VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/win/loadall.cmd@ 83780

Last change on this file since 83780 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

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