20 #include <freerdp/config.h>
22 #include <winpr/tchar.h>
23 #include <winpr/windows.h>
25 #include "wf_settings.h"
27 BOOL wf_settings_read_dword(HKEY key, LPCSTR subkey, LPTSTR name, DWORD* value)
35 status = RegOpenKeyExA(key, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
37 if (status == ERROR_SUCCESS)
39 dwSize =
sizeof(DWORD);
41 status = RegQueryValueEx(hKey, name, NULL, &dwType, (BYTE*)&dwValue, &dwSize);
43 if (status == ERROR_SUCCESS)
48 return (status == ERROR_SUCCESS) ? TRUE : FALSE;
54 BOOL wf_settings_read_string_ascii(HKEY key, LPCSTR subkey, LPTSTR name,
char** value)
64 status = RegOpenKeyExA(key, subkey, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
66 if (status != ERROR_SUCCESS)
69 status = RegQueryValueEx(hKey, name, NULL, &dwType, NULL, &dwSize);
71 if (status == ERROR_SUCCESS)
73 strX = (LPTSTR)malloc(dwSize +
sizeof(TCHAR));
76 status = RegQueryValueEx(hKey, name, NULL, &dwType, (BYTE*)strX, &dwSize);
78 if (status != ERROR_SUCCESS)
89 length = WideCharToMultiByte(CP_UTF8, 0, strX, lstrlenW(strX), NULL, 0, NULL, NULL);
90 strA = (
char*)malloc(length + 1);
91 WideCharToMultiByte(CP_UTF8, 0, strX, lstrlenW(strX), strA, length, NULL, NULL);