예제 #1
0
        /// <summary>
        /// Register WER keys to avoid WER dialogs on crashes
        /// Need to apply Disable=1 property and DontShowUI=1 (yes, both are needed.)
        ///  http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx
        /// http://forum.soft32.com/windows/disable-exe-stopped-working-dialog-ftopict365124.html
        /// </summary>
        private static void RegisterWerKeys()
        {
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(werRegistryPath, true))
            {
                if (key != null)
                {
                    //Backup and apply each key
                    RegistryUtilities.BackupKey(key, werDisabledKey);
                    key.SetValue(werDisabledKey, 1, RegistryValueKind.DWord);

                    RegistryUtilities.BackupKey(key, werDontShowUIKey);
                    key.SetValue(werDontShowUIKey, 1, RegistryValueKind.DWord);
                }
            }
        }
예제 #2
0
        private static void RegisterDebuggerKeys(string registryPath, string debugCommand, string debuggerKey, string launchSettingKey, bool isNative)
        {
            using (RegistryKey key = RegistryUtilities.ObtainKey(registryPath))
            {
                // Backup current debugger settings, don't overwrite in case someone manually killed
                // the test before cleanup ran, otherwise we will clobber user's original settings.
                RegistryUtilities.BackupKey(key, debuggerKey);
                RegistryUtilities.BackupKey(key, launchSettingKey);

                key.SetValue(debuggerKey, debugCommand, RegistryValueKind.String);
                // Set JIT debugger to auto launch (e.g. no dialog).
                if (!isNative)
                {
                    key.SetValue(launchSettingKey, "2", RegistryValueKind.DWord);
                }
                else
                {
                    key.SetValue(launchSettingKey, "1", RegistryValueKind.String);
                }
            }
        }