ReactOS 0.4.16-dev-1210-gbc03c01
rosordinal.c File Reference
#include "precomp.h"
Include dependency graph for rosordinal.c:

Go to the source code of this file.

Functions

HRESULT WINAPI SHForwardContextMenuMsg (IUnknown *pUnk, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *pResult, BOOL useIContextMenu2)
 
BOOL WINAPI SHAreIconsEqual (HICON hIcon1, HICON hIcon2)
 

Function Documentation

◆ SHAreIconsEqual()

BOOL WINAPI SHAreIconsEqual ( HICON  hIcon1,
HICON  hIcon2 
)

Definition at line 48 of file rosordinal.c.

49{
50 ICONINFO iconInfo1, iconInfo2;
51 BITMAP bm1, bm2;
52 BOOL bSame = FALSE;
53
54 if (!hIcon1 || !hIcon2)
55 return FALSE;
56
57 if (!GetIconInfo(hIcon1, &iconInfo1))
58 return FALSE;
59
60 if (!GetIconInfo(hIcon2, &iconInfo2))
61 {
62 DeleteObject(iconInfo1.hbmColor);
63 DeleteObject(iconInfo1.hbmMask);
64 return FALSE;
65 }
66
67 GetObjectW(iconInfo1.hbmColor, sizeof(bm1), &bm1);
68 GetObjectW(iconInfo2.hbmColor, sizeof(bm2), &bm2);
69
70 if (bm1.bmWidth == bm2.bmWidth && bm1.bmHeight == bm2.bmHeight)
71 {
72 BITMAPINFO bmi = { { sizeof(bmi), bm1.bmWidth, bm1.bmHeight, 1, 32 } };
73 HDC hdc = GetDC(0);
74 SIZE_T size = bm1.bmWidth * bm1.bmHeight * 4;
75 BYTE *data1, *data2;
76
79
80 if (data1 && data2)
81 {
82 if (GetDIBits(hdc, iconInfo1.hbmColor, 0, bm1.bmHeight, data1, &bmi, DIB_RGB_COLORS) &&
83 GetDIBits(hdc, iconInfo2.hbmColor, 0, bm2.bmHeight, data2, &bmi, DIB_RGB_COLORS))
84 {
85 bSame = memcmp(data1, data2, size) == 0;
86 }
87 }
90
92 }
93
94 DeleteObject(iconInfo1.hbmColor);
95 DeleteObject(iconInfo1.hbmMask);
96
97 DeleteObject(iconInfo2.hbmColor);
98 DeleteObject(iconInfo2.hbmMask);
99
100 return bSame;
101}
static HICON hIcon2
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
GLsizeiptr size
Definition: glext.h:5919
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
Definition: bl.h:1331
HBITMAP hbmColor
Definition: winuser.h:3203
HBITMAP hbmMask
Definition: winuser.h:3202
Definition: tftpd.h:126
Definition: tftpd.h:138
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2382
HDC WINAPI GetDC(_In_opt_ HWND)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ SHForwardContextMenuMsg()

HRESULT WINAPI SHForwardContextMenuMsg ( IUnknown pUnk,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT pResult,
BOOL  useIContextMenu2 
)

Definition at line 11 of file rosordinal.c.

13{
14 HRESULT hr;
15 IContextMenu3* pcmenu3;
16 IContextMenu2* pcmenu2;
17
18 if (!pUnk)
19 return E_FAIL;
20
21 /* First try to use the IContextMenu3 interface */
22 hr = IUnknown_QueryInterface(pUnk, &IID_IContextMenu3, (void**)&pcmenu3);
23 if (SUCCEEDED(hr))
24 {
25 hr = IContextMenu3_HandleMenuMsg2(pcmenu3, uMsg, wParam, lParam, pResult);
26 IContextMenu3_Release(pcmenu3);
27 return hr;
28 }
29
30 /* Return failure if we can't use the IContextMenu2 interface */
31 if(!useIContextMenu2)
32 return hr;
33
34 /* Now try to use the IContextMenu2 interface */
35 hr = IUnknown_QueryInterface(pUnk, &IID_IContextMenu2, (void**)&pcmenu2);
36 if (FAILED(hr))
37 return hr;
38
39 hr = IContextMenu2_HandleMenuMsg(pcmenu2, uMsg, wParam, lParam);
40 IContextMenu2_Release(pcmenu2);
41 if (pResult)
42 *pResult = 0;
43 return hr == S_OK ? S_FALSE : hr;
44}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_FAIL
Definition: ddrawi.h:102
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define S_FALSE
Definition: winerror.h:2357

Referenced by BrFolderDlgProc(), DumpMenu(), CDefaultContextMenu::HandleMenuMsg2(), MenuMessageForwarderWndProc(), CDefView::OnMenuMessage(), and ShellContextMenuWindowProc().