41
41
LogonUserExExWHelper (wchar_t * user_name , wchar_t * domain , wchar_t * password , DWORD logon_type ,
42
42
DWORD logon_provider , PTOKEN_GROUPS token_groups , PHANDLE token , PSID * logon_sid ,
43
43
PVOID * profile_buffer , LPDWORD profile_length , PQUOTA_LIMITS quota_limits )
44
- {
44
+ {
45
45
wchar_t sspicli_dll_path [MAX_PATH + 1 ] = { 0 , };
46
+ wchar_t advapi32_dll_path [MAX_PATH + 1 ] = { 0 , };
46
47
wchar_t system32_path [MAX_PATH + 1 ] = { 0 , };
47
48
48
49
if (!GetSystemDirectoryW (system32_path , _countof (system32_path ))) {
@@ -51,14 +52,23 @@ LogonUserExExWHelper(wchar_t *user_name, wchar_t *domain, wchar_t *password, DWO
51
52
}
52
53
wcsncpy_s (sspicli_dll_path , _countof (sspicli_dll_path ), system32_path , wcsnlen (system32_path , _countof (system32_path )) + 1 );
53
54
wcscat_s (sspicli_dll_path , _countof (sspicli_dll_path ), L"\\sspicli.dll" );
55
+ wcsncpy_s (advapi32_dll_path , _countof (advapi32_dll_path ), system32_path , wcsnlen (system32_path , _countof (system32_path )) + 1 );
56
+ wcscat_s (advapi32_dll_path , _countof (advapi32_dll_path ), L"\\advapi32.dll" );
54
57
55
- if (hMod == NULL )
58
+ if (hMod == NULL ) {
56
59
hMod = LoadLibraryW (sspicli_dll_path );
60
+ if (hMod == NULL )
61
+ debug3 ("Failed to retrieve the module handle of sspicli.dll with error %d" , GetLastError ());
62
+ }
63
+
64
+ if (hMod == NULL )
65
+ hMod = LoadLibraryW (advapi32_dll_path );
57
66
58
67
if (hMod == NULL ) {
59
- debug3 ("Failed to retrieve the module handle of sspicli .dll with error %d" , GetLastError ());
68
+ debug3 ("Failed to retrieve the module handle of advapi32 .dll with error %d" , GetLastError ());
60
69
return FALSE;
61
- }
70
+ }
71
+
62
72
if (func == NULL )
63
73
func = (LogonUserExExWType )GetProcAddress (hMod , "LogonUserExExW" );
64
74
0 commit comments