-
Notifications
You must be signed in to change notification settings - Fork 36
/
query.c
59 lines (58 loc) · 1.37 KB
/
query.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <Windows.h>
#include <stdio.h>
#include "../common.h"
int main()
{
BOOL bOk = FALSE;
HKEY hKey;
if (RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
PRODUCT_OPTIONS_STR,
0,
KEY_READ,
&hKey
) == ERROR_SUCCESS)
{
LPDWORD ResultLength = 0;
if (RegGetValueW(
hKey,
NULL,
PRODUCT_POLICY_STR,
RRF_RT_REG_BINARY,
NULL,
NULL,
&ResultLength
) == ERROR_SUCCESS)
{
void* buffer = malloc(ResultLength);
if (buffer)
{
if (RegGetValueW(
hKey,
NULL,
PRODUCT_POLICY_STR,
RRF_RT_REG_BINARY,
NULL,
buffer,
&ResultLength
) == ERROR_SUCCESS)
{
ULONG uEdit = 0;
HandlePolicyBinary(
ResultLength,
buffer,
&uEdit
);
printf("%lu\n", uEdit);
bOk = TRUE;
}
free(buffer);
}
}
}
if (!bOk)
{
printf("%ld\n", -1);
}
return 0;
}