[WIN32K]
[reactos.git] / reactos / subsystems / win32 / win32k / objects / print.c
index e5c8c30..6377c5e 100644 (file)
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *  GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 /* $Id$ */
 
-#include <w32k.h>
+#include <win32k.h>
 
 #define NDEBUG
 #include <debug.h>
 
 INT
-STDCALL
+APIENTRY
 NtGdiAbortDoc(HDC  hDC)
 {
   UNIMPLEMENTED;
@@ -32,7 +32,7 @@ NtGdiAbortDoc(HDC  hDC)
 }
 
 INT
-STDCALL
+APIENTRY
 NtGdiEndDoc(HDC  hDC)
 {
   UNIMPLEMENTED;
@@ -40,7 +40,7 @@ NtGdiEndDoc(HDC  hDC)
 }
 
 INT
-STDCALL
+APIENTRY
 NtGdiEndPage(HDC  hDC)
 {
   UNIMPLEMENTED;
@@ -63,7 +63,7 @@ IntGdiEscape(PDC    dc,
 }
 
 INT
-STDCALL
+APIENTRY
 NtGdiEscape(HDC  hDC,
             INT  Escape,
             INT  InSize,
@@ -88,24 +88,7 @@ NtGdiEscape(HDC  hDC,
 }
 
 INT
-STDCALL
-IntEngExtEscape(
-   SURFOBJ *Surface,
-   INT      Escape,
-   INT      InSize,
-   LPVOID   InData,
-   INT      OutSize,
-   LPVOID   OutData)
-{
-   if (Escape == QUERYESCSUPPORT)
-      return FALSE;
-
-   DPRINT1("IntEngExtEscape is unimplemented. - Keep going and have a nice day\n");
-   return -1;
-}
-
-INT
-STDCALL
+APIENTRY
 IntGdiExtEscape(
    PDC    dc,
    INT    Escape,
@@ -114,38 +97,29 @@ IntGdiExtEscape(
    INT    OutSize,
    LPSTR  OutData)
 {
-   BITMAPOBJ *BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
+   SURFACE *psurf = dc->dclevel.pSurface;
    INT Result;
 
-   /* FIXME - Handle BitmapObj == NULL !!!!!! */
-
-   if ( NULL == ((GDIDEVICE *)dc->pPDev)->DriverFunctions.Escape )
+   if (!dc->ppdev->DriverFunctions.Escape)
    {
-      Result = IntEngExtEscape(
-         &BitmapObj->SurfObj,
-         Escape,
-         InSize,
-         (PVOID)((ULONG_PTR)InData),
-         OutSize,
-         (PVOID)OutData);
+      Result = 0;
    }
    else
    {
-      Result = ((GDIDEVICE *)dc->pPDev)->DriverFunctions.Escape(
-         &BitmapObj->SurfObj,
+      Result = dc->ppdev->DriverFunctions.Escape(
+         psurf ? &psurf->SurfObj : NULL,
          Escape,
          InSize,
          (PVOID)InData,
          OutSize,
          (PVOID)OutData );
    }
-   BITMAPOBJ_UnlockBitmap(BitmapObj);
 
    return Result;
 }
 
 INT
-STDCALL
+APIENTRY
 NtGdiExtEscape(
    HDC    hDC,
    IN OPTIONAL PWCHAR pDriver,
@@ -164,7 +138,7 @@ NtGdiExtEscape(
 
    if (hDC == 0)
    {
-       hDC = (HDC)UserGetWindowDC(NULL);
+       hDC = UserGetWindowDC(NULL);
    }
 
    pDC = DC_LockDc(hDC);
@@ -173,7 +147,7 @@ NtGdiExtEscape(
       SetLastWin32Error(ERROR_INVALID_HANDLE);
       return -1;
    }
-   if ( pDC->IsIC )
+   if ( pDC->dctype == DC_TYPE_INFO)
    {
       DC_UnlockDc(pDC);
       return 0;
@@ -181,17 +155,17 @@ NtGdiExtEscape(
 
    if ( InSize && UnsafeInData )
    {
-      _SEH_TRY
+      _SEH2_TRY
       {
         ProbeForRead(UnsafeInData,
                      InSize,
                      1);
       }
-      _SEH_HANDLE
+      _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
       {
-        Status = _SEH_GetExceptionCode();
+        Status = _SEH2_GetExceptionCode();
       }
-      _SEH_END;
+      _SEH2_END;
 
       if (!NT_SUCCESS(Status))
       {
@@ -208,22 +182,22 @@ NtGdiExtEscape(
          return -1;
       }
 
-      _SEH_TRY
+      _SEH2_TRY
       {
         /* pointers were already probed! */
         RtlCopyMemory(SafeInData,
                       UnsafeInData,
                       InSize);
       }
-      _SEH_HANDLE
+      _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
       {
-        Status = _SEH_GetExceptionCode();
+        Status = _SEH2_GetExceptionCode();
       }
-      _SEH_END;
+      _SEH2_END;
 
       if ( !NT_SUCCESS(Status) )
       {
-         ExFreePool ( SafeInData );
+         ExFreePoolWithTag ( SafeInData, TAG_PRINT );
          DC_UnlockDc(pDC);
          SetLastNtError(Status);
          return -1;
@@ -232,17 +206,17 @@ NtGdiExtEscape(
 
    if ( OutSize && UnsafeOutData )
    {
-      _SEH_TRY
+      _SEH2_TRY
       {
         ProbeForWrite(UnsafeOutData,
                       OutSize,
                       1);
       }
-      _SEH_HANDLE
+      _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
       {
-        Status = _SEH_GetExceptionCode();
+        Status = _SEH2_GetExceptionCode();
       }
-      _SEH_END;
+      _SEH2_END;
 
       if (!NT_SUCCESS(Status))
       {
@@ -256,7 +230,7 @@ NtGdiExtEscape(
          SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
 freeout:
          if ( SafeInData )
-            ExFreePool ( SafeInData );
+            ExFreePoolWithTag ( SafeInData, TAG_PRINT );
          DC_UnlockDc(pDC);
          return -1;
       }
@@ -267,24 +241,24 @@ freeout:
    DC_UnlockDc(pDC);
 
    if ( SafeInData )
-      ExFreePool ( SafeInData );
+      ExFreePoolWithTag ( SafeInData ,TAG_PRINT );
 
    if ( SafeOutData )
    {
-      _SEH_TRY
+      _SEH2_TRY
       {
         /* pointers were already probed! */
         RtlCopyMemory(UnsafeOutData,
                       SafeOutData,
                       OutSize);
       }
-      _SEH_HANDLE
+      _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
       {
-        Status = _SEH_GetExceptionCode();
+        Status = _SEH2_GetExceptionCode();
       }
-      _SEH_END;
+      _SEH2_END;
 
-      ExFreePool ( SafeOutData );
+      ExFreePoolWithTag ( SafeOutData, TAG_PRINT );
       if ( !NT_SUCCESS(Status) )
       {
          SetLastNtError(Status);
@@ -308,7 +282,7 @@ NtGdiStartDoc(
 }
 
 INT
-STDCALL
+APIENTRY
 NtGdiStartPage(HDC  hDC)
 {
   UNIMPLEMENTED;