Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1be99033
Commit
1be99033
authored
Oct 29, 2009
by
Louis Lenders
Committed by
Alexandre Julliard
Oct 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add more tests for FormatMessageA.
parent
290c5de8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
format_msg.c
dlls/kernel32/tests/format_msg.c
+53
-0
No files found.
dlls/kernel32/tests/format_msg.c
View file @
1be99033
...
...
@@ -647,9 +647,62 @@ static void test_message_null_buffer(void)
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"last error %u
\n
"
,
error
);
}
static
void
test_message_from_hmodule
(
void
)
{
DWORD
ret
,
error
;
HMODULE
h
;
CHAR
out
[
0x100
]
=
{
0
};
h
=
GetModuleHandle
(
"kernel32.dll"
);
ok
(
h
!=
0
,
"GetModuleHandle failed
\n
"
);
/*Test existing messageID; as the message strings from wine's kernel32 differ from windows' kernel32 we don't compare
the strings but only test that FormatMessage doesn't return 0*/
ret
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_HMODULE
,
h
,
7
/*=ERROR_ARENA_TRASHED*/
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_NEUTRAL
),
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
ok
(
ret
!=
0
,
"FormatMessageA returned 0
\n
"
);
/*Test non existing messageID with varying language ID's Note: FormatMessageW behaves the same*/
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_HMODULE
,
h
,
3044
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_NEUTRAL
),
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
error
=
GetLastError
();
ok
(
ret
==
0
,
"FormatMessageA returned %u instead of 0
\n
"
,
ret
);
todo_wine
ok
(
error
==
ERROR_MR_MID_NOT_FOUND
,
"last error %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_HMODULE
,
h
,
3044
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_DEFAULT
),
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
error
=
GetLastError
();
ok
(
ret
==
0
,
"FormatMessageA returned %u instead of 0
\n
"
,
ret
);
todo_wine
ok
(
error
==
ERROR_MR_MID_NOT_FOUND
,
"last error %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_HMODULE
,
h
,
3044
,
MAKELANGID
(
LANG_NEUTRAL
,
SUBLANG_SYS_DEFAULT
),
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
error
=
GetLastError
();
ok
(
ret
==
0
,
"FormatMessageA returned %u instead of 0
\n
"
,
ret
);
todo_wine
ok
(
error
==
ERROR_MR_MID_NOT_FOUND
,
"last error %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_HMODULE
,
h
,
3044
,
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
error
=
GetLastError
();
ok
(
ret
==
0
,
"FormatMessageA returned %u instead of 0
\n
"
,
ret
);
todo_wine
ok
(
error
==
ERROR_MR_MID_NOT_FOUND
,
"last error %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
FormatMessageA
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_FROM_HMODULE
,
h
,
3044
,
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_UK
),
out
,
sizeof
(
out
)
/
sizeof
(
CHAR
),
NULL
);
error
=
GetLastError
();
ok
(
ret
==
0
,
"FormatMessageA returned %u instead of 0
\n
"
,
ret
);
ok
(
error
==
ERROR_RESOURCE_LANG_NOT_FOUND
,
"last error %u
\n
"
,
error
);
}
START_TEST
(
format_msg
)
{
test_message_from_string
();
test_message_from_string_wide
();
test_message_null_buffer
();
test_message_from_hmodule
();
}
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