1 
2 #include "precomp.h"
3 
4 START_TEST(DestroyCursorIcon)
5 {
6     HICON hicon;
7     HCURSOR hcursor;
8     ICONINFO iconinfo;
9 
10     ZeroMemory(&iconinfo, sizeof(iconinfo));
11 
12     iconinfo.hbmMask = CreateBitmap(8, 16, 1, 1, NULL);
13     ok(iconinfo.hbmMask != NULL, "\n");
14 
15     /*
16      * Test if DestroyCursor can destroy an icon, and vice-versa .
17      * It can.
18      */
19     iconinfo.fIcon = TRUE;
20     hicon = CreateIconIndirect(&iconinfo);
21     ok(hicon != 0, "should not fail\n");
22     ok(DestroyCursor(hicon), "\n");
23     ok(!DestroyIcon(hicon), "\n");
24 
25     iconinfo.fIcon = FALSE;
26     hcursor = CreateIconIndirect(&iconinfo);
27     ok(hcursor != 0, "should not fail\n");
28     ok(DestroyIcon(hcursor), "\n");
29     ok(!DestroyCursor(hcursor), "\n");
30 
31     /* Clean up */
32     DeleteObject(iconinfo.hbmMask);
33 
34     /* Now check its behaviour regarding Shared icons/cursors */
35     hcursor = LoadCursor(GetModuleHandle(NULL), "TESTCURSOR");
36     ok(hcursor != 0, "\n");
37 
38     /* MSDN says we shouldn't do that, but it still succeeds */
39     ok(DestroyCursor(hcursor), "\n");
40 
41     /* In fact, it's still there */
42     ZeroMemory(&iconinfo, sizeof(iconinfo));
43     ok(GetIconInfo(hcursor, &iconinfo), "\n");
44     ok(iconinfo.hbmMask != NULL, "\n");
45     ok(iconinfo.hbmColor != NULL, "\n");
46     ok(!iconinfo.fIcon, "\n");
47 
48     /* clean up */
49     DeleteObject(iconinfo.hbmMask);
50     DeleteObject(iconinfo.hbmColor);
51 }
52