[This function is available for use in the operating systems indicated in the Requirements section. It may be altered or unavailable in subsequent versions. SetupAPI should no longer be used for installing applications. Instead, use the Windows Installer for developing application installers. SetupAPI continues to be used for installing device drivers.]
The SetupInstallFileEx function installs a file as specified either by an INFCONTEXT returned by SetupFindXXXLine or explicitly by the filename and path information. This function is the same as SetupInstallFile, except that a BOOL is returned that indicates whether the file was in use.
If a file is copied, the caller of this function is required to have privileges to write into the target directory.
SyntaxWINSETUPAPI BOOL SetupInstallFileExA(
[in] HINF InfHandle,
[in] PINFCONTEXT InfContext,
[in] PCSTR SourceFile,
[in] PCSTR SourcePathRoot,
[in] PCSTR DestinationName,
[in] DWORD CopyStyle,
[in] PSP_FILE_CALLBACK_A CopyMsgHandler,
[in] PVOID Context,
[out] PBOOL FileWasInUse
);
Parameters
[in] InfHandle
Optional pointer to the handle to an INF file that contains the SourceDisksNames and SourceDisksFiles sections. If platform-specific sections exist for the user's system (for example, SourceDisksNames.x86 and SourceDisksFiles.x86), the platform-specific section are used. If InfContext is not specified and CopyStyle includes SP_COPY_SOURCE_ABSOLUTE or SP_COPY_SOURCEPATH_ABSOLUTE, InfHandle is ignored.
[in] InfContext
Optional pointer to context for a line in a Copy Files section in an INF file. The routine looks this file up in the SourceDisksFiles section of InfHandle to get file copy information. If InfContext is not specified, SourceFile must be.
[in] SourceFile
Optional pointer to the filename (no path) of the file to copy. The file is looked up in the SourceDisksFiles section. The SourceFile parameter must be specified if InfContext is not. However, SourceFile is ignored if InfContext is specified.
[in] SourcePathRoot
Optional pointer to the root path for the file to be copied (for example, A:\ or F:). Paths in the SourceDisksNames section are appended to this path. The SourcePathRoot parameter is ignored if CopyStyle includes the SP_COPY_SOURCE_ABSOLUTE flag.
[in] DestinationName
Optional pointer to a new name for the copied file. If InfContext is specified, DestinationName supplies the filename only (no path) of the target file. This parameter can be NULL to indicate that the target file should have the same name as the source file. If InfContext is not specified, DestinationName supplies the full target path and filename for the target.
[in] CopyStyle
Flags that control the behavior of the file copy operation.
These flags can be a combination of the following values.
Value MeaningThe file version information used during version checks is that specified in the dwFileVersionMS and dwFileVersionLS members of a VS_FIXEDFILEINFO structure, as filled in by the version functions. If one of the files does not have version resources, or if they have identical version information, the source file is considered newer.
If the source file is not newer or equal in version, and CopyMsgHandler is specified, the caller is notified and may cancel the copy. If CopyMsgHandler is not specified, the file is not copied.
[in] CopyMsgHandler
Optional pointer to a callback function to be notified of various conditions that may arise during the file copy.
[in] Context
Pointer to a caller-defined value that is passed as the first parameter of the callback function.
[out] FileWasInUse
Pointer to a variable in which this function returns a flag that indicates whether the file was in use. This parameter is required.
Return valueIf the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If GetLastError returns NO_ERROR, the file copy operation was not completed. The file may not have been copied because the file copy operation was unnecessary or because the file callback function returned FALSE.
This API is typically used when installing new versions of system files that are likely to be in use. It updates a BOOL value that indicates whether the file was in use. If the file was in use, then the file copy operation is postponed until the system is rebooted.
If a UNC directory is specified as the target directory of a file installation, you must ensure it exists before you call SetupInstallFileEx. The setup functions do not check for the existence of and do not create UNC directories. If the target UNC directory does not exist, the file installation fails.
Note
The setupapi.h header defines SetupInstallFileEx as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements Requirement Value Minimum supported client Windows XP [desktop apps only] Minimum supported server Windows Server 2003 [desktop apps only] Target Platform Windows Header setupapi.h Library Setupapi.lib DLL Setupapi.dll See alsoRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4