VirtualBox

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

Last change on this file since 93668 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1@echo off
2rem $Id: VBoxSFInst.cmd 93115 2022-01-01 11:31: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-2022 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
18
19
20setlocal ENABLEEXTENSIONS
21setlocal
22
23rem
24rem VBoxSF.sys should be in the same directory as this script or in the additions output dir.
25rem
26set MY_VBOXSF_SYS=%~dp0VBoxSF.sys
27if exist "%MY_VBOXSF_SYS%" goto found_vboxsf
28set MY_VBOXSF_SYS=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxSF.sys
29if exist "%MY_VBOXSF_SYS%" goto found_vboxsf
30echo VBoxSFInst.cmd: failed to find VBoxSF.sys in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
31goto end
32:found_vboxsf
33
34rem
35rem VBoxMRXNP.dll should be in the same directory as this script or in the additions output dir.
36rem
37set MY_VBOXMRXNP_DLL=%~dp0VBoxMRXNP.dll
38if exist "%MY_VBOXMRXNP_DLL%" goto found_vboxmrxnp
39set MY_VBOXMRXNP_DLL=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxMRXNP.dll
40if exist "%MY_VBOXMRXNP_DLL%" goto found_vboxmrxnp
41echo VBoxSFInst.cmd: failed to find VBoxMRXNP.dll in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
42goto end
43:found_vboxmrxnp
44
45rem 32-bit version of same.
46if not "%PROCESSOR_ARCHITECTURE%" == "AMD64" goto found_vboxmrxnp_x86
47set MY_VBOXMRXNP_X86_DLL=%~dp0VBoxMRXNP-x86.dll
48if exist "%MY_VBOXMRXNP_X86_DLL%" goto found_vboxmrxnp_x86
49set MY_VBOXMRXNP_X86_DLL=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxMRXNP-x86.dll
50if exist "%MY_VBOXMRXNP_X86_DLL%" goto found_vboxmrxnp_x86
51echo VBoxSFInst.cmd: failed to find VBoxMRXNP-x86.dll in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
52goto end
53:found_vboxmrxnp_x86
54
55rem
56rem VBoxDrvInst.exe should be in the same directory as this script or in the additions output dir.
57rem
58set MY_VBOXDRVINST=%~dp0VBoxDrvInst.exe
59if exist "%MY_VBOXDRVINST%" goto found_vboxdrvinst
60set MY_VBOXDRVINST=%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\VBoxDrvInst.exe
61if exist "%MY_VBOXDRVINST%" goto found_vboxdrvinst
62echo VBoxSFInst.cmd: failed to find VBoxDrvInst.exe in either "%~dp0" or "%~dp0..\..\..\..\..\out\win.%KBUILD_TARGET_ARCH%\%KBUILD_TYPE%\bin\additions\".
63goto end
64:found_vboxdrvinst
65
66rem
67rem Deregister the service, provider and delete old files.
68rem
69echo "Uninstalling..."
70sc stop VBoxSF
71reg delete /f "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "DeviceName"
72reg delete /f "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "Name"
73reg delete /f "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "ProviderPath"
74
75"%MY_VBOXDRVINST%" service delete VBoxSF
76
77del "%SYSTEMROOT%\system32\drivers\VBoxSF.sys"
78del "%SYSTEMROOT%\system32\VBoxMRXNP.dll"
79if "%PROCESSOR_ARCHITECTURE%" == "AMD64" del "%SYSTEMROOT%\SysWOW64\VBoxMRXNP.dll"
80
81
82rem
83rem Install anything?
84rem
85if "%1" == "-u" goto end
86if "%1" == "--uninstall" goto end
87
88rem
89rem Copy the new files to the system dir.
90rem
91echo "Copying files..."
92copy "%MY_VBOXSF_SYS%" "%SYSTEMROOT%\system32\drivers\"
93copy "%MY_VBOXMRXNP_DLL%" "%SYSTEMROOT%\system32\"
94if "%PROCESSOR_ARCHITECTURE%" == "AMD64" copy "%MY_VBOXMRXNP_X86_DLL%" "%SYSTEMROOT%\SysWow64\VBoxMRXNP.dll"
95
96rem
97rem Register the service.
98rem
99echo "Installing service..."
100"%MY_VBOXDRVINST%" service create VBoxSF "VirtualBox Shared Folders" 2 1 "%SYSTEMROOT%\System32\drivers\VBoxSF.sys" NetworkProvider
101
102echo "Configuring network provider..."
103reg add "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "DeviceName" /d "\Device\VBoxMiniRdr"
104reg add "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "Name" /d "VirtualBox Shared Folders"
105reg add "HKLM\SYSTEM\CurrentControlSet\Services\VBoxSF\NetworkProvider" /v "ProviderPath" /d "%SYSTEMROOT%\System32\VBoxMRXNP.dll"
106
107"%MY_VBOXDRVINST%" netprovider add VBoxSF 0
108
109rem
110rem Start the service?
111rem
112if "%1" == "-n" goto end
113if "%1" == "--no-start" goto end
114sc start VBoxSF
115
116:end
117endlocal
118endlocal
119
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