ntoskrnl.exe: add KeAcquireInStackQueuedSpinLock stub (try 2)

Sebastian Lackner sebastian at fds-team.de
Thu Feb 16 23:06:24 CST 2017


On 09.02.2017 23:51, Austin English wrote:
> CC: Sebastian Lackner <sebastian at fds-team.de>
> 
> https://bugs.winehq.org/show_bug.cgi?id=41472
> 
> -- -Austin GPG: 14FB D7EA A041 937B
> 
> 
> 0001-ntoskrnl.exe-add-KeAcquireInStackQueuedSpinLock-stub.patch
> 
> 
> From ee6a34f4a0e558de27aa5d9f3c81a8ad45c24dbb Mon Sep 17 00:00:00 2001
> From: Austin English <austinenglish at gmail.com>
> Date: Mon, 6 Feb 2017 17:11:15 -0600
> Subject: [PATCH] ntoskrnl.exe: add KeAcquireInStackQueuedSpinLock stub (try 2)
> 
> Signed-off-by: Austin English <austinenglish at gmail.com>
> ---
>  dlls/hal/hal.spec                   |  2 +-
>  dlls/ntoskrnl.exe/ntoskrnl.c        | 13 +++++++++++++
>  dlls/ntoskrnl.exe/ntoskrnl.exe.spec |  1 +
>  include/ddk/wdm.h                   | 10 ++++++++++
>  tools/make_specfiles                |  4 ++++
>  5 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/hal/hal.spec b/dlls/hal/hal.spec
> index bd6bc35..f441ac5 100644
> --- a/dlls/hal/hal.spec
> +++ b/dlls/hal/hal.spec
> @@ -4,7 +4,7 @@
>  @ stub HalClearSoftwareInterrupt
>  @ stub HalRequestSoftwareInterrupt
>  @ stub HalSystemVectorDispatchEntry
> -@ stub KeAcquireInStackQueuedSpinLock
> +@ stdcall -norelay KeAcquireInStackQueuedSpinLock(ptr ptr) ntoskrnl.exe.KeAcquireInStackQueuedSpinLock
>  @ stub KeAcquireInStackQueuedSpinLockRaiseToSynch
>  @ stub KeAcquireQueuedSpinLock
>  @ stub KeAcquireQueuedSpinLockRaiseToSynch
> diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
> index 06320d0..b8f6a25 100644
> --- a/dlls/ntoskrnl.exe/ntoskrnl.c
> +++ b/dlls/ntoskrnl.exe/ntoskrnl.c
> @@ -3188,3 +3188,16 @@ VOID WINAPI KeClearEvent(PRKEVENT event)
>  {
>      FIXME("stub: %p\n", event);
>  }
> +
> +/***********************************************************************
> + *           KeAcquireInStackQueuedSpinLock (NTOSKRNL.EXE.@)
> + */
> +#ifdef DEFINE_FASTCALL2_ENTRYPOINT
> +DEFINE_FASTCALL2_ENTRYPOINT( KeAcquireInStackQueuedSpinLock )
> +void WINAPI __regs_KeAcquireInStackQueuedSpinLock(KSPIN_LOCK *spinlock, KLOCK_QUEUE_HANDLE *handle)
> +#else
> +void WINAPI KeAcquireInStackQueuedSpinLock(KSPIN_LOCK *spinlock, KLOCK_QUEUE_HANDLE *handle)
> +#endif
> +{
> +    FIXME( "stub: %p %p\n", spinlock, handle);
> +}
> diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
> index efa69fe..08644fb 100644
> --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
> +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
> @@ -41,6 +41,7 @@
>  @ stub IoWritePartitionTable
>  @ stdcall -norelay IofCallDriver(ptr ptr)
>  @ stdcall -norelay IofCompleteRequest(ptr long)
> +@ stdcall -norelay KeAcquireInStackQueuedSpinLock(ptr ptr)

Based on the information I have found, the location where this function is
implemented differs between 32-bit and 64-bit Windows versions. On 32-bit its
only in HAL, on 64-bit its only in ntoskrnl. Unfortunately I'm not sure what would
be the best way to solve this. We probably don't want to implement it twice, but
what would be the preferred location? Some shared file, or is it fine to keep the
ntoskrnl export on 32-bit?

>  @ stub KeAcquireInStackQueuedSpinLockAtDpcLevel
>  @ stub KeReleaseInStackQueuedSpinLockFromDpcLevel
>  @ stub KeSetTimeUpdateNotifyRoutine
> diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
> index 4c696f7..3e1a8a7 100644
> --- a/include/ddk/wdm.h
> +++ b/include/ddk/wdm.h
> @@ -1210,6 +1210,16 @@ typedef struct _CALLBACK_OBJECT
>      UCHAR reserved[3];
>  } CALLBACK_OBJECT, *PCALLBACK_OBJECT;
>  
> +typedef struct _KSPIN_LOCK_QUEUE {
> +    struct _KSPIN_LOCK_QUEUE volatile *Next;
> +    volatile PKSPIN_LOCK Lock;

Does this really match your Windows header files? In my Win10 header files
the volatile is at a different place in both lines above.

> +} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
> +
> +typedef struct _KLOCK_QUEUE_HANDLE {
> +    KSPIN_LOCK_QUEUE LockQueue;
> +    KIRQL OldIrql;
> +} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
> +
>  typedef NTSTATUS (NTAPI EX_CALLBACK_FUNCTION)(void *CallbackContext, void *Argument1, void *Argument2);
>  typedef EX_CALLBACK_FUNCTION *PEX_CALLBACK_FUNCTION;
>  
> diff --git a/tools/make_specfiles b/tools/make_specfiles
> index 1e2400e..505bdf1 100755
> --- a/tools/make_specfiles
> +++ b/tools/make_specfiles
> @@ -338,6 +338,10 @@ my @dll_groups =
>    "bcrypt",
>    "ncrypt",
>   ],
> + [
> +  "ntoskrnl.exe",
> +  "hal",
> + ]
>  );
>  
>  my $update_flags = 0;
> -- 2.10.2
> 




More information about the wine-devel mailing list