www.icetips.com  Icetips Utilities Documentation 5/15/2014    

Utility Class: CheckOplocks

Previous  Top  Next  


Prototype: (),Byte

 

ReturnsReturns true if all the registry keys are correct.  Returns false if any of them is wrong.

 

This method checks 4 registry keys for the opportunistic locking (OpLock) settings.  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 can be used to turn 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:

SetOplocksOff

http://support.microsoft.com/kb/296264

http://www.icetips.com/showarticle.php?articleid=264

 



Direct link to this page: http://www.icetips.com/manuals/utilities/checkoplocks_utility.htm