コード例 #1
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing && _sapiRegKey != null && _disposeSapiKey)
     {
         Marshal.ReleaseComObject(_sapiRegKey);
         _sapiRegKey = null;
     }
 }
コード例 #2
0
        protected RegistryDataKey(string fullPath, IntPtr regHandle)
        {
            ISpRegDataKey  spRegDataKey   = (ISpRegDataKey) new SpDataKey();
            SAPIErrorCodes sAPIErrorCodes = (SAPIErrorCodes)spRegDataKey.SetKey(regHandle, false);

            if (sAPIErrorCodes != 0 && sAPIErrorCodes != SAPIErrorCodes.SPERR_ALREADY_INITIALIZED)
            {
                throw new InvalidOperationException();
            }
            _sapiRegKey     = spRegDataKey;
            _sKeyId         = fullPath;
            _disposeSapiKey = true;
        }
コード例 #3
0
 protected RegistryDataKey(string fullPath, ISpDataKey copyKey, bool shouldDispose)
 {
     _sKeyId         = fullPath;
     _sapiRegKey     = copyKey;
     _disposeSapiKey = shouldDispose;
 }
コード例 #4
0
 protected RegistryDataKey(string fullPath, RegistryDataKey copyKey)
 {
     _sKeyId         = fullPath;
     _sapiRegKey     = copyKey._sapiRegKey;
     _disposeSapiKey = copyKey._disposeSapiKey;
 }
コード例 #5
0
 public int CreateKey([MarshalAs(UnmanagedType.LPWStr)] string subKeyName, out ISpDataKey ppSubKey)
 {
     return(_sapiRegKey.CreateKey(subKeyName, out ppSubKey));
 }