Auto-register DLLs during 2nd stage setup
Modified: trunk/reactos/lib/avifil32/avifil32.xml
Modified: trunk/reactos/lib/comctl32/comctl32.xml
Modified: trunk/reactos/lib/dinput/dinput.xml
Modified: trunk/reactos/lib/dinput8/dinput8.xml
Modified: trunk/reactos/lib/dplayx/dplayx.xml
Modified: trunk/reactos/lib/dsound/dsound.xml
Modified: trunk/reactos/lib/dxdiagn/dxdiagn.xml
Modified: trunk/reactos/lib/msi/msi.xml
Modified: trunk/reactos/lib/objsel/objsel.xml
Modified: trunk/reactos/lib/ole32/ole32.xml
Modified: trunk/reactos/lib/oleaut32/oleaut32.xml
Modified: trunk/reactos/lib/olepro32/olepro32.xml
Modified: trunk/reactos/lib/rpcrt4/rpcrt4.xml
Modified: trunk/reactos/lib/shell32/regsvr.c
Modified: trunk/reactos/lib/shell32/shell32.xml
Modified: trunk/reactos/lib/syssetup/resource.h
Modified: trunk/reactos/lib/syssetup/syssetup.xml
Modified: trunk/reactos/lib/syssetup/syssetup_Cz.rc
Modified: trunk/reactos/lib/syssetup/syssetup_De.rc
Modified: trunk/reactos/lib/syssetup/syssetup_En.rc
Modified: trunk/reactos/lib/syssetup/syssetup_Fr.rc
Modified: trunk/reactos/lib/syssetup/syssetup_Hu.rc
Modified: trunk/reactos/lib/syssetup/syssetup_Ja.rc
Modified: trunk/reactos/lib/syssetup/syssetup_Nl.rc
Modified: trunk/reactos/lib/syssetup/wizard.c
Modified: trunk/reactos/lib/wininet/wininet.xml
Modified: trunk/reactos/media/inf/syssetup.inf.tpl

Modified: trunk/reactos/lib/avifil32/avifil32.xml
--- trunk/reactos/lib/avifil32/avifil32.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/avifil32/avifil32.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="avifil32" type="win32dll" baseaddress="${BASEADDRESS_AVIFIL32}" installbase="system32" installname="avifil32.dll">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="avifil32.spec.def" />
 	<include base="avifil32">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/comctl32/comctl32.xml
--- trunk/reactos/lib/comctl32/comctl32.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/comctl32/comctl32.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="comctl32" type="win32dll" baseaddress="${BASEADDRESS_COMCTL32}" installbase="system32" installname="comctl32.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="DllInstall" />
 	<importlibrary definition="comctl32.spec.def" />
 	<include base="comctl32">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/dinput/dinput.xml
--- trunk/reactos/lib/dinput/dinput.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/dinput/dinput.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="dinput" type="win32dll" baseaddress="${BASEADDRESS_DINPUT}" installbase="system32" installname="dinput.dll" allowwarnings ="true">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="dinput.spec.def" />
 	<include base="dinput">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/dinput8/dinput8.xml
--- trunk/reactos/lib/dinput8/dinput8.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/dinput8/dinput8.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="dinput8" type="win32dll" baseaddress="${BASEADDRESS_DINPUT8}" installbase="system32" installname="dinput8.dll">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="dinput8.spec.def" />
 	<include base="dinput8">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/dplayx/dplayx.xml
--- trunk/reactos/lib/dplayx/dplayx.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/dplayx/dplayx.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="dplayx" type="win32dll" baseaddress="${BASEADDRESS_DPLAYX}" installbase="system32" installname="dplayx.dll" allowwarnings ="true">
+	<!-- Won't load correctly in ReactOS yet autoregister infsection="OleControlDlls" type="DllRegisterServer" -->
 	<importlibrary definition="dplayx.spec.def" />
 	<include base="dplayx">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/dsound/dsound.xml
--- trunk/reactos/lib/dsound/dsound.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/dsound/dsound.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="dsound" type="win32dll" baseaddress="${BASEADDRESS_DSOUND}" installbase="system32" installname="dsound.dll" allowwarnings ="true">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="dsound.spec.def" />
 	<include base="dsound">.</include>
 	<include base="ReactOS">include/wine</include>	

Modified: trunk/reactos/lib/dxdiagn/dxdiagn.xml
--- trunk/reactos/lib/dxdiagn/dxdiagn.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/dxdiagn/dxdiagn.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="dxdiagn" type="win32dll" baseaddress="${BASEADDRESS_DXDIAGN}" installbase="system32" installname="dxdiagn.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="dxdiagn.spec.def" />
 	<include base="dxdiagn">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/msi/msi.xml
--- trunk/reactos/lib/msi/msi.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/msi/msi.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="msi" type="win32dll" baseaddress="${BASEADDRESS_MSI}" installbase="system32" installname="msi.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="msi.spec.def" />
 	<include base="msi">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/objsel/objsel.xml
--- trunk/reactos/lib/objsel/objsel.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/objsel/objsel.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="objsel" type="win32dll" baseaddress="${BASEADDRESS_OBJSEL}" installbase="system32" installname="objsel.dll">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="objsel.spec.def" />
 	<include base="objsel">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/ole32/ole32.xml
--- trunk/reactos/lib/ole32/ole32.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/ole32/ole32.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="ole32" type="win32dll" baseaddress="${BASEADDRESS_OLE32}" installbase="system32" installname="ole32.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="ole32.spec.def" />
 	<include base="ole32">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/oleaut32/oleaut32.xml
--- trunk/reactos/lib/oleaut32/oleaut32.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/oleaut32/oleaut32.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="oleaut32" type="win32dll" baseaddress="${BASEADDRESS_OLEAUT32}" installbase="system32" installname="oleaut32.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="oleaut32.spec.def" />
 	<include base="oleaut32">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/olepro32/olepro32.xml
--- trunk/reactos/lib/olepro32/olepro32.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/olepro32/olepro32.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="olepro32" type="win32dll" baseaddress="${BASEADDRESS_OLEPRO32}" installbase="system32" installname="olepro32.dll">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="olepro32.spec.def" />
 	<include base="olepro32">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/rpcrt4/rpcrt4.xml
--- trunk/reactos/lib/rpcrt4/rpcrt4.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/rpcrt4/rpcrt4.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="rpcrt4" type="win32dll" baseaddress="${BASEADDRESS_RPCRT4}" installbase="system32" installname="rpcrt4.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
 	<importlibrary definition="rpcrt4.spec.def" />
 	<include base="rpcrt4">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/shell32/regsvr.c
--- trunk/reactos/lib/shell32/regsvr.c	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/shell32/regsvr.c	2005-11-27 22:27:35 UTC (rev 19702)
@@ -642,11 +642,13 @@
 static const WCHAR wszMyDocuments[] = { 'M','y',' ','D','o','c','u','m','e','n','t','s', 0 };
 
 static struct regsvr_namespace const namespace_extensions_list[] = {
+#if 0
     {   
         &CLSID_MyDocuments,
         wszDesktop,
         wszMyDocuments
     },
+#endif
     { NULL }
 };
 

Modified: trunk/reactos/lib/shell32/shell32.xml
--- trunk/reactos/lib/shell32/shell32.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/shell32/shell32.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="shell32" type="win32dll" baseaddress="${BASEADDRESS_SHELL32}" installbase="system32" installname="shell32.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="Both" />
 	<importlibrary definition="shell32.spec.def" />
 	<include base="shell32">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/lib/syssetup/resource.h
--- trunk/reactos/lib/syssetup/resource.h	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/resource.h	2005-11-27 22:27:35 UTC (rev 19702)
@@ -53,7 +53,9 @@
 #define IDC_AUTODAYLIGHT		1054
 
 #define IDD_PROCESSPAGE			1060
-#define IDC_PROCESSPROGRESS		1061
+#define IDC_ACTIVITY			1061
+#define IDC_ITEM			1062
+#define IDC_PROCESSPROGRESS		1063
 
 #define IDD_FINISHPAGE			1070
 #define IDC_FINISHTITLE			1071
@@ -94,6 +96,16 @@
 #define IDS_CMT_SOLITAIRE		3216
 #define IDS_CMT_WINEMINE		3217
 
+#define IDS_REACTOS_SETUP		3300
+#define IDS_UNKNOWN_ERROR		3301
+#define IDS_REGISTERING_COMPONENTS	3302
+#define IDS_LOADLIBRARY_FAILED		3303
+#define IDS_GETPROCADDR_FAILED		3304
+#define IDS_REGSVR_FAILED		3305
+#define IDS_DLLINSTALL_FAILED		3306
+#define IDS_TIMEOUT			3307
+#define IDS_REASON_UNKNOWN		3308
+
 #define IDR_GPL					4000
 
 #endif /* RESOURCE_H */

Modified: trunk/reactos/lib/syssetup/syssetup.xml
--- trunk/reactos/lib/syssetup/syssetup.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -6,6 +6,7 @@
 	<define name="_UNICODE" />
 	<define name="_WIN32_IE">0x0600</define>
 	<define name="_WIN32_WINNT">0x0501</define>
+	<define name="_SETUPAPI_VER">0x0501</define>
 	<library>uuid</library>
 	<library>ntdll</library>
 	<library>kernel32</library>

Modified: trunk/reactos/lib/syssetup/syssetup_Cz.rc
--- trunk/reactos/lib/syssetup/syssetup_Cz.rc	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup_Cz.rc	2005-11-27 22:27:35 UTC (rev 19702)
@@ -130,8 +130,8 @@
 CAPTION "ReactOS Setup"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
-    LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
     CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
 END
 

Modified: trunk/reactos/lib/syssetup/syssetup_De.rc
--- trunk/reactos/lib/syssetup/syssetup_De.rc	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup_De.rc	2005-11-27 22:27:35 UTC (rev 19702)
@@ -132,8 +132,8 @@
 CAPTION "ReactOS Setup"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
-    LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
     CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
 END
 

Modified: trunk/reactos/lib/syssetup/syssetup_En.rc
--- trunk/reactos/lib/syssetup/syssetup_En.rc	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup_En.rc	2005-11-27 22:27:35 UTC (rev 19702)
@@ -132,8 +132,8 @@
 CAPTION "ReactOS Setup"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
-    LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
     CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32",
             PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
 END
@@ -198,5 +198,17 @@
     IDS_CMT_WINEMINE	"WineMine"
 END
 
+STRINGTABLE
+BEGIN
+    IDS_REACTOS_SETUP		"ReactOS Setup"
+    IDS_UNKNOWN_ERROR           "Unknown error"
+    IDS_REGISTERING_COMPONENTS	"Registering components..."
+    IDS_LOADLIBRARY_FAILED	"LoadLibrary failed: "
+    IDS_GETPROCADDR_FAILED	"GetProcAddr failed: "
+    IDS_REGSVR_FAILED           "DllRegisterServer failed: "
+    IDS_DLLINSTALL_FAILED	"DllInstall failed: "
+    IDS_TIMEOUT			"Timeout during registration"
+    IDS_REASON_UNKNOWN          ""
+END
 
 /* EOF */

Modified: trunk/reactos/lib/syssetup/syssetup_Fr.rc
--- trunk/reactos/lib/syssetup/syssetup_Fr.rc	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup_Fr.rc	2005-11-27 22:27:35 UTC (rev 19702)
@@ -133,8 +133,8 @@
 CAPTION "ReactOS Setup"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
-    LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
     CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
 END
 

Modified: trunk/reactos/lib/syssetup/syssetup_Hu.rc
--- trunk/reactos/lib/syssetup/syssetup_Hu.rc	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup_Hu.rc	2005-11-27 22:27:35 UTC (rev 19702)
@@ -126,8 +126,8 @@
 CAPTION "ReactOS TelepÝt§"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
-    LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
     CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32",
             PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
 END

Modified: trunk/reactos/lib/syssetup/syssetup_Ja.rc
--- trunk/reactos/lib/syssetup/syssetup_Ja.rc	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup_Ja.rc	2005-11-27 22:27:35 UTC (rev 19702)
@@ -132,8 +132,8 @@
 CAPTION "ReactOS âZâbâgâAâbâv"
 FONT 9, "MS UI Gothic"
 BEGIN
-    LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
-    LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
     CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32",
             PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
 END

Modified: trunk/reactos/lib/syssetup/syssetup_Nl.rc
--- trunk/reactos/lib/syssetup/syssetup_Nl.rc	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/syssetup_Nl.rc	2005-11-27 22:27:35 UTC (rev 19702)
@@ -27,7 +27,7 @@
 BEGIN
     LTEXT "Welkom bij de Reactos installatiewizard.", IDC_WELCOMETITLE, 115, 8, 195, 24
     LTEXT "Deze wizard zal Reactos op je computer installeren. De wizard "\
-          "heeft informatie over u en uw computer nodig "\
+          "heeft informatie over jou en jouw computer nodig "\
           "om Reactos correct in te stellen.", IDC_STATIC, 115, 40, 195, 100
     LTEXT "Klik op Volgende om voort te gaan met de installatie.", IDC_STATIC, 115, 169, 195, 17
 END
@@ -132,8 +132,8 @@
 CAPTION "ReactOS Setup"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    LTEXT "Some text...", IDC_STATIC, 53, 7, 253, 20
-    LTEXT "Some more text...", IDC_STATIC, 53, 29, 253, 20
+    LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20
+    LTEXT "", IDC_ITEM, 53, 29, 253, 20
     CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32",
             PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 53, 70, 253, 8
 END

Modified: trunk/reactos/lib/syssetup/wizard.c
--- trunk/reactos/lib/syssetup/wizard.c	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/syssetup/wizard.c	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,45 +1,55 @@
 /*
- *  ReactOS kernel
- *  Copyright (C) 2004 ReactOS Team
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * PROJECT:    System setup
+ * LICENSE:    GPL - See COPYING in the top level directory
+ * PROGRAMMER: Eric Kohl
  */
-/*
- * COPYRIGHT:         See COPYING in the top level directory
- * PROJECT:           ReactOS system libraries
- * PURPOSE:           System setup
- * FILE:              lib/syssetup/wizard.c
- * PROGRAMER:         Eric Kohl
- */
 
 /* INCLUDES *****************************************************************/
 
+#include <ntstatus.h>
+#define WIN32_NO_STATUS
 #include <windows.h>
 #include <windowsx.h>
 #include <commctrl.h>
 #include <tchar.h>
 #include <string.h>
 #include <setupapi.h>
+#define NTOS_MODE_USER
+#include <ndk/ntndk.h>
 
 #include <syssetup/syssetup.h>
 
+#define NDEBUG
+#include <debug.h>
+
 #include "globals.h"
 #include "resource.h"
 
 #define VMWINST
 
+#define PM_REGISTRATION_NOTIFY (WM_APP + 1)
+  /* Private Message used to communicate progress from the background
+     registration thread to the main thread.
+     wParam = 0 Registration in progress
+            = 1 Registration completed
+     lParam = Pointer to a REGISTRATIONNOTIFY structure */
+
+typedef struct _REGISTRATIONNOTIFY
+{
+  ULONG Progress;
+  UINT ActivityID;
+  LPCWSTR CurrentItem;
+  LPCWSTR ErrorMessage;
+} REGISTRATIONNOTIFY, *PREGISTRATIONNOTIFY;
+
+typedef struct _REGISTRATIONDATA
+{
+  HWND hwndDlg;
+  ULONG DllCount;
+  ULONG Registered;
+  PVOID DefaultContext;
+} REGISTRATIONDATA, *PREGISTRATIONDATA;
+
 /* GLOBALS ******************************************************************/
 
 static SETUPDATA SetupData;
@@ -1292,6 +1302,248 @@
 }
 
 
+static UINT CALLBACK
+RegistrationNotificationProc(PVOID Context,
+                             UINT Notification,
+                             UINT_PTR Param1,
+                             UINT_PTR Param2)
+{
+  PREGISTRATIONDATA RegistrationData;
+  REGISTRATIONNOTIFY RegistrationNotify;
+  PSP_REGISTER_CONTROL_STATUSW StatusInfo;
+  UINT MessageID;
+  WCHAR ErrorMessage[128];
+
+  RegistrationData = (PREGISTRATIONDATA) Context;
+
+  if (SPFILENOTIFY_STARTREGISTRATION == Notification ||
+      SPFILENOTIFY_ENDREGISTRATION == Notification)
+    {
+      StatusInfo = (PSP_REGISTER_CONTROL_STATUSW) Param1;
+      RegistrationNotify.CurrentItem = wcsrchr(StatusInfo->FileName, L'\\');
+      if (NULL == RegistrationNotify.CurrentItem)
+        {
+          RegistrationNotify.CurrentItem = StatusInfo->FileName;
+        }
+      else
+        {
+          RegistrationNotify.CurrentItem++;
+        }
+
+      if (SPFILENOTIFY_STARTREGISTRATION == Notification)
+        {
+          DPRINT("Received SPFILENOTIFY_STARTREGISTRATION notification for %S\n",
+                 StatusInfo->FileName);
+          RegistrationNotify.ErrorMessage = NULL;
+          RegistrationNotify.Progress = RegistrationData->Registered;
+        }
+      else
+        {
+          DPRINT("Received SPFILENOTIFY_ENDREGISTRATION notification for %S\n",
+                 StatusInfo->FileName);
+          DPRINT("Win32Error %u FailureCode %u\n", StatusInfo->Win32Error,
+                 StatusInfo->FailureCode);
+          if (SPREG_SUCCESS != StatusInfo->FailureCode)
+            {
+              switch(StatusInfo->FailureCode)
+                {
+                case SPREG_LOADLIBRARY:
+                  MessageID = IDS_LOADLIBRARY_FAILED;
+                  break;
+                case SPREG_GETPROCADDR:
+                  MessageID = IDS_GETPROCADDR_FAILED;
+                  break;
+                case SPREG_REGSVR:
+                  MessageID = IDS_REGSVR_FAILED;
+                  break;
+                case SPREG_DLLINSTALL:
+                  MessageID = IDS_DLLINSTALL_FAILED;
+                  break;
+                case SPREG_TIMEOUT:
+                  MessageID = IDS_TIMEOUT;
+                  break;
+                default:
+                  MessageID = IDS_REASON_UNKNOWN;
+                  break;
+                }
+              if (0 == LoadStringW(hDllInstance, MessageID,
+                                   ErrorMessage,
+                                   sizeof(ErrorMessage) /
+                                   sizeof(ErrorMessage[0])))
+                {
+                  ErrorMessage[0] = L'\0';
+                }
+              if (SPREG_TIMEOUT != StatusInfo->FailureCode)
+                {
+                  FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+                                 StatusInfo->Win32Error, 0, 
+                                 ErrorMessage + wcslen(ErrorMessage),
+                                 sizeof(ErrorMessage) / sizeof(ErrorMessage[0]) -
+                                 wcslen(ErrorMessage), NULL);
+                }
+              RegistrationNotify.ErrorMessage = ErrorMessage;
+            }
+          else
+            {
+              RegistrationNotify.ErrorMessage = NULL;
+            }
+          if (RegistrationData->Registered < RegistrationData->DllCount)
+            {
+              RegistrationData->Registered++;
+            }
+        }
+
+      RegistrationNotify.Progress = RegistrationData->Registered;
+      RegistrationNotify.ActivityID = IDS_REGISTERING_COMPONENTS;
+      SendMessage(RegistrationData->hwndDlg, PM_REGISTRATION_NOTIFY,
+                  0, (LPARAM) &RegistrationNotify);
+
+      return FILEOP_DOIT;
+    }
+  else
+    {
+      DPRINT1("Received unexpected notification %u\n", Notification);
+      return SetupDefaultQueueCallback(RegistrationData->DefaultContext,
+                                       Notification, Param1, Param2);
+    }
+}
+
+
+static DWORD CALLBACK
+RegistrationProc(LPVOID Parameter)
+{
+  PREGISTRATIONDATA RegistrationData;
+  REGISTRATIONNOTIFY RegistrationNotify;
+  DWORD LastError;
+  WCHAR UnknownError[84];
+
+  RegistrationData = (PREGISTRATIONDATA) Parameter;
+  RegistrationData->Registered = 0;
+  RegistrationData->DefaultContext = SetupInitDefaultQueueCallback(RegistrationData->hwndDlg);
+
+  if (SetupInstallFromInfSectionW(GetParent(RegistrationData->hwndDlg),
+                                  hSysSetupInf,
+                                  L"RegistrationPhase2",
+                                  SPINST_REGISTRY |
+                                  SPINST_REGISTERCALLBACKAWARE  |
+                                  SPINST_REGSVR,
+                                  0,
+                                  NULL,
+                                  0,
+                                  RegistrationNotificationProc,
+                                  RegistrationData,
+                                  NULL,
+                                  NULL))
+    {
+      RegistrationNotify.ErrorMessage = NULL;
+    }
+  else
+    {
+      LastError = GetLastError();
+      DPRINT1("SetupInstallFromInfSection failed with error %u\n",
+              LastError);
+      if (0 == FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                              FORMAT_MESSAGE_FROM_SYSTEM, NULL, LastError, 0,
+                              (LPWSTR) &RegistrationNotify.ErrorMessage, 0,
+                              NULL))
+        {
+          if (0 == LoadStringW(hDllInstance, IDS_UNKNOWN_ERROR,
+                               UnknownError,
+                               sizeof(UnknownError) / sizeof(UnknownError[0] -
+                               20)))
+            {
+              wcscpy(UnknownError, L"Unknown error");
+            }
+          wcscat(UnknownError, L" ");
+          _ultow(LastError, UnknownError + wcslen(UnknownError), 10);
+          RegistrationNotify.ErrorMessage = UnknownError;
+        }
+    }
+
+  RegistrationNotify.Progress = RegistrationData->DllCount;
+  RegistrationNotify.ActivityID = IDS_REGISTERING_COMPONENTS;
+  RegistrationNotify.CurrentItem = NULL;
+  SendMessage(RegistrationData->hwndDlg, PM_REGISTRATION_NOTIFY,
+              1, (LPARAM) &RegistrationNotify);
+  if (NULL != RegistrationNotify.ErrorMessage &&
+      UnknownError != RegistrationNotify.ErrorMessage)
+    {
+      LocalFree((PVOID) RegistrationNotify.ErrorMessage);
+    }
+
+  SetupTermDefaultQueueCallback(RegistrationData->DefaultContext);
+  HeapFree(GetProcessHeap(), 0, RegistrationData);
+
+  return 0;
+}
+
+
+static BOOL
+StartComponentRegistration(HWND hwndDlg, PULONG MaxProgress)
+{
+  HANDLE RegistrationThread;
+  LONG DllCount;
+  INFCONTEXT Context;
+  WCHAR SectionName[512];
+  PREGISTRATIONDATA RegistrationData;
+  
+  DllCount = -1;
+  if (! SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2",
+                            L"RegisterDlls", &Context))
+    {
+      DPRINT1("No RegistrationPhase2 section found\n");
+      return FALSE;
+    }
+  if (! SetupGetStringFieldW(&Context, 1, SectionName,
+                             sizeof(SectionName) / sizeof(SectionName[0]),
+                             NULL))
+    {
+      DPRINT1("Unable to retrieve section name\n");
+      return FALSE;
+    }
+  DllCount = SetupGetLineCountW(hSysSetupInf, SectionName);
+  DPRINT("SectionName %S DllCount %ld\n", SectionName, DllCount);
+  if (DllCount < 0)
+    {
+      SetLastError(STATUS_NOT_FOUND);
+      return FALSE;
+    }
+
+  *MaxProgress = (ULONG) DllCount;
+
+  /*
+   * Create a background thread to do the actual registrations, so the
+   * main thread can just run its message loop.
+   */
+  RegistrationThread = NULL;
+  RegistrationData = HeapAlloc(GetProcessHeap(), 0,
+                               sizeof(REGISTRATIONDATA));
+  if (NULL != RegistrationData)
+    {
+      RegistrationData->hwndDlg = hwndDlg;
+      RegistrationData->DllCount = DllCount;
+      RegistrationThread = CreateThread(NULL, 0, RegistrationProc,
+                                        (LPVOID) RegistrationData, 0, NULL);
+      if (NULL != RegistrationThread)
+        {
+          CloseHandle(RegistrationThread);
+        }
+      else
+        {
+          DPRINT1("CreateThread failed, error %u\n", GetLastError());
+          return FALSE;
+        }
+    }
+  else
+    {
+      DPRINT1("HeapAlloc() failed, error %u\n", GetLastError());
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+
 static INT_PTR CALLBACK
 ProcessPageDlgProc(HWND hwndDlg,
                    UINT uMsg,
@@ -1299,6 +1551,8 @@
                    LPARAM lParam)
 {
   PSETUPDATA SetupData;
+  PREGISTRATIONNOTIFY RegistrationNotify;
+  WCHAR Title[64];
 
   /* Retrieve pointer to the global setup data */
   SetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
@@ -1313,39 +1567,10 @@
         }
         break;
 
-      case WM_TIMER:
-         {
-           INT Position;
-           HWND hWndProgress;
-
-           hWndProgress = GetDlgItem(hwndDlg, IDC_PROCESSPROGRESS);
-           Position = SendMessage(hWndProgress, PBM_GETPOS, 0, 0);
-           if (Position == 2)
-           {
-             KillTimer(hwndDlg, 1);
-
-             /* Enable the Back and Next buttons */
-             PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
-             PropSheet_PressButton(GetParent(hwndDlg), PSBTN_NEXT);
-           }
-           else
-           {
-#ifdef VMWINST
-             if (Position == 1)
-             {
-                KillTimer(hwndDlg, 1);
-                RunVMWInstall(GetParent(hwndDlg));
-                SetTimer(hwndDlg, 1, 50, NULL);
-             }
-#endif
-             SendMessage(hWndProgress, PBM_SETPOS, Position + 1, 0);
-           }
-         }
-         return TRUE;
-
       case WM_NOTIFY:
         {
           LPNMHDR lpnm = (LPNMHDR)lParam;
+          ULONG MaxProgress;
 
           switch (lpnm->code)
             {
@@ -1353,9 +1578,12 @@
                 /* Disable the Back and Next buttons */
                 PropSheet_SetWizButtons(GetParent(hwndDlg), 0);
 
-                SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETRANGE, 0,
-                                   MAKELPARAM(0, 2));
-                SetTimer(hwndDlg, 1, 50, NULL);
+                StartComponentRegistration(hwndDlg, &MaxProgress);
+
+                SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETRANGE,
+                                   0, MAKELPARAM(0, MaxProgress));
+                SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS,
+                                   0, 0);
                 break;
 
               case PSN_WIZNEXT:
@@ -1367,6 +1595,47 @@
         }
         break;
 
+      case PM_REGISTRATION_NOTIFY:
+        {
+          WCHAR Activity[64];
+          RegistrationNotify = (PREGISTRATIONNOTIFY) lParam;
+          if (0 != LoadStringW(hDllInstance, RegistrationNotify->ActivityID,
+                               Activity,
+                               sizeof(Activity) / sizeof(Activity[0])))
+            {
+              SendDlgItemMessageW(hwndDlg, IDC_ACTIVITY, WM_SETTEXT,
+                                  0, (LPARAM) Activity);
+            }
+          SendDlgItemMessageW(hwndDlg, IDC_ITEM, WM_SETTEXT, 0,
+                              (LPARAM)(NULL == RegistrationNotify->CurrentItem ?
+                                       L"" : RegistrationNotify->CurrentItem));
+          SendDlgItemMessage(hwndDlg, IDC_PROCESSPROGRESS, PBM_SETPOS,
+                             RegistrationNotify->Progress, 0);
+          if (NULL != RegistrationNotify->ErrorMessage)
+            {
+              if (0 == LoadStringW(hDllInstance, IDS_REACTOS_SETUP,
+                                   Title, sizeof(Title) / sizeof(Title[0])))
+                {
+                  wcscpy(Title, L"ReactOS Setup");
+                }
+              MessageBoxW(hwndDlg, RegistrationNotify->ErrorMessage,
+                          Title, MB_ICONERROR | MB_OK);
+
+            }
+
+          if (wParam)
+            {
+#ifdef VMWINST
+              RunVMWInstall(GetParent(hwndDlg));
+#endif
+
+              /* Enable the Back and Next buttons */
+              PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_NEXT);
+              PropSheet_PressButton(GetParent(hwndDlg), PSBTN_NEXT);
+            }
+         }
+         return TRUE;
+
       default:
         break;
     }

Modified: trunk/reactos/lib/wininet/wininet.xml
--- trunk/reactos/lib/wininet/wininet.xml	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/lib/wininet/wininet.xml	2005-11-27 22:27:35 UTC (rev 19702)
@@ -1,4 +1,5 @@
 <module name="wininet" type="win32dll" baseaddress="${BASEADDRESS_WININET}" installbase="system32" installname="wininet.dll" allowwarnings="true">
+	<autoregister infsection="OleControlDlls" type="DllInstall" />
 	<importlibrary definition="wininet.spec.def" />
 	<include base="wininet">.</include>
 	<include base="ReactOS">include/wine</include>

Modified: trunk/reactos/media/inf/syssetup.inf.tpl
--- trunk/reactos/media/inf/syssetup.inf.tpl	2005-11-27 22:13:00 UTC (rev 19701)
+++ trunk/reactos/media/inf/syssetup.inf.tpl	2005-11-27 22:27:35 UTC (rev 19702)
@@ -23,4 +23,7 @@
 NET_NIC.inf
 ports.inf
 scsi.inf
-usbport.inf
\ No newline at end of file
+usbport.inf
+
+[RegistrationPhase2]
+RegisterDlls=OleControlDlls