2010-02-14 15:17 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/include/hbwince.h
    * redirect GetProcAddress() to GetProcAddressA() in WinCE builds.
      ASCII version of GetProcAddress() is supported by WinCE 3.0 and
      later versions.

  * harbour/include/hbdefs.h
    - removed HBTEXT() macro

  * harbour/src/common/hbver.c
  * harbour/src/rtl/diskspac.c
  * harbour/src/rtl/disksphb.c
  * harbour/src/rtl/gtwvt/gtwvt.c
  * harbour/src/vm/extrap.c
  * harbour/src/vm/maindllp/dllpcode.c
  * harbour/contrib/gtwvg/gtwvg.c
  * harbour/contrib/gtwvg/gtwvg.h
  * harbour/contrib/gtwvg/wvgwin.c
  * harbour/contrib/hbwin/wapi_winbase.c
  * harbour/contrib/hbwin/axcore.c
  * harbour/contrib/hbwin/mapi.c
  * harbour/contrib/hbwin/win_prn2.c
  * harbour/contrib/hbwin/win_prn3.c
  * harbour/contrib/hbwin/wapi_shellapi.c
    * eliminated HBTEXT() macro

  * harbour/src/rtl/diskspac.c
  * harbour/src/rtl/disksphb.c
  * harbour/contrib/hbwin/wapi_winbase.c
    % optimized GetProcAddress() calls to store function addresses
      in static variables
This commit is contained in:
Przemyslaw Czerpak
2010-02-14 14:18:13 +00:00
parent 28df65d9b9
commit cdd7cd30db
18 changed files with 124 additions and 95 deletions

View File

@@ -80,6 +80,9 @@
#if defined( HB_OS_WIN )
#include <windows.h>
#if defined( HB_OS_WIN_CE )
#include "hbwince.h"
#endif
#ifndef VER_PLATFORM_WIN32_WINDOWS
#define VER_PLATFORM_WIN32_WINDOWS 1
@@ -269,7 +272,7 @@ char * hb_verPlatform( void )
const char * pszWine = "";
const char * pszName = "";
if( hntdll && GetProcAddress( hntdll, HBTEXT( "wine_get_version" ) ) )
if( hntdll && GetProcAddress( hntdll, "wine_get_version" ) )
pszWine = " (Wine)";
switch( osVer.dwPlatformId )

View File

@@ -154,20 +154,28 @@ HB_FUNC( DISKSPACE )
{
typedef BOOL ( WINAPI * P_GDFSE )( LPCTSTR, PULARGE_INTEGER,
PULARGE_INTEGER, PULARGE_INTEGER );
P_GDFSE pGetDiskFreeSpaceEx = ( P_GDFSE )
GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ),
#if defined( UNICODE )
HBTEXT( "GetDiskFreeSpaceExW" ) );
#else
HBTEXT( "GetDiskFreeSpaceExA" ) );
#endif
if( pGetDiskFreeSpaceEx )
static P_GDFSE s_pGetDiskFreeSpaceEx = NULL;
static HB_BOOL s_fInit = HB_FALSE;
if( !s_fInit )
{
bError = pGetDiskFreeSpaceEx( lpPath,
( PULARGE_INTEGER ) &i64FreeBytesToCaller,
( PULARGE_INTEGER ) &i64TotalBytes,
( PULARGE_INTEGER ) &i64FreeBytes ) ? HB_FALSE : HB_TRUE;
s_fInit = HB_TRUE;
s_pGetDiskFreeSpaceEx = ( P_GDFSE )
GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ),
#if defined( UNICODE )
"GetDiskFreeSpaceExW" );
#else
"GetDiskFreeSpaceExA" );
#endif
}
if( s_pGetDiskFreeSpaceEx )
{
bError = s_pGetDiskFreeSpaceEx( lpPath,
( PULARGE_INTEGER ) &i64FreeBytesToCaller,
( PULARGE_INTEGER ) &i64TotalBytes,
( PULARGE_INTEGER ) &i64FreeBytes ) ? HB_FALSE : HB_TRUE;
if( ! bError )
dSpace = HB_GET_LARGE_UINT( i64FreeBytesToCaller );
}

View File

@@ -210,24 +210,29 @@ HB_FUNC( HB_DISKSPACE )
}
#else
{
typedef BOOL ( WINAPI * P_GDFSE )( LPCTSTR, PULARGE_INTEGER,
PULARGE_INTEGER, PULARGE_INTEGER );
P_GDFSE pGetDiskFreeSpaceEx = ( P_GDFSE )
GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ),
#if defined( UNICODE )
HBTEXT( "GetDiskFreeSpaceExW" ) );
#else
HBTEXT( "GetDiskFreeSpaceExA" ) );
#endif
static P_GDFSE s_pGetDiskFreeSpaceEx = NULL;
static HB_BOOL s_fInit = HB_FALSE;
if( pGetDiskFreeSpaceEx )
if( !s_fInit )
{
fResult = pGetDiskFreeSpaceEx( lpPath,
( PULARGE_INTEGER ) &i64FreeBytesToCaller,
( PULARGE_INTEGER ) &i64TotalBytes,
( PULARGE_INTEGER ) &i64FreeBytes ) ? HB_TRUE : HB_FALSE;
s_fInit = HB_TRUE;
s_pGetDiskFreeSpaceEx = ( P_GDFSE )
GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ),
#if defined( UNICODE )
"GetDiskFreeSpaceExW" );
#else
"GetDiskFreeSpaceExA" );
#endif
}
if( s_pGetDiskFreeSpaceEx )
{
fResult = s_pGetDiskFreeSpaceEx( lpPath,
( PULARGE_INTEGER ) &i64FreeBytesToCaller,
( PULARGE_INTEGER ) &i64TotalBytes,
( PULARGE_INTEGER ) &i64FreeBytes ) ? HB_TRUE : HB_FALSE;
hb_fsSetIOError( fResult, 0 );
if( fResult )
{

View File

@@ -1860,7 +1860,7 @@ static HB_BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT )
P_SLWA pSetLayeredWindowAttributes = ( P_SLWA )
GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ),
HBTEXT( "SetLayeredWindowAttributes" ) );
"SetLayeredWindowAttributes" );
if( pSetLayeredWindowAttributes )
{

View File

@@ -234,9 +234,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( hKernel32, HBTEXT( "CreateToolhelp32Snapshot" ) );
P_M32F pModule32First = ( P_M32F ) GetProcAddress( hKernel32, HBTEXT( "Module32First" ) );
P_M32N pModule32Next = ( P_M32N ) GetProcAddress( hKernel32, HBTEXT( "Module32Next" ) );
P_CTH32SSH pCreateToolhelp32Snapshot = ( P_CTH32SSH ) GetProcAddress( hKernel32, "CreateToolhelp32Snapshot" );
P_M32F pModule32First = ( P_M32F ) GetProcAddress( hKernel32, "Module32First" );
P_M32N pModule32Next = ( P_M32N ) GetProcAddress( hKernel32, "Module32Next" );
if( pCreateToolhelp32Snapshot &&
pModule32First &&

View File

@@ -58,6 +58,9 @@
#if defined( HB_OS_WIN )
#include <windows.h>
#if defined( HB_OS_WIN_CE )
#include "hbwince.h"
#endif
#endif
#define HB_DLL_PREF TEXT( "harbour" )
@@ -146,12 +149,7 @@ PHB_FUNC hb_dllGetProcAddress( const char * szProcName )
if( s_hModule != NULL )
{
#if defined( HB_OS_WIN_CE )
# define HBTEXTSTR LPCTSTR
#else
# define HBTEXTSTR LPCSTR
#endif
static HBTEXTSTR s_szGetProcAddr = HBTEXT( "_dll_hb_vmProcAddress" );
static const char * s_szGetProcAddr = "_dll_hb_vmProcAddress";
int i = 6;
do