Author: hbelusca
Date: Mon Sep 4 20:00:22 2017
New Revision: 75762
URL:
http://svn.reactos.org/svn/reactos?rev=75762&view=rev
Log:
[USETUP]: Move the SetupExtractFile() function to where it is (only) used.
Modified:
branches/setup_improvements/base/setup/usetup/filequeue.c
branches/setup_improvements/base/setup/usetup/filequeue.h
branches/setup_improvements/base/setup/usetup/filesup.c
branches/setup_improvements/base/setup/usetup/filesup.h
Modified: branches/setup_improvements/base/setup/usetup/filequeue.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/filequeue.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/filequeue.c [iso-8859-1] Mon Sep 4
20:00:22 2017
@@ -57,6 +57,90 @@
/* FUNCTIONS ****************************************************************/
+#ifdef __REACTOS__
+static BOOLEAN HasCurrentCabinet = FALSE;
+static WCHAR CurrentCabinetName[MAX_PATH];
+static CAB_SEARCH Search;
+
+NTSTATUS
+SetupExtractFile(
+ PWCHAR CabinetFileName,
+ PWCHAR SourceFileName,
+ PWCHAR DestinationPathName)
+{
+ ULONG CabStatus;
+
+ DPRINT("SetupExtractFile(CabinetFileName %S, SourceFileName %S,
DestinationPathName %S)\n",
+ CabinetFileName, SourceFileName, DestinationPathName);
+
+ if (HasCurrentCabinet)
+ {
+ DPRINT("CurrentCabinetName: %S\n", CurrentCabinetName);
+ }
+
+ if ((HasCurrentCabinet) && (wcscmp(CabinetFileName, CurrentCabinetName) ==
0))
+ {
+ DPRINT("Using same cabinet as last time\n");
+
+ /* Use our last location because the files should be sequential */
+ CabStatus = CabinetFindNextFileSequential(SourceFileName, &Search);
+ if (CabStatus != CAB_STATUS_SUCCESS)
+ {
+ DPRINT("Sequential miss on file: %S\n", SourceFileName);
+
+ /* Looks like we got unlucky */
+ CabStatus = CabinetFindFirst(SourceFileName, &Search);
+ }
+ }
+ else
+ {
+ DPRINT("Using new cabinet\n");
+
+ if (HasCurrentCabinet)
+ {
+ CabinetCleanup();
+ }
+
+ wcscpy(CurrentCabinetName, CabinetFileName);
+
+ CabinetInitialize();
+ CabinetSetEventHandlers(NULL, NULL, NULL);
+ CabinetSetCabinetName(CabinetFileName);
+
+ CabStatus = CabinetOpen();
+ if (CabStatus == CAB_STATUS_SUCCESS)
+ {
+ DPRINT("Opened cabinet %S\n", CabinetGetCabinetName());
+ HasCurrentCabinet = TRUE;
+ }
+ else
+ {
+ DPRINT("Cannot open cabinet (%d)\n", CabStatus);
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ /* We have to start at the beginning here */
+ CabStatus = CabinetFindFirst(SourceFileName, &Search);
+ }
+
+ if (CabStatus != CAB_STATUS_SUCCESS)
+ {
+ DPRINT1("Unable to find '%S' in cabinet '%S'\n",
SourceFileName, CabinetGetCabinetName());
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ CabinetSetDestinationPath(DestinationPathName);
+ CabStatus = CabinetExtractFile(&Search);
+ if (CabStatus != CAB_STATUS_SUCCESS)
+ {
+ DPRINT("Cannot extract file %S (%d)\n", SourceFileName, CabStatus);
+ return STATUS_UNSUCCESSFUL;
+ }
+
+ return STATUS_SUCCESS;
+}
+#endif
+
HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID)
Modified: branches/setup_improvements/base/setup/usetup/filequeue.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/filequeue.h [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/filequeue.h [iso-8859-1] Mon Sep 4
20:00:22 2017
@@ -69,6 +69,12 @@
/* FUNCTIONS ****************************************************************/
+NTSTATUS
+SetupExtractFile(
+ PWCHAR CabinetFileName,
+ PWCHAR SourceFileName,
+ PWCHAR DestinationFileName);
+
HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID);
Modified: branches/setup_improvements/base/setup/usetup/filesup.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/filesup.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/filesup.c [iso-8859-1] Mon Sep 4
20:00:22 2017
@@ -15,10 +15,6 @@
#include <debug.h>
/* FUNCTIONS ****************************************************************/
-
-static BOOLEAN HasCurrentCabinet = FALSE;
-static WCHAR CurrentCabinetName[MAX_PATH];
-static CAB_SEARCH Search;
static
NTSTATUS
@@ -143,86 +139,6 @@
return Status;
}
-#ifdef __REACTOS__
-NTSTATUS
-SetupExtractFile(
- PWCHAR CabinetFileName,
- PWCHAR SourceFileName,
- PWCHAR DestinationPathName)
-{
- ULONG CabStatus;
-
- DPRINT("SetupExtractFile(CabinetFileName %S, SourceFileName %S,
DestinationPathName %S)\n",
- CabinetFileName, SourceFileName, DestinationPathName);
-
- if (HasCurrentCabinet)
- {
- DPRINT("CurrentCabinetName: %S\n", CurrentCabinetName);
- }
-
- if ((HasCurrentCabinet) && (wcscmp(CabinetFileName, CurrentCabinetName) ==
0))
- {
- DPRINT("Using same cabinet as last time\n");
-
- /* Use our last location because the files should be sequential */
- CabStatus = CabinetFindNextFileSequential(SourceFileName, &Search);
- if (CabStatus != CAB_STATUS_SUCCESS)
- {
- DPRINT("Sequential miss on file: %S\n", SourceFileName);
-
- /* Looks like we got unlucky */
- CabStatus = CabinetFindFirst(SourceFileName, &Search);
- }
- }
- else
- {
- DPRINT("Using new cabinet\n");
-
- if (HasCurrentCabinet)
- {
- CabinetCleanup();
- }
-
- wcscpy(CurrentCabinetName, CabinetFileName);
-
- CabinetInitialize();
- CabinetSetEventHandlers(NULL, NULL, NULL);
- CabinetSetCabinetName(CabinetFileName);
-
- CabStatus = CabinetOpen();
- if (CabStatus == CAB_STATUS_SUCCESS)
- {
- DPRINT("Opened cabinet %S\n", CabinetGetCabinetName());
- HasCurrentCabinet = TRUE;
- }
- else
- {
- DPRINT("Cannot open cabinet (%d)\n", CabStatus);
- return STATUS_UNSUCCESSFUL;
- }
-
- /* We have to start at the beginning here */
- CabStatus = CabinetFindFirst(SourceFileName, &Search);
- }
-
- if (CabStatus != CAB_STATUS_SUCCESS)
- {
- DPRINT1("Unable to find '%S' in cabinet '%S'\n",
SourceFileName, CabinetGetCabinetName());
- return STATUS_UNSUCCESSFUL;
- }
-
- CabinetSetDestinationPath(DestinationPathName);
- CabStatus = CabinetExtractFile(&Search);
- if (CabStatus != CAB_STATUS_SUCCESS)
- {
- DPRINT("Cannot extract file %S (%d)\n", SourceFileName, CabStatus);
- return STATUS_UNSUCCESSFUL;
- }
-
- return STATUS_SUCCESS;
-}
-#endif
-
BOOLEAN
IsValidPath(
IN PWCHAR InstallDir,
Modified: branches/setup_improvements/base/setup/usetup/filesup.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/filesup.h [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/filesup.h [iso-8859-1] Mon Sep 4
20:00:22 2017
@@ -13,12 +13,6 @@
SetupCreateDirectory(
PWCHAR DirectoryName);
-NTSTATUS
-SetupExtractFile(
- PWCHAR CabinetFileName,
- PWCHAR SourceFileName,
- PWCHAR DestinationFileName);
-
BOOLEAN
IsValidPath(
IN PWCHAR InstallDir,