subr_pe.c (168421) | subr_pe.c (189488) |
---|---|
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> | 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 168421 2007-04-06 11:18:57Z pjd $"); | 34__FBSDID("$FreeBSD: head/sys/compat/ndis/subr_pe.c 189488 2009-03-07 07:26:22Z weongyo $"); |
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, --- 369 unchanged lines hidden (view full) --- 412 relhdr->ibr_vaddr + IMR_RELOFFSET(rel)); 413 *sloc += (delta & 0xFFFF); 414 break; 415 case IMAGE_REL_BASED_DIR64: 416 qloc = (uint64_t *)pe_translate_addr(imgbase, 417 relhdr->ibr_vaddr + IMR_RELOFFSET(rel)); 418 *qloc = pe_translate_addr(imgbase, 419 (*qloc - base)); | 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, --- 369 unchanged lines hidden (view full) --- 412 relhdr->ibr_vaddr + IMR_RELOFFSET(rel)); 413 *sloc += (delta & 0xFFFF); 414 break; 415 case IMAGE_REL_BASED_DIR64: 416 qloc = (uint64_t *)pe_translate_addr(imgbase, 417 relhdr->ibr_vaddr + IMR_RELOFFSET(rel)); 418 *qloc = pe_translate_addr(imgbase, 419 (*qloc - base)); |
420 break; | 420 break; |
421 422 default: 423 printf ("[%d]reloc type: %d\n",i, 424 IMR_RELTYPE(rel)); 425 break; 426 } 427 } 428 relhdr = (image_base_reloc *)((vm_offset_t)relhdr + --- 12 unchanged lines hidden (view full) --- 441 * Note: module names are case insensitive! 442 */ 443 444int 445pe_get_import_descriptor(imgbase, desc, module) 446 vm_offset_t imgbase; 447 image_import_descriptor *desc; 448 char *module; | 421 422 default: 423 printf ("[%d]reloc type: %d\n",i, 424 IMR_RELTYPE(rel)); 425 break; 426 } 427 } 428 relhdr = (image_base_reloc *)((vm_offset_t)relhdr + --- 12 unchanged lines hidden (view full) --- 441 * Note: module names are case insensitive! 442 */ 443 444int 445pe_get_import_descriptor(imgbase, desc, module) 446 vm_offset_t imgbase; 447 image_import_descriptor *desc; 448 char *module; |
449{ | 449{ |
450 vm_offset_t offset; 451 image_import_descriptor *imp_desc; 452 char *modname; 453 454 if (imgbase == 0 || module == NULL || desc == NULL) 455 return(EINVAL); 456 457 offset = pe_directory_offset(imgbase, IMAGE_DIRECTORY_ENTRY_IMPORT); --- 185 unchanged lines hidden --- | 450 vm_offset_t offset; 451 image_import_descriptor *imp_desc; 452 char *modname; 453 454 if (imgbase == 0 || module == NULL || desc == NULL) 455 return(EINVAL); 456 457 offset = pe_directory_offset(imgbase, IMAGE_DIRECTORY_ENTRY_IMPORT); --- 185 unchanged lines hidden --- |