2011-05-09 15:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbwin/wapi_misc.c
    ! trying to make hbwapi_LoadLibrarySystem() really safe
      by using LoadLibraryEx() with special flag. On win7/64 tested
      with 32-bit or 64-bit exe, it still tries to load f.e. winspool.drv
      from the apps own dir, at least as per procmon. GetSystemDirectory()
      will return system32 as the .dll dir, though it is SysWOW64, but
      this seems to be fixed internall by kernel.
      (safety is apparently fully going against MS's will, but anyway, 
      maybe I'm not getting it)

  * contrib/hbwin/wce_simc.c
  * contrib/hbwin/wce_smsc.c
  * contrib/hbwin/hbwin.hbx
  * contrib/hbwin/wce_sim.prg
    ! fixed to always define wce (and compiler) specific .prg level functions
This commit is contained in:
Viktor Szakats
2011-05-09 13:28:15 +00:00
parent 744a7426dd
commit a876c981d9
6 changed files with 63 additions and 13 deletions

View File

@@ -16,6 +16,23 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-05-09 15:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/wapi_misc.c
! trying to make hbwapi_LoadLibrarySystem() really safe
by using LoadLibraryEx() with special flag. On win7/64 tested
with 32-bit or 64-bit exe, it still tries to load f.e. winspool.drv
from the apps own dir, at least as per procmon. GetSystemDirectory()
will return system32 as the .dll dir, though it is SysWOW64, but
this seems to be fixed internall by kernel.
(safety is apparently fully going against MS's will, but anyway,
maybe I'm not getting it)
* contrib/hbwin/wce_simc.c
* contrib/hbwin/wce_smsc.c
* contrib/hbwin/hbwin.hbx
* contrib/hbwin/wce_sim.prg
! fixed to always define wce (and compiler) specific .prg level functions
2011-05-09 13:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/hbwapi.h
* contrib/hbwin/wapi_misc.c

View File

@@ -289,6 +289,14 @@ DYNAMIC WAPI_WAITFORMULTIPLEOBJECTSEX
DYNAMIC WAPI_WAITFORSINGLEOBJECT
DYNAMIC WAPI_WAITFORSINGLEOBJECTEX
DYNAMIC WAPI_WNETGETLASTERROR
DYNAMIC WCE_SIM
DYNAMIC WCE_SIMDEINITIALIZE
DYNAMIC WCE_SIMDELETEPHONEBOOKENTRY
DYNAMIC WCE_SIMINITIALIZE
DYNAMIC WCE_SIMPHONEBOOKSTATUS
DYNAMIC WCE_SIMREADPHONEBOOKENTRY
DYNAMIC WCE_SIMWRITEPHONEBOOKENTRY
DYNAMIC WCE_SMSSENDMESSAGE
DYNAMIC WIDETOANSI
DYNAMIC WIN_ABORTDOC
DYNAMIC WIN_ANSITOWIDE

View File

@@ -136,7 +136,7 @@ HMODULE hbwapi_LoadLibrarySystem( LPCTSTR pFileName )
{
TCHAR * pLibPath = hbwapi_FileNameAtSystemDir( pFileName );
HMODULE h = LoadLibrary( pLibPath );
HMODULE h = LoadLibraryEx( pLibPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
hb_xfree( pLibPath );

View File

@@ -50,8 +50,6 @@
*
*/
#if defined( __PLATFORM__WINCE )
#include "hbclass.ch"
#include "common.ch"
@@ -231,5 +229,3 @@ METHOD End() CLASS wce_sim
ENDIF
RETURN NIL
#endif

View File

@@ -54,25 +54,36 @@
#include "hbapiitm.h"
#if defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ )
#include <simmgr.h>
# include <simmgr.h>
# define __HB_COMPONENT_SUPPORTED__
#endif
HB_FUNC( WCE_SIMINITIALIZE ) /* hSim by reference, lNotifications */
{
#ifdef __HB_COMPONENT_SUPPORTED__
HSIM hSim = 0;
HRESULT hResult = SimInitialize( hb_parl( 2 ) ? SIM_INIT_SIMCARD_NOTIFICATIONS : 0, NULL, 0, &hSim );
hb_storptr( hResult == S_OK ? hSim : 0, 1 );
hb_retnl( hResult );
#else
hb_storptr( 0, 1 );
hb_retnl( -1 );
#endif
}
HB_FUNC( WCE_SIMDEINITIALIZE ) /* hSim */
{
#ifdef __HB_COMPONENT_SUPPORTED__
hb_retnl( SimDeinitialize( ( HSIM ) hb_parptr( 1 ) ) );
#else
hb_retnl( -1 );
#endif
}
HB_FUNC( WCE_SIMPHONEBOOKSTATUS ) /* hSim, nLocation, @nTotal, @nUsed */
{
#ifdef __HB_COMPONENT_SUPPORTED__
DWORD dwUsed = 0, dwTotal = 0;
HRESULT hResult = SimGetPhonebookStatus( ( HSIM ) hb_parptr( 1 ), ( DWORD ) hb_parnl( 2 ) /* dwLocation */, &dwUsed, &dwTotal );
@@ -80,10 +91,16 @@ HB_FUNC( WCE_SIMPHONEBOOKSTATUS ) /* hSim, nLocation, @nTotal, @nUsed */
hb_stornl( hResult == S_OK ? ( long ) dwUsed : 0, 4 );
hb_retnl( hResult );
#else
hb_stornl( 0, 3 );
hb_stornl( 0, 4 );
hb_retnl( -1 );
#endif
}
HB_FUNC( WCE_SIMREADPHONEBOOKENTRY ) /* hSim, nLocation, nPos, @aEntry */
{
#ifdef __HB_COMPONENT_SUPPORTED__
HSIM hSim = ( HSIM ) hb_parptr( 1 );
DWORD dwIndex = ( DWORD ) hb_parnl( 3 );
SIMPHONEBOOKENTRY PhoneEntry;
@@ -102,10 +119,14 @@ HB_FUNC( WCE_SIMREADPHONEBOOKENTRY ) /* hSim, nLocation, nPos, @aEntry */
hb_itemParamStoreForward( 4, pArray );
hb_itemRelease( pArray );
#else
hb_reta( 0 );
#endif
}
HB_FUNC( WCE_SIMWRITEPHONEBOOKENTRY ) /* hSim, nLocation, nPos, cNumber, cName, nPlan, nAddrType */
{
#ifdef __HB_COMPONENT_SUPPORTED__
SIMPHONEBOOKENTRY PhoneEntry;
void * hAddress;
@@ -122,11 +143,16 @@ HB_FUNC( WCE_SIMWRITEPHONEBOOKENTRY ) /* hSim, nLocation, nPos, cNumber, cName,
hb_strfree( hAddress );
hb_strfree( hText );
#else
hb_retnl( -1 );
#endif
}
HB_FUNC( WCE_SIMDELETEPHONEBOOKENTRY ) /* hSim, nLocation, nPos */
{
#ifdef __HB_COMPONENT_SUPPORTED__
hb_retnl( SimDeletePhonebookEntry( ( HSIM ) hb_parptr( 1 ), ( DWORD ) hb_parnl( 2 ), ( DWORD ) hb_parnl( 3 ) ) );
}
#else
hb_retnl( -1 );
#endif
}

View File

@@ -55,11 +55,13 @@
#if defined( HB_OS_WIN_CE ) && \
! defined( __MINGW32__ ) && \
!( ! defined( __cplusplus ) && ( defined( _MSC_VER ) && ( _MSC_VER <= 1310 ) ) )
#include <sms.h>
# include <sms.h>
# define __HB_COMPONENT_SUPPORTED__
#endif
HB_FUNC( WCE_SMSSENDMESSAGE ) /* cMessage, cNumber */
{
#ifdef __HB_COMPONENT_SUPPORTED__
SMS_HANDLE smshHandle = 0;
HRESULT hr = SmsOpen( SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &smshHandle, NULL ); /* try to open an SMS Handle */
@@ -112,6 +114,7 @@ HB_FUNC( WCE_SMSSENDMESSAGE ) /* cMessage, cNumber */
SmsClose( smshHandle );
}
}
#else
hb_retnl( -1 );
#endif
}