#include <initguid.h>
#include <windows.h>
#include <windowsx.h>
+#undef INITGUID
#include <shlobj.h>
#include <shellapi.h>
#include <shobjidl.h>
}
-BOOL Shortcut_Create (LPTSTR pszTarget, LPCTSTR pszSource, LPTSTR pszDesc)
+BOOL Shortcut_Create (LPTSTR pszTarget, LPCTSTR pszSource, LPTSTR pszDesc, LPTSTR pszArgs)
{
IShellLink *psl;
HRESULT rc = CoCreateInstance (CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **)&psl);
rc = psl->SetDescription (pszDesc ? pszDesc : pszSource);
if (SUCCEEDED (rc))
{
+ if ( pszArgs )
+ rc = psl->SetArguments (pszArgs);
+ if (SUCCEEDED (rc))
+ {
#ifdef UNICODE
- rc = ppf->Save (pszTarget, TRUE);
+ rc = ppf->Save (pszTarget, TRUE);
#else
- WORD wsz[ MAX_PATH ];
- MultiByteToWideChar (CP_ACP, 0, pszTarget, -1, wsz, MAX_PATH);
- rc = ppf->Save (wsz, TRUE);
+ WORD wsz[ MAX_PATH ];
+ MultiByteToWideChar (CP_ACP, 0, pszTarget, -1, wsz, MAX_PATH);
+ rc = ppf->Save (wsz, TRUE);
#endif
+ }
}
}
ppf->Release ();
void Shortcut_FixStartup (LPCTSTR pszLinkName, BOOL fAutoStart)
{
- TCHAR szShortcut[ MAX_PATH ] = TEXT("");
+ TCHAR szShortcut[ MAX_PATH + 10 ] = TEXT("");
HKEY hk;
if (RegOpenKey (HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), &hk) == 0)
if (fAutoStart)
{
- Shortcut_Create (szShortcut, szSource);
+ Shortcut_Create (szShortcut, szSource, "Autostart Authentication Agent");
}
else // (!g.fAutoStart)
{