VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/UnpackBlessedDrivers.cmd@ 72019

Last change on this file since 72019 was 72019, checked in by vboxsync, 7 years ago

Installer/win: Updated UnpackBlessedDrivers.cmd. bugref:8691

  • 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: UnpackBlessedDrivers.cmd 72019 2018-04-25 14:19:58Z vboxsync $
3rem rem @file
4rem Windows NT batch script for unpacking drivers after being signed.
5rem
6
7rem
8rem Copyright (C) 2018 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 Check for environment variables we need.
25rem
26if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_BIN_PATH is not set & goto end_failed)
27
28rem
29rem Parse arguments.
30rem
31set _MY_OPT_BINDIR=..\bin
32set _MY_OPT_INPUT=
33set _MY_OPT_SIGN_CAT=1
34
35:argument_loop
36if ".%1" == "." goto no_more_arguments
37
38if ".%1" == ".-h" goto opt_h
39if ".%1" == ".-?" goto opt_h
40if ".%1" == "./h" goto opt_h
41if ".%1" == "./H" goto opt_h
42if ".%1" == "./?" goto opt_h
43if ".%1" == ".-help" goto opt_h
44if ".%1" == ".--help" goto opt_h
45
46if ".%1" == ".-b" goto opt_b
47if ".%1" == ".--bindir" goto opt_b
48if ".%1" == ".-i" goto opt_i
49if ".%1" == ".--input" goto opt_i
50if ".%1" == ".-n" goto opt_n
51if ".%1" == ".--no-sign-cat" goto opt_n
52echo syntax error: Unknown option: %1
53echo Try --help to list valid options.
54goto end_failed
55
56:argument_loop_next_with_value
57shift
58shift
59goto argument_loop
60
61:opt_b
62if ".%2" == "." goto syntax_error_missing_value
63set _MY_OPT_BINDIR=%2
64goto argument_loop_next_with_value
65
66:opt_h
67echo This script unpacks the zip-file containing the blessed driver files from
68echo Microsoft, replacing original files in the bin directory. The catalog files
69echo will be signed again and the Microsoft signature merged with ours.
70echo .
71echo Usage: UnpackBlessedDrivers.cmd [-b bindir] [-n/--no-sign-cat] -i input.zip
72echo .
73echo Warning! This script should normally be invoked from the repack directory
74goto end_failed
75
76:opt_i
77if ".%2" == "." goto syntax_error_missing_value
78set _MY_OPT_INPUT=%2
79goto argument_loop_next_with_value
80
81:opt_n
82set _MY_OPT_SIGN_CAT=0
83shift
84goto argument_loop
85
86:syntax_error_missing_value
87echo syntax error: missing or empty option value after %1
88goto end_failed
89
90:error_bindir_does_not_exist
91echo syntax error: Specified BIN directory does not exist: "%_MY_OPT_BINDIR%"
92goto end_failed
93
94:error_input_not_found
95echo error: Input file does not exist: "%_MY_OPT_INPUT%"
96goto end_failed
97
98:no_more_arguments
99rem validate specified options
100if not exist "%_MY_OPT_BINDIR%" goto error_bindir_does_not_exist
101
102rem figure defaults here: if ".%_MY_OPT_INPUT%" == "." if exist "%_MY_OPT_BINDIR%\x86" set _MY_OPT_INPUT=VBoxDrivers-amd64.cab
103rem figure defaults here: if ".%_MY_OPT_INPUT%" == "." set _MY_OPT_INPUT=VBoxDrivers-x86.cab
104if not exist "%_MY_OPT_INPUT%" goto error_input_exists
105
106rem
107rem Unpack the stuff.
108rem
109%KBUILD_DEVTOOLS%\win.x86\bin\unzip.exe -o -j "%_MY_OPT_INPUT%" -d "%_MY_OPT_BINDIR%" || goto end_failed
110
111rem
112rem Modify the catalog signatures.
113rem
114for %cat in (VBoxDrv.cat VBoxNetAdp6.cat VBoxNetLwf.cat VBoxUSB.cat VBoxUSBMon.cat) do (
115 copy /y "%_MY_OPT_BINDIR%\%cat%" "%_MY_OPT_BINDIR%\%cat%.ms" || goto end_failed
116 call sign-dual.cmd "%_MY_OPT_BINDIR%\%cat%" || goto end_failed
117 "%_MY_OPT_BINDIR%\tools\RTSignTool.exe" add-nested-exe-signature -v "%_MY_OPT_BINDIR%\%cat%" "%_MY_OPT_BINDIR%\%cat%.ms" || goto end_failed
118)
119
120goto end
121
122:end_failed
123@endlocal
124@endlocal
125@exit /b 1
126
127:end
128@endlocal
129@endlocal
130
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