shdocvw(2/2): rudimentary implementation of CLSID_InternetShortcut (try 3)

Jacek Caban jacek at codeweavers.com
Thu Jul 31 16:07:56 CDT 2008


Hi Damjan,

Damjan Jovanovic wrote:
> Changelog:
> * Added a rudimentary implementation of CLSID_InternetShorcut, with
> tests (#3546).
>
> Damjan Jovanovic
>   

+
+static HRESULT strdupAtoW(LPCSTR in, LPWSTR *out)
+{
+    INT len;
+    if (in == NULL)
+    {
+        *out = NULL;
+        return S_OK;
+    }
+    len = MultiByteToWideChar(CP_ACP, 0, in, -1, NULL, 0);
+    *out = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
+    if (!*out)
+        return E_OUTOFMEMORY;
+    MultiByteToWideChar(CP_ACP, 0, in, -1, *out, len);
+    return S_OK;
+}
+
+static HRESULT strdupWtoA(LPCWSTR in, LPSTR *out)
+{
+    INT len;
+    if (in == NULL)
+    {
+        *out = NULL;
+        return S_OK;
+    }
+    len = WideCharToMultiByte(CP_ACP, 0, in, -1, NULL, 0, 0, 0);
+    *out = HeapAlloc(GetProcessHeap(), 0, len);
+    if (!*out)
+        return E_OUTOFMEMORY;
+    WideCharToMultiByte(CP_ACP, 0, in, -1, *out, len, 0, 0);
+    return S_OK;
+}


These function should go to shdocvw.h and be named heap_strdup*. You may copy them from dlls/mshtml/mshtml_private.h.

+    else if (IsEqualGUID(&IID_IShellLinkA, riid))
+    {
+        FIXME("The IShellLinkA interface is not yet supported by InternetShortcut\n");
+        return E_NOTIMPL;

E_NOINTERFACE is better choice.

+    }
+    else if (IsEqualGUID(&IID_IShellLinkW, riid))
+    {
+        FIXME("The IShellLinkW interface is not yet supported by InternetShortcut\n");
+        return E_NOTIMPL;

Same here.

+    }
+    else
+    {
+        FIXME("Interface with GUID %s not yet implemented by InternetShortcut\n", debugstr_guid(riid));
+        return E_NOINTERFACE;
+    }

You should set ppvObject to NULL here.

Also, the order of function is strange. The convention is to order function as they are ordered in the interface declaration and not mix interfaces.

Also there are heap_alloc, heap_alloc_zero and heap_free functions in shdocvw.h that you should use instead of HeapAlloc/HeapFree.



Jacek





More information about the wine-devel mailing list