Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Problems with API call


4 replies to this topic

aseyer

aseyer
  • Members
  • 21 posts

Posted 26 February 2004 - 21:28

I am trying to get 32-bit code to detect if it is running on a 64-bit OS. Here is the code I have and never is able to properly execute the punction

//PROTOTYPES
prototype BOOL KERNEL.IsWow64Process(HWND,POINTER);

//VARIABLES
POINTER pIsWow;
HWND hHwnd ;

//First, Get the Process Hangler
nHwnd = GetWindowHandle (HWND_INSTALL);

//Next, ApiCall to see if Running on WOW64
nvResult = KERNEL.IsWow64Process(hHwnd,pIsWow);

//Parse Results
if pIsWow = 1 then
MessageBox("64-Bit OS",INFORMATION);
abort;
else
MessageBox("Not a 64-Bit OS",INFORMATION);
endif;


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 27 February 2004 - 14:16

You're misusing the second parameter. Define it as BYREF BOOL and define
BOOL IsWow;


aseyer

aseyer
  • Members
  • 21 posts

Posted 27 February 2004 - 17:30

Made the changes, however nvResult is still coming back as 0 (failed).

This call should work on XP systems and above. The documentation says I do not need to call USEDLL on the Kernel, so I don't think that is the issue.

Any other ideas?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 29 February 2004 - 17:24

Looks like IsWow64Process wants a process handle, not a window handle. So you would have to pass in the handle to the installscript engine process (which I guess would require another API call)

aseyer

aseyer
  • Members
  • 21 posts

Posted 01 March 2004 - 19:11

Yep that worked.

For anyone who uses this: This code must only be executed on Windows 2000 and above. IsWow64process is not in 9X or NT kernels. This should work on all flavors (AMD, Prescott, and Itanium) 64-bit operating systems.

Thanks for your help!

Here's the code:

prototype BOOL KERNEL.IsWow64Process(HWND,BYREF BOOL);
prototype HWND KERNEL.GetCurrentProcess();
NUMBER nResult;
HWND hHwnd;
BOOL bIsWow;

hHwnd = KERNEL.GetCurrentProcess();

nvResult = KERNEL.IsWow64Process(hHwnd,bIsWow);

if bIsWow = 1 then
MessageBox("64-Bit OS",INFORMATION);
else
MessageBox("Not a 64-Bit OS",INFORMATION);
endif;

Edited by aseyer, 01 March 2004 - 19:13.