4141LogonUserExExWHelper (wchar_t * user_name , wchar_t * domain , wchar_t * password , DWORD logon_type ,
4242 DWORD logon_provider , PTOKEN_GROUPS token_groups , PHANDLE token , PSID * logon_sid ,
4343 PVOID * profile_buffer , LPDWORD profile_length , PQUOTA_LIMITS quota_limits )
44- {
44+ {
4545 wchar_t sspicli_dll_path [MAX_PATH + 1 ] = { 0 , };
46+ wchar_t advapi32_dll_path [MAX_PATH + 1 ] = { 0 , };
4647 wchar_t system32_path [MAX_PATH + 1 ] = { 0 , };
4748
4849 if (!GetSystemDirectoryW (system32_path , _countof (system32_path ))) {
@@ -51,14 +52,23 @@ LogonUserExExWHelper(wchar_t *user_name, wchar_t *domain, wchar_t *password, DWO
5152 }
5253 wcsncpy_s (sspicli_dll_path , _countof (sspicli_dll_path ), system32_path , wcsnlen (system32_path , _countof (system32_path )) + 1 );
5354 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" );
5457
55- if (hMod == NULL )
58+ if (hMod == NULL ) {
5659 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 );
5766
5867 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 ());
6069 return FALSE;
61- }
70+ }
71+
6272 if (func == NULL )
6373 func = (LogonUserExExWType )GetProcAddress (hMod , "LogonUserExExW" );
6474
0 commit comments