ReactOS 0.4.15-dev-5875-g7c755d9
CImage.cpp File Reference
#include <atlimage.h>
#include "resource.h"
#include "atltest.h"
Include dependency graph for CImage.cpp:

Go to the source code of this file.

Typedefs

typedef Gdiplus::GpStatus(WINAPISTARTUP) (ULONG_PTR *, const Gdiplus::GdiplusStartupInput *, Gdiplus::GdiplusStartupOutput *)
 
typedef void(WINAPISHUTDOWN) (ULONG_PTR)
 
typedef Gdiplus::GpStatus(WINGDIPAPICREATEBITMAPFROMFILE) (GDIPCONST WCHAR *, Gdiplus::GpBitmap **)
 
typedef Gdiplus::GpStatus(WINGDIPAPIGETPIXELFORMAT) (Gdiplus::GpImage *image, Gdiplus::PixelFormat *format)
 
typedef Gdiplus::GpStatus(WINGDIPAPIDISPOSEIMAGE) (Gdiplus::GpImage *)
 

Functions

TCHARfile_name (const TCHAR *file)
 
static void write_bitmap (HINSTANCE hInst, int id, TCHAR *file)
 
template<typename TYPE >
TYPE AddrOf (const char *name)
 
static void init_gdip ()
 
static void determine_file_bpp (TCHAR *tfile, Gdiplus::PixelFormat expect_pf)
 
 START_TEST (CImage)
 

Variables

const TCHARszFiles []
 
static TCHAR szTempPath [MAX_PATH]
 
static HINSTANCE hinstGdiPlus
 
static ULONG_PTR gdiplusToken
 
static STARTUP Startup
 
static SHUTDOWN Shutdown
 
static CREATEBITMAPFROMFILE CreateBitmapFromFile
 
static GETPIXELFORMAT GetImagePixelFormat
 
static DISPOSEIMAGE DisposeImage
 

Typedef Documentation

◆ CREATEBITMAPFROMFILE

typedef Gdiplus::GpStatus(WINGDIPAPI * CREATEBITMAPFROMFILE) (GDIPCONST WCHAR *, Gdiplus::GpBitmap **)

Definition at line 74 of file CImage.cpp.

◆ DISPOSEIMAGE

typedef Gdiplus::GpStatus(WINGDIPAPI * DISPOSEIMAGE) (Gdiplus::GpImage *)

Definition at line 76 of file CImage.cpp.

◆ GETPIXELFORMAT

typedef Gdiplus::GpStatus(WINGDIPAPI * GETPIXELFORMAT) (Gdiplus::GpImage *image, Gdiplus::PixelFormat *format)

Definition at line 75 of file CImage.cpp.

◆ SHUTDOWN

typedef void(WINAPI * SHUTDOWN) (ULONG_PTR)

Definition at line 73 of file CImage.cpp.

◆ STARTUP

typedef Gdiplus::GpStatus(WINAPI * STARTUP) (ULONG_PTR *, const Gdiplus::GdiplusStartupInput *, Gdiplus::GdiplusStartupOutput *)

Definition at line 72 of file CImage.cpp.

Function Documentation

◆ AddrOf()

template<typename TYPE >
TYPE AddrOf ( const char name)

Definition at line 88 of file CImage.cpp.

89{
91 return reinterpret_cast<TYPE>(proc);
92}
static HINSTANCE hinstGdiPlus
Definition: CImage.cpp:78
int(* FARPROC)()
Definition: compat.h:36
#define GetProcAddress(x, y)
Definition: compat.h:753
TYPE
Definition: eventcreate.c:652
static HANDLE proc()
Definition: pdb.c:34
Definition: name.c:39

◆ determine_file_bpp()

static void determine_file_bpp ( TCHAR tfile,
Gdiplus::PixelFormat  expect_pf 
)
static

Definition at line 105 of file CImage.cpp.

106{
107 using namespace Gdiplus;
108 GpBitmap *pBitmap = NULL;
109
110#ifdef UNICODE
111 WCHAR* file = tfile;
112#else
114 ::MultiByteToWideChar(CP_ACP, 0, tfile, -1, file, MAX_PATH);
115#endif
116
117 if (Startup == NULL)
118 init_gdip();
119
120 Gdiplus::GdiplusStartupInput gdiplusStartupInput;
121 Startup(&gdiplusToken, &gdiplusStartupInput, NULL);
122
123
124 Gdiplus::GpStatus status = CreateBitmapFromFile(file, &pBitmap);
125 ok(status == Gdiplus::Ok, "Expected status to be %i, was: %i\n", (int)Gdiplus::Ok, (int)status);
126 ok(pBitmap != NULL, "Expected a valid bitmap\n");
127 if (pBitmap)
128 {
129 PixelFormat pf;
130 GetImagePixelFormat(pBitmap, &pf);
131 ok(pf == expect_pf, "Expected PixelFormat to be 0x%x, was: 0x%x\n", (int)expect_pf, (int)pf);
132
133 DisposeImage(pBitmap);
134 }
136}
static ULONG_PTR gdiplusToken
Definition: CImage.cpp:79
static STARTUP Startup
Definition: CImage.cpp:81
static GETPIXELFORMAT GetImagePixelFormat
Definition: CImage.cpp:84
static CREATEBITMAPFROMFILE CreateBitmapFromFile
Definition: CImage.cpp:83
static SHUTDOWN Shutdown
Definition: CImage.cpp:82
static DISPOSEIMAGE DisposeImage
Definition: CImage.cpp:85
static void init_gdip()
Definition: CImage.cpp:94
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define MAX_PATH
Definition: compat.h:34
#define MultiByteToWideChar
Definition: compat.h:110
INT PixelFormat
Definition: fci.c:127
Definition: ps.c:97
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ file_name()

TCHAR * file_name ( const TCHAR file)

Definition at line 26 of file CImage.cpp.

27{
28 static TCHAR buffer[MAX_PATH];
30 lstrcat(buffer, TEXT("\\"));
32 return buffer;
33}
static TCHAR szTempPath[MAX_PATH]
Definition: CImage.cpp:25
GLuint buffer
Definition: glext.h:5915
#define TEXT(s)
Definition: k32.h:26
#define lstrcpy
Definition: winbase.h:3745
#define lstrcat
Definition: winbase.h:3742
char TCHAR
Definition: xmlstorage.h:189

◆ init_gdip()

static void init_gdip ( )
static

Definition at line 94 of file CImage.cpp.

95{
96 hinstGdiPlus = ::LoadLibraryA("gdiplus.dll");
97 Startup = AddrOf<STARTUP>("GdiplusStartup");
98 Shutdown = AddrOf<SHUTDOWN>("GdiplusShutdown");
99 CreateBitmapFromFile = AddrOf<CREATEBITMAPFROMFILE>("GdipCreateBitmapFromFile");
100 GetImagePixelFormat = AddrOf<GETPIXELFORMAT>("GdipGetImagePixelFormat");
101 DisposeImage = AddrOf<DISPOSEIMAGE>("GdipDisposeImage");
102}
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111

Referenced by determine_file_bpp(), and START_TEST().

◆ START_TEST()

START_TEST ( CImage  )

Definition at line 139 of file CImage.cpp.

140{
141 HRESULT hr;
142 TCHAR* file;
143 BOOL bOK;
144 int width, height, bpp;
145 size_t n;
146 CImage image1, image2;
148 HDC hDC;
149
150#if 0
151 width = image1.GetWidth();
152 height = image1.GetHeight();
153 bpp = image1.GetBPP();
154#endif
155
158
160 ok(!image1.IsNull(), "Expected image1 is not null\n");
161
162 width = image1.GetWidth();
163 ok(width == 48, "Expected width to be 48, was: %d\n", width);
164 height = image1.GetHeight();
165 ok(height == 48, "Expected height to be 48, was: %d\n", height);
166 bpp = image1.GetBPP();
167 ok(bpp == 8, "Expected bpp to be 8, was: %d\n", bpp);
168
169
171 ok(!image2.IsNull(), "Expected image2 is not null\n");
172 image2.SetTransparentColor(RGB(255, 255, 255));
173
174 width = image2.GetWidth();
175 ok(width == 32, "Expected width to be 32, was: %d\n", width);
176 height = image2.GetHeight();
177 ok(height == 32, "Expected height to be 32, was: %d\n", height);
178 bpp = image2.GetBPP();
179 ok(bpp == 8, "Expected bpp to be 8, was: %d\n", bpp);
180
181 color = image1.GetPixel(5, 5);
182 ok(color == RGB(166, 202, 240), "Expected color to be 166, 202, 240; was: %i, %i, %i\n", GetRValue(color), GetGValue(color), GetBValue(color));
183
184 hDC = image1.GetDC();
185 bOK = image2.Draw(hDC, 0, 0);
186 image1.ReleaseDC();
187 ok(bOK != FALSE, "Expected bDraw to be TRUE, was: %d\n", bOK);
188 image2.Destroy();
189
190 color = image1.GetPixel(5, 5);
191 ok(color == RGB(255, 0,0), "Expected color to be 255, 0, 0; was: %i, %i, %i\n", GetRValue(color), GetGValue(color), GetBValue(color));
192
193 file = file_name(TEXT("ant.bmp"));
195
196 init_gdip();
197
199
200 hr = image2.Load(file);
201 ok(hr == S_OK, "Expected hr to be S_OK, was: %08lx\n", hr);
202 ok(!image2.IsNull(), "Expected image1 is not null\n");
203 bOK = DeleteFile(file);
204 ok(bOK, "Expected bOK to be TRUE, was: %d\n", bOK);
205
206 width = image2.GetWidth();
207 ok_int(width, 48);
208 height = image2.GetHeight();
209 ok_int(height, 48);
210 bpp = image2.GetBPP();
211 ok_int(bpp, 32);
212
213 for (n = 0; n < _countof(szFiles); ++n)
214 {
216 image2.Destroy();
217
218 if (n == 0)
219 hr = image1.Save(file, Gdiplus::ImageFormatPNG);
220 else
221 hr = image1.Save(file);
222 ok(hr == S_OK, "Expected hr to be S_OK, was: %08lx (for %i)\n", hr, n);
223
224 bOK = (GetFileAttributes(file) != 0xFFFFFFFF);
225 ok(bOK, "Expected bOK to be TRUE, was: %d (for %i)\n", bOK, n);
226
227 hr = image2.Load(file);
228 ok(hr == S_OK, "Expected hr to be S_OK, was: %08lx (for %i)\n", hr, n);
229
230 width = image2.GetWidth();
231 ok(width == 48, "Expected width to be 48, was: %d (for %i)\n", width, n);
232 height = image2.GetHeight();
233 ok(height == 48, "Expected height to be 48, was: %d (for %i)\n", height, n);
234 bpp = image2.GetBPP();
235 if (n == 3)
236 {
237 ok(bpp == 32, "Expected bpp to be 32, was: %d (for %i)\n", bpp, n);
239 }
240 else
241 {
242 ok(bpp == 32, "Expected bpp to be 32, was: %d (for %i)\n", bpp, n);
244 }
245 color = image1.GetPixel(5, 5);
246 ok(color == RGB(255, 0,0), "Expected color to be 255, 0, 0; was: %i, %i, %i (for %i)\n", GetRValue(color), GetGValue(color), GetBValue(color), n);
247
248 bOK = DeleteFile(file);
249 ok(bOK, "Expected bOK to be TRUE, was: %d (for %i)\n", bOK, n);
250 }
251
253 CSimpleArray<GUID> aguidFileTypes;
254#ifdef UNICODE
255 CHAR szBuff[512];
256 const WCHAR *psz;
257#else
258 const CHAR *psz;
259#endif
260
261 CSimpleString strImporters(mgr);
262 aguidFileTypes.RemoveAll();
263 hr = CImage::GetImporterFilterString(strImporters,
264 aguidFileTypes,
265 TEXT("All Image Files"), 0);
266 ok(hr == S_OK, "Expected hr to be S_OK, was: %ld\n", hr);
267 ok(aguidFileTypes.GetSize() == 9, "Expected aguidFileTypes.GetSize() to be 8, was %d.", aguidFileTypes.GetSize());
268 ok(IsEqualGUID(aguidFileTypes[0], GUID_NULL), "Expected aguidFileTypes[0] to be GUID_NULL.\n");
269 ok(IsEqualGUID(aguidFileTypes[1], Gdiplus::ImageFormatBMP), "Expected aguidFileTypes[1] to be Gdiplus::ImageFormatBMP.\n");
270 ok(IsEqualGUID(aguidFileTypes[2], Gdiplus::ImageFormatJPEG), "Expected aguidFileTypes[2] to be Gdiplus::ImageFormatJPEG.\n");
271 ok(IsEqualGUID(aguidFileTypes[3], Gdiplus::ImageFormatGIF), "Expected aguidFileTypes[3] to be Gdiplus::ImageFormatGIF.\n");
272 ok(IsEqualGUID(aguidFileTypes[4], Gdiplus::ImageFormatEMF), "Expected aguidFileTypes[4] to be Gdiplus::ImageFormatEMF.\n");
273 ok(IsEqualGUID(aguidFileTypes[5], Gdiplus::ImageFormatWMF), "Expected aguidFileTypes[5] to be Gdiplus::ImageFormatWMF.\n");
274 ok(IsEqualGUID(aguidFileTypes[6], Gdiplus::ImageFormatTIFF), "Expected aguidFileTypes[6] to be Gdiplus::ImageFormatTIFF.\n");
275 ok(IsEqualGUID(aguidFileTypes[7], Gdiplus::ImageFormatPNG), "Expected aguidFileTypes[7] to be Gdiplus::ImageFormatPNG.\n");
276 ok(IsEqualGUID(aguidFileTypes[8], Gdiplus::ImageFormatIcon), "Expected aguidFileTypes[8] to be Gdiplus::ImageFormatIcon.\n");
277
278 psz = strImporters.GetString();
279#ifdef UNICODE
280 WideCharToMultiByte(CP_ACP, 0, psz, -1, szBuff, 512, NULL, NULL);
281 ok(lstrcmpA(szBuff, "All Image Files|*.BMP;*.DIB;*.RLE;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.EMF;*.WMF;*.TIF;*.TIFF;*.PNG;*.ICO|BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|GIF (*.GIF)|*.GIF|EMF (*.EMF)|*.EMF|WMF (*.WMF)|*.WMF|TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|PNG (*.PNG)|*.PNG|ICO (*.ICO)|*.ICO||") == 0,
282 "The importer filter string is bad, was: %s\n", szBuff);
283#else
284 ok(lstrcmpA(psz, "All Image Files|*.BMP;*.DIB;*.RLE;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.EMF;*.WMF;*.TIF;*.TIFF;*.PNG;*.ICO|BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|GIF (*.GIF)|*.GIF|EMF (*.EMF)|*.EMF|WMF (*.WMF)|*.WMF|TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|PNG (*.PNG)|*.PNG|ICO (*.ICO)|*.ICO||") == 0,
285 "The importer filter string is bad, was: %s\n", psz);
286#endif
287
288 CSimpleString strExporters(mgr);
289 aguidFileTypes.RemoveAll();
290 hr = CImage::GetExporterFilterString(strExporters,
291 aguidFileTypes,
292 TEXT("All Image Files"), 0);
293 ok(hr == S_OK, "Expected hr to be S_OK, was: %ld\n", hr);
294 ok(aguidFileTypes.GetSize() == 9, "Expected aguidFileTypes.GetSize() to be 8, was %d.", aguidFileTypes.GetSize());
295 ok(IsEqualGUID(aguidFileTypes[0], GUID_NULL), "Expected aguidFileTypes[0] to be GUID_NULL.\n");
296 ok(IsEqualGUID(aguidFileTypes[1], Gdiplus::ImageFormatBMP), "Expected aguidFileTypes[1] to be Gdiplus::ImageFormatBMP.\n");
297 ok(IsEqualGUID(aguidFileTypes[2], Gdiplus::ImageFormatJPEG), "Expected aguidFileTypes[2] to be Gdiplus::ImageFormatJPEG.\n");
298 ok(IsEqualGUID(aguidFileTypes[3], Gdiplus::ImageFormatGIF), "Expected aguidFileTypes[3] to be Gdiplus::ImageFormatGIF.\n");
299 ok(IsEqualGUID(aguidFileTypes[4], Gdiplus::ImageFormatEMF), "Expected aguidFileTypes[4] to be Gdiplus::ImageFormatEMF.\n");
300 ok(IsEqualGUID(aguidFileTypes[5], Gdiplus::ImageFormatWMF), "Expected aguidFileTypes[5] to be Gdiplus::ImageFormatWMF.\n");
301 ok(IsEqualGUID(aguidFileTypes[6], Gdiplus::ImageFormatTIFF), "Expected aguidFileTypes[6] to be Gdiplus::ImageFormatTIFF.\n");
302 ok(IsEqualGUID(aguidFileTypes[7], Gdiplus::ImageFormatPNG), "Expected aguidFileTypes[7] to be Gdiplus::ImageFormatPNG.\n");
303 ok(IsEqualGUID(aguidFileTypes[8], Gdiplus::ImageFormatIcon), "Expected aguidFileTypes[8] to be Gdiplus::ImageFormatIcon.\n");
304
305 psz = strExporters.GetString();
306#ifdef UNICODE
307 WideCharToMultiByte(CP_ACP, 0, psz, -1, szBuff, 512, NULL, NULL);
308 ok(lstrcmpA(szBuff, "All Image Files|*.BMP;*.DIB;*.RLE;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.EMF;*.WMF;*.TIF;*.TIFF;*.PNG;*.ICO|BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|GIF (*.GIF)|*.GIF|EMF (*.EMF)|*.EMF|WMF (*.WMF)|*.WMF|TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|PNG (*.PNG)|*.PNG|ICO (*.ICO)|*.ICO||") == 0,
309 "The exporter filter string is bad, was: %s\n", szBuff);
310#else
311 ok(lstrcmpA(psz, "All Image Files|*.BMP;*.DIB;*.RLE;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.EMF;*.WMF;*.TIF;*.TIFF;*.PNG;*.ICO|BMP (*.BMP;*.DIB;*.RLE)|*.BMP;*.DIB;*.RLE|JPEG (*.JPG;*.JPEG;*.JPE;*.JFIF)|*.JPG;*.JPEG;*.JPE;*.JFIF|GIF (*.GIF)|*.GIF|EMF (*.EMF)|*.EMF|WMF (*.WMF)|*.WMF|TIFF (*.TIF;*.TIFF)|*.TIF;*.TIFF|PNG (*.PNG)|*.PNG|ICO (*.ICO)|*.ICO||") == 0,
312 "The exporter filter string is bad, was: %s\n", psz);
313#endif
314}
static HDC hDC
Definition: 3dtext.c:33
static void determine_file_bpp(TCHAR *tfile, Gdiplus::PixelFormat expect_pf)
Definition: CImage.cpp:105
static void write_bitmap(HINSTANCE hInst, int id, TCHAR *file)
Definition: CImage.cpp:35
const TCHAR * szFiles[]
Definition: CImage.cpp:17
#define ok_int(expression, result)
Definition: atltest.h:134
static IAtlStringMgr * GetInstance(void)
Definition: atlstr.h:28
int GetBPP() const
Definition: atlimage.h:282
void LoadFromResource(HINSTANCE hInstance, LPCTSTR pszResourceName)
Definition: atlimage.h:436
HRESULT Load(LPCTSTR pszFileName)
Definition: atlimage.h:377
HRESULT Save(IStream *pStream, GUID *guidFileType) const
Definition: atlimage.h:523
static HRESULT GetImporterFilterString(CSimpleString &strImporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultLoad, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:787
void Destroy()
Definition: atlimage.h:208
HDC GetDC() const
Definition: atlimage.h:96
void ReleaseDC() const
Definition: atlimage.h:106
int GetWidth() const
Definition: atlimage.h:354
bool IsNull() const
Definition: atlimage.h:372
int GetHeight() const
Definition: atlimage.h:297
static HRESULT GetExporterFilterString(CSimpleString &strExporters, CSimpleArray< GUID > &aguidFileTypes, LPCTSTR pszAllFilesDescription=NULL, DWORD dwExclude=excludeDefaultSave, TCHAR chSeparator=TEXT('|'))
Definition: atlimage.h:801
COLORREF SetTransparentColor(COLORREF rgbTransparent)
Definition: atlimage.h:613
COLORREF GetPixel(int x, int y) const
Definition: atlimage.h:332
BOOL Draw(HDC hDestDC, int xDest, int yDest, int nDestWidth, int nDestHeight, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight) const
Definition: atlimage.h:216
#define FALSE
Definition: types.h:117
DWORD bpp
Definition: surface.c:185
#define WideCharToMultiByte
Definition: compat.h:111
#define RGB(r, g, b)
Definition: precomp.h:62
#define GetBValue(quad)
Definition: precomp.h:66
#define GetGValue(quad)
Definition: precomp.h:65
#define GetRValue(quad)
Definition: precomp.h:64
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PixelFormat8bppIndexed
#define PixelFormat24bppRGB
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble n
Definition: glext.h:7729
GLuint color
Definition: glext.h:6243
#define S_OK
Definition: intsafe.h:52
#define GUID_NULL
Definition: ks.h:106
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
#define IDB_CROSS
Definition: resource.h:6
#define IDB_ANT
Definition: resource.h:5
static HDC
Definition: imagelist.c:92
static LPCWSTR file_name
Definition: protocol.c:147
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:68
#define GetTempPath
Definition: winbase.h:3721
#define GetFileAttributes
Definition: winbase.h:3686
#define GetModuleHandle
Definition: winbase.h:3698
#define DeleteFile
Definition: winbase.h:3635
DWORD COLORREF
Definition: windef.h:300
char CHAR
Definition: xmlstorage.h:175

◆ write_bitmap()

static void write_bitmap ( HINSTANCE  hInst,
int  id,
TCHAR file 
)
static

Definition at line 35 of file CImage.cpp.

36{
37 HRSRC rsrc;
38
40 ok(rsrc != NULL, "Expected to find an image resource\n");
41 if (rsrc)
42 {
43 void *rsrc_data;
44 HANDLE hfile;
45 BOOL ret;
47 DWORD rsrc_size = SizeofResource(hInst, rsrc);
48
49 rsrc_data = LockResource(glob);
50
52 ok(hfile != INVALID_HANDLE_VALUE, "Unable to open temp file: %lu\n", GetLastError());
53 if (hfile != INVALID_HANDLE_VALUE)
54 {
55 BITMAPFILEHEADER bfh = { 0 };
56 DWORD dwWritten;
57
58 bfh.bfType = 'MB';
59 bfh.bfSize = rsrc_size + sizeof(BITMAPFILEHEADER);
60 bfh.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
61 bfh.bfReserved1 = bfh.bfReserved2 = 0;
62 ret = WriteFile(hfile, &bfh, sizeof(bfh), &dwWritten, NULL);
63 ok(ret, "Unable to write temp file: %lu\n", GetLastError());
64 ret = WriteFile(hfile, rsrc_data, rsrc_size, &dwWritten, NULL);
65 ok(ret, "Unable to write temp file: %lu\n", GetLastError());
66 CloseHandle(hfile);
67 }
68 UnlockResource(rsrc_data);
69 }
70}
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
char ** glob(const char *v)
Definition: fake.c:36
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
#define RT_BITMAP
Definition: pedump.c:364
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define FindResource
Definition: winbase.h:3664
#define CreateFile
Definition: winbase.h:3620
#define UnlockResource(handle)
Definition: winbase.h:3243
struct tagBITMAPFILEHEADER BITMAPFILEHEADER
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by START_TEST().

Variable Documentation

◆ CreateBitmapFromFile

CREATEBITMAPFROMFILE CreateBitmapFromFile
static

Definition at line 83 of file CImage.cpp.

Referenced by determine_file_bpp(), init_gdip(), and ATL::CImage::Load().

◆ DisposeImage

DISPOSEIMAGE DisposeImage
static

Definition at line 85 of file CImage.cpp.

Referenced by determine_file_bpp(), and init_gdip().

◆ gdiplusToken

ULONG_PTR gdiplusToken
static

◆ GetImagePixelFormat

GETPIXELFORMAT GetImagePixelFormat
static

Definition at line 84 of file CImage.cpp.

Referenced by determine_file_bpp(), and init_gdip().

◆ hinstGdiPlus

HINSTANCE hinstGdiPlus
static

Definition at line 78 of file CImage.cpp.

Referenced by AddrOf(), and init_gdip().

◆ Shutdown

SHUTDOWN Shutdown
static

Definition at line 82 of file CImage.cpp.

Referenced by determine_file_bpp(), and init_gdip().

◆ Startup

STARTUP Startup
static

Definition at line 81 of file CImage.cpp.

Referenced by determine_file_bpp(), and init_gdip().

◆ szFiles

const TCHAR* szFiles[]
Initial value:
= {
TEXT("ant.png"),
TEXT("ant.tif"),
TEXT("ant.gif"),
TEXT("ant.jpg"),
TEXT("ant.bmp"),
}

Definition at line 17 of file CImage.cpp.

Referenced by parse_file_list(), and START_TEST().

◆ szTempPath