* The installer for the Zuma Deluxe Popcap game is good for testing.
*/
+#include <stdarg.h>
+#include <stdio.h>
+
#include "wine/debug.h"
#include "shdocvw.h"
#include "objidl.h"
#include "intshcut.h"
#include "shellapi.h"
#include "winreg.h"
+#include "shlwapi.h"
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
PersistFile_GetCurFile
};
+static InternetShortcut *create_shortcut(void)
+{
+ InternetShortcut *newshortcut;
+
+ newshortcut = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InternetShortcut));
+ if (newshortcut)
+ {
+ newshortcut->uniformResourceLocatorA.lpVtbl = &uniformResourceLocatorAVtbl;
+ newshortcut->uniformResourceLocatorW.lpVtbl = &uniformResourceLocatorWVtbl;
+ newshortcut->persistFile.lpVtbl = &persistFileVtbl;
+ newshortcut->refCount = 0;
+ }
+
+ return newshortcut;
+}
+
HRESULT InternetShortcut_Create(IUnknown *pOuter, REFIID riid, void **ppv)
{
InternetShortcut *This;
if(pOuter)
return CLASS_E_NOAGGREGATION;
- This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InternetShortcut));
+ This = create_shortcut();
if (This)
{
- This->uniformResourceLocatorA.lpVtbl = &uniformResourceLocatorAVtbl;
- This->uniformResourceLocatorW.lpVtbl = &uniformResourceLocatorWVtbl;
- This->persistFile.lpVtbl = &persistFileVtbl;
- This->refCount = 0;
hr = Unknown_QueryInterface(This, riid, ppv);
if (SUCCEEDED(hr))
SHDOCVW_LockModule();
else
return E_OUTOFMEMORY;
}
+
+
+/**********************************************************************
+ * OpenURL (SHDOCVW.@)
+ */
+void WINAPI OpenURL(HWND hWnd, HINSTANCE hInst, LPCSTR lpcstrUrl, int nShowCmd)
+{
+ InternetShortcut *shortcut;
+ WCHAR* urlfilepath = NULL;
+ shortcut = create_shortcut();
+
+ if (shortcut)
+ {
+ int len;
+
+ len = MultiByteToWideChar(CP_ACP, 0, lpcstrUrl, -1, NULL, 0);
+ urlfilepath = heap_alloc(len * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, lpcstrUrl, -1, urlfilepath, len);
+
+ if(SUCCEEDED(IPersistFile_Load(&shortcut->persistFile, urlfilepath, 0)))
+ {
+ URLINVOKECOMMANDINFOW ici;
+
+ memset( &ici, 0, sizeof ici );
+ ici.dwcbSize = sizeof ici;
+ ici.dwFlags = IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB;
+ ici.hwndParent = hWnd;
+
+ if FAILED(UniformResourceLocatorW_InvokeCommand(&shortcut->uniformResourceLocatorW, (PURLINVOKECOMMANDINFOW) &ici))
+ TRACE("failed to open URL: %s\n.",debugstr_a(lpcstrUrl));
+ }
+
+ heap_free(shortcut);
+ heap_free(urlfilepath);
+ }
+}