advapi32: Forward LogonUserA to LogonUserW.

This commit is contained in:
Hans Leidekker 2013-11-13 15:32:55 +01:00 committed by Alexandre Julliard
parent 02970b578e
commit 7519cddddb
2 changed files with 29 additions and 2 deletions

View file

@ -35,6 +35,8 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "advapi32_misc.h"
WINE_DEFAULT_DEBUG_CHANNEL(advapi); WINE_DEFAULT_DEBUG_CHANNEL(advapi);
/****************************************************************************** /******************************************************************************
@ -268,10 +270,23 @@ BOOL WINAPI InitiateSystemShutdownW( LPWSTR lpMachineName, LPWSTR lpMessage, DWO
BOOL WINAPI LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, BOOL WINAPI LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword,
DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken )
{ {
FIXME("%s %s %p 0x%08x 0x%08x %p - stub\n", debugstr_a(lpszUsername), WCHAR *usernameW = NULL, *domainW = NULL, *passwordW = NULL;
BOOL ret = FALSE;
TRACE("%s %s %p 0x%08x 0x%08x %p\n", debugstr_a(lpszUsername),
debugstr_a(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken); debugstr_a(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken);
return TRUE; if (lpszUsername && !(usernameW = strdupAW( lpszUsername ))) return FALSE;
if (lpszDomain && !(domainW = strdupAW( lpszUsername ))) goto done;
if (lpszPassword && !(passwordW = strdupAW( lpszPassword ))) goto done;
ret = LogonUserW( usernameW, domainW, passwordW, dwLogonType, dwLogonProvider, phToken );
done:
heap_free( usernameW );
heap_free( domainW );
heap_free( passwordW );
return ret;
} }
BOOL WINAPI LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, BOOL WINAPI LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword,

View file

@ -22,6 +22,7 @@
#include "ntsecapi.h" #include "ntsecapi.h"
#include "winsvc.h" #include "winsvc.h"
#include "winnls.h"
const char * debugstr_sid(PSID sid) DECLSPEC_HIDDEN; const char * debugstr_sid(PSID sid) DECLSPEC_HIDDEN;
BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) DECLSPEC_HIDDEN; BOOL ADVAPI_IsLocalComputer(LPCWSTR ServerName) DECLSPEC_HIDDEN;
@ -52,4 +53,15 @@ static inline BOOL heap_free( void *mem )
return HeapFree( GetProcessHeap(), 0, mem ); return HeapFree( GetProcessHeap(), 0, mem );
} }
static inline WCHAR *strdupAW( const char *src )
{
WCHAR *dst = NULL;
if (src)
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
if ((dst = heap_alloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
}
return dst;
}
#endif /* __WINE_ADVAPI32MISC_H */ #endif /* __WINE_ADVAPI32MISC_H */