Skip to content

Commit 90278c5

Browse files
committed
libwdi 1.5.0
* Also fix static analysis warnings
1 parent 3baf428 commit 90278c5

File tree

10 files changed

+40
-29
lines changed

10 files changed

+40
-29
lines changed

ChangeLog

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
For the latest changes, please visit:
22
https://github.com/pbatard/libwdi/commits/master
33

4+
o v1.5.0 (2023.03.01)
5+
New features:
6+
- ARM64 driver installation support (WinUSB, USBSer with MSVC only)
7+
Bugfixes:
8+
- fix MSVC compilation of the shared library
9+
- fix MinGW compilation when using the shared library (with thanks to Joel Holdsworth)
10+
Improvements:
11+
- avoid symbol conflicts by using library specific prefixes where needed
12+
- improve Zadig network support
13+
414
o v1.4.1 (2021.11.01)
515
New features:
616
- add a new 'external_inf' boolean option to wdi_options_prepare_driver

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Main features
1212

1313
* Automated inf creation, using reported USB device name
1414
* Automated catalog file creation and signing, using autogenerated certificate
15-
* Automated driver files extraction, for both 32 and 64 bit platforms
15+
* Automated driver files extraction, for x86_32 x86_64 and ARM64 platforms
1616
* Automated driver installation, including UAC elevation where necessary
1717
* Single library embedding all the required files
1818
* Supports Windows platform from Windows 7 to Windows 11

examples/wdi-simple.rc

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#endif
88

99
VS_VERSION_INFO VERSIONINFO
10-
FILEVERSION 1,4,1,781
11-
PRODUCTVERSION 1,4,1,781
10+
FILEVERSION 1,5,0,782
11+
PRODUCTVERSION 1,5,0,782
1212
FILEFLAGSMASK 0x17L
1313
#ifdef _DEBUG
1414
FILEFLAGS 0x1L
@@ -25,13 +25,13 @@ BEGIN
2525
BEGIN
2626
VALUE "CompanyName", "akeo.ie"
2727
VALUE "FileDescription", "WDI-Simple"
28-
VALUE "FileVersion", "1.4.1.781"
28+
VALUE "FileVersion", "1.5.0.782"
2929
VALUE "InternalName", "WDI-Simple"
30-
VALUE "LegalCopyright", "� 2010-2021 Pete Batard (LGPL v3)"
30+
VALUE "LegalCopyright", "� 2010-2023 Pete Batard (LGPL v3)"
3131
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/lesser.html"
3232
VALUE "OriginalFilename", "wdi-simple.exe"
3333
VALUE "ProductName", "WDI-Simple"
34-
VALUE "ProductVersion", "1.4.1.781"
34+
VALUE "ProductVersion", "1.5.0.782"
3535
VALUE "Comments", "http://libwdi.akeo.ie"
3636
END
3737
END

examples/zadig.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,12 @@ int get_windows_version(char* WindowsVersionStr, size_t WindowsVersionStrSize)
936936
char* vptr;
937937
size_t vlen;
938938
unsigned major, minor;
939-
int nWindowsVersion, nWindowsBuildNumber;
939+
int nWindowsVersion = WINDOWS_UNDEFINED, nWindowsBuildNumber = 0;
940940
ULONGLONG major_equal, minor_equal;
941941
BOOL ws;
942942

943-
nWindowsVersion = WINDOWS_UNDEFINED;
943+
if (WindowsVersionStr == NULL || WindowsVersionStrSize < 32)
944+
return nWindowsVersion;
944945
safe_strcpy(WindowsVersionStr, WindowsVersionStrSize, "Windows Undefined");
945946

946947
memset(&vi, 0, sizeof(vi));
@@ -1282,7 +1283,7 @@ BOOL parse_ini(void) {
12821283

12831284
// Set the log level
12841285
profile_get_integer(profile, "general", "log_level", NULL, WDI_LOG_LEVEL_INFO, &log_level);
1285-
if ((log_level < WDI_LOG_LEVEL_DEBUG) && (log_level > WDI_LOG_LEVEL_NONE)) {
1286+
if ((log_level < WDI_LOG_LEVEL_DEBUG) || (log_level > WDI_LOG_LEVEL_NONE)) {
12861287
log_level = WDI_LOG_LEVEL_INFO;
12871288
}
12881289

examples/zadig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#define FIELD_ORANGE RGB(255,240,200)
6161
#define ARROW_GREEN RGB(92,228,65)
6262
#define ARROW_ORANGE RGB(253,143,56)
63-
#define APP_VERSION "Zadig 2.7.781"
63+
#define APP_VERSION "Zadig 2.8.782"
6464

6565
// These are used to flag end users about the driver they are going to replace
6666
enum driver_type {

examples/zadig.rc

+7-7
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ BEGIN
151151
LTEXT "WCID",IDC_STATIC_WCID,14,84,18,9,SS_NOTIFY
152152
EDITTEXT IDC_WCID_BOX,40,82,14,14,ES_READONLY | NOT WS_TABSTOP
153153
EDITTEXT IDC_WCID,55,82,44,14,ES_READONLY | NOT WS_VISIBLE | NOT WS_TABSTOP,WS_EX_TRANSPARENT
154-
LTEXT "�",IDC_RARR,142,44,17,14,SS_NOTIFY | SS_CENTERIMAGE | NOT WS_VISIBLE
154+
LTEXT "�",IDC_RARR,142,44,17,14,SS_NOTIFY | SS_CENTERIMAGE | NOT WS_VISIBLE
155155
EDITTEXT IDC_TARGET,162,44,98,14,ES_READONLY | NOT WS_TABSTOP
156156
CONTROL "",IDC_TARGETSPIN,"msctls_updown32",UDS_ARROWKEYS,260,44,11,14,WS_EX_TRANSPARENT
157157
CONTROL IDB_ZADIG,IDC_THIS_SPACE_FOR_RENT,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE,278,37,97,66
@@ -246,8 +246,8 @@ END
246246
//
247247

248248
VS_VERSION_INFO VERSIONINFO
249-
FILEVERSION 2,7,781,0
250-
PRODUCTVERSION 2,7,781,0
249+
FILEVERSION 2,8,782,0
250+
PRODUCTVERSION 2,8,782,0
251251
FILEFLAGSMASK 0x17L
252252
#ifdef _DEBUG
253253
FILEFLAGS 0x1L
@@ -264,14 +264,14 @@ BEGIN
264264
BEGIN
265265
VALUE "CompanyName", "akeo.ie"
266266
VALUE "FileDescription", "Zadig"
267-
VALUE "FileVersion", "2.7.781"
267+
VALUE "FileVersion", "2.8.782"
268268
VALUE "InternalName", "Zadig"
269-
VALUE "LegalCopyright", "� 2010-2021 Pete Batard (GPL v3)"
269+
VALUE "LegalCopyright", "� 2010-2023 Pete Batard (GPL v3)"
270270
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html"
271271
VALUE "OriginalFilename", "zadig.exe"
272272
VALUE "ProductName", "Zadig"
273-
VALUE "ProductVersion", "2.7.781"
274-
VALUE "Comments", "http://libwdi.akeo.ie"
273+
VALUE "ProductVersion", "2.8.782"
274+
VALUE "Comments", "https://zadig.akeo.ie"
275275
END
276276
END
277277
BLOCK "VarFileInfo"

libwdi/installer.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,12 @@ static __inline char* xlocale_to_utf8(const char* str)
365365
}
366366

367367
// +1 for extra leading byte
368-
if ((ustr = (char*)calloc(size+1, 1)) == NULL) {
368+
if ((ustr = (char*)calloc((size_t)size + 1, 1)) == NULL) {
369369
free(wstr);
370370
return NULL;
371371
}
372372

373-
if (wchar_to_utf8_no_alloc(wstr, ustr+1, size) != size) {
373+
if (wchar_to_utf8_no_alloc(wstr, ustr + 1, size) != size) {
374374
free(ustr);
375375
free(wstr);
376376
return NULL;
@@ -480,7 +480,7 @@ void __cdecl syslog_reader_thread(void* param)
480480

481481
if (size != 0) {
482482
// Read from file and add a zero terminator
483-
buffer = malloc(size+1);
483+
buffer = malloc((size_t)size + 1);
484484
if (buffer == NULL) {
485485
plog("could not allocate buffer to read syslog");
486486
goto out;

libwdi/libwdi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ static int install_driver_internal(void* arglist)
16931693
DWORD err, rd_count, to_read, offset, bufsize = LOGBUF_SIZE;
16941694
USHORT platform_arch = get_platform_arch();
16951695
int r;
1696-
char path[MAX_PATH], exename[MAX_PATH], exeargs[MAX_PATH], installer_name[32];
1696+
char path[MAX_PATH], exename[MAX_PATH], exeargs[MAX_PATH], installer_name[32] = { 0 };
16971697
char *buffer = NULL, *new_buffer;
16981698
const char* filter_name = "libusb0";
16991699

@@ -1768,7 +1768,7 @@ static int install_driver_internal(void* arglist)
17681768
static_sprintf(exeargs, "\"%s\"", params->inf_name);
17691769
} else {
17701770
// Use libusb-win32's filter driver installer
1771-
static_strcat(installer_name, "install-filter.exe");
1771+
static_strcpy(installer_name, "install-filter.exe");
17721772
static_strcat(path, (platform_arch == IMAGE_FILE_MACHINE_AMD64) ? "\\amd64" : "\\x86");
17731773
if (safe_stricmp(current_device->upper_filter, filter_name) == 0) {
17741774
// Device already has the libusb-win32 filter => remove

libwdi/libwdi.rc

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ END
5050
//
5151

5252
VS_VERSION_INFO VERSIONINFO
53-
FILEVERSION 1,4,1,781
54-
PRODUCTVERSION 1,4,1,781
53+
FILEVERSION 1,5,0,782
54+
PRODUCTVERSION 1,5,0,782
5555
FILEFLAGSMASK 0x17L
5656
#ifdef _DEBUG
5757
FILEFLAGS 0x1L
@@ -68,13 +68,13 @@ BEGIN
6868
BEGIN
6969
VALUE "CompanyName", "akeo.ie"
7070
VALUE "FileDescription", "libwdi: Windows Driver Installer Library"
71-
VALUE "FileVersion", "1.4.1.781"
71+
VALUE "FileVersion", "1.5.0.782"
7272
VALUE "InternalName", "libwdi"
73-
VALUE "LegalCopyright", "� 2010-2022 Pete Batard (LGPL v3)"
73+
VALUE "LegalCopyright", "� 2010-2023 Pete Batard (LGPL v3)"
7474
VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/lesser.html"
7575
VALUE "OriginalFilename", "libwdi"
7676
VALUE "ProductName", "libwdi"
77-
VALUE "ProductVersion", "1.4.1.781"
77+
VALUE "ProductVersion", "1.5.0.782"
7878
VALUE "Comments", "http://libwdi.akeo.ie"
7979
END
8080
END

libwdi/msapi_utf8.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,11 @@ static __inline int ComboBox_GetLBTextU(HWND hCtrl, int index, char* lpString)
439439
size = (int)SendMessageW(hCtrl, CB_GETLBTEXTLEN, (WPARAM)index, (LPARAM)0);
440440
if (size < 0)
441441
return size;
442-
wlpString = (wchar_t*)calloc(size+1, sizeof(wchar_t));
442+
wlpString = (wchar_t*)calloc((size_t)size + 1, sizeof(wchar_t));
443443
size = (int)SendMessageW(hCtrl, CB_GETLBTEXT, (WPARAM)index, (LPARAM)wlpString);
444444
err = GetLastError();
445445
if (size > 0)
446-
wchar_to_utf8_no_alloc(wlpString, lpString, size+1);
446+
wchar_to_utf8_no_alloc(wlpString, lpString, size + 1);
447447
wfree(lpString);
448448
SetLastError(err);
449449
return size;

0 commit comments

Comments
 (0)