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 124502 2004-01-13 22:26:37Z obrien $");
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,
--- 527 unchanged lines hidden (view full) ---
570
571/*
572 * Patch the imported function addresses for a given module.
573 * The caller must specify the module name and provide a table
574 * of function pointers that will be patched into the jump table.
575 * Note that there are actually two copies of the jump table: one
576 * copy is left alone. In a .SYS file, the jump tables are usually
577 * merged into the INIT segment.
578 *
579 * Note: Windows uses the _stdcall calling convention. This means
580 * that the callback functions provided in the function table must
581 * be declared using __attribute__((__stdcall__)), otherwise the
582 * Windows code will likely screw up the %esp register and cause
583 * us to jump to an invalid address when it returns.
584 */
585
586int
587pe_patch_imports(imgbase, module, functbl)
588 vm_offset_t imgbase;
589 char *module;
590 image_patch_table *functbl;
591{
--- 31 unchanged lines hidden ---
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 124502 2004-01-13 22:26:37Z obrien $");
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,
--- 527 unchanged lines hidden (view full) ---
570
571/*
572 * Patch the imported function addresses for a given module.
573 * The caller must specify the module name and provide a table
574 * of function pointers that will be patched into the jump table.
575 * Note that there are actually two copies of the jump table: one
576 * copy is left alone. In a .SYS file, the jump tables are usually
577 * merged into the INIT segment.
578 *
579 * Note: Windows uses the _stdcall calling convention. This means
580 * that the callback functions provided in the function table must
581 * be declared using __attribute__((__stdcall__)), otherwise the
582 * Windows code will likely screw up the %esp register and cause
583 * us to jump to an invalid address when it returns.
584 */
585
586int
587pe_patch_imports(imgbase, module, functbl)
588 vm_offset_t imgbase;
589 char *module;
590 image_patch_table *functbl;
591{
--- 31 unchanged lines hidden ---