summaryrefslogtreecommitdiff
path: root/MAS
diff options
context:
space:
mode:
authorWindowsAddict2025-04-16 00:00:31 +0000
committerWindowsAddict2025-04-16 00:00:31 +0000
commit70162c413026ec938f1049b1e4011ac64945e31e (patch)
treef845ee8ee115ad224ef5f0d51a5ae30eb2eb9636 /MAS
parent294837dfe0eed177b177954e7ba8b5841af55264 (diff)
downloadMicrosoft-Activation-Scripts-70162c413026ec938f1049b1e4011ac64945e31e.zip
Add support for external LibTSforge.dll if found in BIN folder
Diffstat (limited to 'MAS')
-rw-r--r--MAS/All-In-One-Version-KL/MAS_AIO.cmd28
-rw-r--r--MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd28
2 files changed, 38 insertions, 18 deletions
diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd
index b5a94e7..7f7bb7a 100644
--- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd
+++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd
@@ -154,6 +154,7 @@ goto dk_done
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
+set "_workp=%_work:'=''%"
set "_batf=%~f0"
set "_batp=%_batf:'=''%"
@@ -8826,17 +8827,26 @@ namespace LibTSforge.PhysicalStore
}
'@
$ErrorActionPreference = 'Stop'
-$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
-$cp.CompilerOptions = "/unsafe"
-$lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
+$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll"
-$ctemp = "$env:SystemRoot\Temp\"
-if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
-$env:TMP = $ctemp
-$env:TEMP = $ctemp
+if (Test-Path -Path $binPath) {
+ Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
+ Add-Type -Path $binPath
+}
+else {
+ $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
+ $cp.CompilerOptions = "/unsafe"
+ $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
+
+ $ctemp = "$env:SystemRoot\Temp\"
+ if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
+ $env:TMP = $ctemp
+ $env:TEMP = $ctemp
+
+ $cp.GenerateInMemory = $true
+ Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
+}
-$cp.GenerateInMemory = $true
-Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
if ($env:_debug -eq '0') {
[LibTSforge.Logger]::HideOutput = $true
}
diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
index 7da980b..8d79784 100644
--- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
+++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
@@ -221,6 +221,7 @@ goto dk_done
set "_work=%~dp0"
if "%_work:~-1%"=="\" set "_work=%_work:~0,-1%"
+set "_workp=%_work:'=''%"
set "_batf=%~f0"
set "_batp=%_batf:'=''%"
@@ -6709,17 +6710,26 @@ namespace LibTSforge.PhysicalStore
}
'@
$ErrorActionPreference = 'Stop'
-$cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
-$cp.CompilerOptions = "/unsafe"
-$lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
+$binPath = Join-Path -Path $env:_workp -ChildPath "BIN\LibTSforge.dll"
-$ctemp = "$env:SystemRoot\Temp\"
-if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
-$env:TMP = $ctemp
-$env:TEMP = $ctemp
+if (Test-Path -Path $binPath) {
+ Write-Host "LibTSforge.dll found in BIN folder. Loading the DLL..."
+ Add-Type -Path $binPath
+}
+else {
+ $cp = [CodeDom.Compiler.CompilerParameters] [string[]]@("System.dll", "System.Core.dll", "System.ServiceProcess.dll", "System.Xml.dll")
+ $cp.CompilerOptions = "/unsafe"
+ $lang = If ((Get-Host).Version.Major -gt 2) { "CSharp" } Else { "CSharpVersion3" }
+
+ $ctemp = "$env:SystemRoot\Temp\"
+ if (-Not (Test-Path -Path $ctemp)) { New-Item -Path $ctemp -ItemType Directory > $null }
+ $env:TMP = $ctemp
+ $env:TEMP = $ctemp
+
+ $cp.GenerateInMemory = $true
+ Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
+}
-$cp.GenerateInMemory = $true
-Add-Type -Language $lang -TypeDefinition $src -CompilerParameters $cp
if ($env:_debug -eq '0') {
[LibTSforge.Logger]::HideOutput = $true
}