Exemplo n.º 1
0
 /// <summary>
 /// This fixes my mistake for naming IIS process "wp3.exe" and not "w3wp.exe" like it should be.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="descriptorIndex"></param>
 internal static void IISFix( Microsoft.Win32.RegistryKey key, int descriptorIndex )
 {
     try {
         // get the name.
         var name = (string)key.GetValue ( ATASettings.Keys.AttachDescriptorName.With ( descriptorIndex ) );
         var processGroup = ATASettings.Keys.AttachDescriptorProcessNames.With ( descriptorIndex );
         var allProcesses = ( (string)key.GetValue ( processGroup ) )
                                                 .Split ( new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries );
         // does it have the f****d up process name?
         var hasWp3 = allProcesses.Any ( s => string.Compare ( s, "wp3.exe", true ) == 0 );
         // if it is iis, and it has the wrong process, fix that shit.
         if ( string.Compare ( name, "iis", true ) == 0 && hasWp3 ) {
             var newList = allProcesses.Where ( s => string.Compare ( s, "wp3.exe", true ) != 0 ).Concat ( new string[] { "w3wp.exe" } );
             key.SetValue ( processGroup, string.Join ( ";", newList ) );
         }
     } catch ( Exception ) {
         // if we dont have access to write, there is a problem.
     }
 }
Exemplo n.º 2
0
        public void EnsureAppInitSet(Microsoft.Win32.RegistryKey key, String szDllName)
        {
            key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(szAppInitKey, true);

            // Set the relevant values
            // TODO MAYBE record what these were set to and set them back if we uninstall?
            String LoadAppInit_DLLs = "LoadAppInit_DLLs";
            if (key.GetValue(LoadAppInit_DLLs, null) != null)
            {
                key.SetValue(LoadAppInit_DLLs, 1);
            }

            String RequireSignedAppInit_DLLs = "RequireSignedAppInit_DLLs";
            if (key.GetValue(RequireSignedAppInit_DLLs, null) != null)
            {
                key.SetValue(RequireSignedAppInit_DLLs, 1);
            }

            // Set the AppInit_Dlls value to include our DLL
            String value = key.GetValue(szAppInitValue).ToString();

            if (value.ToLower().Contains(GetDllPath(szDllName).ToLower()))
            {
                // Value already contains our DLL, so return
                return;
            }

            // Sanity check so I don't accidentally repeatedly add to this buffer
            if (value.Length > 1024)
            {
                // TODO Record an error
                return;
            }

            // Append a space if something is already there
            if (value.Length != 0)
            {
                value += " ";
            }

            // Append our DLL path
            value += GetDllPath(szDllName);

            // Set registry value
            key.SetValue(szAppInitValue, value);
        }
Exemplo n.º 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Tells the adapter to load it's settings from the specified keys.
		/// </summary>
		/// <param name="key"></param>
		/// ------------------------------------------------------------------------------------
		public void LoadSettings(Microsoft.Win32.RegistryKey key)
		{
			// Set the sidebar's width
			if (m_navPane.Parent != null)
				m_navPane.Parent.Width = (int)key.GetValue("SideBarWidth", m_navPane.Parent.Width);

			// Restore the active tab and active tab item.
			string tabName = key.GetValue("ActiveTab") as string;
			if (tabName != null)
			{
				// First set the current tab without causing events.
				SetCurrentTab(tabName, false);

				string itemName = key.GetValue("ActiveTabItem") as string;
				if (itemName != null)
					SetCurrentTabItem(tabName, itemName, true);
				else
				{
					// At this point, the registry didn't contain an active tab item, so
					// we'll set the current tab again, but this time generate events on
					// the assumption that when the application gets the event, it will
					// set a default tab item for the tab.
					SetCurrentTab(tabName, true);
				}
			}
		}
 private string getRegValue(Microsoft.Win32.RegistryKey key, string keyName)
 {
     try
     {
         return key.GetValue(keyName).ToString();
     }
     catch
     {
         return null;
     }
 }
Exemplo n.º 5
0
 public static DeepForest.Phone.Assets.Shell.ApplicationBar GetApplicationBar(Microsoft.Phone.Controls.PhoneApplicationPage obj)
 {
     return (DeepForest.Phone.Assets.Shell.ApplicationBar)obj.GetValue(ApplicationBarProperty);
 }
Exemplo n.º 6
0
                private static void CopyKeyRecursive(Microsoft.Win32.RegistryKey sourceKey, Microsoft.Win32.RegistryKey destKey)
                {
                        foreach (string ValueName in sourceKey.GetValueNames()) {
                                object Val = sourceKey.GetValue(ValueName);
                                destKey.SetValue(ValueName, Val, sourceKey.GetValueKind(ValueName));
                        }

                        foreach (string SubKeyName in sourceKey.GetSubKeyNames()) {
                                using (Microsoft.Win32.RegistryKey sourceSubKey = sourceKey.OpenSubKey(SubKeyName, false))
                                using (Microsoft.Win32.RegistryKey destSubKey = destKey.CreateSubKey(SubKeyName)) {
                                        CopyKeyRecursive(sourceSubKey, destSubKey);
                                }
                        }
                }
Exemplo n.º 7
0
 public static ApplicationBar GetApplicationBar(Microsoft.Phone.Controls.PhoneApplicationPage obj)
 {
     return (ApplicationBar)obj.GetValue(ApplicationBarProperty);
 }
Exemplo n.º 8
0
 public static ICommand GetCommand(Microsoft.Phone.Controls.PhoneApplicationPage buttonBase)
 {
     return buttonBase.GetValue(CommandProperty) as ICommand;
 }
 public VsPackageInfo(Microsoft.Win32.RegistryKey packageKey)
 {
     DefaultName = packageKey.GetValue(System.String.Empty) as string;
     Class = packageKey.GetValue("Class") as string;
 }
Exemplo n.º 10
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Load the active tab's settings.
		/// </summary>
		///
		/// <param name='key'>The Registry Key.</param>
		/// ------------------------------------------------------------------------------------
		private void LoadSettings(Microsoft.Win32.RegistryKey key)
		{
			SuspendLayout();

			try
			{
				IRegistryKeyNameModifier modifier = Parent.Parent as IRegistryKeyNameModifier;
				key = modifier.ModifyKey(key, true);
			}
			catch
			{}
			m_nPressedButtonsStartup = (int)key.GetValue(Name + "State", -1);

			if (m_nPressedButtonsStartup != -1 && Buttons.Count > 0)
			{
				// note: In TE, there are no buttons created yet when settings are loaded.
				// So this section of code is probably never used.
				// Instead, the ResumeLayout() method takes care of the initial pressing of
				//buttons later, when the tab is redrawn after the buttons are created.
				for (int i = 0; i < Buttons.Count; i++)
				{
					bool fPress = (m_nPressedButtonsStartup & (1 << i)) != 0;
					Buttons[i].PressButton(fPress);
					// Also visually click only if not suspended (we are suspended at least once, because we
					// call SuspendLayout() above!)
					if (fPress && m_nSuspendedLayout < 2)
					{
						// Also click a pressed button if appropriate
						if (fPress && OkToClickAButtonInThisTab)
							Buttons[i].PerformClick();
					}
				}

				// Clear the startup button states, now that we have used them
				m_nPressedButtonsStartup = -1;
			}

			int nDefault = LargeIconsShowing ? 1 : 0;
			LargeIconsShowing = ((int)key.GetValue(Name + "LargeIcons", nDefault) == 1)
				? true : false;

			ResumeLayout();
		}
Exemplo n.º 11
0
        private string getSmtpQSetting(Microsoft.Win32.RegistryKey kSmtpQ,
            string name, string defaultVal)
        {
            string s;
            Object objVal;

            s = null;
            objVal = null;
            objVal = kSmtpQ.GetValue(name);
            if (objVal != null) s = objVal.ToString();
            if (s == null)
            {
                kSmtpQ.SetValue(name, defaultVal, Microsoft.Win32.RegistryValueKind.String);
                objVal = kSmtpQ.GetValue(name);
                if (objVal != null) s = objVal.ToString();
            }
            return s;
        }
Exemplo n.º 12
0
 public void GetVsPackages(Microsoft.Win32.RegistryKey hiveRoot, Microsoft.Win32.RegistryKey editorKey, string editorExt)
 {
     if ((extension == null) || (System.StringComparer.OrdinalIgnoreCase.Compare(editorExt, extension) == 0))
     {
         string s = editorKey.GetValue("Package") as string;
         if (!System.String.IsNullOrEmpty(s))
         {
             using (Microsoft.Win32.RegistryKey registryKey = hiveRoot.OpenSubKey("Packages\\" + s))
             {
                 if ((registryKey != null) && !editors.ContainsKey(registryKey.Name))
                     editors.Add(registryKey.Name, new VsPackageInfo(registryKey));
             }
         }
     }
 }
Exemplo n.º 13
0
 public static object GetCommandParameter(Microsoft.Phone.Controls.PhoneApplicationPage buttonBase)
 {
     return buttonBase.GetValue(CommandParameterProperty);
 }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void OnLoadSettings(Microsoft.Win32.RegistryKey key)
		{
			base.OnLoadSettings(key);

			if (m_list == null || key == null)
				return;

			string value = key.GetValue("SelectedCheckingError", null) as string;
			if (value != null)
			{
				Guid guid = new Guid(value);
				SelectCheckingError(guid);
			}
		}
Exemplo n.º 15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Tells the adapter to load it's settings from the specified keys.
		/// </summary>
		/// <param name="key"></param>
		/// ------------------------------------------------------------------------------------
		public void LoadSettings(Microsoft.Win32.RegistryKey key)
		{
			// TODO for SilSidePane: some functionality here about setting items and tabs is irrelevant with SilSidePane, so identify and remove it.

			// Set the sidebar's width
			if (m_sidePane.ContainingControl != null)
				m_sidePane.ContainingControl.Width = (int)key.GetValue("SideBarWidth", m_sidePane.ContainingControl.Width);

			// Restore the active tab and active tab item.
			string tabName = key.GetValue("ActiveTab") as string;
			if (tabName != null)
			{
				// First set the current tab without causing events.
				SetCurrentTab(tabName, false);

				string itemName = key.GetValue("ActiveTabItem") as string;
				if (itemName != null)
					SetCurrentTabItem(tabName, itemName, true);
				else
				{
					// At this point, the registry didn't contain an active tab item, so
					// we'll set the current tab again, but this time generate events on
					// the assumption that when the application gets the event, it will
					// set a default tab item for the tab.
					SetCurrentTab(tabName, true);
				}
			}
			else
			{
				// Set to a default tab and tab item.
				// Use the first item on the first tab, rather than kScrSBTabName, kScrDraftViewSBItemName, since
				// this library shouldn't have to know what buttons the application uses.
				var tab = m_tabProps[0];
				if (null != tab)
				{
					SetCurrentTab(tab.Name, true);
					// Setting first item on tab should happen automatically.
				}
			}
		}
Exemplo n.º 16
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void OnLoadSettings(Microsoft.Win32.RegistryKey key)
		{
			CheckDisposed();
			base.OnLoadSettings(key);

			if (m_list == null || key == null)
				return;

			string value = key.GetValue("SelectedKeyTermRef", null) as string;
			if (value != null)
			{
				Guid guid = new Guid(value);
				SelectKeyTermRef(guid);
			}
		}
Exemplo n.º 17
0
        private static PhoneApplicationPageBackKeyPressCommandBehavior GetOrCreateBehavior(Microsoft.Phone.Controls.PhoneApplicationPage buttonBase)
        {
            PhoneApplicationPageBackKeyPressCommandBehavior behavior = buttonBase.GetValue(BackKeyPressCommandBehaviorProperty) as PhoneApplicationPageBackKeyPressCommandBehavior;
            if (behavior == null)
            {
                behavior = new PhoneApplicationPageBackKeyPressCommandBehavior(buttonBase);
                buttonBase.SetValue(BackKeyPressCommandBehaviorProperty, behavior);
            }

            return behavior;
        }