Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56007 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56576
-- v11: msdelta: Add stubs for ApplyDeltaA() and ApplyDeltaW().
From: Vijay Kiran Kamuju infyquest@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56007 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56576 --- configure | 1 + configure.ac | 1 + dlls/msdelta/Makefile.in | 4 ++ dlls/msdelta/msdelta.spec | 4 +- dlls/msdelta/msdelta_main.c | 80 ++++++++++++++++++++++++++++++ dlls/msdelta/tests/Makefile.in | 5 ++ dlls/msdelta/tests/apply_delta.c | 85 ++++++++++++++++++++++++++++++++ include/msdelta.h | 4 ++ 8 files changed, 182 insertions(+), 2 deletions(-) create mode 100644 dlls/msdelta/msdelta_main.c create mode 100644 dlls/msdelta/tests/Makefile.in create mode 100644 dlls/msdelta/tests/apply_delta.c
diff --git a/configure b/configure index a74bdc797ed..b7c63cd8294 100755 --- a/configure +++ b/configure @@ -22239,6 +22239,7 @@ wine_fn_config_makefile dlls/msdaps enable_msdaps wine_fn_config_makefile dlls/msdasql enable_msdasql wine_fn_config_makefile dlls/msdasql/tests enable_tests wine_fn_config_makefile dlls/msdelta enable_msdelta +wine_fn_config_makefile dlls/msdelta/tests enable_tests wine_fn_config_makefile dlls/msdmo enable_msdmo wine_fn_config_makefile dlls/msdmo/tests enable_tests wine_fn_config_makefile dlls/msdrm enable_msdrm diff --git a/configure.ac b/configure.ac index 0f5b89d1b47..2b0720d9c31 100644 --- a/configure.ac +++ b/configure.ac @@ -2819,6 +2819,7 @@ WINE_CONFIG_MAKEFILE(dlls/msdaps) WINE_CONFIG_MAKEFILE(dlls/msdasql) WINE_CONFIG_MAKEFILE(dlls/msdasql/tests) WINE_CONFIG_MAKEFILE(dlls/msdelta) +WINE_CONFIG_MAKEFILE(dlls/msdelta/tests) WINE_CONFIG_MAKEFILE(dlls/msdmo) WINE_CONFIG_MAKEFILE(dlls/msdmo/tests) WINE_CONFIG_MAKEFILE(dlls/msdrm) diff --git a/dlls/msdelta/Makefile.in b/dlls/msdelta/Makefile.in index 5f26bb04dde..ebc402807d6 100644 --- a/dlls/msdelta/Makefile.in +++ b/dlls/msdelta/Makefile.in @@ -1,3 +1,7 @@ MODULE = msdelta.dll +IMPORTLIB = msdelta
EXTRADLLFLAGS = -Wb,--prefer-native + +SOURCES = \ + msdelta_main.c diff --git a/dlls/msdelta/msdelta.spec b/dlls/msdelta/msdelta.spec index ce2b5edf472..6a0ed4c9be6 100644 --- a/dlls/msdelta/msdelta.spec +++ b/dlls/msdelta/msdelta.spec @@ -1,7 +1,7 @@ -@ stub ApplyDeltaA +@ stdcall ApplyDeltaA(int64 ptr ptr ptr) @ stub ApplyDeltaB @ stub ApplyDeltaProvidedB -@ stub ApplyDeltaW +@ stdcall ApplyDeltaW(int64 ptr ptr ptr) @ stub CreateDeltaA @ stub CreateDeltaB @ stub CreateDeltaW diff --git a/dlls/msdelta/msdelta_main.c b/dlls/msdelta/msdelta_main.c new file mode 100644 index 00000000000..1a05575e2ba --- /dev/null +++ b/dlls/msdelta/msdelta_main.c @@ -0,0 +1,80 @@ +/* + * MSDelta + * + * Copyright 2024 Vijay Kiran Kamuju + * + * 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 + */ + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "msdelta.h" +#include "wine/debug.h" + + +WINE_DEFAULT_DEBUG_CHANNEL(msdelta); + + +static WCHAR *strdupAW(const char *src) +{ + WCHAR *dst = NULL; + if (src) + { + int len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); + if ((dst = malloc(len * sizeof(WCHAR)))) + MultiByteToWideChar(CP_ACP, 0, src, -1, dst, len); + } + return dst; +} + +/***************************************************** + * ApplyDeltaA (MSDELTA.@) + */ +BOOL WINAPI ApplyDeltaA(DELTA_FLAG_TYPE flags, LPCSTR source_file, + LPCSTR delta_file, LPCSTR target_file) +{ + BOOL ret; + WCHAR *source_fileW, *delta_fileW = NULL, *target_fileW = NULL; + + source_fileW = strdupAW(source_file); + delta_fileW = strdupAW(delta_file); + target_fileW = strdupAW(target_file); + + ret = ApplyDeltaW(flags, source_fileW, delta_fileW, target_fileW); + + free(source_fileW); + free(delta_fileW); + free(target_fileW); + + return ret; +} + +BOOL WINAPI ApplyDeltaW(DELTA_FLAG_TYPE flags, LPCWSTR source_file, + LPCWSTR delta_file, LPCWSTR target_file) +{ + BOOL ret = FALSE; + FIXME("(%llx,%s,%s,%s): stub!\n", flags, debugstr_w(source_file), debugstr_w(delta_file), debugstr_w(target_file)); + + if (!source_file) + { + SetLastError(ERROR_INVALID_DATA); + return ret; + } + SetLastError(ERROR_FILE_NOT_FOUND); + + return ret; +} diff --git a/dlls/msdelta/tests/Makefile.in b/dlls/msdelta/tests/Makefile.in new file mode 100644 index 00000000000..ab9bba4df9a --- /dev/null +++ b/dlls/msdelta/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = msdelta.dll +IMPORTS = msdelta + +SOURCES = \ + apply_delta.c diff --git a/dlls/msdelta/tests/apply_delta.c b/dlls/msdelta/tests/apply_delta.c new file mode 100644 index 00000000000..ce591fdac88 --- /dev/null +++ b/dlls/msdelta/tests/apply_delta.c @@ -0,0 +1,85 @@ +/* + * Unit tests for MSDelta API functions + * + * Copyright (c) 2024 Vijay Kiran Kamuju + * + * 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 + * + * NOTES + * + * Without mspatchc.dll, the inability to create test patch files under Wine + * limits testing to the supplied small files. + */ + +#include "wine/test.h" +#include "windef.h" +#include "winerror.h" + +#include "msdelta.h" + +static BOOL (WINAPI *pApplyDeltaA)(DELTA_FLAG_TYPE, LPCSTR, LPCSTR, LPCSTR); + +static BOOL init_function_pointers(void) +{ + HMODULE msdelta = LoadLibraryA("msdelta.dll"); + if (!msdelta) + { + win_skip("msdelta.dll not found\n"); + return FALSE; + } + pApplyDeltaA = (void *)GetProcAddress(msdelta, "ApplyDeltaA"); + + return TRUE; +} + +static void test_ApplyDelta(void) +{ + DWORD err; + + if (!pApplyDeltaA) + return; + + SetLastError(0xdeadbeef); + ok(!pApplyDeltaA(0, NULL, NULL, NULL), + "ApplyDeltaA: expected FALSE\n"); + err = GetLastError(); + ok(err == ERROR_INVALID_DATA, "Expected ERROR_INVALID_DATA, got 0x%08lx\n", err); + + SetLastError(0xdeadbeef); + ok(!pApplyDeltaA(0, "src.tmp", NULL, NULL), + "ApplyDeltaA: expected FALSE\n"); + err = GetLastError(); + ok(err == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got 0x%08lx\n", err); + + SetLastError(0xdeadbeef); + ok(!pApplyDeltaA(0, "src.tmp", "delta.tmp", NULL), + "ApplyDeltaA: expected FALSE\n"); + err = GetLastError(); + ok(err == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got 0x%08lx\n", err); + + SetLastError(0xdeadbeef); + ok(!pApplyDeltaA(0, "src.tmp", "delta.tmp", "tgt.tmp"), + "ApplyDeltaA: expected FALSE\n"); + err = GetLastError(); + ok(err == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got 0x%08lx\n", err); +} + +START_TEST(apply_delta) +{ + if (!init_function_pointers()) + return; + + test_ApplyDelta(); +} diff --git a/include/msdelta.h b/include/msdelta.h index aa7161c6b0a..e291e5800df 100644 --- a/include/msdelta.h +++ b/include/msdelta.h @@ -162,6 +162,10 @@ typedef struct _DELTA_HEADER_INFO typedef DELTA_HEADER_INFO *LPDELTA_HEADER_INFO; typedef const DELTA_HEADER_INFO *LPCDELTA_HEADER_INFO;
+BOOL WINAPI ApplyDeltaA(DELTA_FLAG_TYPE, LPCSTR, LPCSTR, LPCSTR); +BOOL WINAPI ApplyDeltaW(DELTA_FLAG_TYPE, LPCWSTR, LPCWSTR, LPCWSTR); +#define ApplyDelta WINELIB_NAME_AW(ApplyDelta) + #ifdef __cplusplus } #endif
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=149294
Your paranoid android.
=== debian11b (64 bit WoW report) ===
kernel32: comm.c:1574: Test failed: AbortWaitCts hComPortEvent failed comm.c:1586: Test failed: Unexpected time 1001, expected around 500