Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 Google Inc. All Rights Reserved. | 1 // Copyright 2015 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 // | 14 // |
| 15 // Definition of some structures encountered in the PE files. | 15 // Definition of some structures encountered in the PE files. |
| 16 | 16 |
| 17 #ifndef SYZYGY_PE_PE_STRUCTS_H_ | 17 #ifndef SYZYGY_PE_PE_STRUCTS_H_ |
| 18 #define SYZYGY_PE_PE_STRUCTS_H_ | 18 #define SYZYGY_PE_PE_STRUCTS_H_ |
| 19 | 19 |
| 20 #include <windows.h> | 20 #include <windows.h> |
| 21 | 21 |
| 22 namespace pe { | 22 namespace pe { |
| 23 | 23 |
| 24 // Redefinition of the IMAGE_LOAD_CONFIG_CODE_INTEGRITY structure. This | |
| 25 // corresponds to the structure as encountered in the version 10.0+ of the | |
| 26 // Windows SDK. | |
| 27 struct IMAGE_LOAD_CONFIG_CODE_INTEGRITY { | |
| 28 WORD Flags; | |
| 29 WORD Catalog; | |
| 30 DWORD CatalogOffset; | |
| 31 DWORD Reserved; | |
| 32 }; | |
| 33 | |
| 24 // Redefinition of the IMAGE_LOAD_CONFIG_DIRECTORY structure. This corresponds | 34 // 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. | 35 // to the structure as encountered in the version 10.0.14393 of the Windows SDK. |
| 26 struct LoadConfigDirectory { | 36 struct LoadConfigDirectory { |
| 27 // Fields available in v8.0+ of the Windows SDK. | 37 // Fields available in v8.0+ of the Windows SDK. |
| 28 DWORD Size; | 38 DWORD Size; |
| 29 DWORD TimeDateStamp; | 39 DWORD TimeDateStamp; |
| 30 WORD MajorVersion; | 40 WORD MajorVersion; |
| 31 WORD MinorVersion; | 41 WORD MinorVersion; |
| 32 DWORD GlobalFlagsClear; | 42 DWORD GlobalFlagsClear; |
| 33 DWORD GlobalFlagsSet; | 43 DWORD GlobalFlagsSet; |
| 34 DWORD CriticalSectionDefaultTimeout; | 44 DWORD CriticalSectionDefaultTimeout; |
| 35 DWORD DeCommitFreeBlockThreshold; | 45 DWORD DeCommitFreeBlockThreshold; |
| 36 DWORD DeCommitTotalFreeThreshold; | 46 DWORD DeCommitTotalFreeThreshold; |
| 37 DWORD LockPrefixTable; // VA | 47 DWORD LockPrefixTable; // VA |
| 38 DWORD MaximumAllocationSize; | 48 DWORD MaximumAllocationSize; |
| 39 DWORD VirtualMemoryThreshold; | 49 DWORD VirtualMemoryThreshold; |
| 40 DWORD ProcessHeapFlags; | 50 DWORD ProcessHeapFlags; |
| 41 DWORD ProcessAffinityMask; | 51 DWORD ProcessAffinityMask; |
| 42 WORD CSDVersion; | 52 WORD CSDVersion; |
| 43 WORD Reserved1; | 53 WORD Reserved1; |
| 44 DWORD EditList; // VA | 54 DWORD EditList; // VA |
| 45 DWORD SecurityCookie; // VA | 55 DWORD SecurityCookie; // VA |
| 46 DWORD SEHandlerTable; // VA | 56 DWORD SEHandlerTable; // VA |
| 47 DWORD SEHandlerCount; | 57 DWORD SEHandlerCount; |
| 48 | 58 |
| 49 // Fields available in v8.1+ of the Windows SDK. | 59 // Fields available in v8.1+ of the Windows SDK. |
| 50 DWORD GuardCFCheckFunctionPointer; // VA | 60 DWORD GuardCFCheckFunctionPointer; // VA |
| 51 DWORD Reserved2; | 61 DWORD Reserved2; |
| 52 DWORD GuardCFFunctionTable; // VA | 62 DWORD GuardCFFunctionTable; // VA |
| 53 DWORD GuardCFFunctionCount; | 63 DWORD GuardCFFunctionCount; |
| 54 DWORD GuardFlags; | 64 DWORD GuardFlags; |
| 65 | |
| 66 // Fields available in v10.0+ of the Windows SDK. | |
| 67 IMAGE_LOAD_CONFIG_CODE_INTEGRITY CodeIntegrity; | |
| 68 DWORD GuardAddressTakenIatEntryTable; // VA | |
| 69 DWORD GuardAddressTakenIatEntryCount; | |
| 70 DWORD GuardLongJumpTargetTable; // VA | |
| 71 DWORD GuardLongJumpTargetCount; | |
| 72 DWORD DynamicValueRelocTable; // VA | |
| 73 DWORD HybridMetadataPointer; | |
| 55 }; | 74 }; |
| 56 | 75 |
| 57 // An enum mapping the size of a given IMAGE_LOAD_CONFIG_DIRECTORY structure to | 76 // An enum mapping the size of a given IMAGE_LOAD_CONFIG_DIRECTORY structure |
| 58 // the corresponding version of the Windows SDK. | 77 // to the corresponding version of the Windows SDK. |
| 59 enum LoadConfigDirectoryVersion { | 78 enum LoadConfigDirectoryVersion { |
| 60 kLoadConfigDirectorySizeUnknown = 0, | 79 kLoadConfigDirectorySizeUnknown = 0, |
| 80 // Corresponds to the version 8.0 of the Windows SDK. | |
| 61 kLoadConfigDirectorySize80 = | 81 kLoadConfigDirectorySize80 = |
| 62 offsetof(LoadConfigDirectory, GuardCFCheckFunctionPointer), | 82 offsetof(LoadConfigDirectory, GuardCFCheckFunctionPointer), |
| 63 kLoadConfigDirectorySize81 = sizeof(LoadConfigDirectory), | 83 // Corresponds to the version 8.1+ of the Windows SDK or to the version 10 |
| 84 // with the code integrity feature disabled. | |
| 85 kLoadConfigDirectorySizeNoCodeIntegrity = | |
|
chrisha
2017/03/23 21:29:29
I'd prefer two identical enums:
kLoadConfigDirect
Sébastien Marchand
2017/03/24 13:19:52
Done.
| |
| 86 offsetof(LoadConfigDirectory, CodeIntegrity), | |
| 87 // Corresponds to the version 10.0+ of the Windows SDK with the CFG feature | |
| 88 // disabled. | |
| 89 kLoadConfigDirectorySizeNoCFG = | |
|
chrisha
2017/03/23 21:29:30
And kLoadConfigDirectorySize100NoCFG
This is more
Sébastien Marchand
2017/03/24 13:19:52
Done.
| |
| 90 offsetof(LoadConfigDirectory, GuardAddressTakenIatEntryTable), | |
| 91 // Corresponds to the full version 10.0 of the Windows SDK. | |
| 92 kLoadConfigDirectorySize100 = sizeof(LoadConfigDirectory), | |
| 64 }; | 93 }; |
| 65 | 94 |
| 66 }; // namespace pe | 95 }; // namespace pe |
| 67 | 96 |
| 68 #endif // SYZYGY_PE_PE_STRUCTS_H_ | 97 #endif // SYZYGY_PE_PE_STRUCTS_H_ |
| OLD | NEW |