2009-12-06 03:09 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbtpathy/tpunix.c
    + Cleaned definition of CRTSCTS macro, if not defined.
      Based on info sent to dev list by Przemek, plus Darwin value
      added after checking my system.
    + Added TODO warning and dummy return value if CRTSCTS
      cannot is unknown for target platform.
    ; Please review me.

  * contrib/hbwin/win_os.prg
  * contrib/hbwin/win_osc.c
  * contrib/hbwin/legacycv.c
    + Added WIN_OSISVISTAORUPPER().
    + Added xhb compatibility functions OS_ISWINVISTA_OR_LATER()
    + WIN_OSNETREGOK() extended to turn of SMB2 on Vista and upper systems.
    ! Fixed WIN_OSNETREGOK() to only attempt to change HKLM registry settings
      if run under admin account (on NT systems). This also fixes a typo
      in current xhb implementation.
    ; Adaptation of xhb addition by Peter Rees.

  * contrib/hbwin/win_regc.c
    + Added NOTE about minor xhb incompatibility in registry hive numbers.
      (default/zero is HKCU in Harbour, HKLM in xhb)

  * contrib/hbide/ideparseexpr.c
    * Cleaned int/size type usage.
    * Formatting.
    * Variables name cleanups.
This commit is contained in:
Viktor Szakats
2009-12-06 02:10:39 +00:00
parent 9e275b0446
commit c83dbe83c5
7 changed files with 178 additions and 122 deletions

View File

@@ -17,6 +17,35 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-12-06 03:09 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbtpathy/tpunix.c
+ Cleaned definition of CRTSCTS macro, if not defined.
Based on info sent to dev list by Przemek, plus Darwin value
added after checking my system.
+ Added TODO warning and dummy return value if CRTSCTS
cannot is unknown for target platform.
; Please review me.
* contrib/hbwin/win_os.prg
* contrib/hbwin/win_osc.c
* contrib/hbwin/legacycv.c
+ Added WIN_OSISVISTAORUPPER().
+ Added xhb compatibility functions OS_ISWINVISTA_OR_LATER()
+ WIN_OSNETREGOK() extended to turn of SMB2 on Vista and upper systems.
! Fixed WIN_OSNETREGOK() to only attempt to change HKLM registry settings
if run under admin account (on NT systems). This also fixes a typo
in current xhb implementation.
; Adaptation of xhb addition by Peter Rees.
* contrib/hbwin/win_regc.c
+ Added NOTE about minor xhb incompatibility in registry hive numbers.
(default/zero is HKCU in Harbour, HKLM in xhb)
* contrib/hbide/ideparseexpr.c
* Cleaned int/size type usage.
* Formatting.
* Variables name cleanups.
2009-12-05 13:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbide/hbide.prg
! Build <Project Tree> from opened projects.

View File

@@ -71,27 +71,15 @@
/*----------------------------------------------------------------------*/
#define MAX_LINE_LEN 2047
static const char s_good[] = "''_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890.";
static const char * s_adouble[] = { "*/", "/*", "//", "->", "::", "||", "++", "--", "**", ":=",
"<=", ">=", "<>", "!=", "==", "+=", "-=", "*=", "/=", "%=",
"^=", "&&", "^^", ">>", "<<", "=>", "&=", "|=" };
static int s_lengood = HB_SIZEOFARRAY( s_good ) - 1;
static int s_lendouble = HB_SIZEOFARRAY( s_adouble );
/*----------------------------------------------------------------------*/
static HB_SIZE linearfind( const char ** array, const char * cText, HB_SIZE lenarray, HB_SIZE lentext, HB_BOOL bMatchCase )
static int linearfind( const char ** array, const char * pszText, int lenarray, int lentext, HB_BOOL bMatchCase )
{
HB_SIZE i;
int i;
if( bMatchCase )
{
for( i = 0; i < lenarray; i++ )
{
if( strncmp( cText, array[ i ], lentext + 1 ) == 0 )
if( strncmp( pszText, array[ i ], lentext + 1 ) == 0 )
return i + 1;
}
}
@@ -99,7 +87,7 @@ static HB_SIZE linearfind( const char ** array, const char * cText, HB_SIZE lena
{
for( i = 0; i < lenarray; i++ )
{
if( hb_strnicmp( cText, array[ i ], lentext + 1 ) == 0 )
if( hb_strnicmp( pszText, array[ i ], lentext + 1 ) == 0 )
return i + 1;
}
@@ -109,13 +97,13 @@ static HB_SIZE linearfind( const char ** array, const char * cText, HB_SIZE lena
/*----------------------------------------------------------------------*/
static HB_BOOL strempty( const char * string )
static HB_BOOL strempty( const char * pszString )
{
HB_SIZE i = 0;
int i = 0;
while( string[ i ] != 0 )
while( pszString[ i ] != 0 )
{
if( string[ i++ ] != ' ' )
if( pszString[ i++ ] != ' ' )
return HB_FALSE;
}
@@ -124,16 +112,16 @@ static HB_BOOL strempty( const char * string )
/*----------------------------------------------------------------------*/
static HB_SIZE atbuff( const char * chars, const char * string, HB_SIZE StartFrom, HB_SIZE Target, HB_SIZE len_chars, HB_SIZE len )
static int atbuff( const char * pszChars, const char * pszString, int StartFrom, int Target, int len_chars, int len )
{
if( len >= len_chars && StartFrom <= len - len_chars )
{
HB_SIZE x;
HB_SIZE Counter = 0;
int x;
int Counter = 0;
for( x = StartFrom; x <= ( len - len_chars ); x++ )
{
if( strncmp( string + x, chars, len_chars ) == 0 )
if( strncmp( pszString + x, pszChars, len_chars ) == 0 )
{
if( ++Counter == Target )
return x + 1;
@@ -146,27 +134,35 @@ static HB_SIZE atbuff( const char * chars, const char * string, HB_SIZE StartFro
/*----------------------------------------------------------------------*/
static int _GetWord( const char * cText, HB_BOOL lHonorSpacing, char * cWord, int * pnpos )
static int getword( const char * pszText, HB_BOOL bHonorSpacing, char * pszWord, int * pnpos )
{
int maxlen = strlen( cText );
static const char s_szGood[] = "''_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890.";
static const char * s_szDoubleList[] = { "*/", "/*", "//", "->", "::", "||", "++", "--", "**", ":=",
"<=", ">=", "<>", "!=", "==", "+=", "-=", "*=", "/=", "%=",
"^=", "&&", "^^", ">>", "<<", "=>", "&=", "|=" };
static int s_lengood = HB_SIZEOFARRAY( s_szGood ) - 1;
static int s_lendouble = HB_SIZEOFARRAY( s_szDoubleList );
int maxlen = strlen( pszText );
int npos = 0;
int wordlen = 0;
if( maxlen > 0 )
{
char temp;
char ch;
char csingle[ 2 ];
char cdouble[ 3 ];
char temp;
char ch;
char csingle[ 2 ];
char cdouble[ 3 ];
csingle[ 1 ] = '\0';
cdouble[ 2 ] = '\0';
ch = cText[ 0 ];
ch = pszText[ 0 ];
if( ch == ',' ) /* lists */
{
cWord[ wordlen++ ] = ch;
pszWord[ wordlen++ ] = ch;
npos++;
}
else /* literals */
@@ -174,57 +170,57 @@ static int _GetWord( const char * cText, HB_BOOL lHonorSpacing, char * cWord, in
if( ch == '"' || ch == '\'' )
{
temp = ch;
cWord[ wordlen++ ] = ch;
pszWord[ wordlen++ ] = ch;
npos++;
ch = ' ';
while( ( npos < maxlen ) && ( ch != temp ) )
while( npos < maxlen && ch != temp )
{
ch = cText[ npos ];
cWord[ wordlen++ ] = ch;
ch = pszText[ npos ];
pszWord[ wordlen++ ] = ch;
npos++;
}
}
else
{
csingle[0] = ch;
if( atbuff( csingle, s_good, 0, 1, 1, s_lengood ) ) /* ch $ s_good ) // variables, commands, function names */
csingle[ 0 ] = ch;
if( atbuff( csingle, s_szGood, 0, 1, 1, s_lengood ) ) /* ch $ s_szGood ) // variables, commands, function names */
{
while( ( npos < maxlen ) && atbuff( csingle, s_good, 0, 1, 1, s_lengood ) )
while( npos < maxlen && atbuff( csingle, s_szGood, 0, 1, 1, s_lengood ) )
{
cWord[ wordlen++ ] = ch;
pszWord[ wordlen++ ] = ch;
npos++;
ch = cText[ npos ];
ch = pszText[ npos ];
csingle[ 0 ] = ch;
}
}
else if( ch == ' ' )
{
while( ( npos < maxlen ) && ch == ' ' )
while( npos < maxlen && ch == ' ' )
{
cWord[ wordlen++ ] = ch;
pszWord[ wordlen++ ] = ch;
npos++;
ch = cText[ npos ];
ch = pszText[ npos ];
}
if( !lHonorSpacing )
if( !bHonorSpacing )
{
cWord[ 0 ] = ' '; /* reduce spaces to 1 */
pszWord[ 0 ] = ' '; /* reduce spaces to 1 */
wordlen = 1;
}
}
else /* operators, punctuation */
{
cWord[ wordlen++ ]= ch;
pszWord[ wordlen++ ]= ch;
npos++;
ch = cText[ npos ];
ch = pszText[ npos ];
if( maxlen > npos )
{
cdouble[ 0 ] = cWord[ 0 ];
cdouble[ 0 ] = pszWord[ 0 ];
cdouble[ 1 ] = ch;
if( linearfind( s_adouble, cdouble, s_lendouble, 2, HB_TRUE ) ) /* if( (cWord + ch) $ s_adouble) //aScan( s_adouble, cWord + ch ) > 0 */
if( linearfind( s_szDoubleList, cdouble, s_lendouble, 2, HB_TRUE ) ) /* if( (pszWord + ch) $ s_szDoubleList) //aScan( s_szDoubleList, pszWord + ch ) > 0 */
{
cWord[ wordlen++ ] = ch;
pszWord[ wordlen++ ] = ch;
npos++;
}
}
@@ -233,7 +229,7 @@ static int _GetWord( const char * cText, HB_BOOL lHonorSpacing, char * cWord, in
}
}
cWord[ wordlen ] = '\0';
pszWord[ wordlen ] = '\0';
*pnpos = npos;
return wordlen;
@@ -241,109 +237,107 @@ static int _GetWord( const char * cText, HB_BOOL lHonorSpacing, char * cWord, in
/*----------------------------------------------------------------------*/
/*
* ( c, lHonorSpacing, lInRemark, lUpperKeyWord, lKeepComments, lPRG, lKeepSpaces )
*/
HB_FUNC( PARSEXPR )
HB_FUNC( PARSEXPR ) /* ( c, bHonorSpacing, bInRemark, bUpperKeyWord, bKeepComments, bPRG, bKeepSpaces ) */
{
const char * c = hb_parcx( 1 );
HB_BOOL lHonorSpacing = hb_parl( 2 );
HB_BOOL lInRemark = HB_ISLOG( 3 ) ? hb_parl( 3 ) : HB_FALSE;
HB_BOOL lKeepComments = HB_ISLOG( 5 ) ? hb_parl( 5 ) : HB_TRUE;
const char * pszExpr = hb_parcx( 1 );
HB_BOOL bHonorSpacing = hb_parl( 2 );
HB_BOOL bInRemark = HB_ISLOG( 3 ) ? hb_parl( 3 ) : HB_FALSE;
HB_BOOL bKeepComments = HB_ISLOG( 5 ) ? hb_parl( 5 ) : HB_TRUE;
HB_BOOL bPRG = HB_ISLOG( 6 ) ? hb_parl( 6 ) : HB_TRUE;
HB_BOOL lKeepSpaces = HB_ISLOG( 7 ) ? hb_parl( 7 ) : HB_TRUE;
PHB_ITEM aExpr = hb_itemArrayNew( 0 );
PHB_ITEM element = hb_itemNew( NULL );
HB_BOOL lFirst = HB_TRUE;
HB_BOOL bKeepSpaces = HB_ISLOG( 7 ) ? hb_parl( 7 ) : HB_TRUE;
PHB_ITEM paExpr = hb_itemArrayNew( 0 );
PHB_ITEM pTemp = hb_itemNew( NULL );
HB_BOOL bFirst = HB_TRUE;
int lenprocessed = 0;
int lenwords = 0;
int wordlen;
int npos;
char NextWord[ MAX_LINE_LEN + 1 ];
char szNextWord[ 2048 ];
NextWord[ 0 ] = '\0';
szNextWord[ 0 ] = '\0';
while( ( wordlen = _GetWord( c, lHonorSpacing, NextWord, &lenprocessed ) ) != 0 )
while( ( wordlen = getword( pszExpr, bHonorSpacing, szNextWord, &lenprocessed ) ) != 0 )
{
c += lenprocessed;
pszExpr += lenprocessed;
if( strncmp( NextWord, "*/", 3 ) == 0 ) /* remark end */
if( strncmp( szNextWord, "*/", 3 ) == 0 ) /* remark end */
{
if( lKeepComments )
if( bKeepComments )
{
lenwords++;
hb_arrayAdd( aExpr, hb_itemPutC( element, NextWord ) );
hb_arrayAdd( paExpr, hb_itemPutC( pTemp, szNextWord ) );
}
lInRemark = HB_FALSE;
bInRemark = HB_FALSE;
}
else if( ( strncmp( NextWord, "/*", 3 ) == 0 ) || lInRemark ) /* remark start */
else if( ( strncmp( szNextWord, "/*", 3 ) == 0 ) || bInRemark ) /* remark start */
{
lInRemark = ( ( npos = atbuff( "*/", c, 0, 1, 2, strlen( c ) ) ) == 0 );
bInRemark = ( ( npos = atbuff( "*/", pszExpr, 0, 1, 2, strlen( pszExpr ) ) ) == 0 );
if( lInRemark )
if( bInRemark )
{
if( lKeepComments )
if( bKeepComments )
{
hb_strncat( NextWord, c, sizeof( NextWord ) - 1 );
hb_strncat( szNextWord, pszExpr, sizeof( szNextWord ) - 1 );
lenwords++;
hb_arrayAdd( aExpr, hb_itemPutC( element, NextWord ) );
hb_arrayAdd( paExpr, hb_itemPutC( pTemp, szNextWord ) );
}
break;
}
else
{
if( lKeepComments )
if( bKeepComments )
{
strncpy( NextWord + wordlen, c, npos + 1 );
NextWord[ wordlen + npos + 1 ] = '\0';
strncpy( szNextWord + wordlen, pszExpr, npos + 1 );
szNextWord[ wordlen + npos + 1 ] = '\0';
lenwords++;
hb_arrayAdd( aExpr, hb_itemPutC( element, NextWord ) );
hb_arrayAdd( paExpr, hb_itemPutC( pTemp, szNextWord ) );
}
c += ( npos + 1 );
pszExpr += npos + 1;
}
}
else if( strncmp( NextWord, "//", 3 ) == 0 || ( bPRG && strncmp( NextWord, "&&", 3 ) == 0 ) ) /* inline remark */
else if( strncmp( szNextWord, "//", 3 ) == 0 || ( bPRG && strncmp( szNextWord, "&&", 3 ) == 0 ) ) /* inline remark */
{
if( lKeepComments )
if( bKeepComments )
{
hb_strncat( NextWord, c, sizeof( NextWord ) - 1 );
hb_strncat( szNextWord, pszExpr, sizeof( szNextWord ) - 1 );
lenwords++;
hb_arrayAdd( aExpr, hb_itemPutC( element, NextWord ) );
hb_arrayAdd( paExpr, hb_itemPutC( pTemp, szNextWord ) );
}
break;
}
else if( strncmp( NextWord, "**", 3 ) == 0 && lFirst && bPRG )
else if( strncmp( szNextWord, "**", 3 ) == 0 && bFirst && bPRG )
{
if( lKeepComments )
if( bKeepComments )
{
hb_strncat( NextWord, c, sizeof( NextWord ) - 1 );
hb_strncat( szNextWord, pszExpr, sizeof( szNextWord ) - 1 );
lenwords++;
hb_arrayAdd( aExpr, hb_itemPutC( element, NextWord ) );
hb_arrayAdd( paExpr, hb_itemPutC( pTemp, szNextWord ) );
}
break;
}
else
{
if( lKeepSpaces || ! strempty( NextWord ) )
if( bKeepSpaces || ! strempty( szNextWord ) )
{
lenwords++;
hb_arrayAdd( aExpr, hb_itemPutC( element, NextWord ) );
hb_arrayAdd( paExpr, hb_itemPutC( pTemp, szNextWord ) );
}
}
if( ! strempty( NextWord ) )
lFirst = HB_FALSE;
if( ! strempty( szNextWord ) )
bFirst = HB_FALSE;
}
if( ! lKeepComments && !( lenwords > 0 ) && hb_arrayGetCPtr( aExpr, lenwords ) )
hb_arraySize( aExpr, lenwords );
if( ! bKeepComments && !( lenwords > 0 ) && hb_arrayGetCPtr( paExpr, lenwords ) )
hb_arraySize( paExpr, lenwords );
hb_storl( lInRemark, 3 );
hb_storl( bInRemark, 3 );
hb_itemRelease( element );
hb_itemReturnRelease( aExpr );
hb_itemRelease( pTemp );
hb_itemReturnRelease( paExpr );
}
/*----------------------------------------------------------------------*/

View File

@@ -267,11 +267,22 @@ HB_FUNC( __TP_ISCTS )
hb_retl( FALSE );
}
#if ! defined( CRTSCTS )
#if defined( HB_OS_LINUX ) ||
defined( HB_OS_SUNOS )
#define CRTSCTS 0x80000000
#elif defined( HB_OS_BSD )
#define CRTSCTS 0x00010000
#elif defined( HB_OS_BEOS )
#define CRTSCTS 0x00006000
#elif defined( HB_OS_DARWIN )
#define CRTSCTS 0x00030000
#endif
#endif
HB_FUNC( __TP_CTRLCTS )
{
#if !defined( CRTSCTS )
# define CRTSCTS 020000000000
#endif
#if defined( CRTSCTS )
struct termios options;
int port = hb_parnl( 1 );
int newvalue = hb_pcount() == 2 ? hb_parnl( 2 ) : -1;
@@ -290,6 +301,10 @@ HB_FUNC( __TP_CTRLCTS )
rc = tcsetattr( port, TCSAFLUSH, &options );
hb_retni( curvalue ? 1 : 0 );
#else
int iTODO;
hb_retni( 0 );
#endif
}
#if 0

View File

@@ -58,22 +58,23 @@
#if ! defined( HB_WIN_LEGACY_LEVEL_OFF )
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_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_OSIS7 ) ; HB_FUNC( OS_ISWIN7 ) { HB_FUNC_EXEC( WIN_OSIS7 ); }
HB_FUNC_EXTERN( WIN_OSIS9X ) ; HB_FUNC( OS_ISWIN9X ) { HB_FUNC_EXEC( WIN_OSIS9X ); }
HB_FUNC_EXTERN( WIN_OSIS95 ) ; HB_FUNC( OS_ISWIN95 ) { HB_FUNC_EXEC( WIN_OSIS95 ); }
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 ); }
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_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 ); }
HB_FUNC_EXTERN( WIN_OSIS7 ) ; HB_FUNC( OS_ISWIN7 ) { HB_FUNC_EXEC( WIN_OSIS7 ); }
HB_FUNC_EXTERN( WIN_OSIS9X ) ; HB_FUNC( OS_ISWIN9X ) { HB_FUNC_EXEC( WIN_OSIS9X ); }
HB_FUNC_EXTERN( WIN_OSIS95 ) ; HB_FUNC( OS_ISWIN95 ) { HB_FUNC_EXEC( WIN_OSIS95 ); }
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 ); }
#endif

View File

@@ -76,14 +76,18 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )
DEFAULT lSetIt TO .F.
DEFAULT lDoVista TO .T.
IF ! lDoVista .AND. ( win_osIsVista() .OR. win_osIs7() )
*
IF ! lDoVista .AND. win_osIsVistaOrUpper()
/* do nothing */
ELSEIF win_osIs9X()
rVal := QueryRegistry( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt )
ELSE
cKeySrv := "System\CurrentControlSet\Services\LanmanServer\Parameters"
cKeyWks := "System\CurrentControlSet\Services\LanmanWorkStation\Parameters"
IF lSetIt
lSetIt := ! win_osIsNT() .OR. wapi_IsUserAnAdmin()
ENDIF
/* Server settings */
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt )
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */
@@ -91,6 +95,11 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt )
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt )
IF win_osIsVistaOrUpper()
/* If SMB2 is enabled turning off oplocks does not work, so SMB2 is required to be turned off on Server. */
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "SMB2", 0, lSetIt )
ENDIF
/* Workstation settings */
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt )
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt )

View File

@@ -119,6 +119,13 @@ HB_FUNC( WIN_OSISVISTA )
hb_retl( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 );
}
HB_FUNC( WIN_OSISVISTAORUPPER )
{
OSVERSIONINFO osvi;
getwinver( &osvi );
hb_retl( osvi.dwMajorVersion >= 6 );
}
HB_FUNC( WIN_OSIS7 )
{
OSVERSIONINFO osvi;

View File

@@ -63,6 +63,7 @@ static HKEY hb_regkeyconv( HB_PTRUINT nKey )
{
case 1:
return ( HKEY ) HKEY_CLASSES_ROOT;
/* NOTE: In xhb, zero value means HKEY_LOCAL_MACHINE. */
case 0:
case 2:
return ( HKEY ) HKEY_CURRENT_USER;