Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f0499323
Commit
f0499323
authored
Apr 08, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe: Implement ExAcquireSharedStarveExclusive().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dcfc7ab1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
1 deletion
+66
-1
ntoskrnl.exe.spec
dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+1
-1
sync.c
dlls/ntoskrnl.exe/sync.c
+64
-0
wdm.h
include/ddk/wdm.h
+1
-0
No files found.
dlls/ntoskrnl.exe/ntoskrnl.exe.spec
View file @
f0499323
...
...
@@ -122,7 +122,7 @@
@ stub DbgSetDebugFilterState
@ stdcall ExAcquireResourceExclusiveLite(ptr long)
@ stdcall ExAcquireResourceSharedLite(ptr long)
@ st
ub ExAcquireSharedStarveExclusive
@ st
dcall ExAcquireSharedStarveExclusive(ptr long)
@ stub ExAcquireSharedWaitForExclusive
@ stub ExAllocateFromPagedLookasideList
@ stdcall ExAllocatePool(long long)
...
...
dlls/ntoskrnl.exe/sync.c
View file @
f0499323
...
...
@@ -880,3 +880,67 @@ BOOLEAN WINAPI ExAcquireResourceSharedLite( ERESOURCE *resource, BOOLEAN wait )
return
TRUE
;
}
/***********************************************************************
* ExAcquireSharedStarveExclusive (NTOSKRNL.EXE.@)
*/
BOOLEAN
WINAPI
ExAcquireSharedStarveExclusive
(
ERESOURCE
*
resource
,
BOOLEAN
wait
)
{
OWNER_ENTRY
*
entry
;
KIRQL
irql
;
TRACE
(
"resource %p, wait %u.
\n
"
,
resource
,
wait
);
KeAcquireSpinLock
(
&
resource
->
SpinLock
,
&
irql
);
entry
=
resource_get_shared_entry
(
resource
,
(
ERESOURCE_THREAD
)
KeGetCurrentThread
()
);
if
(
resource
->
Flag
&
ResourceOwnedExclusive
)
{
if
(
resource
->
OwnerEntry
.
OwnerThread
==
(
ERESOURCE_THREAD
)
KeGetCurrentThread
())
{
resource
->
ActiveEntries
++
;
KeReleaseSpinLock
(
&
resource
->
SpinLock
,
irql
);
return
TRUE
;
}
}
/* We are starving exclusive waiters, but we cannot steal the resource out
* from under an exclusive waiter who is about to acquire it. (Because of
* locking, and because exclusive waiters are always waked first, this is
* guaranteed to be the case if the resource is unowned and there are
* exclusive waiters.) */
else
if
(
!
(
!
resource
->
ActiveEntries
&&
resource
->
NumberOfExclusiveWaiters
))
{
entry
->
OwnerCount
++
;
resource
->
ActiveEntries
++
;
KeReleaseSpinLock
(
&
resource
->
SpinLock
,
irql
);
return
TRUE
;
}
if
(
!
wait
)
{
KeReleaseSpinLock
(
&
resource
->
SpinLock
,
irql
);
return
FALSE
;
}
if
(
!
resource
->
SharedWaiters
)
{
resource
->
SharedWaiters
=
heap_alloc
(
sizeof
(
*
resource
->
SharedWaiters
)
);
KeInitializeSemaphore
(
resource
->
SharedWaiters
,
0
,
INT_MAX
);
}
resource
->
NumberOfSharedWaiters
++
;
KeReleaseSpinLock
(
&
resource
->
SpinLock
,
irql
);
KeWaitForSingleObject
(
resource
->
SharedWaiters
,
Executive
,
KernelMode
,
FALSE
,
NULL
);
KeAcquireSpinLock
(
&
resource
->
SpinLock
,
&
irql
);
entry
->
OwnerCount
++
;
resource
->
ActiveEntries
++
;
resource
->
NumberOfSharedWaiters
--
;
KeReleaseSpinLock
(
&
resource
->
SpinLock
,
irql
);
return
TRUE
;
}
include/ddk/wdm.h
View file @
f0499323
...
...
@@ -1514,6 +1514,7 @@ NTSTATUS WINAPI DbgQueryDebugFilterState(ULONG, ULONG);
void
WINAPI
ExAcquireFastMutexUnsafe
(
PFAST_MUTEX
);
BOOLEAN
WINAPI
ExAcquireResourceExclusiveLite
(
ERESOURCE
*
,
BOOLEAN
);
BOOLEAN
WINAPI
ExAcquireResourceSharedLite
(
ERESOURCE
*
,
BOOLEAN
);
BOOLEAN
WINAPI
ExAcquireSharedStarveExclusive
(
ERESOURCE
*
,
BOOLEAN
);
PVOID
WINAPI
ExAllocatePool
(
POOL_TYPE
,
SIZE_T
);
PVOID
WINAPI
ExAllocatePoolWithQuota
(
POOL_TYPE
,
SIZE_T
);
PVOID
WINAPI
ExAllocatePoolWithTag
(
POOL_TYPE
,
SIZE_T
,
ULONG
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment