[PATCH 1/2] shell32: Add a basic implementation for SHGetStockIconInfo
Detlef Riekenberg
wine.dev at web.de
Wed Jan 30 22:35:57 CST 2013
Needed for ClassicShell
--
By by ... Detlef
---
dlls/shell32/iconcache.c | 75 +++++++++++++++++++++++++++++++++++++++++++++
dlls/shell32/shell32.spec | 1 +
2 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index 637dbca..2d6ec83 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -876,3 +876,78 @@ INT WINAPI SHGetIconOverlayIndexW(LPCWSTR pszIconPath, INT iIconIndex)
return -1;
}
+
+
+/****************************************************************************
+ * helper for SHGetStockIconInfo
+ */
+typedef struct stockiconentry_t {
+ SHSTOCKICONID id;
+ DWORD iconid;
+} stockiconentry;
+
+static stockiconentry stockicontable[] = {
+ {SIID_DOCNOASSOC, IDI_SHELL_DOCUMENT},
+ {SIID_DOCASSOC, IDI_SHELL_DOCUMENT},
+ {SIID_FOLDER, IDI_SHELL_FOLDER},
+ {SIID_DRIVERNET, IDI_SHELL_NETDRIVE},
+ {SIID_DRIVERCD, IDI_SHELL_CDROM},
+ {SIID_DRIVERRAM, IDI_SHELL_RAMDISK},
+ {SIID_DESKTOPPC, IDI_SHELL_MY_COMPUTER},
+ {SIID_PRINTER, IDI_SHELL_PRINTER},
+ {SIID_SETTINGS, IDI_SHELL_CONTROL_PANEL},
+ {SIID_RECYCLERFULL, IDI_SHELL_FULL_RECYCLE_BIN},
+ {SIID_DELETE, IDI_SHELL_CONFIRM_DELETE},
+};
+
+static int cmp_stockiconentry(const void *entry1, const void *entry2)
+{
+ stockiconentry *p1 = (stockiconentry *) entry1;
+ stockiconentry *p2 = (stockiconentry *) entry2;
+
+ return p1->id - p2->id;
+}
+
+/****************************************************************************
+ * SHGetStockIconInfo [SHELL32.@]
+ *
+ * Receive informations for shell icons
+ *
+ * PARAMS
+ * id [I] selected icon-id to get informations
+ * flags [I] select informations to receive
+ * sii [IO] SHSTOCKICONINFO structure to fill
+ *
+ * RETURNS
+ * Success: S_OK
+ * Failure: A HRESULT failure code
+ *
+ */
+HRESULT WINAPI SHGetStockIconInfo(SHSTOCKICONID id, UINT flags, SHSTOCKICONINFO *sii)
+{
+ stockiconentry *entry;
+
+ TRACE("(%d, 0x%x, %p)\n", id, flags, sii);
+ if ((id < 0) | (id >= (SIID_MAX_ICONS - 1)) || !sii || (sii->cbSize != sizeof(SHSTOCKICONINFO)))
+ return E_INVALIDARG;
+
+ /* find the requested icon */
+ entry = bsearch(&id, stockicontable, sizeof(stockicontable)/sizeof(stockicontable[0]),
+ sizeof(stockiconentry), cmp_stockiconentry);
+
+ if (!entry) {
+ FIXME("using fallback for id %d\n", id);
+ entry = stockicontable;
+ }
+
+ if (flags)
+ FIXME("flags 0x%x not implemented\n", flags);
+
+ sii->hIcon = NULL;
+ sii->iSysImageIndex = -1;
+ sii->iIcon = - entry->iconid;
+
+ GetModuleFileNameW(shell32_hInstance, sii->szPath, MAX_PATH);
+
+ return S_OK;
+}
diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec
index 790cc9f..37bb64b 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -388,6 +388,7 @@
@ stdcall SHGetSpecialFolderLocation(long long ptr)
@ stdcall SHGetSpecialFolderPathA(long ptr long long)
@ stdcall SHGetSpecialFolderPathW(long ptr long long)
+@ stdcall SHGetStockIconInfo(long long ptr)
@ stdcall SHHelpShortcuts_RunDLL(long long long long) SHHelpShortcuts_RunDLLA
@ stdcall SHHelpShortcuts_RunDLLA(long long long long)
@ stdcall SHHelpShortcuts_RunDLLW(long long long long)
--
1.7.5.4
More information about the wine-patches
mailing list