summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dll_init.h
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dll_init.h')
-rw-r--r--winsup/cygwin/dll_init.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/winsup/cygwin/dll_init.h b/winsup/cygwin/dll_init.h
index d14cc6cb9..dc5c57038 100644
--- a/winsup/cygwin/dll_init.h
+++ b/winsup/cygwin/dll_init.h
@@ -52,6 +52,7 @@ struct dll
int count;
bool has_dtors;
dll_type type;
+ DWORD image_size;
WCHAR name[1];
void detach ();
int init ();
@@ -109,6 +110,24 @@ public:
dll_list () { protect.init ("dll_list"); }
};
+/* References:
+ http://msdn.microsoft.com/en-us/windows/hardware/gg463125
+ http://msdn.microsoft.com/en-us/library/ms809762.aspx
+*/
+struct pefile
+{
+ IMAGE_DOS_HEADER dos_hdr;
+
+ char* rva (long offset) { return (char*) this + offset; }
+ PIMAGE_NT_HEADERS32 pe_hdr () { return (PIMAGE_NT_HEADERS32) rva (dos_hdr.e_lfanew); }
+ PIMAGE_OPTIONAL_HEADER32 optional_hdr () { return &pe_hdr ()->OptionalHeader; }
+ PIMAGE_DATA_DIRECTORY idata_dir (DWORD which)
+ {
+ PIMAGE_OPTIONAL_HEADER32 oh = optional_hdr ();
+ return (which < oh->NumberOfRvaAndSizes)? oh->DataDirectory + which : 0;
+ }
+};
+
extern dll_list dlls;
void dll_global_dtors ();