mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-09 00:11:17 +12:00
Clean return value if any win32 call fails.
This commit is contained in:
parent
e3ea4c5046
commit
369ae1d28a
1 changed files with 24 additions and 10 deletions
|
@ -10,9 +10,15 @@ uint64 QueryRamUsage()
|
|||
{
|
||||
PROCESS_MEMORY_COUNTERS pmc{};
|
||||
pmc.cb = sizeof(pmc);
|
||||
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
|
||||
if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
|
||||
{
|
||||
return pmc.WorkingSetSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void QueryProcTime(uint64 &out_now, uint64 &out_user, uint64 &out_kernel)
|
||||
{
|
||||
|
@ -22,7 +28,8 @@ void QueryProcTime(uint64 &out_now, uint64 &out_user, uint64 &out_kernel)
|
|||
now.LowPart = ftime.dwLowDateTime;
|
||||
now.HighPart = ftime.dwHighDateTime;
|
||||
|
||||
GetProcessTimes(GetCurrentProcess(), &ftime, &ftime, &fkernel, &fuser);
|
||||
if (GetProcessTimes(GetCurrentProcess(), &ftime, &ftime, &fkernel, &fuser))
|
||||
{
|
||||
kernel.LowPart = fkernel.dwLowDateTime;
|
||||
kernel.HighPart = fkernel.dwHighDateTime;
|
||||
|
||||
|
@ -33,6 +40,13 @@ void QueryProcTime(uint64 &out_now, uint64 &out_user, uint64 &out_kernel)
|
|||
out_user = user.QuadPart;
|
||||
out_kernel = kernel.QuadPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
out_now = 0;
|
||||
out_user = 0;
|
||||
out_kernel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void QueryCoreTimes(uint32 count, ProcessorTime out[])
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue