2010-02-11 04:25 UTC+0100 Xavi (jarabal/at/gmail.com)

* contrib/hbwin/wapi_winbase.c
    + Added wapi_GETSHORTPATHNAME()
This commit is contained in:
Xavi
2010-02-11 03:26:15 +00:00
parent b1aea85a0c
commit 64b78151ae
2 changed files with 37 additions and 0 deletions

View File

@@ -17,6 +17,10 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-02-11 04:25 UTC+0100 Xavi (jarabal/at/gmail.com)
* contrib/hbwin/wapi_winbase.c
+ Added wapi_GETSHORTPATHNAME()
2010-02-10 20:23 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/rtl/achoice.prg
! fixed typo in one of recent modifications which caused RTE in

View File

@@ -295,3 +295,36 @@ HB_FUNC( WAPI_MULDIV )
{
hb_retni( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) );
}
HB_FUNC( WAPI_GETSHORTPATHNAME )
{
void * hLongPath;
DWORD length = 0;
LPCTSTR lpszLongPath = HB_PARSTR( 1, &hLongPath, NULL );
if( lpszLongPath )
{
length = GetShortPathName( lpszLongPath, NULL, 0 );
if( length && HB_ISBYREF( 2 ) )
{
LPTSTR lpszShortPath;
DWORD cchBuffer = ( DWORD ) hb_parnl( 3 );
if( cchBuffer )
cchBuffer = HB_MIN( length, cchBuffer + sizeof( TCHAR ) );
else
cchBuffer = length;
lpszShortPath = ( LPTSTR ) hb_xgrab( cchBuffer * sizeof( TCHAR ) );
length = GetShortPathName( lpszLongPath, lpszShortPath, cchBuffer );
hbwapi_SetLastError( GetLastError() );
HB_STORSTR( length > cchBuffer ? NULL : lpszShortPath, 2 );
hb_xfree( lpszShortPath );
}
else if( length == 0 )
hbwapi_SetLastError( GetLastError() );
}
hb_retnl( length );
hb_strfree( hLongPath );
}