Fixed ProbeForRead* macros: make sure the data always is read while probing it
authorThomas Bluemel <thomas@reactsoft.com>
Thu, 27 Oct 2005 23:48:22 +0000 (23:48 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Thu, 27 Oct 2005 23:48:22 +0000 (23:48 +0000)
svn path=/trunk/; revision=18817

reactos/ntoskrnl/include/internal/ntoskrnl.h

index 140a416..64917b5 100644 (file)
@@ -134,7 +134,6 @@ ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest,
                 else
                 {
                     /* sanitize structure */
                 else
                 {
                     /* sanitize structure */
-                    Dest->Length = 0;
                     Dest->MaximumLength = 0;
                     Dest->Buffer = NULL;
                 }
                     Dest->MaximumLength = 0;
                     Dest->Buffer = NULL;
                 }
@@ -209,7 +208,7 @@ ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString,
     (((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) ||                \
         (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) ?   \
             ExRaiseStatus (STATUS_ACCESS_VIOLATION), Default :                    \
     (((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) ||                \
         (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) ?   \
             ExRaiseStatus (STATUS_ACCESS_VIOLATION), Default :                    \
-            *(Type *)(Ptr))
+            *(volatile Type *)(Ptr))
 
 #define ProbeForReadBoolean(Ptr) ProbeForReadGenericType(Ptr, BOOLEAN, FALSE)
 #define ProbeForReadUchar(Ptr) ProbeForReadGenericType(Ptr, UCHAR, 0)
 
 #define ProbeForReadBoolean(Ptr) ProbeForReadGenericType(Ptr, BOOLEAN, FALSE)
 #define ProbeForReadUchar(Ptr) ProbeForReadGenericType(Ptr, UCHAR, 0)