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
9d30002f
Commit
9d30002f
authored
Oct 01, 2014
by
Sebastian Lackner
Committed by
Alexandre Julliard
Oct 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add tests for K32GetModuleInformation.
parent
9f8d2218
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
module.c
dlls/kernel32/tests/module.c
+45
-0
No files found.
dlls/kernel32/tests/module.c
View file @
9d30002f
...
@@ -20,12 +20,15 @@
...
@@ -20,12 +20,15 @@
#include "wine/test.h"
#include "wine/test.h"
#include <windows.h>
#include <windows.h>
#include <psapi.h>
static
DWORD
(
WINAPI
*
pGetDllDirectoryA
)(
DWORD
,
LPSTR
);
static
DWORD
(
WINAPI
*
pGetDllDirectoryA
)(
DWORD
,
LPSTR
);
static
DWORD
(
WINAPI
*
pGetDllDirectoryW
)(
DWORD
,
LPWSTR
);
static
DWORD
(
WINAPI
*
pGetDllDirectoryW
)(
DWORD
,
LPWSTR
);
static
BOOL
(
WINAPI
*
pSetDllDirectoryA
)(
LPCSTR
);
static
BOOL
(
WINAPI
*
pSetDllDirectoryA
)(
LPCSTR
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExA
)(
DWORD
,
LPCSTR
,
HMODULE
*
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExA
)(
DWORD
,
LPCSTR
,
HMODULE
*
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExW
)(
DWORD
,
LPCWSTR
,
HMODULE
*
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExW
)(
DWORD
,
LPCWSTR
,
HMODULE
*
);
static
BOOL
(
WINAPI
*
pK32GetModuleInformation
)(
HANDLE
process
,
HMODULE
module
,
MODULEINFO
*
modinfo
,
DWORD
cb
);
static
BOOL
is_unicode_enabled
=
TRUE
;
static
BOOL
is_unicode_enabled
=
TRUE
;
...
@@ -514,7 +517,20 @@ static void init_pointers(void)
...
@@ -514,7 +517,20 @@ static void init_pointers(void)
MAKEFUNC
(
SetDllDirectoryA
);
MAKEFUNC
(
SetDllDirectoryA
);
MAKEFUNC
(
GetModuleHandleExA
);
MAKEFUNC
(
GetModuleHandleExA
);
MAKEFUNC
(
GetModuleHandleExW
);
MAKEFUNC
(
GetModuleHandleExW
);
MAKEFUNC
(
K32GetModuleInformation
);
#undef MAKEFUNC
#undef MAKEFUNC
/* not all Windows versions export this in kernel32 */
if
(
!
pK32GetModuleInformation
)
{
HMODULE
hPsapi
=
LoadLibraryA
(
"psapi.dll"
);
if
(
hPsapi
)
{
pK32GetModuleInformation
=
(
void
*
)
GetProcAddress
(
hPsapi
,
"GetModuleInformation"
);
if
(
!
pK32GetModuleInformation
)
FreeLibrary
(
hPsapi
);
}
}
}
}
static
void
testGetModuleHandleEx
(
void
)
static
void
testGetModuleHandleEx
(
void
)
...
@@ -696,6 +712,34 @@ static void testGetModuleHandleEx(void)
...
@@ -696,6 +712,34 @@ static void testGetModuleHandleEx(void)
FreeLibrary
(
mod_kernel32
);
FreeLibrary
(
mod_kernel32
);
}
}
static
void
testK32GetModuleInformation
(
void
)
{
MODULEINFO
info
;
HMODULE
mod
;
BOOL
ret
;
if
(
!
pK32GetModuleInformation
)
{
win_skip
(
"K32GetModuleInformation not available
\n
"
);
return
;
}
mod
=
GetModuleHandleA
(
NULL
);
memset
(
&
info
,
0xAA
,
sizeof
(
info
));
ret
=
pK32GetModuleInformation
(
GetCurrentProcess
(),
mod
,
&
info
,
sizeof
(
info
));
ok
(
ret
,
"K32GetModuleInformation failed for main module
\n
"
);
ok
(
info
.
lpBaseOfDll
==
mod
,
"Wrong info.lpBaseOfDll = %p, expected %p
\n
"
,
info
.
lpBaseOfDll
,
mod
);
todo_wine
ok
(
info
.
EntryPoint
!=
NULL
,
"Expected nonzero entrypoint
\n
"
);
mod
=
GetModuleHandleA
(
"kernel32.dll"
);
memset
(
&
info
,
0xAA
,
sizeof
(
info
));
ret
=
pK32GetModuleInformation
(
GetCurrentProcess
(),
mod
,
&
info
,
sizeof
(
info
));
ok
(
ret
,
"K32GetModuleInformation failed for kernel32 module
\n
"
);
ok
(
info
.
lpBaseOfDll
==
mod
,
"Wrong info.lpBaseOfDll = %p, expected %p
\n
"
,
info
.
lpBaseOfDll
,
mod
);
ok
(
info
.
EntryPoint
!=
NULL
,
"Expected nonzero entrypoint
\n
"
);
}
START_TEST
(
module
)
START_TEST
(
module
)
{
{
WCHAR
filenameW
[
MAX_PATH
];
WCHAR
filenameW
[
MAX_PATH
];
...
@@ -724,4 +768,5 @@ START_TEST(module)
...
@@ -724,4 +768,5 @@ START_TEST(module)
testGetProcAddress_Wrong
();
testGetProcAddress_Wrong
();
testLoadLibraryEx
();
testLoadLibraryEx
();
testGetModuleHandleEx
();
testGetModuleHandleEx
();
testK32GetModuleInformation
();
}
}
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