2009-12-06 03:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/Makefile
* contrib/hbwin/win_reg.prg
+ contrib/hbwin/legacycr.c
+ Renamed three registry functions to reside in WIN_ namespace:
win_regSet() <= SetRegistry()
win_regGet() <= GetRegistry()
win_regQuery() <= QueryRegistry()
; Old names are still available.
; TODO: Move legacy Windows function names to xhb lib.
This has the advantage that they can stay there
forever.
* contrib/hbwin/win_os.prg
* Changed to use new function names.
* Variable name cleanup.
% WIN_OSNETVREDIROK() optimized/simplified.
* contrib/hbide/ideparseexpr.c
* Final renaming cleanup.
* contrib/hbide/hbide.prg
+ Changed to use HB_MEMOWRIT() instead of MEMOWRIT() to avoid
legacy EOF char.
This commit is contained in:
@@ -17,6 +17,32 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-12-06 03:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/Makefile
|
||||
* contrib/hbwin/win_reg.prg
|
||||
+ contrib/hbwin/legacycr.c
|
||||
+ Renamed three registry functions to reside in WIN_ namespace:
|
||||
win_regSet() <= SetRegistry()
|
||||
win_regGet() <= GetRegistry()
|
||||
win_regQuery() <= QueryRegistry()
|
||||
; Old names are still available.
|
||||
|
||||
; TODO: Move legacy Windows function names to xhb lib.
|
||||
This has the advantage that they can stay there
|
||||
forever.
|
||||
|
||||
* contrib/hbwin/win_os.prg
|
||||
* Changed to use new function names.
|
||||
* Variable name cleanup.
|
||||
% WIN_OSNETVREDIROK() optimized/simplified.
|
||||
|
||||
* contrib/hbide/ideparseexpr.c
|
||||
* Final renaming cleanup.
|
||||
|
||||
* contrib/hbide/hbide.prg
|
||||
+ Changed to use HB_MEMOWRIT() instead of MEMOWRIT() to avoid
|
||||
legacy EOF char.
|
||||
|
||||
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.
|
||||
|
||||
@@ -802,7 +802,7 @@ METHOD HbIde:saveSource( nTab, lConfirm )
|
||||
|
||||
IF lSave
|
||||
cBuffer := ::aTabs[ nTab, 2 ]:toPlainText()
|
||||
memowrit( ::aTabs[ nTab, 5 ], cBuffer )
|
||||
hb_memowrit( ::aTabs[ nTab, 5 ], cBuffer )
|
||||
qDocument:setModified( .f. )
|
||||
::createTags()
|
||||
::updateFuncList()
|
||||
@@ -1663,7 +1663,7 @@ METHOD HbIde:saveProject()
|
||||
".hbi"
|
||||
|
||||
CreateTarget( ::cSaveTo, txt_ )
|
||||
MemoWrit( hb_dirBase() + "hbide.env", o_[ E_oPrjCmp ]:toPlainText() )
|
||||
hb_MemoWrit( hb_dirBase() + "hbide.env", o_[ E_oPrjCmp ]:toPlainText() )
|
||||
|
||||
RETURN Nil
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static int linearfind( const char ** array, const char * pszText, int lenarray, int lentext, HB_BOOL bMatchCase )
|
||||
static int ide_linearfind( const char ** array, const char * pszText, int lenarray, int lentext, HB_BOOL bMatchCase )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -97,7 +97,7 @@ static int linearfind( const char ** array, const char * pszText, int lenarray,
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static HB_BOOL strempty( const char * pszString )
|
||||
static HB_BOOL ide_strempty( const char * pszString )
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -112,18 +112,18 @@ static HB_BOOL strempty( const char * pszString )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static int atbuff( const char * pszChars, const char * pszString, int StartFrom, int Target, int len_chars, int len )
|
||||
static int ide_atbuff( const char * pszChars, const char * pszString, int StartFrom, int Target, int len_chars, int len )
|
||||
{
|
||||
if( len >= len_chars && StartFrom <= len - len_chars )
|
||||
{
|
||||
int x;
|
||||
int Counter = 0;
|
||||
int counter = 0;
|
||||
|
||||
for( x = StartFrom; x <= ( len - len_chars ); x++ )
|
||||
{
|
||||
if( strncmp( pszString + x, pszChars, len_chars ) == 0 )
|
||||
{
|
||||
if( ++Counter == Target )
|
||||
if( ++counter == Target )
|
||||
return x + 1;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ static int atbuff( const char * pszChars, const char * pszString, int StartFrom,
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static int getword( const char * pszText, HB_BOOL bHonorSpacing, char * pszWord, int * pnpos )
|
||||
static int ide_getword( const char * pszText, HB_BOOL bHonorSpacing, char * pszWord, int * pnpos )
|
||||
{
|
||||
static const char s_szGood[] = "''_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890.";
|
||||
static const char * s_szDoubleList[] = { "*/", "/*", "//", "->", "::", "||", "++", "--", "**", ":=",
|
||||
@@ -152,11 +152,11 @@ static int getword( const char * pszText, HB_BOOL bHonorSpacing, char * pszWord,
|
||||
{
|
||||
char temp;
|
||||
char ch;
|
||||
char csingle[ 2 ];
|
||||
char cdouble[ 3 ];
|
||||
char szSingle[ 2 ];
|
||||
char szDouble[ 3 ];
|
||||
|
||||
csingle[ 1 ] = '\0';
|
||||
cdouble[ 2 ] = '\0';
|
||||
szSingle[ 1 ] = '\0';
|
||||
szDouble[ 2 ] = '\0';
|
||||
|
||||
ch = pszText[ 0 ];
|
||||
|
||||
@@ -182,17 +182,16 @@ static int getword( const char * pszText, HB_BOOL bHonorSpacing, char * pszWord,
|
||||
}
|
||||
else
|
||||
{
|
||||
csingle[ 0 ] = ch;
|
||||
if( atbuff( csingle, s_szGood, 0, 1, 1, s_lengood ) ) /* ch $ s_szGood ) // variables, commands, function names */
|
||||
szSingle[ 0 ] = ch;
|
||||
if( ide_atbuff( szSingle, s_szGood, 0, 1, 1, s_lengood ) ) /* ch $ s_szGood ) // variables, commands, function names */
|
||||
{
|
||||
while( npos < maxlen && atbuff( csingle, s_szGood, 0, 1, 1, s_lengood ) )
|
||||
while( npos < maxlen && ide_atbuff( szSingle, s_szGood, 0, 1, 1, s_lengood ) )
|
||||
{
|
||||
pszWord[ wordlen++ ] = ch;
|
||||
npos++;
|
||||
ch = pszText[ npos ];
|
||||
csingle[ 0 ] = ch;
|
||||
szSingle[ 0 ] = ch;
|
||||
}
|
||||
|
||||
}
|
||||
else if( ch == ' ' )
|
||||
{
|
||||
@@ -216,9 +215,9 @@ static int getword( const char * pszText, HB_BOOL bHonorSpacing, char * pszWord,
|
||||
ch = pszText[ npos ];
|
||||
if( maxlen > npos )
|
||||
{
|
||||
cdouble[ 0 ] = pszWord[ 0 ];
|
||||
cdouble[ 1 ] = ch;
|
||||
if( linearfind( s_szDoubleList, cdouble, s_lendouble, 2, HB_TRUE ) ) /* if( (pszWord + ch) $ s_szDoubleList) //aScan( s_szDoubleList, pszWord + ch ) > 0 */
|
||||
szDouble[ 0 ] = pszWord[ 0 ];
|
||||
szDouble[ 1 ] = ch;
|
||||
if( ide_linearfind( s_szDoubleList, szDouble, s_lendouble, 2, HB_TRUE ) ) /* if( (pszWord + ch) $ s_szDoubleList) //aScan( s_szDoubleList, pszWord + ch ) > 0 */
|
||||
{
|
||||
pszWord[ wordlen++ ] = ch;
|
||||
npos++;
|
||||
@@ -258,7 +257,7 @@ HB_FUNC( PARSEXPR ) /* ( c, bHonorSpacing, bInRemark, bUpperKeyWord, bKeepCommen
|
||||
|
||||
szNextWord[ 0 ] = '\0';
|
||||
|
||||
while( ( wordlen = getword( pszExpr, bHonorSpacing, szNextWord, &lenprocessed ) ) != 0 )
|
||||
while( ( wordlen = ide_getword( pszExpr, bHonorSpacing, szNextWord, &lenprocessed ) ) != 0 )
|
||||
{
|
||||
pszExpr += lenprocessed;
|
||||
|
||||
@@ -273,7 +272,7 @@ HB_FUNC( PARSEXPR ) /* ( c, bHonorSpacing, bInRemark, bUpperKeyWord, bKeepCommen
|
||||
}
|
||||
else if( ( strncmp( szNextWord, "/*", 3 ) == 0 ) || bInRemark ) /* remark start */
|
||||
{
|
||||
bInRemark = ( ( npos = atbuff( "*/", pszExpr, 0, 1, 2, strlen( pszExpr ) ) ) == 0 );
|
||||
bInRemark = ( ( npos = ide_atbuff( "*/", pszExpr, 0, 1, 2, strlen( pszExpr ) ) ) == 0 );
|
||||
|
||||
if( bInRemark )
|
||||
{
|
||||
@@ -290,6 +289,7 @@ HB_FUNC( PARSEXPR ) /* ( c, bHonorSpacing, bInRemark, bUpperKeyWord, bKeepCommen
|
||||
{
|
||||
if( bKeepComments )
|
||||
{
|
||||
/* TOFIX: To use hb_strncpy() */
|
||||
strncpy( szNextWord + wordlen, pszExpr, npos + 1 );
|
||||
szNextWord[ wordlen + npos + 1 ] = '\0';
|
||||
lenwords++;
|
||||
@@ -320,14 +320,14 @@ HB_FUNC( PARSEXPR ) /* ( c, bHonorSpacing, bInRemark, bUpperKeyWord, bKeepCommen
|
||||
}
|
||||
else
|
||||
{
|
||||
if( bKeepSpaces || ! strempty( szNextWord ) )
|
||||
if( bKeepSpaces || ! ide_strempty( szNextWord ) )
|
||||
{
|
||||
lenwords++;
|
||||
hb_arrayAdd( paExpr, hb_itemPutC( pTemp, szNextWord ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( ! strempty( szNextWord ) )
|
||||
if( ! ide_strempty( szNextWord ) )
|
||||
bFirst = HB_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ C_SOURCES := \
|
||||
legacycd.c \
|
||||
legacyco.c \
|
||||
legacycp.c \
|
||||
legacycr.c \
|
||||
legacycv.c \
|
||||
wce_simc.c \
|
||||
wce_smsc.c \
|
||||
|
||||
65
harbour/contrib/hbwin/legacycr.c
Normal file
65
harbour/contrib/hbwin/legacycr.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Compatibility calls (Printer support).
|
||||
*
|
||||
* Copyright 2009 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#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 )
|
||||
|
||||
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 ); }
|
||||
|
||||
#endif
|
||||
@@ -69,7 +69,7 @@
|
||||
Administrator rights are required by default in Windows. [vszakats] */
|
||||
|
||||
FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )
|
||||
LOCAL rVal := .T.
|
||||
LOCAL bRetVal := .T.
|
||||
LOCAL cKeySrv
|
||||
LOCAL cKeyWks
|
||||
|
||||
@@ -79,7 +79,7 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )
|
||||
IF ! lDoVista .AND. win_osIsVistaOrUpper()
|
||||
/* do nothing */
|
||||
ELSEIF win_osIs9X()
|
||||
rVal := QueryRegistry( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt )
|
||||
bRetVal := win_regQuery( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\VxD\VREDIR", "DiscardCacheOnOpen", 1, lSetIt )
|
||||
ELSE
|
||||
cKeySrv := "System\CurrentControlSet\Services\LanmanServer\Parameters"
|
||||
cKeyWks := "System\CurrentControlSet\Services\LanmanWorkStation\Parameters"
|
||||
@@ -89,45 +89,38 @@ FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )
|
||||
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 */
|
||||
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt )
|
||||
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt )
|
||||
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( 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 )
|
||||
bRetVal := bRetVal .AND. win_regQuery( 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 )
|
||||
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt )
|
||||
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt )
|
||||
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt )
|
||||
|
||||
IF win_osis2000OrUpper()
|
||||
rVal := rVal .AND. QueryRegistry( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt )
|
||||
bRetVal := bRetVal .AND. win_regQuery( HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN rVal
|
||||
RETURN bRetVal
|
||||
|
||||
FUNCTION WIN_OSNETVREDIROK( nResult )
|
||||
LOCAL cWinDir
|
||||
LOCAL cFile
|
||||
LOCAL a
|
||||
|
||||
nResult := 0
|
||||
|
||||
IF win_osIs9X()
|
||||
cWinDir := GetEnv( "WINDIR" ) /* Get the folder that Windows is installed in */
|
||||
IF Empty( cWinDir )
|
||||
cWinDir := "C:\WINDOWS"
|
||||
ENDIF
|
||||
cFile := cWinDir + "\SYSTEM\VREDIR.VXD"
|
||||
a := Directory( cFile ) /* Check for faulty files. */
|
||||
a := Directory( hb_GetEnv( "WINDIR", "C:\WINDOWS" ) + "\SYSTEM\VREDIR.VXD" ) /* Check for faulty files. */
|
||||
IF ! Empty( a )
|
||||
IF a[ 1, F_SIZE ] == 156749 .AND. a[ 1, F_TIME ] == "11:11:10"
|
||||
nResult := 1111
|
||||
|
||||
@@ -103,14 +103,14 @@ FUNCTION win_regRead( cRegPath, xDefault )
|
||||
|
||||
win_regPathSplit( cRegPath, @nHKEY, @cKey, @cEntry )
|
||||
|
||||
RETURN GetRegistry( nHKEY, cKey, cEntry, xDefault )
|
||||
RETURN win_regGet( nHKEY, cKey, cEntry, xDefault )
|
||||
|
||||
FUNCTION win_regWrite( cRegPath, xValue )
|
||||
LOCAL nHKEY, cKey, cEntry
|
||||
|
||||
win_regPathSplit( cRegPath, @nHKEY, @cKey, @cEntry )
|
||||
|
||||
RETURN SetRegistry( nHKEY, cKey, cEntry, xValue )
|
||||
RETURN win_regSet( nHKEY, cKey, cEntry, xValue )
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
@@ -135,13 +135,13 @@ FUNCTION win_regWrite( cRegPath, xValue )
|
||||
#define REG_FULL_RESOURCE_DESCRIPTOR 9 // Resource list in the hardware description
|
||||
#define REG_RESOURCE_REQUIREMENTS_LIST 10
|
||||
|
||||
FUNCTION QueryRegistry( nHKEY, cKeyName, cEntryName, xValue, lSetIt )
|
||||
LOCAL xKey := GetRegistry( nHKEY, cKeyName, cEntryName )
|
||||
FUNCTION win_regQuery( nHKEY, cKeyName, cEntryName, xValue, lSetIt )
|
||||
LOCAL xKey := win_regGet( nHKEY, cKeyName, cEntryName )
|
||||
|
||||
LOCAL cValType := ValType( xValue )
|
||||
LOCAL lRetVal
|
||||
|
||||
DEFAULT lSetIT TO .F.
|
||||
DEFAULT lSetIt TO .F.
|
||||
|
||||
IF cValType == "L"
|
||||
xValue := iif( xValue, 1, 0 )
|
||||
@@ -153,21 +153,21 @@ FUNCTION QueryRegistry( nHKEY, cKeyName, cEntryName, xValue, lSetIt )
|
||||
|
||||
lRetVal := ( xKey != NIL .AND. xValue != NIL .AND. cValType == ValType( xKey ) .AND. xValue == xKey )
|
||||
IF ! lRetVal .AND. lSetIt
|
||||
lRetVal := SetRegistry( nHKEY, cKeyName, cEntryName, xValue )
|
||||
lRetVal := win_regSet( nHKEY, cKeyName, cEntryName, xValue )
|
||||
ENDIF
|
||||
|
||||
RETURN lRetVal
|
||||
|
||||
FUNCTION GetRegistry( nHKEY, cKeyName, cEntryName, xDefault )
|
||||
FUNCTION win_regGet( nHKEY, cKeyName, cEntryName, xDefault )
|
||||
LOCAL xRetVal
|
||||
LOCAL pKeyHandle
|
||||
LOCAL nValueType
|
||||
|
||||
IF win_RegOpenKeyEx( nHKEY, cKeyName, 0, KEY_QUERY_VALUE, @pKeyHandle )
|
||||
IF win_regOpenKeyEx( nHKEY, cKeyName, 0, KEY_QUERY_VALUE, @pKeyHandle )
|
||||
|
||||
/* retrieve the length of the value */
|
||||
|
||||
win_RegQueryValueEx( pKeyHandle, cEntryName, 0, @nValueType, @xRetVal )
|
||||
win_regQueryValueEx( pKeyHandle, cEntryName, 0, @nValueType, @xRetVal )
|
||||
|
||||
IF ISCHARACTER( xRetVal )
|
||||
DO CASE
|
||||
@@ -185,20 +185,20 @@ FUNCTION GetRegistry( nHKEY, cKeyName, cEntryName, xDefault )
|
||||
xRetVal := xDefault
|
||||
ENDIF
|
||||
|
||||
win_RegCloseKey( pKeyHandle )
|
||||
win_regCloseKey( pKeyHandle )
|
||||
ELSE
|
||||
xRetVal := xDefault
|
||||
ENDIF
|
||||
|
||||
RETURN xRetVal
|
||||
|
||||
FUNCTION SetRegistry( nHKEY, cKeyName, cEntryName, xValue )
|
||||
FUNCTION win_regSet( nHKEY, cKeyName, cEntryName, xValue )
|
||||
LOCAL cName
|
||||
LOCAL nValueType
|
||||
LOCAL lRetVal := .F.
|
||||
LOCAL pKeyHandle
|
||||
|
||||
IF win_RegCreateKeyEx( nHKEY, cKeyName, 0, 0, 0, KEY_SET_VALUE, 0, @pKeyHandle )
|
||||
IF win_regCreateKeyEx( nHKEY, cKeyName, 0, 0, 0, KEY_SET_VALUE, 0, @pKeyHandle )
|
||||
|
||||
/* no support for Arrays, Codeblock ... */
|
||||
SWITCH ValType( xValue )
|
||||
@@ -222,10 +222,10 @@ FUNCTION SetRegistry( nHKEY, cKeyName, cEntryName, xValue )
|
||||
ENDSWITCH
|
||||
|
||||
IF cName != NIL
|
||||
lRetVal := win_RegSetValueEx( pKeyHandle, cEntryName, 0, nValueType, cName )
|
||||
lRetVal := win_regSetValueEx( pKeyHandle, cEntryName, 0, nValueType, cName )
|
||||
ENDIF
|
||||
|
||||
win_RegCloseKey( pKeyHandle )
|
||||
win_regCloseKey( pKeyHandle )
|
||||
ENDIF
|
||||
|
||||
RETURN lRetVal
|
||||
|
||||
Reference in New Issue
Block a user