From d3b17faf0e90800a5aa639033a2fbc1113b5e2fb Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 22 Nov 2012 17:09:31 +0000 Subject: [PATCH] 2012-11-22 18:09 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/contrib/hbwin/hbwin.hbx * harbour/contrib/hbwin/wapi_winbase.c + added new function: wapi_GetVolumeInformation( , @, @, @, @, @ ) -> --- harbour/ChangeLog | 8 ++++ harbour/contrib/hbwin/hbwin.hbx | 1 + harbour/contrib/hbwin/wapi_winbase.c | 60 ++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 91dbf62e93..ff02f76492 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -10,6 +10,14 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2012-11-22 18:09 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/contrib/hbwin/hbwin.hbx + * harbour/contrib/hbwin/wapi_winbase.c + + added new function: + wapi_GetVolumeInformation( , @, @, + @, @, + @ ) -> + 2012-11-22 17:16 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/src/rtl/dbedit.prg ! fixed infinite loop introduced in my recent modification diff --git a/harbour/contrib/hbwin/hbwin.hbx b/harbour/contrib/hbwin/hbwin.hbx index 8f85dfd4f6..1f1ecf50ad 100644 --- a/harbour/contrib/hbwin/hbwin.hbx +++ b/harbour/contrib/hbwin/hbwin.hbx @@ -96,6 +96,7 @@ DYNAMIC wapi_GetSystemMetrics DYNAMIC wapi_GetTextAlign DYNAMIC wapi_GetTextColor DYNAMIC wapi_GetTextFace +DYNAMIC wapi_GetVolumeInformation DYNAMIC wapi_GetWindowsDirectory DYNAMIC wapi_ImageList_Add DYNAMIC wapi_ImageList_AddMasked diff --git a/harbour/contrib/hbwin/wapi_winbase.c b/harbour/contrib/hbwin/wapi_winbase.c index 6eb0e26442..eb7a0ec5a1 100644 --- a/harbour/contrib/hbwin/wapi_winbase.c +++ b/harbour/contrib/hbwin/wapi_winbase.c @@ -476,3 +476,63 @@ HB_FUNC( WAPI_QUERYPERFORMANCEFREQUENCY ) hb_stornint( HBWAPI_GET_LARGEUINT( frequency ), 1 ); hb_retl( result != 0 ); } + +/* wapi_GetVolumeInformation( , @, @, + * @, @, + * @ ) -> + */ + +HB_FUNC( WAPI_GETVOLUMEINFORMATION ) +{ +#if defined( HB_OS_WIN ) && ! defined( HB_OS_WIN_CE ) + BOOL bResult; + DWORD dwSerialNumber, dwMaxFileNameLen, dwFileSystemFlags; + DWORD dwVolNameSize, dwFSNameSize; + LPTSTR lpVolNameBuf, lpFSNameBuf; + void * hRootPath; + LPCTSTR lpRootPath; + + dwSerialNumber = dwMaxFileNameLen = dwFileSystemFlags = 0; + dwVolNameSize = dwFSNameSize = 0; + lpVolNameBuf = lpFSNameBuf = NULL; + lpRootPath = HB_PARSTR( 1, &hRootPath, NULL ); + if( HB_ISBYREF( 2 ) ) + { + dwVolNameSize = MAX_PATH + 1; + lpVolNameBuf = ( LPTSTR ) hb_xgrab( MAX_PATH + 1 ); + } + if( HB_ISBYREF( 6 ) ) + { + dwFSNameSize = MAX_PATH + 1; + lpFSNameBuf = ( LPTSTR ) hb_xgrab( MAX_PATH + 1 ); + } + + bResult = GetVolumeInformation( lpRootPath, /* RootPathName */ + lpVolNameBuf, /* VolumeName */ + dwVolNameSize, /* VolumeNameSize */ + &dwSerialNumber, /* VolumeSerialNumber */ + &dwMaxFileNameLen, /* MaxComponentLength */ + &dwFileSystemFlags, /* FileSystemFlags */ + lpFSNameBuf, /* FileSystemName */ + dwFSNameSize ); /* FileSystemSize */ + hb_strfree( hRootPath ); + + if( lpVolNameBuf ) + { + HB_STORSTR( lpVolNameBuf, 2 ); + hb_xfree( lpVolNameBuf ); + } + hb_stornint( dwSerialNumber, 3 ); + hb_stornint( dwMaxFileNameLen, 4 ); + hb_stornint( dwFileSystemFlags, 5 ); + if( lpFSNameBuf ) + { + HB_STORSTR( lpFSNameBuf, 6 ); + hb_xfree( lpFSNameBuf ); + } + + hb_retl( bResult != 0 ); +#else + hb_retl( HB_FALSE ); +#endif +}