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
0d0f2fa4
Commit
0d0f2fa4
authored
May 12, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
May 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Moved GetModuleInformation implementation to kernel32.
parent
9bbf3f90
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
137 deletions
+26
-137
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-0
module.c
dlls/kernel32/module.c
+24
-0
psapi.spec
dlls/psapi/psapi.spec
+1
-1
psapi_main.c
dlls/psapi/psapi_main.c
+0
-136
No files found.
dlls/kernel32/kernel32.spec
View file @
0d0f2fa4
...
...
@@ -776,6 +776,7 @@
@ stdcall K32GetModuleBaseNameW(long long ptr long)
@ stdcall K32GetModuleFileNameExA(long long ptr long)
@ stdcall K32GetModuleFileNameExW(long long ptr long)
@ stdcall K32GetModuleInformation(long long ptr long)
@ stdcall K32GetProcessMemoryInfo(long ptr long)
@ stdcall K32QueryWorkingSet(long ptr long)
@ stdcall K32QueryWorkingSetEx(long ptr long)
...
...
dlls/kernel32/module.c
View file @
0d0f2fa4
...
...
@@ -37,6 +37,7 @@
#include "winbase.h"
#include "winternl.h"
#include "kernel_private.h"
#include "psapi.h"
#include "wine/exception.h"
#include "wine/debug.h"
...
...
@@ -1283,6 +1284,29 @@ DWORD WINAPI K32GetModuleFileNameExA(HANDLE process, HMODULE module,
return
strlen
(
file_name
);
}
/***********************************************************************
* K32GetModuleInformation (KERNEL32.@)
*/
BOOL
WINAPI
K32GetModuleInformation
(
HANDLE
process
,
HMODULE
module
,
MODULEINFO
*
modinfo
,
DWORD
cb
)
{
LDR_MODULE
ldr_module
;
if
(
cb
<
sizeof
(
MODULEINFO
))
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
if
(
!
get_ldr_module
(
process
,
module
,
&
ldr_module
))
return
FALSE
;
modinfo
->
lpBaseOfDll
=
ldr_module
.
BaseAddress
;
modinfo
->
SizeOfImage
=
ldr_module
.
SizeOfImage
;
modinfo
->
EntryPoint
=
ldr_module
.
EntryPoint
;
return
TRUE
;
}
#ifdef __i386__
/***********************************************************************
...
...
dlls/psapi/psapi.spec
View file @
0d0f2fa4
...
...
@@ -14,7 +14,7 @@
@ stdcall GetModuleBaseNameW(long long ptr long) kernel32.K32GetModuleBaseNameW
@ stdcall GetModuleFileNameExA(long long ptr long) kernel32.K32GetModuleFileNameExA
@ stdcall GetModuleFileNameExW(long long ptr long) kernel32.K32GetModuleFileNameExW
@ stdcall GetModuleInformation(long long ptr long)
@ stdcall GetModuleInformation(long long ptr long)
kernel32.K32GetModuleInformation
@ stdcall GetPerformanceInfo(ptr long)
@ stdcall GetProcessImageFileNameA(long ptr long) kernel32.K32GetProcessImageFileNameA
@ stdcall GetProcessImageFileNameW(long ptr long) kernel32.K32GetProcessImageFileNameW
...
...
dlls/psapi/psapi_main.c
View file @
0d0f2fa4
...
...
@@ -34,119 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
psapi
);
typedef
struct
{
HANDLE
hProcess
;
PLIST_ENTRY
pHead
,
pCurrent
;
LDR_MODULE
LdrModule
;
}
MODULE_ITERATOR
;
/***********************************************************************
* PSAPI_ModuleIteratorInit [internal]
*
* Prepares to iterate through the loaded modules of the given process.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
static
BOOL
PSAPI_ModuleIteratorInit
(
MODULE_ITERATOR
*
iter
,
HANDLE
hProcess
)
{
PROCESS_BASIC_INFORMATION
pbi
;
PPEB_LDR_DATA
pLdrData
;
NTSTATUS
status
;
/* Get address of PEB */
status
=
NtQueryInformationProcess
(
hProcess
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
);
if
(
status
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
));
return
FALSE
;
}
/* Read address of LdrData from PEB */
if
(
!
ReadProcessMemory
(
hProcess
,
&
pbi
.
PebBaseAddress
->
LdrData
,
&
pLdrData
,
sizeof
(
pLdrData
),
NULL
))
return
FALSE
;
/* Read address of first module from LdrData */
if
(
!
ReadProcessMemory
(
hProcess
,
&
pLdrData
->
InLoadOrderModuleList
.
Flink
,
&
iter
->
pCurrent
,
sizeof
(
iter
->
pCurrent
),
NULL
))
return
FALSE
;
iter
->
pHead
=
&
pLdrData
->
InLoadOrderModuleList
;
iter
->
hProcess
=
hProcess
;
return
TRUE
;
}
/***********************************************************************
* PSAPI_ModuleIteratorNext [internal]
*
* Iterates to the next module.
*
* RETURNS
* 1 : Success
* 0 : No more modules
* -1 : Failure
*
* NOTES
* Every function which uses this routine suffers from a race condition
* when a module is unloaded during the enumeration which can cause the
* function to fail. As there is no way to lock the loader of another
* process we can't avoid that.
*/
static
INT
PSAPI_ModuleIteratorNext
(
MODULE_ITERATOR
*
iter
)
{
if
(
iter
->
pCurrent
==
iter
->
pHead
)
return
0
;
if
(
!
ReadProcessMemory
(
iter
->
hProcess
,
CONTAINING_RECORD
(
iter
->
pCurrent
,
LDR_MODULE
,
InLoadOrderModuleList
),
&
iter
->
LdrModule
,
sizeof
(
iter
->
LdrModule
),
NULL
))
return
-
1
;
else
iter
->
pCurrent
=
iter
->
LdrModule
.
InLoadOrderModuleList
.
Flink
;
return
1
;
}
/***********************************************************************
* PSAPI_GetLdrModule [internal]
*
* Reads the LDR_MODULE structure of the given module.
*
* RETURNS
* Success: TRUE
* Failure: FALSE
*/
static
BOOL
PSAPI_GetLdrModule
(
HANDLE
hProcess
,
HMODULE
hModule
,
LDR_MODULE
*
pLdrModule
)
{
MODULE_ITERATOR
iter
;
INT
ret
;
if
(
!
PSAPI_ModuleIteratorInit
(
&
iter
,
hProcess
))
return
FALSE
;
while
((
ret
=
PSAPI_ModuleIteratorNext
(
&
iter
))
>
0
)
/* When hModule is NULL we return the process image - which will be
* the first module since our iterator uses InLoadOrderModuleList */
if
(
!
hModule
||
hModule
==
iter
.
LdrModule
.
BaseAddress
)
{
*
pLdrModule
=
iter
.
LdrModule
;
return
TRUE
;
}
if
(
ret
==
0
)
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
/***********************************************************************
* EnumDeviceDrivers (PSAPI.@)
*/
...
...
@@ -263,29 +150,6 @@ DWORD WINAPI GetMappedFileNameW(HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename,
}
/***********************************************************************
* GetModuleInformation (PSAPI.@)
*/
BOOL
WINAPI
GetModuleInformation
(
HANDLE
hProcess
,
HMODULE
hModule
,
LPMODULEINFO
lpmodinfo
,
DWORD
cb
)
{
LDR_MODULE
LdrModule
;
if
(
cb
<
sizeof
(
MODULEINFO
))
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
}
if
(
!
PSAPI_GetLdrModule
(
hProcess
,
hModule
,
&
LdrModule
))
return
FALSE
;
lpmodinfo
->
lpBaseOfDll
=
LdrModule
.
BaseAddress
;
lpmodinfo
->
SizeOfImage
=
LdrModule
.
SizeOfImage
;
lpmodinfo
->
EntryPoint
=
LdrModule
.
EntryPoint
;
return
TRUE
;
}
/***********************************************************************
* GetPerformanceInfo (PSAPI.@)
*/
BOOL
WINAPI
GetPerformanceInfo
(
PPERFORMANCE_INFORMATION
info
,
DWORD
size
)
...
...
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