2009-12-11 19:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbwin/wce_smsc.c
    + Eliminated hb_parclen() usage.

  * contrib/hbwin/win_prn3.c
    ! Fixed typos.
This commit is contained in:
Viktor Szakats
2009-12-11 18:59:21 +00:00
parent 2c87340571
commit 81effeca0c
3 changed files with 50 additions and 37 deletions

View File

@@ -17,6 +17,13 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-11 19:56 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/wce_smsc.c
+ Eliminated hb_parclen() usage.
* contrib/hbwin/win_prn3.c
! Fixed typos.
2009-12-11 19:51 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbwin/wapi_winbase.c
! fixed casting
@@ -65,8 +72,8 @@
came out after cleaning header dir usage.
* contrib/hbide/hbide.hbp
+ Added MSVC link switched sent by Andi to make QT 4.6.0
libs to default Harbour build.
+ Added MSVC link switches sent by Andi to make QT 4.6.0
libs work with default Harbour build.
2009-12-11 18:17 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* include/hbwinuni.h

View File

@@ -64,50 +64,56 @@ HB_FUNC( WCE_SMSSENDMESSAGE ) /* cMessage, cNumber */
SMS_HANDLE smshHandle = 0;
HRESULT hr = SmsOpen( SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &smshHandle, NULL ); /* try to open an SMS Handle */
if( hr == ERROR_SUCCESS && hb_parclen( 2 ) <= SMS_MAX_ADDRESS_LENGTH )
{
SMS_ADDRESS smsaDestination;
TEXT_PROVIDER_SPECIFIC_DATA tpsd;
SMS_MESSAGE_ID smsmidMessageID = 0;
/* Set default return value */
hb_retnl( -1 );
if( hr == ERROR_SUCCESS )
{
void * hMessage;
void * hPhoneNumber;
HB_SIZE nPhoneNumberLen;
LPCTSTR sztMessage = HB_PARSTRDEF( 1, &hMessage , NULL );
LPCTSTR sztPhoneNumber = HB_PARSTRDEF( 2, &hPhoneNumber, NULL );
LPCTSTR sztPhoneNumber = HB_PARSTRDEF( 2, &hPhoneNumber, &nPhoneNumberLen );
/* Create the destination address */
memset( &smsaDestination, 0, sizeof( smsaDestination ) );
smsaDestination.smsatAddressType = ( *sztPhoneNumber == _T( '+' ) ) ? SMSAT_INTERNATIONAL : SMSAT_NATIONAL;
/* TOFIX: lstrcpy() unsafe and may cause buffer overrun.
Worked around using hb_parclen( 2 ) check against SMS_MAX_ADDRESS_LENGTH.
[vszakats]. */
lstrcpy( smsaDestination.ptsAddress, sztPhoneNumber );
if( nPhoneNumberLen <= SMS_MAX_ADDRESS_LENGTH )
{
SMS_ADDRESS smsaDestination;
TEXT_PROVIDER_SPECIFIC_DATA tpsd;
SMS_MESSAGE_ID smsmidMessageID = 0;
/* Set up provider specific data */
tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE;
tpsd.psMessageClass = PS_MESSAGE_CLASS0;
tpsd.psReplaceOption = PSRO_NONE;
/* Send the message, indicating success or failure */
hb_retnl( SmsSendMessage( smshHandle,
NULL,
&smsaDestination,
NULL,
( PBYTE ) sztMessage,
_tcslen( sztMessage ) * sizeof( wchar_t ),
( PBYTE ) &tpsd, 12,
SMSDE_OPTIMAL,
SMS_OPTION_DELIVERY_NONE,
&smsmidMessageID ) );
SmsClose( smshHandle );
/* Create the destination address */
memset( &smsaDestination, 0, sizeof( smsaDestination ) );
smsaDestination.smsatAddressType = ( *sztPhoneNumber == _T( '+' ) ) ? SMSAT_INTERNATIONAL : SMSAT_NATIONAL;
/* TOFIX: lstrcpy() unsafe and may cause buffer overrun.
Worked around using length check against SMS_MAX_ADDRESS_LENGTH.
[vszakats]. */
lstrcpy( smsaDestination.ptsAddress, sztPhoneNumber );
/* Set up provider specific data */
tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE;
tpsd.psMessageClass = PS_MESSAGE_CLASS0;
tpsd.psReplaceOption = PSRO_NONE;
/* Send the message, indicating success or failure */
hb_retnl( SmsSendMessage( smshHandle,
NULL,
&smsaDestination,
NULL,
( PBYTE ) sztMessage,
_tcslen( sztMessage ) * sizeof( wchar_t ),
( PBYTE ) &tpsd, 12,
SMSDE_OPTIMAL,
SMS_OPTION_DELIVERY_NONE,
&smsmidMessageID ) );
}
hb_strfree( hMessage );
hb_strfree( hPhoneNumber );
SmsClose( smshHandle );
}
else
hb_retnl( -1 );
}
#endif

View File

@@ -252,9 +252,9 @@ HB_FUNC( WIN_PRINTERSETDEFAULT )
{
void * hPrinterName;
HB_SIZE nLen;
TCHAR pszPrinterName = HB_PARSTR( 1, &hPrinterName, &ulLen );
LPCTSTR pszPrinterName = HB_PARSTR( 1, &hPrinterName, &nLen );
hb_retl( ulLen > 0 ? hb_SetDefaultPrinter( pszPrinterName ) : HB_FALSE );
hb_retl( nLen > 0 ? hb_SetDefaultPrinter( pszPrinterName ) : HB_FALSE );
hb_strfree( hPrinterName );
}