/* INCLUDES *****************************************************************/
-#include <ntos.h>
#include <windows.h>
+#define NTOS_MODE_USER
+#include <ndk/ntndk.h>
+
#include <commctrl.h>
#include <stdio.h>
#include <tchar.h>
#include <stdlib.h>
-#include <samlib.h>
-#include <syssetup.h>
+#include <samlib/samlib.h>
+#include <syssetup/syssetup.h>
#include <userenv.h>
#include <setupapi.h>
{
PROCESS_INFORMATION ProcInfo;
STARTUPINFO si;
-
+ WCHAR InstallName[] = L"vmwinst.exe";
+
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
-
- if(CreateProcess(NULL, _T("vmwinst.exe"), NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS,
+
+ if(CreateProcess(NULL, InstallName, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS,
NULL, NULL, &si, &ProcInfo))
{
WaitForSingleObject(ProcInfo.hProcess, INFINITE);
#endif
-HRESULT CreateShellLink(LPCSTR linkPath, LPCSTR cmd, LPCSTR arg, LPCSTR dir, LPCSTR iconPath, int icon_nr, LPCSTR comment)
+HRESULT CreateShellLink(LPCTSTR linkPath, LPCTSTR cmd, LPCTSTR arg, LPCTSTR dir, LPCTSTR iconPath, int icon_nr, LPCTSTR comment)
{
- IShellLinkA* psl;
+ IShellLink* psl;
IPersistFile* ppf;
+#ifndef _UNICODE
WCHAR buffer[MAX_PATH];
+#endif /* _UNICODE */
HRESULT hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&psl);
if (SUCCEEDED(hr))
{
+#ifdef _UNICODE
+ hr = ppf->lpVtbl->Save(ppf, linkPath, TRUE);
+#else /* _UNICODE */
MultiByteToWideChar(CP_ACP, 0, linkPath, -1, buffer, MAX_PATH);
hr = ppf->lpVtbl->Save(ppf, buffer, TRUE);
+#endif /* _UNICODE */
ppf->lpVtbl->Release(ppf);
}
}
-static VOID
-CreateCmdLink(VOID)
+static BOOL
+CreateShortcut(int csidl, LPCTSTR folder, LPCTSTR linkName, LPCTSTR command, UINT nIdTitle)
{
- char path[MAX_PATH];
- LPSTR p;
+ TCHAR path[MAX_PATH];
+ TCHAR title[256];
+ LPTSTR p = path;
- CoInitialize(NULL);
+ if (!SHGetSpecialFolderPath(0, path, csidl, TRUE))
+ return FALSE;
+
+ if (folder)
+ {
+ p = PathAddBackslash(p);
+ _tcscpy(p, folder);
+ }
- SHGetSpecialFolderPathA(0, path, CSIDL_DESKTOP, TRUE);
- p = PathAddBackslashA(path);
+ p = PathAddBackslash(p);
+ _tcscpy(p, linkName);
- strcpy(p, "Command Prompt.lnk");
- CreateShellLink(path, "cmd.exe", "", NULL, NULL, 0, "Open command prompt");
+ if (!LoadString(hDllInstance, nIdTitle, title, 256))
+ return FALSE;
- CoUninitialize();
+ return SUCCEEDED(CreateShellLink(path, command, _T(""), NULL, NULL, 0, title));
+}
+
+
+static BOOL
+CreateShortcutFolder(int csidl, UINT nID, LPTSTR name, int nameLen)
+{
+ TCHAR path[MAX_PATH];
+ LPTSTR p;
+
+ if (!SHGetSpecialFolderPath(0, path, csidl, TRUE))
+ return FALSE;
+
+ if (!LoadString(hDllInstance, nID, name, nameLen))
+ return FALSE;
+
+ p = PathAddBackslash(path);
+ _tcscpy(p, name);
+
+ return CreateDirectory(path, NULL) || GetLastError()==ERROR_ALREADY_EXISTS;
}
{
case WM_INITDIALOG:
SendDlgItemMessage(hWnd, IDC_RESTART_PROGRESS, PBM_SETRANGE, 0,
- MAKELPARAM(0, 300));
- SetTimer(hWnd, 0, 50, NULL);
+ MAKELPARAM(0, 300));
+ SetTimer(hWnd, 1, 50, NULL);
return TRUE;
case WM_TIMER:
DWORD STDCALL
InstallReactOS (HINSTANCE hInstance)
{
+ TCHAR sAccessories[256];
+
# if 0
OutputDebugStringA ("InstallReactOS() called\n");
return 0;
}
- CreateCmdLink();
+ CoInitialize(NULL);
+
+ /* create desktop shortcuts */
+ CreateShortcut(CSIDL_DESKTOP, NULL, _T("Command Prompt.lnk"), _T("cmd.exe"), IDS_CMT_CMD);
+
+ /* create program startmenu shortcuts */
+ CreateShortcut(CSIDL_PROGRAMS, NULL, _T("winefile.lnk"), _T("winefile.exe"), IDS_CMT_WINEFILE);
+
+ /* create and fill Accessories subfolder */
+ if (CreateShortcutFolder(CSIDL_PROGRAMS, IDS_ACCESSORIES, sAccessories, 256)) {
+ //CreateShortcut(CSIDL_PROGRAMS, sAccessories, _T("Calculator.lnk"), _T("calc.exe"), IDS_CMT_CALC);
+ CreateShortcut(CSIDL_PROGRAMS, sAccessories, _T("Command Prompt.lnk"), _T("cmd.exe"), IDS_CMT_CMD);
+ CreateShortcut(CSIDL_PROGRAMS, sAccessories, _T("notepad.lnk"), _T("notepad.exe"), IDS_CMT_NOTEPAD);
+ CreateShortcut(CSIDL_PROGRAMS, sAccessories, _T("explorer.lnk"), _T("explorer.exe"), IDS_CMT_EXPLORER);
+ CreateShortcut(CSIDL_PROGRAMS, sAccessories, _T("regedit.lnk"), _T("regedit.exe"), IDS_CMT_REGEDIT);
+ }
+
+ CoUninitialize();
/* Create the semi-random Domain-SID */
CreateRandomSid (&DomainSid);