2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS GUI first stage setup application
4 * FILE: base/setup/lib/fileqsup.c
5 * PURPOSE: Interfacing with Setup* API File Queue support functions
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
9 /* INCLUDES *****************************************************************/
16 /* SETUP* API COMPATIBILITY FUNCTIONS ****************************************/
18 /* A simplified version of SetupQueueCopyW that wraps Cabinet support around */
21 SpFileQueueCopy_NtToWin32(
22 IN HSPFILEQ QueueHandle
,
23 IN PCWSTR SourceRootPath
,
24 IN PCWSTR SourcePath OPTIONAL
,
25 IN PCWSTR SourceFileName
,
26 IN PCWSTR SourceDescription OPTIONAL
,
27 IN PCWSTR SourceCabinet OPTIONAL
,
28 IN PCWSTR SourceTagFile OPTIONAL
,
29 IN PCWSTR TargetDirectory
,
30 IN PCWSTR TargetFileName OPTIONAL
,
33 WCHAR Win32SourceRootPath
[MAX_PATH
];
34 WCHAR Win32TargetDirectory
[MAX_PATH
];
37 * SpFileQueueCopy is called within setuplib with NT paths, however
38 * the Win32 SetupQueueCopyW API only takes Win32 paths. We therefore
39 * map the NT path to Win32 path and then call the Win32 API.
41 if (!ConvertNtPathToWin32Path(Win32SourceRootPath
,
42 _countof(Win32SourceRootPath
),
47 /* SourcePath, SourceFileName and SourceCabinet are appended to SourceRootPath by the SetupApi function */
49 if (!ConvertNtPathToWin32Path(Win32TargetDirectory
,
50 _countof(Win32TargetDirectory
),
55 /* TargetFileName is appended to TargetDirectory by the SetupApi function */
58 * Use the undocumented way of copying files from within a given cabinet file
59 * *ONLY IF* the files do not already exist in the same directory where
60 * the cabinet file resides!!
62 return SetupQueueCopyW(QueueHandle
,
66 // Undocumented on MSDN is the fact that this parameter is mandatory *IF* one wants to take the TagFile into account!
68 // SourceTagFile -- Special behaviour: use cabinet file present in ArchiveDir path! The API does not check for a ".cab" extension.
72 // We choose to decompress the archive, so do NOT specify SP_COPY_NODECOMP !
73 SP_COPY_NOOVERWRITE
/* | SP_COPY_SOURCE_ABSOLUTE | SP_COPY_SOURCEPATH_ABSOLUTE */
79 SpFileQueueDelete_NtToWin32(
80 IN HSPFILEQ QueueHandle
,
82 IN PCWSTR PathPart2 OPTIONAL
)
84 WCHAR Win32PathPart1
[MAX_PATH
];
87 * SpFileQueueDelete is called within setuplib with NT paths, however
88 * the Win32 SetupQueueDeleteW API only takes Win32 paths. We therefore
89 * map the NT path to Win32 path and then call the Win32 API.
91 if (!ConvertNtPathToWin32Path(Win32PathPart1
,
92 _countof(Win32PathPart1
),
97 /* PathPart2 is appended to PathPart1 by the SetupApi function */
99 return SetupQueueDeleteW(QueueHandle
, Win32PathPart1
, PathPart2
);
104 SpFileQueueRename_NtToWin32(
105 IN HSPFILEQ QueueHandle
,
106 IN PCWSTR SourcePath
,
107 IN PCWSTR SourceFileName OPTIONAL
,
108 IN PCWSTR TargetPath OPTIONAL
,
109 IN PCWSTR TargetFileName
)
111 WCHAR Win32SourcePath
[MAX_PATH
];
112 WCHAR Win32TargetPath
[MAX_PATH
];
115 * SpFileQueueRename is called within setuplib with NT paths, however
116 * the Win32 SetupQueueRenameW API only takes Win32 paths. We therefore
117 * map the NT path to Win32 path and then call the Win32 API.
119 if (!ConvertNtPathToWin32Path(Win32SourcePath
,
120 _countof(Win32SourcePath
),
125 /* SourceFileName is appended to SourcePath by the SetupApi function */
129 if (!ConvertNtPathToWin32Path(Win32TargetPath
,
130 _countof(Win32TargetPath
),
136 /* TargetFileName is appended to TargetPath by the SetupApi function */
138 return SetupQueueRenameW(QueueHandle
,
141 TargetPath
? Win32TargetPath
: NULL
,
146 /* GLOBALS *******************************************************************/
148 pSpFileQueueOpen SpFileQueueOpen
= SetupOpenFileQueue
;
149 pSpFileQueueClose SpFileQueueClose
= SetupCloseFileQueue
;
150 pSpFileQueueCopy SpFileQueueCopy
= SpFileQueueCopy_NtToWin32
;
151 pSpFileQueueDelete SpFileQueueDelete
= SpFileQueueDelete_NtToWin32
;
152 pSpFileQueueRename SpFileQueueRename
= SpFileQueueRename_NtToWin32
;
153 pSpFileQueueCommit SpFileQueueCommit
= SetupCommitFileQueueW
;