1 /** 2 * \file os_is64bit.c 3 * \brief Native code-side checking for a 64-bit architecture. 4 * \author Copyright (c) 2011 Jason Perkins and the Premake project 5 */ 6 7 #include "premake.h" 8 os_is64bit(lua_State * L)9int os_is64bit(lua_State* L) 10 { 11 // If this code returns true, then the platform is 64-bit. If it 12 // returns false, the platform might still be 64-bit, but more 13 // checking will need to be done on the Lua side of things. 14 #if PLATFORM_WINDOWS 15 typedef BOOL (WINAPI* WowFuncSig)(HANDLE, PBOOL); 16 WowFuncSig func = (WowFuncSig)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); 17 if (func) 18 { 19 BOOL isWow = FALSE; 20 if (func(GetCurrentProcess(), &isWow)) 21 { 22 lua_pushboolean(L, isWow); 23 return 1; 24 } 25 } 26 #endif 27 28 lua_pushboolean(L, 0); 29 return 1; 30 } 31