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
e6dd213d
Commit
e6dd213d
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 GetModuleBaseName[AW] implementation to kernel32.
parent
8379893f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
48 deletions
+76
-48
kernel32.spec
dlls/kernel32/kernel32.spec
+2
-0
module.c
dlls/kernel32/module.c
+72
-0
psapi.spec
dlls/psapi/psapi.spec
+2
-2
psapi_main.c
dlls/psapi/psapi_main.c
+0
-46
No files found.
dlls/kernel32/kernel32.spec
View file @
e6dd213d
...
@@ -772,6 +772,8 @@
...
@@ -772,6 +772,8 @@
@ stdcall K32GetProcessImageFileNameW(long ptr long)
@ stdcall K32GetProcessImageFileNameW(long ptr long)
@ stdcall K32EnumProcessModules(long ptr long ptr)
@ stdcall K32EnumProcessModules(long ptr long ptr)
@ stdcall K32EnumProcesses(ptr long ptr)
@ stdcall K32EnumProcesses(ptr long ptr)
@ stdcall K32GetModuleBaseNameA(long long ptr long)
@ stdcall K32GetModuleBaseNameW(long long ptr long)
@ stdcall K32GetProcessMemoryInfo(long ptr long)
@ stdcall K32GetProcessMemoryInfo(long ptr long)
@ stdcall K32QueryWorkingSet(long ptr long)
@ stdcall K32QueryWorkingSet(long ptr long)
@ stdcall K32QueryWorkingSetEx(long ptr long)
@ stdcall K32QueryWorkingSetEx(long ptr long)
...
...
dlls/kernel32/module.c
View file @
e6dd213d
...
@@ -1125,6 +1125,29 @@ static int module_iterator_next(MODULE_ITERATOR *iter)
...
@@ -1125,6 +1125,29 @@ static int module_iterator_next(MODULE_ITERATOR *iter)
return
1
;
return
1
;
}
}
static
BOOL
get_ldr_module
(
HANDLE
process
,
HMODULE
module
,
LDR_MODULE
*
ldr_module
)
{
MODULE_ITERATOR
iter
;
INT
ret
;
if
(
!
init_module_iterator
(
&
iter
,
process
))
return
FALSE
;
while
((
ret
=
module_iterator_next
(
&
iter
))
>
0
)
/* When hModule is NULL we return the process image - which will be
* the first module since our iterator uses InLoadOrderModuleList */
if
(
!
module
||
module
==
iter
.
ldr_module
.
BaseAddress
)
{
*
ldr_module
=
iter
.
ldr_module
;
return
TRUE
;
}
if
(
ret
==
0
)
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
/***********************************************************************
/***********************************************************************
* K32EnumProcessModules (KERNEL32.@)
* K32EnumProcessModules (KERNEL32.@)
*
*
...
@@ -1155,6 +1178,55 @@ BOOL WINAPI K32EnumProcessModules(HANDLE process, HMODULE *lphModule,
...
@@ -1155,6 +1178,55 @@ BOOL WINAPI K32EnumProcessModules(HANDLE process, HMODULE *lphModule,
return
ret
==
0
;
return
ret
==
0
;
}
}
/***********************************************************************
* K32GetModuleBaseNameW (KERNEL32.@)
*/
DWORD
WINAPI
K32GetModuleBaseNameW
(
HANDLE
process
,
HMODULE
module
,
LPWSTR
base_name
,
DWORD
size
)
{
LDR_MODULE
ldr_module
;
if
(
!
get_ldr_module
(
process
,
module
,
&
ldr_module
))
return
0
;
size
=
min
(
ldr_module
.
BaseDllName
.
Length
/
sizeof
(
WCHAR
),
size
);
if
(
!
ReadProcessMemory
(
process
,
ldr_module
.
BaseDllName
.
Buffer
,
base_name
,
size
*
sizeof
(
WCHAR
),
NULL
))
return
0
;
base_name
[
size
]
=
0
;
return
size
;
}
/***********************************************************************
* K32GetModuleBaseNameA (KERNEL32.@)
*/
DWORD
WINAPI
K32GetModuleBaseNameA
(
HANDLE
process
,
HMODULE
module
,
LPSTR
base_name
,
DWORD
size
)
{
WCHAR
*
base_name_w
;
DWORD
len
,
ret
=
0
;
if
(
!
base_name
||
!
size
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
base_name_w
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
size
);
if
(
!
base_name_w
)
return
0
;
len
=
K32GetModuleBaseNameW
(
process
,
module
,
base_name_w
,
size
);
TRACE
(
"%d, %s
\n
"
,
len
,
debugstr_w
(
base_name_w
));
if
(
len
)
{
ret
=
WideCharToMultiByte
(
CP_ACP
,
0
,
base_name_w
,
len
,
base_name
,
size
,
NULL
,
NULL
);
if
(
ret
<
size
)
base_name
[
ret
]
=
0
;
}
HeapFree
(
GetProcessHeap
(),
0
,
base_name_w
);
return
ret
;
}
#ifdef __i386__
#ifdef __i386__
...
...
dlls/psapi/psapi.spec
View file @
e6dd213d
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
@ stdcall GetDeviceDriverFileNameW(ptr ptr long)
@ stdcall GetDeviceDriverFileNameW(ptr ptr long)
@ stdcall GetMappedFileNameA(long ptr ptr long)
@ stdcall GetMappedFileNameA(long ptr ptr long)
@ stdcall GetMappedFileNameW(long ptr ptr long)
@ stdcall GetMappedFileNameW(long ptr ptr long)
@ stdcall GetModuleBaseNameA(long long ptr long)
@ stdcall GetModuleBaseNameA(long long ptr long)
kernel32.K32GetModuleBaseNameA
@ stdcall GetModuleBaseNameW(long long ptr long)
@ stdcall GetModuleBaseNameW(long long ptr long)
kernel32.K32GetModuleBaseNameW
@ stdcall GetModuleFileNameExA(long long ptr long)
@ stdcall GetModuleFileNameExA(long long ptr long)
@ stdcall GetModuleFileNameExW(long long ptr long)
@ stdcall GetModuleFileNameExW(long long ptr long)
@ stdcall GetModuleInformation(long long ptr long)
@ stdcall GetModuleInformation(long long ptr long)
...
...
dlls/psapi/psapi_main.c
View file @
e6dd213d
...
@@ -263,52 +263,6 @@ DWORD WINAPI GetMappedFileNameW(HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename,
...
@@ -263,52 +263,6 @@ DWORD WINAPI GetMappedFileNameW(HANDLE hProcess, LPVOID lpv, LPWSTR lpFilename,
}
}
/***********************************************************************
/***********************************************************************
* GetModuleBaseNameA (PSAPI.@)
*/
DWORD
WINAPI
GetModuleBaseNameA
(
HANDLE
hProcess
,
HMODULE
hModule
,
LPSTR
lpBaseName
,
DWORD
nSize
)
{
WCHAR
*
lpBaseNameW
;
DWORD
buflenW
,
ret
=
0
;
if
(
!
lpBaseName
||
!
nSize
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
lpBaseNameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
nSize
);
buflenW
=
GetModuleBaseNameW
(
hProcess
,
hModule
,
lpBaseNameW
,
nSize
);
TRACE
(
"%d, %s
\n
"
,
buflenW
,
debugstr_w
(
lpBaseNameW
));
if
(
buflenW
)
{
ret
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpBaseNameW
,
buflenW
,
lpBaseName
,
nSize
,
NULL
,
NULL
);
if
(
ret
<
nSize
)
lpBaseName
[
ret
]
=
0
;
}
HeapFree
(
GetProcessHeap
(),
0
,
lpBaseNameW
);
return
ret
;
}
/***********************************************************************
* GetModuleBaseNameW (PSAPI.@)
*/
DWORD
WINAPI
GetModuleBaseNameW
(
HANDLE
hProcess
,
HMODULE
hModule
,
LPWSTR
lpBaseName
,
DWORD
nSize
)
{
LDR_MODULE
LdrModule
;
if
(
!
PSAPI_GetLdrModule
(
hProcess
,
hModule
,
&
LdrModule
))
return
0
;
nSize
=
min
(
LdrModule
.
BaseDllName
.
Length
/
sizeof
(
WCHAR
),
nSize
);
if
(
!
ReadProcessMemory
(
hProcess
,
LdrModule
.
BaseDllName
.
Buffer
,
lpBaseName
,
nSize
*
sizeof
(
WCHAR
),
NULL
))
return
0
;
lpBaseName
[
nSize
]
=
0
;
return
nSize
;
}
/***********************************************************************
* GetModuleFileNameExA (PSAPI.@)
* GetModuleFileNameExA (PSAPI.@)
*/
*/
DWORD
WINAPI
GetModuleFileNameExA
(
HANDLE
hProcess
,
HMODULE
hModule
,
DWORD
WINAPI
GetModuleFileNameExA
(
HANDLE
hProcess
,
HMODULE
hModule
,
...
...
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