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
b34ec645
Commit
b34ec645
authored
Oct 13, 2023
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Avoid unneeded reallocations of the ReadEventLog() buffer.
Also we don't care about the content of the buffer so using HeapRealloc() makes no sense.
parent
e0c3530a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
eventlog.c
dlls/advapi32/tests/eventlog.c
+10
-5
No files found.
dlls/advapi32/tests/eventlog.c
View file @
b34ec645
...
...
@@ -780,6 +780,7 @@ static void test_readwrite(void)
DWORD
i
;
char
*
localcomputer
=
NULL
;
DWORD
size
;
void
*
buf
;
if
(
pCreateWellKnownSid
)
{
...
...
@@ -962,9 +963,10 @@ static void test_readwrite(void)
handle
=
OpenEventLogA
(
NULL
,
eventlogname
);
ok
(
handle
!=
NULL
,
"OpenEventLogA(%s) failed : %ld
\n
"
,
eventlogname
,
GetLastError
());
i
=
0
;
size
=
sizeof
(
EVENTLOGRECORD
)
+
128
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
for
(;;)
{
void
*
buf
;
DWORD
read
,
needed
;
EVENTLOGRECORD
*
record
;
char
*
sourcename
,
*
computername
;
...
...
@@ -973,7 +975,6 @@ static void test_readwrite(void)
BOOL
run_sidtests
=
read_write
[
i
].
evt_sid
&
sidavailable
;
winetest_push_context
(
"%lu"
,
i
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
EVENTLOGRECORD
));
SetLastError
(
0xdeadbeef
);
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
...
...
@@ -981,13 +982,17 @@ static void test_readwrite(void)
ok
(
!
ret
,
"Expected failure
\n
"
);
if
(
!
ret
&&
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
{
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
ok
(
GetLastError
()
==
ERROR_HANDLE_EOF
,
"record %ld, got %ld
\n
"
,
i
,
GetLastError
());
winetest_pop_context
();
break
;
}
buf
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
buf
,
needed
);
if
(
needed
>
size
)
{
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
size
=
needed
;
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
}
ret
=
ReadEventLogA
(
handle
,
EVENTLOG_SEQUENTIAL_READ
|
EVENTLOG_FORWARDS_READ
,
0
,
buf
,
needed
,
&
read
,
&
needed
);
ok
(
ret
,
"Expected success: %ld
\n
"
,
GetLastError
());
...
...
@@ -1057,10 +1062,10 @@ static void test_readwrite(void)
ok
(
record
->
Length
==
*
(
DWORD
*
)((
BYTE
*
)
buf
+
record
->
Length
-
sizeof
(
DWORD
)),
"Expected the closing DWORD to contain the length of the record
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
winetest_pop_context
();
i
++
;
}
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
CloseEventLog
(
handle
);
/* Test clearing a real 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