2010-03-08 00:09 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* include/hbapi.h
  * src/common/hbver.c
    + Added hb_iswin2k() low-level function to detect
      if running under Windows 2000 or newer.

  * include/hbextern.ch
  * src/rtl/version.c
    + Added HB_OSISWIN2K() .prg level function.

  * src/rtl/gtwin/gtwin.c
  * src/rtl/gtwvt/gtwvt.c
  * contrib/gtwvg/gtwvg.c
  * contrib/gtwvg/wvggui.c
  * examples/gtwvw/gtwvw.c
  * contrib/hbwin/win_prn2.c
  * contrib/hbwin/win_prn3.c
    % Changed to use hb_iswin*() API instead of implementing
      version detection locally.

  * contrib/hbmysql/mysql.c
  * contrib/hbpgsql/postgres.c
    + Added my partial copyright.

  * contrib/hbpgsql/tests/tstpgrdd.prg
    * Formatting.

  * contrib/hbpgsql/postgres.c
    ! Fixed to define all .prg level functions regardless
      of pgsql lib it's built against. They return
      permanent failure in this case.
    ! Fixed PQCREATETRACE() to return NULL pointer instead
      of NIL for static builds.
    ! PQFREECANCEL() marked with HB_LEGACY_LEVEL3.

  * contrib/hbwin/win_os.prg
    + Using HB_OSISWIN2K() core API.

  * contrib/hbide/ideprojmanager.prg
    * Minor alignment.
This commit is contained in:
Viktor Szakats
2010-03-07 23:11:09 +00:00
parent 93d5b9b090
commit feb9517ee2
17 changed files with 108 additions and 50 deletions

View File

@@ -17,6 +17,47 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-03-08 00:09 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* include/hbapi.h
* src/common/hbver.c
+ Added hb_iswin2k() low-level function to detect
if running under Windows 2000 or newer.
* include/hbextern.ch
* src/rtl/version.c
+ Added HB_OSISWIN2K() .prg level function.
* src/rtl/gtwin/gtwin.c
* src/rtl/gtwvt/gtwvt.c
* contrib/gtwvg/gtwvg.c
* contrib/gtwvg/wvggui.c
* examples/gtwvw/gtwvw.c
* contrib/hbwin/win_prn2.c
* contrib/hbwin/win_prn3.c
% Changed to use hb_iswin*() API instead of implementing
version detection locally.
* contrib/hbmysql/mysql.c
* contrib/hbpgsql/postgres.c
+ Added my partial copyright.
* contrib/hbpgsql/tests/tstpgrdd.prg
* Formatting.
* contrib/hbpgsql/postgres.c
! Fixed to define all .prg level functions regardless
of pgsql lib it's built against. They return
permanent failure in this case.
! Fixed PQCREATETRACE() to return NULL pointer instead
of NIL for static builds.
! PQFREECANCEL() marked with HB_LEGACY_LEVEL3.
* contrib/hbwin/win_os.prg
+ Using HB_OSISWIN2K() core API.
* contrib/hbide/ideprojmanager.prg
* Minor alignment.
2010-03-07 20:31 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbpgsql/tests/tstpgrdd.prg
* contrib/hbpgsql/tests/async.prg

View File

@@ -319,10 +319,6 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT )
static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
{
PHB_GTWVT pWVT;
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
GetVersionEx( &osvi );
pWVT = ( PHB_GTWVT ) hb_xgrab( sizeof( HB_GTWVT ) );
memset( pWVT, 0, sizeof( HB_GTWVT ) );
@@ -384,7 +380,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
pWVT->boxCodePage = OEM_CHARSET; /* GetACP(); - set code page to default system */
#endif
pWVT->Win9X = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS );
pWVT->Win9X = hb_iswin9x();
pWVT->AltF4Close = HB_FALSE;
pWVT->IgnoreWM_SYSCHAR = HB_FALSE;

View File

@@ -226,10 +226,6 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT )
static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
{
PHB_GTWVT pWVT;
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
GetVersionEx( &osvi );
pWVT = ( PHB_GTWVT ) hb_xgrab( sizeof( HB_GTWVT ) );
memset( pWVT, 0, sizeof( HB_GTWVT ) );
@@ -267,7 +263,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
pWVT->CentreWindow = HB_TRUE; /* Default is to always display window in centre of screen */
pWVT->CodePage = OEM_CHARSET; /* GetACP(); - set code page to default system */
pWVT->Win9X = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS );
pWVT->Win9X = hb_iswin9x();
pWVT->IgnoreWM_SYSCHAR = HB_FALSE;

View File

@@ -137,7 +137,7 @@ CLASS IdeProject
DATA hSources INIT {=>}
DATA hPaths INIT {=>}
DATA lPathAbs INIT .F. // Lets try relative paths first . xhp and hbp will be relative anyway
DATA projPath INIT ""
DATA projPath INIT ""
METHOD new( oIDE, aProps )

View File

@@ -6,6 +6,7 @@
* Harbour Project source code:
* MySQL DBMS low level (client api) interface code.
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) (GC support)
* Copyright 2000 Maurilio Longo <maurilio.longo@libero.it>
* www - http://www.harbour-project.org
*

View File

@@ -6,6 +6,7 @@
* Harbour Project source code:
* PostgreSQL RDBMS low level (client api) interface code.
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) (GC support)
* Copyright 2003 Rodrigo Moreno rodrigo_moreno@yahoo.com
* www - http://www.harbour-project.org
*
@@ -1037,6 +1038,8 @@ HB_FUNC( PQCREATETRACE )
{
#ifdef NODLL
hb_FILE_ret( fopen( hb_parcx( 1 ), "w+b" ) );
#else
hb_retptr( NULL );
#endif
}
@@ -1133,30 +1136,37 @@ HB_FUNC( LO_UNLINK )
hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
#if HB_PGVERSION >= 0x0800
HB_FUNC( PQSERVERVERSION )
{
#if HB_PGVERSION >= 0x0800
PGconn * conn = hb_PGconn_par( 1 );
if( conn )
hb_retni( PQserverVersion( conn ) );
else
hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
#else
hb_retni( 0 );
#endif
}
HB_FUNC( PQGETCANCEL )
{
#if HB_PGVERSION >= 0x0800
PGconn * conn = hb_PGconn_par( 1 );
if( conn )
hb_PGcancel_ret( PQgetCancel( conn ) );
else
hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
#else
hb_retptr( NULL );
#endif
}
HB_FUNC( PQCANCEL )
{
#if HB_PGVERSION >= 0x0800
PGcancel * cancel = hb_PGcancel_par( 1 );
if( cancel )
@@ -1171,11 +1181,18 @@ HB_FUNC( PQCANCEL )
}
else
hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
#else
hb_retl( HB_FALSE );
hb_storc( NULL, 2 );
#endif
}
#if defined( HB_LEGACY_LEVEL3 )
/* NOTE: Deprecated */
HB_FUNC( PQFREECANCEL )
{
#if HB_PGVERSION >= 0x0800
void ** ph = ( void ** ) hb_parptrGC( &s_gcPGcancelFuncs, 1 );
/* Check if pointer is not NULL to avoid multiple freeing */
@@ -1187,10 +1204,14 @@ HB_FUNC( PQFREECANCEL )
/* set pointer to NULL to avoid multiple freeing */
* ph = NULL;
}
#endif
}
#endif
HB_FUNC( PQESCAPEBYTEACONN )
{
#if HB_PGVERSION >= 0x0800
PGconn * conn = hb_PGconn_par( 1 );
if( conn && HB_ISCHAR( 2 ) )
@@ -1205,9 +1226,10 @@ HB_FUNC( PQESCAPEBYTEACONN )
}
else
hb_errRT_BASE( EG_ARG, 2020, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
#else
hb_retc_null();
#endif
}
/*

View File

@@ -11,7 +11,7 @@
PROCEDURE Main()
LOCAL NCONN
LOCAL nConn
SET DELETED ON

View File

@@ -106,7 +106,7 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt )
IF win_osIs2000OrUpper()
IF hb_osIsWin2K()
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt )
ENDIF
ENDIF

View File

@@ -119,14 +119,10 @@ static void hb_GetDefaultPrinter( PHB_ITEM pPrinterName )
{
#if ! defined( HB_OS_WIN_CE )
HB_BOOL bResult = HB_FALSE;
OSVERSIONINFO osvi;
hb_itemPutC( pPrinterName, NULL );
osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
GetVersionEx( &osvi );
if( osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 ) /* Windows 2000 or later */
if( hb_iswin2k() ) /* Windows 2000 or later */
{
typedef BOOL( WINAPI * DEFPRINTER ) ( LPTSTR, LPDWORD );
DEFPRINTER fnGetDefaultPrinter;

View File

@@ -104,7 +104,7 @@ static HB_BOOL hb_SetDefaultPrinter( LPCTSTR lpPrinterName )
GetVersionEx( &osv );
/* If Windows 95 or 98, use SetPrinter. */
if( osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
if( hb_iswin9x() )
{
/* Open this printer so you can get information about it. */
bFlag = OpenPrinter( ( LPTSTR ) lpPrinterName, &hPrinter, NULL );

View File

@@ -1576,8 +1576,6 @@ static void gt_wNtTone( double dFreq, double dDurat )
/* */
static void hb_gt_wvw_Tone( PHB_GT pGT, double dFrequency, double dDuration )
{
OSVERSIONINFO osv;
HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvw_Tone(%lf, %lf)", dFrequency, dDuration));
HB_SYMBOL_UNUSED( pGT );
@@ -1592,14 +1590,9 @@ static void hb_gt_wvw_Tone( PHB_GT pGT, double dFrequency, double dDuration )
/* keep the frequency in an acceptable range */
dFrequency = HB_MIN( HB_MAX( 0.0, dFrequency ), 32767.0 );
/* What version of Windows are you running? */
osv.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
GetVersionEx( &osv );
/* If Windows 95 or 98, use w9xTone for BCC32, MSVC */
if ( osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
if( hb_iswin9x() )
{
#if defined( __BORLANDC__ ) || defined( _MSC_VER ) || defined( __WATCOMC__ ) || defined(__MINGW32__)
gt_w9xTone( dFrequency, dDuration );
#else
@@ -1609,9 +1602,9 @@ static void hb_gt_wvw_Tone( PHB_GT pGT, double dFrequency, double dDuration )
/* If Windows NT or NT2k, use wNtTone, which provides TONE()
reset sequence support (new) */
else if ( osv.dwPlatformId == VER_PLATFORM_WIN32_NT )
else if( hb_iswinnt() )
{
gt_wNtTone( dFrequency, dDuration );
gt_wNtTone( dFrequency, dDuration );
}
}

View File

@@ -1133,8 +1133,9 @@ extern HB_EXPORT const char * hb_verHB_PLAT( void ); /* retrieves a stat
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 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_iswinnt( void ); /* return HB_TRUE if OS == Windows NT or newer */
extern HB_EXPORT HB_BOOL hb_iswin2k( void ); /* return HB_TRUE if OS == Windows 2000 or newer */
extern HB_EXPORT HB_BOOL hb_iswinvista( void ); /* return HB_TRUE if OS == Windows Vista 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 );

View File

@@ -948,6 +948,7 @@ EXTERNAL HB_MILLISECONDS
EXTERNAL HB_CURDRIVE
EXTERNAL HB_OSNEWLINE
EXTERNAL HB_OSISWINNT
EXTERNAL HB_OSISWIN2K
EXTERNAL HB_OSISWINVISTA
EXTERNAL HB_OSISWINCE
EXTERNAL HB_APARAMS

View File

@@ -400,6 +400,7 @@ char * hb_verPlatform( void )
static HB_BOOL s_fWinVerInit = HB_FALSE;
static HB_BOOL s_fWinVista = HB_FALSE;
static HB_BOOL s_fWin2K = HB_FALSE;
static HB_BOOL s_fWinNT = HB_FALSE;
static HB_BOOL s_fWin9x = HB_FALSE;
@@ -411,6 +412,7 @@ static void s_hb_winVerInit( void )
if( GetVersionEx( &osvi ) )
{
s_fWinVista = osvi.dwMajorVersion >= 6;
s_fWin2K = osvi.dwMajorVersion >= 5;
s_fWinNT = osvi.dwPlatformId == VER_PLATFORM_WIN32_NT; /* && osvi.dwMajorVersion >= 4); */
s_fWin9x = osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS;
}
@@ -429,6 +431,17 @@ HB_BOOL hb_iswinvista( void )
#endif
}
HB_BOOL hb_iswin2k( void )
{
#if defined( HB_OS_WIN )
if( ! s_fWinVerInit )
s_hb_winVerInit();
return s_fWin2K;
#else
return HB_FALSE;
#endif
}
HB_BOOL hb_iswinnt( void )
{
#if defined( HB_OS_WIN )

View File

@@ -209,8 +209,6 @@ static int s_mouseLast; /* Last mouse button to be pressed
static int s_mouse_iCol;
static int s_mouse_iRow;
static OSVERSIONINFO s_osv;
typedef struct _CLIPKEYCODE
{
int key;
@@ -808,9 +806,7 @@ static void hb_gt_win_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
{
HB_TRACE(HB_TR_DEBUG, ("hb_gt_win_Init(%p,%p,%p,%p)", pGT, ( void * ) ( HB_PTRDIFF ) hFilenoStdin, ( void * ) ( HB_PTRDIFF ) hFilenoStdout, ( void * ) ( HB_PTRDIFF ) hFilenoStderr));
s_osv.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
GetVersionEx( &s_osv );
if( s_osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
if( hb_iswin9x() )
s_dwAltGrBits = RIGHT_ALT_PRESSED;
else
s_dwAltGrBits = LEFT_CTRL_PRESSED | RIGHT_ALT_PRESSED;
@@ -1478,9 +1474,9 @@ static int hb_gt_win_ReadKey( PHB_GT pGT, int iEventMask )
if( s_bSpecialKeyHandling &&
( dwState & CAPSLOCK_ON ) &&
s_osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
hb_iswin9x() )
{
ch = SpecialHandling( &wChar, wKey, ch, (dwState & SHIFT_PRESSED) );
ch = SpecialHandling( &wChar, wKey, ch, ( dwState & SHIFT_PRESSED ) );
}
if( s_wRepeated == 0 )

View File

@@ -132,9 +132,10 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara
static void hb_gt_wvt_RegisterClass( HINSTANCE hInstance )
{
WNDCLASS wndclass;
WNDCLASSEX wndclass;
memset( &wndclass, 0, sizeof( WNDCLASS ) );
memset( &wndclass, 0, sizeof( WNDCLASSEX ) );
wndclass.cbSize = sizeof( WNDCLASSEX );
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wndclass.lpfnWndProc = hb_gt_wvt_WndProc;
/* wndclass.cbClsExtra = 0; */
@@ -146,7 +147,7 @@ static void hb_gt_wvt_RegisterClass( HINSTANCE hInstance )
/* wndclass.lpszMenuName = NULL; */
wndclass.lpszClassName = s_szClassName;
if( ! RegisterClass( &wndclass ) )
if( ! RegisterClassEx( &wndclass ) )
{
if( GetLastError() != 1410 )
hb_errInternal( 10001, "Failed to register WVT window class", NULL, NULL );
@@ -251,10 +252,6 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT )
static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
{
PHB_GTWVT pWVT;
OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
GetVersionEx( &osvi );
pWVT = ( PHB_GTWVT ) hb_xgrab( sizeof( HB_GTWVT ) );
memset( pWVT, 0, sizeof( HB_GTWVT ) );
@@ -319,7 +316,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow )
pWVT->boxCodePage = OEM_CHARSET; /* GetACP(); - set code page to default system */
#endif
pWVT->Win9X = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS );
pWVT->Win9X = hb_iswin9x();
pWVT->AltF4Close = HB_FALSE;
pWVT->IgnoreWM_SYSCHAR = HB_FALSE;

View File

@@ -196,6 +196,11 @@ HB_FUNC( HB_OSISWINNT )
hb_retl( hb_iswinnt() );
}
HB_FUNC( HB_OSISWIN2K )
{
hb_retl( hb_iswin2k() );
}
HB_FUNC( HB_OSISWINVISTA )
{
hb_retl( hb_iswinvista() );