[SYSSETUP]
authorThomas Faber <thomas.faber@reactos.org>
Mon, 20 Apr 2015 09:35:39 +0000 (09:35 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 20 Apr 2015 09:35:39 +0000 (09:35 +0000)
- Addendum to r66069: also install tcpip on the livecd
CORE-9564 CORE-9113

svn path=/trunk/; revision=67324

reactos/dll/win32/syssetup/install.c
reactos/dll/win32/syssetup/wizard.c

index 5ef77be..22906a4 100644 (file)
@@ -754,6 +754,71 @@ error:
     return FALSE;
 }
 
+/* Install a section of a .inf file
+ * Returns TRUE if success, FALSE if failure. Error code can
+ * be retrieved with GetLastError()
+ */
+static
+BOOL
+InstallInfSection(
+    IN HWND hWnd,
+    IN LPCWSTR InfFile,
+    IN LPCWSTR InfSection OPTIONAL,
+    IN LPCWSTR InfService OPTIONAL)
+{
+    WCHAR Buffer[MAX_PATH];
+    HINF hInf = INVALID_HANDLE_VALUE;
+    UINT BufferSize;
+    PVOID Context = NULL;
+    BOOL ret = FALSE;
+
+    /* Get Windows directory */
+    BufferSize = MAX_PATH - 5 - wcslen(InfFile);
+    if (GetWindowsDirectoryW(Buffer, BufferSize) > BufferSize)
+    {
+        /* Function failed */
+        SetLastError(ERROR_GEN_FAILURE);
+        goto cleanup;
+    }
+    /* We have enough space to add some information in the buffer */
+    if (Buffer[wcslen(Buffer) - 1] != '\\')
+        wcscat(Buffer, L"\\");
+    wcscat(Buffer, L"Inf\\");
+    wcscat(Buffer, InfFile);
+
+    /* Install specified section */
+    hInf = SetupOpenInfFileW(Buffer, NULL, INF_STYLE_WIN4, NULL);
+    if (hInf == INVALID_HANDLE_VALUE)
+        goto cleanup;
+
+    Context = SetupInitDefaultQueueCallback(hWnd);
+    if (Context == NULL)
+        goto cleanup;
+
+    ret = TRUE;
+    if (ret && InfSection)
+    {
+        ret = SetupInstallFromInfSectionW(
+            hWnd, hInf,
+            InfSection, SPINST_ALL,
+            NULL, NULL, SP_COPY_NEWER,
+            SetupDefaultQueueCallbackW, Context,
+            NULL, NULL);
+    }
+    if (ret && InfService)
+    {
+        ret = SetupInstallServicesFromInfSectionW(
+            hInf, InfService, 0);
+    }
+
+cleanup:
+    if (Context)
+        SetupTermDefaultQueueCallback(Context);
+    if (hInf != INVALID_HANDLE_VALUE)
+        SetupCloseInfFile(hInf);
+    return ret;
+}
+
 DWORD WINAPI
 InstallLiveCD(IN HINSTANCE hInstance)
 {
@@ -761,6 +826,21 @@ InstallLiveCD(IN HINSTANCE hInstance)
     PROCESS_INFORMATION ProcessInformation;
     BOOL bRes;
 
+    /* Hack: Install TCP/IP protocol driver */
+    bRes = InstallInfSection(NULL,
+                            L"nettcpip.inf",
+                            L"MS_TCPIP.PrimaryInstall",
+                            L"MS_TCPIP.PrimaryInstall.Services");
+    if (!bRes && GetLastError() != ERROR_FILE_NOT_FOUND)
+    {
+        DPRINT("InstallInfSection() failed with error 0x%lx\n", GetLastError());
+    }
+    else
+    {
+        /* Start the TCP/IP protocol driver */
+        SetupStartService(L"Tcpip", FALSE);
+    }
+
     if (!CommonInstall())
         goto error;
 
@@ -846,71 +926,6 @@ SetSetupType(DWORD dwSetupType)
     return TRUE;
 }
 
-/* Install a section of a .inf file
- * Returns TRUE if success, FALSE if failure. Error code can
- * be retrieved with GetLastError()
- */
-static
-BOOL
-InstallInfSection(
-    IN HWND hWnd,
-    IN LPCWSTR InfFile,
-    IN LPCWSTR InfSection OPTIONAL,
-    IN LPCWSTR InfService OPTIONAL)
-{
-    WCHAR Buffer[MAX_PATH];
-    HINF hInf = INVALID_HANDLE_VALUE;
-    UINT BufferSize;
-    PVOID Context = NULL;
-    BOOL ret = FALSE;
-
-    /* Get Windows directory */
-    BufferSize = MAX_PATH - 5 - wcslen(InfFile);
-    if (GetWindowsDirectoryW(Buffer, BufferSize) > BufferSize)
-    {
-        /* Function failed */
-        SetLastError(ERROR_GEN_FAILURE);
-        goto cleanup;
-    }
-    /* We have enough space to add some information in the buffer */
-    if (Buffer[wcslen(Buffer) - 1] != '\\')
-        wcscat(Buffer, L"\\");
-    wcscat(Buffer, L"Inf\\");
-    wcscat(Buffer, InfFile);
-
-    /* Install specified section */
-    hInf = SetupOpenInfFileW(Buffer, NULL, INF_STYLE_WIN4, NULL);
-    if (hInf == INVALID_HANDLE_VALUE)
-        goto cleanup;
-
-    Context = SetupInitDefaultQueueCallback(hWnd);
-    if (Context == NULL)
-        goto cleanup;
-
-    ret = TRUE;
-    if (ret && InfSection)
-    {
-        ret = SetupInstallFromInfSectionW(
-            hWnd, hInf,
-            InfSection, SPINST_ALL,
-            NULL, NULL, SP_COPY_NEWER,
-            SetupDefaultQueueCallbackW, Context,
-            NULL, NULL);
-    }
-    if (ret && InfService)
-    {
-        ret = SetupInstallServicesFromInfSectionW(
-            hInf, InfService, 0);
-    }
-
-cleanup:
-    if (Context)
-        SetupTermDefaultQueueCallback(Context);
-    if (hInf != INVALID_HANDLE_VALUE)
-        SetupCloseInfFile(hInf);
-    return ret;
-}
-
 static DWORD CALLBACK
 HotkeyThread(LPVOID Parameter)
 {
index e65dffa..51230bc 100644 (file)
@@ -1807,7 +1807,7 @@ StartComponentRegistration(HWND hwndDlg, PULONG MaxProgress)
         RegistrationData->hwndDlg = hwndDlg;
         RegistrationData->DllCount = DllCount;
         RegistrationThread = CreateThread(NULL, 0, RegistrationProc,
-                                          (LPVOID) RegistrationData, 0, NULL);
+                                          RegistrationData, 0, NULL);
         if (RegistrationThread != NULL)
         {
             CloseHandle(RegistrationThread);