Beispiel #1
0
	LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
	{
		KillTimer( 0 );
		IPicture_Release(logos[0]);
		IPicture_Release(logos[1]);
		DeleteObject(backbuffer);

		return 0;
	}
Beispiel #2
0
static void test_OleCreatePictureIndirect(void)
{
    OLE_HANDLE handle;
    IPicture *pict;
    HRESULT hr;
    short type;

    if(!pOleCreatePictureIndirect)
    {
        win_skip("Skipping OleCreatePictureIndirect tests\n");
        return;
    }

if (0)
{
    /* crashes on native */
    pOleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, NULL);
}

    hr = pOleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict);
    ok(hr == S_OK, "hr %08x\n", hr);

    type = PICTYPE_NONE;
    hr = IPicture_get_Type(pict, &type);
    ok(hr == S_OK, "hr %08x\n", hr);
    ok(type == PICTYPE_UNINITIALIZED, "type %d\n", type);

    handle = 0xdeadbeef;
    hr = IPicture_get_Handle(pict, &handle);
    ok(hr == S_OK, "hr %08x\n", hr);
    ok(handle == 0, "handle %08x\n", handle);

    IPicture_Release(pict);
}
Beispiel #3
0
static void test_OleCreatePictureIndirect(void)
{
    IPicture *pict;
    HRESULT hr;
    short type;
    OLE_HANDLE handle;

    if(!pOleCreatePictureIndirect)
    {
        skip("Skipping OleCreatePictureIndirect tests\n");
        return;
    }

    hr = pOleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict);
    ok(hr == S_OK, "hr %08x\n", hr);

    hr = IPicture_get_Type(pict, &type);
    ok(hr == S_OK, "hr %08x\n", hr);
    ok(type == PICTYPE_UNINITIALIZED, "type %d\n", type);

    hr = IPicture_get_Handle(pict, &handle);
    ok(hr == S_OK, "hr %08x\n", hr);
    ok(handle == 0, "handle %08x\n", handle);

    IPicture_Release(pict);
}
Beispiel #4
0
static void test_get_Type(void)
{
    IPicture *pic;
    HRESULT hres;

    OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (VOID**)&pic);

    hres = IPicture_get_Type(pic, NULL);
    ole_expect(hres, E_POINTER);

    IPicture_Release(pic);
}
Beispiel #5
0
static void test_load_save_icon(void)
{
    IPicture *pic;
    PICTDESC desc;
    short type;
    OLE_HANDLE handle;
    HGLOBAL hmem;
    DWORD *mem;
    IPersistStream *src_stream;
    IStream *dst_stream;
    HRESULT hr;

    desc.cbSizeofstruct = sizeof(desc);
    desc.picType = PICTYPE_ICON;
    desc.u.icon.hicon = LoadIcon(0, IDI_APPLICATION);
    hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic);
    ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr);

    type = -1;
    hr = IPicture_get_Type(pic, &type);
    ok(hr == S_OK,"get_Type error %#8x\n", hr);
    ok(type == PICTYPE_ICON,"expected picture type PICTYPE_ICON, got %d\n", type);

    hr = IPicture_get_Handle(pic, &handle);
    ok(hr == S_OK,"get_Handle error %#8x\n", hr);
    ok(IntToPtr(handle) == desc.u.icon.hicon, "get_Handle returned wrong handle %#x\n", handle);

    hmem = GlobalAlloc(GMEM_ZEROINIT, 8192);
    hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream);
    ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);

    hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream);
    ok(hr == S_OK, "QueryInterface error %#x\n", hr);

    hr = IPersistStream_Save(src_stream, dst_stream, TRUE);
    ok(hr == S_OK, "Saveerror %#x\n", hr);

    IPersistStream_Release(src_stream);
    IStream_Release(dst_stream);

    mem = GlobalLock(hmem);
    ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]);
todo_wine
    ok(mem[1] == 766, "expected stream size 766, got %u\n", mem[1]);
    ok(mem[2] == 0x00010000, "got wrong icon header %04x\n", mem[2]);

    GlobalUnlock(hmem);
    GlobalFree(hmem);

    DestroyIcon(desc.u.icon.hicon);
    IPicture_Release(pic);
}
Beispiel #6
0
static void test_load_save_bmp(void)
{
    IPicture *pic;
    PICTDESC desc;
    short type;
    OLE_HANDLE handle;
    HGLOBAL hmem;
    DWORD *mem;
    IPersistStream *src_stream;
    IStream *dst_stream;
    HRESULT hr;

    desc.cbSizeofstruct = sizeof(desc);
    desc.picType = PICTYPE_BITMAP;
    desc.u.bmp.hpal = 0;
    desc.u.bmp.hbitmap = CreateBitmap(1, 1, 1, 1, NULL);
    hr = OleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic);
    ok(hr == S_OK, "OleCreatePictureIndirect error %#x\n", hr);

    type = -1;
    hr = IPicture_get_Type(pic, &type);
    ok(hr == S_OK,"get_Type error %#8x\n", hr);
    ok(type == PICTYPE_BITMAP,"expected picture type PICTYPE_BITMAP, got %d\n", type);

    hr = IPicture_get_Handle(pic, &handle);
    ok(hr == S_OK,"get_Handle error %#8x\n", hr);
    ok(IntToPtr(handle) == desc.u.bmp.hbitmap, "get_Handle returned wrong handle %#x\n", handle);

    hmem = GlobalAlloc(GMEM_ZEROINIT, 4096);
    hr = CreateStreamOnHGlobal(hmem, FALSE, &dst_stream);
    ok(hr == S_OK, "createstreamonhglobal error %#x\n", hr);

    hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream);
    ok(hr == S_OK, "QueryInterface error %#x\n", hr);

    hr = IPersistStream_Save(src_stream, dst_stream, TRUE);
    ok(hr == S_OK, "Save error %#x\n", hr);

    IPersistStream_Release(src_stream);
    IStream_Release(dst_stream);

    mem = GlobalLock(hmem);
    ok(!memcmp(mem, "lt\0\0", 4), "got wrong stream header %04x\n", mem[0]);
    ok(mem[1] == 66, "expected stream size 66, got %u\n", mem[1]);
    ok(!memcmp(&mem[2], "BM", 2), "got wrong bmp header %04x\n", mem[2]);

    GlobalUnlock(hmem);
    GlobalFree(hmem);

    DeleteObject(desc.u.bmp.hbitmap);
    IPicture_Release(pic);
}
Beispiel #7
0
static void test_empty_image(void) {
	LPBYTE		data;
	LPSTREAM	stream;
	IPicture*	pic = NULL;
	HRESULT		hres;
	LPVOID		pvObj = NULL;
	HGLOBAL		hglob;
	OLE_HANDLE	handle;
	ULARGE_INTEGER	newpos1;
	LARGE_INTEGER	seekto;
	short		type;
	DWORD		attr;

	/* Empty image. Happens occasionally in VB programs. */
	hglob = GlobalAlloc (0, 8);
	data = GlobalLock (hglob);
	memcpy(data,"lt\0\0",4);
	((DWORD*)data)[1] = 0;
	hres = CreateStreamOnHGlobal (hglob, TRUE, &stream);
	ok (hres == S_OK, "CreatestreamOnHGlobal failed? doubt it... hres 0x%08x\n", hres);

	memset(&seekto,0,sizeof(seekto));
	hres = IStream_Seek(stream,seekto,SEEK_CUR,&newpos1);
	ok (hres == S_OK, "istream seek failed? doubt it... hres 0x%08x\n", hres);

	pvObj = NULL;
	hres = pOleLoadPicture(stream, 8, TRUE, &IID_IPicture, &pvObj);
	pic = pvObj;
	ok(hres == S_OK,"empty picture not loaded, hres 0x%08x\n", hres);
	ok(pic != NULL,"empty picture not loaded, pic is NULL\n");

	hres = IPicture_get_Type (pic, &type);
	ok (hres == S_OK,"empty picture get type failed with hres 0x%08x\n", hres);
	ok (type == PICTYPE_NONE,"type is %d, but should be PICTYPE_NONE(0)\n", type);

	attr = 0xdeadbeef;
	hres = IPicture_get_Attributes (pic, &attr);
	ok (hres == S_OK,"empty picture get attributes failed with hres 0x%08x\n", hres);
	ok (attr == 0,"attr is %d, but should be 0\n", attr);

	hres = IPicture_get_Handle (pic, &handle);
	ok (hres == S_OK,"empty picture get handle failed with hres 0x%08x\n", hres);
	ok (handle == 0, "empty picture get handle did not return 0, but 0x%08x\n", handle);
	IPicture_Release (pic);
	IStream_Release (stream);
}
Beispiel #8
0
static void test_get_Attributes(void)
{
    IPicture *pic;
    HRESULT hres;
    short type;
    DWORD attr;

    OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (VOID**)&pic);
    hres = IPicture_get_Type(pic, &type);
    ok(hres == S_OK, "IPicture_get_Type does not return S_OK, but 0x%08x\n", hres);
    ok(type == PICTYPE_UNINITIALIZED, "Expected type = PICTYPE_UNINITIALIZED, got = %d\n", type);

    hres = IPicture_get_Attributes(pic, NULL);
    ole_expect(hres, E_POINTER);

    attr = 0xdeadbeef;
    hres = IPicture_get_Attributes(pic, &attr);
    ole_expect(hres, S_OK);
    ok(attr == 0, "IPicture_get_Attributes does not reset attr to zero, got %d\n", attr);

    IPicture_Release(pic);
}
Beispiel #9
0
static void test_empty_image_2(void) {
	LPBYTE		data;
	LPSTREAM	stream;
	IPicture*	pic = NULL;
	HRESULT		hres;
	LPVOID		pvObj = NULL;
	HGLOBAL		hglob;
	ULARGE_INTEGER	newpos1;
	LARGE_INTEGER	seekto;
	short		type;

	/* Empty image at random stream position. */
	hglob = GlobalAlloc (0, 200);
	data = GlobalLock (hglob);
	data += 42;
	memcpy(data,"lt\0\0",4);
	((DWORD*)data)[1] = 0;
	hres = CreateStreamOnHGlobal (hglob, TRUE, &stream);
	ok (hres == S_OK, "CreatestreamOnHGlobal failed? doubt it... hres 0x%08x\n", hres);

	memset(&seekto,0,sizeof(seekto));
	seekto.u.LowPart = 42;
	hres = IStream_Seek(stream,seekto,SEEK_CUR,&newpos1);
	ok (hres == S_OK, "istream seek failed? doubt it... hres 0x%08x\n", hres);

	pvObj = NULL;
	hres = pOleLoadPicture(stream, 8, TRUE, &IID_IPicture, &pvObj);
	pic = pvObj;
	ok(hres == S_OK,"empty picture not loaded, hres 0x%08x\n", hres);
	ok(pic != NULL,"empty picture not loaded, pic is NULL\n");

	hres = IPicture_get_Type (pic, &type);
	ok (hres == S_OK,"empty picture get type failed with hres 0x%08x\n", hres);
	ok (type == PICTYPE_NONE,"type is %d, but should be PICTYPE_NONE(0)\n", type);

	IPicture_Release (pic);
	IStream_Release (stream);
}
Beispiel #10
0
static void test_apm()
{
    OLE_HANDLE handle;
    LPSTREAM stream;
    IPicture *pict;
    HGLOBAL hglob;
    LPBYTE *data;
    LONG cxy;
    BOOL keep;
    short type;

    hglob = GlobalAlloc (0, sizeof(apmdata));
    data = GlobalLock(hglob);
    memcpy(data, apmdata, sizeof(apmdata));

    ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream));
    ole_check(OleLoadPictureEx(stream, sizeof(apmdata), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict));

    ole_check(IPicture_get_Handle(pict, &handle));
    ok(handle != 0, "handle is null\n");

    ole_check(IPicture_get_Type(pict, &type));
    expect_eq(type, PICTYPE_METAFILE, short, "%d");

    ole_check(IPicture_get_Height(pict, &cxy));
    expect_eq(cxy,  1667, LONG, "%d");

    ole_check(IPicture_get_Width(pict, &cxy));
    expect_eq(cxy,  1323, LONG, "%d");

    ole_check(IPicture_get_KeepOriginalFormat(pict, &keep));
    todo_wine expect_eq(keep, FALSE, LONG, "%d");

    ole_expect(IPicture_get_hPal(pict, &handle), E_FAIL);
    IPicture_Release(pict);
    IStream_Release(stream);
}
Beispiel #11
0
static void
test_pic_with_stream(LPSTREAM stream, unsigned int imgsize)
{
	IPicture*	pic = NULL;
	HRESULT		hres;
	LPVOID		pvObj = NULL;
	OLE_HANDLE	handle, hPal;
	OLE_XSIZE_HIMETRIC	width;
	OLE_YSIZE_HIMETRIC	height;
	short		type;
	DWORD		attr;
	ULONG		res;

	pvObj = NULL;
	hres = pOleLoadPicture(stream, imgsize, TRUE, &IID_IPicture, &pvObj);
	pic = pvObj;

	ok(hres == S_OK,"OLP (NULL,..) does not return 0, but 0x%08lx\n",hres);
	ok(pic != NULL,"OLP (NULL,..) returns NULL, instead of !NULL\n");
	if (pic == NULL)
		return;

	pvObj = NULL;
	hres = IPicture_QueryInterface (pic, &IID_IPicture, &pvObj);

	ok(hres == S_OK,"IPicture_QI does not return S_OK, but 0x%08lx\n", hres);
	ok(pvObj != NULL,"IPicture_QI does return NULL, instead of a ptr\n");

	IPicture_Release ((IPicture*)pvObj);

	handle = 0;
	hres = IPicture_get_Handle (pic, &handle);
	ok(hres == S_OK,"IPicture_get_Handle does not return S_OK, but 0x%08lx\n", hres);
	ok(handle != 0, "IPicture_get_Handle returns a NULL handle, but it should be non NULL\n");

	width = 0;
	hres = IPicture_get_Width (pic, &width);
	ok(hres == S_OK,"IPicture_get_Width does not return S_OK, but 0x%08lx\n", hres);
	ok(width != 0, "IPicture_get_Width returns 0, but it should not be 0.\n");

	height = 0;
	hres = IPicture_get_Height (pic, &height);
	ok(hres == S_OK,"IPicture_get_Height does not return S_OK, but 0x%08lx\n", hres);
	ok(height != 0, "IPicture_get_Height returns 0, but it should not be 0.\n");

	type = 0;
	hres = IPicture_get_Type (pic, &type);
	ok(hres == S_OK,"IPicture_get_Type does not return S_OK, but 0x%08lx\n", hres);
	ok(type == PICTYPE_BITMAP, "IPicture_get_Type returns %d, but it should be PICTYPE_BITMAP(%d).\n", type, PICTYPE_BITMAP);

	attr = 0;
	hres = IPicture_get_Attributes (pic, &attr);
	ok(hres == S_OK,"IPicture_get_Attributes does not return S_OK, but 0x%08lx\n", hres);
	ok(attr == 0, "IPicture_get_Attributes returns %ld, but it should be 0.\n", attr);

	hPal = 0;
	hres = IPicture_get_hPal (pic, &hPal);
	ok(hres == S_OK,"IPicture_get_hPal does not return S_OK, but 0x%08lx\n", hres);
	/* a single pixel b/w image has no palette */
	ok(hPal == 0, "IPicture_get_hPal returns %ld, but it should be 0.\n", (long)hPal);

	res = IPicture_Release (pic);
	ok (res == 0, "refcount after release is %ld, but should be 0?\n", res);
}
Beispiel #12
0
static LRESULT CALLBACK GEPProc(HWND wnd, UINT msg, WPARAM wp, LPARAM lp)
{
	HGLOBAL hglob;
	logo_data * gep_gun;

	if (msg == WM_NCCREATE)
	{
		HMODULE hInst = core_api::get_my_instance();
		
		hglob = GlobalAlloc(GMEM_MOVEABLE,sizeof(logo_data));
		gep_gun = (logo_data *) GlobalLock(hglob);

		gep_gun->frame = 0;
		gep_gun->logos[0] = LoadPic(MAKEINTRESOURCE(IDB_LOGO1), _T("JPG"), hInst);
		gep_gun->logos[1] = LoadPic(MAKEINTRESOURCE(IDB_LOGO2), _T("JPG"), hInst);
		
		IPicture_getHandle(gep_gun->logos[0], (OLE_HANDLE *)&gep_gun->frames[0]);
		IPicture_getHandle(gep_gun->logos[1], (OLE_HANDLE *)&gep_gun->frames[1]);

		BITMAP bm;
		GetObject( gep_gun->frames[0], sizeof(bm), &bm );
		gep_gun->ptSize.x = bm.bmWidth;
		gep_gun->ptSize.y = bm.bmHeight;

		BITMAPINFOHEADER bmih;
		bmih.biSize = sizeof(bmih);
		bmih.biWidth = bm.bmWidth;
		bmih.biHeight = bm.bmHeight;
		bmih.biPlanes = bm.bmPlanes;
		bmih.biBitCount = bm.bmBitsPixel;
		bmih.biCompression = BI_RGB;
		bmih.biSizeImage = 0;
		bmih.biXPelsPerMeter = 0;
		bmih.biYPelsPerMeter = 0;
		bmih.biClrUsed = 0;
		bmih.biClrImportant = 0;

		BYTE * gfx;
		gep_gun->backbuffer = CreateDIBSection(0, (const BITMAPINFO *) &bmih, DIB_RGB_COLORS, (VOID **) &gfx, 0, 0);

		SetWindowLong( wnd, GWL_USERDATA, (LONG) hglob );

		SetWindowPos( wnd, 0, 0, 0, gep_gun->ptSize.x, gep_gun->ptSize.y, SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);

		SetTimer( wnd, 666, 10, 0 );
	}
	else
	{
		hglob = (HGLOBAL) GetWindowLong( wnd, GWL_USERDATA );
		if (hglob == NULL) return DefWindowProc(wnd, msg, wp, lp);
		gep_gun = (logo_data *) GlobalLock(hglob);
	}
	switch (msg)
	{
	case WM_TIMER:
		if (wp == 666)
		{
			gep_gun->frame++;
			if (gep_gun->frame >= 1000) gep_gun->frame = 0;
			if (!gep_gun->frame ||
				(gep_gun->frame >= 400 && gep_gun->frame <= 500) ||
				(gep_gun->frame >= 900))
			{
				RECT rc;
				GetClientRect( wnd, &rc );
				InvalidateRect( wnd, &rc, FALSE );
			}
		}
		break;

	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			HDC hdc = BeginPaint( wnd, &ps );

			HDC hdcMem, hdcBB;
			HBITMAP hbmOld, hbmOldBB;
			BLENDFUNCTION func = { AC_SRC_OVER, 0, 0, 0 };

			ps.rcPaint.right -= ps.rcPaint.left;
			ps.rcPaint.bottom -= ps.rcPaint.top;

			if (gep_gun->frame < 400)
			{
				hdcMem = CreateCompatibleDC( hdc );
				hbmOld = (HBITMAP) SelectObject( hdcMem, gep_gun->frames[0] );

				BitBlt( hdc, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcMem,
					ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);

				SelectObject( hdcMem, hbmOld );
				DeleteDC( hdcMem );
			}
			else if (gep_gun->frame < 500)
			{
				hdcBB = CreateCompatibleDC( hdc );
				hbmOldBB = (HBITMAP) SelectObject( hdcBB, gep_gun->backbuffer );

				hdcMem = CreateCompatibleDC( hdc );
				hbmOld = (HBITMAP) SelectObject( hdcMem, gep_gun->frames[0] );

				BitBlt( hdcBB, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcMem,
					ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);

				SelectObject( hdcMem, gep_gun->frames[1] );

				func.SourceConstantAlpha = (gep_gun->frame - 400) * 255 / 100;

				AlphaBlend( hdcBB, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcMem,
					ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, func);

				SelectObject( hdcMem, hbmOld );
				DeleteDC( hdcMem );

				BitBlt( hdc, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcBB,
					ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);

				SelectObject( hdcBB, hbmOldBB );
				DeleteDC( hdcBB );
			}
			else if (gep_gun->frame < 900)
			{
				hdcMem = CreateCompatibleDC( hdc );
				hbmOld = (HBITMAP) SelectObject( hdcMem, gep_gun->frames[1] );

				BitBlt( hdc, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcMem,
					ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);

				SelectObject( hdcMem, hbmOld );
				DeleteDC( hdcMem );
			}
			else if (gep_gun->frame < 1000)
			{
				hdcBB = CreateCompatibleDC( hdc );
				hbmOldBB = (HBITMAP) SelectObject( hdcBB, gep_gun->backbuffer );

				hdcMem = CreateCompatibleDC( hdc );
				hbmOld = (HBITMAP) SelectObject( hdcMem, gep_gun->frames[1] );

				BitBlt( hdcBB, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcMem,
					ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);

				SelectObject( hdcMem, gep_gun->frames[0] );

				func.SourceConstantAlpha = (gep_gun->frame - 900) * 255 / 100;

				AlphaBlend( hdcBB, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcMem,
					ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, func);

				SelectObject( hdcMem, hbmOld );
				DeleteDC( hdcMem );

				BitBlt( hdc, ps.rcPaint.left, ps.rcPaint.top,
					ps.rcPaint.right, ps.rcPaint.bottom, hdcBB,
					ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);

				SelectObject( hdcBB, hbmOldBB );
				DeleteDC( hdcBB );
			}

			EndPaint( wnd, &ps );
		}
		break;

	/*case WM_LBUTTONDOWN:
		PlaySound(LPCSTR(IDR_COUGH), core_api::get_my_instance(), SND_RESOURCE | SND_ASYNC);
		break;*/

	case WM_DESTROY:
		KillTimer( wnd, 666 );
		SetWindowLong( wnd, GWL_USERDATA, 0 );
		IPicture_Release(gep_gun->logos[0]);
		IPicture_Release(gep_gun->logos[1]);
		DeleteObject(gep_gun->backbuffer);
		GlobalUnlock(hglob);
		GlobalFree(hglob);
		return 0;
	}

	GlobalUnlock(hglob);

	return uDefWindowProc(wnd, msg, wp, lp);
}
Beispiel #13
0
BOOL CALLBACK infoDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
	char Buffer[1024];
	char *LFpsftag;
	//char LFpsftag[50001];
	DWORD c,d;
	IPicture * pPicture;
	HANDLE surpriseImage;
	int randNum;


	switch (uMsg) {	
	case WM_CLOSE:
		if(decode_pos_ms  >= TrackLength-FadeLength)
				TrackLength=decode_pos_ms+FadeLength;
		EndDialog(hDlg,TRUE);
		return 0;
	case WM_INITDIALOG:
		pimpbot = FALSE;
		randNum = rand();
	    SetWindowLong(hDlg, DWL_USER, (LONG)0);
		if (PepperisaGoodBoy)
		{
			pPicture = NULL;
			if (randNum < RAND_MAX*0.025)	//  1/10th a chance of occurring
			{
				pPicture = LoadPic(MAKEINTRESOURCE(IDB_BIGKITTY), "JPG", mod.hDllInstance);
			}
			else if (randNum >= RAND_MAX*0.025 && randNum < RAND_MAX*0.05)
			{
				pPicture = LoadPic(MAKEINTRESOURCE(IDB_PIMPBOT), "JPG", mod.hDllInstance);
				pimpbot = TRUE;
			}
			else if (randNum >= RAND_MAX*0.05 && randNum < RAND_MAX*0.1)
			{
				pPicture = LoadPic(MAKEINTRESOURCE(IDB_PEPPER), "JPG", mod.hDllInstance);
			}
			if (pPicture)
			{
				if (IPicture_getHandle(pPicture, (OLE_HANDLE *)&surpriseImage) == S_OK)
				{
					SendMessage( GetDlgItem(hDlg, IDC_LOGO), STM_SETIMAGE, IMAGE_BITMAP, (long)surpriseImage); //change the logo graphic
					SetWindowLong(hDlg, DWL_USER, (LONG)pPicture);
				}
				else
				{
					IPicture_Release(pPicture);
				}
			}
		}

		if(infoDlgDisableTimer)
		{
			CheckDlgButton(hDlg,IDC_DTIMER,BST_CHECKED);
			playforever=1;
		}
		SetinfoDlgText(hDlg);

		
		break;

	case WM_LBUTTONDOWN:
		if (pimpbot)
		{
			if (rand() > RAND_MAX/2) PlaySound((LPCSTR)IDR_PIMPBOT1, mod.hDllInstance, SND_RESOURCE|SND_ASYNC);
			else PlaySound((LPCSTR)IDR_PIMPBOT2, mod.hDllInstance, SND_RESOURCE|SND_ASYNC);
		}
		break;
		
	case WM_COMMAND:
		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
		case IDOK:
			GetDlgItemText(hDlg,IDC_TITLE,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"title",Buffer);
			
			GetDlgItemText(hDlg,IDC_ARTIST,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"artist",Buffer);
				
			GetDlgItemText(hDlg,IDC_GAME,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"game",Buffer);

			GetDlgItemText(hDlg,IDC_YEAR,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"year",Buffer);
			
			GetDlgItemText(hDlg,IDC_COPYRIGHT,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"copyright",Buffer);

			GetDlgItemText(hDlg,IDC_GSFBY,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"gsfby",Buffer);

			GetDlgItemText(hDlg,IDC_TAGBY,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"tagger",Buffer);

			GetDlgItemText(hDlg,IDC_VOLUME,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"volume",Buffer);

			if(IsCurrentFile&&!SongChanged)
			{
				relvolume=VolumeFromString(Buffer);
				if(relvolume==0)
					relvolume=defvolume;
			}

			GetDlgItemText(hDlg,IDC_LENGTH,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"length",Buffer);

			if(IsCurrentFile&&!SongChanged)
				TrackLength=LengthFromString(Buffer);
			
			GetDlgItemText(hDlg,IDC_FADE,Buffer,1024);
			psftag_raw_setvar(infoDlgpsftag,50000-1,"fade",Buffer);
			if(IsCurrentFile&&!SongChanged)
			{
				FadeLength=LengthFromString(Buffer);
				TrackLength+=FadeLength;
			

				if(TrackLength == 0)
				{
					TrackLength = (deflen + deffade)*1000;
					FadeLength = deffade*1000;
				}
				track_length=TrackLength;
			}



			//mod.GetLength;

			GetDlgItemText(hDlg,IDC_COMMENT,Buffer,1024);

			// remove 0x0d (in PSF a newline is 0x0a)
			for (c=0,d=0; c < strlen(Buffer); c++) {
				if (Buffer[c] != 0x0d) {
					Buffer[d]=Buffer[c];
					d++;
				}
			}
			Buffer[d]='\0';

			psftag_raw_setvar(infoDlgpsftag,50000,"comment",Buffer);

			infoDlgWriteNewTags=1;

		case IDCANCEL:
			if(decode_pos_ms  >= TrackLength-FadeLength)
				TrackLength=decode_pos_ms+FadeLength;
			EndDialog(hDlg, TRUE);
			break;
		case IDC_NOWBUT:
			if(decode_pos_ms != 0)
			{
				sprintf(Buffer,"%i:%02i.%i",getoutputtime()/60000,(getoutputtime()%60000)/1000,getoutputtime()%1000);
				SetDlgItemText(hDlg,IDC_LENGTH,Buffer);
			}
			break;
		case IDC_DTIMER:
			infoDlgDisableTimer=(IsDlgButtonChecked(hDlg, IDC_DTIMER) == BST_CHECKED) ? TRUE : FALSE;
			playforever=infoDlgDisableTimer;
			if(decode_pos_ms  >= TrackLength-FadeLength)
				TrackLength=decode_pos_ms+FadeLength;
			break;

		//case IDC_SECRETBUTTON:
		//	PlaySound((LPCSTR)IDR_WAVE1, mod.hDllInstance, SND_RESOURCE|SND_ASYNC);
		//	surpriseImage = LoadImage(mod.hDllInstance, MAKEINTRESOURCE(IDB_BIGKITTY), IMAGE_BITMAP, 0, 0, 0);		//change the logo graphic
			//SendMessage( GetDlgItem(hDlg, IDC_SECRETBUTTON), STM_SETIMAGE, IMAGE_BITMAP, (long)surpriseImage); //''
		//	SendMessage(GetDlgItem(hDlg,IDC_SECRETBUTTON),BM_SETIMAGE,IMAGE_BITMAP, (long)surpriseImage);
		//	break;
		case IDC_LAUNCHCONFIG:
			DialogBox(mod.hDllInstance, (const char *)IDD_CONFIG, hDlg, configDlgProc);
			break;
		case IDC_VIEWRAW:
			DialogBox(mod.hDllInstance, (const char *)IDD_RAWTAG, hDlg, rawDlgProc);
			SetinfoDlgText(hDlg);
		}
		break;
	case WM_DESTROY:
		pPicture = (IPicture *) GetWindowLong(hDlg, DWL_USER);
		if (pPicture) IPicture_Release(pPicture);
		break;
	default:
		return 0;
	}

	return 1;
}
Beispiel #14
0
static void test_Render(void)
{
    IPicture *pic;
    HRESULT hres;
    short type;
    PICTDESC desc;
    HDC hdc = GetDC(0);

    /* test IPicture::Render return code on uninitialized picture */
    OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (VOID**)&pic);
    hres = IPicture_get_Type(pic, &type);
    ok(hres == S_OK, "IPicture_get_Type does not return S_OK, but 0x%08x\n", hres);
    ok(type == PICTYPE_UNINITIALIZED, "Expected type = PICTYPE_UNINITIALIZED, got = %d\n", type);
    /* zero dimensions */
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    /* nonzero dimensions, PICTYPE_UNINITIALIZED */
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 10, NULL);
    ole_expect(hres, S_OK);
    IPicture_Release(pic);

    desc.cbSizeofstruct = sizeof(PICTDESC);
    desc.picType = PICTYPE_ICON;
    desc.u.icon.hicon = LoadIcon(NULL, IDI_APPLICATION);
    if(!desc.u.icon.hicon){
        win_skip("LoadIcon failed. Skipping...\n");
        ReleaseDC(NULL, hdc);
        return;
    }

    OleCreatePictureIndirect(&desc, &IID_IPicture, TRUE, (VOID**)&pic);
    /* zero dimensions, PICTYPE_ICON */
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    IPicture_Release(pic);

    ReleaseDC(NULL, hdc);
}
Beispiel #15
0
static void test_himetric(void)
{
    static const BYTE bmp_bits[1024];
    OLE_XSIZE_HIMETRIC cx;
    OLE_YSIZE_HIMETRIC cy;
    IPicture *pic;
    PICTDESC desc;
    HBITMAP bmp;
    HRESULT hr;
    HICON icon;
    HDC hdc;
    INT d;

    if (!pOleCreatePictureIndirect)
    {
        win_skip("OleCreatePictureIndirect not available\n");
        return;
    }

    desc.cbSizeofstruct = sizeof(desc);
    desc.picType = PICTYPE_BITMAP;
    desc.u.bmp.hpal = NULL;

    hdc = CreateCompatibleDC(0);

    bmp = CreateBitmap(1.9 * GetDeviceCaps(hdc, LOGPIXELSX),
                       1.9 * GetDeviceCaps(hdc, LOGPIXELSY), 1, 1, NULL);

    desc.u.bmp.hbitmap = bmp;

    /* size in himetric units reported rounded up to next integer value */
    hr = pOleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic);
    ok(hr == S_OK, "got 0x%08x\n", hr);

    cx = 0;
    d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSX)), 2540, GetDeviceCaps(hdc, LOGPIXELSX));
    hr = IPicture_get_Width(pic, &cx);
    ok(hr == S_OK, "got 0x%08x\n", hr);
    ok(cx == d, "got %d, expected %d\n", cx, d);

    cy = 0;
    d = MulDiv((INT)(1.9 * GetDeviceCaps(hdc, LOGPIXELSY)), 2540, GetDeviceCaps(hdc, LOGPIXELSY));
    hr = IPicture_get_Height(pic, &cy);
    ok(hr == S_OK, "got 0x%08x\n", hr);
    ok(cy == d, "got %d, expected %d\n", cy, d);

    DeleteObject(bmp);
    IPicture_Release(pic);

    /* same thing with icon */
    icon = CreateIcon(NULL, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON),
                      1, 1, bmp_bits, bmp_bits);
    ok(icon != NULL, "failed to create icon\n");

    desc.picType = PICTYPE_ICON;
    desc.u.icon.hicon = icon;

    hr = pOleCreatePictureIndirect(&desc, &IID_IPicture, FALSE, (void**)&pic);
    ok(hr == S_OK, "got 0x%08x\n", hr);

    cx = 0;
    d = MulDiv(GetSystemMetrics(SM_CXICON), 2540, GetDeviceCaps(hdc, LOGPIXELSX));
    hr = IPicture_get_Width(pic, &cx);
    ok(hr == S_OK, "got 0x%08x\n", hr);
    ok(cx == d, "got %d, expected %d\n", cx, d);

    cy = 0;
    d = MulDiv(GetSystemMetrics(SM_CYICON), 2540, GetDeviceCaps(hdc, LOGPIXELSY));
    hr = IPicture_get_Height(pic, &cy);
    ok(hr == S_OK, "got 0x%08x\n", hr);
    ok(cy == d, "got %d, expected %d\n", cy, d);

    IPicture_Release(pic);
    DestroyIcon(icon);

    DeleteDC(hdc);
}
Beispiel #16
0
static void test_OleLoadPicturePath(void)
{
    static WCHAR emptyW[] = {0};

    IPicture *pic;
    HRESULT hres;
    int i;
    char temp_path[MAX_PATH];
    char temp_file[MAX_PATH];
    WCHAR temp_fileW[MAX_PATH + 5] = {'f','i','l','e',':','/','/','/'};
    HANDLE file;
    DWORD size;
    WCHAR *ptr;

    const struct
    {
        LPOLESTR szURLorPath;
        REFIID riid;
        IPicture **pic;
    } invalid_parameters[] =
    {
        {NULL,  NULL,          NULL},
        {NULL,  NULL,          &pic},
        {NULL,  &IID_IPicture, NULL},
        {NULL,  &IID_IPicture, &pic},
        {emptyW, NULL,          NULL},
        {emptyW, &IID_IPicture, NULL},
    };

    for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
    {
        pic = (IPicture *)0xdeadbeef;
        hres = OleLoadPicturePath(invalid_parameters[i].szURLorPath, NULL, 0, 0,
                                  invalid_parameters[i].riid,
                                  (void **)invalid_parameters[i].pic);
        ok(hres == E_INVALIDARG,
           "[%d] Expected OleLoadPicturePath to return E_INVALIDARG, got 0x%08x\n", i, hres);
        ok(pic == (IPicture *)0xdeadbeef,
           "[%d] Expected output pointer to be 0xdeadbeef, got %p\n", i, pic);
    }

    pic = (IPicture *)0xdeadbeef;
    hres = OleLoadPicturePath(emptyW, NULL, 0, 0, NULL, (void **)&pic);
    todo_wine
    ok(hres == INET_E_UNKNOWN_PROTOCOL || /* XP/Vista+ */
       broken(hres == E_UNEXPECTED) || /* NT4 */
       broken(hres == E_OUTOFMEMORY), /* Win2k/Win2k3 */
       "Expected OleLoadPicturePath to return INET_E_UNKNOWN_PROTOCOL, got 0x%08x\n", hres);
    ok(pic == NULL,
       "Expected the output interface pointer to be NULL, got %p\n", pic);

    pic = (IPicture *)0xdeadbeef;
    hres = OleLoadPicturePath(emptyW, NULL, 0, 0, &IID_IPicture, (void **)&pic);
    todo_wine
    ok(hres == INET_E_UNKNOWN_PROTOCOL || /* XP/Vista+ */
       broken(hres == E_UNEXPECTED) || /* NT4 */
       broken(hres == E_OUTOFMEMORY), /* Win2k/Win2k3 */
       "Expected OleLoadPicturePath to return INET_E_UNKNOWN_PROTOCOL, got 0x%08x\n", hres);
    ok(pic == NULL,
       "Expected the output interface pointer to be NULL, got %p\n", pic);

    /* Create a local temporary image file for testing. */
    GetTempPathA(sizeof(temp_path), temp_path);
    GetTempFileNameA(temp_path, "bmp", 0, temp_file);
    file = CreateFileA(temp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                       FILE_ATTRIBUTE_NORMAL, NULL);
    WriteFile(file, bmpimage, sizeof(bmpimage), &size, NULL);
    CloseHandle(file);

    MultiByteToWideChar(CP_ACP, 0, temp_file, -1, temp_fileW + 8, sizeof(temp_fileW)/sizeof(WCHAR) - 8);

    /* Try a normal DOS path. */
    hres = OleLoadPicturePath(temp_fileW + 8, NULL, 0, 0, &IID_IPicture, (void **)&pic);
    ok(hres == S_OK ||
       broken(hres == E_UNEXPECTED), /* NT4 */
       "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres);
    if (pic)
        IPicture_Release(pic);

    /* Try a DOS path with tacked on "file:". */
    hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic);
    ok(hres == S_OK ||
       broken(hres == E_UNEXPECTED), /* NT4 */
       "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres);
    if (pic)
        IPicture_Release(pic);

    DeleteFileA(temp_file);

    /* Try with a nonexistent file. */
    hres = OleLoadPicturePath(temp_fileW + 8, NULL, 0, 0, &IID_IPicture, (void **)&pic);
    ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */
       broken(hres == E_UNEXPECTED) || /* NT4 */
       broken(hres == E_FAIL), /*Win2k */
       "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres);

    hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic);
    ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */
       broken(hres == E_UNEXPECTED) || /* NT4 */
       broken(hres == E_FAIL), /* Win2k */
       "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres);

    file = CreateFileA(temp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                       FILE_ATTRIBUTE_NORMAL, NULL);
    WriteFile(file, bmpimage, sizeof(bmpimage), &size, NULL);
    CloseHandle(file);

    /* Try a "file:" URL with slash separators. */
    ptr = temp_fileW + 8;
    while (*ptr)
    {
        if (*ptr == '\\')
            *ptr = '/';
        ptr++;
    }

    hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic);
    ok(hres == S_OK ||
       broken(hres == E_UNEXPECTED), /* NT4 */
       "Expected OleLoadPicturePath to return S_OK, got 0x%08x\n", hres);
    if (pic)
        IPicture_Release(pic);

    DeleteFileA(temp_file);

    /* Try with a nonexistent file. */
    hres = OleLoadPicturePath(temp_fileW, NULL, 0, 0, &IID_IPicture, (void **)&pic);
    ok(hres == INET_E_RESOURCE_NOT_FOUND || /* XP+ */
       broken(hres == E_UNEXPECTED) || /* NT4 */
       broken(hres == E_FAIL), /* Win2k */
       "Expected OleLoadPicturePath to return INET_E_RESOURCE_NOT_FOUND, got 0x%08x\n", hres);
}
Beispiel #17
0
static void test_Render(void)
{
    IPicture *pic;
    HRESULT hres;
    short type;
    PICTDESC desc;
    OLE_XSIZE_HIMETRIC pWidth;
    OLE_YSIZE_HIMETRIC pHeight;
    COLORREF result, expected;
    HDC hdc = GetDC(0);

    /* test IPicture::Render return code on uninitialized picture */
    OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (VOID**)&pic);
    hres = IPicture_get_Type(pic, &type);
    ok(hres == S_OK, "IPicture_get_Type does not return S_OK, but 0x%08x\n", hres);
    ok(type == PICTYPE_UNINITIALIZED, "Expected type = PICTYPE_UNINITIALIZED, got = %d\n", type);
    /* zero dimensions */
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    /* nonzero dimensions, PICTYPE_UNINITIALIZED */
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 10, NULL);
    ole_expect(hres, S_OK);
    IPicture_Release(pic);

    desc.cbSizeofstruct = sizeof(PICTDESC);
    desc.picType = PICTYPE_ICON;
    desc.u.icon.hicon = LoadIcon(NULL, IDI_APPLICATION);
    if(!desc.u.icon.hicon){
        win_skip("LoadIcon failed. Skipping...\n");
        ReleaseDC(NULL, hdc);
        return;
    }

    OleCreatePictureIndirect(&desc, &IID_IPicture, TRUE, (VOID**)&pic);
    /* zero dimensions, PICTYPE_ICON */
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);
    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL);
    ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE);

    /* Check if target size and position is respected */
    IPicture_get_Width(pic, &pWidth);
    IPicture_get_Height(pic, &pHeight);

    SetPixelV(hdc, 0, 0, 0x00F0F0F0);
    SetPixelV(hdc, 5, 5, 0x00F0F0F0);
    SetPixelV(hdc, 10, 10, 0x00F0F0F0);
    expected = GetPixel(hdc, 0, 0);

    hres = IPicture_Render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL);
    ole_expect(hres, S_OK);

    if(hres != S_OK) {
        IPicture_Release(pic);
        ReleaseDC(NULL, hdc);
        return;
    }

    /* Evaluate the rendered Icon */
    result = GetPixel(hdc, 0, 0);
    ok(result == expected,
       "Color at 0,0 should be unchanged 0x%06X, but was 0x%06X\n", expected, result);
    result = GetPixel(hdc, 5, 5);
    ok(result != expected ||
        broken(result == expected), /* WinNT 4.0 and older may claim they drew */
                                    /* the icon, even if they didn't. */
       "Color at 5,5 should have changed, but still was 0x%06X\n", expected);
    result = GetPixel(hdc, 10, 10);
    ok(result == expected,
       "Color at 10,10 should be unchanged 0x%06X, but was 0x%06X\n", expected, result);

    IPicture_Release(pic);
    ReleaseDC(NULL, hdc);
}