}
else if (error != ERROR_MOD_NOT_FOUND) return 1;
+ imports.advapi32 = get_dll(_T("advapi32.dll"), &error);
+ if (imports.advapi32) {
+ imports.CreateWellKnownSid = (CreateWellKnownSid_ptr) get_import(imports.advapi32, "CreateWellKnownSid", &error);
+ if (! imports.CreateWellKnownSid) {
+ if (error != ERROR_PROC_NOT_FOUND) return 6;
+ }
+ imports.IsWellKnownSid = (IsWellKnownSid_ptr) get_import(imports.advapi32, "IsWellKnownSid", &error);
+ if (! imports.IsWellKnownSid) {
+ if (error != ERROR_PROC_NOT_FOUND) return 7;
+ }
+ }
+ else if (error != ERROR_MOD_NOT_FOUND) return 5;
+
return 0;
}
void free_imports() {
if (imports.kernel32) FreeLibrary(imports.kernel32);
+ if (imports.advapi32) FreeLibrary(imports.advapi32);
ZeroMemory(&imports, sizeof(imports));
}
typedef BOOL (WINAPI *AttachConsole_ptr)(DWORD);
typedef BOOL (WINAPI *SleepConditionVariableCS_ptr)(PCONDITION_VARIABLE, PCRITICAL_SECTION, DWORD);
typedef void (WINAPI *WakeConditionVariable_ptr)(PCONDITION_VARIABLE);
+typedef BOOL (WINAPI *CreateWellKnownSid_ptr)(WELL_KNOWN_SID_TYPE, SID *, SID *, unsigned long *);
+typedef BOOL (WINAPI *IsWellKnownSid_ptr)(SID *, WELL_KNOWN_SID_TYPE);
typedef struct {
HMODULE kernel32;
+ HMODULE advapi32;
AttachConsole_ptr AttachConsole;
SleepConditionVariableCS_ptr SleepConditionVariableCS;
WakeConditionVariable_ptr WakeConditionVariable;
+ CreateWellKnownSid_ptr CreateWellKnownSid;
+ IsWellKnownSid_ptr IsWellKnownSid;
} imports_t;
HMODULE get_dll(const TCHAR *, unsigned long *);