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
fc173ccc
Commit
fc173ccc
authored
May 26, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Reimplement GetProcessVersion() in kernelbase.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
54a7e592
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
57 deletions
+25
-57
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-1
process.c
dlls/kernel32/process.c
+0
-55
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-1
process.c
dlls/kernelbase/process.c
+23
-0
No files found.
dlls/kernel32/kernel32.spec
View file @
fc173ccc
...
...
@@ -793,7 +793,7 @@
# @ stub GetProcessorSystemCycleTime
@ stdcall -import GetProcessTimes(long ptr ptr ptr ptr)
# @ stub GetProcessUserModeExceptionPolicy
@ stdcall GetProcessVersion(long)
@ stdcall
-import
GetProcessVersion(long)
@ stdcall GetProcessWorkingSetSize(long ptr ptr)
@ stdcall -import GetProcessWorkingSetSizeEx(long ptr ptr ptr)
@ stdcall -import GetProductInfo(long long long long ptr)
...
...
dlls/kernel32/process.c
View file @
fc173ccc
...
...
@@ -452,61 +452,6 @@ BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PD
/***********************************************************************
* GetProcessVersion (KERNEL32.@)
*/
DWORD
WINAPI
GetProcessVersion
(
DWORD
pid
)
{
HANDLE
process
;
NTSTATUS
status
;
PROCESS_BASIC_INFORMATION
pbi
;
SIZE_T
count
;
PEB
peb
;
IMAGE_DOS_HEADER
dos
;
IMAGE_NT_HEADERS
nt
;
DWORD
ver
=
0
;
if
(
!
pid
||
pid
==
GetCurrentProcessId
())
{
IMAGE_NT_HEADERS
*
pnt
;
if
((
pnt
=
RtlImageNtHeader
(
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
)))
return
((
pnt
->
OptionalHeader
.
MajorSubsystemVersion
<<
16
)
|
pnt
->
OptionalHeader
.
MinorSubsystemVersion
);
return
0
;
}
process
=
OpenProcess
(
PROCESS_VM_READ
|
PROCESS_QUERY_INFORMATION
,
FALSE
,
pid
);
if
(
!
process
)
return
0
;
status
=
NtQueryInformationProcess
(
process
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
);
if
(
status
)
goto
err
;
status
=
NtReadVirtualMemory
(
process
,
pbi
.
PebBaseAddress
,
&
peb
,
sizeof
(
peb
),
&
count
);
if
(
status
||
count
!=
sizeof
(
peb
))
goto
err
;
memset
(
&
dos
,
0
,
sizeof
(
dos
));
status
=
NtReadVirtualMemory
(
process
,
peb
.
ImageBaseAddress
,
&
dos
,
sizeof
(
dos
),
&
count
);
if
(
status
||
count
!=
sizeof
(
dos
))
goto
err
;
if
(
dos
.
e_magic
!=
IMAGE_DOS_SIGNATURE
)
goto
err
;
memset
(
&
nt
,
0
,
sizeof
(
nt
));
status
=
NtReadVirtualMemory
(
process
,
(
char
*
)
peb
.
ImageBaseAddress
+
dos
.
e_lfanew
,
&
nt
,
sizeof
(
nt
),
&
count
);
if
(
status
||
count
!=
sizeof
(
nt
))
goto
err
;
if
(
nt
.
Signature
!=
IMAGE_NT_SIGNATURE
)
goto
err
;
ver
=
MAKELONG
(
nt
.
OptionalHeader
.
MinorSubsystemVersion
,
nt
.
OptionalHeader
.
MajorSubsystemVersion
);
err
:
CloseHandle
(
process
);
if
(
status
!=
STATUS_SUCCESS
)
SetLastError
(
RtlNtStatusToDosError
(
status
));
return
ver
;
}
/***********************************************************************
* SetProcessWorkingSetSize [KERNEL32.@]
* Sets the min/max working set sizes for a specified process.
*
...
...
dlls/kernelbase/kernelbase.spec
View file @
fc173ccc
...
...
@@ -636,7 +636,7 @@
@ stdcall GetProcessPriorityBoost(long ptr)
@ stdcall GetProcessShutdownParameters(ptr ptr)
@ stdcall GetProcessTimes(long ptr ptr ptr ptr)
@ stdcall GetProcessVersion(long)
kernel32.GetProcessVersion
@ stdcall GetProcessVersion(long)
@ stdcall GetProcessWorkingSetSizeEx(long ptr ptr ptr)
# @ stub GetProcessorSystemCycleTime
@ stdcall GetProductInfo(long long long long ptr)
...
...
dlls/kernelbase/process.c
View file @
fc173ccc
...
...
@@ -815,6 +815,29 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetProcessTimes( HANDLE process, FILETIME *create,
/***********************************************************************
* GetProcessVersion (kernelbase.@)
*/
DWORD
WINAPI
DECLSPEC_HOTPATCH
GetProcessVersion
(
DWORD
pid
)
{
SECTION_IMAGE_INFORMATION
info
;
NTSTATUS
status
;
HANDLE
process
;
if
(
pid
&&
pid
!=
GetCurrentProcessId
())
{
if
(
!
(
process
=
OpenProcess
(
PROCESS_QUERY_INFORMATION
,
FALSE
,
pid
)))
return
0
;
status
=
NtQueryInformationProcess
(
process
,
ProcessImageInformation
,
&
info
,
sizeof
(
info
),
NULL
);
CloseHandle
(
process
);
}
else
status
=
NtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessImageInformation
,
&
info
,
sizeof
(
info
),
NULL
);
if
(
!
set_ntstatus
(
status
))
return
0
;
return
MAKELONG
(
info
.
SubsystemVersionLow
,
info
.
SubsystemVersionHigh
);
}
/***********************************************************************
* GetProcessWorkingSetSizeEx (kernelbase.@)
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
GetProcessWorkingSetSizeEx
(
HANDLE
process
,
SIZE_T
*
minset
,
...
...
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