make more robust by calling GetSystemDirectory
[reactos.git] / reactos / lib / syssetup / install.c
index 91d4aec..e3a8199 100644 (file)
 
 /* INCLUDES *****************************************************************/
 
+#define WIN32_NO_STATUS
 #include <windows.h>
 #define NTOS_MODE_USER
 #include <ndk/ntndk.h>
 
 #include <commctrl.h>
 #include <stdio.h>
+#include <io.h>
 #include <tchar.h>
 #include <stdlib.h>
 
@@ -397,6 +399,9 @@ DWORD STDCALL
 InstallReactOS (HINSTANCE hInstance)
 {
   TCHAR sAccessories[256];
+  TCHAR sGames[256];
+  TCHAR Sys[_MAX_PATH];
+    
 
 # if 0
   OutputDebugStringA ("InstallReactOS() called\n");
@@ -433,17 +438,30 @@ InstallReactOS (HINSTANCE hInstance)
   /* 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("Command Prompt.lnk"), _T("cmd.exe"), IDS_CMT_CMD);
-  CreateShortcut(CSIDL_PROGRAMS, NULL, _T("explorer.lnk"), _T("explorer.exe"), IDS_CMT_EXPLORER);
+  /* 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("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);
   }
 
+  if(!GetSystemDirectory(Sys, _MAX_PATH))
+    Sys[0] = L'\0';
+
+  /* create Games subfolder and fill if the exe is available */
+  if (CreateShortcutFolder(CSIDL_PROGRAMS, IDS_GAMES, sGames, 256)) {
+       if (Sys[0] != L'\0') {
+         if((_taccess(_tcscat(Sys, _T("\\sol.exe")), 0 )) != -1)
+        CreateShortcut(CSIDL_PROGRAMS, sGames, _T("Solitaire.lnk"), _T("sol.exe"), IDS_CMT_SOLITAIRE);
+         
+      /* winemine etc .... */
+       }
+  }
+
   CoUninitialize();
 
   /* Create the semi-random Domain-SID */