From 0a75a71279d6f9a90d118d2841ae2c7e47a231cb Mon Sep 17 00:00:00 2001 From: jm33-m0 Date: Wed, 2 Jan 2019 17:30:15 +0800 Subject: [PATCH] add support for Office 2019 --- README.md | 21 +++++++------ win10-activate/MainWindow.xaml.cs | 49 ++++++++++++++++++++++++------- 2 files changed, 50 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5a30b9a..aedad09 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # kms-activate Microsoft Windows/Office 一键激活工具,基于kms.jm33.me的KMS服务器 -> in case this repo (or even my account) is blocked, please contact me via Telegram if you need the binary - -supported versions +## supported versions - Windows 10 Professional - Windows 10 Enterprise @@ -17,14 +15,19 @@ supported versions - Windows Server 2012 R2 Datacenter - Windows Server 2008 R2 Standard - Windows Server 2008 R2 Enterprise -- Office 2010, 2013, 2016 Professional Plus +- Office 2010, 2013, 2016, 2019 + +## Office Deployment Tool + +you can use [Office Deployment Tool](https://www.microsoft.com/en-us/download/details.aspx?id=49117) to download and install Office (VOL) from Microsoft -NOTE: +## NOTE: -- **Change KMS server** if activation keeps failing +- KMS activation requires a working internet connection, and `kms.jm33.me` or your custom KMS server must be reachable +- Change KMS server if activation keeps failing +- Check `Show debug info` to view log - Make sure kms server is reachable, and is present in your slmgr.vbs -- Tested on Windows 10 Vol and/or Windows 10 Download Tool edition, it should work in most cases -- Office 2016 Vol is recommended +- Office 2019 Vol is recommended - Download from [here](https://github.com/jm33-m0/kms-activate/releases) -![](/img/win-activate.JPG) +![screenshot](/img/win-activate.JPG) diff --git a/win10-activate/MainWindow.xaml.cs b/win10-activate/MainWindow.xaml.cs index 5bb2b2f..b2c59f9 100644 --- a/win10-activate/MainWindow.xaml.cs +++ b/win10-activate/MainWindow.xaml.cs @@ -1,12 +1,10 @@ -using System.Security.Principal; -using System.Windows; -using System.Linq; +using Microsoft.Win32; +using System; +using System.Collections.Generic; using System.Diagnostics; +using System.Security.Principal; using System.Threading; -using System.IO; -using System.Collections.Generic; -using Microsoft.Win32; -using System; +using System.Windows; namespace kms_activate { @@ -141,6 +139,14 @@ public void WinActivate() // which version to activate? string key = ""; string productName = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", "").ToString(); + if (productName.ToLower().Contains("ultimate")) + // in case you want to activate Windows 7 Ultimate (it's a retail version, which doesn't support VOL at all) + { + MessageBox.Show("Not supported", "Error", MessageBoxButton.OK, MessageBoxImage.Stop); + return; + } + + try { foreach (string winversion in winKeys.Keys) @@ -324,10 +330,14 @@ private void Button_Click(object sender, RoutedEventArgs e) Application.Current.Shutdown(); } - MessageBoxResult response = MessageBox.Show("Make sure you are using VOL version", "Proceed?", MessageBoxButton.YesNo, MessageBoxImage.Question); - if (response == MessageBoxResult.No) + if (office_option.IsChecked.Value) + // Office has to be vol { - return; + MessageBoxResult response = MessageBox.Show("Make sure you are using VOL version", "Proceed?", MessageBoxButton.YesNo, MessageBoxImage.Question); + if (response == MessageBoxResult.No) + { + return; + } } // Disable all buttons @@ -371,21 +381,38 @@ private void Windows_option_Checked(object sender, RoutedEventArgs e) private void Office_option_Checked(object sender, RoutedEventArgs e) { + // look for Office's install path, where OSPP.VBS can be found try { button.Content = "Activate "; RegistryKey localKey; if (Environment.Is64BitOperatingSystem) + { localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); + } else + { localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); + } string officepath = ""; RegistryKey officeBaseKey = localKey.OpenSubKey(@"SOFTWARE\Microsoft\Office"); if (officeBaseKey.OpenSubKey(@"16.0", false) != null) { officepath = officeBaseKey.OpenSubKey(@"16.0\Word\InstallRoot").GetValue("Path").ToString(); - button.Content += "Office 2016"; + + if (officepath.Contains("root")) + // Office 2019 can only be installed via Click-To-Run, therefore we get "C:\Program Files\Microsoft Office\root\Office16\", + // otherwise we get "C:\Program Files\Microsoft Office\Office16\" + { + // OSPP.VBS is still in "C:\Program Files\Microsoft Office\Office16\" + officepath = officepath.Replace("root", ""); + button.Content += "Office 2019/2016"; + } + else + { + button.Content += "Office 2016"; + } } else if (officeBaseKey.OpenSubKey(@"15.0", false) != null) {