diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a7c2ba7eb2..a2be2dbd95 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-11-02 12:48 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/common/hbfsapi.c + * harbour/source/common/hbwince.c + ! fixed hb_fsFileExists() in W32 Unicode builds and WinCE + 2007-11-02 21:32 UTC+0100 Miguel Angel Marchuet Frutos * contrib/bmdbfcdx/bmdbfcdx1.c ! fixed acces to set variables. diff --git a/harbour/source/common/hbfsapi.c b/harbour/source/common/hbfsapi.c index be868362f9..6b8f1a8e7f 100644 --- a/harbour/source/common/hbfsapi.c +++ b/harbour/source/common/hbfsapi.c @@ -284,7 +284,7 @@ HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName ) if( pszFileName == NULL ) return FALSE; - #if defined( HB_OS_DOS ) +#if defined( HB_OS_DOS ) { union REGS regs; struct SREGS sregs; @@ -297,19 +297,19 @@ HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName ) return regs.x.cflag == 0; } - #elif defined( HB_OS_WIN_32 ) +#elif defined( HB_OS_WIN_32 ) { - return GetFileAttributes( pszFileName ) != INVALID_FILE_ATTRIBUTES; + return GetFileAttributesA( pszFileName ) != INVALID_FILE_ATTRIBUTES; } - #elif defined( HB_OS_UNIX ) +#elif defined( HB_OS_UNIX ) { struct stat statbuf; return stat( pszFileName, &statbuf ) == 0; } - #else +#else { return FALSE; } - #endif +#endif } diff --git a/harbour/source/common/hbwince.c b/harbour/source/common/hbwince.c index 368e41cf51..16bf8962bb 100644 --- a/harbour/source/common/hbwince.c +++ b/harbour/source/common/hbwince.c @@ -446,13 +446,15 @@ BOOL WINAPI CreateDirectoryA( LPCSTR path, LPSECURITY_ATTRIBUTES attr ) BOOL WINAPI CharToOemBuffA( LPCSTR src, LPSTR dst, DWORD len ) { - hb_strncpy( dst, src, len ); + if( len ) + hb_strncpy( dst, src, len - 1 ); return TRUE; } BOOL WINAPI OemToCharBuffA( LPCSTR src, LPSTR dst, DWORD len ) { - hb_strncpy( dst, src, len ); + if( len ) + hb_strncpy( dst, src, len - 1 ); return TRUE; } @@ -500,6 +502,18 @@ BOOL WINAPI FindNextFileA( HANDLE handle, WIN32_FIND_DATAA * data ) return b; } +DWORD WINAPI GetFileAttributesA( LPCSTR path ) +{ + LPWSTR wpath; + DWORD dw; + + wpath = hb_mbtowc( path ); + dw = GetFileAttributesW( wpath ); + hb_xfree( wpath ); + + return dw; +} + BOOL WINAPI GetVersionExA( OSVERSIONINFOA * v ) { OSVERSIONINFOW wv;