diff options
author | Christopher Faylor <me@cgf.cx> | 2006-07-06 17:16:37 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-07-06 17:16:37 +0000 |
commit | b4054e770675ff388d3fcbca41e8e3233f0a7ac1 (patch) | |
tree | 36b292788ae10fcd7235964573d27a17652474de /winsup/cygwin/hookapi.cc | |
parent | 26d31dc917d6dd05cea56a5f7169586d9a7abf05 (diff) | |
download | cygnal-b4054e770675ff388d3fcbca41e8e3233f0a7ac1.tar.gz cygnal-b4054e770675ff388d3fcbca41e8e3233f0a7ac1.tar.bz2 cygnal-b4054e770675ff388d3fcbca41e8e3233f0a7ac1.zip |
* hookapi.cc: Add comment header
(putmem): Make static.
(get_export): Ditto.
(rvadelta): Ditto. Don't assume that a section which ends where the import_rva
begins is the import list.
* child_info.h: Update copyright.
* fork.cc: Ditto.
Diffstat (limited to 'winsup/cygwin/hookapi.cc')
-rw-r--r-- | winsup/cygwin/hookapi.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/winsup/cygwin/hookapi.cc b/winsup/cygwin/hookapi.cc index a58814e6b..39ba6de88 100644 --- a/winsup/cygwin/hookapi.cc +++ b/winsup/cygwin/hookapi.cc @@ -1,3 +1,13 @@ +/* hookapi.cc + + Copyright 2005, 2006 Red Hat, Inc. + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + #include "winsup.h" #include "cygerrno.h" #include "security.h" @@ -38,19 +48,19 @@ PEHeaderFromHModule (HMODULE hModule) return pNTHeader; } -long +static long rvadelta (PIMAGE_NT_HEADERS pnt, DWORD import_rva) { PIMAGE_SECTION_HEADER section = (PIMAGE_SECTION_HEADER) (pnt + 1); for (int i = 0; i < pnt->FileHeader.NumberOfSections; i++) if (section[i].VirtualAddress <= import_rva - && (section[i].VirtualAddress + section[i].Misc.VirtualSize) >= import_rva) + && (section[i].VirtualAddress + section[i].Misc.VirtualSize) > import_rva) // if (strncasematch ((char *) section[i].Name, ".idata", IMAGE_SIZEOF_SHORT_NAME)) return section[i].VirtualAddress - section[i].PointerToRawData; return -1; } -void * +static void * putmem (PIMAGE_THUNK_DATA pi, const void *hookfn) { DWORD ofl; @@ -108,7 +118,7 @@ RedirectIAT (function_hook& fh, PIMAGE_IMPORT_DESCRIPTOR pImportDesc, return true; } -void +static void get_export (function_hook& fh) { PIMAGE_DOS_HEADER pdh = (PIMAGE_DOS_HEADER) cygwin_hmodule; |