From fd0e25f477c79ce8dbf3c214db079270d777dd98 Mon Sep 17 00:00:00 2001
From: WindowsAddict <windowsaddict@protonmail.com>
Date: Fri, 16 Aug 2024 04:34:19 +0530
Subject: [PATCH] Detect Ohook install in KMS script

---
 .../Activators/Online_KMS_Activation.cmd      | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
index 057328a..b2d51a1 100644
--- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
+++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
@@ -602,6 +602,28 @@ if not %_actoff%==1 goto :ks_activate
 
 call :ks_setspp
 
+::  Check ohook install
+
+set ohook=
+for %%# in (15 16) do (
+for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
+if exist "%%~A\Microsoft Office\Office%%#\sppc*dll" set ohook=1
+)
+)
+
+for %%# in (System SystemX86) do (
+for %%G in ("Office 15" "Office") do (
+for %%A in ("%ProgramFiles%" "%ProgramW6432%" "%ProgramFiles(x86)%") do (
+if exist "%%~A\Microsoft %%~G\root\vfs\%%#\sppc*dll" set ohook=1
+)
+)
+)
+
+if defined ohook (
+echo:
+call :dk_color %Gray% "Checking Ohook                          [Ohook activation is already installed for Office]"
+)
+
 ::  Check unsupported office versions
 
 set o14c2r=