- probe.h: "NTOSKRNL unfortunately doesn't export RtlRaiseStatus!" -- no, but it...
authorStefan Ginsberg <stefanginsberg@gmail.com>
Sun, 2 Aug 2009 20:35:19 +0000 (20:35 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Sun, 2 Aug 2009 20:35:19 +0000 (20:35 +0000)
- ddraw.h: Don't check if WINNT is defined, our winnt.h defines _WINNT_H. Also fix the way CO_E_NOTINITIALIZED is defined.
- Define NT_BUILD_ENVIRONMENT in win32k so the define in ddraw.h doesn't conflict with winerror.h. Not sure if this is correct, but our headers are a mess.
- Add a hack to disable C4276 (caused by napi.h) until a more proper fix is devised.
- Win32K now fully compiles in MSVC.

svn path=/trunk/; revision=42346

reactos/include/dxsdk/ddraw.h
reactos/include/reactos/probe.h
reactos/subsystems/win32/win32k/misc/err.c
reactos/subsystems/win32/win32k/pch.h
reactos/subsystems/win32/win32k/win32k.rbuild

index 699819d..1e8dbd2 100644 (file)
@@ -8,8 +8,8 @@
 #include <objbase.h>
 #else
 #define IUnknown void
-#if !defined(NT_BUILD_ENVIRONMENT) && !defined(WINNT)
-        #define CO_E_NOTINITIALIZED 0x800401F0
+#if !defined(NT_BUILD_ENVIRONMENT) && !defined(_WINNT_H)
+        #define CO_E_NOTINITIALIZED 0x800401F0L
 #endif
 #endif
 
index 4a13cd7..f4c1b6c 100644 (file)
@@ -14,14 +14,6 @@ static const IO_STATUS_BLOCK __emptyIoStatusBlock = {{0}, 0};
 static const LARGE_STRING __emptyLargeString = {0, 0, 0, NULL};
 #endif
 
-#if defined(_WIN32K_)
-/*
- * NOTE: NTOSKRNL unfortunately doesn't export RtlRaiseStatus!
- */
-VOID NTAPI W32kRaiseStatus(NTSTATUS Status);
-#define RtlRaiseStatus W32kRaiseStatus
-#endif
-
 /*
  * NOTE: Alignment of the pointers is not verified!
  */
@@ -29,7 +21,7 @@ VOID NTAPI W32kRaiseStatus(NTSTATUS Status);
     do {                                                                       \
         if ((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) ||          \
             (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) { \
-            RtlRaiseStatus (STATUS_ACCESS_VIOLATION);                          \
+            ExRaiseAccessViolation();                                          \
         }                                                                      \
         *(volatile Type *)(Ptr) = *(volatile Type *)(Ptr);                     \
     } while (0)
@@ -60,7 +52,7 @@ VOID NTAPI W32kRaiseStatus(NTSTATUS Status);
 #define ProbeForReadGenericType(Ptr, Type, Default)                            \
     (((ULONG_PTR)(Ptr) + sizeof(Type) - 1 < (ULONG_PTR)(Ptr) ||                \
         (ULONG_PTR)(Ptr) + sizeof(Type) - 1 >= (ULONG_PTR)MmUserProbeAddress) ?   \
-            ExRaiseStatus (STATUS_ACCESS_VIOLATION), Default :                    \
+            ExRaiseAccessViolation(), Default :                     \
             *(const volatile Type *)(Ptr))
 
 #define ProbeForReadBoolean(Ptr) ProbeForReadGenericType(Ptr, BOOLEAN, FALSE)
@@ -90,7 +82,7 @@ VOID NTAPI W32kRaiseStatus(NTSTATUS Status);
     do {                                                                       \
         if ((ULONG_PTR)(Ptr) + sizeof(HANDLE) - 1 < (ULONG_PTR)(Ptr) ||        \
             (ULONG_PTR)(Ptr) + sizeof(HANDLE) - 1 >= (ULONG_PTR)MmUserProbeAddress) { \
-            RtlRaiseStatus (STATUS_ACCESS_VIOLATION);                          \
+            ExRaiseAccessViolation();                                          \
         }                                                                      \
         *(volatile HANDLE *)(Ptr) = NULL;                                      \
     } while (0)
@@ -113,7 +105,7 @@ ProbeArrayForRead(IN const VOID *ArrayPtr,
     ArraySize = ItemSize * ItemCount;
     if (ArraySize / ItemSize != ItemCount)
     {
-        RtlRaiseStatus (STATUS_INVALID_PARAMETER);
+        ExRaiseStatus(STATUS_INVALID_PARAMETER);
     }
 
     /* Probe the array */
@@ -135,7 +127,7 @@ ProbeArrayForWrite(IN OUT PVOID ArrayPtr,
     ArraySize = ItemSize * ItemCount;
     if (ArraySize / ItemSize != ItemCount)
     {
-        RtlRaiseStatus (STATUS_INVALID_PARAMETER);
+        ExRaiseStatus(STATUS_INVALID_PARAMETER);
     }
 
     /* Probe the array */
index d584cc2..5943b4f 100644 (file)
@@ -61,22 +61,4 @@ GetLastNtError()
   return 0;
 }
 
-VOID
-APIENTRY
-W32kRaiseStatus(NTSTATUS Status)
-{
-    EXCEPTION_RECORD ExceptionRecord;
-
-    /* Create an exception record */
-    ExceptionRecord.ExceptionCode  = Status;
-    ExceptionRecord.ExceptionRecord = NULL;
-    ExceptionRecord.NumberParameters = 0;
-    ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
-
-    RtlRaiseException(&ExceptionRecord);
-
-    /* If we returned, raise a status */
-    W32kRaiseStatus(Status);
-}
-
 /* EOF */
index b53d861..a77ee87 100644 (file)
@@ -36,6 +36,7 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
 
 #include <winerror.h>
 #include <wingdi.h>
+#define NT_BUILD_ENVIRONMENT
 #include <winddi.h>
 #include <winuser.h>
 #include <prntfont.h>
index 7a16aac..47edc91 100644 (file)
@@ -10,6 +10,7 @@
        <include base="ReactOS">include/reactos/subsys</include>
        <include base="ReactOS">include/reactos/drivers</include>
        <compilerflag compilerset="gcc">-fms-extensions</compilerflag>
+       <compilerflag compilerset="msc">/wd4276</compilerflag>
        <define name="LANGPACK" />
        <define name="_WIN32K_" />
        <!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38269