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
8986f6fa
Commit
8986f6fa
authored
Jun 04, 2022
by
Daniel Lehman
Committed by
Alexandre Julliard
Jun 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Test if FormatMessage modifies va_list on error.
Signed-off-by:
Daniel Lehman
<
dlehman25@gmail.com
>
parent
dd95979b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
format_msg.c
dlls/kernel32/tests/format_msg.c
+22
-0
No files found.
dlls/kernel32/tests/format_msg.c
View file @
8986f6fa
...
...
@@ -1005,6 +1005,25 @@ static void test_message_wrap(void)
ok
(
!
strcmp
(
"short
\r\n
long?line"
,
out
),
"failed out=[%s]
\n
"
,
out
);
}
static
void
test_message_arg_eaten
(
const
WCHAR
*
src
,
...
)
{
DWORD
ret
;
va_list
list
;
WCHAR
*
arg
,
out
[
1
];
out
[
0
]
=
0xcccc
;
va_start
(
list
,
src
);
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageW
(
FORMAT_MESSAGE_FROM_STRING
,
src
,
0
,
0
,
out
,
ARRAY_SIZE
(
out
),
&
list
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected GetLastError() to return ERROR_INSUFFICIENT_BUFFER, got %lu
\n
"
,
GetLastError
());
ok
(
ret
==
0
,
"Expected FormatMessageW to return 0, got %lu
\n
"
,
ret
);
ok
(
out
[
0
]
==
0
,
"Expected null, got %ls
\n
"
,
out
);
arg
=
va_arg
(
list
,
WCHAR
*
);
ok
(
!
wcscmp
(
L"unused"
,
arg
),
"Expected 'unused', got %s
\n
"
,
wine_dbgstr_w
(
arg
));
va_end
(
list
);
}
static
void
test_message_insufficient_buffer
(
void
)
{
static
const
char
init_buf
[]
=
{
'x'
,
'x'
,
'x'
,
'x'
,
'x'
};
...
...
@@ -1153,6 +1172,9 @@ static void test_message_insufficient_buffer_wide(void)
HeapFree
(
GetProcessHeap
(),
0
,
tmp
);
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
}
/* va_arg is eaten even in case of insufficient buffer */
test_message_arg_eaten
(
L"%1!s! %2!s!"
,
L"eaten"
,
L"unused"
);
}
static
void
test_message_null_buffer
(
void
)
...
...
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