Skip to content

Commit

Permalink
[core] fix DLL build
Browse files Browse the repository at this point in the history
* Closes #238
  • Loading branch information
pbatard committed Jan 30, 2022
1 parent d670251 commit c0c4664
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
8 changes: 4 additions & 4 deletions examples/wdi-simple.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#endif

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,1,765
PRODUCTVERSION 1,4,1,765
FILEVERSION 1,4,1,768
PRODUCTVERSION 1,4,1,768
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -25,13 +25,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "WDI-Simple"
VALUE "FileVersion", "1.4.1.765"
VALUE "FileVersion", "1.4.1.768"
VALUE "InternalName", "WDI-Simple"
VALUE "LegalCopyright", "� 2010-2021 Pete Batard (LGPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/lesser.html"
VALUE "OriginalFilename", "wdi-simple.exe"
VALUE "ProductName", "WDI-Simple"
VALUE "ProductVersion", "1.4.1.765"
VALUE "ProductVersion", "1.4.1.768"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down
2 changes: 1 addition & 1 deletion examples/zadig.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#define FIELD_ORANGE RGB(255,240,200)
#define ARROW_GREEN RGB(92,228,65)
#define ARROW_ORANGE RGB(253,143,56)
#define APP_VERSION "Zadig 2.7.765"
#define APP_VERSION "Zadig 2.7.768"

// These are used to flag end users about the driver they are going to replace
enum driver_type {
Expand Down
8 changes: 4 additions & 4 deletions examples/zadig.rc
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,7,765,0
PRODUCTVERSION 2,7,765,0
FILEVERSION 2,7,768,0
PRODUCTVERSION 2,7,768,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -264,13 +264,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Zadig"
VALUE "FileVersion", "2.7.765"
VALUE "FileVersion", "2.7.768"
VALUE "InternalName", "Zadig"
VALUE "LegalCopyright", "� 2010-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "zadig.exe"
VALUE "ProductName", "Zadig"
VALUE "ProductVersion", "2.7.765"
VALUE "ProductVersion", "2.7.768"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down
6 changes: 3 additions & 3 deletions libwdi/installer.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Library for WinUSB/libusb automated driver installation
* Copyright (c) 2010-2013 Pete Batard <pete@akeo.ie>
* Library for USB automated driver installation
* Copyright (c) 2010-2022 Pete Batard <pete@akeo.ie>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -689,7 +689,7 @@ BOOL disable_system_restore(BOOL enabled)
LONG r;
DWORD disp, regtype, val, val_size=sizeof(DWORD);
HRESULT hr;
IGroupPolicyObject* pLGPO;
IGroupPolicyObject* pLGPO = NULL;
static DWORD original_val = -1; // -1 = key doesn't exist
HKEY machine_key = NULL, disable_system_restore_key = NULL;
// MSVC is finicky about these ones => redefine them
Expand Down
13 changes: 9 additions & 4 deletions libwdi/libwdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,8 @@ static long wdi_tokenize_file(const char* src, char** dst, const token_entity_t*
int LIBWDI_API wdi_prepare_driver(struct wdi_device_info* device_info, const char* path,
const char* inf, struct wdi_options_prepare_driver* options)
{
PF_DECL_LIBRARY(Ntdll);
PF_TYPE_DECL(NTAPI, NTSTATUS, NtQuerySystemInformation, (SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG));
const wchar_t bom = 0xFEFF;
#if defined(ENABLE_DEBUG_LOGGING) || defined(INCLUDE_DEBUG_LOGGING)
const char* driver_display_name[WDI_NB_DRIVERS] = { "WinUSB", "libusb0.sys", "libusbK.sys", "Generic USB CDC", "user driver" };
Expand Down Expand Up @@ -1498,10 +1500,13 @@ int LIBWDI_API wdi_prepare_driver(struct wdi_device_info* device_info, const cha

// Check if testsigning is enabled
// https://social.msdn.microsoft.com/Forums/Windowsapps/en-US/e6c1be93-7003-4594-b8e4-18ab4a75d273/detecting-testsigning-onoff-via-api
sci.Length = sizeof(sci);
if (NtQuerySystemInformation((SYSTEM_INFORMATION_CLASS)0x67, &sci, sizeof(sci), &dwcbSz) >= 0 && dwcbSz == sizeof(sci))
is_test_signing_enabled = !!(sci.CodeIntegrityOptions & 0x02);
wdi_info("Test signing is: %s", is_test_signing_enabled ? "Enabled" : "Disabled");
PF_INIT(NtQuerySystemInformation, Ntdll);
if (pfNtQuerySystemInformation != NULL) {
sci.Length = sizeof(sci);
if (pfNtQuerySystemInformation((SYSTEM_INFORMATION_CLASS)0x67, &sci, sizeof(sci), &dwcbSz) >= 0 && dwcbSz == sizeof(sci))
is_test_signing_enabled = !!(sci.CodeIntegrityOptions & 0x02);
wdi_info("Test signing is: %s", is_test_signing_enabled ? "Enabled" : "Disabled");
}

// Failures on the following are fatal on Windows 10 when test signing is not enabled
if (!CreateCat(cat_path, hw_id, drv_path, cat_list, nb_entries)) {
Expand Down
10 changes: 5 additions & 5 deletions libwdi/libwdi.rc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,1,765
PRODUCTVERSION 1,4,1,765
FILEVERSION 1,4,1,768
PRODUCTVERSION 1,4,1,768
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,13 +68,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "libwdi: Windows Driver Installer Library"
VALUE "FileVersion", "1.4.1.765"
VALUE "FileVersion", "1.4.1.768"
VALUE "InternalName", "libwdi"
VALUE "LegalCopyright", "� 2010-2021 Pete Batard (LGPL v3)"
VALUE "LegalCopyright", "� 2010-2022 Pete Batard (LGPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/lesser.html"
VALUE "OriginalFilename", "libwdi"
VALUE "ProductName", "libwdi"
VALUE "ProductVersion", "1.4.1.765"
VALUE "ProductVersion", "1.4.1.768"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down

0 comments on commit c0c4664

Please sign in to comment.