Commit 5dafeacb authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

advapi32: Add a input parameter check to ClearEventLog.

parent e13ead69
......@@ -107,7 +107,7 @@ BOOL WINAPI BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
/******************************************************************************
* ClearEventLogA [ADVAPI32.@]
*
* Clears the event log and/or saves the log to a backup file.
* Clears the event log and optionally saves the log to a backup file.
*
* PARAMS
* hEvenLog [I] Handle to event log to clear.
......@@ -121,8 +121,14 @@ BOOL WINAPI BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
*/
BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
{
FIXME("(%p,%s) stub\n", hEventLog, debugstr_a(lpBackupFileName));
return TRUE;
LPWSTR backupW;
BOOL ret;
backupW = SERV_dup(lpBackupFileName);
ret = ClearEventLogW(hEventLog, backupW);
HeapFree(GetProcessHeap(), 0, backupW);
return ret;
}
/******************************************************************************
......@@ -132,8 +138,15 @@ BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
*/
BOOL WINAPI ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
{
FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
return TRUE;
FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
if (!hEventLog)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
return TRUE;
}
/******************************************************************************
......
......@@ -508,22 +508,16 @@ static void test_clear(void)
SetLastError(0xdeadbeef);
ret = ClearEventLogA(NULL, NULL);
todo_wine
{
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
}
/* Make a backup eventlog to work with */
create_backup(backup);
SetLastError(0xdeadbeef);
ret = ClearEventLogA(NULL, backup);
todo_wine
{
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
}
handle = OpenBackupEventLogA(NULL, backup);
todo_wine
......@@ -532,20 +526,14 @@ static void test_clear(void)
/* A real eventlog would fail with ERROR_ALREADY_EXISTS */
SetLastError(0xdeadbeef);
ret = ClearEventLogA(handle, backup);
todo_wine
{
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
}
/* Show that ClearEventLog only works for real eventlogs. */
SetLastError(0xdeadbeef);
ret = ClearEventLogA(handle, NULL);
todo_wine
{
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
}
CloseEventLog(handle);
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