1/*- 2 * Copyright (c) 2003 3 * Bill Paul <wpaul@windriver.com>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/compat/ndis/subr_pe.c 142037 2005-02-18 04:33:34Z wpaul $"); |
35 36/* 37 * This file contains routines for relocating and dynamically linking 38 * executable object code files in the Windows(r) PE (Portable Executable) 39 * format. In Windows, anything with a .EXE, .DLL or .SYS extention is 40 * considered an executable, and all such files have some structures in 41 * common. The PE format was apparently based largely on COFF but has 42 * mutated significantly over time. We are mainly concerned with .SYS files, --- 247 unchanged lines hidden (view full) --- 290 * the section alignment and rounding the section length 291 * up to a page boundary. 292 */ 293 while (i++ < sections) { 294 fixedlen = sect_hdr->ish_misc.ish_vsize; 295 fixedlen += ((opt_hdr.ioh_sectalign - 1) - 296 sect_hdr->ish_misc.ish_vsize) & 297 (opt_hdr.ioh_sectalign - 1); |
298 if (sect_hdr->ish_vaddr <= (uint32_t)rva && |
299 (sect_hdr->ish_vaddr + fixedlen) > |
300 (uint32_t)rva) |
301 break; 302 sect_hdr++; 303 } 304 305 if (i > sections) 306 return(0); 307 308 return((vm_offset_t)(imgbase + rva - sect_hdr->ish_vaddr + --- 326 unchanged lines hidden --- |