From df8fa6e078b3ac80356ef41c3e17da5bf7d98969 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 29 Apr 2010 06:46:25 +0000 Subject: [PATCH] 2010-04-29 08:44 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/win_osc.c + Added WIN_OSISWINXPORLATER(). Following Peter Rees in xhb. * contrib/xhb/Makefile + contrib/xhb/xwin_reg.c + contrib/xhb/xwin_ver.c * contrib/hbwin/Makefile - contrib/hbwin/legacycr.c - contrib/hbwin/legacycv.c ! Moved these legacy Windows functions to xhb lib from hbwin lib. This way we don't have to delete them after next release, plus they provide better compatibility as they are now also present in non-win builds (returning dummy values), just like in xhb. + Added OS_ISWINXP_OR_LATER() function. --- harbour/ChangeLog | 17 ++++++++++ harbour/contrib/hbwin/Makefile | 2 -- harbour/contrib/hbwin/win_osc.c | 7 ++++ harbour/contrib/xhb/Makefile | 2 ++ .../{hbwin/legacycr.c => xhb/xwin_reg.c} | 12 ++++--- .../{hbwin/legacycv.c => xhb/xwin_ver.c} | 33 +++++++++++++++---- 6 files changed, 59 insertions(+), 14 deletions(-) rename harbour/contrib/{hbwin/legacycr.c => xhb/xwin_reg.c} (93%) rename harbour/contrib/{hbwin/legacycv.c => xhb/xwin_ver.c} (77%) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6fdadba44a..9e13f95d1b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-04-29 08:44 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbwin/win_osc.c + + Added WIN_OSISWINXPORLATER(). Following Peter Rees in xhb. + + * contrib/xhb/Makefile + + contrib/xhb/xwin_reg.c + + contrib/xhb/xwin_ver.c + * contrib/hbwin/Makefile + - contrib/hbwin/legacycr.c + - contrib/hbwin/legacycv.c + ! Moved these legacy Windows functions to xhb lib from hbwin + lib. This way we don't have to delete them after next + release, plus they provide better compatibility as they are + now also present in non-win builds (returning dummy values), + just like in xhb. + + Added OS_ISWINXP_OR_LATER() function. + 2010-04-28 23:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/xhb/hbxml.c ! REVERTED: 2010-04-05 11:04 UTC+0200 diff --git a/harbour/contrib/hbwin/Makefile b/harbour/contrib/hbwin/Makefile index 4f541bbc84..6ebe730f06 100644 --- a/harbour/contrib/hbwin/Makefile +++ b/harbour/contrib/hbwin/Makefile @@ -13,8 +13,6 @@ C_SOURCES := \ legacycd.c \ legacyco.c \ legacycp.c \ - legacycr.c \ - legacycv.c \ mapi.c \ olecore.c \ oleinit.c \ diff --git a/harbour/contrib/hbwin/win_osc.c b/harbour/contrib/hbwin/win_osc.c index a334b33019..5e20d61fad 100644 --- a/harbour/contrib/hbwin/win_osc.c +++ b/harbour/contrib/hbwin/win_osc.c @@ -103,6 +103,13 @@ HB_FUNC( WIN_OSISXP ) hb_retl( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ); } +HB_FUNC( WIN_OSISWINXPORUPPER ) +{ + OSVERSIONINFO osvi; + getwinver( &osvi ); + hb_retl( osvi.dwMajorVersion > 5 || ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1 ) ); +} + HB_FUNC( WIN_OSIS2003 ) { OSVERSIONINFO osvi; diff --git a/harbour/contrib/xhb/Makefile b/harbour/contrib/xhb/Makefile index b2f39e0ddc..368f9095f9 100644 --- a/harbour/contrib/xhb/Makefile +++ b/harbour/contrib/xhb/Makefile @@ -38,6 +38,8 @@ C_SOURCES := \ xhbtrim.c \ xhbwith.c \ xstrdel.c \ + xwin_reg.c \ + xwin_ver.c \ C_HEADERS := \ hbcompat.h \ diff --git a/harbour/contrib/hbwin/legacycr.c b/harbour/contrib/xhb/xwin_reg.c similarity index 93% rename from harbour/contrib/hbwin/legacycr.c rename to harbour/contrib/xhb/xwin_reg.c index 9796d58c32..79eedc50ef 100644 --- a/harbour/contrib/hbwin/legacycr.c +++ b/harbour/contrib/xhb/xwin_reg.c @@ -52,14 +52,16 @@ #include "hbapi.h" -#if ! defined( HB_LEGACY_LEVEL3 ) && ! defined( HB_WIN_LEGACY_LEVEL_OFF ) - #define HB_WIN_LEGACY_LEVEL_OFF -#endif - -#if ! defined( HB_WIN_LEGACY_LEVEL_OFF ) +#if defined( HB_OS_WIN ) HB_FUNC_EXTERN( WIN_REGQUERY ) ; HB_FUNC( QUERYREGISTRY ) { HB_FUNC_EXEC( WIN_REGQUERY ); } HB_FUNC_EXTERN( WIN_REGGET ) ; HB_FUNC( GETREGISTRY ) { HB_FUNC_EXEC( WIN_REGGET ); } HB_FUNC_EXTERN( WIN_REGSET ) ; HB_FUNC( SETREGISTRY ) { HB_FUNC_EXEC( WIN_REGSET ); } +#else + +HB_FUNC( QUERYREGISTRY ) { hb_retl( HB_FALSE ); } +HB_FUNC( GETREGISTRY ) { hb_ret(); } +HB_FUNC( SETREGISTRY ) { hb_retl( HB_FALSE ); } + #endif diff --git a/harbour/contrib/hbwin/legacycv.c b/harbour/contrib/xhb/xwin_ver.c similarity index 77% rename from harbour/contrib/hbwin/legacycv.c rename to harbour/contrib/xhb/xwin_ver.c index 4be0b6821b..37bbcd19bd 100644 --- a/harbour/contrib/hbwin/legacycv.c +++ b/harbour/contrib/xhb/xwin_ver.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * Compatibility calls (Printer support). + * Compatibility calls (OS version support). * * Copyright 2009 Viktor Szakats (harbour.01 syenar.hu) * www - http://www.harbour-project.org @@ -52,18 +52,16 @@ #include "hbapi.h" -#if ! defined( HB_LEGACY_LEVEL3 ) && ! defined( HB_WIN_LEGACY_LEVEL_OFF ) - #define HB_WIN_LEGACY_LEVEL_OFF -#endif - -#if ! defined( HB_WIN_LEGACY_LEVEL_OFF ) +#if defined( HB_OS_WIN ) +HB_FUNC_EXTERN( WIN_OSVERSIONINFO ) ; HB_FUNC( OS_VERSIONINFO ) { HB_FUNC_EXEC( WIN_OSVERSIONINFO ); } HB_FUNC_EXTERN( WIN_OSISNT ) ; HB_FUNC( OS_ISWINNT ) { HB_FUNC_EXEC( WIN_OSISNT ); } HB_FUNC_EXTERN( WIN_OSISNT351 ) ; HB_FUNC( OS_ISWINNT351 ) { HB_FUNC_EXEC( WIN_OSISNT351 ); } HB_FUNC_EXTERN( WIN_OSISNT4 ) ; HB_FUNC( OS_ISWINNT4 ) { HB_FUNC_EXEC( WIN_OSISNT4 ); } HB_FUNC_EXTERN( WIN_OSIS2000ORUPPER ) ; HB_FUNC( OS_ISWIN2000_OR_LATER ) { HB_FUNC_EXEC( WIN_OSIS2000ORUPPER ); } HB_FUNC_EXTERN( WIN_OSIS2000 ) ; HB_FUNC( OS_ISWIN2000 ) { HB_FUNC_EXEC( WIN_OSIS2000 ); } HB_FUNC_EXTERN( WIN_OSISXP ) ; HB_FUNC( OS_ISWINXP ) { HB_FUNC_EXEC( WIN_OSISXP ); } +HB_FUNC_EXTERN( WIN_OSISWINXPORUPPER ) ; HB_FUNC( OS_ISWINXP_OR_LATER ) { HB_FUNC_EXEC( WIN_OSISWINXPORUPPER ); } HB_FUNC_EXTERN( WIN_OSIS2003 ) ; HB_FUNC( OS_ISWIN2003 ) { HB_FUNC_EXEC( WIN_OSIS2003 ); } HB_FUNC_EXTERN( WIN_OSISVISTA ) ; HB_FUNC( OS_ISWINVISTA ) { HB_FUNC_EXEC( WIN_OSISVISTA ); } HB_FUNC_EXTERN( WIN_OSISVISTAORUPPER ) ; HB_FUNC( OS_ISWINVISTA_OR_LATER ) { HB_FUNC_EXEC( WIN_OSISVISTAORUPPER ); } @@ -73,8 +71,29 @@ HB_FUNC_EXTERN( WIN_OSIS95 ) ; HB_FUNC( OS_ISWIN95 ) { HB_ HB_FUNC_EXTERN( WIN_OSIS98 ) ; HB_FUNC( OS_ISWIN98 ) { HB_FUNC_EXEC( WIN_OSIS98 ); } HB_FUNC_EXTERN( WIN_OSISME ) ; HB_FUNC( OS_ISWINME ) { HB_FUNC_EXEC( WIN_OSISME ); } HB_FUNC_EXTERN( WIN_OSISTSCLIENT ) ; HB_FUNC( OS_ISWTSCLIENT ) { HB_FUNC_EXEC( WIN_OSISTSCLIENT ); } -HB_FUNC_EXTERN( WIN_OSVERSIONINFO ) ; HB_FUNC( OS_VERSIONINFO ) { HB_FUNC_EXEC( WIN_OSVERSIONINFO ); } HB_FUNC_EXTERN( WIN_OSNETREGOK ) ; HB_FUNC( OS_NETREGOK ) { HB_FUNC_EXEC( WIN_OSNETREGOK ); } HB_FUNC_EXTERN( WIN_OSNETVREDIROK ) ; HB_FUNC( OS_NETVREDIROK ) { HB_FUNC_EXEC( WIN_OSNETVREDIROK ); } +#else + +HB_FUNC( OS_VERSIONINFO ) {} +HB_FUNC( OS_ISWINNT ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWINNT351 ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWINNT4 ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWIN2000_OR_LATER ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWIN2000 ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWINXP ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWINXP_OR_LATER ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWIN2003 ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWINVISTA ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWINVISTA_OR_LATER ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWIN7 ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWIN9X ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWIN95 ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWIN98 ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWINME ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_ISWTSCLIENT ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_NETREGOK ) { hb_retl( HB_FALSE ); } +HB_FUNC( OS_NETVREDIROK ) { hb_retl( HB_FALSE ); } + #endif