2009-10-15 15:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* src/common/hbgete.c
  * src/rtl/filesys.c
  * src/rtl/net.c
    + Changed to use native instead of fixed ANSI version of win API calls.
    ; Please review me, all these are critical low level functions, 
      so any mistakes can be deadly.

    ; TODO: There are still some forced ANSI calls in Harbour code:
            (plus some dynamically called ones)
      ---
      source/common/hbver.c:264:      if( GetVersionExA( &osVer ) )
      source/common/hbver.c:306:                  if( GetVersionExA( ( OSVERSIONINFOA * ) &osVerEx ) )
      source/rtl/fstemp.c:153:         if( ! GetTempPathA( ( DWORD ) ( HB_PATH_MAX - 1 ), pszName ) )
      source/rtl/fstemp.c:270:         if( ! GetTempPathA( ( DWORD ) HB_PATH_MAX, szTempDir ) )
      source/rtl/fstemp.c:278:      fResult = GetTempFileNameA( szTempDir, pszPrefix ? pszPrefix : "hb", 0, pszBuffer );
      contrib/hbwin/win_prn2.c:169:      DWORD dwSize = GetProfileStringA( "windows", "device", "", pPrinterName, *pdwBufferSize );
      ---

  * src/rtl/fstemp.c
    * Minor formatting.
This commit is contained in:
Viktor Szakats
2009-10-15 13:56:40 +00:00
parent 57bee03186
commit 1a71aa5b61
5 changed files with 71 additions and 17 deletions

View File

@@ -17,6 +17,28 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-10-15 15:55 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/common/hbgete.c
* src/rtl/filesys.c
* src/rtl/net.c
+ Changed to use native instead of fixed ANSI version of win API calls.
; Please review me, all these are critical low level functions,
so any mistakes can be deadly.
; TODO: There are still some forced ANSI calls in Harbour code:
(plus some dynamically called ones)
---
source/common/hbver.c:264: if( GetVersionExA( &osVer ) )
source/common/hbver.c:306: if( GetVersionExA( ( OSVERSIONINFOA * ) &osVerEx ) )
source/rtl/fstemp.c:153: if( ! GetTempPathA( ( DWORD ) ( HB_PATH_MAX - 1 ), pszName ) )
source/rtl/fstemp.c:270: if( ! GetTempPathA( ( DWORD ) HB_PATH_MAX, szTempDir ) )
source/rtl/fstemp.c:278: fResult = GetTempFileNameA( szTempDir, pszPrefix ? pszPrefix : "hb", 0, pszBuffer );
contrib/hbwin/win_prn2.c:169: DWORD dwSize = GetProfileStringA( "windows", "device", "", pPrinterName, *pdwBufferSize );
---
* src/rtl/fstemp.c
* Minor formatting.
2009-10-15 13:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.pt_BR.po
* utils/hbmk2/hbmk2.hu_HU.po
@@ -1683,6 +1705,7 @@
source/rtl/net.c:186: GetUserNameA( pszValue, &ulLen );
contrib/hbwin/win_prn2.c:169: DWORD dwSize = GetProfileStringA( "windows", "device", "", pPrinterName, *pdwBufferSize );
---
[DONE]
; Review me.

View File

@@ -72,13 +72,20 @@ char * hb_getenv( const char * szName )
#if defined( HB_OS_WIN )
{
DWORD size = GetEnvironmentVariableA( szName, NULL, 0 );
LPTSTR lpName = HB_TCHAR_CONVTO( szName );
DWORD size = GetEnvironmentVariable( lpName, NULL, 0 );
if( size != 0 )
{
pszBuffer = ( char * ) hb_xgrab( size );
GetEnvironmentVariableA( szName, pszBuffer, size );
LPTSTR lpBuffer = ( LPTSTR ) hb_xgrab( size * sizeof( TCHAR ) );
GetEnvironmentVariable( lpName, lpBuffer, size );
pszBuffer = HB_TCHAR_CONVFROM( lpBuffer );
#if defined( UNICODE )
HB_TCHAR_FREE( lpBuffer );
#endif
}
HB_TCHAR_FREE( lpName );
}
#elif defined( HB_OS_OS2 )
@@ -110,9 +117,17 @@ BOOL hb_getenv_buffer( const char * szName, char * szBuffer, int nSize )
BOOL bRetVal;
#if defined( HB_OS_WIN )
{
LPTSTR lpName = HB_TCHAR_CONVTO( szName );
LPTSTR lpBuffer = ( LPTSTR ) hb_xgrab( nSize * sizeof( TCHAR ) );
bRetVal = GetEnvironmentVariableA( szName, szBuffer, nSize ) != 0;
bRetVal = GetEnvironmentVariable( lpName, lpBuffer, nSize ) != 0;
HB_TCHAR_GETFROM( szBuffer, lpBuffer, nSize );
HB_TCHAR_FREE( lpBuffer );
HB_TCHAR_FREE( lpName );
}
#elif defined( HB_OS_OS2 )
{
PSZ EnvValue = ( PSZ ) "";

View File

@@ -2729,12 +2729,14 @@ USHORT hb_fsCurDirBuff( USHORT uiDrive, char * pszBuffer, ULONG ulSize )
#endif
#if defined( HB_OS_WIN )
hb_vmUnlock();
fResult = GetCurrentDirectoryA( ulSize, pszBuffer );
hb_fsSetIOError( fResult, 0 );
hb_vmLock();
{
LPTSTR lpBuffer = ( LPTSTR ) hb_xgrab( ulSize * sizeof( TCHAR ) );
hb_vmUnlock();
fResult = GetCurrentDirectory( ulSize, lpBuffer );
hb_fsSetIOError( fResult, 0 );
hb_vmLock();
HB_TCHAR_GETFROM( pszBuffer, lpBuffer, ulSize );
}
#elif defined( HB_OS_OS2 ) && defined( __GNUC__ )
hb_vmUnlock();

View File

@@ -173,7 +173,7 @@ static HB_FHANDLE hb_fsCreateTempLow( const char * pszDir, const char * pszPrefi
#endif
}
if( pszName[0] != '\0' )
if( pszName[ 0 ] != '\0' )
{
int len = strlen( pszName );
if( pszName[ len - 1 ] != HB_OS_PATH_DELIM_CHR )

View File

@@ -151,10 +151,17 @@ char * hb_netname( void )
#elif defined( HB_OS_WIN )
DWORD ulLen = MAX_COMPUTERNAME_LENGTH + 1;
char * pszValue = ( char * ) hb_xgrab( ulLen );
LPTSTR lpValue = ( LPTSTR ) hb_xgrab( ulLen * sizeof( TCHAR ) );
char * pszValue;
lpValue[ 0 ] = L'\0';
GetComputerName( lpValue, &ulLen );
pszValue = HB_TCHAR_CONVFROM( lpValue );
#if defined( UNICODE )
HB_TCHAR_FREE( lpValue );
#endif
pszValue[ 0 ] = '\0';
GetComputerNameA( pszValue, &ulLen );
return pszValue;
#else
@@ -180,10 +187,17 @@ char * hb_username( void )
#elif defined( HB_OS_WIN )
DWORD ulLen = 256;
char * pszValue = ( char * ) hb_xgrab( ulLen );
LPTSTR lpValue = ( LPTSTR ) hb_xgrab( ulLen * sizeof( TCHAR ) );
char * pszValue;
lpValue[ 0 ] = L'\0';
GetUserName( lpValue, &ulLen );
pszValue = HB_TCHAR_CONVFROM( lpValue );
#if defined( UNICODE )
HB_TCHAR_FREE( lpValue );
#endif
pszValue[ 0 ] = '\0';
GetUserNameA( pszValue, &ulLen );
return pszValue;
#else