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
428a1219
Commit
428a1219
authored
Oct 02, 2023
by
Daniel Lehman
Committed by
Alexandre Julliard
Oct 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Add ReadEventLogW tests for EventLogStarted.
parent
77b50670
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
0 deletions
+105
-0
eventlog.c
dlls/advapi32/tests/eventlog.c
+80
-0
Makefile.in
include/Makefile.in
+1
-0
netevent.h
include/netevent.h
+24
-0
No files found.
dlls/advapi32/tests/eventlog.c
View file @
428a1219
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include "wmistr.h"
#include "wmistr.h"
#include "evntprov.h"
#include "evntprov.h"
#include "evntrace.h"
#include "evntrace.h"
#include "netevent.h"
#include "wine/test.h"
#include "wine/test.h"
...
@@ -1316,6 +1317,83 @@ done:
...
@@ -1316,6 +1317,83 @@ done:
DeleteFileA
(
filepath
);
DeleteFileA
(
filepath
);
}
}
static
void
test_eventlog_start
(
void
)
{
BOOL
ret
,
found
;
HANDLE
handle
,
handle2
;
EVENTLOGRECORD
*
record
;
DWORD
size
,
read
,
needed
;
WCHAR
*
sourcename
,
*
computername
,
*
localcomputer
;
size
=
MAX_COMPUTERNAME_LENGTH
+
1
;
localcomputer
=
malloc
(
size
*
sizeof
(
WCHAR
));
GetComputerNameW
(
localcomputer
,
&
size
);
handle
=
OpenEventLogW
(
0
,
L"System"
);
handle2
=
OpenEventLogW
(
0
,
L"System"
);
todo_wine
ok
(
handle
!=
handle2
,
"Expected different handle
\n
"
);
CloseEventLog
(
handle2
);
handle2
=
OpenEventLogW
(
0
,
L"SYSTEM"
);
ok
(
!!
handle2
,
"Expected valid handle
\n
"
);
CloseEventLog
(
handle2
);
ret
=
TRUE
;
found
=
FALSE
;
while
(
!
found
&&
ret
)
{
read
=
needed
=
0
;
record
=
malloc
(
sizeof
(
EVENTLOGRECORD
));
if
(
!
(
ret
=
ReadEventLogW
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_BACKWARDS_READ
,
0
,
record
,
sizeof
(
EVENTLOGRECORD
),
&
read
,
&
needed
))
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
{
record
=
realloc
(
record
,
needed
);
ret
=
ReadEventLogW
(
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
"
);
sourcename
=
(
WCHAR
*
)(
record
+
1
);
ok
(
!
lstrcmpW
(
sourcename
,
L"EventLog"
),
"Expected 'EventLog', got '%ls'
\n
"
,
sourcename
);
computername
=
sourcename
+
sizeof
(
"EventLog"
);
ok
(
!
lstrcmpiW
(
computername
,
localcomputer
),
"Expected '%ls', got '%ls'
\n
"
,
localcomputer
,
computername
);
size
=
sizeof
(
EVENTLOGRECORD
)
+
sizeof
(
L"EventLog"
)
+
(
lstrlenW
(
computername
)
+
1
)
*
sizeof
(
WCHAR
);
size
=
(
size
+
7
)
&
~
7
;
ok
(
record
->
DataOffset
==
size
||
broken
(
record
->
DataOffset
==
size
-
sizeof
(
WCHAR
)),
/* 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
(
localcomputer
);
}
START_TEST
(
eventlog
)
START_TEST
(
eventlog
)
{
{
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -1349,4 +1427,6 @@ START_TEST(eventlog)
...
@@ -1349,4 +1427,6 @@ START_TEST(eventlog)
/* Trace tests */
/* Trace tests */
test_start_trace
();
test_start_trace
();
test_eventlog_start
();
}
}
include/Makefile.in
View file @
428a1219
...
@@ -561,6 +561,7 @@ SOURCES = \
...
@@ -561,6 +561,7 @@ SOURCES = \
ndrtypes.h
\
ndrtypes.h
\
netcfgx.idl
\
netcfgx.idl
\
netcon.idl
\
netcon.idl
\
netevent.h
\
netfw.idl
\
netfw.idl
\
netioapi.h
\
netioapi.h
\
netiodef.h
\
netiodef.h
\
...
...
include/netevent.h
0 → 100644
View file @
428a1219
/*
* Copyright 2023 Daniel Lehman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _NETEVENT_
#define _NETEVENT_
#define EVENT_EventlogStarted 0x80001775
#endif
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