677ba8680f
This requires us to make some insane conversions between INF date, JavaScript time, and finally Windows file time. The point is to mimic SystemTimeToFileTime, which is what SpInf.dll's pSetupStringToDriverDate does on the YYYY-MM-DD from the INF. The result is that we no longer have to parse an ancient text format in C at runtime. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18 lines
761 B
JavaScript
18 lines
761 B
JavaScript
/* SPDX-License-Identifier: GPL-2.0
|
|
*
|
|
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
|
*/
|
|
|
|
while (!WScript.StdIn.AtEndOfStream) {
|
|
var line = WScript.StdIn.ReadLine();
|
|
if (line.substr(0, 12) != "DriverVer = ")
|
|
continue;
|
|
var val = line.substr(12).split(",");
|
|
var date = val[0].split("/");
|
|
var ver = val[1].split(".");
|
|
var time = Date.UTC(date[2], date[0] - 1, date[1]).toString()
|
|
WScript.Echo("#define WINTUN_INF_FILETIME { (DWORD)((" + time + "ULL * 10000ULL + 116444736000000000ULL) & 0xffffffffU), (DWORD)((" + time + "ULL * 10000ULL + 116444736000000000ULL) >> 32) }")
|
|
WScript.Echo("#define WINTUN_INF_VERSION ((" + ver[0] + "ULL << 48) | (" + ver[1] + "ULL << 32) | (" + ver[2] + "ULL << 16) | (" + ver[3] + "ULL << 0))")
|
|
break;
|
|
}
|