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.
);
Value | Description |
METADATA_PERMISSION_READ | Open the key for reading. |
METADATA_PERMISSION_WRITE | Open the key for writing. |
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. |
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.