Merge pull request #2 from vyvojar/master
[WindowsD.git] / defs.h
blob951927c8c17d7cb7b14c168ee46620214ee48519
1 // ONLY macros
3 #define LOADER_ID 10
4 #define SYS_ID 20
5 #define DLL_ID 30
7 #ifdef _WIN64
8 #define BITS "64"
9 #define ENTRY(x) _##x
10 #else
11 #define ENTRY(x) x
12 #define BITS "32"
13 #endif
15 #define BASENAME "WinD" BITS
17 #define RTL_STRING(s) ((UNICODE_STRING){sizeof(s)-sizeof((s)[0]),sizeof(s),(s)})
19 #define RVA2PTR(base,rva) ((void*)(((PCHAR) base) + rva))
20 #define ID_SeLoadDriverPrivilege 10
21 #define LUID_SeLoadDriverPrivilege (LUID){ID_SeLoadDriverPrivilege,0}
23 #define FILE_VBS "wind-restorepoint.vbs"
24 #define RESTORE_VBS \
25 "set obj=GetObject(\"winmgmts:\\\\.\\root\\default:Systemrestore\")\nobj.Enable(\"\")\n" \
26 "obj.CreateRestorePoint \"%s\", 0, 100\nWScript.Quit 123"
28 #define POLICY_KEY "System\\CurrentControlSet\\Control\\ProductOptions"
29 #define PRODUCT_POLICY "ProductPolicy"
30 #define CUSTOM_POLICY "CustomPolicy"
32 #define NT_MACHINE L"\\Registry\\Machine\\"
34 #define POLICY_PATH NT_MACHINE POLICY_KEY
35 #define SVC_BASE NT_MACHINE "System\\CurrentControlSet\\Services\\"
36 #define LOAD_ATTEMPTS 8
38 #ifndef NDEBUG
39 #ifdef _WIND_DRIVER
40 #define DBG(x...) DbgPrint("WIND: " x);
41 #else
42 //#define DBG(x...) { printf("! %s:%d@%s(): ",__FILE__,__LINE__,__func__); printf(x); printf("\n"); }
43 #define DBG(x...) { \
44 char _buf[512]; \
45 sprintf(_buf + sprintf(_buf, "WIND: %s:%d@%s(): ",__FILE__,__LINE__,__func__), x); \
46 strcat(_buf, "\n"); \
47 OutputDebugStringA(_buf); \
49 #endif
50 #else
51 #define DBG(x...)
52 #endif
54 #define RTL_QUERY_REGISTRY_TYPECHECK 0x00000100
55 #define RTL_QUERY_REGISTRY_TYPECHECK_SHIFT 24
57 #define WIN7 (cfg.protbit >= 0)
58 #define SystemModuleInformation 0xb
59 #define SystemBootEnvironmentInformation 0x5a
60 #define SystemCodeIntegrityInformation 0x67
61 #define SystemSecureBootPolicyInformation 0x8f
64 #define WSKIP(p) while (*p == L' ' || *p == L'\t') p++;
65 #define EQUALS(a,b) (RtlCompareMemory(a,b,sizeof(b)-1)==(sizeof(b)-1))