Antonio Linares wrote:http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_iswin64
#include "Fivewin.ch"
FUNCTION MAIN()
? IsWow64()
RETURN NIL
//---------------------------------------------------------------------------
#pragma BEGINDUMP
#include <windows.h>
#include <stdio.h>
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process;
HB_FUNC( ISWOW64 )
{
BOOL bIsWow64 = FALSE;
//IsWow64Process is not available on all supported versions of Windows.
//Use GetModuleHandle to get a handle to the DLL that contains the function
//and GetProcAddress to get a pointer to the function if available.
fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
GetModuleHandle(TEXT("kernel32")),"IsWow64Process");
if(NULL != fnIsWow64Process)
{
if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
{
//handle error
}
}
hb_retl( bIsWow64 );
return; // bIsWow64;
}
#pragma ENDDUMP
//---------------------------------------------------------------------------
#ifdef _WIN64
HB_FUNC( ISWIN64 ) // Check if Windows 64 is running
{
hb_retl( ( sizeof( void * ) == 8 ) );
}
#else
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process;
HB_FUNC( ISWIN64 )
{
BOOL bIsWow64 = FALSE;
//IsWow64Process is not available on all supported versions of Windows.
//Use GetModuleHandle to get a handle to the DLL that contains the function
//and GetProcAddress to get a pointer to the function if available.
fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
GetModuleHandle( "kernel32") ,"IsWow64Process");
if(NULL != fnIsWow64Process)
{
!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
}
hb_retl( bIsWow64 );
}
#endif /*_WIN64*/
Daniel Garcia-Gil wrote:HB_FUNC( ISWIN64 )
Davide wrote:Daniel,
thank you for your feedback.Daniel Garcia-Gil wrote:HB_FUNC( ISWIN64 )
I intentionally left IsWin64() untouched and added IsWow64() because the former is already used (for example) in rPreview.prg to determine whether to load the 32 or 64 bit DLL. Your change would make a FWH32 program trying to load PREV64.DLL (that's not possible)
Hi,
Davide
HB_FUNC( ISWIN64 ) // Check if Windows 64 is running
{
hb_retl( ( sizeof( void * ) == 8 ) );
}
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process;
HB_FUNC( ISWOW64 )
{
BOOL bIsWow64 = FALSE;
//IsWow64Process is not available on all supported versions of Windows.
//Use GetModuleHandle to get a handle to the DLL that contains the function
//and GetProcAddress to get a pointer to the function if available.
fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
GetModuleHandle( "kernel32") ,"IsWow64Process");
if(NULL != fnIsWow64Process)
{
fnIsWow64Process(GetCurrentProcess(),&bIsWow64);
}
hb_retl( bIsWow64 );
}
Daniel Garcia-Gil wrote:The function IsWin64 return .T. / .F. if the application was built under 64
Function IsWow64 return .T. / .F. if the application was built in 32bit and run over 64
- Code: Select all Expand view
HB_FUNC( ISWIN64 ) // Check if Windows 64 is running
Davide wrote:Obviously if it's .T. you're evidently using Windows64 bit, but a FWH32 program will always return .F. even on Win64 (that's why I added IsWow64)
#include "Fivewin.ch"
FUNCTION MAIN()
? "Is Windows 64 (IsWin64):" + cValToStr( IsWin64() ), "Is Windows 64 (IsWow64):" + cValToStr( IsWow64() )
RETURN NIL
Daniel Garcia-Gil wrote:the applications built in 64bit no run in 32bits
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 81 guests