Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
362a7d57
Commit
362a7d57
authored
May 10, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
May 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Moved EnumProcessModules implementation to kernel32.
parent
4422d22c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
31 deletions
+84
-31
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-0
process.c
dlls/kernel32/process.c
+82
-0
psapi.spec
dlls/psapi/psapi.spec
+1
-1
psapi_main.c
dlls/psapi/psapi_main.c
+0
-30
No files found.
dlls/kernel32/kernel32.spec
View file @
362a7d57
...
...
@@ -770,6 +770,7 @@
@ stdcall K32EmptyWorkingSet(long)
@ stdcall K32GetProcessImageFileNameA(long ptr long)
@ stdcall K32GetProcessImageFileNameW(long ptr long)
@ stdcall K32EnumProcessModules(long ptr long ptr)
@ stdcall K32EnumProcesses(ptr long ptr)
@ stdcall -i386 -private -register K32Thk1632Epilog() krnl386.exe16.K32Thk1632Epilog
@ stdcall -i386 -private -register K32Thk1632Prolog() krnl386.exe16.K32Thk1632Prolog
...
...
dlls/kernel32/process.c
View file @
362a7d57
...
...
@@ -3501,6 +3501,88 @@ BOOL WINAPI K32EnumProcesses(DWORD *lpdwProcessIDs, DWORD cb, DWORD *lpcbUsed)
return
TRUE
;
}
typedef
struct
{
HANDLE
process
;
PLIST_ENTRY
head
,
current
;
LDR_MODULE
ldr_module
;
}
MODULE_ITERATOR
;
static
BOOL
init_module_iterator
(
MODULE_ITERATOR
*
iter
,
HANDLE
process
)
{
PROCESS_BASIC_INFORMATION
pbi
;
PPEB_LDR_DATA
ldr_data
;
NTSTATUS
status
;
/* Get address of PEB */
status
=
NtQueryInformationProcess
(
process
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
);
if
(
status
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
));
return
FALSE
;
}
/* Read address of LdrData from PEB */
if
(
!
ReadProcessMemory
(
process
,
&
pbi
.
PebBaseAddress
->
LdrData
,
&
ldr_data
,
sizeof
(
ldr_data
),
NULL
))
return
FALSE
;
/* Read address of first module from LdrData */
if
(
!
ReadProcessMemory
(
process
,
&
ldr_data
->
InLoadOrderModuleList
.
Flink
,
&
iter
->
current
,
sizeof
(
iter
->
current
),
NULL
))
return
FALSE
;
iter
->
head
=
&
ldr_data
->
InLoadOrderModuleList
;
iter
->
process
=
process
;
return
TRUE
;
}
static
int
module_iterator_next
(
MODULE_ITERATOR
*
iter
)
{
if
(
iter
->
current
==
iter
->
head
)
return
0
;
if
(
!
ReadProcessMemory
(
iter
->
process
,
CONTAINING_RECORD
(
iter
->
current
,
LDR_MODULE
,
InLoadOrderModuleList
),
&
iter
->
ldr_module
,
sizeof
(
iter
->
ldr_module
),
NULL
))
return
-
1
;
iter
->
current
=
iter
->
ldr_module
.
InLoadOrderModuleList
.
Flink
;
return
1
;
}
/***********************************************************************
* K32EnumProcessModules (KERNEL32.@)
*
* NOTES
* Returned list is in load order.
*/
BOOL
WINAPI
K32EnumProcessModules
(
HANDLE
process
,
HMODULE
*
lphModule
,
DWORD
cb
,
DWORD
*
needed
)
{
MODULE_ITERATOR
iter
;
INT
ret
;
if
(
!
init_module_iterator
(
&
iter
,
process
))
return
FALSE
;
*
needed
=
0
;
while
((
ret
=
module_iterator_next
(
&
iter
))
>
0
)
{
if
(
cb
>=
sizeof
(
HMODULE
))
{
*
lphModule
++
=
iter
.
ldr_module
.
BaseAddress
;
cb
-=
sizeof
(
HMODULE
);
}
*
needed
+=
sizeof
(
HMODULE
);
}
return
ret
==
0
;
}
/***********************************************************************
* ProcessIdToSessionId (KERNEL32.@)
* This function is available on Terminal Server 4SP4 and Windows 2000
...
...
dlls/psapi/psapi.spec
View file @
362a7d57
...
...
@@ -2,7 +2,7 @@
@ stdcall EnumDeviceDrivers(ptr long ptr)
@ stdcall EnumPageFilesA(ptr ptr)
@ stdcall EnumPageFilesW(ptr ptr)
@ stdcall EnumProcessModules(long ptr long ptr)
@ stdcall EnumProcessModules(long ptr long ptr)
kernel32.K32EnumProcessModules
@ stdcall EnumProcesses(ptr long ptr) kernel32.K32EnumProcesses
@ stdcall GetDeviceDriverBaseNameA(ptr ptr long)
@ stdcall GetDeviceDriverBaseNameW(ptr ptr long)
...
...
dlls/psapi/psapi_main.c
View file @
362a7d57
...
...
@@ -179,36 +179,6 @@ BOOL WINAPI EnumPageFilesW( PENUM_PAGE_FILE_CALLBACKW callback, LPVOID context )
}
/***********************************************************************
* EnumProcessModules (PSAPI.@)
*
* NOTES
* Returned list is in load order.
*/
BOOL
WINAPI
EnumProcessModules
(
HANDLE
hProcess
,
HMODULE
*
lphModule
,
DWORD
cb
,
LPDWORD
lpcbNeeded
)
{
MODULE_ITERATOR
iter
;
INT
ret
;
if
(
!
PSAPI_ModuleIteratorInit
(
&
iter
,
hProcess
))
return
FALSE
;
*
lpcbNeeded
=
0
;
while
((
ret
=
PSAPI_ModuleIteratorNext
(
&
iter
))
>
0
)
{
if
(
cb
>=
sizeof
(
HMODULE
))
{
*
lphModule
++
=
iter
.
LdrModule
.
BaseAddress
;
cb
-=
sizeof
(
HMODULE
);
}
*
lpcbNeeded
+=
sizeof
(
HMODULE
);
}
return
(
ret
==
0
);
}
/***********************************************************************
* GetDeviceDriverBaseNameA (PSAPI.@)
*/
DWORD
WINAPI
GetDeviceDriverBaseNameA
(
LPVOID
ImageBase
,
LPSTR
lpBaseName
,
...
...
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