LoginSignup
2
2

More than 5 years have passed since last update.

Microsoft Security Advisory 2963983

Last updated at Posted at 2014-05-01

Microsoft Security Advisory 2963983 を参考に、ざっくり vgx.dll を登録・解除するバッチファイルを書いてみました。 32-bit Windows のみ対応しています。64-bit Windows で動作させるにはレジストリキー(Wow6432Node)やフォルダー(C:\Windows\SysWOW64)などを考慮して修正する必要があります。

where コマンドがない場合は which をご利用ください。

2963983.bat
@echo off

set SELF=%~n0

setlocal
  echo.
  echo checking prerequisites...
  set PATH=%PATH%;%PROGRAMFILES%\Internet Explorer
  for %%i in (iexplore.exe ping.exe reg.exe regsvr32.exe taskkill.exe tasklist.exe) do (
    where %%i > NUL || (
      (echo %SELF%: file not found: %%i) >&2
      exit /b 1
    )
  )
  call :sleep 2

  echo.
  echo creating VML file...
  (
    echo ^<html xmlns:v="urn:schemas-microsoft-com:vml"^>
    echo ^<head^>
    echo ^<style^>v\:* { behavior: url^(#default#VML^); }^</style^>
    echo ^</head^>
    echo ^<body^>
    echo ^<v:shape fillcolor="#ffcccc" strokecolor="#cfa3a7" style="width: 200; height:200" path="m 80,0 l 60,65, 0,65, 50,100, 25,160,80,120, 135,160, 110,100, 160,65 100,65 x e"^>^</v:shape^>
    echo ^</body^>
    echo ^</html^>
  ) > %SELF%.html

  echo.
  echo launching browser and drawing vector graphic...
  start iexplore %SELF%.html || (
    (echo %SELF%: launching browser failed: start) >&2
    exit /b 1
  )
  call :sleep 3

  echo.
  echo gathering information about vgx.dll...
  tasklist /M "vgx.dll" || (
    (echo %SELF%: gathering information failed: tasklist) >&2
    exit /b 1
  )

  echo.
  echo terminating browser...
  set /p t=press ^<ENTER^> to continue.
  for /f "tokens=2" %%i in ('tasklist /NH /FI "IMAGENAME eq iexplore.exe"') do (
    taskkill /PID %%i > NUL 2>&1 || (
      rem (echo %SELF%: terminating browser failed: taskkill) >&2
    )
  )

  reg query "HKEY_CLASSES_ROOT\CLSID\{10072CEC-8CC1-11D1-986E-00A0C955B42E}\InprocServer32" && (
    echo.
    echo deregistering vgx.dll...
    regsvr32 /u "%COMMONPROGRAMFILES%\Microsoft Shared\VGX\vgx.dll" || (
      (echo %SELF%: deregistering DLL failed: regsvr32) >&2
    )
  ) || (
    echo.
    echo registering vgx.dll...
    regsvr32    "%COMMONPROGRAMFILES%\Microsoft Shared\VGX\vgx.dll" || (
      (echo %SELF%: deregistering DLL failed: regsvr32) >&2
    )
  )

  echo.
  echo launching browser and drawing vector graphic...
  start iexplore %SELF%.html || (
    (echo %SELF%: launching browser failed: start) >&2
    exit /b 1
  )
  call :sleep 3

  echo.
  echo gathering information about vgx.dll...
  tasklist /M "vgx.dll" || (
    (echo %SELF%: gathering information failed: tasklist) >&2
    exit /b 1
  )

  echo.
  echo terminating browser...
  set /p t=press ^<ENTER^> to continue.
  for /f "tokens=2" %%i in ('tasklist /NH /FI "IMAGENAME eq iexplore.exe"') do (
    taskkill /PID %%i > NUL 2>&1 || (
      rem (echo %SELF%: terminating browser failed: taskkill) >&2
    )
  )

  echo.
  echo deleting temporary file...
  if exist "%SELF%.html" (
    del %SELF%.html > NUL || (
      (echo %SELF%: deleting file failed: del) >&2
      exit /b 1
    )
  )

  exit /b 0
endlocal
goto :EOF

:sleep
setlocal
  if "%~1" == "" (
    (echo insufficient argument: #1) >&2
    exit /b 1
  )
  ping -n %~1 127.0.0.1 > NUL 2>&1
endlocal
goto :EOF
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2