mirror of
https://github.com/reactos/reactos.git
synced 2024-09-06 10:52:52 +00:00
Add creation of command prompt shortcut on desktop
svn path=/trunk/; revision=7631
This commit is contained in:
parent
89cfa2f16d
commit
0a8c4b149b
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.2 2003/11/14 17:13:33 weiden Exp $
|
||||
# $Id: makefile,v 1.3 2004/01/14 23:17:50 gvg Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
|
@ -12,7 +12,9 @@ TARGET_INSTALLDIR = system32
|
|||
|
||||
TARGET_SDKLIBS = kernel32.a
|
||||
|
||||
TARGET_CFLAGS = -DUNICODE -Wall -Werror
|
||||
TARGET_GCCLIBS = ole32 uuid shell32 shlwapi
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API -D_WIN32_IE=0x0400
|
||||
|
||||
TARGET_LFLAGS =
|
||||
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
|
||||
#include <syssetup.h>
|
||||
|
||||
#include <shlobj.h>
|
||||
#include <objidl.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#define DEBUG
|
||||
|
||||
typedef DWORD STDCALL (*PINSTALL_REACTOS)(HINSTANCE hInstance);
|
||||
|
@ -53,6 +57,74 @@ LPTSTR lstrchr(LPCTSTR s, TCHAR c)
|
|||
}
|
||||
|
||||
|
||||
HRESULT CreateShellLink(LPCSTR linkPath, LPCSTR cmd, LPCSTR arg, LPCSTR dir, LPCSTR iconPath, int icon_nr, LPCSTR comment)
|
||||
{
|
||||
IShellLinkA* psl;
|
||||
IPersistFile* ppf;
|
||||
WCHAR buffer[MAX_PATH];
|
||||
|
||||
HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = psl->lpVtbl->SetPath(psl, cmd);
|
||||
|
||||
if (arg)
|
||||
{
|
||||
hr = psl->lpVtbl->SetArguments(psl, arg);
|
||||
}
|
||||
|
||||
if (dir)
|
||||
{
|
||||
hr = psl->lpVtbl->SetWorkingDirectory(psl, dir);
|
||||
}
|
||||
|
||||
if (iconPath)
|
||||
{
|
||||
hr = psl->lpVtbl->SetIconLocation(psl, iconPath, icon_nr);
|
||||
}
|
||||
|
||||
if (comment)
|
||||
{
|
||||
hr = psl->lpVtbl->SetDescription(psl, comment);
|
||||
}
|
||||
|
||||
hr = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile, (LPVOID*)&ppf);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, linkPath, -1, buffer, MAX_PATH);
|
||||
|
||||
hr = ppf->lpVtbl->Save(ppf, buffer, TRUE);
|
||||
|
||||
ppf->lpVtbl->Release(ppf);
|
||||
}
|
||||
|
||||
psl->lpVtbl->Release(psl);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
CreateCmdLink()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
LPSTR p;
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
SHGetSpecialFolderPathA(0, path, CSIDL_DESKTOP, TRUE);
|
||||
p = PathAddBackslashA(path);
|
||||
|
||||
strcpy(p, "Command Prompt.lnk");
|
||||
CreateShellLink(path, "cmd.exe", "", NULL, NULL, 0, "Open command prompt");
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
RunNewSetup (HINSTANCE hInstance)
|
||||
{
|
||||
|
@ -85,6 +157,8 @@ RunNewSetup (HINSTANCE hInstance)
|
|||
InstallReactOS (hInstance);
|
||||
|
||||
FreeLibrary (hDll);
|
||||
|
||||
CreateCmdLink();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue