Commit e94c1ce3 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

advapi32: Add some input parameter checks to OpenBackupEventLog.

parent 381533e5
......@@ -378,8 +378,16 @@ BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent )
*/
HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
{
FIXME("(%s,%s) stub\n", debugstr_a(lpUNCServerName), debugstr_a(lpFileName));
return (HANDLE)0xcafe4242;
LPWSTR uncnameW, filenameW;
HANDLE handle;
uncnameW = SERV_dup(lpUNCServerName);
filenameW = SERV_dup(lpFileName);
handle = OpenBackupEventLogW(uncnameW, filenameW);
HeapFree(GetProcessHeap(), 0, uncnameW);
HeapFree(GetProcessHeap(), 0, filenameW);
return handle;
}
/******************************************************************************
......@@ -390,6 +398,26 @@ HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName )
HANDLE WINAPI OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName )
{
FIXME("(%s,%s) stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpFileName));
if (!lpFileName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return NULL;
}
if (lpUNCServerName && lpUNCServerName[0])
{
FIXME("Remote server not supported\n");
SetLastError(RPC_S_SERVER_UNAVAILABLE);
return NULL;
}
if (GetFileAttributesW(lpFileName) == INVALID_FILE_ATTRIBUTES)
{
SetLastError(ERROR_FILE_NOT_FOUND);
return NULL;
}
return (HANDLE)0xcafe4242;
}
......
......@@ -413,37 +413,25 @@ static void test_openbackup(void)
SetLastError(0xdeadbeef);
handle = OpenBackupEventLogA(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 = OpenBackupEventLogA(NULL, "idontexist.evt");
todo_wine
{
ok(handle == NULL, "Didn't expect a handle\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
}
SetLastError(0xdeadbeef);
handle = OpenBackupEventLogA("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 = OpenBackupEventLogA("IDontExist", "idontexist.evt");
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());
}
/* Make a backup eventlog to work with */
DeleteFileA(backup);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment