2010-02-13 20:20 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/Makefile
+ contrib/hbwin/hbdyn.h
+ contrib/hbwin/hbdyn.ch
+ contrib/hbwin/hbdyn.c
* contrib/hbwin/hbwin.h
* contrib/hbwin/hbwin.ch
* contrib/hbwin/win_misc.c
* contrib/hbwin/win_dll.c
* contrib/hbwin/win_dllx.c
* contrib/hbwin/legacycd.c
* contrib/hbwin/tests/testdll.prg
+ Separated OS-independendent dynamic call support from Windows-specific parts.
* Changed names to reflect that.
This commit is contained in:
@@ -17,6 +17,21 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-02-13 20:20 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/Makefile
|
||||
+ contrib/hbwin/hbdyn.h
|
||||
+ contrib/hbwin/hbdyn.ch
|
||||
+ contrib/hbwin/hbdyn.c
|
||||
* contrib/hbwin/hbwin.h
|
||||
* contrib/hbwin/hbwin.ch
|
||||
* contrib/hbwin/win_misc.c
|
||||
* contrib/hbwin/win_dll.c
|
||||
* contrib/hbwin/win_dllx.c
|
||||
* contrib/hbwin/legacycd.c
|
||||
* contrib/hbwin/tests/testdll.prg
|
||||
+ Separated OS-independendent dynamic call support from Windows-specific parts.
|
||||
* Changed names to reflect that.
|
||||
|
||||
2010-02-13 20:20 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/win_dll.c
|
||||
% Final planned step to remove a remaining redundancy.
|
||||
|
||||
@@ -10,14 +10,15 @@ LIBNAME := hbwin
|
||||
|
||||
C_SOURCES := \
|
||||
axcore.c \
|
||||
hbdyn.c \
|
||||
legacycd.c \
|
||||
legacyco.c \
|
||||
legacycp.c \
|
||||
legacycr.c \
|
||||
legacycv.c \
|
||||
mapi.c \
|
||||
olecore.c \
|
||||
oleinit.c \
|
||||
mapi.c \
|
||||
wapi_alloc.c \
|
||||
wapi_commctrl.c \
|
||||
wapi_err.c \
|
||||
@@ -60,6 +61,7 @@ C_HEADERS := \
|
||||
hbwinole.h \
|
||||
|
||||
PRG_HEADERS := \
|
||||
hbdyn.ch \
|
||||
hbwin.ch \
|
||||
|
||||
ifneq ($(filter $(HB_PLATFORM),win wce),)
|
||||
|
||||
1320
harbour/contrib/hbwin/hbdyn.c
Normal file
1320
harbour/contrib/hbwin/hbdyn.c
Normal file
File diff suppressed because it is too large
Load Diff
101
harbour/contrib/hbwin/hbdyn.ch
Normal file
101
harbour/contrib/hbwin/hbdyn.ch
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Header for .dll support
|
||||
*
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: This file is also used by C code. */
|
||||
|
||||
#ifndef HBDYN_CH_
|
||||
#define HBDYN_CH_
|
||||
|
||||
/* WIN_DLLCALL() C calling convention */
|
||||
#define HB_DYN_CALLCONV_STDCALL 0x000000
|
||||
#define HB_DYN_CALLCONV_CDECL 0x100000
|
||||
|
||||
/* WIN_DLLCALL() string encoding */
|
||||
#define HB_DYN_ENC_ASCII 0x000000
|
||||
#define HB_DYN_ENC_UTF8 0x010000
|
||||
#define HB_DYN_ENC_UTF16 0x040000
|
||||
#define HB_DYN_ENC_RAW 0x080000
|
||||
|
||||
/* WIN_DLLCALL() C types */
|
||||
#define HB_DYN_CTYPE_DEFAULT 0x000000
|
||||
#define HB_DYN_CTYPE_CHAR 0x000001
|
||||
#define HB_DYN_CTYPE_CHAR_UNSIGNED 0x000011
|
||||
#define HB_DYN_CTYPE_CHAR_PTR 0x000101
|
||||
#define HB_DYN_CTYPE_CHAR_UNSIGNED_PTR 0x000111
|
||||
#define HB_DYN_CTYPE_SHORT 0x000002
|
||||
#define HB_DYN_CTYPE_SHORT_UNSIGNED 0x000012
|
||||
#define HB_DYN_CTYPE_SHORT_PTR 0x000102
|
||||
#define HB_DYN_CTYPE_SHORT_UNSIGNED_PTR 0x000112
|
||||
#define HB_DYN_CTYPE_INT 0x000003
|
||||
#define HB_DYN_CTYPE_INT_UNSIGNED 0x000013
|
||||
#define HB_DYN_CTYPE_INT_PTR 0x000103
|
||||
#define HB_DYN_CTYPE_INT_UNSIGNED_PTR 0x000113
|
||||
#define HB_DYN_CTYPE_LONG 0x000004
|
||||
#define HB_DYN_CTYPE_LONG_UNSIGNED 0x000014
|
||||
#define HB_DYN_CTYPE_LONG_PTR 0x000104
|
||||
#define HB_DYN_CTYPE_LONG_UNSIGNED_PTR 0x000114
|
||||
#define HB_DYN_CTYPE_LLONG 0x000005
|
||||
#define HB_DYN_CTYPE_LLONG_UNSIGNED 0x000015
|
||||
#define HB_DYN_CTYPE_LLONG_PTR 0x000105
|
||||
#define HB_DYN_CTYPE_LLONG_UNSIGNED_PTR 0x000115
|
||||
#define HB_DYN_CTYPE_FLOAT 0x000006
|
||||
#define HB_DYN_CTYPE_FLOAT_PTR 0x000106
|
||||
#define HB_DYN_CTYPE_DOUBLE 0x000007
|
||||
#define HB_DYN_CTYPE_DOUBLE_PTR 0x000107
|
||||
#define HB_DYN_CTYPE_BOOL 0x000008
|
||||
#define HB_DYN_CTYPE_BOOL_PTR 0x000108
|
||||
#define HB_DYN_CTYPE_VOID 0x000009
|
||||
#define HB_DYN_CTYPE_VOID_PTR 0x000109
|
||||
#define HB_DYN_CTYPE_STRUCTURE 0x00000A
|
||||
#define HB_DYN_CTYPE_STRUCTURE_PTR 0x00010A
|
||||
|
||||
#endif /* HBDYN_CH_ */
|
||||
65
harbour/contrib/hbwin/hbdyn.h
Normal file
65
harbour/contrib/hbwin/hbdyn.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Dynamic call (low-level)
|
||||
*
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __HBDYN_H
|
||||
#define __HBDYN_H
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbdyn.ch"
|
||||
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
extern HB_EXPORT void hb_dynCall( int iFuncFlags, void * pFunction, int iParams, int iFirst, int * piArgFlags );
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
#endif /* __HBDYN_H */
|
||||
@@ -56,49 +56,6 @@
|
||||
#ifndef HBWIN_CH_
|
||||
#define HBWIN_CH_
|
||||
|
||||
/* WIN_DLLCALL() C calling convention */
|
||||
#define HB_WIN_DLL_CALLCONV_STDCALL 0x000000
|
||||
#define HB_WIN_DLL_CALLCONV_CDECL 0x100000
|
||||
|
||||
/* WIN_DLLCALL() string encoding */
|
||||
#define HB_WIN_DLL_ENC_ASCII 0x000000
|
||||
#define HB_WIN_DLL_ENC_UTF8 0x010000
|
||||
#define HB_WIN_DLL_ENC_UTF16 0x040000
|
||||
#define HB_WIN_DLL_ENC_RAW 0x080000
|
||||
|
||||
/* WIN_DLLCALL() C types */
|
||||
#define HB_WIN_DLL_CTYPE_DEFAULT 0x000000
|
||||
#define HB_WIN_DLL_CTYPE_CHAR 0x000001
|
||||
#define HB_WIN_DLL_CTYPE_CHAR_UNSIGNED 0x000011
|
||||
#define HB_WIN_DLL_CTYPE_CHAR_PTR 0x000101
|
||||
#define HB_WIN_DLL_CTYPE_CHAR_UNSIGNED_PTR 0x000111
|
||||
#define HB_WIN_DLL_CTYPE_SHORT 0x000002
|
||||
#define HB_WIN_DLL_CTYPE_SHORT_UNSIGNED 0x000012
|
||||
#define HB_WIN_DLL_CTYPE_SHORT_PTR 0x000102
|
||||
#define HB_WIN_DLL_CTYPE_SHORT_UNSIGNED_PTR 0x000112
|
||||
#define HB_WIN_DLL_CTYPE_INT 0x000003
|
||||
#define HB_WIN_DLL_CTYPE_INT_UNSIGNED 0x000013
|
||||
#define HB_WIN_DLL_CTYPE_INT_PTR 0x000103
|
||||
#define HB_WIN_DLL_CTYPE_INT_UNSIGNED_PTR 0x000113
|
||||
#define HB_WIN_DLL_CTYPE_LONG 0x000004
|
||||
#define HB_WIN_DLL_CTYPE_LONG_UNSIGNED 0x000014
|
||||
#define HB_WIN_DLL_CTYPE_LONG_PTR 0x000104
|
||||
#define HB_WIN_DLL_CTYPE_LONG_UNSIGNED_PTR 0x000114
|
||||
#define HB_WIN_DLL_CTYPE_LLONG 0x000005
|
||||
#define HB_WIN_DLL_CTYPE_LLONG_UNSIGNED 0x000015
|
||||
#define HB_WIN_DLL_CTYPE_LLONG_PTR 0x000105
|
||||
#define HB_WIN_DLL_CTYPE_LLONG_UNSIGNED_PTR 0x000115
|
||||
#define HB_WIN_DLL_CTYPE_FLOAT 0x000006
|
||||
#define HB_WIN_DLL_CTYPE_FLOAT_PTR 0x000106
|
||||
#define HB_WIN_DLL_CTYPE_DOUBLE 0x000007
|
||||
#define HB_WIN_DLL_CTYPE_DOUBLE_PTR 0x000107
|
||||
#define HB_WIN_DLL_CTYPE_BOOL 0x000008
|
||||
#define HB_WIN_DLL_CTYPE_BOOL_PTR 0x000108
|
||||
#define HB_WIN_DLL_CTYPE_VOID 0x000009
|
||||
#define HB_WIN_DLL_CTYPE_VOID_PTR 0x000109
|
||||
#define HB_WIN_DLL_CTYPE_STRUCTURE 0x00000A
|
||||
#define HB_WIN_DLL_CTYPE_STRUCTURE_PTR 0x00010A
|
||||
|
||||
/* WIN_MAPISENDMAIL() address types */
|
||||
#define WIN_MAPI_TO 1
|
||||
#define WIN_MAPI_CC 2
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Harbour Project source code:
|
||||
* Windows communications library
|
||||
*
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* Copyright 2005-2009 Alex Strickland <sscc@mweb.co.za>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
@@ -93,9 +94,9 @@
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
extern HB_EXPORT int hbwin_bitmapType( const void * pImgBuf, HB_SIZE size );
|
||||
extern HB_EXPORT void hbwin_dllCall( int iFuncFlags, FARPROC lpFunction, int iParams, int iFirst, int * piArgFlags );
|
||||
extern FARPROC hbwin_getprocaddress( HMODULE hDLL, PHB_ITEM pParam, HB_BOOL * pbWIDE );
|
||||
|
||||
extern FARPROC hbwin_getprocaddress( HMODULE hDLL, PHB_ITEM pParam, HB_BOOL * pbUNICODE );
|
||||
extern HB_EXPORT void hb_dynCall( int iFuncFlags, void * pFunction, int iParams, int iFirst, int * piArgFlags );
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
[vszakats] */
|
||||
|
||||
#include "hbwin.h"
|
||||
#include "hbdyn.h"
|
||||
|
||||
#if ! defined( HB_LEGACY_LEVEL3 ) && ! defined( HB_WIN_LEGACY_LEVEL_OFF )
|
||||
#define HB_WIN_LEGACY_LEVEL_OFF
|
||||
@@ -97,26 +98,19 @@ HB_FUNC( FREELIBRARY )
|
||||
hb_retl( HB_FALSE );
|
||||
}
|
||||
|
||||
#ifndef HB_WIN_NO_LEGACY
|
||||
#define HB_WIN_NO_LEGACY
|
||||
#endif
|
||||
#undef HB_LEGACY_LEVEL3
|
||||
|
||||
#include "hbwin.ch"
|
||||
|
||||
HB_FUNC( CALLDLL )
|
||||
{
|
||||
hbwin_dllCall( 0, ( FARPROC ) hb_parptr( 1 ), hb_pcount(), 2, NULL );
|
||||
hb_dynCall( 0, hb_parptr( 1 ), hb_pcount(), 2, NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( CALLDLLBOOL )
|
||||
{
|
||||
hbwin_dllCall( HB_WIN_DLL_CTYPE_BOOL, ( FARPROC ) hb_parptr( 1 ), hb_pcount(), 2, NULL );
|
||||
hb_dynCall( HB_DYN_CTYPE_BOOL, hb_parptr( 1 ), hb_pcount(), 2, NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( CALLDLLTYPED )
|
||||
{
|
||||
hbwin_dllCall( hb_parni( 2 ), ( FARPROC ) hb_parptr( 1 ), hb_pcount(), 3, NULL );
|
||||
hb_dynCall( hb_parni( 2 ), hb_parptr( 1 ), hb_pcount(), 3, NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( GETPROCADDRESS )
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbwin.ch"
|
||||
#include "hbdyn.ch"
|
||||
|
||||
#define MB_OK 0x00000000
|
||||
#define MB_OKCANCEL 0x00000001
|
||||
@@ -76,9 +76,9 @@ PROCEDURE Main()
|
||||
IF hb_FileExists( "libcurl.dll" )
|
||||
hDLL := wapi_LoadLibrary( "libcurl.dll" )
|
||||
? GetProcAddress( hDLL, "curl_version" )
|
||||
? win_dllCall( { "curl_version", hDLL, HB_WIN_DLL_CTYPE_CHAR_PTR } )
|
||||
? win_dllCall( { "curl_version", hDLL, HB_DYN_CTYPE_CHAR_PTR } )
|
||||
wapi_FreeLibrary( hDLL )
|
||||
? win_dllCall( { "curl_version", "libcurl.dll", HB_WIN_DLL_CTYPE_CHAR_PTR } )
|
||||
? win_dllCall( { "curl_version", "libcurl.dll", HB_DYN_CTYPE_CHAR_PTR } )
|
||||
ENDIF
|
||||
|
||||
/* Force Windows not to show dragged windows contents */
|
||||
@@ -99,18 +99,18 @@ PROCEDURE Main()
|
||||
? "ValType( hDLL ): ", ValType( hDLL )
|
||||
? "------"
|
||||
cData := Space( MAX_PATH )
|
||||
? "WIN_DLLCALL (BOOL retval): ", win_dllCall( { "SHGetSpecialFolderPath", hDLL, HB_WIN_DLL_CTYPE_BOOL }, 0, @cData, CSIDL_APPDATA, 0 )
|
||||
? "WIN_DLLCALL (BOOL retval): ", win_dllCall( { "SHGetSpecialFolderPath", hDLL, HB_DYN_CTYPE_BOOL }, 0, @cData, CSIDL_APPDATA, 0 )
|
||||
? "@cData: ", cData
|
||||
? "------"
|
||||
cData := Space( MAX_PATH )
|
||||
? "WIN_DLLCALL (BOOL retval): ", win_dllCall( { GetProcAddress( hDLL, "SHGetSpecialFolderPath" ), HB_WIN_DLL_CTYPE_BOOL }, 0, @cData, CSIDL_APPDATA, 0 )
|
||||
? "WIN_DLLCALL (BOOL retval): ", win_dllCall( { GetProcAddress( hDLL, "SHGetSpecialFolderPath" ), HB_DYN_CTYPE_BOOL }, 0, @cData, CSIDL_APPDATA, 0 )
|
||||
? "@cData: ", cData
|
||||
? "------"
|
||||
? "WIN_DLLCALL: ", win_dllCall( { "SHGetFolderPath", hDLL }, 0, CSIDL_ADMINTOOLS, 0, 0, cData ) // WRONG
|
||||
? "cData:", cData
|
||||
? "------"
|
||||
cData := Space( MAX_PATH )
|
||||
? "WIN_DLLCALL (PARAMS): ", win_dllCall( { "SHGetSpecialFolderPath", hDLL, NIL, NIL, NIL, HB_WIN_DLL_CTYPE_BOOL }, 0, @cData, CSIDL_APPDATA, 0 )
|
||||
? "WIN_DLLCALL (PARAMS): ", win_dllCall( { "SHGetSpecialFolderPath", hDLL, NIL, NIL, NIL, HB_DYN_CTYPE_BOOL }, 0, @cData, CSIDL_APPDATA, 0 )
|
||||
? "@cData: ", cData
|
||||
? "------"
|
||||
cData := Space( MAX_PATH )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -55,13 +55,7 @@
|
||||
#include "hbwin.h"
|
||||
#include "hbapierr.h"
|
||||
#include "hbapiitm.h"
|
||||
#include "hbvm.h"
|
||||
|
||||
#ifndef HB_WIN_NO_LEGACY
|
||||
#define HB_WIN_NO_LEGACY
|
||||
#endif
|
||||
#undef HB_LEGACY_LEVEL3
|
||||
#include "hbwin.ch"
|
||||
#include "hbdyn.h"
|
||||
|
||||
#ifdef HB_COMPAT_XPP
|
||||
|
||||
@@ -73,7 +67,7 @@ typedef struct
|
||||
HMODULE hDLL; /* Handle */
|
||||
HB_BOOL bFreeDLL; /* Free library handle on destroy? */
|
||||
int iFuncFlags;
|
||||
FARPROC lpFunction; /* Function Address */
|
||||
void * pFunction; /* Function Address */
|
||||
} HB_DLLEXEC, * PHB_DLLEXEC;
|
||||
|
||||
static HB_GARBAGE_FUNC( _DLLUnload )
|
||||
@@ -131,14 +125,14 @@ HB_FUNC( DLLCALL )
|
||||
|
||||
if( hDLL && ( HB_PTRDIFF ) hDLL >= 32 )
|
||||
{
|
||||
HB_BOOL bUNICODE;
|
||||
FARPROC lpFunction = hbwin_getprocaddress( hDLL, hb_param( 3, HB_IT_ANY ), &bUNICODE );
|
||||
HB_BOOL bWIDE;
|
||||
void * pFunction = ( void * ) hbwin_getprocaddress( hDLL, hb_param( 3, HB_IT_ANY ), &bWIDE );
|
||||
|
||||
hbwin_dllCall( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : HB_WIN_DLL_CALLCONV_STDCALL ) | ( bUNICODE ? HB_WIN_DLL_ENC_UTF16 : 0 ),
|
||||
lpFunction,
|
||||
hb_pcount(),
|
||||
4,
|
||||
NULL );
|
||||
hb_dynCall( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : HB_DYN_CALLCONV_STDCALL ) | ( bWIDE ? HB_DYN_ENC_UTF16 : 0 ),
|
||||
pFunction,
|
||||
hb_pcount(),
|
||||
4,
|
||||
NULL );
|
||||
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
FreeLibrary( hDLL );
|
||||
@@ -169,11 +163,11 @@ HB_FUNC( DLLPREPARECALL )
|
||||
|
||||
if( xec->hDLL )
|
||||
{
|
||||
HB_BOOL bUNICODE;
|
||||
xec->lpFunction = hbwin_getprocaddress( xec->hDLL, hb_param( 3, HB_IT_ANY ), &bUNICODE );
|
||||
if( xec->lpFunction )
|
||||
HB_BOOL bWIDE;
|
||||
xec->pFunction = ( void * ) hbwin_getprocaddress( xec->hDLL, hb_param( 3, HB_IT_ANY ), &bWIDE );
|
||||
if( xec->pFunction )
|
||||
{
|
||||
xec->iFuncFlags = ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : HB_WIN_DLL_CALLCONV_STDCALL ) | ( bUNICODE ? HB_WIN_DLL_ENC_UTF16 : 0 );
|
||||
xec->iFuncFlags = ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : HB_DYN_CALLCONV_STDCALL ) | ( bWIDE ? HB_DYN_ENC_UTF16 : 0 );
|
||||
|
||||
hb_retptrGC( xec );
|
||||
return;
|
||||
@@ -192,13 +186,13 @@ HB_FUNC( DLLEXECUTECALL )
|
||||
{
|
||||
PHB_DLLEXEC xec = ( PHB_DLLEXEC ) hb_parptrGC( &s_gcDllFuncs, 1 );
|
||||
|
||||
if( xec && xec->hDLL && xec->lpFunction )
|
||||
if( xec && xec->hDLL && xec->pFunction )
|
||||
{
|
||||
hbwin_dllCall( xec->iFuncFlags,
|
||||
xec->lpFunction,
|
||||
hb_pcount(),
|
||||
2,
|
||||
NULL );
|
||||
hb_dynCall( xec->iFuncFlags,
|
||||
xec->pFunction,
|
||||
hb_pcount(),
|
||||
2,
|
||||
NULL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
*/
|
||||
|
||||
#include "hbwin.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
#ifndef QS_ALLPOSTMESSAGE
|
||||
#define QS_ALLPOSTMESSAGE 0x0100
|
||||
@@ -302,3 +303,56 @@ HB_FUNC( WIN_SYSREFRESH )
|
||||
CloseHandle( hDummyEvent );
|
||||
hb_retni( 0 );
|
||||
}
|
||||
|
||||
FARPROC hbwin_getprocaddress( HMODULE hDLL, PHB_ITEM pParam, HB_BOOL * pbWIDE )
|
||||
{
|
||||
#if defined( HB_OS_WIN_CE )
|
||||
void * hStr;
|
||||
HB_SIZE nLen;
|
||||
LPCWSTR szProc = hb_itemGetStrU16( pParam, HB_CDP_ENDIAN_NATIVE, &hStr, &nLen );
|
||||
FARPROC lpFunction = GetProcAddress( hDLL, szProc ? szProc :
|
||||
( LPCWSTR ) ( HB_PTRDIFF ) ( hb_itemGetNI( pParam ) & 0x0FFFF ) );
|
||||
|
||||
if( ! lpFunction && szProc ) /* try with WIDE suffix? */
|
||||
{
|
||||
LPWSTR pszProcW = ( LPWSTR ) hb_xgrab( ( nLen + 2 ) * sizeof( WCHAR ) );
|
||||
memcpy( pszProcW, szProc, nLen * sizeof( WCHAR ) );
|
||||
pszProcW[ nLen++ ] = L'W';
|
||||
pszProcW[ nLen++ ] = 0;
|
||||
lpFunction = GetProcAddress( hDLL, pszProcW );
|
||||
hb_xfree( pszProcW );
|
||||
}
|
||||
hb_strfree( hStr );
|
||||
|
||||
if( pbWIDE )
|
||||
*pbWIDE = HB_TRUE;
|
||||
#else
|
||||
const char * szProc = hb_itemGetCPtr( pParam );
|
||||
FARPROC lpFunction = GetProcAddress( hDLL, szProc ? szProc :
|
||||
( LPCSTR ) ( HB_PTRDIFF ) ( hb_itemGetNI( pParam ) & 0x0FFFF ) );
|
||||
|
||||
if( pbWIDE )
|
||||
*pbWIDE = HB_FALSE;
|
||||
|
||||
#if defined( UNICODE )
|
||||
if( ! lpFunction && szProc ) /* try with WIDE suffix? */
|
||||
{
|
||||
char * pszFuncName = hb_xstrcpy( NULL, szProc, "W", NULL );
|
||||
lpFunction = GetProcAddress( hDLL, pszFuncName );
|
||||
hb_xfree( pszFuncName );
|
||||
if( pbWIDE )
|
||||
*pbWIDE = HB_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if( ! lpFunction && szProc ) /* try with ANSI suffix? */
|
||||
{
|
||||
char * pszFuncName = hb_xstrcpy( NULL, szProc, "A", NULL );
|
||||
lpFunction = GetProcAddress( hDLL, pszFuncName );
|
||||
hb_xfree( pszFuncName );
|
||||
if( pbWIDE )
|
||||
*pbWIDE = HB_FALSE;
|
||||
}
|
||||
#endif
|
||||
return lpFunction;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user