VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/win/load.cmd

Last change on this file was 106061, checked in by vboxsync, 4 weeks ago

Copyright year updates by scm.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1@echo off
2rem $Id: load.cmd 106061 2024-09-16 14:03:52Z vboxsync $
3rem rem @file
4rem Windows NT batch script for loading the support driver.
5rem
6
7rem
8rem Copyright (C) 2009-2024 Oracle and/or its affiliates.
9rem
10rem This file is part of VirtualBox base platform packages, as
11rem available from https://www.virtualbox.org.
12rem
13rem This program is free software; you can redistribute it and/or
14rem modify it under the terms of the GNU General Public License
15rem as published by the Free Software Foundation, in version 3 of the
16rem License.
17rem
18rem This program is distributed in the hope that it will be useful, but
19rem WITHOUT ANY WARRANTY; without even the implied warranty of
20rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21rem General Public License for more details.
22rem
23rem You should have received a copy of the GNU General Public License
24rem along with this program; if not, see <https://www.gnu.org/licenses>.
25rem
26rem The contents of this file may alternatively be used under the terms
27rem of the Common Development and Distribution License Version 1.0
28rem (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
29rem in the VirtualBox distribution, in which case the provisions of the
30rem CDDL are applicable instead of those of the GPL.
31rem
32rem You may elect to license modified versions of this file under the
33rem terms and conditions of either the GPL or the CDDL or both.
34rem
35rem SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
36rem
37
38
39setlocal ENABLEEXTENSIONS
40setlocal ENABLEDELAYEDEXPANSION
41setlocal
42
43
44rem
45rem find the directory we're in.
46rem
47set MY_DIR=%~dp0
48if exist "%MY_DIR%\load.cmd" goto dir_okay
49echo load.cmd: failed to find load.sh in "%~dp0".
50goto end
51
52:dir_okay
53rem
54rem We don't use the driver files directly any more because of win10 keeping the open,
55rem so create an alternative directory for the binaries.
56rem
57set MY_ALTDIR=%MY_DIR%\..\LoadedDrivers
58if not exist "%MY_ALTDIR%" mkdir "%MY_ALTDIR%"
59
60rem
61rem Display device states.
62rem
63for %%i in (VBoxNetAdp VBoxNetAdp6 VBoxNetFlt VBoxNetLwf VBoxUSBMon VBoxUSB VBoxSup) do (
64 set type=
65 for /f "usebackq tokens=*" %%f in (`sc query %%i`) do (set xxx=%%f&&if "!xxx:~0,5!" =="STATE" set type=!xxx!)
66 for /f "usebackq tokens=2 delims=:" %%f in ('!type!') do set type=%%f
67 if "!type!x" == "x" set type= not configured, probably
68 echo load.sh: %%i -!type!
69)
70
71rem
72rem Copy uninstallers and installers and VBoxRT into the dir:
73rem
74echo **
75echo ** Copying installers and uninstallers into %MY_ALTDIR%...
76echo **
77set MY_FAILED=no
78for %%i in (NetAdpUninstall.exe NetAdp6Uninstall.exe USBUninstall.exe NetFltUninstall.exe NetLwfUninstall.exe SUPUninstall.exe ^
79 NetAdpInstall.exe NetAdp6Install.exe USBInstall.exe NetFltInstall.exe NetLwfInstall.exe SUPInstall.exe ^
80 VBoxRT.dll) do if exist "%MY_DIR%\%%i" (copy "%MY_DIR%\%%i" "%MY_ALTDIR%\%%i" || set MY_FAILED=yes)
81if "%MY_FAILED%" == "yes" goto end
82
83rem
84rem Unload the drivers.
85rem
86echo **
87echo ** Unloading drivers...
88echo **
89for %%i in (NetAdpUninstall.exe NetAdp6Uninstall.exe USBUninstall.exe NetFltUninstall.exe NetLwfUninstall.exe SUPUninstall.exe) do (
90 if exist "%MY_ALTDIR%\%%i" (echo ** Running %%i...&& "%MY_ALTDIR%\%%i")
91)
92
93rem
94rem Copy the driver files into the directory now that they no longer should be in use and can be overwritten.
95rem
96echo **
97echo ** Copying drivers into %MY_ALTDIR%...
98echo **
99set MY_FAILED=no
100for %%i in (VBoxSup.sys VBoxSup.inf VBoxSup.cat) do if exist "%MY_DIR%\%%i" (copy "%MY_DIR%\%%i" "%MY_ALTDIR%\%%i" || set MY_FAILED=yes)
101if "%MY_FAILED%" == "yes" goto end
102
103rem
104rem Invoke the installer if asked to do so.
105rem
106if "%1%" == "-u" goto end
107if "%1%" == "--uninstall" goto end
108echo **
109echo ** Loading drivers...
110echo **
111for %%i in (SUPInstall.exe) do "%MY_ALTDIR%\%%i" || goto end
112
113:end
114endlocal
115endlocal
116endlocal
117
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