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
e8a95bf6
Commit
e8a95bf6
authored
Apr 05, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 05, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Return failure from GetModuleHandleEx if the module handle pointer is NULL.
parent
7133c000
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
25 deletions
+31
-25
module.c
dlls/kernel32/module.c
+7
-1
module.c
dlls/kernel32/tests/module.c
+24
-24
No files found.
dlls/kernel32/module.c
View file @
e8a95bf6
...
...
@@ -508,6 +508,12 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
HMODULE
ret
;
ULONG
magic
;
if
(
!
module
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
/* if we are messing with the refcount, grab the loader lock */
if
((
flags
&
GET_MODULE_HANDLE_EX_FLAG_PIN
)
||
!
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
))
...
...
@@ -542,7 +548,7 @@ BOOL WINAPI GetModuleHandleExW( DWORD flags, LPCWSTR name, HMODULE *module )
!
(
flags
&
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
))
LdrUnlockLoaderLock
(
0
,
magic
);
if
(
module
)
*
module
=
ret
;
*
module
=
ret
;
return
(
status
==
STATUS_SUCCESS
);
}
...
...
dlls/kernel32/tests/module.c
View file @
e8a95bf6
...
...
@@ -518,14 +518,14 @@ static void testGetModuleHandleEx(void)
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExA
(
0
,
NULL
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExA
(
0
,
"kernel32"
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
mod
=
(
HMODULE
)
0xdeadbeef
;
...
...
@@ -545,14 +545,14 @@ static void testGetModuleHandleEx(void)
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExW
(
0
,
NULL
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExW
(
0
,
kernel32W
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
mod
=
(
HMODULE
)
0xdeadbeef
;
...
...
@@ -572,14 +572,14 @@ static void testGetModuleHandleEx(void)
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExA
(
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
,
NULL
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExA
(
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
,
"kernel32"
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
mod
=
(
HMODULE
)
0xdeadbeef
;
...
...
@@ -598,14 +598,14 @@ static void testGetModuleHandleEx(void)
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExW
(
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
,
NULL
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExW
(
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT
,
kernel32W
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
mod
=
(
HMODULE
)
0xdeadbeef
;
...
...
@@ -626,14 +626,14 @@ static void testGetModuleHandleEx(void)
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExA
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
NULL
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExA
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
(
LPCSTR
)
mod_kernel32
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
mod
=
(
HMODULE
)
0xdeadbeef
;
...
...
@@ -653,14 +653,14 @@ static void testGetModuleHandleEx(void)
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExW
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
NULL
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetModuleHandleExW
(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
,
(
LPCWSTR
)
mod_kernel32
,
NULL
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
,
"unexpected success
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
ok
(
!
ret
,
"unexpected success
\n
"
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"got %u
\n
"
,
error
);
SetLastError
(
0xdeadbeef
);
mod
=
(
HMODULE
)
0xdeadbeef
;
...
...
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