Changeset 84636 in webkit
- Timestamp:
- Apr 22, 2011 9:45:49 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84635 r84636 1 2011-04-21 Adam Roben <aroben@apple.com> 2 3 Add code to enumerate all the functions imported by a particular Windows binary 4 5 PEImage is where all the logic starts. It represents a single Portable Executable (PE) 6 binary. The various enumerator classes are used in conjunction with PEImage to enumerate the 7 modules and functions imported by that image. 8 9 I couldn't figure out how to write a test for this. :-( 10 11 Part of <http://webkit.org/b/51063> <rdar://problem/8769281> REGRESSION (WebKit2): No 12 context menu appears when right-clicking on windowless Flash plugin 13 14 Reviewed by Sam Weinig, and given a good once-over by Jeff Miller. 15 16 * WebCore.vcproj/WebCore.vcproj: Added the new files. 17 18 * platform/win/PEImage.cpp: Added. 19 (WebCore::PEImage::PEImage): Checks that the module contains the expected magic numbers, 20 then initializes m_ntHeaders using the module. 21 (WebCore::PEImage::convertRVAToAddress): Converts a relative virtual address (RVA) to a 22 non-relative address, which can then be dereferenced. (The PE format uses RVAs in lots of 23 places.) 24 (WebCore::PEImage::dataDirectoryEntryAddress): Returns the address of the data associated 25 with the given entry in the image's DataDirectory. 26 27 * platform/win/PEImage.h: Added. 28 (WebCore::PEImage::isValid): We're a valid image if the validation code in our constructor 29 succeeded, in which case m_ntHeaders will be set. 30 31 * platform/win/ImportedFunctionsEnumerator.cpp: Added. This class enumerates all the 32 functions imported by the image from a single module by walking the Import Name Table (INT) 33 and Import Address Table (IAT). 34 (WebCore::ImportedFunctionsEnumerator::ImportedFunctionsEnumerator): Initialize our members. 35 (WebCore::ImportedFunctionsEnumerator::isAtEnd): The INT and IAT are both 0-terminated 36 arrays. 37 (WebCore::ImportedFunctionsEnumerator::next): Step to the next entries in the INT and IAT. 38 (WebCore::ImportedFunctionsEnumerator::currentFunctionName): Gets the address of the 39 function's name, if possible, using the INT. 40 (WebCore::ImportedFunctionsEnumerator::addressOfCurrentFunctionPointer): Returns the address 41 of the function pointer for the current function. This function pointer is used whenever 42 code in m_image calls the current function. (A future patch will take advantage of this by 43 overwriting this function pointer with another, thereby redirecting calls to that function.) 44 45 * platform/win/ImportedFunctionsEnumerator.h: Added. 46 47 * platform/win/ImportedModulesEnumeratorBase.h: Added. This base class is used by 48 ImportedModulesEnumerator and DelayLoadedModulesEnumerator, and allows code to be written 49 that works with either one. 50 51 * platform/win/ImportedModulesEnumerator.cpp: Added. This class enumerates all the 52 non-delay-loaded modules imported by the image by walking the image's import array. 53 (WebCore::ImportedModulesEnumerator::ImportedModulesEnumerator): Module import information 54 is stored in the IMAGE_DIRECTORY_ENTRY_IMPORT entry of the image's DataDirectory. 55 (WebCore::ImportedModulesEnumerator::isAtEnd): The import array is 0-terminated. 56 (WebCore::ImportedModulesEnumerator::next): Steps along the import array. 57 (WebCore::ImportedModulesEnumerator::currentModuleName): Gets the address of the module's 58 name. 59 (WebCore::ImportedModulesEnumerator::functionsEnumerator): Get's the addresses of the INT 60 and IAT for this module and wraps them in an ImportedFunctionsEnumerator. 61 62 * platform/win/ImportedModulesEnumerator.h: Added. 63 64 * platform/win/DelayLoadedModulesEnumerator.cpp: Added. This class enumerates all the 65 delay-loaded modules that are imported by the given PEImage by walking the image's 66 ImageDelayDescr array. 67 (WebCore::DelayLoadedModulesEnumerator::DelayLoadedModulesEnumerator): Delay-load 68 information is stored in the IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT entry of the image's 69 DataDirectory. 70 (WebCore::DelayLoadedModulesEnumerator::isAtEnd): The delay-loaded modules array is 71 0-terminated. 72 (WebCore::DelayLoadedModulesEnumerator::next): Steps along the delay-loaded modules array. 73 (WebCore::DelayLoadedModulesEnumerator::currentModuleName): Gets the address of the module's 74 name out of the descriptor. 75 (WebCore::DelayLoadedModulesEnumerator::functionsEnumerator): Gets the INT and IAT for the 76 current module out of the descriptor and makes an ImportedFunctionsEnumerator from them. 77 (WebCore::DelayLoadedModulesEnumerator::convertPotentialRVAToAddress): Pre-VC7.0 images 78 stored non-relative addresses in the ImageDelayDescr structures, while VC7.0 and later 79 images store RVAs. This function abstracts away the difference. 80 81 * platform/win/DelayLoadedModulesEnumerator.h: Added. 82 1 83 2011-04-21 Adam Roben <aroben@apple.com> 2 84 -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r84635 r84636 26498 26498 </File> 26499 26499 <File 26500 RelativePath="..\platform\win\DelayLoadedModulesEnumerator.cpp" 26501 > 26502 </File> 26503 <File 26504 RelativePath="..\platform\win\DelayLoadedModulesEnumerator.h" 26505 > 26506 </File> 26507 <File 26500 26508 RelativePath="..\platform\win\DragDataWin.cpp" 26501 26509 > … … 26586 26594 </File> 26587 26595 <File 26596 RelativePath="..\platform\win\ImportedFunctionsEnumerator.cpp" 26597 > 26598 </File> 26599 <File 26600 RelativePath="..\platform\win\ImportedFunctionsEnumerator.h" 26601 > 26602 </File> 26603 <File 26604 RelativePath="..\platform\win\ImportedModulesEnumerator.cpp" 26605 > 26606 </File> 26607 <File 26608 RelativePath="..\platform\win\ImportedModulesEnumerator.h" 26609 > 26610 </File> 26611 <File 26612 RelativePath="..\platform\win\ImportedModulesEnumeratorBase.h" 26613 > 26614 </File> 26615 <File 26588 26616 RelativePath="..\platform\win\KeyEventWin.cpp" 26589 26617 > … … 26615 26643 <File 26616 26644 RelativePath="..\platform\win\PathWalker.h" 26645 > 26646 </File> 26647 <File 26648 RelativePath="..\platform\win\PEImage.cpp" 26649 > 26650 </File> 26651 <File 26652 RelativePath="..\platform\win\PEImage.h" 26617 26653 > 26618 26654 </File>
Note: See TracChangeset
for help on using the changeset viewer.