//**************************************************************************** // $Module type: package // $Module name: GetSystemInfo // $Author : Nils G. Svedmyr // Created : 2003-04-30 @ 20:17 // // Description : // // $Rev History: // 2003-04-30 Module header created // 2004-02-08 Changed to instead use the CrossMerge.dll // This function will also work for 'ghost' or shadow // processors. //**************************************************************************** Use vWin32fh.pkg // Result constants: define HT_NOT_CAPABLE for 0 define HT_ENABLED for 1 define HT_DISABLED for 2 define HT_SUPPORTED_NOT_ENABLED for 3 define HT_CANNOT_DETECT for 4 External_Function CPUCount "CPUCount" CrossMerge.dll ; Pointer LogicalCount ; Pointer PhysicalCount ; Returns Integer Function NumberOfCPUs Global Returns Integer Integer iResult iLogical iPhysical iRetval String sPath Move (psProgramPath(phoWorkSpace(ghoApplication))) To sPath Get vFilePathExists (sPath - "\CrossMerge.dll") To iRetval If (Not(iRetval)) Begin Send Stop_Box ("One of the component files for CrossMerge is missing or damaged." * ; "You should try to reinstall the product to fix the problem or contact your distributor." * ; "The program will be aborted.") Abort End // If (Not(iRetval)) Begin Move 0 To iLogical Move 0 To iPhysical Move (CPUCount(AddressOf(iLogical), AddressOf(iPhysical))) To iResult Function_Return iPhysical End_Function // NumberOfCPUs //Define PROCESSOR_ARCHITECTURE_UNKNOWN For //Define PROCESSOR_ARCHITECTURE_INTEL For //Define PROCESSOR_ARCHITECTURE_MIPS For //Define PROCESSOR_ARCHITECTURE_ALPHA For //Define PROCESSOR_ARCHITECTURE_PPC For //Define PROCESSOR_ARCHITECTURE_IA64 For //Define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 For //Define PROCESSOR_ARCHITECTURE_AMD64 For //typedef struct _SYSTEM_INFO { // DWORD dwOemId // WORD wProcessorArchitecture // WORD wReserved // DWORD dwPageSize // LPVOID lpMinimumApplicationAddress // LPVOID lpMaximumApplicationAddress // DWORD_PTR dwActiveProcessorMask // DWORD dwNumberOfProcessors // DWORD dwProcessorType // DWORD dwAllocationGranularity // WORD wProcessorLevel // WORD wProcessorRevision //External_Function CMGetSystemInfo "GetSystemInfo" Kernel32.dll ; // Pointer lpSystem_Info Returns Integer //Type vtProcessorArchitecture // Field vtProcessorArchitecture.wProcessorArchitecture as UShort // Field vtProcessorArchitecture.wReserved as UShort //End_Type // vtProcessorArchitecture //Type vtSystem_Info // Field vtSystem_Info.dwOemId as dWord // Field vtSystem_Info.dwPageSize as dWord // Field vtSystem_Info.lpMinimumApplicationAddress as Pointer // Field vtSystem_Info.lpMaximumApplicationAddress as Pointer // Field vtSystem_Info.dwActiveProcessorMask as Pointer // Field vtSystem_Info.dwNumberOfProcessors as dWord // Field vtSystem_Info.dwProcessorType as dWord // Field vtSystem_Info.dwAllocationGranularity as dWord // Field vtSystem_Info.wProcessorLevel as UShort // Field vtSystem_Info.wProcessorRevision as UShort //End_Type // vtSystem_Info //Function NumberOfCPUs Global Returns Integer // Integer iRetval // Void_Type iVoid // String sSystemInfo // Pointer lpsSystemInfo // Fill string variable with null characters // ZeroType vtSystem_Info To sSystemInfo // GetAddress Of sSystemInfo To lpsSystemInfo // Move (CMGetSystemInfo(lpsSystemInfo)) To iVoid // Move (CMGetSystemInfo(AddressOf(sSystemInfo))) To iVoid // GetBuff From sSystemInfo At vtSystem_Info.dwNumberOfProcessors To iRetval // Function_Return iRetval //End_Function // NumberOfCPUs