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
8c91e484
Commit
8c91e484
authored
Dec 23, 2023
by
Daniel Lehman
Committed by
Alexandre Julliard
Jan 31, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Reduce reallocations.
parent
2de6cd5d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
eventlog.c
dlls/advapi32/tests/eventlog.c
+11
-7
No files found.
dlls/advapi32/tests/eventlog.c
View file @
8c91e484
...
...
@@ -1323,19 +1323,21 @@ done:
static
BOOL
read_record
(
HANDLE
handle
,
DWORD
flags
,
DWORD
offset
,
EVENTLOGRECORD
**
record
,
DWORD
*
size
)
{
DWORD
read
;
DWORD
read
,
needed
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
memset
(
*
record
,
0
,
*
size
);
if
(
!
(
ret
=
ReadEventLogW
(
handle
,
flags
,
offset
,
*
record
,
*
size
,
&
read
,
size
))
&&
needed
=
0
;
if
(
!
(
ret
=
ReadEventLogW
(
handle
,
flags
,
offset
,
*
record
,
*
size
,
&
read
,
&
needed
))
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
{
free
(
*
record
);
*
record
=
malloc
(
*
size
);
*
record
=
malloc
(
needed
);
SetLastError
(
0xdeadbeef
);
memset
(
*
record
,
0
,
*
size
);
ret
=
ReadEventLogW
(
handle
,
flags
,
offset
,
*
record
,
*
size
,
&
read
,
size
);
memset
(
*
record
,
0
,
needed
);
*
size
=
needed
;
ret
=
ReadEventLogW
(
handle
,
flags
,
offset
,
*
record
,
*
size
,
&
read
,
&
needed
);
}
return
ret
;
...
...
@@ -1560,7 +1562,8 @@ static void test_eventlog_start(void)
/* change how */
ret
=
read_record
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
100
,
&
record
,
&
size
);
ok
(
ret
,
"Expected success : %ld
\n
"
,
GetLastError
());
ok
(
record
->
RecordNumber
==
4
,
"Expected 4, got %lu
\n
"
,
record
->
RecordNumber
);
ok
(
record
->
RecordNumber
==
4
||
broken
(
record
->
RecordNumber
==
5
)
/* some win10 22h2 */
,
"Expected 4, got %lu
\n
"
,
record
->
RecordNumber
);
/* change direction */
ret
=
read_record
(
handle
,
EVENTLOG_SEEK_READ
|
EVENTLOG_BACKWARDS_READ
,
10
,
&
record
,
&
size
);
ok
(
ret
,
"Expected success : %ld
\n
"
,
GetLastError
());
...
...
@@ -1591,7 +1594,8 @@ static void test_eventlog_start(void)
/* change how */
ret
=
read_record
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_BACKWARDS_READ
,
100
,
&
record
,
&
size
);
ok
(
ret
,
"Expected success : %ld
\n
"
,
GetLastError
());
ok
(
record
->
RecordNumber
==
3
,
"Expected 3, got %lu
\n
"
,
record
->
RecordNumber
);
ok
(
record
->
RecordNumber
==
3
||
broken
(
record
->
RecordNumber
==
2
)
/* some win10 22h2 */
,
"Expected 3, got %lu
\n
"
,
record
->
RecordNumber
);
/* change direction */
ret
=
read_record
(
handle
,
EVENTLOG_SEEK_READ
|
EVENTLOG_FORWARDS_READ
,
10
,
&
record
,
&
size
);
ok
(
ret
,
"Expected success : %ld
\n
"
,
GetLastError
());
...
...
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