2017-11-14 20:44 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbwin/hbwin.hbx
  * contrib/hbwin/wapi_winbase_2.c
    + added PRG wrapper to QueryDosDevice() WINAPI function
         wapi_QueryDosDevice( <cDeviceName> ) -> <aResults>
This commit is contained in:
Przemysław Czerpak
2017-11-14 20:44:16 +01:00
parent 39041d159c
commit e7b53af398
3 changed files with 42 additions and 0 deletions

View File

@@ -7,6 +7,12 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */
2017-11-14 20:44 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbwin/hbwin.hbx
* contrib/hbwin/wapi_winbase_2.c
+ added PRG wrapper to QueryDosDevice() WINAPI function
wapi_QueryDosDevice( <cDeviceName> ) -> <aResults>
2017-11-14 20:30 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rdd/dbf1.c
! fixed typo in index used inside DBS_ISNULL

View File

@@ -143,6 +143,7 @@ DYNAMIC wapi_MulDiv
DYNAMIC wapi_OpenMutex
DYNAMIC wapi_OutputDebugString
DYNAMIC wapi_PlaySound
DYNAMIC wapi_QueryDosDevice
DYNAMIC wapi_QueryPerformanceCounter
DYNAMIC wapi_QueryPerformanceFrequency
DYNAMIC wapi_Rectangle

View File

@@ -45,6 +45,7 @@
*/
#include "hbwapi.h"
#include "hbapiitm.h"
HB_FUNC( WAPI_GETLASTERROR )
{
@@ -134,3 +135,37 @@ HB_FUNC( WAPI_OUTPUTDEBUGSTRING )
hb_strfree( hOutputString );
}
#define TARGET_PATH_BUFFER_SIZE 4096
HB_FUNC( WAPI_QUERYDOSDEVICE )
{
void * hDeviceName;
LPTSTR lpTargetPath = ( LPTSTR ) hb_xgrab( TARGET_PATH_BUFFER_SIZE * sizeof( TCHAR ) );
DWORD dwResult;
dwResult = QueryDosDevice( HB_PARSTR( 1, &hDeviceName, NULL ), lpTargetPath, TARGET_PATH_BUFFER_SIZE );
hbwapi_SetLastError( GetLastError() );
if( dwResult )
{
PHB_ITEM pArray = hb_itemArrayNew( 0 ), pItem = NULL;
DWORD dwPos, dwStart;
dwPos = dwStart = 0;
while( lpTargetPath[ dwPos ] )
{
if( ! lpTargetPath[ ++dwPos ] )
{
pItem = HB_ITEMPUTSTRLEN( pItem, lpTargetPath + dwStart, dwPos - dwStart - 1 );
hb_arrayAdd( pArray, pItem );
dwStart = ++dwPos;
}
}
hb_itemRelease( pItem );
hb_itemReturnRelease( pArray );
}
else
hb_reta( 0 );
hb_strfree( hDeviceName );
hb_xfree( lpTargetPath );
}