11 #include <drift/dslcore.h>
12 #include <drift/os_version.h>
15 const char * DSL_CC GetOSVersion() {
17 return "Windows (64-bit)";
19 return "Windows (32-bit)";
23 typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
24 LPFN_ISWOW64PROCESS fnIsWow64Process=NULL;
26 bool DSL_CC Is64Bit() {
30 if (fnIsWow64Process == NULL) {
31 fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandleA(
"kernel32"),
"IsWow64Process");
33 if (fnIsWow64Process == NULL) {
return false; }
35 BOOL bIsWow64 = FALSE;
36 if (fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) {
45 static char Get_OS_Version_Buf[1024];
46 const char * DSL_CC GetOSVersion() {
48 memset(&name, 0,
sizeof(name));
49 if (uname(&name) >= 0) {
50 sprintf(Get_OS_Version_Buf,
"%s %s %s on %s", name.sysname, name.version, name.release, name.machine);
51 return Get_OS_Version_Buf;
54 return "POSIX-compliant OS";
56 return "Non-Windows OS";
61 bool DSL_CC Is64Bit() {
62 #if defined(__x86_64__)
70 DSL_API
void DSL_CC linux_cpuid(
int cpuInfo[4],
int function_id) {
71 __cpuid(function_id, cpuInfo[0], cpuInfo[1], cpuInfo[2], cpuInfo[3]);
78 const InstructionSet::InstructionSet_Internal InstructionSet::CPU_Rep;