From: Zebediah Figura zfigura@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48455 --- dlls/setupapi/queue.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c index 40e106fffcd..6ee4e0af9e1 100644 --- a/dlls/setupapi/queue.c +++ b/dlls/setupapi/queue.c @@ -293,13 +293,16 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARAMS_W *params, WCHAR *src_root, WCHAR *src_path) { - INFCONTEXT file_ctx, disk_ctx; - INT id, diskid; + INFCONTEXT disk_ctx; + UINT diskid; + INT id; DWORD len;
- /* find the SourceDisksFiles entry */ - if (!SetupFindFirstLineW( hinf, L"SourceDisksFiles", src_file, &file_ctx )) return; - if (!SetupGetIntField( &file_ctx, 1, &diskid )) return; + if (!SetupGetSourceFileLocationW( hinf, NULL, src_file, &diskid, src_path, MAX_PATH, &len )) + return; + + if (len > sizeof(WCHAR)) + params->SourcePath = src_path;
/* now find the diskid in the SourceDisksNames section */ if (!SetupFindFirstLineW( hinf, L"SourceDisksNames", NULL, &disk_ctx )) return; @@ -324,12 +327,6 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA SetupGetStringFieldW( &disk_ctx, 4, src_root + lstrlenW( src_root ), MAX_PATH - lstrlenW( src_root ), NULL ); } - - if (SetupGetStringFieldW( &file_ctx, 2, NULL, 0, &len ) && len > sizeof(WCHAR) && len < MAX_PATH) - { - SetupGetStringFieldW( &file_ctx, 2, src_path, MAX_PATH, NULL ); - params->SourcePath = src_path; - } }
/***********************************************************************
From: Zebediah Figura zfigura@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48455 --- dlls/setupapi/queue.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c index 6ee4e0af9e1..c54c1949cf2 100644 --- a/dlls/setupapi/queue.c +++ b/dlls/setupapi/queue.c @@ -293,9 +293,7 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARAMS_W *params, WCHAR *src_root, WCHAR *src_path) { - INFCONTEXT disk_ctx; UINT diskid; - INT id; DWORD len;
if (!SetupGetSourceFileLocationW( hinf, NULL, src_file, &diskid, src_path, MAX_PATH, &len )) @@ -304,27 +302,19 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA if (len > sizeof(WCHAR)) params->SourcePath = src_path;
- /* now find the diskid in the SourceDisksNames section */ - if (!SetupFindFirstLineW( hinf, L"SourceDisksNames", NULL, &disk_ctx )) return; - for (;;) - { - if (SetupGetIntField( &disk_ctx, 0, &id ) && (id == diskid)) break; - if (!SetupFindNextLine( &disk_ctx, &disk_ctx )) return; - } - - if (SetupGetStringFieldW( &disk_ctx, 1, NULL, 0, &len ) && len > sizeof(WCHAR) + if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_DESCRIPTION, NULL, 0, &len ) && len > sizeof(WCHAR) && (params->SourceDescription = malloc( len * sizeof(WCHAR) ))) - SetupGetStringFieldW( &disk_ctx, 1, (WCHAR *)params->SourceDescription, len, NULL ); + SetupGetSourceInfoW( hinf, diskid, SRCINFO_DESCRIPTION, (WCHAR *)params->SourceDescription, len, NULL );
- if (SetupGetStringFieldW( &disk_ctx, 2, NULL, 0, &len ) && len > sizeof(WCHAR) + if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_TAGFILE, NULL, 0, &len ) && len > sizeof(WCHAR) && (params->SourceTagfile = malloc( len * sizeof(WCHAR) ))) - SetupGetStringFieldW( &disk_ctx, 2, (WCHAR *)params->SourceTagfile, len, NULL ); + SetupGetSourceInfoW( hinf, diskid, SRCINFO_TAGFILE, (WCHAR *)params->SourceTagfile, len, NULL );
- if (SetupGetStringFieldW( &disk_ctx, 4, NULL, 0, &len ) && len > sizeof(WCHAR) + if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_PATH, NULL, 0, &len ) && len > sizeof(WCHAR) && len < MAX_PATH - lstrlenW( src_root ) - 1) { lstrcatW( src_root, L"\" ); - SetupGetStringFieldW( &disk_ctx, 4, src_root + lstrlenW( src_root ), + SetupGetSourceInfoW( hinf, diskid, SRCINFO_PATH, src_root + lstrlenW( src_root ), MAX_PATH - lstrlenW( src_root ), NULL ); } }
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/setupapi/tests/install.c | 78 +++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+)
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c index d33925f128e..9f5260359a5 100644 --- a/dlls/setupapi/tests/install.c +++ b/dlls/setupapi/tests/install.c @@ -35,6 +35,23 @@
#include "wine/test.h"
+#ifdef __i386__ +#define MYEXT "x86" +#define WRONGEXT "ARM" +#elif defined(__x86_64__) +#define MYEXT "AMD64" +#define WRONGEXT "ARM64" +#elif defined(__arm__) +#define MYEXT "ARM" +#define WRONGEXT "x86" +#elif defined(__aarch64__) +#define MYEXT "ARM64" +#define WRONGEXT "AMD64" +#else +#define MYEXT +#define WRONGEXT +#endif + static const char inffile[] = "test.inf"; static const WCHAR inffileW[] = {'t','e','s','t','.','i','n','f',0}; static char CURR_DIR[MAX_PATH]; @@ -89,6 +106,12 @@ static void create_file(const char *filename) create_inf_file(filename, "dummy"); }
+static void create_directory(const char *name) +{ + BOOL ret = CreateDirectoryA(name, NULL); + ok(ret, "Failed to create %s, error %lu.\n", name, GetLastError()); +} + static BOOL delete_file(const char *filename) { if (GetFileAttributesA(filename) & FILE_ATTRIBUTE_DIRECTORY) @@ -2393,6 +2416,60 @@ static void test_append_reg(void) ok(ret, "Failed to delete INF file, error %lu.\n", GetLastError()); }
+static void test_source_disks_architecture(void) +{ + static const char inf_data[] = + "[Version]\n" + "Signature="$Chicago$"\n" + "[install_section]\n" + "CopyFiles=section1\n" + "[section1]\n" + "one.txt\n" + "[SourceDisksNames." MYEXT "]\n" + "1=,,,heis\n" + "2=,,,duo\n" + "[SourceDisksNames." WRONGEXT "]\n" + "1=,,,treis\n" + "2=,,,tessares\n" + "[SourceDisksFiles." MYEXT "]\n" + "one.txt=1\n" + "[SourceDisksFiles." WRONGEXT "]\n" + "one.txt=2\n" + "[DestinationDirs]\n" + "DefaultDestDir=40000,dst\n"; + + char path[MAX_PATH]; + void *context; + HINF hinf; + BOOL ret; + + create_inf_file(inffile, inf_data); + + sprintf(path, "%s\%s", CURR_DIR, inffile); + hinf = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); + ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#lx.\n", GetLastError()); + + create_directory("src"); + create_directory("src/heis"); + create_file("src/heis/one.txt"); + create_directory("dst"); + + context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, 0); + ret = SetupInstallFromInfSectionA(NULL, hinf, "install_section", SPINST_FILES, + NULL, "src", 0, SetupDefaultQueueCallbackA, context, NULL, NULL); + ok(ret, "Failed to install, error %#lx.\n", GetLastError()); + SetupTermDefaultQueueCallback(context); + + ok(delete_file("dst/one.txt"), "Destination file should exist.\n"); + + SetupCloseInfFile(hinf); + delete_file("src/heis/one.txt"); + delete_file("src/heis"); + delete_file("src/"); + delete_file("dst/"); + ok(delete_file(inffile), "Failed to delete INF file.\n"); +} + static WCHAR service_name[] = L"Wine Test Service"; static SERVICE_STATUS_HANDLE service_handle; static HANDLE stop_event; @@ -2503,6 +2580,7 @@ START_TEST(install) test_register_dlls(); test_rename(); test_append_reg(); + test_source_disks_architecture();
UnhookWindowsHookEx(hhook);
From: Zebediah Figura zfigura@codeweavers.com
"len" is in characters, not bytes. --- dlls/setupapi/queue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c index c54c1949cf2..1c43808bc5f 100644 --- a/dlls/setupapi/queue.c +++ b/dlls/setupapi/queue.c @@ -299,18 +299,18 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA if (!SetupGetSourceFileLocationW( hinf, NULL, src_file, &diskid, src_path, MAX_PATH, &len )) return;
- if (len > sizeof(WCHAR)) + if (len > 1) params->SourcePath = src_path;
- if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_DESCRIPTION, NULL, 0, &len ) && len > sizeof(WCHAR) + if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_DESCRIPTION, NULL, 0, &len ) && len > 1 && (params->SourceDescription = malloc( len * sizeof(WCHAR) ))) SetupGetSourceInfoW( hinf, diskid, SRCINFO_DESCRIPTION, (WCHAR *)params->SourceDescription, len, NULL );
- if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_TAGFILE, NULL, 0, &len ) && len > sizeof(WCHAR) + if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_TAGFILE, NULL, 0, &len ) && len > 1 && (params->SourceTagfile = malloc( len * sizeof(WCHAR) ))) SetupGetSourceInfoW( hinf, diskid, SRCINFO_TAGFILE, (WCHAR *)params->SourceTagfile, len, NULL );
- if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_PATH, NULL, 0, &len ) && len > sizeof(WCHAR) + if (SetupGetSourceInfoW( hinf, diskid, SRCINFO_PATH, NULL, 0, &len ) && len > 1 && len < MAX_PATH - lstrlenW( src_root ) - 1) { lstrcatW( src_root, L"\" );
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147131
Your paranoid android.
=== debian11b (64 bit WoW report) ===
ddraw: ddraw1.c:3645: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31969).