1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-04-24 10:09:49 +02:00
OJ aca306f8ce Implement CF_DIB support
The clipboard code now supports the `CF_DIB` format on the clipboard. When
found, it takes the data and uses GDI+ to convert it into a JPEG. GDI+ was
used because:

* It's on every Windows machine from XP SP0 onwards (Win2k doesn't work).
* It requires linking to a small gdiplus.lib instead of a massive jpeg
  library.
* It's a really easy interface to use that interops easily with the
  Windows bitmap header information structures.

I think it'd be worth considering this approach for the other screenshot
applications as well, as it'd reduce the jpeg lib dependency and simplify
the codebase.
2013-10-21 00:02:16 +10:00

23 lines
771 B
C

/*!
* @file clipboard_image.h
* @brief Declarations for clipboard image handling functionality
*/
#ifndef _METERPRETER_SOURCE_EXTENSION_EXTAPI_CLIPBOARD_IMAGE_H
#define _METERPRETER_SOURCE_EXTENSION_EXTAPI_CLIPBOARD_IMAGE_H
typedef struct _ConvertedImage
{
/*!
* @brief Pointer to a pointer which will receive the JPEG image data buffer.
* This value is allocated using \c malloc prior to returning. If after
* calling this function the value is non-NULL the caller must call
* \c free to release this memory.
*/
PBYTE pImageBuffer;
DWORD dwImageBufferSize;
} ConvertedImage;
DWORD convert_to_jpg( const LPBITMAPINFO lpBI, const LPVOID lpDIB, ULONG ulQuality, ConvertedImage* pImage );
#endif