function print(...)
Debug.ShowWindow();
for i, v in pairs{...}do
Debug.Print(tostring(v).."\t");
end
Debug.Print("\r\n");
return true;
end
-- wProcessorArchitecture
PROCESSOR_ARCHITECTURE_AMD64 = 9 -- x64 (AMD or Intel)
PROCESSOR_ARCHITECTURE_IA64 = 6 -- Intel Itanium-based
PROCESSOR_ARCHITECTURE_INTEL = 0 -- x86
PROCESSOR_ARCHITECTURE_UNKNOWN = 0xffff
PROCS = {
[PROCESSOR_ARCHITECTURE_AMD64] = "x64 (AMD / Intel)";
[PROCESSOR_ARCHITECTURE_IA64] = "Intel Itanium-based";
[PROCESSOR_ARCHITECTURE_INTEL] = "x86";
[PROCESSOR_ARCHITECTURE_UNKNOWN] = "Unknown";
};
SYSTEM_INFO = MemoryEx.DefineStruct{
UNION{
UDWORD ("dwOemId");
UWORD ("wProcessorArchitecture", 2); -- [0] is the field you want. [1] is reserved.
};
UDWORD ("dwPageSize");
UINT ("lpMinimumApplicationAddress");
UINT ("lpMaximumApplicationAddress");
UDWORD ("dwActiveProcessorMask");
UDWORD ("dwNumberOfProcessors");
UDWORD ("dwProcessorType");
UDWORD ("dwAllocationGranularity");
UWORD ("wProcessorLevel");
UWORD ("wProcessorRevision");
};
function GetSystemInfo(lpStructure)
local proc = "GetSystemInfo";
if(System.Is64BitOS())then
proc = "GetNativeSystemInfo";
end
DLL.CallFunction("kernel32.dll", proc, tostring(lpStructure), DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
end
hBuffer = MemoryEx.AllocateEx(MemoryEx.StructSize(SYSTEM_INFO));
if(hBuffer)then
local hSystemInfo = hBuffer:AssignStruct(SYSTEM_INFO);
if(hSystemInfo)then
GetSystemInfo(hBuffer:GetPointer());
print("Proc Architecture", PROCS[hSystemInfo.wProcessorArchitecture[0]]);
print("Proc Level", hSystemInfo.wProcessorLevel);
print("Proc Revision", hSystemInfo.wProcessorRevision);
print("CPU's / Cores", hSystemInfo.dwNumberOfProcessors);
print("Page-size\t", tostring(hSystemInfo.dwPageSize).." bytes");
hSystemInfo:Close();
end
hBuffer:Free();
end
Comments