[WINESYNC] setupapi: Avoid debugstr buffer overflow.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 88e28d971bd119f214e29d4ebfa819af9f18f5b7 by Józef Kucia <jkucia@codeweavers.com>

[WINESYNC] setupapi: Handle an empty string for the source file in SetupQueueCopySection().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47185
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 86724af01241b257a4b4b39682031c9c7a3aaeaa by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi/tests: Add some basic tests for SetupDi{Get, Set}DeviceInstallParams().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 45d199023f440209c5753e055db233924664df22 by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi/tests: Add tests for SetupDiGetActualSectionToInstall().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 6244f05941f13bf330d68208849d74ae54f116a0 by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi: Return the section name in SetupDiGetActualSectionToInstall() even if it doesn't exist.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 23320d05b628575ab9ccb44e4482a30268e9a93e by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi/tests: Add some tests for SetupInstallFile().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 2ddc60c8f0276c739b2f512397d32e1b9425e4b0 by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi: Retrieve the default destination path in SetupInstallFile().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id d5f6d6419b16ef81ce882f01a318189251320fcb by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi: Clear the Win32 error if no copy was necessary.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id a748f685a502891bc8fa5f4719f80b6feb39ac9c by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi: Don't fail a queued copy if no copy was necessary.

This fixes a regression introduced by 3e5c9798a80641e0e39e95e4467c60405b22b062.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47219
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 8bc25b24af0276985ad080c8364c11cfff3a1fe5 by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi/tests: Add tests for building and enumerating driver lists.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 57c3ebec7c803857f39a6cb1033f8a67e3949190 by Zebediah Figura <z.figura12@gmail.com>

[WINESYNC] setupapi: Add a basic implementation of SetupDiCallClassInstaller().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 43ee138d4747722cfc7d27e59014a47c3003a898 by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
winesync 2023-09-25 17:37:59 +02:00 committed by Hermès Bélusca-Maïto
parent b22b28a68d
commit 2e5c712eb6
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
5 changed files with 655 additions and 32 deletions

View file

@ -922,6 +922,7 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
SP_FILE_COPY_PARAMS_W params;
INT flags;
BOOL ret;
DWORD len;
TRACE("queue %p, src_root %s, hinf %p, hlist %p, section %s, style %#x.\n",
queue, debugstr_w(src_root), hinf, hlist, debugstr_w(section), style);
@ -993,7 +994,7 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
if (!SetupGetStringFieldW( &context, 1, dst_file, ARRAY_SIZE( dst_file ), NULL ))
goto end;
if (!SetupGetStringFieldW( &context, 2, src_file, ARRAY_SIZE( src_file ), NULL ))
if (!SetupGetStringFieldW( &context, 2, src_file, ARRAY_SIZE( src_file ), &len ) || len <= sizeof(WCHAR))
strcpyW( src_file, dst_file );
if (!SetupGetIntField( &context, 4, &flags )) flags = 0; /* FIXME */
@ -1396,6 +1397,8 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
#endif
TRACE("Did copy... rc was %i\n",rc);
}
else
SetLastError(ERROR_SUCCESS);
/* after copy processing */
if (style & SP_COPY_DELETESOURCE)
@ -1467,7 +1470,7 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
static const WCHAR CopyFiles[] = {'C','o','p','y','F','i','l','e','s',0};
BOOL ret, absolute = (root && *root && !(style & SP_COPY_SOURCE_ABSOLUTE));
WCHAR *buffer, *p, *inf_source = NULL;
WCHAR *buffer, *p, *inf_source = NULL, dest_path[MAX_PATH];
unsigned int len;
TRACE("%p %p %s %s %s %x %p %p %p\n", hinf, inf_context, debugstr_w(source), debugstr_w(root),
@ -1475,8 +1478,11 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
if (in_use) FIXME("no file in use support\n");
dest_path[0] = 0;
if (hinf)
{
WCHAR *dest_dir;
INFCONTEXT ctx;
if (!inf_context)
@ -1496,6 +1502,13 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
return FALSE;
}
source = inf_source;
if ((dest_dir = get_destination_dir( hinf, NULL )))
{
strcpyW( dest_path, dest_dir );
strcatW( dest_path, backslashW );
heap_free( dest_dir );
}
}
else if (!source)
{
@ -1522,7 +1535,9 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
while (*source == '\\') source++;
strcpyW( p, source );
ret = do_file_copyW( buffer, dest, style, handler, context );
strcatW( dest_path, dest );
ret = do_file_copyW( buffer, dest_path, style, handler, context );
HeapFree( GetProcessHeap(), 0, inf_source );
HeapFree( GetProcessHeap(), 0, buffer );
@ -1546,7 +1561,7 @@ static BOOL queue_copy_file( const WCHAR *source, const WCHAR *dest,
if (op->dst_path && !create_full_pathW(op->dst_path))
return FALSE;
if (do_file_copyW(source, dest, op->style, handler, context))
if (do_file_copyW(source, dest, op->style, handler, context) || GetLastError() == ERROR_SUCCESS)
return TRUE;
/* try to extract it from the cabinet file */