2008/11/5 Vincent Povirk vincent@codeweavers.com:
- CoInitialize(NULL);
- if (!SUCCEEDED(CoCreateInstance( &CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, &IID_IShellLinkW, (LPVOID*)&shelllink)))
goto done;
- IShellLinkW_SetPath( shelllink, cmdline );
- SHPathPrepareForWriteW( NULL, NULL, lnkpath, SHPPFW_DIRCREATE|SHPPFW_IGNOREFILENAME );
- if (SUCCEEDED(IShellLinkW_QueryInterface( shelllink, &IID_IPersistFile, (LPVOID*)&persistfile)))
- {
TRACE( "writing link: %s\n", debugstr_w(lnkpath) );
IPersistFile_Save( persistfile, lnkpath, FALSE );
IPersistFile_Release( persistfile );
- }
- IShellLinkW_Release( shelllink );
+done:
- HeapFree( GetProcessHeap(), 0, cmdline ); return TRUE;
You've forgotten to call CoUninitialize().