Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d2a606bc
Commit
d2a606bc
authored
Oct 02, 2023
by
Daniel Lehman
Committed by
Alexandre Julliard
Oct 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Add ReadEventLogA tests for EventlogStarted.
parent
67bc3495
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
eventlog.c
dlls/advapi32/tests/eventlog.c
+66
-0
No files found.
dlls/advapi32/tests/eventlog.c
View file @
d2a606bc
...
...
@@ -1324,7 +1324,9 @@ static void test_eventlog_start(void)
EVENTLOGRECORD
*
record
;
DWORD
size
,
read
,
needed
;
WCHAR
*
sourcename
,
*
computername
,
*
localcomputer
;
char
*
sourcenameA
,
*
computernameA
,
*
localcomputerA
;
/* ReadEventLogW */
size
=
MAX_COMPUTERNAME_LENGTH
+
1
;
localcomputer
=
malloc
(
size
*
sizeof
(
WCHAR
));
GetComputerNameW
(
localcomputer
,
&
size
);
...
...
@@ -1392,6 +1394,70 @@ static void test_eventlog_start(void)
todo_wine
ok
(
found
,
"EventlogStarted event not found
\n
"
);
CloseEventLog
(
handle
);
free
(
localcomputer
);
/* ReadEventLogA */
size
=
MAX_COMPUTERNAME_LENGTH
+
1
;
localcomputerA
=
malloc
(
size
);
GetComputerNameA
(
localcomputerA
,
&
size
);
handle
=
OpenEventLogA
(
0
,
"System"
);
handle2
=
OpenEventLogA
(
0
,
"SYSTEM"
);
todo_wine
ok
(
handle
!=
handle2
,
"Expected different handle
\n
"
);
CloseEventLog
(
handle2
);
ret
=
TRUE
;
found
=
FALSE
;
while
(
!
found
&&
ret
)
{
read
=
needed
=
0
;
record
=
malloc
(
sizeof
(
EVENTLOGRECORD
));
if
(
!
(
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_BACKWARDS_READ
,
0
,
record
,
sizeof
(
EVENTLOGRECORD
),
&
read
,
&
needed
))
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
{
record
=
realloc
(
record
,
needed
);
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_BACKWARDS_READ
,
0
,
record
,
needed
,
&
read
,
&
needed
);
ok
(
needed
==
0
,
"Expected 0, got %ld
\n
"
,
needed
);
}
if
(
ret
&&
record
->
EventID
==
EVENT_EventlogStarted
)
{
ok
(
record
->
Length
==
read
,
"Expected %ld, got %ld
\n
"
,
read
,
record
->
Length
);
ok
(
record
->
Reserved
==
0x654c664c
,
"Expected 0x654c664c, got %ld
\n
"
,
record
->
Reserved
);
ok
(
record
->
RecordNumber
>
0
,
"Expected 1 or higher, got %ld
\n
"
,
record
->
RecordNumber
);
ok
(
record
->
TimeGenerated
==
record
->
TimeWritten
,
"Expected time values to be the same
\n
"
);
ok
(
record
->
EventType
==
EVENTLOG_INFORMATION_TYPE
,
"Expected %d, got %d
\n
"
,
EVENTLOG_INFORMATION_TYPE
,
record
->
EventType
);
ok
(
record
->
NumStrings
==
0
,
"Expected 0, got %d
\n
"
,
record
->
NumStrings
);
ok
(
record
->
EventCategory
==
0
,
"Expected 0, got %d
\n
"
,
record
->
EventCategory
);
ok
(
record
->
ReservedFlags
==
0
,
"Expected 0, got %d
\n
"
,
record
->
ReservedFlags
);
ok
(
record
->
ClosingRecordNumber
==
0
,
"Expected 0, got %ld
\n
"
,
record
->
ClosingRecordNumber
);
ok
(
record
->
StringOffset
==
record
->
UserSidOffset
,
"Expected offsets to be the same
\n
"
);
ok
(
record
->
UserSidLength
==
0
,
"Expected 0, got %ld
\n
"
,
record
->
UserSidLength
);
ok
(
record
->
DataLength
==
24
,
"Expected 24, got %ld
\n
"
,
record
->
DataLength
);
ok
(
record
->
DataOffset
==
record
->
UserSidOffset
,
"Expected offsets to be the same
\n
"
);
sourcenameA
=
(
char
*
)(
record
+
1
);
ok
(
!
strcmp
(
sourcenameA
,
"EventLog"
),
"Expected 'EventLog', got '%s'
\n
"
,
sourcenameA
);
computernameA
=
sourcenameA
+
sizeof
(
"EventLog"
);
ok
(
!
_stricmp
(
computernameA
,
localcomputerA
),
"Expected '%s', got '%s'
\n
"
,
localcomputerA
,
computernameA
);
size
=
sizeof
(
EVENTLOGRECORD
)
+
sizeof
(
"EventLog"
)
+
strlen
(
computernameA
)
+
1
;
size
=
(
size
+
7
)
&
~
7
;
ok
(
record
->
DataOffset
==
size
||
broken
(
record
->
DataOffset
==
size
-
1
),
/* win8 */
"Expected %ld, got %ld
\n
"
,
size
,
record
->
DataOffset
);
found
=
TRUE
;
}
free
(
record
);
}
todo_wine
ok
(
found
,
"EventlogStarted event not found
\n
"
);
CloseEventLog
(
handle
);
free
(
localcomputerA
);
}
START_TEST
(
eventlog
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment