Beispiel #1
0
        public static IntPtr OpenSubKey(IntPtr hKey, string subKey, Win32API.RegSAM samDesired)
        {
            IntPtr hResult = IntPtr.Zero;

            Win32API.Error result = Win32API.RegOpenKeyEx(hKey, subKey, 0, samDesired, out hResult);
            if (result == Win32API.Error.Success)
            {
                // do nothing
            }

            return(hResult);
        }
Beispiel #2
0
        protected override bool PreExecuteWaitInit(AutoResetEvent executeEvent)
        {
            Win32API.RegNotifyChangeFilter notifyFilter = (Win32API.RegNotifyChangeFilter.Attributes |
                                                           Win32API.RegNotifyChangeFilter.Name |
                                                           Win32API.RegNotifyChangeFilter.Security |
                                                           Win32API.RegNotifyChangeFilter.Value);

            // http://msdn.microsoft.com/en-us/library/windows/desktop/ms724892(v=vs.85).aspx:
            // This function detects a single change. After the caller receives a notification event,
            // it should call the function again to receive the next notification.
            Win32API.Error result = Win32API.RegNotifyChangeKeyValue(RegKey.Handle,
                                                                     WatchSubtree,
                                                                     notifyFilter,
                                                                     executeEvent.SafeWaitHandle.DangerousGetHandle(),
                                                                     true);
            return(result == Win32API.Error.Success);
        }