Antonio Linares wrote:Rafa,
Si, Michel Driessen ha confirmado que a él tambien le solucionó el problema el desactivar el SMB2, y a Dutch igual.
Asi que bienvenida sea esa solución para quienes sufren ese problema
#define HKEY_LOCAL_MACHINE 2147483650
//---------------------------------------------------------------------------//
function SmbOff()
LOCAL oReg, cName, uVar
oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters" )
// Call Set with an empty string to access the default key
oReg:Set( "FileInfoCacheLifetime", 0 )
oReg:Set( "FileNotFoundCacheLifetime", 0 )
oReg:Set( "DirectoryCacheLifetime", 0 )
oReg:Close()
oReg := TReg32():Create( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" )
// Call Set with an empty string to access the default key
oReg:Set( "Smb2", 0 )
oReg:Close()
Alert( "Windows registry updated!" )
return nil
FUNCTION win_osNetRegOk( lSetIt, lDoVista )
LOCAL bRetVal := .T.
LOCAL cKeySrv
LOCAL cKeyWks
hb_default( @lSetIt, .F. )
hb_default( @lDoVista, .T. )
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 )
ELSE
cKeySrv := "System\CurrentControlSet\Services\LanmanServer\Parameters"
cKeyWks := "System\CurrentControlSet\Services\LanmanWorkStation\Parameters"
IF lSetIt
lSetIt := ! hb_osIsWinNT() .OR. wapi_IsUserAnAdmin()
ENDIF
/* Server settings */
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt )
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 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
/* Workstation settings */
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt )
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 hb_osIsWinVista()
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileInfoCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileNotFoundCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "DirectoryCacheLifetime", 0, lSetIt )
ENDIF
IF hb_osIsWin2K()
bRetVal := bRetVal .AND. win_regQuery( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt )
ENDIF
ENDIF
RETURN bRetVal
#include "FiveWin.ch"
#include "DbInfo.ch"
ANNOUNCE RDDSYS
REQUEST DBFCDX, DBFFPT
ANNOUNCE FPTCDX
STATIC lOnOff := .F.
FUNCTION MAIN()
RDDSETDEFAULT("DBFCDX")
USE TEST //HAS NO MEMO FIELD
INDEX ON Field->ONE TO TEST
CLOSE DATABASES
USE TEST INDEX TEST ALIAS TEST SHARED NEW
? DBInfo( DBI_FILEHANDLE ) //OK
? DBInfo( DBI_MEMOHANDLE ) //HANGS HERE
// ? "OK"
IF TurnShared( lOnOff ) // se Shared = Retorna .T.
? [Shared]
ELSE // Retorna .F.
? [Not Shared]
ENDIF
QUIT
RETURN NIL
function TurnShared( lOnOff )
return dbInfo( DBI_SHARED, lOnOff )
#include "FiveWin.ch"
static oWnd
//----------------------------------------------------------------//
function Main()
If !WIN_OSNETREGOK() //Precisa direitos ADM
If !WIN_OSNETREGOK(.t.,.t.) //primeiro .t. é para ajustar XP/W98..., o segundo ajusta no vista.
MsgInfo('Registro do windows não ajustado !')
EndIf
EndIf
RETURN NIL
#include "common.ch"
#include "directry.ch"
#define WIN_HKEY_LOCAL_MACHINE 0
#define WIN_HKEY_CLASSES_ROOT 1
#define WIN_HKEY_CURRENT_USER 2
#define WIN_HKEY_CURRENT_CONFIG 3
#define WIN_HKEY_LOCAL_MACHINE 4
#define WIN_HKEY_USERS 5
/* NOTE: To change any of these registry settings
Administrator rights are required by default in Windows. [vszakats] */
FUNCTION WIN_OSNETREGOK( lSetIt, lDoVista )
LOCAL bRetVal := .T.
LOCAL cKeySrv
LOCAL cKeyWks
IF ! ISLOGICAL( lSetIt )
lSetIt := .F.
ENDIF
IF ! ISLOGICAL( lDoVista )
lDoVista := .T.
ENDIF
IF ! lDoVista .AND. Os_IsWinVISTA() //win_osIsVistaOrUpper()
/* do nothing */
ELSEIF Os_IsWin9X() // hb_osIsWin9x()
bRetVal := QueryRegistry( WIN_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 := ! Os_IsWinNT() .OR. os_IsUserAnAdmin() //wapi_IsUserAnAdmin()
ENDIF
/* Server settings */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "CachedOpenLimit", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLocks", 0, lSetIt ) /* Q124916 */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "EnableOpLockForceClose", 1, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationDelay", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SharingViolationRetries", 0, lSetIt )
IF Os_IsWinVISTA() // win_osIsVistaOrUpper()
/* If SMB2 is enabled turning off oplocks does not work, so SMB2 is required to be turned off on Server. */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeySrv, "SMB2", 0, lSetIt )
ENDIF
/* Workstation settings */
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseOpportunisticLocking", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLocks", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "EnableOpLockForceClose", 1, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UtilizeNtCaching", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "UseLockReadUnlock", 0, lSetIt )
IF Os_IsWinVISTA() //win_osIsVistaOrUpper()
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileInfoCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "FileNotFoundCacheLifetime", 0, lSetIt )
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, cKeyWks, "DirectoryCacheLifetime", 0, lSetIt )
ENDIF
IF Os_IsWinNT() //hb_osIsWin2K()
bRetVal := bRetVal .AND. QueryRegistry( WIN_HKEY_LOCAL_MACHINE, "System\CurrentControlSet\Services\MRXSmb\Parameters", "OpLocksDisabled", 1, lSetIt )
ENDIF
// Senores como hacer esto en windows 7 e xHarbour?
IF Os_IsWin7() //hb_osIsWin7()
ENDIF
// Senores como hacer esto en windows 8 e xHarbour?
IF Os_IsWin8() //hb_osIsWin8()
ENDIF
ENDIF
RETURN bRetVal
FUNCTION WIN_OSNETVREDIROK( /* @ */ nResult )
LOCAL aFiles
nResult := 0
IF Os_IsWin9X() // hb_osIsWin9x()
aFiles := Directory( GetEnv( "WINDIR", "C:\WINDOWS" ) + "\SYSTEM\VREDIR.VXD" ) /* Check for faulty files. */
IF ! Empty( aFiles )
IF aFiles[ 1 ][ F_SIZE ] == 156749 .AND. aFiles[ 1 ][ F_TIME ] == "11:11:10"
nResult := 1111
ELSEIF aFiles[ 1 ][ F_SIZE ] == 140343 .AND. aFiles[ 1 ][ F_TIME ] == "09:50:00"
nResult := 950
ENDIF
ENDIF
ENDIF
RETURN Empty( nResult )
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 23 guests