mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
[USETUP] Move the SetupExtractFile() function to where it is (only) used.
svn path=/branches/setup_improvements/; revision=75762
This commit is contained in:
parent
48aab0fb20
commit
c3ab29682a
4 changed files with 88 additions and 88 deletions
|
@ -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)
|
||||
|
|
|
@ -69,6 +69,12 @@ typedef struct _COPYCONTEXT
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
SetupExtractFile(
|
||||
PWCHAR CabinetFileName,
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName);
|
||||
|
||||
HSPFILEQ
|
||||
WINAPI
|
||||
SetupOpenFileQueue(VOID);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -12,12 +12,6 @@ NTSTATUS
|
|||
SetupCreateDirectory(
|
||||
PWCHAR DirectoryName);
|
||||
|
||||
NTSTATUS
|
||||
SetupExtractFile(
|
||||
PWCHAR CabinetFileName,
|
||||
PWCHAR SourceFileName,
|
||||
PWCHAR DestinationFileName);
|
||||
|
||||
BOOLEAN
|
||||
IsValidPath(
|
||||
IN PCWSTR InstallDir);
|
||||
|
|
Loading…
Reference in a new issue