[ros-diffs] [jimtabor] 33796: Sorry again... NtGdiCreateEnhMetaFile will be converted to NtGdiCreateMetafileDC. Keeping the original code for now.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Sun Jun 1 07:40:53 CEST 2008


Author: jimtabor
Date: Sun Jun  1 00:40:53 2008
New Revision: 33796

URL: http://svn.reactos.org/svn/reactos?rev=33796&view=rev
Log:
Sorry again... NtGdiCreateEnhMetaFile will be converted to NtGdiCreateMetafileDC. Keeping the original code for now.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/metafile.c
    trunk/reactos/subsystems/win32/win32k/stubs/stubs.c
    trunk/reactos/subsystems/win32/win32k/win32k.rbuild

Modified: trunk/reactos/subsystems/win32/win32k/objects/metafile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/metafile.c?rev=33796&r1=33795&r2=33796&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/metafile.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/metafile.c [iso-8859-1] Sun Jun  1 00:40:53 2008
@@ -23,243 +23,6 @@
 #define NDEBUG
 #include <debug.h>
 
-HENHMETAFILE
-STDCALL
-NtGdiCloseEnhMetaFile(HDC  hDC)
-{
-  LPENHMETAHEADER emh;
-  HANDLE hmf = 0;
-  PDD_ENHMETAFILEOBJ phmf;
-  HANDLE hMapping = 0;
-  EMREOF emr;
-  PDC Dc;
-
-  IO_STATUS_BLOCK Iosb;
-  NTSTATUS Status;
-
-
-
-  Dc = DC_LockDc(hDC);
-  if (Dc == NULL)
-  {
-      SetLastWin32Error(ERROR_INVALID_HANDLE);
-      return NULL;
-  }
-
-  emr.emr.iType = EMR_EOF;
-  emr.emr.nSize = sizeof(EMREOF);
-  emr.nPalEntries = 0;
-  emr.offPalEntries = 0;
-  emr.nSizeLast = emr.emr.nSize;
-
-  if(Dc->hFile)
-  {
-     Status = NtWriteFile(Dc->hFile, NULL, NULL, NULL, &Iosb, (PVOID)&emr, emr.emr.nSize, NULL, NULL);
-     if (Status == STATUS_PENDING)
-      {
-          Status = NtWaitForSingleObject(Dc->hFile,FALSE,NULL);
-          if (NT_SUCCESS(Status))
-          {
-              Status = Iosb.Status;
-          }
-      }
-
-      if (NT_SUCCESS(Status))
-      {
-		  DWORD len = Dc->emh->nBytes + emr.emr.nSize;
-		  /* always resize the buffer */
-		  emh = EngAllocMem(FL_ZERO_MEMORY, len, 0);
-		  if (emh != NULL)
-	      {
-              memcpy(emh,Dc->emh,Dc->emh->nBytes);
-	          EngFreeMem(Dc->emh);
-	          Dc->emh = emh;
-
-			  memcpy(Dc->emh + Dc->emh->nBytes, &emr, emr.emr.nSize);
-	      }
-	      else
-	      {
-	          EngFreeMem(Dc->emh);
-	          Dc->emh=NULL;
-	      }
-
-      }
-      else
-      {
-          Dc->hFile = NULL;
-		  DPRINT1("Write to EnhMetaFile fail\n");
-      }
-  }
-
-  Dc->emh->nBytes += emr.emr.nSize;
-  Dc->emh->nRecords++;
-
-  if(Dc->emh->rclFrame.left > Dc->emh->rclFrame.right)
-  {
-     Dc->emh->rclFrame.left = Dc->emh->rclBounds.left * Dc->emh->szlMillimeters.cx * 100 / Dc->emh->szlDevice.cx;
-     Dc->emh->rclFrame.top = Dc->emh->rclBounds.top * Dc->emh->szlMillimeters.cy * 100 / Dc->emh->szlDevice.cy;
-     Dc->emh->rclFrame.right = Dc->emh->rclBounds.right * Dc->emh->szlMillimeters.cx * 100 / Dc->emh->szlDevice.cx;
-     Dc->emh->rclFrame.bottom = Dc->emh->rclBounds.bottom * Dc->emh->szlMillimeters.cy * 100 / Dc->emh->szlDevice.cy;
-  }
-
-  if (Dc->hFile)  /* disk based metafile */
-  {
-	  FILE_POSITION_INFORMATION FilePosition;
-	  LARGE_INTEGER Distance ;
-	  IO_STATUS_BLOCK IoStatusBlock;
-
-	  POBJECT_ATTRIBUTES ObjectAttributes = NULL;
-      ACCESS_MASK DesiredAccess;
-	  PLARGE_INTEGER SectionSize = NULL;
-	  DWORD flProtect;
-	  ULONG Attributes;
-	  LARGE_INTEGER SectionOffset;
-      ULONG ViewSize;
-      ULONG Protect;
-      LPVOID ViewBase;
-
-	  Distance.u.LowPart = 0;
-      Distance.u.HighPart = 0;
-	  FilePosition.CurrentByteOffset.QuadPart = Distance.QuadPart;
-
-	  DPRINT1("Trying write to metafile and map it\n");
-
-	  Status = NtSetInformationFile(Dc->hFile, &IoStatusBlock, &FilePosition,
-		                             sizeof(FILE_POSITION_INFORMATION), FilePositionInformation);
-
-	 if (!NT_SUCCESS(Status))
-     {
-		 // SetLastErrorByStatus(Status);
-         SetLastWin32Error(ERROR_INVALID_HANDLE);
-
-		 NtClose( Dc->hFile );
-		 DC_UnlockDc(Dc);
-		 NtGdiDeleteObjectApp(hDC);
-
-		 DPRINT1("NtSetInformationFile fail\n");
-	     return hmf;
-     }
-
-	 if (FilePosition.CurrentByteOffset.u.LowPart != 0)
-	 {
-		 // SetLastErrorByStatus(Status);
-		 SetLastWin32Error(ERROR_INVALID_HANDLE);
-
-		 NtClose( Dc->hFile );
-		 DC_UnlockDc(Dc);
-		 NtGdiDeleteObjectApp(hDC);
-		 DPRINT1("FilePosition.CurrentByteOffset.u.LowPart is not 0\n");
-	     return hmf;
-	 }
-
-	 Status = NtWriteFile(Dc->hFile, NULL, NULL, NULL, &Iosb, (PVOID)&Dc->emh,  sizeof(*Dc->emh), NULL, NULL);
-     if (Status == STATUS_PENDING)
-     {
-          Status = NtWaitForSingleObject(Dc->hFile,FALSE,NULL);
-          if (NT_SUCCESS(Status))
-          {
-              Status = Iosb.Status;
-          }
-      }
-
-      if (!NT_SUCCESS(Status))
-      {
-         NtClose( Dc->hFile );
-		 DC_UnlockDc(Dc);
-         NtGdiDeleteObjectApp(hDC);
-		 DPRINT1("fail to write 0\n");
-         return hmf;
-      }
-
-	  EngFreeMem(Dc->emh);
-
-      /* create maping */
-      DesiredAccess = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ;
-      Attributes = (PAGE_READONLY & (SEC_FILE | SEC_IMAGE | SEC_RESERVE | SEC_NOCACHE | SEC_COMMIT));
-      flProtect = PAGE_READONLY ^ (PAGE_READONLY & (SEC_FILE | SEC_IMAGE | SEC_RESERVE | SEC_NOCACHE | SEC_COMMIT));
-
-      if (!Attributes) Attributes = SEC_COMMIT;
-
-      if (Dc->hFile == INVALID_HANDLE_VALUE)
-      {
-          Dc->hFile = NULL;
-          if (!SectionSize)
-          {
-			 SetLastWin32Error(ERROR_INVALID_PARAMETER);
-             hMapping = NULL;
-			 DPRINT1("fail !SectionSize \n");
-          }
-      }
-	  else
-	  {
-          Status = NtCreateSection(&hMapping, DesiredAccess, ObjectAttributes, SectionSize, flProtect, Attributes, Dc->hFile);
-          if (!NT_SUCCESS(Status))
-          {
-          //SetLastErrorByStatus(Status);
-		      SetLastWin32Error(ERROR_INVALID_HANDLE);
-              hMapping =  NULL;
-			  DPRINT1("fail NtCreateSection \n");
-          }
-	  }
-
-      /* MapViewOfFile */
-      SectionOffset.LowPart = 0;
-      SectionOffset.HighPart = 0;
-      ViewBase = NULL;
-      ViewSize = 0;
-
-      Protect = PAGE_READONLY;
-
-      Status = ZwMapViewOfSection(&hMapping, NtCurrentProcess(), &ViewBase, 0,
-		                          0, &SectionOffset, &ViewSize, ViewShare, 0, Protect);
-      if (!NT_SUCCESS(Status))
-      {
-          //SetLastErrorByStatus(Status);
-		  SetLastWin32Error(ERROR_INVALID_HANDLE);
-          Dc->emh = NULL;
-		  DPRINT1("fail ZwMapViewOfSection \n");
-      }
-	  else
-      {
-          Dc->emh = ViewBase;
-	  }
-      /* Close */
-	  if (hMapping != NULL)
-          NtClose( hMapping );
-	  if (Dc->hFile != NULL)
-          NtClose( Dc->hFile );
-    }
-
-  phmf = GDIOBJ_AllocObjWithHandle(GdiHandleTable, GDI_OBJECT_TYPE_ENHMETAFILE);
-  if (phmf != NULL)
-  {
-    hmf = phmf->BaseObject.hHmgr;
-    if (Dc->hFile != NULL)
-    {
-      phmf->on_disk = TRUE;
-    }
-    else
-    {
-      phmf->on_disk = FALSE;
-    }
-    phmf->emh = Dc->emh;
-    GDIOBJ_UnlockObjByPtr(GdiHandleTable, phmf);
-  }
-
-  Dc->emh = NULL;  /* So it won't be deleted */
-  DC_UnlockDc(Dc);
-  NtGdiDeleteObjectApp(hDC);
-  return hmf;
-}
-
-HENHMETAFILE
-STDCALL
-NtGdiCopyEnhMetaFile(HENHMETAFILE  Src,
-                                  LPCWSTR  File)
-{
-  UNIMPLEMENTED;
-  return 0;
-}
 
 //
 //
@@ -268,11 +31,14 @@
 //
 HDC
 STDCALL
-NtGdiCreateEnhMetaFile(HDC  hDCRef,
-                           LPCWSTR  File,
-                           CONST LPRECT  Rect,
-                           LPCWSTR  Description)
+NtGdiCreateMetafileDC(IN HDC hdc)
 {
+
+    UNIMPLEMENTED;
+    return NULL;
+
+
+#if 0
    PDC Dc;
    HDC ret = NULL;
    DWORD length = 0;
@@ -467,114 +233,8 @@
     }
 
     return ret;
+#endif
 }
 
-BOOL
-STDCALL
-NtGdiDeleteEnhMetaFile(HENHMETAFILE  emf)
-{
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
-BOOL
-STDCALL
-NtGdiEnumEnhMetaFile(HDC  hDC,
-                          HENHMETAFILE  emf,
-                          ENHMFENUMPROC  EnhMetaFunc,
-                          LPVOID  Data,
-                          CONST LPRECT  Rect)
-{
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
-BOOL
-STDCALL
-NtGdiGdiComment(HDC  hDC,
-                     UINT  Size,
-                     CONST LPBYTE  Data)
-{
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
-HENHMETAFILE
-STDCALL
-NtGdiGetEnhMetaFile(LPCWSTR  MetaFile)
-{
-  UNIMPLEMENTED;
-  return 0;
-}
-
-UINT
-STDCALL
-NtGdiGetEnhMetaFileBits(HENHMETAFILE  hemf,
-                             UINT  BufSize,
-                             LPBYTE  Buffer)
-{
-  UNIMPLEMENTED;
-  return 0;
-}
-
-UINT
-STDCALL
-NtGdiGetEnhMetaFileDescription(HENHMETAFILE  hemf,
-                                    UINT  BufSize,
-                                    LPWSTR  Description)
-{
-  UNIMPLEMENTED;
-  return 0;
-}
-
-UINT
-STDCALL
-NtGdiGetEnhMetaFileHeader(HENHMETAFILE  hemf,
-                               UINT  BufSize,
-                               LPENHMETAHEADER  emh)
-{
-  UNIMPLEMENTED;
-  return 0;
-}
-
-UINT
-STDCALL
-NtGdiGetEnhMetaFilePaletteEntries(HENHMETAFILE  hemf,
-                                       UINT  Entries,
-                                       LPPALETTEENTRY  pe)
-{
-  UNIMPLEMENTED;
-  return 0;
-}
-
-BOOL
-STDCALL
-NtGdiPlayEnhMetaFile(HDC  hDC,
-                          HENHMETAFILE  hemf,
-                          CONST PRECT  Rect)
-{
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
-BOOL
-STDCALL
-NtGdiPlayEnhMetaFileRecord(HDC  hDC,
-                                LPHANDLETABLE  Handletable,
-                                CONST ENHMETARECORD *EnhMetaRecord,
-                                UINT  Handles)
-{
-  UNIMPLEMENTED;
-  return FALSE;
-}
-
-HENHMETAFILE
-STDCALL
-NtGdiSetEnhMetaFileBits(UINT  BufSize,
-                                     CONST PBYTE  Data)
-{
-  UNIMPLEMENTED;
-  return 0;
-}
 
 /* EOF */

Modified: trunk/reactos/subsystems/win32/win32k/stubs/stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/stubs/stubs.c?rev=33796&r1=33795&r2=33796&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] Sun Jun  1 00:40:53 2008
@@ -1668,19 +1668,6 @@
  /*
  * @unimplemented
  */
-
-HDC
-APIENTRY
-NtGdiCreateMetafileDC(IN HDC hdc)
-{
-    UNIMPLEMENTED;
-    return NULL;
-}
-
-
- /*
- * @unimplemented
- */
 HBITMAP
 APIENTRY
 NtGdiClearBitmapAttributes(

Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/win32k.rbuild?rev=33796&r1=33795&r2=33796&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Sun Jun  1 00:40:53 2008
@@ -160,6 +160,7 @@
 		<file>gdiobj.c</file>
 		<file>icm.c</file>
 		<file>line.c</file>
+		<file>metafile.c</file>
 		<file>palobj.c</file>
 		<file>path.c</file>
 		<file>pen.c</file>



More information about the Ros-diffs mailing list