Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
May 2019
- 96 participants
- 1957 messages
[PATCH] dbgeng/tests: Fix event handle leak (Coverity).
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
dlls/dbgeng/tests/dbgeng.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/dbgeng/tests/dbgeng.c b/dlls/dbgeng/tests/dbgeng.c
index 715649b7c3..293ae10f1e 100644
--- a/dlls/dbgeng/tests/dbgeng.c
+++ b/dlls/dbgeng/tests/dbgeng.c
@@ -477,6 +477,7 @@ static void test_module_information(void)
CloseHandle(info.hProcess);
CloseHandle(info.hThread);
+ CloseHandle(event);
client->lpVtbl->Release(client);
control->lpVtbl->Release(control);
--
2.20.1
May 1, 2019
Re: [PATCH 3/3] setupapi/tests: Add some tests for SetupInstallFilesFromInfSection().
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=51674
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/setupapi/tests/Makefile.in:1
Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/setupapi/tests/Makefile.in:1
Task: Patch failed to apply
=== debian9 (build log) ===
error: patch failed: dlls/setupapi/tests/Makefile.in:1
Task: Patch failed to apply
May 1, 2019
[PATCH 3/3] setupapi/tests: Add some tests for SetupInstallFilesFromInfSection().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/setupapi/tests/Makefile.in | 2 +-
dlls/setupapi/tests/install.c | 329 ++++++++++++++++++++++++++++++++
2 files changed, 330 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in
index ae520b736a..bbfdf590d5 100644
--- a/dlls/setupapi/tests/Makefile.in
+++ b/dlls/setupapi/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = setupapi.dll
-IMPORTS = advapi32 setupapi shell32 uuid user32
+IMPORTS = advapi32 cabinet setupapi shell32 uuid user32
SOURCES = \
coinst.c \
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index cee4b55f54..f99cb0186a 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include "windef.h"
#include "winbase.h"
@@ -30,6 +31,7 @@
#include "winsvc.h"
#include "setupapi.h"
#include "shlobj.h"
+#include "fci.h"
#include "wine/test.h"
@@ -64,6 +66,225 @@ static void create_inf_file(LPCSTR filename, const char *data)
CloseHandle(handle);
}
+static void create_file(const char *filename)
+{
+ create_inf_file(filename, "dummy");
+}
+
+static BOOL delete_file(const char *filename)
+{
+ if (GetFileAttributesA(filename) & FILE_ATTRIBUTE_DIRECTORY)
+ return RemoveDirectoryA(filename);
+ else
+ return DeleteFileA(filename);
+}
+
+static BOOL file_exists(const char *path)
+{
+ return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
+}
+
+static void * CDECL mem_alloc(ULONG cb)
+{
+ return HeapAlloc(GetProcessHeap(), 0, cb);
+}
+
+static void CDECL mem_free(void *memory)
+{
+ HeapFree(GetProcessHeap(), 0, memory);
+}
+
+static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
+{
+ sprintf(pccab->szCab, pv, pccab->iCab);
+ return TRUE;
+}
+
+static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
+{
+ return 0;
+}
+
+static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
+ BOOL fContinuation, void *pv)
+{
+ return 0;
+}
+
+static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
+{
+ HANDLE handle;
+ DWORD dwAccess = 0;
+ DWORD dwShareMode = 0;
+ DWORD dwCreateDisposition = OPEN_EXISTING;
+
+ dwAccess = GENERIC_READ | GENERIC_WRITE;
+ dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
+
+ if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
+ dwCreateDisposition = OPEN_EXISTING;
+ else
+ dwCreateDisposition = CREATE_NEW;
+
+ handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
+ dwCreateDisposition, 0, NULL);
+
+ ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
+
+ return (INT_PTR)handle;
+}
+
+static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
+{
+ HANDLE handle = (HANDLE)hf;
+ DWORD dwRead;
+ BOOL res;
+
+ res = ReadFile(handle, memory, cb, &dwRead, NULL);
+ ok(res, "Failed to ReadFile\n");
+
+ return dwRead;
+}
+
+static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
+{
+ HANDLE handle = (HANDLE)hf;
+ DWORD dwWritten;
+ BOOL res;
+
+ res = WriteFile(handle, memory, cb, &dwWritten, NULL);
+ ok(res, "Failed to WriteFile\n");
+
+ return dwWritten;
+}
+
+static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
+{
+ HANDLE handle = (HANDLE)hf;
+ ok(CloseHandle(handle), "Failed to CloseHandle\n");
+
+ return 0;
+}
+
+static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
+{
+ HANDLE handle = (HANDLE)hf;
+ DWORD ret;
+
+ ret = SetFilePointer(handle, dist, NULL, seektype);
+ ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
+
+ return ret;
+}
+
+static int CDECL fci_delete(char *pszFile, int *err, void *pv)
+{
+ BOOL ret = DeleteFileA(pszFile);
+ ok(ret, "Failed to DeleteFile %s\n", pszFile);
+
+ return 0;
+}
+
+static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
+{
+ LPSTR tempname;
+
+ tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
+ GetTempFileNameA(".", "xx", 0, tempname);
+
+ if (tempname && (strlen(tempname) < (unsigned)cbTempName))
+ {
+ lstrcpyA(pszTempName, tempname);
+ HeapFree(GetProcessHeap(), 0, tempname);
+ return TRUE;
+ }
+
+ HeapFree(GetProcessHeap(), 0, tempname);
+
+ return FALSE;
+}
+
+static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
+ USHORT *pattribs, int *err, void *pv)
+{
+ BY_HANDLE_FILE_INFORMATION finfo;
+ FILETIME filetime;
+ HANDLE handle;
+ DWORD attrs;
+ BOOL res;
+
+ handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+
+ ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
+
+ res = GetFileInformationByHandle(handle, &finfo);
+ ok(res, "Expected GetFileInformationByHandle to succeed\n");
+
+ FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
+ FileTimeToDosDateTime(&filetime, pdate, ptime);
+
+ attrs = GetFileAttributesA(pszName);
+ ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
+
+ return (INT_PTR)handle;
+}
+
+static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
+{
+ char path[MAX_PATH];
+ char filename[MAX_PATH];
+
+ lstrcpyA(path, CURR_DIR);
+ lstrcatA(path, "\\");
+ lstrcatA(path, file);
+
+ lstrcpyA(filename, file);
+
+ return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
+ progress, get_open_info, compress);
+}
+
+static void create_cab_file(const CHAR *name, const CHAR *files)
+{
+ CCAB cabParams = {0};
+ LPCSTR ptr;
+ HFCI hfci;
+ ERF erf;
+ BOOL res;
+
+ cabParams.cb = INT_MAX;
+ cabParams.cbFolderThresh = 900000;
+ cabParams.setID = 0xbeef;
+ cabParams.iCab = 1;
+ lstrcpyA(cabParams.szCabPath, CURR_DIR);
+ lstrcatA(cabParams.szCabPath, "\\");
+ lstrcpyA(cabParams.szCab, name);
+
+ hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
+ fci_read, fci_write, fci_close, fci_seek, fci_delete,
+ get_temp_file, &cabParams, NULL);
+
+ ok(hfci != NULL, "Failed to create an FCI context\n");
+
+ ptr = files;
+ while (*ptr)
+ {
+ create_file(ptr);
+ res = add_file(hfci, ptr, tcompTYPE_MSZIP);
+ ok(res, "Failed to add file: %s\n", ptr);
+ res = DeleteFileA(ptr);
+ ok(res, "Failed to delete file %s, error %u\n", ptr, GetLastError());
+ ptr += lstrlenA(ptr) + 1;
+ }
+
+ res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
+ ok(res, "Failed to flush the cabinet\n");
+
+ res = FCIDestroy(hfci);
+ ok(res, "Failed to destroy the cabinet\n");
+}
+
/* CBT hook to ensure a window (e.g., MessageBox) cannot be created */
static HHOOK hhook;
static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
@@ -760,6 +981,113 @@ static void test_dirid(void)
check_dirid(40, expected);
}
+static void test_install_files_queue(void)
+{
+ static const char inf_data[] = "[Version]\n"
+ "Signature=\"$Chicago$\"\n"
+ "[DefaultInstall]\n"
+ "CopyFiles=files_section\n"
+ "[files_section]\n"
+ "one.txt\n"
+ "two.txt\n"
+ "three.txt\n"
+ "four.txt\n"
+ "five.txt\n"
+ "six.txt\n"
+ "seven.txt\n"
+ "eight.txt\n"
+ "[SourceDisksNames]\n"
+ "1=heis\n"
+ "2=duo,,,alpha\n"
+ "3=treis,treis.cab\n"
+ "4=tessares,tessares.cab,,alpha\n"
+ "[SourceDisksFiles]\n"
+ "one.txt=1\n"
+ "two.txt=1,beta\n"
+ "three.txt=2\n"
+ "four.txt=2,beta\n"
+ "five.txt=3\n"
+ "six.txt=3,beta\n"
+ "seven.txt=4\n"
+ "eight.txt=4,beta\n"
+ "[DestinationDirs]\n"
+ "files_section=40000,dst\n";
+
+ char path[MAX_PATH];
+ HSPFILEQ queue;
+ 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 %#x.\n", GetLastError());
+
+ ret = CreateDirectoryA("src", NULL);
+ ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+ ret = CreateDirectoryA("src/alpha", NULL);
+ ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+ ret = CreateDirectoryA("src/alpha/beta", NULL);
+ ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+ ret = CreateDirectoryA("src/beta", NULL);
+ ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+ ret = SetupSetDirectoryIdA(hinf, 40000, CURR_DIR);
+ ok(ret, "Failed to set directory ID, error %u.\n", GetLastError());
+
+ create_file("src/one.txt");
+ create_file("src/beta/two.txt");
+ create_file("src/alpha/three.txt");
+ create_file("src/alpha/beta/four.txt");
+ create_cab_file("src/treis.cab", "src\\beta\\five.txt\0six.txt\0");
+ create_cab_file("src/alpha/tessares.cab", "seven.txt\0eight.txt\0");
+
+ queue = SetupOpenFileQueue();
+ ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+
+ context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, 0);
+ ok(!!context, "Failed to create callback context, error %#x.\n", GetLastError());
+
+ ret = SetupInstallFilesFromInfSectionA(hinf, NULL, queue, "DefaultInstall", "src", 0);
+ ok(ret, "Failed to install files, error %#x.\n", GetLastError());
+
+ ok(file_exists("src/one.txt"), "Source file should exist.\n");
+ ok(!file_exists("dst/one.txt"), "Destination file should not exist.\n");
+
+ ret = SetupCommitFileQueueA(NULL, queue, SetupDefaultQueueCallbackA, context);
+ ok(ret, "Failed to commit queue, error %#x.\n", GetLastError());
+
+ ok(file_exists("src/one.txt"), "Source file should exist.\n");
+ ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
+ ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
+ ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
+ ok(delete_file("dst/four.txt"), "Destination file should exist.\n");
+ ok(delete_file("dst/five.txt"), "Destination file should exist.\n");
+ ok(delete_file("dst/six.txt"), "Destination file should exist.\n");
+ todo_wine ok(delete_file("dst/seven.txt"), "Destination file should exist.\n");
+ todo_wine ok(delete_file("dst/eight.txt"), "Destination file should exist.\n");
+
+ SetupTermDefaultQueueCallback(context);
+ ret = SetupCloseFileQueue(queue);
+ ok(ret, "Failed to close queue, error %#x.\n", GetLastError());
+
+ SetupCloseInfFile(hinf);
+ delete_file("src/one.txt");
+ delete_file("src/beta/two.txt");
+ delete_file("src/alpha/three.txt");
+ delete_file("src/alpha/beta/four.txt");
+ delete_file("src/treis.cab");
+ delete_file("src/alpha/tessares.cab");
+ delete_file("src/alpha/beta/");
+ delete_file("src/alpha/");
+ delete_file("src/beta/");
+ delete_file("src/");
+ delete_file("dst/");
+ ret = DeleteFileA(inffile);
+ ok(ret, "Failed to delete INF file, error %u.\n", GetLastError());
+}
+
START_TEST(install)
{
char temp_path[MAX_PATH], prev_path[MAX_PATH];
@@ -784,6 +1112,7 @@ START_TEST(install)
test_install_svc_from();
test_driver_install();
test_dirid();
+ test_install_files_queue();
UnhookWindowsHookEx(hhook);
--
2.21.0
May 1, 2019
[PATCH 2/3] setupapi/tests: Avoid assert().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/setupapi/tests/install.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index 4232212515..cee4b55f54 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -21,7 +21,6 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include "windef.h"
#include "winbase.h"
@@ -59,9 +58,9 @@ static void create_inf_file(LPCSTR filename, const char *data)
BOOL ret;
HANDLE handle = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- assert(handle != INVALID_HANDLE_VALUE);
+ ok(handle != INVALID_HANDLE_VALUE, "Failed to create %s, error %u.\n", filename, GetLastError());
ret = WriteFile(handle, data, strlen(data), &res, NULL);
- assert(ret != 0);
+ ok(ret, "Failed to write file, error %u.\n", GetLastError());
CloseHandle(handle);
}
@@ -777,7 +776,7 @@ START_TEST(install)
/* Set CBT hook to disallow MessageBox creation in current thread */
hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
- assert(hhook != 0);
+ ok(!!hhook, "Failed to set hook, error %u.\n", GetLastError());
test_cmdline();
test_registry();
--
2.21.0
May 1, 2019
[PATCH 1/3] setupapi: Extract individual files from cabinets.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/setupapi/queue.c | 88 ++++++++++++++++++++++++++-----------------
1 file changed, 54 insertions(+), 34 deletions(-)
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c
index cc17966770..f033ef75da 100644
--- a/dlls/setupapi/queue.c
+++ b/dlls/setupapi/queue.c
@@ -353,8 +353,52 @@ static WCHAR *get_destination_dir( HINF hinf, const WCHAR *section )
return strdupW( systemdir );
}
+struct extract_cab_ctx
+{
+ const WCHAR *src;
+ const WCHAR *dst;
+};
+
+static UINT WINAPI extract_cab_cb( void *arg, UINT message, UINT_PTR param1, UINT_PTR param2 )
+{
+ struct extract_cab_ctx *ctx = arg;
+
+ switch (message)
+ {
+ case SPFILENOTIFY_FILEINCABINET:
+ {
+ FILE_IN_CABINET_INFO_W *info = (FILE_IN_CABINET_INFO_W *)param1;
+ const WCHAR *filename;
+
+ if ((filename = strrchrW( info->NameInCabinet, '\\' )))
+ filename++;
+ else
+ filename = info->NameInCabinet;
+
+ if (lstrcmpiW( filename, ctx->src ))
+ return FILEOP_SKIP;
-static void (WINAPI *pExtractFiles)( LPSTR, LPSTR, DWORD, DWORD, DWORD, DWORD );
+ strcpyW( info->FullTargetName, ctx->dst );
+ return FILEOP_DOIT;
+ }
+ case SPFILENOTIFY_FILEEXTRACTED:
+ {
+ const FILEPATHS_W *paths = (const FILEPATHS_W *)param1;
+ return paths->Win32Error;
+ }
+ case SPFILENOTIFY_NEEDNEWCABINET:
+ {
+ const CABINET_INFO_W *info = (const CABINET_INFO_W *)param1;
+ strcpyW( (WCHAR *)param2, info->CabinetPath );
+ return ERROR_SUCCESS;
+ }
+ case SPFILENOTIFY_CABINETINFO:
+ return 0;
+ default:
+ FIXME("Unexpected message %#x.\n", message);
+ return 0;
+ }
+}
/***********************************************************************
* extract_cabinet_file
@@ -365,44 +409,20 @@ static BOOL extract_cabinet_file( const WCHAR *cabinet, const WCHAR *root,
const WCHAR *src, const WCHAR *dst )
{
static const WCHAR extW[] = {'.','c','a','b',0};
- static HMODULE advpack;
-
- char *cab_path, *cab_file;
+ static const WCHAR backslashW[] = {'\\',0};
+ struct extract_cab_ctx ctx = {src, dst};
int len = strlenW( cabinet );
+ WCHAR path[MAX_PATH];
/* make sure the cabinet file has a .cab extension */
if (len <= 4 || strcmpiW( cabinet + len - 4, extW )) return FALSE;
- if (!pExtractFiles)
- {
- if (!advpack && !(advpack = LoadLibraryA( "advpack.dll" )))
- {
- ERR( "could not load advpack.dll\n" );
- return FALSE;
- }
- if (!(pExtractFiles = (void *)GetProcAddress( advpack, "ExtractFiles" )))
- {
- ERR( "could not find ExtractFiles in advpack.dll\n" );
- return FALSE;
- }
- }
- if (!(cab_path = strdupWtoA( root ))) return FALSE;
- len = WideCharToMultiByte( CP_ACP, 0, cabinet, -1, NULL, 0, NULL, NULL );
- if (!(cab_file = HeapAlloc( GetProcessHeap(), 0, strlen(cab_path) + len + 1 )))
- {
- HeapFree( GetProcessHeap(), 0, cab_path );
- return FALSE;
- }
- strcpy( cab_file, cab_path );
- if (cab_file[0] && cab_file[strlen(cab_file)-1] != '\\') strcat( cab_file, "\\" );
- WideCharToMultiByte( CP_ACP, 0, cabinet, -1, cab_file + strlen(cab_file), len, NULL, NULL );
- FIXME( "awful hack: extracting cabinet %s\n", debugstr_a(cab_file) );
- pExtractFiles( cab_file, cab_path, 0, 0, 0, 0 );
- HeapFree( GetProcessHeap(), 0, cab_file );
- HeapFree( GetProcessHeap(), 0, cab_path );
- return CopyFileW( src, dst, FALSE /*FIXME*/ );
-}
+ strcpyW(path, root);
+ strcatW(path, backslashW);
+ strcatW(path, cabinet);
+ return SetupIterateCabinetW( path, 0, extract_cab_cb, &ctx );
+}
/***********************************************************************
* SetupOpenFileQueue (SETUPAPI.@)
@@ -1309,7 +1329,7 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
if (op->src_tag)
{
if (extract_cabinet_file( op->src_tag, op->src_root,
- paths.Source, paths.Target )) break;
+ op->src_file, paths.Target )) break;
}
paths.Win32Error = GetLastError();
op_result = handler( context, SPFILENOTIFY_COPYERROR,
--
2.21.0
May 1, 2019
[PATCH v3] qcap/vfwcapture: Implement IPin::CheckMediaType().
by Zebediah Figura
From: Damjan Jovanovic <damjan.jov(a)gmail.com>
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
I've made some stylistic tweaks, and also removed test_property_bag which was
only duplicating tests already extant in devenum.
dlls/qcap/capture.h | 1 +
dlls/qcap/tests/Makefile.in | 3 +-
dlls/qcap/tests/videocapture.c | 133 +++++++++++++++++++++++++++++++++
dlls/qcap/v4l.c | 40 ++++++++--
dlls/qcap/vfwcapture.c | 6 +-
5 files changed, 173 insertions(+), 10 deletions(-)
create mode 100644 dlls/qcap/tests/videocapture.c
diff --git a/dlls/qcap/capture.h b/dlls/qcap/capture.h
index 65ed2dfc27..aed88893e5 100644
--- a/dlls/qcap/capture.h
+++ b/dlls/qcap/capture.h
@@ -25,6 +25,7 @@ typedef struct _Capture Capture;
Capture *qcap_driver_init(IPin*,USHORT) DECLSPEC_HIDDEN;
HRESULT qcap_driver_destroy(Capture*) DECLSPEC_HIDDEN;
+HRESULT qcap_driver_check_format(Capture*,const AM_MEDIA_TYPE*) DECLSPEC_HIDDEN;
HRESULT qcap_driver_set_format(Capture*,AM_MEDIA_TYPE*) DECLSPEC_HIDDEN;
HRESULT qcap_driver_get_format(const Capture*,AM_MEDIA_TYPE**) DECLSPEC_HIDDEN;
HRESULT qcap_driver_get_prop_range(Capture*,VideoProcAmpProperty,LONG*,LONG*,LONG*,LONG*,LONG*) DECLSPEC_HIDDEN;
diff --git a/dlls/qcap/tests/Makefile.in b/dlls/qcap/tests/Makefile.in
index 2b988476ad..a5b9d0e474 100644
--- a/dlls/qcap/tests/Makefile.in
+++ b/dlls/qcap/tests/Makefile.in
@@ -5,4 +5,5 @@ C_SRCS = \
audiorecord.c \
avico.c \
qcap.c \
- smartteefilter.c
+ smartteefilter.c \
+ videocapture.c
diff --git a/dlls/qcap/tests/videocapture.c b/dlls/qcap/tests/videocapture.c
new file mode 100644
index 0000000000..b80b0f2624
--- /dev/null
+++ b/dlls/qcap/tests/videocapture.c
@@ -0,0 +1,133 @@
+/*
+ * WDM video capture filter unit tests
+ *
+ * Copyright 2019 Damjan Jovanovic
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+#include "dshow.h"
+#include "wine/test.h"
+
+static void test_media_types(IPin *pin)
+{
+ IEnumMediaTypes *enum_media_types;
+ AM_MEDIA_TYPE mt, *pmt;
+ HRESULT hr;
+
+ hr = IPin_EnumMediaTypes(pin, &enum_media_types);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ while (IEnumMediaTypes_Next(enum_media_types, 1, &pmt, NULL) == S_OK)
+ {
+ hr = IPin_QueryAccept(pin, pmt);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ CoTaskMemFree(pmt);
+ }
+ IEnumMediaTypes_Release(enum_media_types);
+
+ hr = IPin_QueryAccept(pin, NULL);
+ todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+
+ memset(&mt, 0, sizeof(mt));
+ hr = IPin_QueryAccept(pin, &mt);
+ ok(hr != S_OK, "Got hr %#x.\n", hr);
+
+ mt.majortype = MEDIATYPE_Video;
+ hr = IPin_QueryAccept(pin, &mt);
+ ok(hr != S_OK, "Got hr %#x.\n", hr);
+
+ mt.formattype = FORMAT_VideoInfo;
+ hr = IPin_QueryAccept(pin, &mt);
+ ok(hr != S_OK, "Got hr %#x.\n", hr);
+
+ mt.formattype = FORMAT_None;
+ hr = IPin_QueryAccept(pin, &mt);
+ ok(hr != S_OK, "Got hr %#x.\n", hr);
+}
+
+static void test_capture(IBaseFilter *filter)
+{
+ IEnumPins *enum_pins;
+ IPin *pin;
+ HRESULT hr;
+
+ hr = IBaseFilter_EnumPins(filter, &enum_pins);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ while ((hr = IEnumPins_Next(enum_pins, 1, &pin, NULL)) == S_OK)
+ {
+ PIN_DIRECTION pin_direction;
+ IPin_QueryDirection(pin, &pin_direction);
+ if (pin_direction == PINDIR_OUTPUT)
+ test_media_types(pin);
+ IPin_Release(pin);
+ }
+
+ IEnumPins_Release(enum_pins);
+}
+
+START_TEST(videocapture)
+{
+ ICreateDevEnum *dev_enum;
+ IEnumMoniker *class_enum;
+ IBaseFilter *filter;
+ IMoniker *moniker;
+ WCHAR *name;
+ HRESULT hr;
+ ULONG ref;
+
+ CoInitialize(NULL);
+
+ hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC,
+ &IID_ICreateDevEnum, (void **)&dev_enum);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+ hr = ICreateDevEnum_CreateClassEnumerator(dev_enum, &CLSID_VideoInputDeviceCategory, &class_enum, 0);
+ if (hr == S_FALSE)
+ {
+ skip("No video capture devices present.\n");
+ ICreateDevEnum_Release(dev_enum);
+ CoUninitialize();
+ return;
+ }
+ ok(hr == S_OK, "Got hr=%#x.\n", hr);
+
+ while (IEnumMoniker_Next(class_enum, 1, &moniker, NULL) == S_OK)
+ {
+ hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &name);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ trace("Testing device %s.\n", wine_dbgstr_w(name));
+ CoTaskMemFree(name);
+
+ hr = IMoniker_BindToObject(moniker, NULL, NULL, &IID_IBaseFilter, (void**)&filter);
+ if (hr == S_OK)
+ {
+ test_capture(filter);
+ IBaseFilter_Release(filter);
+ }
+ else
+ skip("Failed to open capture device, hr=%#x.\n", hr);
+
+ ref = IBaseFilter_Release(filter);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+ IMoniker_Release(moniker);
+ }
+
+ ICreateDevEnum_Release(dev_enum);
+ IEnumMoniker_Release(class_enum);
+ CoUninitialize();
+}
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c
index f0875f7636..6fe394af0a 100644
--- a/dlls/qcap/v4l.c
+++ b/dlls/qcap/v4l.c
@@ -131,20 +131,48 @@ HRESULT qcap_driver_destroy(Capture *capBox)
return S_OK;
}
+HRESULT qcap_driver_check_format(Capture *device, const AM_MEDIA_TYPE *mt)
+{
+ HRESULT hr;
+ TRACE("device %p, mt %p.\n", device, mt);
+ dump_AM_MEDIA_TYPE(mt);
+
+ if (!mt)
+ return E_POINTER;
+
+ if (!IsEqualGUID(&mt->majortype, &MEDIATYPE_Video))
+ return S_FALSE;
+
+ if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo) && mt->pbFormat
+ && mt->cbFormat >= sizeof(VIDEOINFOHEADER))
+ {
+ VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)mt->pbFormat;
+ if (vih->bmiHeader.biBitCount == 24 && vih->bmiHeader.biCompression == BI_RGB)
+ hr = S_OK;
+ else
+ {
+ FIXME("Unsupported compression %#x, bpp %u.\n", vih->bmiHeader.biCompression,
+ vih->bmiHeader.biBitCount);
+ hr = S_FALSE;
+ }
+ }
+ else
+ hr = VFW_E_INVALIDMEDIATYPE;
+
+ return hr;
+}
+
HRESULT qcap_driver_set_format(Capture *device, AM_MEDIA_TYPE *mt)
{
struct v4l2_format format = {0};
int newheight, newwidth;
VIDEOINFOHEADER *vih;
int fd = device->fd;
+ HRESULT hr;
+ if (FAILED(hr = qcap_driver_check_format(device, mt)))
+ return hr;
vih = (VIDEOINFOHEADER *)mt->pbFormat;
- if (vih->bmiHeader.biBitCount != 24 || vih->bmiHeader.biCompression != BI_RGB)
- {
- FIXME("Unsupported compression %#x, bpp %u.\n", vih->bmiHeader.biCompression,
- vih->bmiHeader.biBitCount);
- return VFW_E_INVALIDMEDIATYPE;
- }
newwidth = vih->bmiHeader.biWidth;
newheight = vih->bmiHeader.biHeight;
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index 6297a80e61..8cf25c19b2 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -658,10 +658,10 @@ static inline VfwPinImpl *impl_from_BasePin(BasePin *pin)
return CONTAINING_RECORD(pin, VfwPinImpl, pin.pin);
}
-static HRESULT WINAPI VfwPin_CheckMediaType(BasePin *pin, const AM_MEDIA_TYPE *amt)
+static HRESULT WINAPI VfwPin_CheckMediaType(BasePin *pin, const AM_MEDIA_TYPE *mt)
{
- FIXME("(%p) stub\n", pin);
- return E_NOTIMPL;
+ VfwPinImpl *filter = impl_from_BasePin(pin);
+ return qcap_driver_check_format(filter->parent->driver_info, mt);
}
static HRESULT WINAPI VfwPin_GetMediaType(BasePin *pin, int iPosition, AM_MEDIA_TYPE *pmt)
--
2.21.0
May 1, 2019
[PATCH] iphlpapi: Add GetBestRoute2 stub.
by Vijay Kiran Kamuju
From: Austin English <austinenglish(a)gmail.com>
Add more failure conditions
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44850
Signed-off-by: Austin English <austinenglish(a)gmail.com>
Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>
---
dlls/iphlpapi/iphlpapi.spec | 2 +-
dlls/iphlpapi/iphlpapi_main.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec
index b4f77beced..7a447e733a 100644
--- a/dlls/iphlpapi/iphlpapi.spec
+++ b/dlls/iphlpapi/iphlpapi.spec
@@ -77,7 +77,7 @@
@ stdcall GetBestInterfaceEx( ptr ptr )
@ stub GetBestInterfaceFromStack
@ stdcall GetBestRoute( long long ptr )
-#@ stub GetBestRoute2
+@ stdcall GetBestRoute2( ptr long ptr ptr long ptr ptr )
@ stub GetBestRouteFromStack
#@ stub GetCurrentThreadCompartmentId
@ stdcall GetExtendedTcpTable( ptr ptr long long long long )
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 5df4cd832b..95ccf496e7 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -3313,3 +3313,23 @@ DWORD WINAPI GetIpInterfaceTable(ADDRESS_FAMILY family, PMIB_IPINTERFACE_TABLE *
FIXME("(%u %p): stub\n", family, table);
return ERROR_NOT_SUPPORTED;
}
+
+/******************************************************************
+ * GetBestRoute2 (IPHLPAPI.@)
+ */
+DWORD WINAPI GetBestRoute2(NET_LUID *luid, NET_IFINDEX index,
+ const SOCKADDR_INET *source, const SOCKADDR_INET *destination,
+ ULONG options, PMIB_IPFORWARD_ROW2 bestroute,
+ SOCKADDR_INET *bestaddress)
+{
+ static int once;
+
+ if (!once++)
+ FIXME("(%p, %d, %p, %p, 0x%08x, %p, %p): stub\n", luid, index, source,
+ destination, options, bestroute, bestaddress);
+
+ if (!destination || !bestroute || !bestaddress)
+ return ERROR_INVALID_PARAMETER;
+
+ return ERROR_NOT_SUPPORTED;
+}
--
2.21.0
May 1, 2019