1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Definition of some structures encountered in the PE files.
16 :
17 : #ifndef SYZYGY_PE_PE_STRUCTS_H_
18 : #define SYZYGY_PE_PE_STRUCTS_H_
19 :
20 : #include <windows.h>
21 :
22 m : namespace pe {
23 :
24 : // Redefinition of the IMAGE_LOAD_CONFIG_DIRECTORY structure. This corresponds
25 : // to the structure as encountered in the version 8.1 of the Windows SDK.
26 m : struct LoadConfigDirectory {
27 : // Fields available in v8.0+ of the Windows SDK.
28 m : DWORD Size;
29 m : DWORD TimeDateStamp;
30 m : WORD MajorVersion;
31 m : WORD MinorVersion;
32 m : DWORD GlobalFlagsClear;
33 m : DWORD GlobalFlagsSet;
34 m : DWORD CriticalSectionDefaultTimeout;
35 m : DWORD DeCommitFreeBlockThreshold;
36 m : DWORD DeCommitTotalFreeThreshold;
37 m : DWORD LockPrefixTable; // VA
38 m : DWORD MaximumAllocationSize;
39 m : DWORD VirtualMemoryThreshold;
40 m : DWORD ProcessHeapFlags;
41 m : DWORD ProcessAffinityMask;
42 m : WORD CSDVersion;
43 m : WORD Reserved1;
44 m : DWORD EditList; // VA
45 m : DWORD SecurityCookie; // VA
46 m : DWORD SEHandlerTable; // VA
47 m : DWORD SEHandlerCount;
48 :
49 : // Fields available in v8.1+ of the Windows SDK.
50 m : DWORD GuardCFCheckFunctionPointer; // VA
51 m : DWORD Reserved2;
52 m : DWORD GuardCFFunctionTable; // VA
53 m : DWORD GuardCFFunctionCount;
54 m : DWORD GuardFlags;
55 m : };
56 :
57 : // An enum mapping the size of a given IMAGE_LOAD_CONFIG_DIRECTORY structure to
58 : // the corresponding version of the Windows SDK.
59 m : enum LoadConfigDirectoryVersion {
60 m : kLoadConfigDirectorySizeUnknown = 0,
61 m : kLoadConfigDirectorySize80 =
62 m : offsetof(LoadConfigDirectory, GuardCFCheckFunctionPointer),
63 m : kLoadConfigDirectorySize81 = sizeof(LoadConfigDirectory),
64 m : };
65 :
66 m : }; // namespace pe
67 :
68 : #endif // SYZYGY_PE_PE_STRUCTS_H_
|