#include "directry.ch"
#include "hbwin.ch"
/* 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
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
I was just wondering if it might be time to investigate other routes to MSSQL.
Get-SmbServerConfiguration
EnableSMB1Protocol : False
EnableSMB2Protocol : True
FileInfoCacheLifetime
FileNotFoundCacheLifetime
DirectoryCacheLifetime
Jimmy wrote:i saw Comments about SMB ...
many of these Comment are "outdate", while for SMB1, and not valid when using Windows 10 / 11
Note : it is NOT recommended to use "older" OS than Windows 10 any more
Jimmy wrote:are you using "Drive-Letter" or UNC-Path
Jimmy wrote:Programmer like to "open" as much as possible and "leave" all "open" ...
that you can do with Single User App but it is not recommend in Network
Jimmy wrote:do NOT use OLD SMB1 "Hack" on Windows 10 / 11
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 35 guests