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
b13a00f8
Commit
b13a00f8
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 ExAcquireSharedWaitForExclusive().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f0499323
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
1 deletion
+64
-1
ntoskrnl.exe.spec
dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+1
-1
sync.c
dlls/ntoskrnl.exe/sync.c
+62
-0
wdm.h
include/ddk/wdm.h
+1
-0
No files found.
dlls/ntoskrnl.exe/ntoskrnl.exe.spec
View file @
b13a00f8
...
...
@@ -123,7 +123,7 @@
@ stdcall ExAcquireResourceExclusiveLite(ptr long)
@ stdcall ExAcquireResourceSharedLite(ptr long)
@ stdcall ExAcquireSharedStarveExclusive(ptr long)
@ st
ub ExAcquireSharedWaitForExclusive
@ st
dcall ExAcquireSharedWaitForExclusive(ptr long)
@ stub ExAllocateFromPagedLookasideList
@ stdcall ExAllocatePool(long long)
@ stdcall ExAllocatePoolWithQuota(long long)
...
...
dlls/ntoskrnl.exe/sync.c
View file @
b13a00f8
...
...
@@ -944,3 +944,65 @@ BOOLEAN WINAPI ExAcquireSharedStarveExclusive( ERESOURCE *resource, BOOLEAN wait
return
TRUE
;
}
/***********************************************************************
* ExAcquireSharedWaitForExclusive (NTOSKRNL.EXE.@)
*/
BOOLEAN
WINAPI
ExAcquireSharedWaitForExclusive
(
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
())
{
/* We own the resource exclusively, so increase recursion. */
resource
->
ActiveEntries
++
;
KeReleaseSpinLock
(
&
resource
->
SpinLock
,
irql
);
return
TRUE
;
}
}
/* We may only grab the resource if there are no exclusive waiters, even if
* we already own it shared. */
else
if
(
!
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 @
b13a00f8
...
...
@@ -1515,6 +1515,7 @@ void WINAPI ExAcquireFastMutexUnsafe(PFAST_MUTEX);
BOOLEAN
WINAPI
ExAcquireResourceExclusiveLite
(
ERESOURCE
*
,
BOOLEAN
);
BOOLEAN
WINAPI
ExAcquireResourceSharedLite
(
ERESOURCE
*
,
BOOLEAN
);
BOOLEAN
WINAPI
ExAcquireSharedStarveExclusive
(
ERESOURCE
*
,
BOOLEAN
);
BOOLEAN
WINAPI
ExAcquireSharedWaitForExclusive
(
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