mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Remove some unused stuff from pnUtMisc.
This commit is contained in:
@ -47,13 +47,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#include "../pnUtils.h"
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Private
|
||||
*
|
||||
***/
|
||||
static MEMORYSTATUSEX s_memstatus;
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Exports
|
||||
@ -65,70 +58,12 @@ const wchar_t * AppGetCommandLine () {
|
||||
return GetCommandLineW();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void MachineGetName (wchar_t *computerName, unsigned int length) {
|
||||
DWORD len = length;
|
||||
GetComputerNameW(computerName, &len);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* System status
|
||||
*
|
||||
***/
|
||||
|
||||
//============================================================================
|
||||
void MemoryGetStatus (MemoryStatus * status) {
|
||||
MEMORYSTATUSEX mem;
|
||||
mem.dwLength = sizeof(mem);
|
||||
GlobalMemoryStatusEx(&mem);
|
||||
|
||||
const uint64_t BYTES_PER_MB = 1024 * 1024;
|
||||
status->totalPhysMB = unsigned(mem.ullTotalPhys / BYTES_PER_MB);
|
||||
status->availPhysMB = unsigned(mem.ullAvailPhys / BYTES_PER_MB);
|
||||
status->totalPageFileMB = unsigned(mem.ullTotalPageFile / BYTES_PER_MB);
|
||||
status->availPageFileMB = unsigned(mem.ullAvailPageFile / BYTES_PER_MB);
|
||||
status->totalVirtualMB = unsigned(mem.ullTotalVirtual / BYTES_PER_MB);
|
||||
status->availVirtualMB = unsigned(mem.ullAvailVirtual / BYTES_PER_MB);
|
||||
status->memoryLoad = mem.dwMemoryLoad;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
void DiskGetStatus (ARRAY(DiskStatus) * disks) {
|
||||
DWORD length = GetLogicalDriveStrings(0, NULL);
|
||||
if (!length || length > 2048)
|
||||
return;
|
||||
|
||||
wchar_t* buffer = (wchar_t*)malloc((length + 1) * sizeof(wchar_t));
|
||||
wchar_t* origbuf = buffer;
|
||||
if (!GetLogicalDriveStringsW(length, buffer))
|
||||
{
|
||||
free(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
for (; *buffer; buffer += StrLen(buffer) + 1) {
|
||||
UINT driveType = GetDriveTypeW(buffer);
|
||||
if (driveType != DRIVE_FIXED)
|
||||
continue;
|
||||
|
||||
ULARGE_INTEGER freeBytes;
|
||||
ULARGE_INTEGER totalBytes;
|
||||
if (!GetDiskFreeSpaceExW(buffer, &freeBytes, &totalBytes, NULL))
|
||||
continue;
|
||||
|
||||
DiskStatus status;
|
||||
StrCopy(status.name, buffer, arrsize(status.name));
|
||||
|
||||
const uint64_t BYTES_PER_MB = 1024 * 1024;
|
||||
status.totalSpaceMB = unsigned(totalBytes.QuadPart / BYTES_PER_MB);
|
||||
status.freeSpaceMB = unsigned(freeBytes.QuadPart / BYTES_PER_MB);
|
||||
|
||||
disks->Add(status);
|
||||
}
|
||||
free(origbuf);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// Loosely taken from MS's cpuid code sample
|
||||
void CpuGetInfo (
|
||||
|
@ -51,16 +51,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "Pch.h"
|
||||
#include "pnUtArray.h"
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Constants
|
||||
*
|
||||
***/
|
||||
|
||||
const wchar_t UNICODE_BOM = 0xfeff; // Unicode byte-order mark
|
||||
const char UTF8_BOM[] = "\xef\xbb\xbf";
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Module instance functions
|
||||
@ -80,14 +70,6 @@ void * ModuleGetInstance ();
|
||||
const wchar_t * AppGetCommandLine ();
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* System info functions
|
||||
*
|
||||
***/
|
||||
void MachineGetName (wchar_t * computerName, unsigned length = 32);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Misc types
|
||||
@ -101,46 +83,12 @@ typedef void (CDECL * FStateDump)(
|
||||
...
|
||||
);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Dll initialization
|
||||
*
|
||||
***/
|
||||
|
||||
#if HS_BUILD_FOR_WIN32
|
||||
#define SRV_MODULE_PRE_INIT() \
|
||||
extern BOOL WINAPI PreDllMain (HANDLE handle, DWORD reason, LPVOID); \
|
||||
extern "C" BOOL (WINAPI *_pRawDllMain)(HANDLE, DWORD, LPVOID) = PreDllMain
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* System status
|
||||
*
|
||||
***/
|
||||
|
||||
struct MemoryStatus {
|
||||
unsigned totalPhysMB; // total physical memory
|
||||
unsigned availPhysMB; // free physical memory
|
||||
unsigned totalPageFileMB; // total page file size
|
||||
unsigned availPageFileMB; // free page file size
|
||||
unsigned totalVirtualMB; // total virtual address space for calling process
|
||||
unsigned availVirtualMB; // available virtual address space for calling process
|
||||
unsigned memoryLoad; // 0..100
|
||||
};
|
||||
void MemoryGetStatus (MemoryStatus * status);
|
||||
|
||||
struct DiskStatus {
|
||||
wchar_t name[16];
|
||||
unsigned totalSpaceMB;
|
||||
unsigned freeSpaceMB;
|
||||
};
|
||||
|
||||
void DiskGetStatus (ARRAY(DiskStatus) * disks);
|
||||
|
||||
|
||||
void CpuGetInfo (
|
||||
uint16_t * cpuCaps,
|
||||
uint32_t * cpuVendor,
|
||||
|
Reference in New Issue
Block a user