FW: shell32.SHDefExtractIcon implementation take

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Fri Dec 6 14:52:40 CST 2002


>>>>> "Rolf" == Rolf Kalbermatter <rolf.kalbermatter at citeng.com> writes:
+/****************************************************************************
+ * SHDefExtractIconW           [SHELL32.@]
+ */
+HRESULT SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags,
+                          HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize)
+{
+       UINT ret;
+       HICON hIcons[2];
              ^^^^^^^^

+       WARN("%s %d 0x%08x %p %p %d, semi-stub\n", debugstr_w(pszIconFile),\
iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
+
+       ret = PrivateExtractIconsW(pszIconFile, iIndex, nIconSize,
nIconSize, h\
Icons, NULL, 2, LR_DEFAULTCOLOR);
+       /* FIXME: deal with uFlags parameter which contains GIL_ flags */
+       if (ret == 0xFFFFFFFF)
+         return E_FAIL;
+       if (ret > 0) {
+         *phiconLarge = hIcons[0];
          ^^^^^^^^^^^^
Rolf,

this doesn't look right to me:

You allocate space on the function local stack, then hand out a pointer to
that memory and return from the function. No the function local stack is
undefined and the pointers are dangling. I think the heap should be used for
allocating the needed storage.

Bye

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the wine-devel mailing list