diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c0c58a4ba9..baf55b9bb6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,19 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-03-05 13:48 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * src/common/hbver.c + * include/hbapi.h + + Added hb_iswinvista() to detect Vista and newer Windows versions. + + * src/rtl/version.c + * include/hbextern.ch + + Added HB_OSISWINVISTA() .prg level function with above meaning. + + * contrib/hbwin/win_os.prg + % Changed to use HB_OSISWINVISTA() instead of hbwin specific + WIN_OSISVISTAORUPPER(). + 2010-03-05 13:19 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbrddnsx.h * harbour/src/rdd/dbfnsx/dbfnsx1.c @@ -43,7 +56,7 @@ 2010-03-05 11:11 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/rddsql/sddoci/sddoci.c - ! Fixed OCILIB initalization to make OCI_GetLastError() work. + ! Fixed OCILIB initialization to make OCI_GetLastError() work. (Thanks to OCILIB author Vincent Rogier for the report and fix) @@ -52,7 +65,7 @@ on code posted Saulius Zrelskis) + Added code to disable 'close' menu also. This is using undocumented Windows API call, so by default the logic - is disabled, and can be enabled with HB_GTWIN_UNDOC_WINAPI + is disabled, and can be enabled with HB_GTWIN_USE_UNDOC_WINAPI macro. (Thanks to Saulius Zrelskis for this API tip) (NOTE: All 'close' controls are controlled by HB_GTI_CLOSABLE) diff --git a/harbour/contrib/hbwin/win_os.prg b/harbour/contrib/hbwin/win_os.prg index d830a25c0f..6aa2386c78 100644 --- a/harbour/contrib/hbwin/win_os.prg +++ b/harbour/contrib/hbwin/win_os.prg @@ -75,7 +75,7 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista ) DEFAULT lSetIt TO .F. DEFAULT lDoVista TO .T. - IF ! lDoVista .AND. win_osIsVistaOrUpper() + IF ! lDoVista .AND. hb_osIsWinVista() /* do nothing */ ELSEIF hb_osIsWin9x() bRetVal := win_regQuery( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt ) @@ -94,7 +94,7 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista ) bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt ) bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt ) - IF win_osIsVistaOrUpper() + IF hb_osIsWinVista() /* If SMB2 is enabled turning off oplocks does not work, so SMB2 is required to be turned off on Server. */ bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SMB2", 0, lSetIt ) ENDIF diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index 1100a0ae6f..43344ca747 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -1129,9 +1129,11 @@ extern HB_EXPORT const char * hb_verFlagsPRG( void ); /* retrieves a stat extern HB_EXPORT const char * hb_verHB_PLAT( void ); /* retrieves a static buffer containing build time HB_PLATFORM setting */ extern HB_EXPORT const char * hb_verHB_COMP( void ); /* retrieves a static buffer containing build time HB_COMPILER setting */ -extern HB_EXPORT HB_BOOL hb_iswin9x( void ); /* return .T. if OS == Windows 9x, ME */ -extern HB_EXPORT HB_BOOL hb_iswinnt( void ); /* return .T. if OS == Windows NT, 2000, XP */ -extern HB_EXPORT HB_BOOL hb_iswince( void ); /* return .T. if OS is Windows CE or Windows Mobile */ +extern HB_EXPORT HB_BOOL hb_iswin9x( void ); /* return HB_TRUE if OS == Windows 9x, ME */ +extern HB_EXPORT HB_BOOL hb_iswinnt( void ); /* return HB_TRUE if OS == Windows NT, 2000, XP or newer */ +extern HB_EXPORT HB_BOOL hb_iswinvista( void ); /* return HB_TRUE if OS == Windows Vista, 7, 2008 or newer */ +extern HB_EXPORT HB_BOOL hb_iswince( void ); /* return HB_TRUE if OS is Windows CE or Windows Mobile */ + extern HB_EXPORT HB_BOOL hb_printerIsReady( const char * pszPrinterName ); /* OS/Harbour codepage conversion */ diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index aba0f88c17..630ddfab2d 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -948,6 +948,7 @@ EXTERNAL HB_MILLISECONDS EXTERNAL HB_CURDRIVE EXTERNAL HB_OSNEWLINE EXTERNAL HB_OSISWINNT +EXTERNAL HB_OSISWINVISTA EXTERNAL HB_OSISWINCE EXTERNAL HB_APARAMS EXTERNAL HB_PVALUE diff --git a/harbour/src/common/hbver.c b/harbour/src/common/hbver.c index 56b4fa1811..6535d00796 100644 --- a/harbour/src/common/hbver.c +++ b/harbour/src/common/hbver.c @@ -399,6 +399,7 @@ char * hb_verPlatform( void ) #if defined( HB_OS_WIN ) static HB_BOOL s_fWinVerInit = HB_FALSE; +static HB_BOOL s_fWinVista = HB_FALSE; static HB_BOOL s_fWinNT = HB_FALSE; static HB_BOOL s_fWin9x = HB_FALSE; @@ -409,6 +410,7 @@ static void s_hb_winVerInit( void ) osvi.dwOSVersionInfoSize = sizeof( osvi ); if( GetVersionEx( &osvi ) ) { + s_fWinVista = osvi.dwMajorVersion >= 6; s_fWinNT = osvi.dwPlatformId == VER_PLATFORM_WIN32_NT; /* && osvi.dwMajorVersion >= 4); */ s_fWin9x = osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS; } @@ -416,6 +418,17 @@ static void s_hb_winVerInit( void ) } #endif +HB_BOOL hb_iswinvista( void ) +{ +#if defined( HB_OS_WIN ) + if( ! s_fWinVerInit ) + s_hb_winVerInit(); + return s_fWinVista; +#else + return HB_FALSE; +#endif +} + HB_BOOL hb_iswinnt( void ) { #if defined( HB_OS_WIN ) diff --git a/harbour/src/rtl/version.c b/harbour/src/rtl/version.c index 6707abde57..94966ffa2a 100644 --- a/harbour/src/rtl/version.c +++ b/harbour/src/rtl/version.c @@ -196,6 +196,11 @@ HB_FUNC( HB_OSISWINNT ) hb_retl( hb_iswinnt() ); } +HB_FUNC( HB_OSISWINVISTA ) +{ + hb_retl( hb_iswinvista() ); +} + HB_FUNC( HB_OSISWINCE ) { hb_retl( hb_iswince() );