freebsd-skq/sys/compat/ndis
wpaul 6140104fb2 Clean up and apply the fix for PR 83477. The calculation for locating
the start of the section headers has to take into account the fact
that the image_nt_header is really variable sized. It happens that
the existing calculation is correct for _most_ production binaries
produced by the Windows DDK, but if we get a binary with oddball
offsets, the PE loader could crash.

Changes from the supplied patch are:

- We don't really need to use the IMAGE_SIZEOF_NT_HEADER() macro when
  computing how much of the header to return to callers of
  pe_get_optional_header(). While it's important to take the variable
  size of the header into account in other calculations, we never
  actually look at anything outside the non-variable portion of the
  header. This saves callers from having to allocate a variable sized
  buffer off the heap (I purposely tried to avoid using malloc()
  in subr_pe.c to make it easier to compile in both the -D_KERNEL and
  !-D_KERNEL case), and since we're copying into a buffer on the
  stack, we always have to copy the same amount of data or else
  we'll trash the stack something fierce.

- We need <stddef.h> to get offsetof() in the !-D_KERNEL case.

- ndiscvt.c needs the IMAGE_FIRST_SECTION() macro too, since it does
  a little bit of section pre-processing.

PR: kern/83477
2005-10-26 18:46:27 +00:00
..
cfg_var.h Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
hal_var.h Create new i386 windows/bsd thunking layer, similar to the amd64 thunking 2005-04-11 02:02:35 +00:00
kern_ndis.c Get rid of the timer tracking and reaping code in NdisMInitializeTimer() 2005-10-26 06:52:57 +00:00
kern_windrv.c This commit makes a big round of updates and fixes many, many things. 2005-10-10 16:46:39 +00:00
ndis_var.h Another round of cleanups and fixes: 2005-10-18 19:52:15 +00:00
ntoskrnl_var.h Get rid of the timer tracking and reaping code in NdisMInitializeTimer() 2005-10-26 06:52:57 +00:00
pe_var.h Clean up and apply the fix for PR 83477. The calculation for locating 2005-10-26 18:46:27 +00:00
resource_var.h Add support for Windows/x86-64 binaries to Project Evil. 2005-02-16 05:41:18 +00:00
subr_hal.c Correct the macro definition for KeRaiseIrql(). The official API 2005-10-21 05:23:20 +00:00
subr_ndis.c Get rid of the timer tracking and reaping code in NdisMInitializeTimer() 2005-10-26 06:52:57 +00:00
subr_ntoskrnl.c Get rid of the timer tracking and reaping code in NdisMInitializeTimer() 2005-10-26 06:52:57 +00:00
subr_pe.c Clean up and apply the fix for PR 83477. The calculation for locating 2005-10-26 18:46:27 +00:00
subr_usbd.c This commit makes a bunch of changes, some big, some not so big. 2005-05-05 03:56:09 +00:00
usbd_var.h - Correct one aspect of the driver_object/device_object/IRP framework: 2005-02-24 21:49:14 +00:00
winx32_wrap.S This commit makes a big round of updates and fixes many, many things. 2005-10-10 16:46:39 +00:00
winx64_wrap.S When setting up the new stack for a function in x86_64_wrap(), make 2005-04-16 04:47:15 +00:00