VirtualBox

source: vbox/trunk/src/VBox/Main/src-all/win/comregister.cmd@ 107362

Last change on this file since 107362 was 107362, checked in by vboxsync, 5 weeks ago

Main,Installer/win: Removed VBoxProxyStubLegacy.dll since we no longer support Vista and older 64-bit windows hosts.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1@echo off
2REM $Id: comregister.cmd 107362 2024-12-18 15:40:40Z vboxsync $
3REM
4REM Script to register the VirtualBox COM classes
5REM (both inproc and out-of-process)
6REM
7
8REM
9REM Copyright (C) 2006-2024 Oracle and/or its affiliates.
10REM
11REM This file is part of VirtualBox base platform packages, as
12REM available from https://www.virtualbox.org.
13REM
14REM This program is free software; you can redistribute it and/or
15REM modify it under the terms of the GNU General Public License
16REM as published by the Free Software Foundation, in version 3 of the
17REM License.
18REM
19REM This program is distributed in the hope that it will be useful, but
20REM WITHOUT ANY WARRANTY; without even the implied warranty of
21REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22REM General Public License for more details.
23REM
24REM You should have received a copy of the GNU General Public License
25REM along with this program; if not, see <https://www.gnu.org/licenses>.
26REM
27REM SPDX-License-Identifier: GPL-3.0-only
28REM
29
30setlocal
31
32REM Check if the current user is an administrator. Otherwise
33REM all the COM registration will fail silently.
34NET FILE 1>NUL 2>NUL & IF ERRORLEVEL 1 (ECHO Must be run as Administrator. Exiting.) & GOTO end
35
36REM
37REM Figure out where the script lives first, so that we can invoke the
38REM correct VBoxSVC and register the right VBoxC.dll.
39REM
40
41REM Determine the current directory.
42set _SCRIPT_CURDIR=%CD%
43for /f "tokens=*" %%d in ('cd') do set _SCRIPT_CURDIR=%%d
44
45REM Determine a correct self - by %0.
46set _SCRIPT_SELF=%0
47if exist "%_SCRIPT_SELF%" goto found_self
48set _SCRIPT_SELF=%_SCRIPT_SELF%.cmd
49if exist "%_SCRIPT_SELF%" goto found_self
50
51REM Determine a correct self - by current working directory.
52set _SCRIPT_SELF=%_SCRIPT_CURDIR%\comregister.cmd
53if exist "%_SCRIPT_SELF%" goto found_self
54
55REM Determine a correct self - by the PATH
56REM This is very verbose because nested for loops didn't work out.
57for /f "tokens=1 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
58if exist "%_SCRIPT_SELF%" goto found_self
59for /f "tokens=2 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
60if exist "%_SCRIPT_SELF%" goto found_self
61for /f "tokens=3 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
62if exist "%_SCRIPT_SELF%" goto found_self
63for /f "tokens=4 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
64if exist "%_SCRIPT_SELF%" goto found_self
65for /f "tokens=5 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
66if exist "%_SCRIPT_SELF%" goto found_self
67for /f "tokens=6 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
68if exist "%_SCRIPT_SELF%" goto found_self
69for /f "tokens=7 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
70if exist "%_SCRIPT_SELF%" goto found_self
71for /f "tokens=8 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
72if exist "%_SCRIPT_SELF%" goto found_self
73for /f "tokens=9 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
74if exist "%_SCRIPT_SELF%" goto found_self
75for /f "tokens=10 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
76if exist "%_SCRIPT_SELF%" goto found_self
77for /f "tokens=11 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
78if exist "%_SCRIPT_SELF%" goto found_self
79for /f "tokens=12 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
80if exist "%_SCRIPT_SELF%" goto found_self
81for /f "tokens=13 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
82if exist "%_SCRIPT_SELF%" goto found_self
83for /f "tokens=14 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
84if exist "%_SCRIPT_SELF%" goto found_self
85for /f "tokens=15 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
86if exist "%_SCRIPT_SELF%" goto found_self
87for /f "tokens=16 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
88if exist "%_SCRIPT_SELF%" goto found_self
89for /f "tokens=17 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
90if exist "%_SCRIPT_SELF%" goto found_self
91for /f "tokens=18 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
92if exist "%_SCRIPT_SELF%" goto found_self
93for /f "tokens=19 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
94if exist "%_SCRIPT_SELF%" goto found_self
95for /f "tokens=20 delims=;" %%d in ("%PATH%") do set _SCRIPT_SELF=%%d\comregister.cmd
96if exist "%_SCRIPT_SELF%" goto found_self
97echo Warning: Not able to determin the comregister.cmd location.
98set _VBOX_DIR=
99goto register
100
101:found_self
102set _VBOX_DIR=
103cd "%_SCRIPT_SELF%\.."
104for /f "tokens=*" %%d in ('cd') do set _VBOX_DIR=%%d\
105cd "%_SCRIPT_CURDIR%"
106
107REM
108REM Check for 64-bitness.
109REM
110set fIs64BitWindows=0
111if not "%ProgramW6432%x" == "x" set fIs64BitWindows=1
112if exist "%windir\syswow64\kernel32.dll" set fIs64BitWindows=1
113
114REM
115REM Parse arguments.
116REM
117set fNoProxy=0
118set fUninstallOnly=0
119
120:arg_loop
121if "%1x" == "x" goto arg_done
122
123if "%1" == "-u" goto arg_uninstall
124if "%1" == "--uninstall" goto arg_uninstall
125if "%1" == "--proxy" goto arg_proxy
126if "%1" == "--no-proxy" goto arg_no_proxy
127echo syntax error: Unknown option %1
128echo usage: comregister.cmd [-u,--uninstall] [--no-proxy] [--proxy]
129goto end
130
131:arg_uninstall
132set fUninstallOnly=1
133goto arg_next
134
135:arg_proxy
136set fNoProxy=0
137goto arg_next
138
139:arg_no_proxy
140set fNoProxy=1
141goto arg_next
142
143:arg_next
144shift
145goto arg_loop
146:arg_done
147
148REM
149REM Do the registrations.
150REM
151@if %fIs64BitWindows% == 1 goto register_amd64
152
153:register_x86
154@echo on
155"%_VBOX_DIR%VBoxSVC.exe" /UnregServer
156regsvr32 /s /u "%_VBOX_DIR%VBoxC.dll"
157%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxProxyStub.dll"
158@if %fUninstallOnly% == 1 goto end
159"%_VBOX_DIR%VBoxSVC.exe" /RegServer
160"%_VBOX_DIR%VBoxSDS.exe" /RegService
161regsvr32 /s "%_VBOX_DIR%VBoxC.dll"
162@if %fNoProxy% == 1 goto end
163if exist "%_VBOX_DIR%VBoxProxyStub.dll" %windir%\system32\regsvr32 /s "%_VBOX_DIR%VBoxProxyStub.dll"
164@echo off
165goto end
166
167REM Unregister all first, then register them. The order matters here.
168:register_amd64
169@echo on
170"%_VBOX_DIR%VBoxSVC.exe" /UnregServer
171"%_VBOX_DIR%VBoxSDS.exe" /UnregService
172%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxC.dll"
173%windir%\syswow64\regsvr32 /s /u "%_VBOX_DIR%x86\VBoxClient-x86.dll"
174%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxProxyStub.dll"
175%windir%\syswow64\regsvr32 /s /u "%_VBOX_DIR%x86\VBoxProxyStub-x86.dll"
176if %fUninstallOnly% == 1 goto end
177"%_VBOX_DIR%VBoxSVC.exe" /RegServer
178"%_VBOX_DIR%VBoxSDS.exe" /RegService
179%windir%\system32\regsvr32 /s "%_VBOX_DIR%VBoxC.dll"
180%windir%\syswow64\regsvr32 /s "%_VBOX_DIR%x86\VBoxClient-x86.dll"
181if %fNoProxy% == 1 goto end
182if exist "%_VBOX_DIR%VBoxProxyStub.dll" %windir%\system32\regsvr32 /s "%_VBOX_DIR%VBoxProxyStub.dll"
183if exist "%_VBOX_DIR%x86\VBoxProxyStub-x86.dll" %windir%\syswow64\regsvr32 /s "%_VBOX_DIR%x86\VBoxProxyStub-x86.dll"
184@echo off
185
186:end
187@endlocal
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette