ReactOS  0.4.15-dev-1374-g8d3e80e
LoadImage.c File Reference
#include "precomp.h"
Include dependency graph for LoadImage.c:

Go to the source code of this file.

Functions

 START_TEST (LoadImage)
 

Function Documentation

◆ START_TEST()

START_TEST ( LoadImage  )

Definition at line 4 of file LoadImage.c.

5 {
6  char path[MAX_PATH];
8  STARTUPINFO si;
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;
22  HBITMAP hbmp;
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");
72  DeleteDC(hdc);
73  DeleteDC(hdcScreen);
74 
75  ok(GetIconInfo(arg, &ii), "\n");
76  ok(ii.hbmMask != NULL, "\n");
78  if(ii.hbmColor) DeleteObject(ii.hbmColor);
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 );
88  WaitForSingleObject (pi.hProcess, INFINITE);
89 }
static int argc
Definition: ServiceArgs.c:12
static HICON
Definition: imagelist.c:84
#define LR_SHARED
Definition: winuser.h:1090
static char ** test_argv
Definition: cursoricon.c:296
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
#define IMAGE_CURSOR
Definition: winuser.h:213
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1499
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
void * arg
Definition: msvc.h:10
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2014
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define sprintf(buf, format,...)
Definition: sprintf.c:55
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
HBITMAP hbmMask
Definition: winuser.h:3101
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:1956
HBITMAP hbmColor
Definition: winuser.h:3102
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
HBITMAP hbmp
DWORD cb
Definition: winbase.h:809
#define LR_DEFAULTSIZE
Definition: winuser.h:1084
static refpint_t pi[]
Definition: server.c:96
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:4744
#define MAX_PATH
Definition: compat.h:34
int winetest_get_mainargs(char ***pargv)
static const WCHAR L[]
Definition: oid.c:1250
HDC hdc
Definition: main.c:9
HICON WINAPI CopyIcon(_In_ HICON)
Definition: cursoricon.c:1980
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1089
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:1987
#define GetModuleHandle
Definition: winbase.h:3667
BOOL WINAPI DeleteDC(_In_ HDC)
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
static HBITMAP
Definition: button.c:44
#define INFINITE
Definition: serial.h:102
#define memset(x, y, z)
Definition: compat.h:39