mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 12:34:09 +00:00
advapi32/tests: Add some more EventLog tests.
This commit is contained in:
parent
8c91e484cb
commit
452b59bb4f
|
@ -1347,8 +1347,8 @@ static void test_eventlog_start(void)
|
|||
{
|
||||
BOOL ret, found;
|
||||
HANDLE handle, handle2;
|
||||
EVENTLOGRECORD *record;
|
||||
DWORD size, count, read, needed;
|
||||
EVENTLOGRECORD *record, *record2;
|
||||
DWORD size, size2, count, count2, read, needed;
|
||||
WCHAR *sourcename, *computername, *localcomputer;
|
||||
char *sourcenameA, *computernameA, *localcomputerA;
|
||||
|
||||
|
@ -1547,6 +1547,14 @@ static void test_eventlog_start(void)
|
|||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
count = 0xdeadbeef;
|
||||
ret = GetNumberOfEventLogRecords(handle, &count);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
ret = read_record(handle, EVENTLOG_SEEK_READ | EVENTLOG_FORWARDS_READ, count + 1, &record, &size);
|
||||
ok(!ret, "Expected failure\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
||||
|
||||
todo_wine {
|
||||
ret = read_record(handle, EVENTLOG_SEEK_READ | EVENTLOG_FORWARDS_READ, 2, &record, &size);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
|
@ -1603,6 +1611,44 @@ static void test_eventlog_start(void)
|
|||
}
|
||||
CloseEventLog(handle);
|
||||
|
||||
/* reading same log with different handles */
|
||||
handle = OpenEventLogW(0, L"System");
|
||||
handle2 = OpenEventLogW(0, L"SYSTEM");
|
||||
todo_wine {
|
||||
ret = read_record(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, 0, &record, &size);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
ok(record->RecordNumber == 1, "Expected 1, got %lu\n", record->RecordNumber);
|
||||
ret = read_record(handle2, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, 0, &record, &size);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
ok(record->RecordNumber == 1, "Expected 1, got %lu\n", record->RecordNumber);
|
||||
}
|
||||
CloseEventLog(handle2);
|
||||
CloseEventLog(handle);
|
||||
|
||||
/* using source name */
|
||||
size2 = size;
|
||||
record2 = malloc(size2);
|
||||
handle = OpenEventLogW(0, L"System");
|
||||
handle2 = OpenEventLogW(0, L"EventLog");
|
||||
todo_wine {
|
||||
ret = read_record(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, 0, &record, &size);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
ret = read_record(handle2, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, 0, &record2, &size2);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
}
|
||||
ok(size == size2, "Expected %lu, got %lu\n", size, size2);
|
||||
ok(!memcmp(record, record2, min(size, size2)), "Records miscompare\n");
|
||||
count = 0xdeadbeef;
|
||||
count2 = 0xdeadbeef;
|
||||
ret = GetNumberOfEventLogRecords(handle, &count);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
ret = GetNumberOfEventLogRecords(handle2, &count2);
|
||||
ok(ret, "Expected success : %ld\n", GetLastError());
|
||||
ok(count == count2, "Expected %lu, got %lu\n", count, count2);
|
||||
CloseEventLog(handle2);
|
||||
CloseEventLog(handle);
|
||||
|
||||
free(record2);
|
||||
free(record);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue