From 43a0697b3dc1b2b3ea4d8162b802569a045f9fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Sat, 1 Feb 2014 09:11:23 +0100 Subject: [PATCH] 2014-02-01 09:11 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbwince.h - removed GetProcAddress() redefinition which forced ANSI version not supported in recent Windows Mobile MSVC libraries * include/hbwinuni.h + added new macros which hide differences between Windows systems in GetProcAddress() usage: HB_WINAPI_GETPROCADDRESS() and HB_WINAPI_GETPROCADDRESST() The second one adds "W" or "A" suffix to function names. - removed not longer used HB_WINAPI_FUNCTION_NAME() macro * src/vm/dynlibhb.c * updated hb_libSymAddr() to work with Unicode version of GetProcAddress() in WinCE builds * src/vm/maindllp/dllpcode.c * updated hb_dllGetProcAddress() to work with Unicode version of GetProcAddress() in WinCE builds * contrib/hbwin/wapi_winbase.c * updated WAPI_GetProcAddress() to work with Unicode version of GetProcAddress() in WinCE builds * src/common/hbdate.c * src/common/hbver.c * src/rtl/diskspac.c * src/rtl/disksphb.c * src/rtl/fslink.c * src/rtl/gtwin/gtwin.c * src/rtl/gtwvt/gtwvt.c * src/vm/extrap.c * contrib/gtwvg/gtwvgd.c * contrib/gtwvg/wvgwin.c * contrib/hbwin/axcore.c * contrib/hbwin/mapi.c * contrib/hbwin/wapi_shellapi.c * contrib/hbwin/wapi_winbase.c * contrib/hbwin/wapi_wingdi_font.c * contrib/hbwin/win_prn2.c * contrib/hbwin/win_prn3.c * contrib/hbwin/win_rpc.c * extras/gtwvw/gtwvwd.c * use HB_WINAPI_GETPROCADDRESS*() --- ChangeLog.txt | 45 ++++++++++++++++++++++++++++++++ contrib/gtwvg/gtwvgd.c | 12 ++++----- contrib/gtwvg/wvgwin.c | 2 +- contrib/hbwin/axcore.c | 4 +-- contrib/hbwin/mapi.c | 2 +- contrib/hbwin/wapi_shellapi.c | 2 +- contrib/hbwin/wapi_winbase.c | 19 +++++++++++--- contrib/hbwin/wapi_wingdi_font.c | 8 +++--- contrib/hbwin/win_prn2.c | 4 +-- contrib/hbwin/win_prn3.c | 4 +-- contrib/hbwin/win_rpc.c | 6 ++--- extras/gtwvw/gtwvwd.c | 2 +- include/hbwince.h | 6 ----- include/hbwinuni.h | 11 ++++++-- src/common/hbdate.c | 3 ++- src/common/hbver.c | 4 +-- src/rtl/diskspac.c | 2 +- src/rtl/disksphb.c | 2 +- src/rtl/fslink.c | 6 ++--- src/rtl/gtwin/gtwin.c | 12 ++++----- src/rtl/gtwvt/gtwvt.c | 10 ++++--- src/vm/dynlibhb.c | 7 ++++- src/vm/extrap.c | 7 ++--- src/vm/maindllp/dllpcode.c | 12 ++++++--- 24 files changed, 131 insertions(+), 61 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index b50b8c1286..06ddb24047 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,51 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-02-01 09:11 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * include/hbwince.h + - removed GetProcAddress() redefinition which forced ANSI + version not supported in recent Windows Mobile MSVC libraries + + * include/hbwinuni.h + + added new macros which hide differences between Windows systems + in GetProcAddress() usage: HB_WINAPI_GETPROCADDRESS() and + HB_WINAPI_GETPROCADDRESST() + The second one adds "W" or "A" suffix to function names. + - removed not longer used HB_WINAPI_FUNCTION_NAME() macro + + * src/vm/dynlibhb.c + * updated hb_libSymAddr() to work with Unicode version of + GetProcAddress() in WinCE builds + + * src/vm/maindllp/dllpcode.c + * updated hb_dllGetProcAddress() to work with Unicode version of + GetProcAddress() in WinCE builds + + * contrib/hbwin/wapi_winbase.c + * updated WAPI_GetProcAddress() to work with Unicode version of + GetProcAddress() in WinCE builds + + * src/common/hbdate.c + * src/common/hbver.c + * src/rtl/diskspac.c + * src/rtl/disksphb.c + * src/rtl/fslink.c + * src/rtl/gtwin/gtwin.c + * src/rtl/gtwvt/gtwvt.c + * src/vm/extrap.c + * contrib/gtwvg/gtwvgd.c + * contrib/gtwvg/wvgwin.c + * contrib/hbwin/axcore.c + * contrib/hbwin/mapi.c + * contrib/hbwin/wapi_shellapi.c + * contrib/hbwin/wapi_winbase.c + * contrib/hbwin/wapi_wingdi_font.c + * contrib/hbwin/win_prn2.c + * contrib/hbwin/win_prn3.c + * contrib/hbwin/win_rpc.c + * extras/gtwvw/gtwvwd.c + * use HB_WINAPI_GETPROCADDRESS*() + 2014-01-30 16:28 UTC-0200 Raphael Gozzo (raphaelgz users.noreply.github.com) * package/harbour.spec + Added detection of CentOS diff --git a/contrib/gtwvg/gtwvgd.c b/contrib/gtwvg/gtwvgd.c index 35d4044b29..e2020279da 100644 --- a/contrib/gtwvg/gtwvgd.c +++ b/contrib/gtwvg/gtwvgd.c @@ -2702,10 +2702,10 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT ) rt.bottom = 0; #ifdef MONITOR_DEFAULTTONEAREST - pMonitorFromWindow = ( P_MFW ) GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ), - "MonitorFromWindow" ); - pGetMonitorInfo = ( P_GMI ) GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ), - "GetMonitorInfo" ); + pMonitorFromWindow = ( P_MFW ) HB_WINAPI_GETPROCADDRESS( GetModuleHandle( TEXT( "user32.dll" ) ), + "MonitorFromWindow" ); + pGetMonitorInfo = ( P_GMI ) HB_WINAPI_GETPROCADDRESS( GetModuleHandle( TEXT( "user32.dll" ) ), + "GetMonitorInfo" ); if( pMonitorFromWindow && pGetMonitorInfo ) { @@ -4313,7 +4313,7 @@ static void hb_wvt_gtLoadGuiData( void ) if( h ) { /* workaround for wrong declarations in some old C compilers */ - s_guiData->pfnGF = ( wvtGradientFill ) GetProcAddress( h, "GradientFill" ); + s_guiData->pfnGF = ( wvtGradientFill ) HB_WINAPI_GETPROCADDRESS( h, "GradientFill" ); if( s_guiData->pfnGF ) s_guiData->hMSImg32 = h; } @@ -4321,7 +4321,7 @@ static void hb_wvt_gtLoadGuiData( void ) h = GetModuleHandle( TEXT( "user32.dll" ) ); if( h ) { - s_guiData->pfnLayered = ( wvtSetLayeredWindowAttributes ) GetProcAddress( h, "SetLayeredWindowAttributes" ); + s_guiData->pfnLayered = ( wvtSetLayeredWindowAttributes ) HB_WINAPI_GETPROCADDRESS( h, "SetLayeredWindowAttributes" ); if( s_guiData->pfnLayered ) s_guiData->hUser32 = h; } diff --git a/contrib/gtwvg/wvgwin.c b/contrib/gtwvg/wvgwin.c index 675a5edc32..bfe5117bad 100644 --- a/contrib/gtwvg/wvgwin.c +++ b/contrib/gtwvg/wvgwin.c @@ -1036,7 +1036,7 @@ HB_FUNC( WVG_SETLAYEREDWINDOWATTRIBUTES ) h = GetModuleHandle( TEXT( "user32.dll" ) ); if( h ) { - pfnLayered = ( wvtSetLayeredWindowAttributes ) GetProcAddress( h, "SetLayeredWindowAttributes" ); + pfnLayered = ( wvtSetLayeredWindowAttributes ) HB_WINAPI_GETPROCADDRESS( h, "SetLayeredWindowAttributes" ); if( pfnLayered ) { HWND hWnd = hbwapi_par_raw_HWND( 1 ); diff --git a/contrib/hbwin/axcore.c b/contrib/hbwin/axcore.c index 715102d286..9a55608b80 100644 --- a/contrib/hbwin/axcore.c +++ b/contrib/hbwin/axcore.c @@ -109,8 +109,8 @@ HB_BOOL hb_oleAxInit( void ) s_hLib = NULL; return HB_FALSE; } - pAtlAxWinInit = ( PHB_AX_WININIT ) GetProcAddress( s_hLib, "AtlAxWinInit" ); - s_pAtlAxGetControl = ( PHB_AX_GETCTRL ) GetProcAddress( s_hLib, "AtlAxGetControl" ); + pAtlAxWinInit = ( PHB_AX_WININIT ) HB_WINAPI_GETPROCADDRESS( s_hLib, "AtlAxWinInit" ); + s_pAtlAxGetControl = ( PHB_AX_GETCTRL ) HB_WINAPI_GETPROCADDRESS( s_hLib, "AtlAxGetControl" ); if( pAtlAxWinInit ) ( *pAtlAxWinInit )(); diff --git a/contrib/hbwin/mapi.c b/contrib/hbwin/mapi.c index 2cb951a47b..29cae4a7d7 100644 --- a/contrib/hbwin/mapi.c +++ b/contrib/hbwin/mapi.c @@ -93,7 +93,7 @@ HB_FUNC( WIN_MAPISENDMAIL ) #endif ) ) >= ( HINSTANCE ) 32 ) { - LPMAPISENDMAIL MAPISendMail = ( LPMAPISENDMAIL ) GetProcAddress( hMapiDll, "MAPISendMail" ); + LPMAPISENDMAIL MAPISendMail = ( LPMAPISENDMAIL ) HB_WINAPI_GETPROCADDRESS( hMapiDll, "MAPISendMail" ); if( MAPISendMail ) { diff --git a/contrib/hbwin/wapi_shellapi.c b/contrib/hbwin/wapi_shellapi.c index c58f804137..538de7e4d3 100644 --- a/contrib/hbwin/wapi_shellapi.c +++ b/contrib/hbwin/wapi_shellapi.c @@ -87,7 +87,7 @@ HB_FUNC( WAPI_ISUSERANADMIN ) { typedef int ( WINAPI * ISUSERANADMIN )( void ); ISUSERANADMIN pIsUserAnAdmin = ( ISUSERANADMIN ) - GetProcAddress( hLib, "IsUserAnAdmin" ); + HB_WINAPI_GETPROCADDRESS( hLib, "IsUserAnAdmin" ); if( pIsUserAnAdmin ) bResult = ( pIsUserAnAdmin )(); diff --git a/contrib/hbwin/wapi_winbase.c b/contrib/hbwin/wapi_winbase.c index f683cbabe5..5468c52884 100644 --- a/contrib/hbwin/wapi_winbase.c +++ b/contrib/hbwin/wapi_winbase.c @@ -229,9 +229,20 @@ HB_FUNC( WAPI_GETPROCADDRESS ) { FARPROC pProc; DWORD dwLastError; - pProc = GetProcAddress( ( HMODULE ) hb_parptr( 1 ), HB_ISCHAR( 2 ) ? - hb_parc( 2 ) : ( LPCSTR ) ( HB_PTRDIFF ) hb_parnint( 2 ) ); +#if defined( HB_OS_WIN_CE ) + void * hProcName; + LPCTSTR lpProcName = HB_PARSTR( 2, &hProcName, NULL ); + pProc = GetProcAddress( ( HMODULE ) hb_parptr( 1 ), + lpProcName ? lpProcName : + ( LPCTSTR ) ( HB_PTRDIFF ) hb_parnint( 2 ) ); dwLastError = GetLastError(); + hb_strfree( hProcName ); +#else + pProc = GetProcAddress( ( HMODULE ) hb_parptr( 1 ), + HB_ISCHAR( 2 ) ? hb_parc( 2 ) : + ( LPCSTR ) ( HB_PTRDIFF ) hb_parnint( 2 ) ); + dwLastError = GetLastError(); +#endif hbwapi_SetLastError( dwLastError ); hb_retptr( ( void * ) ( HB_PTRDIFF ) pProc ); } @@ -381,8 +392,8 @@ HB_FUNC( WAPI_GETLONGPATHNAME ) { s_getPathNameAddr = ( _HB_GETPATHNAME ) - GetProcAddress( GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ), - HB_WINAPI_FUNCTION_NAME( "GetLongPathName" ) ); + HB_WINAPI_GETPROCADDRESST( GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ), + "GetLongPathName" ); if( ! s_getPathNameAddr ) s_getPathNameAddr = GetShortPathName; diff --git a/contrib/hbwin/wapi_wingdi_font.c b/contrib/hbwin/wapi_wingdi_font.c index 4030e2b9a6..5d8400df41 100644 --- a/contrib/hbwin/wapi_wingdi_font.c +++ b/contrib/hbwin/wapi_wingdi_font.c @@ -75,8 +75,8 @@ HB_FUNC( WAPI_ADDFONTRESOURCEEX ) static _HB_ADDFONTRESOURCEEX s_pAddFontResourceEx = NULL; if( ! s_pAddFontResourceEx ) - s_pAddFontResourceEx = ( _HB_ADDFONTRESOURCEEX ) GetProcAddress( GetModuleHandle( TEXT( "gdi32.dll" ) ), - HB_WINAPI_FUNCTION_NAME( "AddFontResourceEx" ) ); + s_pAddFontResourceEx = ( _HB_ADDFONTRESOURCEEX ) HB_WINAPI_GETPROCADDRESST( GetModuleHandle( TEXT( "gdi32.dll" ) ), + "AddFontResourceEx" ); if( s_pAddFontResourceEx ) { @@ -101,8 +101,8 @@ HB_FUNC( WAPI_REMOVEFONTRESOURCEEX ) static _HB_REMOVEFONTRESOURCEEX s_pRemoveFontResourceEx = NULL; if( ! s_pRemoveFontResourceEx ) - s_pRemoveFontResourceEx = ( _HB_REMOVEFONTRESOURCEEX ) GetProcAddress( GetModuleHandle( TEXT( "gdi32.dll" ) ), - HB_WINAPI_FUNCTION_NAME( "RemoveFontResourceEx" ) ); + s_pRemoveFontResourceEx = ( _HB_REMOVEFONTRESOURCEEX ) HB_WINAPI_GETPROCADDRESST( GetModuleHandle( TEXT( "gdi32.dll" ) ), + "RemoveFontResourceEx" ); if( s_pRemoveFontResourceEx ) { diff --git a/contrib/hbwin/win_prn2.c b/contrib/hbwin/win_prn2.c index 412d39845a..45df5c2229 100644 --- a/contrib/hbwin/win_prn2.c +++ b/contrib/hbwin/win_prn2.c @@ -132,8 +132,8 @@ static void hb_GetDefaultPrinter( PHB_ITEM pPrinterName ) if( hWinSpool ) { - fnGetDefaultPrinter = ( DEFPRINTER ) GetProcAddress( hWinSpool, - HB_WINAPI_FUNCTION_NAME( "GetDefaultPrinter" ) ); + fnGetDefaultPrinter = ( DEFPRINTER ) HB_WINAPI_GETPROCADDRESST( hWinSpool, + "GetDefaultPrinter" ); if( fnGetDefaultPrinter ) { diff --git a/contrib/hbwin/win_prn3.c b/contrib/hbwin/win_prn3.c index b1ec61a083..0bd8299f93 100644 --- a/contrib/hbwin/win_prn3.c +++ b/contrib/hbwin/win_prn3.c @@ -125,8 +125,8 @@ static HB_BOOL hb_SetDefaultPrinter( LPCTSTR lpPrinterName ) if( ! hWinSpool ) return HB_FALSE; - fnSetDefaultPrinter = ( DEFPRINTER ) GetProcAddress( hWinSpool, - HB_WINAPI_FUNCTION_NAME( "SetDefaultPrinter" ) ); + fnSetDefaultPrinter = ( DEFPRINTER ) HB_WINAPI_GETPROCADDRESST( hWinSpool, + "SetDefaultPrinter" ); if( ! fnSetDefaultPrinter ) { diff --git a/contrib/hbwin/win_rpc.c b/contrib/hbwin/win_rpc.c index 1e699a1ca6..da139734f3 100644 --- a/contrib/hbwin/win_rpc.c +++ b/contrib/hbwin/win_rpc.c @@ -72,10 +72,10 @@ HB_FUNC( WIN_UUIDCREATESTRING ) { HMODULE hRpcrt4 = GetModuleHandle( TEXT( "rpcrt4.dll" ) ); - s_pUuidCreate = ( _HB_UUIDCREATE ) GetProcAddress( hRpcrt4, "UuidCreate" ); + s_pUuidCreate = ( _HB_UUIDCREATE ) HB_WINAPI_GETPROCADDRESS( hRpcrt4, "UuidCreate" ); - s_pUuidToString = ( _HB_UUIDTOSTRING ) GetProcAddress( hRpcrt4, HB_WINAPI_FUNCTION_NAME( "UuidToString" ) ); - s_pRpcStringFree = ( _HB_RPCSTRINGFREE ) GetProcAddress( hRpcrt4, HB_WINAPI_FUNCTION_NAME( "RpcStringFree" ) ); + s_pUuidToString = ( _HB_UUIDTOSTRING ) HB_WINAPI_GETPROCADDRESST( hRpcrt4, "UuidToString" ); + s_pRpcStringFree = ( _HB_RPCSTRINGFREE ) HB_WINAPI_GETPROCADDRESST( hRpcrt4, "RpcStringFree" ); } if( s_pUuidCreate && diff --git a/extras/gtwvw/gtwvwd.c b/extras/gtwvw/gtwvwd.c index 3932e7cefe..8f96821190 100644 --- a/extras/gtwvw/gtwvwd.c +++ b/extras/gtwvw/gtwvwd.c @@ -4527,7 +4527,7 @@ static void hb_gtInitStatics( UINT usWinNum, LPCTSTR lpszWinName, USHORT usRow1, h = LoadLibrary( "msimg32.dll" ); if( h ) { - s_pWvwData->s_sApp->pfnGF = ( wvwGradientFill ) GetProcAddress( h, "GradientFill" ); + s_pWvwData->s_sApp->pfnGF = ( wvwGradientFill ) HB_WINAPI_GETPROCADDRESS( h, "GradientFill" ); if( s_pWvwData->s_sApp->pfnGF ) s_pWvwData->s_sApp->hMSImg32 = h; } diff --git a/include/hbwince.h b/include/hbwince.h index 7c4da02a00..c25e53b449 100644 --- a/include/hbwince.h +++ b/include/hbwince.h @@ -54,12 +54,6 @@ #include -/* use ASCII version of GetProcAddress() to keep the same code for desktop - * windows and WinCE/Mobile. It's supported by WinCE 3.0 and later versions. - */ -#undef GetProcAddress -#define GetProcAddress GetProcAddressA - HB_EXTERN_BEGIN #if defined( _MSC_VER ) diff --git a/include/hbwinuni.h b/include/hbwinuni.h index 8dff90f097..2b854ca02e 100644 --- a/include/hbwinuni.h +++ b/include/hbwinuni.h @@ -86,8 +86,14 @@ #define HB_OSSTRDUP( str ) hb_osStrU16Decode( str ) #define HB_OSSTRDUP2( str, buf, len ) hb_osStrU16Decode2( str, buf, len ) #define HB_WINAPI_SYSTEM( cmd ) _wsystem( cmd ) - #define HB_WINAPI_FUNCTION_NAME( a ) ( a "W" ) #define HB_WINAPI_KERNEL32_DLL() ( hb_iswin9x() ? TEXT( "unicows.dll" ) : TEXT( "kernel32.dll" ) ) + #if defined( HB_OS_WIN_CE ) + #define HB_WINAPI_GETPROCADDRESS( h, n ) GetProcAddress( h, TEXT( n ) ) + #define HB_WINAPI_GETPROCADDRESST( h, n ) GetProcAddress( h, TEXT( n ) TEXT( "W" ) ) + #else + #define HB_WINAPI_GETPROCADDRESS( h, n ) GetProcAddress( h, n ) + #define HB_WINAPI_GETPROCADDRESST( h, n ) GetProcAddress( h, n "W" ) + #endif #else #define HB_PARSTR( n, h, len ) hb_parstr( n, hb_setGetOSCP(), h, len ) #define HB_PARSTRDEF( n, h, len ) hb_strnull( hb_parstr( n, hb_setGetOSCP(), h, len ) ) @@ -119,8 +125,9 @@ #define HB_OSSTRDUP( str ) hb_osStrDecode( str ) #define HB_OSSTRDUP2( str, buf, len ) hb_osStrDecode2( str, buf, len ) #define HB_WINAPI_SYSTEM( cmd ) system( cmd ) - #define HB_WINAPI_FUNCTION_NAME( a ) ( a "A" ) #define HB_WINAPI_KERNEL32_DLL() ( TEXT( "kernel32.dll" ) ) + #define HB_WINAPI_GETPROCADDRESS( h, n ) GetProcAddress( h, n ) + #define HB_WINAPI_GETPROCADDRESST( h, n ) GetProcAddress( h, n "A" ) #endif #endif /* HB_OS_WIN */ diff --git a/src/common/hbdate.c b/src/common/hbdate.c index f45c08dff0..ae3ce38f72 100644 --- a/src/common/hbdate.c +++ b/src/common/hbdate.c @@ -77,6 +77,7 @@ # include #elif defined( HB_OS_WIN ) # include +# include "hbwinuni.h" # if defined( HB_OS_WIN_CE ) # include "hbwince.h" # endif @@ -960,7 +961,7 @@ long hb_timeStampUTCOffset( int iYear, int iMonth, int iDay, HMODULE hModule = GetModuleHandle( TEXT( "kernel32" ) ); if( hModule ) s_pTzSpecificLocalTimeToSystemTime = ( P_TZSPECIFICLOCALTIMETOSYSTEMTIME ) - GetProcAddress( hModule, "TzSpecificLocalTimeToSystemTime" ); + HB_WINAPI_GETPROCADDRESS( hModule, "TzSpecificLocalTimeToSystemTime" ); s_fInit = HB_FALSE; } diff --git a/src/common/hbver.c b/src/common/hbver.c index e3cb51c944..8f2c0032c2 100644 --- a/src/common/hbver.c +++ b/src/common/hbver.c @@ -151,7 +151,7 @@ static HB_BOOL s_win_iswow64( void ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32" ) ); if( hModule ) - pIsWow64Process = ( P_ISWOW64PROCESS ) GetProcAddress( hModule, "IsWow64Process" ); + pIsWow64Process = ( P_ISWOW64PROCESS ) HB_WINAPI_GETPROCADDRESS( hModule, "IsWow64Process" ); else pIsWow64Process = NULL; @@ -363,7 +363,7 @@ char * hb_verPlatform( void ) const char * pszWine = ""; const char * pszName = ""; - if( hntdll && GetProcAddress( hntdll, "wine_get_version" ) ) + if( hntdll && HB_WINAPI_GETPROCADDRESS( hntdll, "wine_get_version" ) ) pszWine = " (Wine)"; switch( osVer.dwPlatformId ) diff --git a/src/rtl/diskspac.c b/src/rtl/diskspac.c index 81c4fad157..c582beefe1 100644 --- a/src/rtl/diskspac.c +++ b/src/rtl/diskspac.c @@ -166,7 +166,7 @@ HB_FUNC( DISKSPACE ) HMODULE hModule = GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ); if( hModule ) s_pGetDiskFreeSpaceEx = ( P_GDFSE ) - GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) ); + HB_WINAPI_GETPROCADDRESST( hModule, "GetDiskFreeSpaceEx" ); s_fInit = HB_TRUE; } diff --git a/src/rtl/disksphb.c b/src/rtl/disksphb.c index 6d59b98758..b4de552279 100644 --- a/src/rtl/disksphb.c +++ b/src/rtl/disksphb.c @@ -125,7 +125,7 @@ HB_FUNC( HB_DISKSPACE ) HMODULE hModule = GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ); if( hModule ) s_pGetDiskFreeSpaceEx = ( P_GDFSE ) - GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) ); + HB_WINAPI_GETPROCADDRESST( hModule, "GetDiskFreeSpaceEx" ); s_fInit = HB_TRUE; } diff --git a/src/rtl/fslink.c b/src/rtl/fslink.c index 9f61ce2570..691b3b0c8b 100644 --- a/src/rtl/fslink.c +++ b/src/rtl/fslink.c @@ -79,7 +79,7 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); if( hModule ) s_pCreateHardLink = ( _HB_CREATEHARDLINK ) - GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "CreateHardLink" ) ); + HB_WINAPI_GETPROCADDRESST( hModule, "CreateHardLink" ); } if( s_pCreateHardLink ) @@ -163,7 +163,7 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); if( hModule ) s_pCreateSymbolicLink = ( _HB_CREATESYMBOLICLINK ) - GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "CreateSymbolicLink" ) ); + HB_WINAPI_GETPROCADDRESST( hModule, "CreateSymbolicLink" ); } if( s_pCreateSymbolicLink ) @@ -269,7 +269,7 @@ char * hb_fsLinkRead( const char * pszFile ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); if( hModule ) s_pGetFinalPathNameByHandle = ( _HB_GETFINALPATHNAMEBYHANDLE ) - GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "GetFinalPathNameByHandle" ) ); + HB_WINAPI_GETPROCADDRESST( hModule, "GetFinalPathNameByHandle" ); } if( s_pGetFinalPathNameByHandle ) diff --git a/src/rtl/gtwin/gtwin.c b/src/rtl/gtwin/gtwin.c index f485a48bce..f75fb6afe1 100644 --- a/src/rtl/gtwin/gtwin.c +++ b/src/rtl/gtwin/gtwin.c @@ -750,8 +750,8 @@ static HB_BOOL hb_gt_win_SetPalette_Vista( HB_BOOL bSet, COLORREF * colors ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); if( hModule ) { - s_pGetConsoleScreenBufferInfoEx = ( P_GETCONSOLESCREENBUFFERINFOEX ) GetProcAddress( hModule, "GetConsoleScreenBufferInfoEx" ); - s_pSetConsoleScreenBufferInfoEx = ( P_SETCONSOLESCREENBUFFERINFOEX ) GetProcAddress( hModule, "SetConsoleScreenBufferInfoEx" ); + s_pGetConsoleScreenBufferInfoEx = ( P_GETCONSOLESCREENBUFFERINFOEX ) HB_WINAPI_GETPROCADDRESS( hModule, "GetConsoleScreenBufferInfoEx" ); + s_pSetConsoleScreenBufferInfoEx = ( P_SETCONSOLESCREENBUFFERINFOEX ) HB_WINAPI_GETPROCADDRESS( hModule, "SetConsoleScreenBufferInfoEx" ); } s_bChecked = HB_TRUE; } @@ -839,9 +839,9 @@ static HB_BOOL hb_gt_win_SetCloseButton( HB_BOOL bSet, HB_BOOL bClosable ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); if( hModule ) { - s_pGetConsoleWindow = ( P_GETCONSOLEWINDOW ) GetProcAddress( hModule, "GetConsoleWindow" ); + s_pGetConsoleWindow = ( P_GETCONSOLEWINDOW ) HB_WINAPI_GETPROCADDRESS( hModule, "GetConsoleWindow" ); #if defined( HB_GTWIN_USE_SETCONSOLEMENUCLOSE ) - s_pSetConsoleMenuClose = ( P_SETCONSOLEMENUCLOSE ) GetProcAddress( hModule, "SetConsoleMenuClose" ); + s_pSetConsoleMenuClose = ( P_SETCONSOLEMENUCLOSE ) HB_WINAPI_GETPROCADDRESS( hModule, "SetConsoleMenuClose" ); #endif } s_bChecked = HB_TRUE; @@ -1766,7 +1766,7 @@ static HB_BOOL hb_gt_win_IsFullScreen( void ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); if( hModule ) - pGetConsoleDisplayMode = ( P_GCDM ) GetProcAddress( hModule, "GetConsoleDisplayMode" ); + pGetConsoleDisplayMode = ( P_GCDM ) HB_WINAPI_GETPROCADDRESS( hModule, "GetConsoleDisplayMode" ); else pGetConsoleDisplayMode = NULL; @@ -1789,7 +1789,7 @@ static HB_BOOL hb_gt_win_FullScreen( HB_BOOL bFullScreen ) HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); if( hModule ) - pSetConsoleDisplayMode = ( P_SCDM ) GetProcAddress( hModule, "SetConsoleDisplayMode" ); + pSetConsoleDisplayMode = ( P_SCDM ) HB_WINAPI_GETPROCADDRESS( hModule, "SetConsoleDisplayMode" ); else pSetConsoleDisplayMode = NULL; diff --git a/src/rtl/gtwvt/gtwvt.c b/src/rtl/gtwvt/gtwvt.c index 17db69fbc6..9e12860f3e 100644 --- a/src/rtl/gtwvt/gtwvt.c +++ b/src/rtl/gtwvt/gtwvt.c @@ -3123,10 +3123,12 @@ static HB_BOOL hb_gt_wvt_FullScreen( PHB_GT pGT ) */ #if 0 #ifdef MONITOR_DEFAULTTONEAREST - pMonitorFromWindow = ( P_MFW ) GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ), - "MonitorFromWindow" ); - pGetMonitorInfo = ( P_GMI ) GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ), - "GetMonitorInfo" ); + pMonitorFromWindow = ( P_MFW ) + HB_WINAPI_GETPROCADDRESS( GetModuleHandle( TEXT( "user32.dll" ) ), + "MonitorFromWindow" ); + pGetMonitorInfo = ( P_GMI ) + HB_WINAPI_GETPROCADDRESS( GetModuleHandle( TEXT( "user32.dll" ) ), + "GetMonitorInfo" ); if( pMonitorFromWindow && pGetMonitorInfo ) { diff --git a/src/vm/dynlibhb.c b/src/vm/dynlibhb.c index 01e1de7c41..8166f416b9 100644 --- a/src/vm/dynlibhb.c +++ b/src/vm/dynlibhb.c @@ -208,7 +208,12 @@ void * hb_libSymAddr( PHB_ITEM pDynLib, const char * pszSymbol ) if( hDynLib ) { -#if defined( HB_OS_WIN ) +#if defined( HB_OS_WIN_CE ) + LPTSTR lpSymbol = hb_mbtowc( pszSymbol ); + void * hFuncAddr = ( void * ) GetProcAddress( ( HMODULE ) hDynLib, lpSymbol ); + hb_xfree( lpSymbol ); + return hFuncAddr; +#elif defined( HB_OS_WIN ) return ( void * ) GetProcAddress( ( HMODULE ) hDynLib, pszSymbol ); #elif defined( HB_OS_OS2 ) PFN pProcAddr = NULL; diff --git a/src/vm/extrap.c b/src/vm/extrap.c index 5e91b71780..6857f55634 100644 --- a/src/vm/extrap.c +++ b/src/vm/extrap.c @@ -84,6 +84,7 @@ # if ! defined( __TINYC__ ) # include # endif +# include "hbwinuni.h" # if defined( HB_OS_WIN_CE ) # include "hbwince.h" # endif @@ -374,9 +375,9 @@ static LONG WINAPI hb_winExceptionHandler( struct _EXCEPTION_POINTERS * pExcepti typedef BOOL ( WINAPI * P_M32F )( HANDLE, LPMODULEENTRY32 ); /* Module32First() */ typedef BOOL ( WINAPI * P_M32N )( HANDLE, LPMODULEENTRY32 ); /* Module32Next() */ - P_CTH32SSH pCreateToolhelp32Snapshot = ( P_CTH32SSH ) GetProcAddress( hToolhelp, "CreateToolhelp32Snapshot" ); - P_M32F pModule32First = ( P_M32F ) GetProcAddress( hToolhelp, "Module32First" ); - P_M32N pModule32Next = ( P_M32N ) GetProcAddress( hToolhelp, "Module32Next" ); + P_CTH32SSH pCreateToolhelp32Snapshot = ( P_CTH32SSH ) HB_WINAPI_GETPROCADDRESS( hToolhelp, "CreateToolhelp32Snapshot" ); + P_M32F pModule32First = ( P_M32F ) HB_WINAPI_GETPROCADDRESS( hToolhelp, "Module32First" ); + P_M32N pModule32Next = ( P_M32N ) HB_WINAPI_GETPROCADDRESS( hToolhelp, "Module32Next" ); if( pCreateToolhelp32Snapshot && pModule32First && diff --git a/src/vm/maindllp/dllpcode.c b/src/vm/maindllp/dllpcode.c index 8a415c40a0..d7c5c14950 100644 --- a/src/vm/maindllp/dllpcode.c +++ b/src/vm/maindllp/dllpcode.c @@ -132,15 +132,19 @@ PHB_FUNC hb_dllGetProcAddress( const char * szProcName ) if( s_hModule != NULL ) { - static const char * s_szGetProcAddr = "_dll_hb_vmProcAddress"; - int i = 6; + int i = 5; do { - i -= i == 4 ? 3 : 1; +#if defined( HB_OS_WIN_CE ) + LPCTSTR s_lpGetProcAddr = TEXT( "_dll_hb_vmProcAddress" ); + s_pProcGet = ( HB_PROC_GET ) GetProcAddress( s_hModule, s_lpGetProcAddr + i ); +#else + static const char * s_szGetProcAddr = "_dll_hb_vmProcAddress"; s_pProcGet = ( HB_PROC_GET ) GetProcAddress( s_hModule, s_szGetProcAddr + i ); +#endif } - while( s_pProcGet == NULL && i > 0 ); + while( s_pProcGet == NULL && ( i -= i == 4 ? 3 : 1 ) >= 0 ); if( s_pProcGet == NULL ) HB_DLL_MSG_NO_FUNC( "hb_vmProcAddress" ); }