Fix a few code analysis warnings
This commit is contained in:
parent
28477f0a80
commit
6eaafaf241
|
@ -54,7 +54,6 @@ namespace NtDll
|
||||||
|
|
||||||
#include "CxbxKrnl.h" // For CxbxKrnlCleanup
|
#include "CxbxKrnl.h" // For CxbxKrnlCleanup
|
||||||
#include "Emu.h" // For EmuWarning()
|
#include "Emu.h" // For EmuWarning()
|
||||||
#include "EmuFS.h"
|
|
||||||
#include "EmuKrnl.h" // For InitializeListHead(), etc.
|
#include "EmuKrnl.h" // For InitializeListHead(), etc.
|
||||||
#include "EmuFile.h" // For IsEmuHandle(), NtStatusToString()
|
#include "EmuFile.h" // For IsEmuHandle(), NtStatusToString()
|
||||||
|
|
||||||
|
@ -161,14 +160,14 @@ xboxkrnl::KPRCB *KeGetCurrentPrcb()
|
||||||
#define KeRaiseIrql(NewIrql, OldIrql) \
|
#define KeRaiseIrql(NewIrql, OldIrql) \
|
||||||
*OldIrql = KfRaiseIrql(NewIrql)
|
*OldIrql = KfRaiseIrql(NewIrql)
|
||||||
|
|
||||||
DWORD BootTickCount = 0;
|
ULONGLONG BootTickCount = 0;
|
||||||
|
|
||||||
// The Xbox GetTickCount is measured in milliseconds, just like the native GetTickCount.
|
// The Xbox GetTickCount is measured in milliseconds, just like the native GetTickCount.
|
||||||
// The only difference we'll take into account here, is that the Xbox will probably reboot
|
// The only difference we'll take into account here, is that the Xbox will probably reboot
|
||||||
// much more often than Windows, so we correct this with a 'BootTickCount' value :
|
// much more often than Windows, so we correct this with a 'BootTickCount' value :
|
||||||
DWORD CxbxXboxGetTickCount()
|
DWORD CxbxXboxGetTickCount()
|
||||||
{
|
{
|
||||||
return GetTickCount() - BootTickCount;
|
return (DWORD)(GetTickCount64() - BootTickCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD __stdcall EmuThreadDpcHandler(LPVOID lpVoid)
|
DWORD __stdcall EmuThreadDpcHandler(LPVOID lpVoid)
|
||||||
|
@ -302,7 +301,7 @@ void ConnectKeInterruptTimeToThunkTable(); // forward
|
||||||
|
|
||||||
void CxbxInitPerformanceCounters()
|
void CxbxInitPerformanceCounters()
|
||||||
{
|
{
|
||||||
BootTickCount = GetTickCount();
|
BootTickCount = GetTickCount64();
|
||||||
|
|
||||||
// Measure current host performance counter and frequency
|
// Measure current host performance counter and frequency
|
||||||
QueryPerformanceCounter(&NativePerformanceCounter);
|
QueryPerformanceCounter(&NativePerformanceCounter);
|
||||||
|
@ -430,7 +429,7 @@ XBSYSAPI EXPORTNUM(96) xboxkrnl::NTSTATUS NTAPI xboxkrnl::KeBugCheckEx
|
||||||
"\nContinue Execution (Not Recommended)?\n",
|
"\nContinue Execution (Not Recommended)?\n",
|
||||||
BugCheckCode, BugCheckParameter1, BugCheckParameter2, BugCheckParameter3, BugCheckParameter4);
|
BugCheckCode, BugCheckParameter1, BugCheckParameter2, BugCheckParameter3, BugCheckParameter4);
|
||||||
|
|
||||||
HRESULT result = MessageBoxA(g_hEmuWindow, buffer, "KeBugCheck", MB_YESNO | MB_ICONWARNING);
|
int result = MessageBoxA(g_hEmuWindow, buffer, "KeBugCheck", MB_YESNO | MB_ICONWARNING);
|
||||||
|
|
||||||
if (result == IDNO) {
|
if (result == IDNO) {
|
||||||
CxbxKrnlCleanup(NULL);
|
CxbxKrnlCleanup(NULL);
|
||||||
|
|
|
@ -533,13 +533,13 @@ XBSYSAPI EXPORTNUM(181) xboxkrnl::NTSTATUS NTAPI xboxkrnl::MmQueryStatistics
|
||||||
{
|
{
|
||||||
LOG_FUNC_ONE_ARG_OUT(MemoryStatistics);
|
LOG_FUNC_ONE_ARG_OUT(MemoryStatistics);
|
||||||
|
|
||||||
MEMORYSTATUS MemoryStatus;
|
MEMORYSTATUSEX MemoryStatus;
|
||||||
SYSTEM_INFO SysInfo;
|
SYSTEM_INFO SysInfo;
|
||||||
NTSTATUS ret;
|
NTSTATUS ret;
|
||||||
|
|
||||||
if (MemoryStatistics->Length == sizeof(MM_STATISTICS))
|
if (MemoryStatistics->Length == sizeof(MM_STATISTICS))
|
||||||
{
|
{
|
||||||
GlobalMemoryStatus(&MemoryStatus);
|
GlobalMemoryStatusEx(&MemoryStatus);
|
||||||
GetSystemInfo(&SysInfo);
|
GetSystemInfo(&SysInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -547,12 +547,12 @@ XBSYSAPI EXPORTNUM(181) xboxkrnl::NTSTATUS NTAPI xboxkrnl::MmQueryStatistics
|
||||||
* are setup correctly below, these two lines become redundant
|
* are setup correctly below, these two lines become redundant
|
||||||
*/
|
*/
|
||||||
ZeroMemory(MemoryStatistics, sizeof(MM_STATISTICS));
|
ZeroMemory(MemoryStatistics, sizeof(MM_STATISTICS));
|
||||||
MemoryStatistics->Length = sizeof(MM_STATISTICS);
|
//MemoryStatistics->Length = sizeof(MM_STATISTICS);
|
||||||
|
|
||||||
MemoryStatistics->TotalPhysicalPages = MemoryStatus.dwTotalPhys / SysInfo.dwPageSize;
|
MemoryStatistics->TotalPhysicalPages = (ULONG)(MemoryStatus.ullTotalPhys / SysInfo.dwPageSize);
|
||||||
MemoryStatistics->AvailablePages = MemoryStatus.dwAvailPhys / SysInfo.dwPageSize;
|
MemoryStatistics->AvailablePages = (ULONG)(MemoryStatus.ullAvailPhys / SysInfo.dwPageSize);
|
||||||
MemoryStatistics->VirtualMemoryBytesCommitted = MemoryStatus.dwTotalVirtual - MemoryStatus.dwAvailVirtual;
|
MemoryStatistics->VirtualMemoryBytesCommitted = (ULONG)(MemoryStatus.ullTotalVirtual - MemoryStatus.ullAvailVirtual);
|
||||||
MemoryStatistics->VirtualMemoryBytesReserved = MemoryStatus.dwAvailVirtual;
|
MemoryStatistics->VirtualMemoryBytesReserved = (ULONG)(MemoryStatus.ullAvailVirtual);
|
||||||
// MemoryStatistics->CachePagesCommitted = [ ];
|
// MemoryStatistics->CachePagesCommitted = [ ];
|
||||||
// MemoryStatistics->PoolPagesCommitted = [ ];
|
// MemoryStatistics->PoolPagesCommitted = [ ];
|
||||||
// MemoryStatistics->StackPagesCommitted = [ ];
|
// MemoryStatistics->StackPagesCommitted = [ ];
|
||||||
|
|
Loading…
Reference in New Issue