ReactOS 0.4.15-dev-5664-g3bf4ef6
install.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum _FILE_COPY_STATUS FILE_COPY_STATUS
 
typedef VOID(__cdeclPFILE_COPY_STATUS_ROUTINE) (IN FILE_COPY_STATUS,...)
 

Enumerations

enum  _FILE_COPY_STATUS { None = 0 }
 

Functions

BOOLEAN PrepareFileCopy (IN OUT PUSETUP_DATA pSetupData, IN PFILE_COPY_STATUS_ROUTINE StatusRoutine OPTIONAL)
 
BOOLEAN DoFileCopy (IN OUT PUSETUP_DATA pSetupData, IN PSP_FILE_CALLBACK_W MsgHandler, IN PVOID Context OPTIONAL)
 

Typedef Documentation

◆ FILE_COPY_STATUS

◆ PFILE_COPY_STATUS_ROUTINE

typedef VOID(__cdecl * PFILE_COPY_STATUS_ROUTINE) (IN FILE_COPY_STATUS,...)

Definition at line 18 of file install.h.

Enumeration Type Documentation

◆ _FILE_COPY_STATUS

Enumerator
None 

Definition at line 12 of file install.h.

13{
14 None = 0,
15 // Success = 0,
enum _FILE_COPY_STATUS FILE_COPY_STATUS
@ None
Definition: install.h:14

Function Documentation

◆ DoFileCopy()

BOOLEAN DoFileCopy ( IN OUT PUSETUP_DATA  pSetupData,
IN PSP_FILE_CALLBACK_W  MsgHandler,
IN PVOID Context  OPTIONAL 
)

Definition at line 818 of file install.c.

822{
824
826 (HSPFILEQ)pSetupData->SetupFileQueue,
827 MsgHandler,
828 Context);
829
830 SpFileQueueClose((HSPFILEQ)pSetupData->SetupFileQueue);
831 pSetupData->SetupFileQueue = NULL;
832
833 return Success;
834}
unsigned char BOOLEAN
#define NULL
Definition: types.h:112
@ Success
Definition: eventcreate.c:712
pSpFileQueueClose SpFileQueueClose
Definition: fileqsup.c:154
pSpFileQueueCommit SpFileQueueCommit
Definition: fileqsup.c:158

Referenced by FileCopyPage(), and PrepareAndDoCopyThread().

◆ PrepareFileCopy()

BOOLEAN PrepareFileCopy ( IN OUT PUSETUP_DATA  pSetupData,
IN PFILE_COPY_STATUS_ROUTINE StatusRoutine  OPTIONAL 
)

Definition at line 676 of file install.c.

679{
680 HINF InfHandle;
681 INFCONTEXT CabinetsContext;
682 PCWSTR CabinetName;
683 UINT ErrorLine;
684#if defined(__REACTOS__) && defined(USE_CABINET_INF)
685 ULONG InfFileSize;
686 PVOID InfFileData;
687 CABINET_CONTEXT CabinetContext;
688#endif
689 WCHAR PathBuffer[MAX_PATH];
690
691 /* Create the file queue */
692 pSetupData->SetupFileQueue = (PVOID)SpFileQueueOpen();
693 if (pSetupData->SetupFileQueue == NULL)
694 {
695 pSetupData->LastErrorNumber = ERROR_COPY_QUEUE;
696 if (pSetupData->ErrorRoutine)
697 pSetupData->ErrorRoutine(pSetupData);
698 return FALSE;
699 }
700
701 /* Prepare the copy of the common files that are not in installation cabinets */
702 if (!PrepareCopyInfFile(pSetupData, pSetupData->SetupInf, NULL))
703 {
704 /* FIXME: show an error dialog */
705 return FALSE;
706 }
707
708 /* Search for the 'Cabinets' section */
709 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"Cabinets", NULL, &CabinetsContext))
710 {
711 /* Skip this step and return success if no cabinet file is listed */
712 return TRUE;
713 }
714
715 /*
716 * Enumerate the installation cabinets listed in the
717 * 'Cabinets' section and parse their inf files.
718 */
719 do
720 {
721 if (!INF_GetData(&CabinetsContext, NULL, &CabinetName))
722 break;
723
724 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
725 pSetupData->SourcePath.Buffer, CabinetName);
726
727#if defined(__REACTOS__) && defined(USE_CABINET_INF)
728 INF_FreeData(CabinetName);
729
730 CabinetInitialize(&CabinetContext);
731 CabinetSetEventHandlers(&CabinetContext, NULL, NULL, NULL);
732 CabinetSetCabinetName(&CabinetContext, PathBuffer);
733
734 if (CabinetOpen(&CabinetContext) == CAB_STATUS_SUCCESS)
735 {
736 DPRINT("Cabinet %S\n", PathBuffer);
737
738 InfFileData = CabinetGetCabinetReservedArea(&CabinetContext, &InfFileSize);
739 if (InfFileData == NULL)
740 {
741 CabinetCleanup(&CabinetContext);
742
743 pSetupData->LastErrorNumber = ERROR_CABINET_SCRIPT;
744 if (pSetupData->ErrorRoutine)
745 pSetupData->ErrorRoutine(pSetupData, PathBuffer);
746 return FALSE;
747 }
748 }
749 else
750 {
751 DPRINT("Cannot open cabinet: %S.\n", PathBuffer);
752 CabinetCleanup(&CabinetContext);
753
754 pSetupData->LastErrorNumber = ERROR_CABINET_MISSING;
755 if (pSetupData->ErrorRoutine)
756 pSetupData->ErrorRoutine(pSetupData, PathBuffer);
757 return FALSE;
758 }
759
760 InfHandle = INF_OpenBufferedFileA((PSTR)InfFileData,
761 InfFileSize,
762 NULL,
764 pSetupData->LanguageId,
765 &ErrorLine);
766
767 CabinetCleanup(&CabinetContext);
768#else
769 {
770 PWCHAR ptr;
771
772 /* First find the filename */
773 ptr = wcsrchr(PathBuffer, L'\\');
774 if (!ptr) ptr = PathBuffer;
775
776 /* Then find its extension */
777 ptr = wcsrchr(ptr, L'.');
778 if (!ptr)
779 ptr = PathBuffer + wcslen(PathBuffer);
780
781 /* Replace it by '.inf' */
782 wcscpy(ptr, L".inf");
783
784 InfHandle = SpInfOpenInfFile(PathBuffer,
785 NULL,
787 pSetupData->LanguageId,
788 &ErrorLine);
789 }
790#endif
791
792 if (InfHandle == INVALID_HANDLE_VALUE)
793 {
794 pSetupData->LastErrorNumber = ERROR_INVALID_CABINET_INF;
795 if (pSetupData->ErrorRoutine)
796 pSetupData->ErrorRoutine(pSetupData, PathBuffer);
797 return FALSE;
798 }
799
800 if (!PrepareCopyInfFile(pSetupData, InfHandle, CabinetName))
801 {
802#if !(defined(__REACTOS__) && defined(USE_CABINET_INF))
803 SpInfCloseInfFile(InfHandle);
804#endif
805 /* FIXME: show an error dialog */
806 return FALSE;
807 }
808
809#if !(defined(__REACTOS__) && defined(USE_CABINET_INF))
810 SpInfCloseInfFile(InfHandle);
811#endif
812 } while (SpInfFindNextLine(&CabinetsContext, &CabinetsContext));
813
814 return TRUE;
815}
BOOLEAN PrepareCopyInfFile(IN OUT PUSETUP_DATA pSetupData, IN HINF InfFile, IN PCWSTR SourceCabinet OPTIONAL)
Definition: install.c:504
#define CAB_STATUS_SUCCESS
Definition: cabinet.h:23
HINF WINAPI INF_OpenBufferedFileA(IN PSTR FileBuffer, IN ULONG FileSize, IN PCSTR InfClass, IN DWORD InfStyle, IN LCID LocaleId, OUT PUINT ErrorLine)
Definition: infsupp.c:244
ULONG CabinetOpen(IN OUT PCABINET_CONTEXT CabinetContext)
Definition: cabinet.c:621
PVOID CabinetGetCabinetReservedArea(IN PCABINET_CONTEXT CabinetContext, OUT PULONG Size)
Definition: cabinet.c:1357
VOID CabinetSetEventHandlers(IN PCABINET_CONTEXT CabinetContext, IN PCABINET_OVERWRITE Overwrite, IN PCABINET_EXTRACT Extract, IN PCABINET_DISK_CHANGE DiskChange, IN PCABINET_CREATE_FILE CreateFile)
Definition: cabinet.c:1340
VOID CabinetInitialize(IN OUT PCABINET_CONTEXT CabinetContext)
Definition: cabinet.c:501
VOID CabinetCleanup(IN OUT PCABINET_CONTEXT CabinetContext)
Definition: cabinet.c:529
VOID CabinetSetCabinetName(IN PCABINET_CONTEXT CabinetContext, IN PCWSTR FileName)
Definition: cabinet.c:580
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define wcsrchr
Definition: compat.h:16
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
@ ERROR_CABINET_MISSING
Definition: errorcode.h:45
@ ERROR_CABINET_SCRIPT
Definition: errorcode.h:46
@ ERROR_COPY_QUEUE
Definition: errorcode.h:47
@ ERROR_INVALID_CABINET_INF
Definition: errorcode.h:44
pSpFileQueueOpen SpFileQueueOpen
Definition: fileqsup.c:153
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:681
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define INF_STYLE_WIN4
Definition: infsupp.h:41
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
FORCEINLINE VOID INF_FreeData(IN PCWSTR InfData)
Definition: infsupp.h:157
pSpInfOpenInfFile SpInfOpenInfFile
Definition: infsupp.c:95
pSpInfCloseInfFile SpInfCloseInfFile
Definition: infsupp.c:86
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:90
signed char * PSTR
Definition: retypes.h:7
void * PVOID
Definition: retypes.h:9
unsigned int ULONG
Definition: retypes.h:1
static PVOID ptr
Definition: dispmode.c:27
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define DPRINT
Definition: sndvol32.h:71
const uint16_t * PCWSTR
Definition: typedefs.h:57
uint16_t * PWCHAR
Definition: typedefs.h:56
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PrepareAndDoCopyThread(), and PrepareCopyPage().