[NtUser] Fix Clipboard Synthesized Returns
authorJames Tabor <james.tabor@reactos.org>
Sat, 1 Jun 2019 12:23:58 +0000 (07:23 -0500)
committerJames Tabor <james.tabor@reactos.org>
Sat, 1 Jun 2019 12:23:58 +0000 (07:23 -0500)
Add supported for Meta file synthesized renderings.
See CORE-12143.

win32ss/user/ntuser/clipboard.c

index 28a1844..95f4489 100644 (file)
@@ -290,7 +290,7 @@ cleanup:
 static VOID NTAPI
 IntAddSynthesizedFormats(PWINSTATION_OBJECT pWinStaObj)
 {
-    BOOL bHaveText, bHaveUniText, bHaveOemText, bHaveLocale, bHaveBm, bHaveDib;
+    BOOL bHaveText, bHaveUniText, bHaveOemText, bHaveLocale, bHaveBm, bHaveDib, bHaveMFP, bHaveEMF;
 
     bHaveText = IntIsFormatAvailable(pWinStaObj, CF_TEXT);
     bHaveOemText = IntIsFormatAvailable(pWinStaObj, CF_OEMTEXT);
@@ -298,6 +298,8 @@ IntAddSynthesizedFormats(PWINSTATION_OBJECT pWinStaObj)
     bHaveLocale = IntIsFormatAvailable(pWinStaObj, CF_LOCALE);
     bHaveBm = IntIsFormatAvailable(pWinStaObj, CF_BITMAP);
     bHaveDib = IntIsFormatAvailable(pWinStaObj, CF_DIB);
+    bHaveMFP = IntIsFormatAvailable(pWinStaObj, CF_METAFILEPICT);
+    bHaveEMF = IntIsFormatAvailable(pWinStaObj, CF_ENHMETAFILE);
 
     /* Add CF_LOCALE format if we have CF_TEXT, CF_OEMTEXT or CF_UNICODETEXT */
     if (!bHaveLocale && (bHaveText || bHaveOemText || bHaveUniText))
@@ -334,6 +336,14 @@ IntAddSynthesizedFormats(PWINSTATION_OBJECT pWinStaObj)
     if (!bHaveBm && bHaveDib)
         IntAddFormatedData(pWinStaObj, CF_BITMAP, DATA_SYNTH_KRNL, FALSE, TRUE);
 
+    /* Add CF_ENHMETAFILE. Note: it is synthesized in gdi32.dll */
+    if (bHaveMFP && !bHaveEMF)
+        IntAddFormatedData(pWinStaObj, CF_ENHMETAFILE, DATA_SYNTH_USER, FALSE, TRUE);
+
+    /* Add CF_METAFILEPICT. Note: it is synthesized in gdi32.dll */
+    if (bHaveEMF && !bHaveMFP)
+        IntAddFormatedData(pWinStaObj, CF_METAFILEPICT, DATA_SYNTH_USER, FALSE, TRUE);
+
     /* Note: We need to render the DIB or DIBV5 format as soon as possible
        because pallette information may change */
     if (!bHaveDib && bHaveBm)
@@ -934,6 +944,16 @@ NtUserGetClipboardData(UINT fmt, PGETCLIPBDATA pgcd)
                 IntSynthesizeBitmap(pWinStaObj, pElement);
                 break;
 
+            case CF_METAFILEPICT:
+                uSourceFmt = CF_ENHMETAFILE;
+                pElement = IntGetFormatElement(pWinStaObj, uSourceFmt);
+                break;
+
+            case CF_ENHMETAFILE:
+                uSourceFmt = CF_METAFILEPICT;
+                pElement = IntGetFormatElement(pWinStaObj, uSourceFmt);
+                break;
+
             default:
                 ASSERT(FALSE);
         }