VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/SharedFolders/VBoxSFInst.cmd@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 22 months 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.9 KB
Line 
1@echo off
2rem $Id: VBoxSFInst.cmd 98103 2023-01-17 14:15:46Z vboxsync $
3rem rem @file
4rem Windows NT batch script for manually installing the shared folders guest addition driver.
5rem
6
7rem
8rem Copyright (C) 2009-2023 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 SPDX-License-Identifier: GPL-3.0-only
27rem
28
29
30setlocal ENABLEEXTENSIONS
31setlocal
32
33rem
34rem VBoxSF.sys should be in the same directory as this script or in the additions output dir.
35rem
36set MY_VBOXSF_SYS=%~dp0VBoxSF.sys
37if exist "%MY_VBOXSF_SYS%" goto found_vboxsf
38set MY_VBOXSF_SYS=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxSF.sys
39if exist "%MY_VBOXSF_SYS%" goto found_vboxsf
40echo VBoxSFInst.cmd: failed to find VBoxSF.sys in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
41goto end
42:found_vboxsf
43
44rem
45rem VBoxMRXNP.dll should be in the same directory as this script or in the additions output dir.
46rem
47set MY_VBOXMRXNP_DLL=%~dp0VBoxMRXNP.dll
48if exist "%MY_VBOXMRXNP_DLL%" goto found_vboxmrxnp
49set MY_VBOXMRXNP_DLL=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxMRXNP.dll
50if exist "%MY_VBOXMRXNP_DLL%" goto found_vboxmrxnp
51echo VBoxSFInst.cmd: failed to find VBoxMRXNP.dll in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
52goto end
53:found_vboxmrxnp
54
55rem 32-bit version of same.
56if not "%PROCESSOR_ARCHITECTURE%" == "AMD64" goto found_vboxmrxnp_x86
57set MY_VBOXMRXNP_X86_DLL=%~dp0VBoxMRXNP-x86.dll
58if exist "%MY_VBOXMRXNP_X86_DLL%" goto found_vboxmrxnp_x86
59set MY_VBOXMRXNP_X86_DLL=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxMRXNP-x86.dll
60if exist "%MY_VBOXMRXNP_X86_DLL%" goto found_vboxmrxnp_x86
61echo VBoxSFInst.cmd: failed to find VBoxMRXNP-x86.dll in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
62goto end
63:found_vboxmrxnp_x86
64
65rem
66rem VBoxDrvInst.exe should be in the same directory as this script or in the additions output dir.
67rem
68set MY_VBOXDRVINST=%~dp0VBoxDrvInst.exe
69if exist "%MY_VBOXDRVINST%" goto found_vboxdrvinst
70set MY_VBOXDRVINST=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxDrvInst.exe
71if exist "%MY_VBOXDRVINST%" goto found_vboxdrvinst
72echo VBoxSFInst.cmd: failed to find VBoxDrvInst.exe in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
73goto end
74:found_vboxdrvinst
75
76rem
77rem Deregister the service, provider and delete old files.
78rem
79echo "Uninstalling..."
80sc stop VBoxSF
81reg delete /f "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "DeviceName"
82reg delete /f "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "Name"
83reg delete /f "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "ProviderPath"
84
85"%MY_VBOXDRVINST%" service delete VBoxSF
86
87del "%SYSTEMROOT%\system32\drivers\VBoxSF.sys"
88del "%SYSTEMROOT%\system32\VBoxMRXNP.dll"
89if "%PROCESSOR_ARCHITECTURE%" == "AMD64" del "%SYSTEMROOT%\SysWOW64\VBoxMRXNP.dll"
90
91
92rem
93rem Install anything?
94rem
95if "%1" == "-u" goto end
96if "%1" == "--uninstall" goto end
97
98rem
99rem Copy the new files to the system dir.
100rem
101echo "Copying files..."
102copy "%MY_VBOXSF_SYS%" "%SYSTEMROOT%\system32\drivers\"
103copy "%MY_VBOXMRXNP_DLL%" "%SYSTEMROOT%\system32\"
104if "%PROCESSOR_ARCHITECTURE%" == "AMD64" copy "%MY_VBOXMRXNP_X86_DLL%" "%SYSTEMROOT%\SysWow64\VBoxMRXNP.dll"
105
106rem
107rem Register the service.
108rem
109echo "Installing service..."
110"%MY_VBOXDRVINST%" service create VBoxSF "VirtualBox Shared Folders" 2 1 "%SYSTEMROOT%\System32\drivers\VBoxSF.sys" NetworkProvider
111
112echo "Configuring network provider..."
113reg add "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "DeviceName" /d "\Device\VBoxMiniRdr"
114reg add "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "Name" /d "VirtualBox Shared Folders"
115reg add "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "ProviderPath" /d "%SYSTEMROOT%\System32\VBoxMRXNP.dll"
116
117"%MY_VBOXDRVINST%" netprovider add VBoxSF 0
118
119rem
120rem Start the service?
121rem
122if "%1" == "-n" goto end
123if "%1" == "--no-start" goto end
124sc start VBoxSF
125
126:end
127endlocal
128endlocal
129
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