[MSPATCHA] Initial patch decoding + applying.
[reactos.git] / sdk / include / psdk / patchapi.h
1 /*
2 * Copyright 2011 Hans Leidekker for CodeWeavers
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #ifndef _PATCHAPI_H_
20 #define _PATCHAPI_H_
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #define APPLY_OPTION_FAIL_IF_EXACT 0x00000001
27 #define APPLY_OPTION_FAIL_IF_CLOSE 0x00000002
28 #define APPLY_OPTION_TEST_ONLY 0x00000004
29 #define APPLY_OPTION_VALID_FLAGS 0x00000007
30
31
32 //
33 // apply error codes
34 //
35 #define ERROR_PATCH_DECODE_FAILURE 0xC00E4101
36 #define ERROR_PATCH_CORRUPT 0xC00E4102
37 #define ERROR_PATCH_NEWER_FORMAT 0xC00E4103
38 #define ERROR_PATCH_WRONG_FILE 0xC00E4104
39 #define ERROR_PATCH_NOT_NECESSARY 0xC00E4105
40 #define ERROR_PATCH_NOT_AVAILABLE 0xC00E4106
41
42
43 typedef struct _PATCH_IGNORE_RANGE
44 {
45 ULONG OffsetInOldFile;
46 ULONG LengthInBytes;
47 } PATCH_IGNORE_RANGE, *PPATCH_IGNORE_RANGE;
48
49 typedef struct _PATCH_RETAIN_RANGE
50 {
51 ULONG OffsetInOldFile;
52 ULONG LengthInBytes;
53 ULONG OffsetInNewFile;
54 } PATCH_RETAIN_RANGE, *PPATCH_RETAIN_RANGE;
55
56
57 typedef WINBOOL (CALLBACK PATCH_PROGRESS_CALLBACK)(PVOID CallbackContext, ULONG CurrentPosition, ULONG MaximumPosition);
58 typedef PATCH_PROGRESS_CALLBACK *PPATCH_PROGRESS_CALLBACK;
59
60
61 BOOL WINAPI TestApplyPatchToFileA(LPCSTR PatchFileName, LPCSTR OldFileName, ULONG ApplyOptionFlags);
62 BOOL WINAPI TestApplyPatchToFileW(LPCWSTR PatchFileName, LPCWSTR OldFileName, ULONG ApplyOptionFlags);
63 #define TestApplyPatchToFile WINELIB_NAME_AW(TestApplyPatchToFile)
64 BOOL WINAPI TestApplyPatchToFileByHandles(HANDLE PatchFileHandle, HANDLE OldFileHandle, ULONG ApplyOptionFlags);
65
66
67 BOOL WINAPI ApplyPatchToFileA(LPCSTR PatchFileName, LPCSTR OldFileName, LPCSTR NewFileName, ULONG ApplyOptionFlags);
68 BOOL WINAPI ApplyPatchToFileW(LPCWSTR PatchFileName, LPCWSTR OldFileName, LPCWSTR NewFileName, ULONG ApplyOptionFlags);
69 #define ApplyPatchToFile WINELIB_NAME_AW(ApplyPatchToFile)
70 BOOL WINAPI ApplyPatchToFileByHandles(HANDLE PatchFileHandle, HANDLE OldFileHandle, HANDLE NewFileHandle, ULONG ApplyOptionFlags);
71
72
73 BOOL WINAPI GetFilePatchSignatureA(LPCSTR FileName, ULONG OptionFlags, PVOID OptionData, ULONG IgnoreRangeCount,
74 PPATCH_IGNORE_RANGE IgnoreRangeArray, ULONG RetainRangeCount,
75 PPATCH_RETAIN_RANGE RetainRangeArray, ULONG SignatureBufferSize,
76 PVOID SignatureBuffer);
77 BOOL WINAPI GetFilePatchSignatureW(LPCWSTR FileName, ULONG OptionFlags, PVOID OptionData, ULONG IgnoreRangeCount,
78 PPATCH_IGNORE_RANGE IgnoreRangeArray, ULONG RetainRangeCount,
79 PPATCH_RETAIN_RANGE RetainRangeArray, ULONG SignatureBufferSize,
80 PVOID SignatureBuffer);
81 #define GetFilePatchSignature WINELIB_NAME_AW(GetFilePatchSignature)
82 BOOL WINAPI GetFilePatchSignatureByHandle(HANDLE FileHandle, ULONG OptionFlags, PVOID OptionData, ULONG IgnoreRangeCount,
83 PPATCH_IGNORE_RANGE IgnoreRangeArray, ULONG RetainRangeCount,
84 PPATCH_RETAIN_RANGE RetainRangeArray, ULONG SignatureBufferSize,
85 PVOID SignatureBuffer);
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif /* _PATCHAPI_H_ */