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*()
This commit is contained in:
@@ -77,6 +77,7 @@
|
||||
# include <sys/time.h>
|
||||
#elif defined( HB_OS_WIN )
|
||||
# include <windows.h>
|
||||
# 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
# if ! defined( __TINYC__ )
|
||||
# include <tlhelp32.h>
|
||||
# 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 &&
|
||||
|
||||
@@ -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" );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user