mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
Merge branch 'applydelta' into 'master'
msdelta: Add stubs for ApplyDeltaA() and ApplyDeltaW(). See merge request wine/wine!5523
This commit is contained in:
commit
fb5707466b
8 changed files with 182 additions and 2 deletions
1
configure
generated
vendored
1
configure
generated
vendored
|
@ -22431,6 +22431,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
|
||||
|
|
|
@ -2829,6 +2829,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)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
MODULE = msdelta.dll
|
||||
IMPORTLIB = msdelta
|
||||
|
||||
EXTRADLLFLAGS = -Wb,--prefer-native
|
||||
|
||||
SOURCES = \
|
||||
msdelta_main.c
|
||||
|
|
|
@ -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
|
||||
|
|
80
dlls/msdelta/msdelta_main.c
Normal file
80
dlls/msdelta/msdelta_main.c
Normal file
|
@ -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;
|
||||
}
|
5
dlls/msdelta/tests/Makefile.in
Normal file
5
dlls/msdelta/tests/Makefile.in
Normal file
|
@ -0,0 +1,5 @@
|
|||
TESTDLL = msdelta.dll
|
||||
IMPORTS = msdelta
|
||||
|
||||
SOURCES = \
|
||||
apply_delta.c
|
85
dlls/msdelta/tests/apply_delta.c
Normal file
85
dlls/msdelta/tests/apply_delta.c
Normal file
|
@ -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();
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue