I am trying to write python script to extract information from import table. I managed to acquire function names imported by each dll. However I am not sure how I could access Hint. Any suggestion?
How we can get Hint in IMAGE_IMPORT_BY_NAME STRUCT in PE file?
2.5k views Asked by Likak At
1
There are 1 answers
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in PORTABLE-EXECUTABLE
- How can I patch a function call to a Windows DLL (e.g. kernel32 LoadLibrary)? Is this even possible?
- How to protect MSI installer digital signature from tampering
- How can I extract raw bytes of DOS stub using python's pefile library?
- How can I decompile an exe protected by a PE packer?
- Spurious trampoline when calling function from DLL
- Trying to convert MASM into C equivalent, but getting different result
- Parse PE File with C in Windows
- PE Loader with Relocation
- How do file pointers point to the of data on the disk?
- Software copyright infringement
- Getting the forwarded function name
- parsing a PE file to find the export table address using CFF explorer and msdn doc
- Extract/parse resources from Portable Executable (PE) file
- A “universal” binary?
- Relocation Table and IDA
Related Questions in IMPORT-TABLE
- R - Importing and formatting mutiple tables from various urls
- googlesheets can't import expandable table
- MySQL shell multi threaded load data infile
- How to skip/dummy columns in mysqlsh importTable util?
- How to optimize the performance of data pulling from a very large text file in excel via VBA
- What is the Derby SQL command to load a tab delimited text file into a blank table?
- How can I resolve the forwarded API from the IAT on PE?
- Crashes after Injecting std functions in a process
- Invalid API's even though right RVA and size
- What is Structure of IMAGE_THUNK_DATA?
- How we can get Hint in IMAGE_IMPORT_BY_NAME STRUCT in PE file?
- Import table from HTML into Matlab
- Why does dependency walker show missing dlls?
- Copy table data from web page to excel sheet
- Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
I'm going to assume you have a pointer to an IMAGE_THUNK_DATA structure for a 32-bit module (or IMAGE_THUNK_DATA64 for a PE32+) since you are already enumerating the names, so we'll just start by covering the bases from there. I'll also assume you are dealing with 32-bit modules, since you haven't specified otherwise.
The IMAGE_THUNK_DATA array is just an array of DWORDs and each DWORD represents an imported function. To know that a function is imported by name instead of ordinal, you must check that the highest bit is NOT set in the DWORD (i.e. 0x80000000).
1> If the high-bit is set, the value of the DWORD ANDed with 0xFFFF (just taking the low WORD) is the ordinal (and is also the "hint" value). The function is therefore imported by ordinal and there is no name available.
2> If the high-bit is not set, the whole DWORD is an RVA (pointer to memory image, without the base) to a IMAGE_IMPORT_BY_NAME structure. If you are reading from the file image, you'll have to convert the RVA to a file offset. I'll also assume you are already doing this, otherwise you wouldn't have the imported function names. The IMAGE_IMPORT_BY_NAME structure is defined as follows in winnt.h:
NOTE: The BYTE designated at Name of course only marks the beginning of the character array of the imported function name as the name can be larger than one character.
The first WORD is the hint, which you must be skipping over if you already have the name. Do you a snippet of the code you can show that you are having a problem with?