IMSAdminBase::ChangePermissions

The IMSAdminBase::ChangePermissions method changes permissions on an open handle. If the handle was opened with write permission and you change it to read-only, this method will cause any callback methods registered to be called.

HRESULT ChangePermissions(

  METADATA_HANDLE hMDHandle,  //metabase handle.

  DWORD dwMDTimeOut,//time, in milliseconds, for the method to wait before failing.

  DWORD dwMDAccessRequested//specifies the new permissions for the handle.

);

 

Parameters
hMDHandle
Specifies a handle to the metabase, as returned by the IMSAdminBase::OpenKey method.
dwMDTimeOut
Specifies the time, in milliseconds, for the method to wait for the operation to succeed.
dwMDAccessRequested
Specifies the new permissions for the handle. It must be one or both of the following values:
Value Description
METADATA_PERMISSION_READ Open the key for reading.
METADATA_PERMISSION_WRITE Open the key for writing.

Return Values

Returns an HRESULT that contains one of the following values:

Value Description
ERROR_INVALID_HANDLE The metabase handle is invalid.
ERROR_PATH_BUSY The path specified cannot be used at this time.
ERROR_SUCCESS The method succeeded.

Remarks

When you use this method to add permissions, you should follow the same rules that apply to IMSAdminBase::OpenKey. Timeout values should be short for this call; it is quite possible for two threads with read permission on the same data to attempt to update to write permission at the same time. Both will block until one read handle is closed.