kernel32: Moved GetProcessMemoryInfo implementation to kernel32.
This commit is contained in:
parent
ed6c309fe5
commit
4ed94f7939
|
@ -772,6 +772,7 @@
|
|||
@ stdcall K32GetProcessImageFileNameW(long ptr long)
|
||||
@ stdcall K32EnumProcessModules(long ptr long ptr)
|
||||
@ stdcall K32EnumProcesses(ptr long ptr)
|
||||
@ stdcall K32GetProcessMemoryInfo(long ptr long)
|
||||
@ stdcall K32QueryWorkingSet(long ptr long)
|
||||
@ stdcall K32QueryWorkingSetEx(long ptr long)
|
||||
@ stdcall -i386 -private -register K32Thk1632Epilog() krnl386.exe16.K32Thk1632Epilog
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define WIN32_NO_STATUS
|
||||
#include "winternl.h"
|
||||
#include "kernel_private.h"
|
||||
#include "psapi.h"
|
||||
#include "wine/library.h"
|
||||
#include "wine/server.h"
|
||||
#include "wine/unicode.h"
|
||||
|
@ -3621,6 +3622,47 @@ BOOL WINAPI K32QueryWorkingSetEx( HANDLE process, LPVOID buffer, DWORD size )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* K32GetProcessMemoryInfo (KERNEL32.@)
|
||||
*
|
||||
* Retrieve memory usage information for a given process
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI K32GetProcessMemoryInfo(HANDLE process,
|
||||
PPROCESS_MEMORY_COUNTERS pmc, DWORD cb)
|
||||
{
|
||||
NTSTATUS status;
|
||||
VM_COUNTERS vmc;
|
||||
|
||||
if (cb < sizeof(PROCESS_MEMORY_COUNTERS))
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
status = NtQueryInformationProcess(process, ProcessVmCounters,
|
||||
&vmc, sizeof(vmc), NULL);
|
||||
|
||||
if (status)
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pmc->cb = sizeof(PROCESS_MEMORY_COUNTERS);
|
||||
pmc->PageFaultCount = vmc.PageFaultCount;
|
||||
pmc->PeakWorkingSetSize = vmc.PeakWorkingSetSize;
|
||||
pmc->WorkingSetSize = vmc.WorkingSetSize;
|
||||
pmc->QuotaPeakPagedPoolUsage = vmc.QuotaPeakPagedPoolUsage;
|
||||
pmc->QuotaPagedPoolUsage = vmc.QuotaPagedPoolUsage;
|
||||
pmc->QuotaPeakNonPagedPoolUsage = vmc.QuotaPeakNonPagedPoolUsage;
|
||||
pmc->QuotaNonPagedPoolUsage = vmc.QuotaNonPagedPoolUsage;
|
||||
pmc->PagefileUsage = vmc.PagefileUsage;
|
||||
pmc->PeakPagefileUsage = vmc.PeakPagefileUsage;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ProcessIdToSessionId (KERNEL32.@)
|
||||
* This function is available on Terminal Server 4SP4 and Windows 2000
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@ stdcall GetPerformanceInfo(ptr long)
|
||||
@ stdcall GetProcessImageFileNameA(long ptr long) kernel32.K32GetProcessImageFileNameA
|
||||
@ stdcall GetProcessImageFileNameW(long ptr long) kernel32.K32GetProcessImageFileNameW
|
||||
@ stdcall GetProcessMemoryInfo(long ptr long)
|
||||
@ stdcall GetProcessMemoryInfo(long ptr long) kernel32.K32GetProcessMemoryInfo
|
||||
@ stdcall GetWsChanges(long ptr long)
|
||||
@ stdcall InitializeProcessForWsWatch(long)
|
||||
@ stdcall QueryWorkingSet(long ptr long) kernel32.K32QueryWorkingSet
|
||||
|
|
|
@ -406,47 +406,6 @@ BOOL WINAPI GetPerformanceInfo( PPERFORMANCE_INFORMATION info, DWORD size )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetProcessMemoryInfo (PSAPI.@)
|
||||
*
|
||||
* Retrieve memory usage information for a given process
|
||||
*
|
||||
*/
|
||||
BOOL WINAPI GetProcessMemoryInfo(HANDLE hProcess,
|
||||
PPROCESS_MEMORY_COUNTERS pmc, DWORD cb)
|
||||
{
|
||||
NTSTATUS status;
|
||||
VM_COUNTERS vmc;
|
||||
|
||||
if (cb < sizeof(PROCESS_MEMORY_COUNTERS))
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
status = NtQueryInformationProcess(hProcess, ProcessVmCounters,
|
||||
&vmc, sizeof(vmc), NULL);
|
||||
|
||||
if (status)
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(status));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pmc->cb = sizeof(PROCESS_MEMORY_COUNTERS);
|
||||
pmc->PageFaultCount = vmc.PageFaultCount;
|
||||
pmc->PeakWorkingSetSize = vmc.PeakWorkingSetSize;
|
||||
pmc->WorkingSetSize = vmc.WorkingSetSize;
|
||||
pmc->QuotaPeakPagedPoolUsage = vmc.QuotaPeakPagedPoolUsage;
|
||||
pmc->QuotaPagedPoolUsage = vmc.QuotaPagedPoolUsage;
|
||||
pmc->QuotaPeakNonPagedPoolUsage = vmc.QuotaPeakNonPagedPoolUsage;
|
||||
pmc->QuotaNonPagedPoolUsage = vmc.QuotaNonPagedPoolUsage;
|
||||
pmc->PagefileUsage = vmc.PagefileUsage;
|
||||
pmc->PeakPagefileUsage = vmc.PeakPagefileUsage;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetWsChanges (PSAPI.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue