[MSPATCHA]

* Import from Wine 1.7.27.
CORE-8550 #comment mspatcha.dll added in r64248.
CORE-8540

svn path=/trunk/; revision=64248
This commit is contained in:
Amine Khaldi 2014-09-23 19:48:41 +00:00
parent a688f19bbb
commit 515ead4a5d
7 changed files with 236 additions and 0 deletions

View file

@ -107,6 +107,7 @@ add_subdirectory(msimtf)
add_subdirectory(msisip)
add_subdirectory(msisys.ocx)
#add_subdirectory(msnet32) #to be deleted in trunk.
add_subdirectory(mspatcha)
add_subdirectory(msports)
add_subdirectory(msrle32)
add_subdirectory(mssign32)

View file

@ -0,0 +1,16 @@
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_definitions(-D__WINESRC__)
spec2def(mspatcha.dll mspatcha.spec)
list(APPEND SOURCE
mspatcha_main.c
${CMAKE_CURRENT_BINARY_DIR}/mspatcha_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/mspatcha.def)
add_library(mspatcha SHARED ${SOURCE} version.rc)
set_module_type(mspatcha win32dll)
target_link_libraries(mspatcha wine)
add_importlibs(mspatcha msvcrt kernel32 ntdll)
add_cd_file(TARGET mspatcha DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,12 @@
1 stdcall ApplyPatchToFileA(str str str long)
2 stub ApplyPatchToFileByHandles
3 stub ApplyPatchToFileByHandlesEx
4 stub ApplyPatchToFileExA
5 stub ApplyPatchToFileExW
6 stdcall ApplyPatchToFileW(wstr wstr wstr long)
7 stdcall GetFilePatchSignatureA(str long ptr long ptr long ptr long ptr)
8 stub GetFilePatchSignatureByHandle
9 stdcall GetFilePatchSignatureW(wstr long ptr long ptr long ptr long ptr)
10 stub TestApplyPatchToFileA
11 stub TestApplyPatchToFileByHandles
12 stub TestApplyPatchToFileW

View file

@ -0,0 +1,128 @@
/*
* PatchAPI
*
* Copyright 2011 David Hedberg for CodeWeavers
*
* 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 <wine/config.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <patchapi.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(mspatcha);
/*****************************************************
* DllMain (MSPATCHA.@)
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
break;
}
return TRUE;
}
static inline WCHAR *strdupAW( const char *src )
{
WCHAR *dst = NULL;
if (src)
{
int len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
if ((dst = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
}
return dst;
}
/*****************************************************
* ApplyPatchToFileA (MSPATCHA.1)
*/
BOOL WINAPI ApplyPatchToFileA(LPCSTR patch_file, LPCSTR old_file, LPCSTR new_file, ULONG apply_flags)
{
BOOL ret;
WCHAR *patch_fileW, *new_fileW, *old_fileW = NULL;
if (!(patch_fileW = strdupAW( patch_file ))) return FALSE;
if (old_file && !(old_fileW = strdupAW( old_file )))
{
HeapFree( GetProcessHeap(), 0, patch_fileW );
return FALSE;
}
if (!(new_fileW = strdupAW( new_file )))
{
HeapFree( GetProcessHeap(), 0, patch_fileW );
HeapFree( GetProcessHeap(), 0, old_fileW );
return FALSE;
}
ret = ApplyPatchToFileW( patch_fileW, old_fileW, new_fileW, apply_flags );
HeapFree( GetProcessHeap(), 0, patch_fileW );
HeapFree( GetProcessHeap(), 0, old_fileW );
HeapFree( GetProcessHeap(), 0, new_fileW );
return ret;
}
/*****************************************************
* ApplyPatchToFileW (MSPATCHA.6)
*/
BOOL WINAPI ApplyPatchToFileW(LPCWSTR patch_file, LPCWSTR old_file, LPCWSTR new_file, ULONG apply_flags)
{
FIXME("stub - %s, %s, %s, %08x\n", debugstr_w(patch_file), debugstr_w(old_file),
debugstr_w(new_file), apply_flags);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/*****************************************************
* GetFilePatchSignatureA (MSPATCHA.7)
*/
BOOL WINAPI GetFilePatchSignatureA(LPCSTR filename, ULONG flags, PVOID data, ULONG ignore_range_count,
PPATCH_IGNORE_RANGE ignore_range, ULONG retain_range_count,
PPATCH_RETAIN_RANGE retain_range, ULONG bufsize, LPSTR buffer)
{
FIXME("stub - %s, %x, %p, %u, %p, %u, %p, %u, %p\n", debugstr_a(filename), flags, data,
ignore_range_count, ignore_range, retain_range_count, retain_range, bufsize, buffer);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/*****************************************************
* GetFilePatchSignatureW (MSPATCHA.9)
*/
BOOL WINAPI GetFilePatchSignatureW(LPCWSTR filename, ULONG flags, PVOID data, ULONG ignore_range_count,
PPATCH_IGNORE_RANGE ignore_range, ULONG retain_range_count,
PPATCH_RETAIN_RANGE retain_range, ULONG bufsize, LPWSTR buffer)
{
FIXME("stub - %s, %x, %p, %u, %p, %u, %p, %u, %p\n", debugstr_w(filename), flags, data,
ignore_range_count, ignore_range, retain_range_count, retain_range, bufsize, buffer);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}

View file

@ -0,0 +1,26 @@
/*
* Copyright 2011 Hans Leidekker for CodeWeavers
*
* 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 WINE_FILEDESCRIPTION_STR "Wine File Patch API"
#define WINE_FILENAME_STR "mspatcha.dll"
#define WINE_FILEVERSION 6,1,7600,16385
#define WINE_FILEVERSION_STR "6.1.7600.16385"
#define WINE_PRODUCTVERSION 6,1,7600,16385
#define WINE_PRODUCTVERSION_STR "6.1.7600.16385"
#include "wine/wine_common_ver.rc"

View file

@ -0,0 +1,52 @@
/*
* Copyright 2011 Hans Leidekker for CodeWeavers
*
* 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
*/
#ifndef _PATCHAPI_H_
#define _PATCHAPI_H_
#ifdef __cplusplus
extern "C" {
#endif
#define APPLY_OPTION_FAIL_IF_EXACT 0x00000001
#define APPLY_OPTION_FAIL_IF_CLOSE 0x00000002
#define APPLY_OPTION_TEST_ONLY 0x00000004
#define APPLY_OPTION_VALID_FLAGS 0x00000007
typedef struct _PATCH_IGNORE_RANGE
{
ULONG OffsetInOldFile;
ULONG LengthInBytes;
} PATCH_IGNORE_RANGE, *PPATCH_IGNORE_RANGE;
typedef struct _PATCH_RETAIN_RANGE
{
ULONG OffsetInOldFile;
ULONG LengthInBytes;
ULONG OffsetInNewFile;
} PATCH_RETAIN_RANGE, *PPATCH_RETAIN_RANGE;
BOOL WINAPI ApplyPatchToFileA(LPCSTR,LPCSTR,LPCSTR,ULONG);
BOOL WINAPI ApplyPatchToFileW(LPCWSTR,LPCWSTR,LPCWSTR,ULONG);
#define ApplyPatchToFile WINELIB_NAME_AW(ApplyPatchToFile)
#ifdef __cplusplus
}
#endif
#endif /* _PATCHAPI_H_ */

View file

@ -126,6 +126,7 @@ reactos/dll/win32/msimtf # Synced to Wine-1.7.17
reactos/dll/win32/msisip # Synced to Wine-1.7.17
reactos/dll/win32/msisys.ocx # Synced to Wine-1.7.17
reactos/dll/win32/msnet32 # Synced to Wine-1.7.17
reactos/dll/win32/mspatcha # Synced to Wine-1.7.27
reactos/dll/win32/msrle32 # Synced to Wine-1.7.17
reactos/dll/win32/mssign32 # Synced to Wine-1.7.17
reactos/dll/win32/mssip32 # Synced to Wine-1.7.17