From: cg on 8 Apr 2010 06:09 Hello, I developp a win32 application and i want this application runs under Windows Server 2008 x64 / x32 - Vista x64 / x32 - Seven x64 / x32, and i need to make some modification for my application to be x64 perfectly compliant. My problem is : how to know if my application runs under an Os 64bits or 32bits. I try the GetSystemInfo with the wProcessorArchitecture entry which curiously return 0. Curiously GetVersionEx can't be used. Help would be grateful. Chris.
From: Leo Davidson on 8 Apr 2010 06:50 On Apr 8, 11:09 am, "cg" <c...(a)nospam.fr> wrote: > My problem is : how to know if my application runs under an Os 64bits or Here's one way: // From http://blogs.msdn.com/oldnewthing/archive/2005/02/01/364563.aspx bool Is64BitWindows() { #if defined(_WIN64) return true; // 64-bit programs run only on Win64 #elif defined(_WIN32) // 32-bit programs run on both 32-bit and 64-bit Windows so must sniff BOOL f64 = FALSE; return (::IsWow64Process(::GetCurrentProcess(), &f64) && f64); #else return false; // Win64 does not support Win16 #endif }
From: Stefan Kuhr on 8 Apr 2010 07:14 Hello Chris, On 4/8/2010 12:09 PM, cg wrote: > Hello, > > I developp a win32 application and i want this application runs under > Windows Server 2008 x64 / x32 - Vista x64 / x32 - Seven x64 / x32, and i > need to make some modification for my application to be x64 perfectly > compliant. > My problem is : how to know if my application runs under an Os 64bits or > 32bits. > > I try the GetSystemInfo with the wProcessorArchitecture entry which > curiously return 0. > > Curiously GetVersionEx can't be used. > > Help would be grateful. > > Chris. > > You might find the following snippet useful: typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE hProcess,PBOOL Wow64Process); BOOL IsRunningUnderWow64(void) { BOOL bIsWow64 = FALSE; #ifndef _WIN64 HMODULE hModKrn32 = GetModuleHandleW(L"kernel32"); LPFN_ISWOW64PROCESS fnIsWow64Process = NULL; __analysis_assert(hModKrn32); fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(hModKrn32,"IsWow64Process"); if (NULL != fnIsWow64Process) { if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64)) bIsWow64 = FALSE; } #endif // _WIN64 return bIsWow64; }
From: Dee Earley on 9 Apr 2010 09:07 On 08/04/2010 11:09, cg wrote: > Hello, > > I developp a win32 application and i want this application runs under > Windows Server 2008 x64 / x32 - Vista x64 / x32 - Seven x64 / x32, and i > need to make some modification for my application to be x64 perfectly > compliant. If your app is a 32bit app then it should work exactly as it did before. > My problem is : how to know if my application runs under an Os 64bits or > 32bits. > > I try the GetSystemInfo with the wProcessorArchitecture entry which > curiously return 0. > > Curiously GetVersionEx can't be used. I think it lies to your app if it's 32-bit. (It doesn't say in MSDN so I can't say this definitively.) If you compile a 64bit version you will get the correct answer. -- Dee Earley (dee.earley(a)icode.co.uk) i-Catcher Development Team iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
From: RichK on 9 Apr 2010 10:51 A call to IsWow64Process(GetCurrentProcess(),&bIsWow64); should return success and set bIsWow64 to a non-zero value when it is called from a 32-bit process that is running on an x64 edition of Windows. "Dee Earley" <dee.earley(a)icode.co.uk> wrote in message news:4bbf21b3$0$344$7b0f0fd3(a)reader.news.newnet.co.uk... > On 08/04/2010 11:09, cg wrote: >> Hello, >> >> I developp a win32 application and i want this application runs under >> Windows Server 2008 x64 / x32 - Vista x64 / x32 - Seven x64 / x32, and i >> need to make some modification for my application to be x64 perfectly >> compliant. > > If your app is a 32bit app then it should work exactly as it did before. > >> My problem is : how to know if my application runs under an Os 64bits or >> 32bits. >> >> I try the GetSystemInfo with the wProcessorArchitecture entry which >> curiously return 0. >> >> Curiously GetVersionEx can't be used. > > I think it lies to your app if it's 32-bit. (It doesn't say in MSDN so I > can't say this definitively.) > If you compile a 64bit version you will get the correct answer. > > -- > Dee Earley (dee.earley(a)icode.co.uk) > i-Catcher Development Team > > iCode Systems > > (Replies direct to my email address will be ignored. > Please reply to the group.)
|
Pages: 1 Prev: Unicode and strings Next: What message control object receive when parent windows is resized? |