- Add preliminary wizard page title and subtitle string resources.
authorEric Kohl <eric.kohl@reactos.org>
Sat, 28 Aug 2004 11:08:50 +0000 (11:08 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 28 Aug 2004 11:08:50 +0000 (11:08 +0000)
- Use setupapi functions to process syssetup.inf.

svn path=/trunk/; revision=10717

reactos/lib/syssetup/Makefile
reactos/lib/syssetup/dllmain.c
reactos/lib/syssetup/globals.h
reactos/lib/syssetup/install.c
reactos/lib/syssetup/logfile.c
reactos/lib/syssetup/resource.h
reactos/lib/syssetup/syssetup_Cz.rc
reactos/lib/syssetup/syssetup_De.rc
reactos/lib/syssetup/syssetup_En.rc
reactos/lib/syssetup/wizard.c

index bc9dce1..45e8cda 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.10 2004/07/19 01:33:14 kuehng Exp $
+# $Id: Makefile,v 1.11 2004/08/28 11:08:50 ekohl Exp $
 
 PATH_TO_TOP = ../..
 
@@ -8,13 +8,14 @@ TARGET_NAME = syssetup
 
 TARGET_BASE = $(TARGET_BASE_LIB_SYSSETUP)
 
-TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a gdi32.a user32.a samlib.a userenv.a comctl32.a
+TARGET_SDKLIBS = ntdll.a kernel32.a advapi32.a gdi32.a user32.a samlib.a userenv.a \
+                 comctl32.a setupapi.a
 
 TARGET_CFLAGS = -Wall -Werror -fno-builtin
 
 TARGET_CFLAGS += -D__USE_W32API -D_WIN32_IE=0x0500
 TARGET_RCFLAGS += -D__USE_W32API -D_WIN32_IE=0x0500
+
 TARGET_LFLAGS = -nostartfiles
 
 TARGET_OBJECTS = dllmain.o install.o logfile.o wizard.o
index eaf0f9d..677d953 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dllmain.c,v 1.3 2004/04/16 13:37:18 ekohl Exp $
+/* $Id: dllmain.c,v 1.4 2004/08/28 11:08:50 ekohl Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS system libraries
  * PURPOSE:           Main file
  * FILE:              lib/syssetup/dllmain.c
- * PROGRAMER:         Eric Kohl (ekohl@rz-online.de)
+ * PROGRAMER:         Eric Kohl
  */
 
 /* INCLUDES *****************************************************************/
 
 #include <windows.h>
 #include <commctrl.h>
+#include <setupapi.h>
 
 #include "globals.h"
 
index d318eb5..ec1fa89 100644 (file)
@@ -27,6 +27,7 @@ typedef struct _SETUPDATA
 
 
 extern HINSTANCE hDllInstance;
+extern HINF hSysSetupInf;
 
 /* wizard.c */
 VOID InstallWizard (VOID);
index faf0632..e482583 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: install.c,v 1.15 2004/08/03 13:43:00 ekohl Exp $
+/* $Id: install.c,v 1.16 2004/08/28 11:08:50 ekohl Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS system libraries
  * PURPOSE:           System setup
  * FILE:              lib/syssetup/install.c
- * PROGRAMER:         Eric Kohl (ekohl@rz-online.de)
+ * PROGRAMER:         Eric Kohl
  */
 
 /* INCLUDES *****************************************************************/
@@ -37,6 +37,7 @@
 #include <samlib.h>
 #include <syssetup.h>
 #include <userenv.h>
+#include <setupapi.h>
 
 #include "globals.h"
 #include "resource.h"
@@ -51,6 +52,7 @@ VOID WINAPI CreateCmdLink(VOID);
 PSID DomainSid = NULL;
 PSID AdminSid = NULL;
 
+HINF hSysSetupInf = INVALID_HANDLE_VALUE;
 
 /* FUNCTIONS ****************************************************************/
 
@@ -247,46 +249,42 @@ CreateTempDir(LPCWSTR VarName)
   RegCloseKey (hKey);
 }
 
-#define SECTIONBUF_SIZE 4096
 
 BOOL
 ProcessSysSetupInf(VOID)
 {
-  LPTSTR pBuf2;
-  TCHAR szBuf[SECTIONBUF_SIZE];
-  DWORD dwBufSize;
-
-  SetLastError(0);
-
-  dwBufSize = GetPrivateProfileSection(_T("DeviceInfsToInstall"),
-                                      szBuf,
-                                      SECTIONBUF_SIZE,
-                                      _T("Inf\\SYSSETUP.INF"));
-
-  /* fix this first... */
-  if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
-    return TRUE;
-
-  if (dwBufSize == SECTIONBUF_SIZE-2)
-    return FALSE;
-
-  if (!dwBufSize)
+  INFCONTEXT InfContext;
+  TCHAR LineBuffer[256];
+  DWORD LineLength;
+
+  if (!SetupFindFirstLine(hSysSetupInf,
+                         _T("DeviceInfsToInstall"),
+                         NULL,
+                         &InfContext))
+  {
     return FALSE;
+  }
 
-  pBuf2 = szBuf;
-  while (*pBuf2)
+  do
   {
-    OutputDebugString(_T("Calling Class Installer for "));
-    OutputDebugString(pBuf2);
-    OutputDebugString(_T("\r\n"));
+    if (!SetupGetStringField(&InfContext,
+                            0,
+                            LineBuffer,
+                            256,
+                            &LineLength))
+    {
+      return FALSE;
+    }
 
 #if 0
     /* FIXME: Currently unsupported */
-    if (!SetupDiInstallClass(NULL, pBuf2, DI_QUIETINSTALL, NULL))
+    if (!SetupDiInstallClass(NULL, LineBuffer, DI_QUIETINSTALL, NULL))
+    {
       return FALSE;
+    }
 #endif
-    pBuf2 += _tcslen(pBuf2) + 1;
   }
+  while (SetupFindNextLine(&InfContext, &InfContext));
 
   return TRUE;
 }
@@ -355,7 +353,7 @@ InstallReactOS (HINSTANCE hInstance)
     }
 
   /* Append the Admin-RID */
-  AppendRidToSid (&AdminSid, DomainSid, DOMAIN_USER_RID_ADMIN);
+  AppendRidToSid(&AdminSid, DomainSid, DOMAIN_USER_RID_ADMIN);
 
 #if 0
   RtlConvertSidToUnicodeString (&SidString, DomainSid, TRUE);
@@ -364,45 +362,57 @@ InstallReactOS (HINSTANCE hInstance)
 #endif
 
   /* Create the Administrator account */
-  if (!SamCreateUser (L"Administrator", L"", AdminSid))
-    {
-      DebugPrint ("SamCreateUser() failed!\n");
-      RtlFreeSid (AdminSid);
-      RtlFreeSid (DomainSid);
-      return 0;
-    }
+  if (!SamCreateUser(L"Administrator", L"", AdminSid))
+  {
+    DebugPrint("SamCreateUser() failed!\n");
+    RtlFreeSid(AdminSid);
+    RtlFreeSid(DomainSid);
+    return 0;
+  }
 
   /* Create the Administrator profile */
-  if (!CreateUserProfileW (AdminSid, L"Administrator"))
-    {
-      DebugPrint ("CreateUserProfileW() failed!\n");
-      RtlFreeSid (AdminSid);
-      RtlFreeSid (DomainSid);
-      return 0;
-    }
+  if (!CreateUserProfileW(AdminSid, L"Administrator"))
+  {
+    DebugPrint("CreateUserProfileW() failed!\n");
+    RtlFreeSid(AdminSid);
+    RtlFreeSid(DomainSid);
+    return 0;
+  }
 
-  RtlFreeSid (AdminSid);
-  RtlFreeSid (DomainSid);
+  RtlFreeSid(AdminSid);
+  RtlFreeSid(DomainSid);
 
   CreateTempDir(L"TEMP");
   CreateTempDir(L"TMP");
 
-  if(!ProcessSysSetupInf())
+  hSysSetupInf = SetupOpenInfFileW(L"syssetup.inf",
+                                  NULL,
+                                  INF_STYLE_WIN4,
+                                  NULL);
+  if (hSysSetupInf == INVALID_HANDLE_VALUE)
   {
-      DebugPrint("ProcessSysSetupInf() failed!\n");
-         return 0;
+    DebugPrint("SetupOpenInfFileW() failed to open 'syssetup.inf' (Error: %lu)\n", GetLastError());
+    return 0;
+  }
+
+  if (!ProcessSysSetupInf())
+  {
+    DebugPrint("ProcessSysSetupInf() failed!\n");
+    return 0;
   }
 
   InstallWizard();
 
+  SetupCloseInfFile(hSysSetupInf);
+
 #ifdef VMWINST
-  RunVMWInstall ();
+  RunVMWInstall();
 #endif
 
-  DialogBox (hDllInstance,
-            MAKEINTRESOURCE(IDD_RESTART),
-            NULL,
-            RestartDlgProc);
+  DialogBox(hDllInstance,
+           MAKEINTRESOURCE(IDD_RESTART),
+           NULL,
+           RestartDlgProc);
 
   return 0;
 }
index 9e32243..1228ffd 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: logfile.c,v 1.2 2004/01/14 22:15:09 gvg Exp $
+/* $Id: logfile.c,v 1.3 2004/08/28 11:08:50 ekohl Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS system libraries
  * PURPOSE:           Log file functions
  * FILE:              lib/syssetup/logfile.c
- * PROGRAMER:         Eric Kohl (ekohl@rz-online.de)
+ * PROGRAMER:         Eric Kohl
  */
 
 /* INCLUDES *****************************************************************/
index 9a896bf..ab86ff2 100644 (file)
 #define IDD_RESTART                    2000
 #define IDC_RESTART_PROGRESS           2001
 
+
+#define IDS_OWNERTITLE                 3000
+#define IDS_OWNERSUBTITLE              3001
+
+#define IDS_COMPUTERTITLE              3002
+#define IDS_COMPUTERSUBTITLE           3003
+
+#define IDS_LOCALETITLE                        3004
+#define IDS_LOCALESUBTITLE             3005
+
 #endif /* RESOURCE_H */
index ee2898b..4ee6ea2 100644 (file)
@@ -106,9 +106,21 @@ STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
 CAPTION "Instatalace ReactOSu"
 FONT 8, "MS Shell Dlg"
 BEGIN
-   LTEXT "Instalace ReactOSu byla úspì\9anì dokonèena.", -1, 13, 12, 212, 16
-   LTEXT "Pro pokraèování potøebuje instalaèní program restartovat Vá\9a poèítaè. Poèítaè bude automaticky restartován za 15 sekund nebo zmáèknete-li tlaèítko Restartovat.", -1, 13, 33, 212, 32
-/*   GROUPBOX "", -1, 7, 3, 231, 106 */
-   CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 
-   PUSHBUTTON "&Restartovat", IDOK, 98, 87, 50, 14
+    LTEXT "Instalace ReactOSu byla úspì\9anì dokonèena.", -1, 13, 12, 212, 16
+    LTEXT "Pro pokraèování potøebuje instalaèní program restartovat Vá\9a poèítaè. Poèítaè bude automaticky restartován za 15 sekund nebo zmáèknete-li tlaèítko Restartovat.", -1, 13, 33, 212, 32
+/*    GROUPBOX "", -1, 7, 3, 231, 106 */
+    CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 
+    PUSHBUTTON "&Restartovat", IDOK, 98, 87, 50, 14
 END
+
+STRINGTABLE
+BEGIN
+    IDS_OWNERTITLE       "Owner page title"
+    IDS_OWNERSUBTITLE    "Owner page subtitle"
+    IDS_COMPUTERTITLE    "Computer page title"
+    IDS_COMPUTERSUBTITLE "Computer page subtitle"
+    IDS_LOCALETITLE      "Locale page title"
+    IDS_LOCALESUBTITLE   "Locale page subtitle"
+END
+
+/* EOF */
index f253c8e..6238e2a 100644 (file)
@@ -108,13 +108,24 @@ STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
 CAPTION "ReactOS Installation"
 FONT 8, "MS Shell Dlg"
 BEGIN
-   LTEXT "Die Installation von ReactOS wurde erfolgreich fertiggestellt.", IDC_STATIC, 13, 12, 212, 16
-   LTEXT "Um fortzufahren muss Ihr Computer neu gesratet werden. "\
-         "Der Computer wird in 15 Minuten automatisch neu gestartet oder wenn Sie auf "\
-         "Neustart klicken.", IDC_STATIC, 13, 33, 212, 32
-/*   GROUPBOX "", -1, 7, 3, 231, 106 */
-   CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 
-   PUSHBUTTON "&Neustart", IDOK, 98, 87, 50, 14
+    LTEXT "Die Installation von ReactOS wurde erfolgreich fertiggestellt.", IDC_STATIC, 13, 12, 212, 16
+    LTEXT "Um fortzufahren muss Ihr Computer neu gesratet werden. "\
+          "Der Computer wird in 15 Minuten automatisch neu gestartet oder wenn Sie auf "\
+          "Neustart klicken.", IDC_STATIC, 13, 33, 212, 32
+/*    GROUPBOX "", -1, 7, 3, 231, 106 */
+    CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 
+    PUSHBUTTON "&Neustart", IDOK, 98, 87, 50, 14
+END
+
+
+STRINGTABLE
+BEGIN
+    IDS_OWNERTITLE       "Owner page title"
+    IDS_OWNERSUBTITLE    "Owner page subtitle"
+    IDS_COMPUTERTITLE    "Computer page title"
+    IDS_COMPUTERSUBTITLE "Computer page subtitle"
+    IDS_LOCALETITLE      "Locale page title"
+    IDS_LOCALESUBTITLE   "Locale page subtitle"
 END
 
 /* EOF */
index 45049ff..1eb7571 100644 (file)
@@ -108,13 +108,24 @@ STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
 CAPTION "ReactOS Installation"
 FONT 8, "MS Shell Dlg"
 BEGIN
-   LTEXT "Installation of ReactOS was successfully completed.", IDC_STATIC, 13, 12, 212, 16
-   LTEXT "In order to continue, the installation program needs to restart your computer. "\
-         "The computer will be automatically restarted in 15 seconds or if you press the "\
-         "Restart button.", IDC_STATIC, 13, 33, 212, 32
-/*   GROUPBOX "", -1, 7, 3, 231, 106 */
-   CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 
-   PUSHBUTTON "&Restart", IDOK, 98, 87, 50, 14
+    LTEXT "Installation of ReactOS was successfully completed.", IDC_STATIC, 13, 12, 212, 16
+    LTEXT "In order to continue, the installation program needs to restart your computer. "\
+          "The computer will be automatically restarted in 15 seconds or if you press the "\
+          "Restart button.", IDC_STATIC, 13, 33, 212, 32
+/*    GROUPBOX "", -1, 7, 3, 231, 106 */
+    CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 
+    PUSHBUTTON "&Restart", IDOK, 98, 87, 50, 14
+END
+
+
+STRINGTABLE
+BEGIN
+    IDS_OWNERTITLE       "Owner page title"
+    IDS_OWNERSUBTITLE    "Owner page subtitle"
+    IDS_COMPUTERTITLE    "Computer page title"
+    IDS_COMPUTERSUBTITLE "Computer page subtitle"
+    IDS_LOCALETITLE      "Locale page title"
+    IDS_LOCALESUBTITLE   "Locale page subtitle"
 END
 
 /* EOF */
index 677b934..f031a7d 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: wizard.c,v 1.5 2004/08/03 13:43:00 ekohl Exp $
+/* $Id: wizard.c,v 1.6 2004/08/28 11:08:50 ekohl Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS system libraries
 
 #include <string.h>
 #include <tchar.h>
+#include <setupapi.h>
 
 #include <syssetup.h>
 
+
 #include "globals.h"
 #include "resource.h"
 
@@ -435,16 +437,16 @@ InstallWizard(VOID)
 
   /* Create the Owner page */
   psp.dwFlags = PSP_DEFAULT; // | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
-//  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_TITLE1);
-//  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUBTITLE1);
+//  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
+//  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
   psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
   psp.pfnDlgProc = OwnerPageDlgProc;
   ahpsp[1] = CreatePropertySheetPage(&psp);
 
   /* Create the Computer page */
   psp.dwFlags = PSP_DEFAULT; // | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
-//  psp.pszHeaderTitle =    MAKEINTRESOURCE(IDS_TITLE2);
-//  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUBTITLE2);
+//  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
+//  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
   psp.pfnDlgProc = ComputerPageDlgProc;
   psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
   ahpsp[2] = CreatePropertySheetPage(&psp);
@@ -452,8 +454,8 @@ InstallWizard(VOID)
 
   /* Create the Locale page */
   psp.dwFlags = PSP_DEFAULT; // | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
-//  psp.pszHeaderTitle =    MAKEINTRESOURCE(IDS_TITLE2);
-//  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_SUBTITLE2);
+//  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
+//  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
   psp.pfnDlgProc = LocalePageDlgProc;
   psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
   ahpsp[3] = CreatePropertySheetPage(&psp);