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
a6451971
Commit
a6451971
authored
Feb 02, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Report correct errors in GetModuleHandleExA().
parent
34a797e8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
module.c
dlls/kernel32/tests/module.c
+18
-0
loader.c
dlls/kernelbase/loader.c
+12
-1
No files found.
dlls/kernel32/tests/module.c
View file @
a6451971
...
...
@@ -953,6 +953,10 @@ static void init_pointers(void)
static
void
testGetModuleHandleEx
(
void
)
{
static
const
char
longname
[]
=
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
;
static
const
WCHAR
kernel32W
[]
=
{
'k'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'3'
,
'2'
,
0
};
static
const
WCHAR
nosuchmodW
[]
=
{
'n'
,
'o'
,
's'
,
'u'
,
'c'
,
'h'
,
'm'
,
'o'
,
'd'
,
0
};
BOOL
ret
;
...
...
@@ -987,6 +991,20 @@ static void testGetModuleHandleEx(void)
ok
(
mod
==
NULL
,
"got %p
\n
"
,
mod
);
SetLastError
(
0xdeadbeef
);
ret
=
GetModuleHandleExA
(
0
,
longname
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %lu
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
mod
=
(
HMODULE
)
0xdeadbeef
;
ret
=
GetModuleHandleExA
(
0
,
longname
,
&
mod
);
error
=
GetLastError
();
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_MOD_NOT_FOUND
,
"got %lu
\n
"
,
error
);
ok
(
mod
==
NULL
,
"got %p
\n
"
,
mod
);
SetLastError
(
0xdeadbeef
);
ret
=
GetModuleHandleExW
(
0
,
NULL
,
NULL
);
error
=
GetLastError
();
ok
(
!
ret
,
"unexpected success
\n
"
);
...
...
dlls/kernelbase/loader.c
View file @
a6451971
...
...
@@ -352,10 +352,21 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetModuleHandleExA( DWORD flags, LPCSTR name, HMOD
{
WCHAR
*
nameW
;
if
(
!
module
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
!
name
||
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
))
return
GetModuleHandleExW
(
flags
,
(
LPCWSTR
)
name
,
module
);
if
(
!
(
nameW
=
file_name_AtoW
(
name
,
FALSE
)))
return
FALSE
;
if
(
!
(
nameW
=
file_name_AtoW
(
name
,
FALSE
)))
{
*
module
=
NULL
;
SetLastError
(
ERROR_MOD_NOT_FOUND
);
return
FALSE
;
}
return
GetModuleHandleExW
(
flags
,
nameW
,
module
);
}
...
...
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