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

advapi32/tests: Add some BackupEventLog tests.

parent f2aa80f7
...@@ -215,6 +215,54 @@ static void test_oldest(void) ...@@ -215,6 +215,54 @@ static void test_oldest(void)
CloseEventLog(handle); CloseEventLog(handle);
} }
static void test_backup(void)
{
HANDLE handle;
BOOL ret;
const char backup[] = "backup.evt";
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");
handle = OpenEventLogA(NULL, "Application");
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");
todo_wine
ok(GetFileAttributesA("backup.evt") != INVALID_FILE_ATTRIBUTES, "Expected a backup file\n");
/* Try to overwrite */
SetLastError(0xdeadbeef);
ret = BackupEventLogA(handle, backup);
todo_wine
{
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_ALREADY_EXISTS, "Expected ERROR_ALREADY_EXISTS, got %d\n", GetLastError());
}
CloseEventLog(handle);
DeleteFileA(backup);
}
START_TEST(eventlog) START_TEST(eventlog)
{ {
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -232,4 +280,5 @@ START_TEST(eventlog) ...@@ -232,4 +280,5 @@ START_TEST(eventlog)
test_info(); test_info();
test_count(); test_count();
test_oldest(); test_oldest();
test_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