Commit 6a5f6716 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

advapi32/tests: Fix a test failure on Vista+.

parent 8d72b37d
...@@ -44,6 +44,9 @@ static void create_backup(const char *filename) ...@@ -44,6 +44,9 @@ static void create_backup(const char *filename)
handle = OpenEventLogA(NULL, "Application"); handle = OpenEventLogA(NULL, "Application");
BackupEventLogA(handle, filename); BackupEventLogA(handle, filename);
CloseEventLog(handle); CloseEventLog(handle);
todo_wine
ok(GetFileAttributesA(filename) != INVALID_FILE_ATTRIBUTES, "Expected a backup file\n");
} }
static void test_open_close(void) static void test_open_close(void)
...@@ -561,6 +564,7 @@ static void test_clear(void) ...@@ -561,6 +564,7 @@ static void test_clear(void)
HANDLE handle; HANDLE handle;
BOOL ret; BOOL ret;
const char backup[] = "backup.evt"; const char backup[] = "backup.evt";
const char backup2[] = "backup2.evt";
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = ClearEventLogA(NULL, NULL); ret = ClearEventLogA(NULL, NULL);
...@@ -583,16 +587,28 @@ static void test_clear(void) ...@@ -583,16 +587,28 @@ static void test_clear(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = ClearEventLogA(handle, backup); ret = ClearEventLogA(handle, backup);
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); /* The eventlog service runs under an account that doesn't have the necessary
* permissions on the users home directory on a default Vista+ system.
*/
ok(GetLastError() == ERROR_INVALID_HANDLE ||
GetLastError() == ERROR_ACCESS_DENIED, /* Vista+ */
"Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
/* Show that ClearEventLog only works for real eventlogs. */ /* Show that ClearEventLog only works for real eventlogs. */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = ClearEventLogA(handle, backup2);
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
ok(GetFileAttributesA(backup2) == INVALID_FILE_ATTRIBUTES, "Expected no backup file\n");
SetLastError(0xdeadbeef);
ret = ClearEventLogA(handle, NULL); ret = ClearEventLogA(handle, NULL);
ok(!ret, "Expected failure\n"); ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
CloseEventLog(handle); CloseEventLog(handle);
DeleteFileA(backup); todo_wine
ok(DeleteFileA(backup), "Could not delete the backup file\n");
} }
START_TEST(eventlog) START_TEST(eventlog)
......
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