Commit 50110d4b authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

mspatcha: Forward ApplyPatchToFileA to ApplyPatchToFileW.

parent e5f1ea57
1 stub ApplyPatchToFileA
1 stdcall ApplyPatchToFileA(str str str long)
2 stub ApplyPatchToFileByHandles
3 stub ApplyPatchToFileByHandlesEx
4 stub ApplyPatchToFileExA
......
......@@ -24,6 +24,8 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "patchapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mspatcha);
......@@ -49,6 +51,45 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
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.6)
*/
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)
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment