[ros-diffs] [sginsberg] 36654: - Implement ExEnterCriticalRegionAndAcquireResourceShared and ExEnterCriticalRegionAndAcquireSharedWaitForExclusive - Add missing prototypes to the NDK

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Sun Oct 5 14:21:55 CEST 2008


Author: sginsberg
Date: Sun Oct  5 07:21:55 2008
New Revision: 36654

URL: http://svn.reactos.org/svn/reactos?rev=36654&view=rev
Log:
- Implement ExEnterCriticalRegionAndAcquireResourceShared and ExEnterCriticalRegionAndAcquireSharedWaitForExclusive
- Add missing prototypes to the NDK

Modified:
    branches/nwin32/include/ndk/exfuncs.h
    branches/nwin32/ntoskrnl/ex/resource.c   (contents, props changed)
    branches/nwin32/ntoskrnl/ntoskrnl_i386.def

Modified: branches/nwin32/include/ndk/exfuncs.h
URL: http://svn.reactos.org/svn/reactos/branches/nwin32/include/ndk/exfuncs.h?rev=36654&r1=36653&r2=36654&view=diff
==============================================================================
--- branches/nwin32/include/ndk/exfuncs.h [iso-8859-1] (original)
+++ branches/nwin32/include/ndk/exfuncs.h [iso-8859-1] Sun Oct  5 07:21:55 2008
@@ -111,6 +111,34 @@
     IN PEX_ENUM_HANDLE_CALLBACK EnumHandleProcedure,
     IN OUT PVOID Context,
     OUT PHANDLE Handle OPTIONAL
+);
+
+//
+// Resource Functions
+//
+
+PVOID
+NTAPI
+ExEnterCriticalRegionAndAcquireResourceExclusive(
+    IN PERESOURCE Resource
+);
+
+PVOID
+NTAPI
+ExEnterCriticalRegionAndAcquireResourceShared(
+    IN PERESOURCE Resource
+);
+
+PVOID
+NTAPI
+ExEnterCriticalRegionAndAcquireSharedWaitForExclusive(
+    IN PERESOURCE Resource
+);
+
+VOID
+FASTCALL
+ExReleaseResourceAndLeaveCriticalRegion(
+    IN PERESOURCE Resource
 );
 
 #endif

Modified: branches/nwin32/ntoskrnl/ex/resource.c
URL: http://svn.reactos.org/svn/reactos/branches/nwin32/ntoskrnl/ex/resource.c?rev=36654&r1=36653&r2=36654&view=diff
==============================================================================
--- branches/nwin32/ntoskrnl/ex/resource.c [iso-8859-1] (original)
+++ branches/nwin32/ntoskrnl/ex/resource.c [iso-8859-1] Sun Oct  5 07:21:55 2008
@@ -2179,10 +2179,10 @@
 
 /*++
  * @name ExEnterCriticalRegionAndAcquireResourceExclusive
- * @implemented NT5.1
- *
- *     The ExEnterCriticalRegionAndAcquireResourceExclusive enters a critical
- *     region and then exclusively acquires a resource.
+ * @implemented NT5.2
+ *
+ *     The ExEnterCriticalRegionAndAcquireResourceExclusive routine
+ *      enters a critical region and then exclusively acquires a resource.
  *
  * @param Resource
  *        Pointer to the resource to acquire.
@@ -2207,11 +2207,71 @@
 }
 
 /*++
+ * @name ExEnterCriticalRegionAndAcquireResourceShared
+ * @implemented NT5.2
+ *
+ *     The ExEnterCriticalRegionAndAcquireResourceShared routine
+ *     enters a critical region and then acquires a resource shared.
+ *
+ * @param Resource
+ *        Pointer to the resource to acquire.
+ *
+ * @return Pointer to the Win32K thread pointer of the current thread.
+ *
+ * @remarks See ExAcquireResourceSharedLite.
+ *
+ *--*/
+PVOID
+NTAPI
+ExEnterCriticalRegionAndAcquireResourceShared(IN PERESOURCE Resource)
+{
+    /* Enter critical region */
+    KeEnterCriticalRegion();
+
+    /* Acquire the resource */
+    ExAcquireResourceSharedLite(Resource, TRUE);
+
+    /* Return the Win32 Thread */
+    return KeGetCurrentThread()->Win32Thread;
+}
+
+/*++
+ * @name ExEnterCriticalRegionAndAcquireSharedWaitForExclusive
+ * @implemented NT5.2
+ *
+ *     The ExEnterCriticalRegionAndAcquireSharedWaitForExclusive routine
+ *     enters a critical region and then acquires a resource shared if
+ *     shared access can be granted and there are no exclusive waiters.
+ *     It then acquires the resource exclusively.
+ *
+ * @param Resource
+ *        Pointer to the resource to acquire.
+ *
+ * @return Pointer to the Win32K thread pointer of the current thread.
+ *
+ * @remarks See ExAcquireSharedWaitForExclusive.
+ *
+ *--*/
+PVOID
+NTAPI
+ExEnterCriticalRegionAndAcquireSharedWaitForExclusive(IN PERESOURCE Resource)
+{
+    /* Enter critical region */
+    KeEnterCriticalRegion();
+
+    /* Acquire the resource */
+    ExAcquireSharedWaitForExclusive(Resource, TRUE);
+
+    /* Return the Win32 Thread */
+    return KeGetCurrentThread()->Win32Thread;
+}
+
+/*++
  * @name ExReleaseResourceAndLeaveCriticalRegion
- * @implemented NT5.1
- *
- *     The ExReleaseResourceAndLeaveCriticalRegion release a resource and
- *     then leaves a critical region.
+ * @implemented NT5.2
+ *
+ *     The ExReleaseResourceAndLeaveCriticalRegion routine releases a resource
+ *     and then leaves a critical region.
  *
  * @param Resource
  *        Pointer to the resource to release.

Propchange: branches/nwin32/ntoskrnl/ex/resource.c
------------------------------------------------------------------------------
--- svn:needs-lock (original)
+++ svn:needs-lock (removed)
@@ -1,1 +1,0 @@
-*

Modified: branches/nwin32/ntoskrnl/ntoskrnl_i386.def
URL: http://svn.reactos.org/svn/reactos/branches/nwin32/ntoskrnl/ntoskrnl_i386.def?rev=36654&r1=36653&r2=36654&view=diff
==============================================================================
--- branches/nwin32/ntoskrnl/ntoskrnl_i386.def [iso-8859-1] (original)
+++ branches/nwin32/ntoskrnl/ntoskrnl_i386.def [iso-8859-1] Sun Oct  5 07:21:55 2008
@@ -83,8 +83,8 @@
 ExDisableResourceBoostLite at 4
 @ExEnterCriticalRegionAndAcquireFastMutexUnsafe at 4
 ExEnterCriticalRegionAndAcquireResourceExclusive at 4
-;ExEnterCriticalRegionAndAcquireResourceShared
-;ExEnterCriticalRegionAndAcquireSharedWaitForExclusive
+ExEnterCriticalRegionAndAcquireResourceShared at 4
+ExEnterCriticalRegionAndAcquireSharedWaitForExclusive at 4
 ExEnumHandleTable at 16
 ExEventObjectType=_ExEventObjectType
 ExExtendZone at 12



More information about the Ros-diffs mailing list