advapi32/tests: Add some input parameter checks.
This commit is contained in:
parent
48033db67e
commit
84d689bd58
|
@ -29,11 +29,25 @@
|
|||
#include "wmistr.h"
|
||||
#include "evntrace.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(eventlog);
|
||||
|
||||
static inline LPWSTR SERV_dup( LPCSTR str )
|
||||
{
|
||||
UINT len;
|
||||
LPWSTR wstr;
|
||||
|
||||
if( !str )
|
||||
return NULL;
|
||||
len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
||||
wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) );
|
||||
MultiByteToWideChar( CP_ACP, 0, str, -1, wstr, len );
|
||||
return wstr;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* BackupEventLogA [ADVAPI32.@]
|
||||
*
|
||||
|
@ -283,8 +297,16 @@ HANDLE WINAPI OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
|
|||
*/
|
||||
HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
|
||||
{
|
||||
FIXME("(%s,%s) stub\n", debugstr_a(uncname), debugstr_a(source));
|
||||
return (HANDLE)0xcafe4242;
|
||||
LPWSTR uncnameW, sourceW;
|
||||
HANDLE handle;
|
||||
|
||||
uncnameW = SERV_dup(uncname);
|
||||
sourceW = SERV_dup(source);
|
||||
handle = OpenEventLogW(uncnameW, sourceW);
|
||||
HeapFree(GetProcessHeap(), 0, uncnameW);
|
||||
HeapFree(GetProcessHeap(), 0, sourceW);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -294,8 +316,22 @@ HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source )
|
|||
*/
|
||||
HANDLE WINAPI OpenEventLogW( LPCWSTR uncname, LPCWSTR source )
|
||||
{
|
||||
FIXME("(%s,%s) stub\n", debugstr_w(uncname), debugstr_w(source));
|
||||
return (HANDLE)0xcafe4242;
|
||||
FIXME("(%s,%s) stub\n", debugstr_w(uncname), debugstr_w(source));
|
||||
|
||||
if (!source)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (uncname)
|
||||
{
|
||||
FIXME("Remote server not supported\n");
|
||||
SetLastError(RPC_S_SERVER_UNAVAILABLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (HANDLE)0xcafe4242;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -44,29 +44,20 @@ static void test_open_close(void)
|
|||
|
||||
SetLastError(0xdeadbeef);
|
||||
handle = OpenEventLogA(NULL, NULL);
|
||||
todo_wine
|
||||
{
|
||||
ok(handle == NULL, "Didn't expect a handle\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
handle = OpenEventLogA("IDontExist", NULL);
|
||||
todo_wine
|
||||
{
|
||||
ok(handle == NULL, "Didn't expect a handle\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
handle = OpenEventLogA("IDontExist", "deadbeef");
|
||||
todo_wine
|
||||
{
|
||||
ok(handle == NULL, "Didn't expect a handle\n");
|
||||
ok(GetLastError() == RPC_S_SERVER_UNAVAILABLE ||
|
||||
GetLastError() == RPC_S_INVALID_NET_ADDR, /* Some Vista and Win7 */
|
||||
"Expected RPC_S_SERVER_UNAVAILABLE, got %d\n", GetLastError());
|
||||
}
|
||||
|
||||
/* This one opens the Application log */
|
||||
handle = OpenEventLogA(NULL, "deadbeef");
|
||||
|
|
Loading…
Reference in New Issue