[winpr,clipboard] ClipboardRegisterSynthesizer return checks

This commit is contained in:
Armin Novak
2026-02-27 20:29:01 +01:00
parent 9774cd06f5
commit b1e4933c78

View File

@@ -967,42 +967,56 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
* CF_TEXT * CF_TEXT
*/ */
{ {
ClipboardRegisterSynthesizer(clipboard, CF_TEXT, CF_OEMTEXT, if (!ClipboardRegisterSynthesizer(clipboard, CF_TEXT, CF_OEMTEXT,
clipboard_synthesize_cf_oemtext); clipboard_synthesize_cf_oemtext))
ClipboardRegisterSynthesizer(clipboard, CF_TEXT, CF_UNICODETEXT, return FALSE;
clipboard_synthesize_cf_unicodetext); if (!ClipboardRegisterSynthesizer(clipboard, CF_TEXT, CF_UNICODETEXT,
ClipboardRegisterSynthesizer(clipboard, CF_TEXT, CF_LOCALE, clipboard_synthesize_cf_locale); clipboard_synthesize_cf_unicodetext))
return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, CF_TEXT, CF_LOCALE,
clipboard_synthesize_cf_locale))
return FALSE;
UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_text_plain); UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_text_plain);
ClipboardRegisterSynthesizer(clipboard, CF_TEXT, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_TEXT, altFormatId,
clipboard_synthesize_utf8_string); clipboard_synthesize_utf8_string))
return FALSE;
} }
/** /**
* CF_OEMTEXT * CF_OEMTEXT
*/ */
{ {
ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, CF_TEXT, clipboard_synthesize_cf_text); if (!ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, CF_TEXT,
ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, CF_UNICODETEXT, clipboard_synthesize_cf_text))
clipboard_synthesize_cf_unicodetext); return FALSE;
ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, CF_LOCALE, if (!ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, CF_UNICODETEXT,
clipboard_synthesize_cf_locale); clipboard_synthesize_cf_unicodetext))
return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, CF_LOCALE,
clipboard_synthesize_cf_locale))
return FALSE;
UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_text_plain); UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_text_plain);
ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_OEMTEXT, altFormatId,
clipboard_synthesize_utf8_string); clipboard_synthesize_utf8_string))
return FALSE;
} }
/** /**
* CF_UNICODETEXT * CF_UNICODETEXT
*/ */
{ {
ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, CF_TEXT, if (!ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, CF_TEXT,
clipboard_synthesize_cf_text); clipboard_synthesize_cf_text))
ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, CF_OEMTEXT, return FALSE;
clipboard_synthesize_cf_oemtext); if (!ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, CF_OEMTEXT,
ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, CF_LOCALE, clipboard_synthesize_cf_oemtext))
clipboard_synthesize_cf_locale); return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, CF_LOCALE,
clipboard_synthesize_cf_locale))
return FALSE;
UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_text_plain); UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_text_plain);
ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_UNICODETEXT, altFormatId,
clipboard_synthesize_utf8_string); clipboard_synthesize_utf8_string))
return FALSE;
} }
/** /**
* UTF8_STRING * UTF8_STRING
@@ -1012,14 +1026,18 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
if (formatId) if (formatId)
{ {
ClipboardRegisterSynthesizer(clipboard, formatId, CF_TEXT, if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_TEXT,
clipboard_synthesize_cf_text); clipboard_synthesize_cf_text))
ClipboardRegisterSynthesizer(clipboard, formatId, CF_OEMTEXT, return FALSE;
clipboard_synthesize_cf_oemtext); if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_OEMTEXT,
ClipboardRegisterSynthesizer(clipboard, formatId, CF_UNICODETEXT, clipboard_synthesize_cf_oemtext))
clipboard_synthesize_cf_unicodetext); return FALSE;
ClipboardRegisterSynthesizer(clipboard, formatId, CF_LOCALE, if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_UNICODETEXT,
clipboard_synthesize_cf_locale); clipboard_synthesize_cf_unicodetext))
return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_LOCALE,
clipboard_synthesize_cf_locale))
return FALSE;
} }
} }
/** /**
@@ -1030,14 +1048,18 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
if (formatId) if (formatId)
{ {
ClipboardRegisterSynthesizer(clipboard, formatId, CF_TEXT, if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_TEXT,
clipboard_synthesize_cf_text); clipboard_synthesize_cf_text))
ClipboardRegisterSynthesizer(clipboard, formatId, CF_OEMTEXT, return FALSE;
clipboard_synthesize_cf_oemtext); if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_OEMTEXT,
ClipboardRegisterSynthesizer(clipboard, formatId, CF_UNICODETEXT, clipboard_synthesize_cf_oemtext))
clipboard_synthesize_cf_unicodetext); return FALSE;
ClipboardRegisterSynthesizer(clipboard, formatId, CF_LOCALE, if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_UNICODETEXT,
clipboard_synthesize_cf_locale); clipboard_synthesize_cf_unicodetext))
return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, formatId, CF_LOCALE,
clipboard_synthesize_cf_locale))
return FALSE;
} }
} }
@@ -1047,16 +1069,21 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
/** /**
* CF_TIFF * CF_TIFF
*/ */
ClipboardRegisterSynthesizer(clipboard, CF_TIFF, htmlFormat, clipboard_synthesize_image_html); if (!ClipboardRegisterSynthesizer(clipboard, CF_TIFF, htmlFormat,
ClipboardRegisterSynthesizer(clipboard, tiffFormat, htmlFormat, clipboard_synthesize_image_html))
clipboard_synthesize_image_html); return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, tiffFormat, htmlFormat,
clipboard_synthesize_image_html))
return FALSE;
/** /**
* CF_DIB * CF_DIB
*/ */
{ {
#if defined(WINPR_UTILS_IMAGE_DIBv5) #if defined(WINPR_UTILS_IMAGE_DIBv5)
ClipboardRegisterSynthesizer(clipboard, CF_DIB, CF_DIBV5, clipboard_synthesize_cf_dibv5); if (!ClipboardRegisterSynthesizer(clipboard, CF_DIB, CF_DIBV5,
clipboard_synthesize_cf_dibv5))
return FALSE;
#endif #endif
for (size_t x = 0; x < ARRAYSIZE(mime_bitmap); x++) for (size_t x = 0; x < ARRAYSIZE(mime_bitmap); x++)
{ {
@@ -1064,11 +1091,13 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime);
if (altFormatId == 0) if (altFormatId == 0)
continue; continue;
ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId,
clipboard_synthesize_image_bmp); clipboard_synthesize_image_bmp))
return FALSE;
} }
ClipboardRegisterSynthesizer(clipboard, CF_DIB, htmlFormat, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIB, htmlFormat,
clipboard_synthesize_image_html); clipboard_synthesize_image_html))
return FALSE;
} }
/** /**
@@ -1076,7 +1105,8 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
*/ */
#if defined(WINPR_UTILS_IMAGE_DIBv5) #if defined(WINPR_UTILS_IMAGE_DIBv5)
{ {
ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, CF_DIB, clipboard_synthesize_cf_dib); if (!ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, CF_DIB, clipboard_synthesize_cf_dib))
return FALSE;
for (size_t x = 0; x < ARRAYSIZE(mime_bitmap); x++) for (size_t x = 0; x < ARRAYSIZE(mime_bitmap); x++)
{ {
@@ -1084,11 +1114,13 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime);
if (altFormatId == 0) if (altFormatId == 0)
continue; continue;
ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId,
clipboard_synthesize_image_bmp); clipboard_synthesize_image_bmp))
return FALSE;
} }
ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, htmlFormat, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, htmlFormat,
clipboard_synthesize_image_html); clipboard_synthesize_image_html))
return FALSE;
} }
#endif #endif
@@ -1101,13 +1133,17 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime);
if (altFormatId == 0) if (altFormatId == 0)
continue; continue;
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB, clipboard_synthesize_cf_dib); if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB,
clipboard_synthesize_cf_dib))
return FALSE;
#if defined(WINPR_UTILS_IMAGE_DIBv5) #if defined(WINPR_UTILS_IMAGE_DIBv5)
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5, if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5,
clipboard_synthesize_cf_dibv5); clipboard_synthesize_cf_dibv5))
return FALSE;
#endif #endif
ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat, if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat,
clipboard_synthesize_image_html); clipboard_synthesize_image_html))
return FALSE;
} }
/** /**
@@ -1116,17 +1152,22 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
#if defined(WINPR_UTILS_IMAGE_PNG) #if defined(WINPR_UTILS_IMAGE_PNG)
{ {
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_png); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_png);
ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId,
clipboard_synthesize_image_bmp_to_png); clipboard_synthesize_image_bmp_to_png))
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB, return FALSE;
clipboard_synthesize_image_png_to_bmp); if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB,
ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat, clipboard_synthesize_image_png_to_bmp))
clipboard_synthesize_image_html); return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat,
clipboard_synthesize_image_html))
return FALSE;
#if defined(WINPR_UTILS_IMAGE_DIBv5) #if defined(WINPR_UTILS_IMAGE_DIBv5)
ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId,
clipboard_synthesize_image_bmp_to_png); clipboard_synthesize_image_bmp_to_png))
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5, return FALSE;
clipboard_synthesize_image_png_to_bmp); if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5,
clipboard_synthesize_image_png_to_bmp))
return FALSE;
#endif #endif
} }
#endif #endif
@@ -1137,17 +1178,22 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
#if defined(WINPR_UTILS_IMAGE_WEBP) #if defined(WINPR_UTILS_IMAGE_WEBP)
{ {
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_webp); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_webp);
ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId,
clipboard_synthesize_image_bmp_to_webp); clipboard_synthesize_image_bmp_to_webp))
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB, return FALSE;
clipboard_synthesize_image_webp_to_bmp); if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB,
ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat, clipboard_synthesize_image_webp_to_bmp))
clipboard_synthesize_image_html); return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat,
clipboard_synthesize_image_html))
return FALSE;
#if defined(WINPR_UTILS_IMAGE_DIBv5) #if defined(WINPR_UTILS_IMAGE_DIBv5)
ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId,
clipboard_synthesize_image_bmp_to_webp); clipboard_synthesize_image_bmp_to_webp))
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5, return FALSE;
clipboard_synthesize_image_webp_to_bmp); if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5,
clipboard_synthesize_image_webp_to_bmp))
return FALSE;
#endif #endif
} }
#endif #endif
@@ -1158,17 +1204,22 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
#if defined(WINPR_UTILS_IMAGE_JPEG) #if defined(WINPR_UTILS_IMAGE_JPEG)
{ {
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_jpeg); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_jpeg);
ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, CF_DIB, altFormatId,
clipboard_synthesize_image_bmp_to_jpeg); clipboard_synthesize_image_bmp_to_jpeg))
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB, return FALSE;
clipboard_synthesize_image_jpeg_to_bmp); if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIB,
ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat, clipboard_synthesize_image_jpeg_to_bmp))
clipboard_synthesize_image_html); return FALSE;
if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, htmlFormat,
clipboard_synthesize_image_html))
return FALSE;
#if defined(WINPR_UTILS_IMAGE_DIBv5) #if defined(WINPR_UTILS_IMAGE_DIBv5)
ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5, if (!ClipboardRegisterSynthesizer(clipboard, altFormatId, CF_DIBV5,
clipboard_synthesize_image_jpeg_to_bmp); clipboard_synthesize_image_jpeg_to_bmp))
ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId, return FALSE;
clipboard_synthesize_image_bmp_to_jpeg); if (!ClipboardRegisterSynthesizer(clipboard, CF_DIBV5, altFormatId,
clipboard_synthesize_image_bmp_to_jpeg))
return FALSE;
#endif #endif
} }
#endif #endif
@@ -1182,8 +1233,9 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
if (formatId) if (formatId)
{ {
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_html); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_html);
ClipboardRegisterSynthesizer(clipboard, formatId, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, formatId, altFormatId,
clipboard_synthesize_text_html); clipboard_synthesize_text_html))
return FALSE;
} }
} }
@@ -1196,8 +1248,9 @@ BOOL ClipboardInitSynthesizers(wClipboard* clipboard)
if (formatId) if (formatId)
{ {
const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_ms_html); const UINT32 altFormatId = ClipboardRegisterFormat(clipboard, mime_ms_html);
ClipboardRegisterSynthesizer(clipboard, formatId, altFormatId, if (!ClipboardRegisterSynthesizer(clipboard, formatId, altFormatId,
clipboard_synthesize_html_format); clipboard_synthesize_html_format))
return FALSE;
} }
} }