aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sign.bat
blob: 9955ac2b9eb62474f2a22c4de57d3569e564dcf0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@rem Copyright (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
@rem This file is part of the "Windows 7 drivers" project.
@rem For details, see https://github.com/egor-tensin/windows7-drivers.
@rem Distributed under the MIT License.

@setlocal enabledelayedexpansion
@echo off

set cert_name=windows7_drivers

if "%~1" == "" (
    echo Usage: %~nx0 SYS_PATH >&2
    exit /b 1
)

set "sys_path=%~f1"

echo ============================ CERT INFO ============================
echo Certificate name: %cert_name%
echo ========================== END CERT INFO ==========================
echo.
echo ============================= SIGNING =============================
call check_ddk.bat || goto :signing_failure
echo signtool.exe sign /s root /n "%cert_name%" "%sys_path%"
     signtool.exe sign /s root /n "%cert_name%" "%sys_path%" >nul || goto :signing_failure
echo signtool.exe verify /pa "%sys_path%"
     signtool.exe verify /pa "%sys_path%" >nul || goto :signing_failure
echo ========================= SIGNING SUCCESS =========================
exit /b 0

:signing_failure
echo ========================= SIGNING FAILURE =========================
exit /b %errorlevel%