From 23ac606bcc933d04dd83b830ed01d425eaab9833 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 8 Jan 2010 00:14:19 +0000 Subject: [PATCH] 2010-01-08 01:02 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * src/vm/dlmalloc.c ! Fixed two potentially uninitialized variables, signaled by MSVC. * src/common/hbgete.c + Changed to use native SetEnvironmentVariable() API instead of forced ANSI one. * src/common/hbwince.c * include/hbwince.h % Deleted unused ANSI Windows API stubs. + Added empty SetEnvironmentVariable() stub for WinCE builds where it's missing. * Reconfigured these stubs: SetCurrentDirectory() GetCurrentDirectory() GetComputerName() GetUserName() * config/win/global.mk * Comment updated. * config/win/msvc.mk + Added -nxcompat and -dynamicbase to .dll link command. (I'm unsure what -dynamicbase is good for in a .dll, but it's accepted and set) ! Fixed to add -nxcompat/-dynamicbase for MSVC 2008 and upper. (it's also possible to use it with MSVS 2005 SP1 though, but build won't detect this case) --- harbour/ChangeLog | 32 ++- harbour/config/win/global.mk | 2 +- harbour/config/win/msvc.mk | 8 +- harbour/include/hbwince.h | 53 ++--- harbour/src/common/hbgete.c | 10 +- harbour/src/common/hbwince.c | 385 +---------------------------------- harbour/src/vm/dlmalloc.c | 6 + 7 files changed, 74 insertions(+), 422 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 78c16dce5d..5d12dd7728 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,36 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-08 01:02 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/vm/dlmalloc.c + ! Fixed two potentially uninitialized variables, signaled by MSVC. + + * src/common/hbgete.c + + Changed to use native SetEnvironmentVariable() API instead of + forced ANSI one. + + * src/common/hbwince.c + * include/hbwince.h + % Deleted unused ANSI Windows API stubs. + + Added empty SetEnvironmentVariable() stub for WinCE + builds where it's missing. + * Reconfigured these stubs: + SetCurrentDirectory() + GetCurrentDirectory() + GetComputerName() + GetUserName() + + * config/win/global.mk + * Comment updated. + + * config/win/msvc.mk + + Added -nxcompat and -dynamicbase to .dll link command. + (I'm unsure what -dynamicbase is good for in a .dll, but it's + accepted and set) + ! Fixed to add -nxcompat/-dynamicbase for MSVC 2008 and upper. + (it's also possible to use it with MSVS 2005 SP1 though, but + build won't detect this case) + 2010-01-07 21:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * INSTALL + Added free SVN book link. @@ -46,7 +76,7 @@ needed by Harbour. ; TODO: Delete rest of not anymore used ANSI WinAPI functions. Now Harbour never uses ANSI - WinAPI functions in UNICODE mode. + WinAPI functions in UNICODE mode. [DONE] * config/win/global.mk - Deleted reference to CharToOemBuffA(), OemToCharBuffA(). diff --git a/harbour/config/win/global.mk b/harbour/config/win/global.mk index 791a18bf75..5fd05f973e 100644 --- a/harbour/config/win/global.mk +++ b/harbour/config/win/global.mk @@ -15,7 +15,7 @@ ifneq ($(HB_CPU),x86) endif # kernel32: needed by some compilers (pocc/watcom) -# user32: *Clipboard*(), MessageBox(), GetKeyState(), GetKeyboardState(), SetKeyboardState() +# user32: *Clipboard*(), GetKeyState(), GetKeyboardState(), SetKeyboardState(), gtwvt stuff # ws2_32: hbsocket # advapi32: GetUserName() # gdi32: gtwvt diff --git a/harbour/config/win/msvc.mk b/harbour/config/win/msvc.mk index 462cd9149d..e8e1dc884e 100644 --- a/harbour/config/win/msvc.mk +++ b/harbour/config/win/msvc.mk @@ -24,6 +24,12 @@ CFLAGS += -I. -I$(HB_INC_COMPILE) CFLAGS += -nologo +# MSVS 2005 SP1 also supports it, but we only enable it for 2008 and upper. +ifeq ($(filter $(HB_COMPILER_VER),600 700 710 800),) + LDFLAGS += -nxcompat -dynamicbase -fixed:no + DFLAGS += -nxcompat -dynamicbase +endif + ifeq ($(HB_BUILD_MODE),c) CFLAGS += -TC endif @@ -73,7 +79,7 @@ LD_OUT := -out: LIBPATHS := -libpath:$(LIB_DIR) LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),$(lib)$(LIB_EXT)) -LDFLAGS += -nologo -nxcompat -dynamicbase -fixed:no $(LIBPATHS) +LDFLAGS += -nologo $(LIBPATHS) AR := lib.exe AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) -nologo -out:$(LIB_DIR)/$@ $(^F) || $(RM) $(LIB_DIR)/$@ diff --git a/harbour/include/hbwince.h b/harbour/include/hbwince.h index fd2de148a9..4927bb2989 100644 --- a/harbour/include/hbwince.h +++ b/harbour/include/hbwince.h @@ -67,7 +67,6 @@ typedef long clock_t; extern clock_t clock( void ); #endif -extern int remove( const char * filename ); extern int system( const char * string ); extern char * strerror( int errnum ); @@ -95,20 +94,9 @@ extern char * strerror( int errnum ); #endif #endif - DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size ); - BOOL WINAPI SetEnvironmentVariableA( LPCSTR name, LPCSTR value ); - LPSTR WINAPI GetEnvironmentStringsA( void ); BOOL WINAPI GetProcessTimes( HANDLE hprocess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); - BOOL WINAPI GetUserNameA( LPSTR buffer, LPDWORD len ); - BOOL WINAPI GetUserNameW( LPWSTR buffer, LPDWORD len ); - BOOL WINAPI GetComputerNameA( LPSTR buffer, LPDWORD len ); - BOOL WINAPI GetComputerNameW( LPWSTR buffer, LPDWORD len ); - DWORD WINAPI GetCurrentDirectoryA( DWORD len, LPSTR buffer ); - DWORD WINAPI GetCurrentDirectoryW( DWORD len, LPWSTR buffer ); - BOOL WINAPI SetCurrentDirectoryA( LPCSTR dirname ); - BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dirname ); BOOL WINAPI LockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ); @@ -122,29 +110,9 @@ extern char * strerror( int errnum ); BOOL WINAPI UnlockFileEx( HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped ); - BOOL WINAPI GetVolumeInformationA( LPCSTR p1, LPSTR p2, DWORD p3, PDWORD p4, - PDWORD p5, PDWORD p6, LPSTR p7, DWORD p8 ); UINT WINAPI SetErrorMode( UINT mode ); - HANDLE WINAPI CreateFileA( LPCSTR filename, DWORD access, - DWORD sharing, LPSECURITY_ATTRIBUTES sa, - DWORD creation, DWORD attributes, HANDLE tmplt ); - BOOL WINAPI MoveFileA( LPCSTR fn1, LPCSTR fn2 ); - BOOL WINAPI DeleteFileA( LPCSTR path ); - BOOL WINAPI RemoveDirectoryA( LPCSTR path ); - BOOL WINAPI CreateDirectoryA( LPCSTR path, LPSECURITY_ATTRIBUTES attr ); - BOOL WINAPI SetFileAttributesA( LPCSTR filename, DWORD attr ); - HANDLE WINAPI FindFirstFileA( LPCSTR path, WIN32_FIND_DATAA * data ); - BOOL WINAPI FindNextFileA( HANDLE handle, WIN32_FIND_DATAA * data ); - BOOL WINAPI GetVersionExA( OSVERSIONINFOA * v ); HANDLE WINAPI GetStdHandle( DWORD nStdHandle ); DWORD WINAPI GetFileType( HANDLE handle ); - HMODULE WINAPI GetModuleHandleA( LPCSTR modulename ); - HINSTANCE WINAPI LoadLibraryA( LPCSTR libname ); - DWORD WINAPI GetTempPathA( DWORD size, LPSTR buffer ); - UINT WINAPI GetTempFileNameA( LPCSTR tmpdir, LPCSTR prefix, UINT unique, LPSTR filename ); - BOOL WINAPI GetDiskFreeSpaceA( LPCSTR path, PDWORD pdwSectorsPerCluster, - PDWORD pdwBytesPerSector, - PDWORD pdwNumberOfFreeClusters, PDWORD pdwTotalNumberOfClusters ); BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDurat ); int WINAPI SetTextCharacterExtra( HDC hdc, int i ); BOOL WINAPI GetKeyboardState( PBYTE p ); @@ -184,9 +152,28 @@ extern char * strerror( int errnum ); #if !defined( GetEnvironmentVariable ) DWORD WINAPI GetEnvironmentVariableW( LPCWSTR name, LPWSTR value, DWORD size ); - DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size ); #define GetEnvironmentVariable GetEnvironmentVariableW #endif + #if !defined( SetEnvironmentVariable ) + BOOL WINAPI SetEnvironmentVariableW( LPCWSTR name, LPCWSTR value ); + #define SetEnvironmentVariable SetEnvironmentVariableW + #endif + #if !defined( SetCurrentDirectory ) + #define SetCurrentDirectory SetCurrentDirectoryW + BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dirname ); + #endif + #if !defined( GetCurrentDirectory ) + #define GetCurrentDirectory GetCurrentDirectoryW + DWORD WINAPI GetCurrentDirectoryW( DWORD len, LPWSTR buffer ); + #endif + #if !defined( GetComputerName ) + #define GetComputerName GetComputerNameW + BOOL WINAPI GetComputerNameW( LPWSTR buffer, LPDWORD len ); + #endif + #if !defined( GetUserName ) + #define GetUserName GetUserNameW + BOOL WINAPI GetUserNameW( LPWSTR buffer, LPDWORD len ); + #endif #endif /* HB_OS_WIN_USED */ diff --git a/harbour/src/common/hbgete.c b/harbour/src/common/hbgete.c index a8a2faa6dc..144af59f6c 100644 --- a/harbour/src/common/hbgete.c +++ b/harbour/src/common/hbgete.c @@ -190,8 +190,14 @@ BOOL hb_getenv_buffer( const char * szName, char * szBuffer, int nSize ) BOOL hb_setenv( const char * szName, const char * szValue ) { #if defined( HB_OS_WIN ) - - return SetEnvironmentVariableA( szName, szValue ) != 0; + { + LPTSTR lpName = HB_TCHAR_CONVTO( szName ); + LPTSTR lpValue = HB_TCHAR_CONVTO( szValue ); + BOOL bResult = ( SetEnvironmentVariable( lpName, lpValue ) != 0 ); + HB_TCHAR_FREE( lpValue ); + HB_TCHAR_FREE( lpName ); + return bResult; + } #elif defined( _BSD_SOURCE ) || _POSIX_C_SOURCE >= 200112L || \ _XOPEN_SOURCE >= 600 || \ diff --git a/harbour/src/common/hbwince.c b/harbour/src/common/hbwince.c index c5cfaa29a3..6896929ce0 100644 --- a/harbour/src/common/hbwince.c +++ b/harbour/src/common/hbwince.c @@ -130,11 +130,6 @@ void hb_wctombget( char *dstA, const wchar_t *srcW, unsigned long ulLen ) #if defined( HB_OS_WIN_CE ) -int remove( const char *filename ) -{ - return DeleteFileA( filename ) ? 0 : -1; -} - int system( const char *cmd ) { LPWSTR wcmd; @@ -182,48 +177,6 @@ char * strerror( int errnum ) return ( char * ) ""; } -DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size ) -{ - /* use registry instead of "environment variable". */ - HKEY hk; - LONG lret; - DWORD dwType = REG_SZ, cbData; - TCHAR buf[ MAX_PATH ] = { 0 }; - LPWSTR wname; - LPSTR avalue; - - lret = RegOpenKeyEx( HKEY_LOCAL_MACHINE, TEXT( "Software\\harbour_mswince" ), 0, KEY_QUERY_VALUE, &hk ); - - if( lret != ERROR_SUCCESS ) - { - if( value && size ) - value[ 0 ] = '\0'; - return 0; - } - - cbData = MAX_PATH * sizeof( *buf ); - wname = hb_mbtowc( name ); - lret = RegQueryValueExW( hk, wname, NULL, &dwType, ( LPBYTE ) buf, &cbData ); - hb_xfree( wname ); - RegCloseKey( hk ); - - if( lret != ERROR_SUCCESS ) - { - if( value && size ) - value[ 0 ] = '\0'; - return 0; - } - - avalue = hb_wctomb( buf ); - if( value && size ) - hb_strncpy( value, avalue, size - 1 ); - size = strlen( avalue ); - - hb_xfree( avalue ); - - return size; -} - DWORD WINAPI GetEnvironmentVariableW( LPCWSTR name, LPWSTR value, DWORD size ) { /* use registry instead of "environment variable". */ @@ -254,7 +207,7 @@ DWORD WINAPI GetEnvironmentVariableW( LPCWSTR name, LPWSTR value, DWORD size ) return result; } -BOOL WINAPI SetEnvironmentVariableA( LPCSTR name, LPCSTR value ) +BOOL WINAPI SetEnvironmentVariableW( LPCWSTR name, LPCWSTR value ) { HB_SYMBOL_UNUSED( name ); HB_SYMBOL_UNUSED( value ); @@ -278,14 +231,6 @@ BOOL WINAPI GetProcessTimes( HANDLE hprocess, return 0; } -BOOL WINAPI GetUserNameA( LPSTR buffer, LPDWORD len ) -{ - if( len && buffer ) - buffer[ 0 ] = '\0'; - - return FALSE; -} - BOOL WINAPI GetUserNameW( LPWSTR buffer, LPDWORD len ) { if( len && buffer ) @@ -294,14 +239,6 @@ BOOL WINAPI GetUserNameW( LPWSTR buffer, LPDWORD len ) return FALSE; } -BOOL WINAPI GetComputerNameA( LPSTR buffer, LPDWORD len ) -{ - if( len && buffer ) - buffer[ 0 ] = '\0'; - - return FALSE; -} - BOOL WINAPI GetComputerNameW( LPWSTR buffer, LPDWORD len ) { if( len && buffer ) @@ -310,14 +247,6 @@ BOOL WINAPI GetComputerNameW( LPWSTR buffer, LPDWORD len ) return FALSE; } -DWORD WINAPI GetCurrentDirectoryA( DWORD len, LPSTR buffer ) -{ - if( len && buffer ) - buffer[ 0 ] = '\0'; - - return FALSE; -} - DWORD WINAPI GetCurrentDirectoryW( DWORD len, LPWSTR buffer ) { if( len && buffer ) @@ -326,13 +255,6 @@ DWORD WINAPI GetCurrentDirectoryW( DWORD len, LPWSTR buffer ) return FALSE; } -BOOL WINAPI SetCurrentDirectoryA( LPCSTR dirname ) -{ - HB_SYMBOL_UNUSED( dirname ); - - return FALSE; -} - BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dirname ) { HB_SYMBOL_UNUSED( dirname ); @@ -394,21 +316,6 @@ BOOL WINAPI UnlockFileEx( HANDLE hFile, DWORD dwReserved, return TRUE; } -BOOL WINAPI GetVolumeInformationA( LPCSTR p1, LPSTR p2, DWORD p3, PDWORD p4, - PDWORD p5, PDWORD p6, LPSTR p7, DWORD p8 ) -{ - HB_SYMBOL_UNUSED( p1 ); - HB_SYMBOL_UNUSED( p2 ); - HB_SYMBOL_UNUSED( p3 ); - HB_SYMBOL_UNUSED( p4 ); - HB_SYMBOL_UNUSED( p5 ); - HB_SYMBOL_UNUSED( p6 ); - HB_SYMBOL_UNUSED( p7 ); - HB_SYMBOL_UNUSED( p8 ); - - return FALSE; -} - UINT WINAPI SetErrorMode( UINT mode ) { HB_SYMBOL_UNUSED( mode ); @@ -416,209 +323,6 @@ UINT WINAPI SetErrorMode( UINT mode ) return 0; } -HANDLE WINAPI CreateFileA( LPCSTR filename, DWORD access, - DWORD sharing, LPSECURITY_ATTRIBUTES sa, - DWORD creation, DWORD attributes, HANDLE tmplt ) -{ - DWORD dwError; - LPWSTR wfilename; - HANDLE h; - - wfilename = hb_mbtowc( filename ); - h = CreateFileW( wfilename, access, sharing, sa, creation, attributes, tmplt ); - dwError = GetLastError(); - hb_xfree( wfilename ); - SetLastError( dwError ); - - return h; -} - -BOOL WINAPI MoveFileA( LPCSTR fn1, LPCSTR fn2 ) -{ - DWORD dwError; - LPWSTR wfn1, wfn2; - BOOL b; - - wfn1 = hb_mbtowc( fn1 ); - wfn2 = hb_mbtowc( fn2 ); - b = MoveFileW( wfn1, wfn2 ); - dwError = GetLastError(); - hb_xfree( wfn1 ); - hb_xfree( wfn2 ); - SetLastError( dwError ); - - return b; -} - -BOOL WINAPI DeleteFileA( LPCSTR path ) -{ - DWORD dwError; - LPWSTR wpath; - BOOL b; - - wpath = hb_mbtowc( path ); - b = DeleteFileW( wpath ); - dwError = GetLastError(); - hb_xfree( wpath ); - SetLastError( dwError ); - - return b; -} - -BOOL WINAPI RemoveDirectoryA( LPCSTR path ) -{ - DWORD dwError; - LPWSTR wpath; - BOOL b; - - wpath = hb_mbtowc( path ); - b = RemoveDirectoryW( wpath ); - dwError = GetLastError(); - hb_xfree( wpath ); - SetLastError( dwError ); - - return b; -} - -BOOL WINAPI CreateDirectoryA( LPCSTR path, LPSECURITY_ATTRIBUTES attr ) -{ - DWORD dwError; - LPWSTR wpath; - BOOL b; - - wpath = hb_mbtowc( path ); - b = CreateDirectoryW( wpath, attr ); - dwError = GetLastError(); - hb_xfree( wpath ); - SetLastError( dwError ); - - return b; -} - -BOOL WINAPI SetFileAttributesA( LPCSTR filename, DWORD attr ) -{ - DWORD dwError; - LPWSTR wfilename; - BOOL b; - - wfilename = hb_mbtowc( filename ); - b = SetFileAttributesW( wfilename, attr ); - dwError = GetLastError(); - hb_xfree( wfilename ); - SetLastError( dwError ); - - return b; -} - -HANDLE WINAPI FindFirstFileA( LPCSTR path, WIN32_FIND_DATAA * data ) -{ - DWORD dwError; - WIN32_FIND_DATAW wdata; - LPWSTR wpath; - LPSTR mb; - HANDLE h; - - wpath = hb_mbtowc( path ); - h = FindFirstFileW( wpath, &wdata ); - dwError = GetLastError(); - hb_xfree( wpath ); - mb = hb_wctomb( wdata.cFileName ); - hb_strncpy( data->cFileName, mb, sizeof( data->cFileName ) - 1 ); - hb_xfree( mb ); - data->dwFileAttributes = wdata.dwFileAttributes; - data->ftCreationTime = wdata.ftCreationTime; - data->ftLastAccessTime = wdata.ftLastAccessTime; - data->ftLastWriteTime = wdata.ftLastWriteTime; - data->nFileSizeHigh = wdata.nFileSizeHigh; - data->nFileSizeLow = wdata.nFileSizeLow; - SetLastError( dwError ); - - return h; -} - -BOOL WINAPI FindNextFileA( HANDLE handle, WIN32_FIND_DATAA * data ) -{ - DWORD dwError; - WIN32_FIND_DATAW wdata; - LPSTR mb; - BOOL b; - - b = FindNextFileW( handle, &wdata ); - dwError = GetLastError(); - mb = hb_wctomb( wdata.cFileName ); - hb_strncpy( data->cFileName, mb, sizeof( data->cFileName ) - 1 ); - hb_xfree( mb ); - data->dwFileAttributes = wdata.dwFileAttributes; - data->ftCreationTime = wdata.ftCreationTime; - data->ftLastAccessTime = wdata.ftLastAccessTime; - data->ftLastWriteTime = wdata.ftLastWriteTime; - data->nFileSizeHigh = wdata.nFileSizeHigh; - data->nFileSizeLow = wdata.nFileSizeLow; - SetLastError( dwError ); - - return b; -} - -DWORD WINAPI GetFileAttributesA( LPCSTR path ) -{ - DWORD dwError; - LPWSTR wpath; - DWORD dw; - - wpath = hb_mbtowc( path ); - dw = GetFileAttributesW( wpath ); - dwError = GetLastError(); - hb_xfree( wpath ); - SetLastError( dwError ); - - return dw; -} - -UINT WINAPI GetDriveTypeA( LPCSTR path ) -{ - /* temporary disabled - not all WinCE compilers support GetDriveTypeW() */ -#if 0 - DWORD dwError; - LPWSTR wpath; - UINT ui; - - wpath = hb_mbtowc( path ); - ui = GetDriveTypeW( wpath ); - dwError = GetLastError(); - hb_xfree( wpath ); - SetLastError( dwError ); - - return ui; -#else - HB_SYMBOL_UNUSED( path ); - - return DRIVE_UNKNOWN; -#endif /* 0 */ -} - -BOOL WINAPI GetVersionExA( OSVERSIONINFOA * v ) -{ - DWORD dwError; - OSVERSIONINFOW wv; - LPSTR mb; - BOOL b; - - b = GetVersionExW( &wv ); - dwError = GetLastError(); - mb = hb_wctomb( wv.szCSDVersion ); - hb_strncpy( v->szCSDVersion, mb, sizeof( v->szCSDVersion ) - 1 ); - hb_xfree( mb ); - v->dwOSVersionInfoSize = wv.dwOSVersionInfoSize; - v->dwMajorVersion = wv.dwMajorVersion; - v->dwMinorVersion = wv.dwMinorVersion; - v->dwBuildNumber = wv.dwBuildNumber; - v->dwPlatformId = wv.dwPlatformId; - SetLastError( dwError ); - - return b; -} - - HANDLE WINAPI GetStdHandle( DWORD nStdHandle ) { HB_SYMBOL_UNUSED( nStdHandle ); @@ -633,80 +337,6 @@ DWORD WINAPI GetFileType( HANDLE handle ) return 0; } -HMODULE WINAPI GetModuleHandleA( LPCSTR modulename ) -{ - DWORD dwError; - LPWSTR wmodulename; - HMODULE h; - - wmodulename = hb_mbtowc( modulename ); - h = GetModuleHandleW( wmodulename ); - dwError = GetLastError(); - hb_xfree( wmodulename ); - SetLastError( dwError ); - - return h; -} - -HINSTANCE WINAPI LoadLibraryA( LPCSTR libname ) -{ - DWORD dwError; - LPWSTR wlibname; - HINSTANCE h; - - wlibname = hb_mbtowc( libname ); - - h = LoadLibraryW( wlibname ); - dwError = GetLastError(); - hb_xfree( wlibname ); - SetLastError( dwError ); - - return h; -} - -DWORD WINAPI GetTempPathA( DWORD size, LPSTR buffer ) -{ - DWORD dwError; - WCHAR wbuffer[MAX_PATH] = { 0 }; - char *abuffer; - DWORD dw; - - dw = GetTempPathW( MAX_PATH, wbuffer ); - dwError = GetLastError(); - abuffer = hb_wctomb( wbuffer ); - hb_strncpy( buffer, abuffer, size ); - hb_xfree( abuffer ); - SetLastError( dwError ); - - return dw; -} - -UINT WINAPI GetTempFileNameA( LPCSTR tmpdir, LPCSTR prefix, UINT unique, LPSTR filename ) -{ - DWORD dwError; - LPWSTR wtmpdir, wprefix; - WCHAR wfilename[ MAX_PATH ] = { 0 }; - UINT u; - - wtmpdir = hb_mbtowc( tmpdir ); - wprefix = hb_mbtowc( prefix ); - u = GetTempFileNameW( wtmpdir, wprefix, unique, wfilename ); - dwError = GetLastError(); - hb_xfree( wtmpdir ); - hb_xfree( wprefix ); - - if( filename ) - { - char *afilename = hb_wctomb( wfilename ); - - hb_strncpy( filename, afilename, HB_PATH_MAX - 1 ); - hb_xfree( afilename ); - } - SetLastError( dwError ); - - return u; -} - BOOL WINAPI Beep( DWORD dwFreq, DWORD dwDurat ) { HB_SYMBOL_UNUSED( dwFreq ); @@ -846,19 +476,6 @@ clock_t clock( void ) } #endif /* __MINGW32CE__ */ -BOOL WINAPI GetDiskFreeSpaceA( LPCSTR path, PDWORD pdwSectorsPerCluster, - PDWORD pdwBytesPerSector, - PDWORD pdwNumberOfFreeClusters, PDWORD pdwTotalNumberOfClusters ) -{ - HB_SYMBOL_UNUSED( path ); - HB_SYMBOL_UNUSED( pdwSectorsPerCluster ); - HB_SYMBOL_UNUSED( pdwBytesPerSector ); - HB_SYMBOL_UNUSED( pdwNumberOfFreeClusters ); - HB_SYMBOL_UNUSED( pdwTotalNumberOfClusters ); - - return FALSE; -} - #endif /* 0 */ #endif /* HB_OS_WIN_CE */ diff --git a/harbour/src/vm/dlmalloc.c b/harbour/src/vm/dlmalloc.c index 94ec87faa0..27c8c8605d 100644 --- a/harbour/src/vm/dlmalloc.c +++ b/harbour/src/vm/dlmalloc.c @@ -4855,6 +4855,9 @@ size_t mspace_footprint(mspace msp) { if (ok_magic(ms)) { result = ms->footprint; } + else { + result = 0; + } USAGE_ERROR_ACTION(ms,ms); return result; } @@ -4866,6 +4869,9 @@ size_t mspace_max_footprint(mspace msp) { if (ok_magic(ms)) { result = ms->max_footprint; } + else { + result = 0; + } USAGE_ERROR_ACTION(ms,ms); return result; }