diff --git a/src/win32/registry.c b/src/win32/registry.c index 64383a2b366a3347b9160e87e87b1dd61ec9ea68..cead0908150a65972869f763a5ee7a0fac3eb206 100644 --- a/src/win32/registry.c +++ b/src/win32/registry.c @@ -1,4 +1,5 @@ #include "registry.h" +#include <shlobj.h> wchar_t* readRegKey(HKEY hKey, LPCWSTR regSubKey, LPCWSTR val) { wchar_t *wret = (wchar_t*)malloc(MAX_PATH); @@ -131,3 +132,10 @@ wchar_t* getUserSID(LPCWSTR homePath) { } return NULL; } + +wchar_t* shGetUsrPath(){ + static WCHAR path[MAX_PATH]; + memset(path, L'\0', MAX_PATH); + SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path); + return path; +} diff --git a/src/win32/registry.h b/src/win32/registry.h index 9299ca13d7c7cc6c007d29291f2c794b5aad025f..f184223fd4ee3d49fd17d1e7749a13d42f2077b6 100644 --- a/src/win32/registry.h +++ b/src/win32/registry.h @@ -13,6 +13,7 @@ wchar_t* readRegKey(HKEY hKey, LPCWSTR regSubKey, LPCWSTR val); wchar_t* getTapGUID(); wchar_t* getTapName(); wchar_t* getUserSID(LPCWSTR homePath); +wchar_t* shGetUsrPath(); wchar_t* regWGetUsrPath(); char* regGetUsrPath();