ReactOS 0.4.15-dev-7131-ge4d03f4
LoadImage.c
Go to the documentation of this file.
1
2#include "precomp.h"
3
5{
6 char path[MAX_PATH];
10
11 char **test_argv;
13
14 /* Now check its behaviour regarding Shared icons/cursors */
16 ok(handle != 0, "\n");
17
18 if (argc >= 3)
19 {
20 HANDLE arg;
21 HICON hCopy;
23 HDC hdc, hdcScreen;
24 ICONINFO ii;
25
26 sscanf (test_argv[2], "%Iu", (ULONG_PTR*) &arg);
27
28 ok(handle != arg, "Got same handles\n");
29
30 /* Try copying it */
31 hCopy = CopyIcon(arg);
32 ok(hCopy != NULL, "\n");
33 ok(DestroyIcon(hCopy), "\n");
34
35 hCopy = CopyImage(arg, IMAGE_CURSOR, 0, 0, 0);
36 ok(hCopy != NULL, "\n");
37 ok(DestroyIcon(hCopy), "\n");
38 /* Unlike the original, this one is not shared */
39 ok(!DestroyIcon(hCopy), "\n");
40
42 ok(hCopy != NULL, "\n");
43 ok(DestroyIcon(hCopy), "\n");
44 /* Unlike the original, this one is not shared */
45 ok(!DestroyIcon(hCopy), "\n");
46
48 ok(hCopy != NULL, "\n");
49 ok(DestroyIcon(hCopy), "\n");
50 /* This one is shared */
51 ok(DestroyIcon(hCopy), "\n");
52
53 hCopy = CopyImage(arg, IMAGE_CURSOR, 0, 0, LR_SHARED);
54 ok(hCopy != NULL, "\n");
55 ok(DestroyIcon(hCopy), "DestroyIcon should succeed.\n");
56 /* This one is shared */
57 ok(DestroyIcon(hCopy) == 0, "DestroyIcon should fail.\n");
58
59 /* Try various usual functions */
60 hdcScreen = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
61 ok(hdcScreen != NULL, "\n");
62 hdc = CreateCompatibleDC(hdcScreen);
63 ok(hdc != NULL, "\n");
64 hbmp = CreateCompatibleBitmap(hdcScreen, 64, 64);
65 ok(hbmp != NULL, "\n");
67 ok(hbmp != NULL, "\n");
68
69 ok(DrawIcon(hdc, 0, 0, arg), "\n");
73 DeleteDC(hdcScreen);
74
75 ok(GetIconInfo(arg, &ii), "\n");
76 ok(ii.hbmMask != NULL, "\n");
79
80 return;
81 }
82
83 /* Start child process */
84 sprintf( path, "%s LoadImage %Iu", test_argv[0], (ULONG_PTR)handle );
85 memset( &si, 0, sizeof(si) );
86 si.cb = sizeof(si);
87 CreateProcessA( NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi );
89}
static int argc
Definition: ServiceArgs.c:12
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
HBITMAP hbmp
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4741
#define INFINITE
Definition: serial.h:102
pKey DeleteObject()
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define sprintf(buf, format,...)
Definition: sprintf.c:55
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static HICON
Definition: imagelist.c:84
static refpint_t pi[]
Definition: server.c:96
static char ** test_argv
Definition: cursoricon.c:296
#define L(x)
Definition: ntvdm.h:50
int winetest_get_mainargs(char ***pargv)
#define memset(x, y, z)
Definition: compat.h:39
HBITMAP hbmColor
Definition: winuser.h:3126
HBITMAP hbmMask
Definition: winuser.h:3125
DWORD cb
Definition: winbase.h:831
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define GetModuleHandle
Definition: winbase.h:3762
void * arg
Definition: msvc.h:10
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1098
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:1987
HICON WINAPI CopyIcon(_In_ HICON)
Definition: cursoricon.c:1980
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2172
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
#define LR_SHARED
Definition: winuser.h:1099
#define LoadImage
Definition: winuser.h:5814
#define IMAGE_CURSOR
Definition: winuser.h:213
#define LR_DEFAULTSIZE
Definition: winuser.h:1093
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022