|
Previous Top Next |
Prototype: | (),Byte |
Returns | Return true if the opportunistic locking was successfully turned off. |
This method sets the appropriate registry keys so that opportunistic locking (OpLocks) is turned off. Those keys are:
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/MRXSmb/Parameters/OplocksDisabled = 1 (hex - DWORD)
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/LanmanServer/Parameters/EnableOpLocks = 0 (hex - DWORD)
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/LanmanServer/Parameters/EnableOpLockForceClose = 1 (hex - DWORD)
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/LanmanServer/Parameters/CachedOPenLimit = 0 (hex - DWORD)
When OpLock is turned on it can cause data corruption and lost data. The SetOplocksOff method turns the opportunistic locking off, but it must be called elevated so I would suggest adding a small executable file that does that and you can call it to fix the opportunistic locking, as described in the example below.
Example:
ITU ITUtilityClass
ITS ITShellClass
I Byte
Code
Loop
If Not ITU.CheckOplocks
Message('The Oportunistic Locking is not set correctly and can cause data corruption.','OPLOCK ERROR',ICON:Hand)
ITS.ITRun('FixOplocks.exe',True,,,True)
End
I+=1
If I > 4
Message('Cannot fix Oportunistic Locking. Aborting','OPLOCK ERROR',ICON:Hand)
HALT(0)
End
End
See also:
http://support.microsoft.com/kb/296264
http://www.icetips.com/showarticle.php?articleid=264