-
Notifications
You must be signed in to change notification settings - Fork 8
/
register_ocx.bat
82 lines (60 loc) · 1.68 KB
/
register_ocx.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
:: Registers ocx/dll files from install folder
@ECHO OFF
PUSHD .
CALL:CHECK_IF_RUN_AS_ADMIN
SET REG_SUCCESS=1
IF [%1]==[/v] (
:: verbose mode
SET EXTRA_ARGS=
) ELSE IF [%1]==[] (
:: silent mode
SET EXTRA_ARGS=/s
) ELSE (
GOTO OUTPUT_USAGE
)
CALL:REGISTER_ACTIVEX_COMPONENT "%~dp0installer\MBMouse.ocx" %EXTRA_ARGS%
CALL:REGISTER_ACTIVEX_COMPONENT "%~dp0installer\mscomctl.ocx" %EXTRA_ARGS%
CALL:REGISTER_ACTIVEX_COMPONENT "%~dp0installer\COMDLG32.OCX" %EXTRA_ARGS%
::CALL:REGISTER_ACTIVEX_COMPONENT "%~dp0installer\dx8vb.dll" %EXTRA_ARGS%
CALL:REGISTER_ACTIVEX_COMPONENT "%systemroot%\SysWOW64\stdole2.tlb" %EXTRA_ARGS%
CALL:REGISTER_ACTIVEX_COMPONENT "%systemroot%\SysWOW64\dx8vb.dll" %EXTRA_ARGS%
CALL:REGISTER_ACTIVEX_COMPONENT "%systemroot%\SysWOW64\scrrun.dll" %EXTRA_ARGS%
IF NOT %REG_SUCCESS% == 1 (
ECHO.
ECHO Registration FAILED
) ELSE (
ECHO.
ECHO Registration SUCCESSFUL
)
GOTO END
:SHOW_NOADMIN_ERROR
ECHO ERROR: Run as admin!
ECHO ERROR: Registering OCX files requires Admin rights.
GOTO END
:OUTPUT_USAGE
ECHO %1: Registers ocx files from installer folder.
ECHO %1 [/v] <absolute path to ocx/dll file>
ECHO /v - verbose mode: shows popup for each registration result
ECHO /h - display usage
GOTO END
:: functions
:CHECK_IF_RUN_AS_ADMIN
NET SESSION > NUL 2>&1
IF NOT %errorLevel% == 0 GOTO SHOW_NOADMIN_ERROR
GOTO:EOF
:REGISTER_ACTIVEX_COMPONENT
:: unregister first
%systemroot%\SysWOW64\regsvr32.exe /u %2 %1
:: register
%systemroot%\SysWOW64\regsvr32.exe %2 %1
IF NOT %errorLevel% == 0 (
ECHO ERROR: Failed Registering %1 ErrorLevel: %errorLevel%
SET REG_SUCCESS=0
) ELSE (
ECHO SUCCESS: Registered %1
)
GOTO:EOF
:END
PAUSE > NUL
POPD
GOTO:EOF