Changeset 6312c431a02c…
Parent 324626306cc4…
by
Changes to 2 files · Browse files at 6312c431a02c Showing diff from parent 324626306cc4 Diff from another changeset...
@@ -1,5 +1,7 @@ #include "stdafx.h"
#include "TortoiseUtils.h"
+
+#include <vector>
#include <assert.h>
#include <io.h>
@@ -254,3 +256,26 @@ return f;
}
+
+// read string value from registry
+int GetRegSZValue(HKEY hkey, const char* name, std::string& res)
+{
+ res = "";
+
+ if (!hkey)
+ return 0;
+
+ std::vector<BYTE> Data(300);
+ DWORD cbData = Data.size();
+
+ LONG rv = ::RegQueryValueExA(hkey, name, 0, 0, &Data[0], &cbData);
+
+ if (rv == ERROR_SUCCESS)
+ {
+ res = reinterpret_cast<char*>(&Data[0]);
+ return 1;
+ }
+
+ return 0;
+}
+
|
@@ -23,5 +23,6 @@ bool IsHgRepo(const std::string& path);
int GetRegistryConfig(const std::string& name, std::string& res);
FILE* fopenReadRenameAllowed(const char* path);
+int GetRegSZValue(HKEY hkey, const char* name, std::string& res);
#endif
|
Loading...