2 * Copyright 2011 Hans Leidekker for CodeWeavers
3 * Copyright 2019 Conor McCarthy
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #define PATCH_OPTION_USE_LZX_A 0x00000001
28 #define PATCH_OPTION_USE_LZX_B 0x00000002
29 #define PATCH_OPTION_USE_LZX_LARGE 0x00000004 /* raise maximum window from 8 -> 32 Mb */
31 #define PATCH_OPTION_NO_BINDFIX 0x00010000
32 #define PATCH_OPTION_NO_LOCKFIX 0x00020000
33 #define PATCH_OPTION_NO_REBASE 0x00040000
34 #define PATCH_OPTION_FAIL_IF_SAME_FILE 0x00080000
35 #define PATCH_OPTION_FAIL_IF_BIGGER 0x00100000
36 #define PATCH_OPTION_NO_CHECKSUM 0x00200000
37 #define PATCH_OPTION_NO_RESTIMEFIX 0x00400000
38 #define PATCH_OPTION_NO_TIMESTAMP 0x00800000
39 #define PATCH_OPTION_INTERLEAVE_FILES 0x40000000
40 #define PATCH_OPTION_RESERVED1 0x80000000
42 #define APPLY_OPTION_FAIL_IF_EXACT 0x00000001
43 #define APPLY_OPTION_FAIL_IF_CLOSE 0x00000002
44 #define APPLY_OPTION_TEST_ONLY 0x00000004
45 #define APPLY_OPTION_VALID_FLAGS 0x00000007
47 #define ERROR_PATCH_DECODE_FAILURE 0xC00E4101
48 #define ERROR_PATCH_CORRUPT 0xC00E4102
49 #define ERROR_PATCH_NEWER_FORMAT 0xC00E4103
50 #define ERROR_PATCH_WRONG_FILE 0xC00E4104
51 #define ERROR_PATCH_NOT_NECESSARY 0xC00E4105
52 #define ERROR_PATCH_NOT_AVAILABLE 0xC00E4106
54 typedef struct _PATCH_IGNORE_RANGE
56 ULONG OffsetInOldFile
;
58 } PATCH_IGNORE_RANGE
, *PPATCH_IGNORE_RANGE
;
60 typedef struct _PATCH_RETAIN_RANGE
62 ULONG OffsetInOldFile
;
64 ULONG OffsetInNewFile
;
65 } PATCH_RETAIN_RANGE
, *PPATCH_RETAIN_RANGE
;
67 typedef struct _PATCH_INTERLEAVE_MAP
{
74 } PATCH_INTERLEAVE_MAP
, *PPATCH_INTERLEAVE_MAP
;
76 typedef BOOL(CALLBACK PATCH_SYMLOAD_CALLBACK
)(ULONG
, LPCSTR
, ULONG
, ULONG
, ULONG
, ULONG
, ULONG
, PVOID
);
78 typedef PATCH_SYMLOAD_CALLBACK
*PPATCH_SYMLOAD_CALLBACK
;
80 typedef struct _PATCH_OPTION_DATA
{
81 ULONG SizeOfThisStruct
;
82 ULONG SymbolOptionFlags
;
83 LPCSTR NewFileSymbolPath
;
84 LPCSTR
*OldFileSymbolPathArray
;
85 ULONG ExtendedOptionFlags
;
86 PPATCH_SYMLOAD_CALLBACK SymLoadCallback
;
88 PPATCH_INTERLEAVE_MAP
* InterleaveMapArray
;
89 ULONG MaxLzxWindowSize
;
90 } PATCH_OPTION_DATA
, *PPATCH_OPTION_DATA
;
92 typedef BOOL (CALLBACK PATCH_PROGRESS_CALLBACK
)(PVOID
, ULONG
, ULONG
);
94 typedef PATCH_PROGRESS_CALLBACK
*PPATCH_PROGRESS_CALLBACK
;
96 BOOL WINAPI
ApplyPatchToFileA(LPCSTR
,LPCSTR
,LPCSTR
,ULONG
);
97 BOOL WINAPI
ApplyPatchToFileW(LPCWSTR
,LPCWSTR
,LPCWSTR
,ULONG
);
98 #define ApplyPatchToFile WINELIB_NAME_AW(ApplyPatchToFile)
100 BOOL WINAPI
ApplyPatchToFileByHandles(HANDLE
, HANDLE
, HANDLE
, ULONG
);
101 BOOL WINAPI
ApplyPatchToFileExA(LPCSTR
, LPCSTR
, LPCSTR
, ULONG
, PPATCH_PROGRESS_CALLBACK
, PVOID
);
102 BOOL WINAPI
ApplyPatchToFileExW(LPCWSTR
, LPCWSTR
, LPCWSTR
, ULONG
, PPATCH_PROGRESS_CALLBACK
, PVOID
);
103 #define ApplyPatchToFileEx WINELIB_NAME_AW(ApplyPatchToFileEx)
104 BOOL WINAPI
ApplyPatchToFileByHandlesEx(HANDLE
, HANDLE
, HANDLE
, ULONG
, PPATCH_PROGRESS_CALLBACK
, PVOID
);
105 BOOL WINAPI
ApplyPatchToFileByBuffers(PBYTE
, ULONG
, PBYTE
, ULONG
, PBYTE
*, ULONG
, ULONG
*, FILETIME
*, ULONG
,
106 PPATCH_PROGRESS_CALLBACK
, PVOID
);
108 BOOL WINAPI
TestApplyPatchToFileA(LPCSTR
, LPCSTR
, ULONG
);
109 BOOL WINAPI
TestApplyPatchToFileW(LPCWSTR
, LPCWSTR
, ULONG
);
110 #define TestApplyPatchToFile WINELIB_NAME_AW(TestApplyPatchToFile)
111 BOOL WINAPI
TestApplyPatchToFileByHandles(HANDLE
, HANDLE
, ULONG
);
112 BOOL WINAPI
TestApplyPatchToFileByBuffers(PBYTE
, ULONG
, PBYTE
, ULONG
, ULONG
*, ULONG
);
114 BOOL WINAPI
GetFilePatchSignatureA(LPCSTR
, ULONG
, PVOID
, ULONG
, PPATCH_IGNORE_RANGE
, ULONG
,
115 PPATCH_RETAIN_RANGE
, ULONG
, LPSTR
);
116 BOOL WINAPI
GetFilePatchSignatureW(LPCWSTR
, ULONG
, PVOID
, ULONG
, PPATCH_IGNORE_RANGE
, ULONG
,
117 PPATCH_RETAIN_RANGE
, ULONG
, LPWSTR
);
118 #define GetFilePatchSignature WINELIB_NAME_AW(GetFilePatchSignature)
120 BOOL WINAPI
GetFilePatchSignatureByHandle(HANDLE
, ULONG
, PVOID
, ULONG
, PPATCH_IGNORE_RANGE
,
121 ULONG
, PPATCH_RETAIN_RANGE
, ULONG
, LPSTR
);
122 BOOL WINAPI
GetFilePatchSignatureByBuffer(PBYTE
, ULONG
, ULONG
, PVOID
, ULONG
, PPATCH_IGNORE_RANGE
, ULONG
,
123 PPATCH_RETAIN_RANGE
, ULONG
, LPSTR
);
124 INT WINAPI
NormalizeFileForPatchSignature(PVOID
, ULONG
, ULONG
, PATCH_OPTION_DATA
*, ULONG
,
125 ULONG
, ULONG
, PPATCH_IGNORE_RANGE
, ULONG
, PPATCH_RETAIN_RANGE
);
131 #endif /* _PATCHAPI_H_ */