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
100131d4
Commit
100131d4
authored
Oct 29, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Propagate the error result from RtlFindMessage in FormatMessage.
parent
b381958f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
format_msg.c
dlls/kernel32/format_msg.c
+14
-14
format_msg.c
dlls/kernel32/tests/format_msg.c
+4
-4
No files found.
dlls/kernel32/format_msg.c
View file @
100131d4
...
...
@@ -72,11 +72,16 @@ static LPWSTR load_messageW( HMODULE module, UINT id, WORD lang )
{
const
MESSAGE_RESOURCE_ENTRY
*
mre
;
WCHAR
*
buffer
;
NTSTATUS
status
;
TRACE
(
"module = %p, id = %08x
\n
"
,
module
,
id
);
if
(
!
module
)
module
=
GetModuleHandleW
(
NULL
);
if
(
RtlFindMessage
(
module
,
RT_MESSAGETABLE
,
lang
,
id
,
&
mre
)
!=
STATUS_SUCCESS
)
return
NULL
;
if
((
status
=
RtlFindMessage
(
module
,
RT_MESSAGETABLE
,
lang
,
id
,
&
mre
))
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
NULL
;
}
if
(
mre
->
Flags
&
MESSAGE_RESOURCE_UNICODE
)
{
...
...
@@ -102,11 +107,16 @@ static LPSTR load_messageA( HMODULE module, UINT id, WORD lang )
{
const
MESSAGE_RESOURCE_ENTRY
*
mre
;
char
*
buffer
;
NTSTATUS
status
;
TRACE
(
"module = %p, id = %08x
\n
"
,
module
,
id
);
if
(
!
module
)
module
=
GetModuleHandleW
(
NULL
);
if
(
RtlFindMessage
(
module
,
RT_MESSAGETABLE
,
lang
,
id
,
&
mre
)
!=
STATUS_SUCCESS
)
return
NULL
;
if
((
status
=
RtlFindMessage
(
module
,
RT_MESSAGETABLE
,
lang
,
id
,
&
mre
))
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
NULL
;
}
if
(
mre
->
Flags
&
MESSAGE_RESOURCE_UNICODE
)
{
...
...
@@ -426,12 +436,7 @@ DWORD WINAPI FormatMessageA(
from
=
load_messageA
(
(
HMODULE
)
lpSource
,
dwMessageId
,
dwLanguageId
);
if
(
!
from
&&
(
dwFlags
&
FORMAT_MESSAGE_FROM_SYSTEM
))
from
=
load_messageA
(
kernel32_handle
,
dwMessageId
,
dwLanguageId
);
if
(
!
from
)
{
SetLastError
(
ERROR_RESOURCE_LANG_NOT_FOUND
);
return
0
;
}
if
(
!
from
)
return
0
;
}
target
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
100
);
t
=
target
;
...
...
@@ -597,12 +602,7 @@ DWORD WINAPI FormatMessageW(
from
=
load_messageW
(
(
HMODULE
)
lpSource
,
dwMessageId
,
dwLanguageId
);
if
(
!
from
&&
(
dwFlags
&
FORMAT_MESSAGE_FROM_SYSTEM
))
from
=
load_messageW
(
kernel32_handle
,
dwMessageId
,
dwLanguageId
);
if
(
!
from
)
{
SetLastError
(
ERROR_RESOURCE_LANG_NOT_FOUND
);
return
0
;
}
if
(
!
from
)
return
0
;
}
target
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
100
*
sizeof
(
WCHAR
)
);
t
=
target
;
...
...
dlls/kernel32/tests/format_msg.c
View file @
100131d4
...
...
@@ -668,28 +668,28 @@ static void test_message_from_hmodule(void)
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
);
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
);
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
);
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
);
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
,
...
...
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