@set @x=0 /*
@echo off
if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="AMD64" ("%SystemRoot%\SysNative\cmd.exe" /c %0 & goto :eof)

>nul 2>&1 net sessions
if errorlevel 1 start "" cscript //nologo /e:jscript "%~f0" &goto :eof

echo HASP Emulators Install Tool v0.09 (C) 2020-2022 by lexapass
setlocal EnableExtensions EnableDelayedExpansion
cd /d "%~dp0"
if exist %windir%\SysWOW64 set bits=64
set certutil=certutil.exe
for /f "delims=." %%v in ('cmd /c ver') do (
   set majv=%%v
   set maj=!majv:~-1!)
if not "!maj!"=="5" set certutil=%windir%\system32\!certutil!
for /f "tokens=3" %%l in ('reg query HKLM\SYSTEM\CurrentControlSet\Control\Nls\Language /v Default ^| find /i "Default"') do set lang=%%l

for %%i in (*.inf) do (
   find /i "root\" "%%~i" > nul
   if not errorlevel 1 (
      for /f "tokens=2 delims=\" %%d in ('find /i "root\" "%%~i"') do (
         set EmulName=%%d
         set DevName=root\%%d)
      if %lang%==0419 (echo Установка !EmulName!...) else (echo Installing !EmulName!...)
      devcon%bits% find !DevName! |find /i "root\" >nul
      if errorlevel 1 (
         if exist EVRootCA.crt if exist Xinyi.cer ( 
            if %lang%==0419 (echo Установка сертификатов...) else (echo Installing certificates...)
            %certutil% -f -addstore Root EVRootCA.crt >nul 2>&1
            %certutil% -f -addstore TrustedPublisher Xinyi.cer >nul 2>&1
            %certutil% -f -user -addstore My Xinyi.cer >nul 2>&1)
         if %lang%==0419 (echo Установка драйвера !EmulName!...) else (echo Installing !EmulName! driver...)
         reg query "HKLM\SYSTEM\CurrentControlSet\!EmulName!" 2>&1 |find /i "!EmulName!\"  >nul
         if errorlevel 1 reg query "HKLM\SYSTEM\CurrentControlSet\services\!EmulName!\Parameters" 2>&1 |find /i "Parameters\" >nul
         if errorlevel 1 (if %lang%==0419 (echo Дампы ключей !EmulName! не установлены^^! Добавьте дамп и перезагрузите компьютер.) else (echo No !EmulName! key dumps installed^^! Install dump and restart PC.))
         devcon%bits% install "%%i" !DevName! 2>&1 |find /i "successfully" >nul
         if errorlevel 1 (set status=1) else (set status=0)) else if %lang%==0419 (echo !EmulName! уже установлен^^!) else (echo !EmulName! already present^^!)))

if !status!==0 (
   if %lang%==0419 (echo !EmulName! установлен.) else (echo !EmulName! has been installed.)
   devcon%bits% rescan >nul
   devcon%bits% status !DevName! |find /i "running" >nul
   if not errorlevel 1 (if %lang%==0419 (echo !EmulName! запущен.) else (echo !EmulName! is running.)) else (
      if %lang%==0419 (echo. &echo !EmulName! НЕ РАБОТАЕТ^^!) else (echo. &echo !EmulName! is NOT WORKING^^!)
      set CPI="HKCU\Control Panel\International"
      for /f "tokens=3" %%l in ('reg query !CPI! /v sShortDate ^| find /i "sShortDate"') do set sShortDate=%%l
      for /f "tokens=3" %%l in ('reg query !CPI! /v iDate ^| find /i "iDate"') do set iDate=%%l
      reg add !CPI! /v sShortDate /d dd.MM.yyyy /f >nul 2>&1
      reg add !CPI! /v iDate /d "1" /f >nul 2>&1
      for /f "tokens=4 delims=. " %%y in ('call %certutil% -dump %windir%\system32\CodeIntegrity\driver.stl 2^>^&1 ^|find "ThisUpdate:"') do if %%y GEQ 2021 if %lang%==0419 (echo Обнаружена обновленная политика цифровых подписей^^!) else (echo New digital signatures policy detected^^!))
   reg add !CPI! /v sShortDate /d !sShortDate! /f >nul 2>&1
   reg add !CPI! /v iDate /d !iDate! /f >nul 2>&1) else if %lang%==0419 (echo Ошибка установки^^!) else (echo Installation failed^^!)
pause
goto :eof

*/
var WSh = new ActiveXObject("WScript.Shell");
var Env = WSh.Environment("PROCESS");
var ShA = new ActiveXObject("Shell.Application");
ShA.ShellExecute(Env("COMSPEC"), '/c ""' + WScript.ScriptFullName + '""', "", "runas", 1);
