Skip to content
Snippets Groups Projects
Commit ae9fc900 authored by dmitriy.gerasimov's avatar dmitriy.gerasimov
Browse files

Merge branch 'bugs-2890' into 'master'

Unicode reg path added

See merge request !31
parents a1924cf9 aae747c1
No related branches found
No related tags found
1 merge request!31Unicode reg path added
......@@ -27,6 +27,21 @@ char* regGetUsrPath() {
return path;
}
wchar_t* regWGetUsrPath() {
static wchar_t path[MAX_PATH] = {};
if (wcslen(path) > 3) { return path; }
HKEY hKey;
const char keyPath[] = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
LSTATUS err = RegOpenKeyExA(HKEY_CURRENT_USER,
keyPath,
0, KEY_READ, &hKey );
if (err != ERROR_SUCCESS) { return NULL; }
DWORD len = MAX_PATH;
err = RegGetValueW(hKey, NULL, L"Personal", RRF_RT_REG_SZ, NULL, (void*)path, &len);
RegCloseKey(hKey);
return path;
}
wchar_t* getTapGUID() {
static wchar_t guid[MAX_PATH] = {};
if (wcslen(guid) > 2) { return guid; }
......
......@@ -14,7 +14,8 @@ wchar_t* getTapGUID();
wchar_t* getTapName();
wchar_t* getUserSID(LPCWSTR homePath);
char* regGetUsrPath();
wchar_t* regWGetUsrPath();
char* regGetUsrPath();
#ifdef __cplusplus
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment