ReactOS 0.4.15-dev-8116-gf69e256
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 826 of file install.c.

830{
832
834 (HSPFILEQ)pSetupData->SetupFileQueue,
835 MsgHandler,
836 Context);
837
838 SpFileQueueClose((HSPFILEQ)pSetupData->SetupFileQueue);
839 pSetupData->SetupFileQueue = NULL;
840
841 return Success;
842}
unsigned char BOOLEAN
#define NULL
Definition: types.h:112
@ Success
Definition: eventcreate.c:712
pSpFileQueueClose SpFileQueueClose
Definition: fileqsup.c:1001
pSpFileQueueCommit SpFileQueueCommit
Definition: fileqsup.c:1005

Referenced by FileCopyPage(), and PrepareAndDoCopyThread().

◆ PrepareFileCopy()

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

Definition at line 684 of file install.c.

687{
688 HINF InfHandle;
689 INFCONTEXT CabinetsContext;
690 PCWSTR CabinetName;
691 UINT ErrorLine;
692#if defined(__REACTOS__) && defined(USE_CABINET_INF)
693 ULONG InfFileSize;
694 PVOID InfFileData;
695 CABINET_CONTEXT CabinetContext;
696#endif
697 WCHAR PathBuffer[MAX_PATH];
698
699 /* Create the file queue */
700 pSetupData->SetupFileQueue = (PVOID)SpFileQueueOpen();
701 if (pSetupData->SetupFileQueue == NULL)
702 {
703 pSetupData->LastErrorNumber = ERROR_COPY_QUEUE;
704 if (pSetupData->ErrorRoutine)
705 pSetupData->ErrorRoutine(pSetupData);
706 return FALSE;
707 }
708
709 /* Prepare the copy of the common files that are not in installation cabinets */
710 if (!PrepareCopyInfFile(pSetupData, pSetupData->SetupInf, NULL))
711 {
712 /* FIXME: show an error dialog */
713 return FALSE;
714 }
715
716 /* Search for the 'Cabinets' section */
717 if (!SpInfFindFirstLine(pSetupData->SetupInf, L"Cabinets", NULL, &CabinetsContext))
718 {
719 /* Skip this step and return success if no cabinet file is listed */
720 return TRUE;
721 }
722
723 /*
724 * Enumerate the installation cabinets listed in the
725 * 'Cabinets' section and parse their inf files.
726 */
727 do
728 {
729 if (!INF_GetData(&CabinetsContext, NULL, &CabinetName))
730 break;
731
732 CombinePaths(PathBuffer, ARRAYSIZE(PathBuffer), 2,
733 pSetupData->SourcePath.Buffer, CabinetName);
734
735#if defined(__REACTOS__) && defined(USE_CABINET_INF)
736 INF_FreeData(CabinetName);
737
738 CabinetInitialize(&CabinetContext);
739 CabinetSetEventHandlers(&CabinetContext, NULL, NULL, NULL);
740 CabinetSetCabinetName(&CabinetContext, PathBuffer);
741
742 if (CabinetOpen(&CabinetContext) == CAB_STATUS_SUCCESS)
743 {
744 DPRINT("Cabinet %S\n", PathBuffer);
745
746 InfFileData = CabinetGetCabinetReservedArea(&CabinetContext, &InfFileSize);
747 if (InfFileData == NULL)
748 {
749 CabinetCleanup(&CabinetContext);
750
751 pSetupData->LastErrorNumber = ERROR_CABINET_SCRIPT;
752 if (pSetupData->ErrorRoutine)
753 pSetupData->ErrorRoutine(pSetupData, PathBuffer);
754 return FALSE;
755 }
756 }
757 else
758 {
759 DPRINT("Cannot open cabinet: %S.\n", PathBuffer);
760 CabinetCleanup(&CabinetContext);
761
762 pSetupData->LastErrorNumber = ERROR_CABINET_MISSING;
763 if (pSetupData->ErrorRoutine)
764 pSetupData->ErrorRoutine(pSetupData, PathBuffer);
765 return FALSE;
766 }
767
768 InfHandle = INF_OpenBufferedFileA((PSTR)InfFileData,
769 InfFileSize,
770 NULL,
772 pSetupData->LanguageId,
773 &ErrorLine);
774
775 CabinetCleanup(&CabinetContext);
776#else
777 {
778 PWCHAR ptr;
779
780 /* First find the filename */
781 ptr = wcsrchr(PathBuffer, L'\\');
782 if (!ptr) ptr = PathBuffer;
783
784 /* Then find its extension */
785 ptr = wcsrchr(ptr, L'.');
786 if (!ptr)
787 ptr = PathBuffer + wcslen(PathBuffer);
788
789 /* Replace it by '.inf' */
790 wcscpy(ptr, L".inf");
791
792 InfHandle = SpInfOpenInfFile(PathBuffer,
793 NULL,
795 pSetupData->LanguageId,
796 &ErrorLine);
797 }
798#endif
799
800 if (InfHandle == INVALID_HANDLE_VALUE)
801 {
802 pSetupData->LastErrorNumber = ERROR_INVALID_CABINET_INF;
803 if (pSetupData->ErrorRoutine)
804 pSetupData->ErrorRoutine(pSetupData, PathBuffer);
805 return FALSE;
806 }
807
808 if (!PrepareCopyInfFile(pSetupData, InfHandle, CabinetName))
809 {
810#if !(defined(__REACTOS__) && defined(USE_CABINET_INF))
811 SpInfCloseInfFile(InfHandle);
812#endif
813 /* FIXME: show an error dialog */
814 return FALSE;
815 }
816
817#if !(defined(__REACTOS__) && defined(USE_CABINET_INF))
818 SpInfCloseInfFile(InfHandle);
819#endif
820 } while (SpInfFindNextLine(&CabinetsContext, &CabinetsContext));
821
822 return TRUE;
823}
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:246
ULONG CabinetOpen(IN OUT PCABINET_CONTEXT CabinetContext)
Definition: cabinet.c:627
PVOID CabinetGetCabinetReservedArea(IN PCABINET_CONTEXT CabinetContext, OUT PULONG Size)
Definition: cabinet.c:1363
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:1346
VOID CabinetInitialize(IN OUT PCABINET_CONTEXT CabinetContext)
Definition: cabinet.c:507
VOID CabinetCleanup(IN OUT PCABINET_CONTEXT CabinetContext)
Definition: cabinet.c:535
VOID CabinetSetCabinetName(IN PCABINET_CONTEXT CabinetContext, IN PCWSTR FileName)
Definition: cabinet.c:586
#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:44
@ ERROR_CABINET_SCRIPT
Definition: errorcode.h:45
@ ERROR_COPY_QUEUE
Definition: errorcode.h:46
@ ERROR_INVALID_CABINET_INF
Definition: errorcode.h:43
pSpFileQueueOpen SpFileQueueOpen
Definition: fileqsup.c:1000
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
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:73
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
void * PVOID
Definition: typedefs.h:50
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PrepareAndDoCopyThread(), and PrepareCopyPage().