diff options
author | Christopher Faylor <me@cgf.cx> | 2011-05-28 20:55:34 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-05-28 20:55:34 +0000 |
commit | 6cd2e18523b86befc0ac656b1308a1b3494e985f (patch) | |
tree | 5d0c8b1f802933b81a53f5019db0387bda3c9c3b /winsup/cygwin/dll_init.h | |
parent | 07f89f85dbae1e891e8d45b5477db24c66f774b4 (diff) | |
download | cygnal-6cd2e18523b86befc0ac656b1308a1b3494e985f.tar.gz cygnal-6cd2e18523b86befc0ac656b1308a1b3494e985f.tar.bz2 cygnal-6cd2e18523b86befc0ac656b1308a1b3494e985f.zip |
* dll_init.cc (dll_list::alloc): Initialize dll::image_size.
(reserve_at): Don't reserve space needed by the target dll if the latter
overlaps the free region to be blocked.
(dll_list::load_after_fork): Use new version of reserve_at.
* dll_init.h (dll::image_size): New member.
(pefile): New struct.
Diffstat (limited to 'winsup/cygwin/dll_init.h')
-rw-r--r-- | winsup/cygwin/dll_init.h | 19 |
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 (); |