https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c3ab29682ad9568a8e333…
commit c3ab29682ad9568a8e3339e2d9a9e9e84ca987d4
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Sep 4 20:00:22 2017 +0000
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Oct 28 00:59:44 2018 +0200
[USETUP] Move the SetupExtractFile() function to where it is (only) used.
svn path=/branches/setup_improvements/; revision=75762
---
base/setup/usetup/filequeue.c | 82 +++++++++++++++++++++++++++++++++++++++++++
base/setup/usetup/filequeue.h | 6 ++++
base/setup/usetup/filesup.c | 82 -------------------------------------------
base/setup/usetup/filesup.h | 6 ----
4 files changed, 88 insertions(+), 88 deletions(-)
diff --git a/base/setup/usetup/filequeue.c b/base/setup/usetup/filequeue.c
index 2d928fb714..b49e56e9ba 100644
--- a/base/setup/usetup/filequeue.c
+++ b/base/setup/usetup/filequeue.c
@@ -56,6 +56,88 @@ typedef struct _FILEQUEUEHEADER
/* FUNCTIONS ****************************************************************/
+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;
+}
+
HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID)
diff --git a/base/setup/usetup/filequeue.h b/base/setup/usetup/filequeue.h
index f43ef91462..1623440035 100644
--- a/base/setup/usetup/filequeue.h
+++ b/base/setup/usetup/filequeue.h
@@ -69,6 +69,12 @@ typedef struct _COPYCONTEXT
/* FUNCTIONS ****************************************************************/
+NTSTATUS
+SetupExtractFile(
+ PWCHAR CabinetFileName,
+ PWCHAR SourceFileName,
+ PWCHAR DestinationFileName);
+
HSPFILEQ
WINAPI
SetupOpenFileQueue(VOID);
diff --git a/base/setup/usetup/filesup.c b/base/setup/usetup/filesup.c
index fa13a0dbe1..b648471084 100644
--- a/base/setup/usetup/filesup.c
+++ b/base/setup/usetup/filesup.c
@@ -15,10 +15,6 @@
/* FUNCTIONS ****************************************************************/
-static BOOLEAN HasCurrentCabinet = FALSE;
-static WCHAR CurrentCabinetName[MAX_PATH];
-static CAB_SEARCH Search;
-
static
NTSTATUS
SetupCreateSingleDirectory(
@@ -142,84 +138,6 @@ done:
return Status;
}
-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;
-}
-
BOOLEAN
IsValidPath(
IN PCWSTR InstallDir)
diff --git a/base/setup/usetup/filesup.h b/base/setup/usetup/filesup.h
index 884d384efa..a441ea4451 100644
--- a/base/setup/usetup/filesup.h
+++ b/base/setup/usetup/filesup.h
@@ -12,12 +12,6 @@ NTSTATUS
SetupCreateDirectory(
PWCHAR DirectoryName);
-NTSTATUS
-SetupExtractFile(
- PWCHAR CabinetFileName,
- PWCHAR SourceFileName,
- PWCHAR DestinationFileName);
-
BOOLEAN
IsValidPath(
IN PCWSTR InstallDir);