Skip to content

Commit

Permalink
libwdi 1.5.0
Browse files Browse the repository at this point in the history
* Also fix static analysis warnings
  • Loading branch information
pbatard committed Mar 1, 2023
1 parent 3baf428 commit 90278c5
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 29 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
For the latest changes, please visit:
https://github.com/pbatard/libwdi/commits/master

o v1.5.0 (2023.03.01)
New features:
- ARM64 driver installation support (WinUSB, USBSer with MSVC only)
Bugfixes:
- fix MSVC compilation of the shared library
- fix MinGW compilation when using the shared library (with thanks to Joel Holdsworth)
Improvements:
- avoid symbol conflicts by using library specific prefixes where needed
- improve Zadig network support

o v1.4.1 (2021.11.01)
New features:
- add a new 'external_inf' boolean option to wdi_options_prepare_driver
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Main features

* Automated inf creation, using reported USB device name
* Automated catalog file creation and signing, using autogenerated certificate
* Automated driver files extraction, for both 32 and 64 bit platforms
* Automated driver files extraction, for x86_32 x86_64 and ARM64 platforms
* Automated driver installation, including UAC elevation where necessary
* Single library embedding all the required files
* Supports Windows platform from Windows 7 to Windows 11
Expand Down
10 changes: 5 additions & 5 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,781
PRODUCTVERSION 1,4,1,781
FILEVERSION 1,5,0,782
PRODUCTVERSION 1,5,0,782
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.781"
VALUE "FileVersion", "1.5.0.782"
VALUE "InternalName", "WDI-Simple"
VALUE "LegalCopyright", "� 2010-2021 Pete Batard (LGPL v3)"
VALUE "LegalCopyright", "� 2010-2023 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.781"
VALUE "ProductVersion", "1.5.0.782"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down
7 changes: 4 additions & 3 deletions examples/zadig.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,12 @@ int get_windows_version(char* WindowsVersionStr, size_t WindowsVersionStrSize)
char* vptr;
size_t vlen;
unsigned major, minor;
int nWindowsVersion, nWindowsBuildNumber;
int nWindowsVersion = WINDOWS_UNDEFINED, nWindowsBuildNumber = 0;
ULONGLONG major_equal, minor_equal;
BOOL ws;

nWindowsVersion = WINDOWS_UNDEFINED;
if (WindowsVersionStr == NULL || WindowsVersionStrSize < 32)
return nWindowsVersion;
safe_strcpy(WindowsVersionStr, WindowsVersionStrSize, "Windows Undefined");

memset(&vi, 0, sizeof(vi));
Expand Down Expand Up @@ -1282,7 +1283,7 @@ BOOL parse_ini(void) {

// Set the log level
profile_get_integer(profile, "general", "log_level", NULL, WDI_LOG_LEVEL_INFO, &log_level);
if ((log_level < WDI_LOG_LEVEL_DEBUG) && (log_level > WDI_LOG_LEVEL_NONE)) {
if ((log_level < WDI_LOG_LEVEL_DEBUG) || (log_level > WDI_LOG_LEVEL_NONE)) {
log_level = WDI_LOG_LEVEL_INFO;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/zadig.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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.781"
#define APP_VERSION "Zadig 2.8.782"

// These are used to flag end users about the driver they are going to replace
enum driver_type {
Expand Down
14 changes: 7 additions & 7 deletions examples/zadig.rc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ BEGIN
LTEXT "WCID",IDC_STATIC_WCID,14,84,18,9,SS_NOTIFY
EDITTEXT IDC_WCID_BOX,40,82,14,14,ES_READONLY | NOT WS_TABSTOP
EDITTEXT IDC_WCID,55,82,44,14,ES_READONLY | NOT WS_VISIBLE | NOT WS_TABSTOP,WS_EX_TRANSPARENT
LTEXT "�",IDC_RARR,142,44,17,14,SS_NOTIFY | SS_CENTERIMAGE | NOT WS_VISIBLE
LTEXT "�",IDC_RARR,142,44,17,14,SS_NOTIFY | SS_CENTERIMAGE | NOT WS_VISIBLE
EDITTEXT IDC_TARGET,162,44,98,14,ES_READONLY | NOT WS_TABSTOP
CONTROL "",IDC_TARGETSPIN,"msctls_updown32",UDS_ARROWKEYS,260,44,11,14,WS_EX_TRANSPARENT
CONTROL IDB_ZADIG,IDC_THIS_SPACE_FOR_RENT,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE,278,37,97,66
Expand Down Expand Up @@ -246,8 +246,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,7,781,0
PRODUCTVERSION 2,7,781,0
FILEVERSION 2,8,782,0
PRODUCTVERSION 2,8,782,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -264,14 +264,14 @@ BEGIN
BEGIN
VALUE "CompanyName", "akeo.ie"
VALUE "FileDescription", "Zadig"
VALUE "FileVersion", "2.7.781"
VALUE "FileVersion", "2.8.782"
VALUE "InternalName", "Zadig"
VALUE "LegalCopyright", "� 2010-2021 Pete Batard (GPL v3)"
VALUE "LegalCopyright", "� 2010-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "zadig.exe"
VALUE "ProductName", "Zadig"
VALUE "ProductVersion", "2.7.781"
VALUE "Comments", "http://libwdi.akeo.ie"
VALUE "ProductVersion", "2.8.782"
VALUE "Comments", "https://zadig.akeo.ie"
END
END
BLOCK "VarFileInfo"
Expand Down
6 changes: 3 additions & 3 deletions libwdi/installer.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ static __inline char* xlocale_to_utf8(const char* str)
}

// +1 for extra leading byte
if ((ustr = (char*)calloc(size+1, 1)) == NULL) {
if ((ustr = (char*)calloc((size_t)size + 1, 1)) == NULL) {
free(wstr);
return NULL;
}

if (wchar_to_utf8_no_alloc(wstr, ustr+1, size) != size) {
if (wchar_to_utf8_no_alloc(wstr, ustr + 1, size) != size) {
free(ustr);
free(wstr);
return NULL;
Expand Down Expand Up @@ -480,7 +480,7 @@ void __cdecl syslog_reader_thread(void* param)

if (size != 0) {
// Read from file and add a zero terminator
buffer = malloc(size+1);
buffer = malloc((size_t)size + 1);
if (buffer == NULL) {
plog("could not allocate buffer to read syslog");
goto out;
Expand Down
4 changes: 2 additions & 2 deletions libwdi/libwdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ static int install_driver_internal(void* arglist)
DWORD err, rd_count, to_read, offset, bufsize = LOGBUF_SIZE;
USHORT platform_arch = get_platform_arch();
int r;
char path[MAX_PATH], exename[MAX_PATH], exeargs[MAX_PATH], installer_name[32];
char path[MAX_PATH], exename[MAX_PATH], exeargs[MAX_PATH], installer_name[32] = { 0 };
char *buffer = NULL, *new_buffer;
const char* filter_name = "libusb0";

Expand Down Expand Up @@ -1768,7 +1768,7 @@ static int install_driver_internal(void* arglist)
static_sprintf(exeargs, "\"%s\"", params->inf_name);
} else {
// Use libusb-win32's filter driver installer
static_strcat(installer_name, "install-filter.exe");
static_strcpy(installer_name, "install-filter.exe");
static_strcat(path, (platform_arch == IMAGE_FILE_MACHINE_AMD64) ? "\\amd64" : "\\x86");
if (safe_stricmp(current_device->upper_filter, filter_name) == 0) {
// Device already has the libusb-win32 filter => remove
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,781
PRODUCTVERSION 1,4,1,781
FILEVERSION 1,5,0,782
PRODUCTVERSION 1,5,0,782
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.781"
VALUE "FileVersion", "1.5.0.782"
VALUE "InternalName", "libwdi"
VALUE "LegalCopyright", "� 2010-2022 Pete Batard (LGPL v3)"
VALUE "LegalCopyright", "� 2010-2023 Pete Batard (LGPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/lesser.html"
VALUE "OriginalFilename", "libwdi"
VALUE "ProductName", "libwdi"
VALUE "ProductVersion", "1.4.1.781"
VALUE "ProductVersion", "1.5.0.782"
VALUE "Comments", "http://libwdi.akeo.ie"
END
END
Expand Down
4 changes: 2 additions & 2 deletions libwdi/msapi_utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,11 @@ static __inline int ComboBox_GetLBTextU(HWND hCtrl, int index, char* lpString)
size = (int)SendMessageW(hCtrl, CB_GETLBTEXTLEN, (WPARAM)index, (LPARAM)0);
if (size < 0)
return size;
wlpString = (wchar_t*)calloc(size+1, sizeof(wchar_t));
wlpString = (wchar_t*)calloc((size_t)size + 1, sizeof(wchar_t));
size = (int)SendMessageW(hCtrl, CB_GETLBTEXT, (WPARAM)index, (LPARAM)wlpString);
err = GetLastError();
if (size > 0)
wchar_to_utf8_no_alloc(wlpString, lpString, size+1);
wchar_to_utf8_no_alloc(wlpString, lpString, size + 1);
wfree(lpString);
SetLastError(err);
return size;
Expand Down

0 comments on commit 90278c5

Please sign in to comment.