https://git.reactos.org/?p=reactos.git;a=commitdiff;h=173b79095c1f7aaf8e5c0…
commit 173b79095c1f7aaf8e5c0e5d3b57b6d54392c1c0
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Mon Mar 5 22:43:05 2018 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Mon Mar 5 22:43:18 2018 +0100
[SHLWAPI] Implement SHAreIconsEqual
CORE-14425
---
dll/win32/shlwapi/rosordinal.c | 57 ++++++++++++++++++++++++++++++++++++++++++
dll/win32/shlwapi/shlwapi.spec | 2 +-
2 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/dll/win32/shlwapi/rosordinal.c b/dll/win32/shlwapi/rosordinal.c
index 53d2a28a43..d392b64120 100644
--- a/dll/win32/shlwapi/rosordinal.c
+++ b/dll/win32/shlwapi/rosordinal.c
@@ -37,3 +37,60 @@ HRESULT WINAPI SHForwardContextMenuMsg(IUnknown* pUnk, UINT uMsg,
WPARAM wParam,
IContextMenu2_Release(pcmenu2);
return hr;
}
+
+/*
http://undoc.airesoft.co.uk/shlwapi.dll/SHAreIconsEqual.php */
+
+BOOL WINAPI SHAreIconsEqual(HICON hIcon1, HICON hIcon2)
+{
+ ICONINFO iconInfo1, iconInfo2;
+ BITMAP bm1, bm2;
+ BOOL bSame = FALSE;
+
+ if (!hIcon1 || !hIcon2)
+ return FALSE;
+
+ if (!GetIconInfo(hIcon1, &iconInfo1))
+ return FALSE;
+
+ if (!GetIconInfo(hIcon2, &iconInfo2))
+ {
+ DeleteObject(iconInfo1.hbmColor);
+ DeleteObject(iconInfo1.hbmMask);
+ return FALSE;
+ }
+
+ GetObjectW(iconInfo1.hbmColor, sizeof(bm1), &bm1);
+ GetObjectW(iconInfo2.hbmColor, sizeof(bm2), &bm2);
+
+ if (bm1.bmWidth == bm2.bmWidth && bm1.bmHeight == bm2.bmHeight)
+ {
+ BITMAPINFO bmi = { { sizeof(bmi), bm1.bmWidth, bm1.bmHeight, 1, 32 } };
+ HDC hdc = GetDC(0);
+ SIZE_T size = bm1.bmWidth * bm1.bmHeight * 4;
+ BYTE *data1, *data2;
+
+ data1 = HeapAlloc(GetProcessHeap(), 0, size);
+ data2 = HeapAlloc(GetProcessHeap(), 0, size);
+
+ if (data1 && data2)
+ {
+ if (GetDIBits(hdc, iconInfo1.hbmColor, 0, bm1.bmHeight, data1, &bmi,
DIB_RGB_COLORS) &&
+ GetDIBits(hdc, iconInfo2.hbmColor, 0, bm2.bmHeight, data2, &bmi,
DIB_RGB_COLORS))
+ {
+ bSame = memcmp(data1, data2, size) == 0;
+ }
+ }
+ HeapFree(GetProcessHeap(), 0, data1);
+ HeapFree(GetProcessHeap(), 0, data2);
+
+ ReleaseDC(NULL, hdc);
+ }
+
+ DeleteObject(iconInfo1.hbmColor);
+ DeleteObject(iconInfo1.hbmMask);
+
+ DeleteObject(iconInfo2.hbmColor);
+ DeleteObject(iconInfo2.hbmMask);
+
+ return bSame;
+}
diff --git a/dll/win32/shlwapi/shlwapi.spec b/dll/win32/shlwapi/shlwapi.spec
index b70601775d..0f5707c8d4 100644
--- a/dll/win32/shlwapi/shlwapi.spec
+++ b/dll/win32/shlwapi/shlwapi.spec
@@ -545,7 +545,7 @@
545 stdcall -noname SHForwardContextMenuMsg(ptr long long long ptr long)
546 stub -noname IUnknown_DoContextMenuPopup
547 stdcall DelayLoadFailureHook(str str) kernel32.DelayLoadFailureHook
-548 stub -noname SHAreIconsEqual
+548 stdcall -noname SHAreIconsEqual(ptr ptr)
549 stdcall -noname SHCoCreateInstanceAC(ptr ptr long ptr ptr)
550 stub -noname GetTemplateInfoFromHandle
551 stub -noname IShellFolder_CompareIDs