diff --git a/32 b/32 index f66587b..030b299 100644 --- a/32 +++ b/32 @@ -1,6 +1,3 @@ - -# This script is hosted on https://get.msvc.win/32 for MSVC Win Project
To get started, run irm get.msvc.win/32 | iex inside of PowerShell
-
 Add-Type -AssemblyName System.IO.Compression.FileSystem
 
 function Main {
@@ -41,20 +38,37 @@ function Main {
     $aria2Dir = Join-Path $tempDir "aria2"
     $aria2Exe = Join-Path $aria2Dir "aria2c.exe"
 
-    # --- Check User IP location---
+    # --- Check User IP location ---
 
     $geoInfo = Invoke-RestMethod -Uri 'https://ipapi.co/json/'
     $countryCode = $geoInfo.country
 
+    # --- Check Proxy Settings ---
+    $webProxy = [System.Net.WebRequest]::GetSystemWebProxy()
+    $uri = New-Object Uri("http://example.com")
+    $proxyUri = $webProxy.GetProxy($uri)
+
+    $useProxy = $proxyUri.Host -ne "example.com"
+    if ($useProxy) {
+        $proxyAddress = $proxyUri.Authority
+        Write-Host "Detected system proxy: $proxyAddress"
+    }
+
     # --- Ensure aria2c is available ---
     if (-not (Test-Path $aria2Exe)) {
         Write-Host "Downloading aria2c..."
         $aria2Zip = Join-Path $tempDir "aria2.zip"
         if ($countryCode -eq 'CN') {
             $aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip"
+            # Workaround for specific Chinese ISPs that would not resolve domains properly like aka.ms
+            $regionalWorkaround = "--async-dns-server=223.5.5.5"
         }
         else {
             $aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-build1.zip"
+            $regionalWorkaround = ""
+        }
+        if ($useProxy) {
+            $regionalWorkaround = "--all-proxy=$proxyAddress"
         }
         Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
         Expand-Archive -Path $aria2Zip -DestinationPath $aria2Dir -Force
@@ -85,6 +99,7 @@ function Main {
             "--max-connection-per-server=8",
             "--split=8",
             "--min-split-size=1M",
+            "$regionalWorkaround",
             "`"$($item.Url)`""
         ) -NoNewWindow -Wait
     }
@@ -97,9 +112,9 @@ function Main {
     # --- Install VC++ Redistributables ---
     foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
         $exePath = Join-Path $tempDir $item.Name
-        $args = if ($item.Year -in @("2005", "2008")) { "/q" } else { "/quiet /norestart" }
+        $arguments = if ($item.Year -in @("2005", "2008")) { "/q" } else { "/quiet /norestart" }
         Write-Host "Installing $($item.Name)..."
-        Start-Process -FilePath $exePath -ArgumentList $args -Wait
+        Start-Process -FilePath $exePath -ArgumentList $arguments -Wait
     }
 
     # --- Cleanup ---
diff --git a/64 b/64
index bffd65e..70093f8 100644
--- a/64
+++ b/64
@@ -1,6 +1,3 @@
-
-# This script is hosted on https://get.msvc.win/64 for MSVC Win Project
To get started, run irm get.msvc.win/64 | iex inside of PowerShell
-
 Add-Type -AssemblyName System.IO.Compression.FileSystem
 
 function Main {
@@ -9,6 +6,12 @@ function Main {
         return 1
     }
 
+    $procArch = $Env:PROCESSOR_ARCHITECTURE
+    if ($procArch -eq 'x86') {
+        Write-Warning "This script does not support 32-bit Windows. Exiting..."
+        return 1
+    }
+
     $flagPath = "$env:TEMP\elevation_success.flag"
     if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
 
@@ -41,20 +44,37 @@ function Main {
     $aria2Dir = Join-Path $tempDir "aria2"
     $aria2Exe = Join-Path $aria2Dir "aria2c.exe"
 
-    # --- Check User IP location---
+    # --- Check User IP location ---
 
     $geoInfo = Invoke-RestMethod -Uri 'https://ipapi.co/json/'
     $countryCode = $geoInfo.country
 
+    # --- Check Proxy Settings ---
+    $webProxy = [System.Net.WebRequest]::GetSystemWebProxy()
+    $uri = New-Object Uri("http://example.com")
+    $proxyUri = $webProxy.GetProxy($uri)
+
+    $useProxy = $proxyUri.Host -ne "example.com"
+    if ($useProxy) {
+        $proxyAddress = $proxyUri.Authority
+        Write-Host "Detected system proxy: $proxyAddress"
+    }
+
     # --- Ensure aria2c is available ---
     if (-not (Test-Path $aria2Exe)) {
         Write-Host "Downloading aria2c..."
         $aria2Zip = Join-Path $tempDir "aria2.zip"
         if ($countryCode -eq 'CN') {
             $aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-64bit-build1.zip"
+            # Workaround for specific Chinese ISPs that would not resolve domains properly like aka.ms
+            $regionalWorkaround = "--async-dns-server=223.5.5.5"
         }
         else {
             $aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
+            $regionalWorkaround = ""
+        }
+        if ($useProxy) {
+            $regionalWorkaround = "--all-proxy=$proxyAddress"
         }
         Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
         Expand-Archive -Path $aria2Zip -DestinationPath $aria2Dir -Force
@@ -90,6 +110,7 @@ function Main {
             "--max-connection-per-server=8",
             "--split=8",
             "--min-split-size=1M",
+            "$regionalWorkaround",
             "`"$($item.Url)`""
         ) -NoNewWindow -Wait
     }
@@ -97,9 +118,9 @@ function Main {
     # --- Install VC++ Redistributables ---
     foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
         $exePath = Join-Path $tempDir $item.Name
-        $args = if ($item.Year -in @("2005", "2008")) { "/q" } else { "/quiet /norestart" }
+        $arguments = if ($item.Year -in @("2005", "2008")) { "/q" } else { "/quiet /norestart" }
         Write-Host "Installing $($item.Name)..."
-        Start-Process -FilePath $exePath -ArgumentList $args -Wait
+        Start-Process -FilePath $exePath -ArgumentList $arguments -Wait
     }
 
     # --- Cleanup ---
diff --git a/dx b/dx
index 8f07d09..ccc215e 100644
--- a/dx
+++ b/dx
@@ -1,6 +1,3 @@
-
-# This script is hosted on https://get.msvc.win/ for MSVC Win Project
To get started, run irm get.msvc.win | iex inside of PowerShell
-
 Add-Type -AssemblyName System.IO.Compression.FileSystem
 
 function Main {
@@ -41,20 +38,40 @@ function Main {
     $aria2Dir = Join-Path $tempDir "aria2"
     $aria2Exe = Join-Path $aria2Dir "aria2c.exe"
 
-    # --- Check User IP location---
+    # --- Check User IP location ---
 
     $geoInfo = Invoke-RestMethod -Uri 'https://ipapi.co/json/'
     $countryCode = $geoInfo.country
 
+    # --- Check Proxy Settings ---
+    $webProxy = [System.Net.WebRequest]::GetSystemWebProxy()
+    $uri = New-Object Uri("http://example.com")
+    $proxyUri = $webProxy.GetProxy($uri)
+
+    $useProxy = $proxyUri.Host -ne "example.com"
+    if ($useProxy) {
+        $proxyAddress = $proxyUri.Authority
+        Write-Host "Detected system proxy: $proxyAddress"
+    }
+
     # --- Ensure aria2c is available ---
     if (-not (Test-Path $aria2Exe)) {
         Write-Host "Downloading aria2c..."
         $aria2Zip = Join-Path $tempDir "aria2.zip"
         if ($countryCode -eq 'CN') {
             $aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip"
+            # Workaround for specific Chinese ISPs that would not resolve domains properly like aka.ms
+            $regionalWorkaround = "--async-dns-server=223.5.5.5"
         }
         else {
-            $aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-build1.zip"
+            $aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
+            $regionalWorkaround = ""
+        }
+        if ($useProxy) {
+            $regionalWorkaround = "--all-proxy=$proxyAddress"
+        }
+        if ($procArch -ne "AMD64") {
+            $aria2Url = $aria2Url.Replace("64bit", "32bit")
         }
         Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
         Expand-Archive -Path $aria2Zip -DestinationPath $aria2Dir -Force
@@ -79,6 +96,7 @@ function Main {
             "--max-connection-per-server=8",
             "--split=8",
             "--min-split-size=1M",
+            "$regionalWorkaround",
             "`"$($item.Url)`""
         ) -NoNewWindow -Wait
     }
diff --git a/index.html b/index.html
index 48402a7..036b70d 100644
--- a/index.html
+++ b/index.html
@@ -9,6 +9,8 @@ function Main {
         return 1
     }
 
+    $procArch = $Env:PROCESSOR_ARCHITECTURE
+
     $flagPath = "$env:TEMP\elevation_success.flag"
     if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
 
@@ -41,20 +43,39 @@ function Main {
     $aria2Dir = Join-Path $tempDir "aria2"
     $aria2Exe = Join-Path $aria2Dir "aria2c.exe"
 
-    # --- Check User IP location---
-
+    # --- Check User IP location ---
     $geoInfo = Invoke-RestMethod -Uri 'https://ipapi.co/json/'
     $countryCode = $geoInfo.country
 
+    # --- Check Proxy Settings ---
+    $webProxy = [System.Net.WebRequest]::GetSystemWebProxy()
+    $uri = New-Object Uri("http://example.com")
+    $proxyUri = $webProxy.GetProxy($uri)
+
+    $useProxy = $proxyUri.Host -ne "example.com"
+    if ($useProxy) {
+        $proxyAddress = $proxyUri.Authority
+        Write-Host "Detected system proxy: $proxyAddress"
+    }
+
     # --- Ensure aria2c is available ---
     if (-not (Test-Path $aria2Exe)) {
         Write-Host "Downloading aria2c..."
         $aria2Zip = Join-Path $tempDir "aria2.zip"
         if ($countryCode -eq 'CN') {
             $aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-64bit-build1.zip"
+            # Workaround for specific Chinese ISPs that would not resolve domains properly like aka.ms
+            $regionalWorkaround = "--async-dns-server=223.5.5.5"
         }
         else {
             $aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
+            $regionalWorkaround = ""
+        }
+        if ($useProxy) {
+            $regionalWorkaround = "--all-proxy=$proxyAddress"
+        }
+        if ($procArch -ne "AMD64") {
+            $aria2Url = $aria2Url.Replace("64bit", "32bit")
         }
         Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
         Expand-Archive -Path $aria2Zip -DestinationPath $aria2Dir -Force
@@ -81,6 +102,9 @@ function Main {
 
     # --- Download everything up front ---
     foreach ($item in $downloads) {
+        if ($item.Name -Match "x64" -and $procArch -ne "AMD64") {
+            continue
+        }
         $outFile = Join-Path $tempDir $item.Name
         Write-Host "Downloading $($item.Name)..."
         Start-Process -FilePath $aria2Exe -ArgumentList @(
@@ -91,6 +115,7 @@ function Main {
             "--max-connection-per-server=8",
             "--split=8",
             "--min-split-size=1M",
+            "$regionalWorkaround",
             "`"$($item.Url)`""
         ) -NoNewWindow -Wait
     }
@@ -102,10 +127,13 @@ function Main {
 
     # --- Install VC++ Redistributables ---
     foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
+        if ($item.Name -Match "x64" -and $procArch -ne "AMD64") {
+            continue
+        }
         $exePath = Join-Path $tempDir $item.Name
-        $args = if ($item.Year -in @("2005", "2008")) { "/q" } else { "/quiet /norestart" }
+        $arguments = if ($item.Year -in @("2005", "2008")) { "/q" } else { "/quiet /norestart" }
         Write-Host "Installing $($item.Name)..."
-        Start-Process -FilePath $exePath -ArgumentList $args -Wait
+        Start-Process -FilePath $exePath -ArgumentList $arguments -Wait
     }
 
     # --- Cleanup ---