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

advapi32: Add some input parameter checks to BackupEventLog.

parent b90ef8c6
......@@ -64,8 +64,14 @@ static inline LPWSTR SERV_dup( LPCSTR str )
*/
BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
{
FIXME("(%p,%s) stub\n", hEventLog, debugstr_a(lpBackupFileName));
return TRUE;
LPWSTR backupW;
BOOL ret;
backupW = SERV_dup(lpBackupFileName);
ret = BackupEventLogW(hEventLog, backupW);
HeapFree(GetProcessHeap(), 0, backupW);
return ret;
}
/******************************************************************************
......@@ -76,6 +82,25 @@ BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName )
BOOL WINAPI BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName )
{
FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName));
if (!lpBackupFileName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!hEventLog)
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
if (GetFileAttributesW(lpBackupFileName) != INVALID_FILE_ATTRIBUTES)
{
SetLastError(ERROR_ALREADY_EXISTS);
return FALSE;
}
return TRUE;
}
......
......@@ -223,15 +223,11 @@ static void test_backup(void)
SetLastError(0xdeadbeef);
ret = BackupEventLogA(NULL, NULL);
todo_wine
{
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
SetLastError(0xdeadbeef);
ret = BackupEventLogA(NULL, backup);
todo_wine
ok(!ret, "Expected failure\n");
ok(GetFileAttributesA(backup) == INVALID_FILE_ATTRIBUTES, "Expected no backup file\n");
......@@ -239,11 +235,8 @@ static void test_backup(void)
SetLastError(0xdeadbeef);
ret = BackupEventLogA(handle, NULL);
todo_wine
{
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
ret = BackupEventLogA(handle, backup);
ok(ret, "Expected succes\n");
......
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