SetupInstallFromInfSection

The SetupInstallFromInfSection function carries out all the directives in an INF file Install section.

BOOL SetupInstallFromInfSection(
  HWND Owner,            // optional, handle of a parent window
  HINF InfHandle,        // handle to the INF file
  PCTSTR SectionName,    // name of the Install section
  UINT Flags,            // which lines to install from section
  HKEY RelativeKeyRoot,  // optional, key for registry installs
  PCTSTR SourceRootPath, // optional, path for source files
  UINT CopyFlags,        // optional, specifies copy behavior
  PSP_FILE_CALLBACK MsgHandler, 
                         // optional, specifies callback routine
  PVOID Context,         // optional, callback routine context
  HDEVINFO DeviceInfoSet,  // optional, device information set
  PSP_DEVINFO_DATA DeviceInfoData
                         // optional, device info structure
);
 

Parameters

Owner
This optional parameter specifies the window handle of the window that owns any dialog boxes that are generated during installation, such as for disk prompting or file copying. If Owner is not specified, these dialog boxes become top-level windows.
InfHandle
Specifies the handle to the INF file that contains the section to be processed. The INF file must be a Windows 95- or Windows NT 4.0-style file; legacy INF files are not supported by SetupInstallFromInfSection.
SectionName
Supplies the name of the Install section in the INF file to process.
Flags
A set of flags that indicates what actions to perform. The flags can be a combination of the following:
SPINST_INIFILES
Perform INI-file operations (UpdateInis, UpdateIniFields lines in the Install section being processed).
SPINST_REGISTRY
Perform registry operations (AddReg, DelReg lines in the Install section being processed).
SPINST_INI2REG
Perform INI-file to registry operations (Ini2Reg lines in the Install section being processed).
SPINST_LOGCONFIG
This flag is only used when installing a device driver.

Perform logical configuration operations (LogConf lines in the Install section being processed). This flag is only used if DeviceInfoSet and DeviceInfoData are specified.

For more information about installing device drivers, LogConf, DeviceInfoSet, or DeviceInfoData, see the DDK Programmer's Guide.

SPINST_FILES
Perform file operations (CopyFiles, DelFiles, RenFiles lines in the Install section being processed).
SPINST_ALL
Perform all installation operations.
RelativeKeyRoot
This optional parameter must be specified if Flags includes SPINST_REGISTRY or SPINST_INI2REG. Specifies a handle to a registry key to be used as the root when the INF file specifies HKR as the key.
SourceRootPath
Specifies the source root for file copies. An example would be A:\ or \\pegasus\win\install. If Flags includes SPINST_FILES, and SourceRootPath is NULL, the system provides a default root path.
CopyFlags
This optional parameter must be specified if Flags includes SPINST_FILES. Specifies flags to be passed to the SetupQueueCopySection function when files are queued for copy. These flags may be a combination of the following values:
SP_COPY_DELETESOURCE
Delete the source file upon successful copy. The caller is not notified if the delete fails.
SP_COPY_REPLACEONLY
Copy the file only if doing so would overwrite a file at the destination path.
SP_COPY_NEWER
Examine each file being copied to see if its version resources indicate that it is not newer than an existing copy on the target.

The 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 Win32 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, and CopyMsgHandler is specified, the caller is notified and may cancel the copy. If CopyMsgHandler is not specified, the file is not copied.

SP_COPY_NOOVERWRITE
Check whether the target file exists, and, if so, notify the caller who may veto the copy. If CopyMsgHandler is not specified, the file is not overwritten.
SP_COPY_NODECOMP
Do not decompress the file. When this flag is set, the target file is not given the uncompressed form of the source name (if appropriate). For example, copying f:\mips\cmd.ex_ to \\install\temp results in a target file of \\install\temp\cmd.ex_. If the SP_COPY_NODECOMP flag was not specified, the file would be decompressed and the target would be called \\install\temp\cmd.exe. The filename part of DestinationName, if specified, is stripped and replaced with the filename of the source file. When SP_COPY_NODECOMP is specified, SP_COPY_LANGUAGEAWARE and SP_COPY_NEWER are ignored.
SP_COPY_LANGUAGEAWARE
Examine each file being copied to see if its language differs from the language of any existing file already on the target. If so, and CopyMsgHandler is specified, the caller is notified and may cancel the copy. If CopyMsgHandler is not specified, the file is not copied.
SP_COPY_SOURCE_ABSOLUTE
SourceFile is a full source path. Do not look it up in the SourceDisksNames section of the INF file.
SP_COPY_SOURCEPATH_ABSOLUTE
SourcePathRoot is the full path part of the source file. Ignore the relative source specified in the SourceDisksNames section of the INF file for the source media where the file is located. This flag is ignored if SP_COPY_SOURCE_ABSOLUTE is specified.
SP_COPY_FORCE_IN_USE
If the target exists, behave as if it is in use and queue the file for copying on the next system reboot.
SP_COPY_IN_USE_NEEDS_REBOOT
If the file was in use during the copy operation inform the user that the system needs to be rebooted. This flag is only used when later calling SetupPromptReboot or SetupScanFileQueue.
SP_COPY_NOSKIP
Do not give the user the option to skip a file.
SP_COPY_FORCE_NOOVERWRITE
Check whether the target file exists, and, if so, the file is not overwritten. The caller is not notified.
SP_COPY_FORCE_NEWER
Examine each file being copied to see if its version resources (or timestamps for non-image files) indicate that it is not newer than an existing copy on the target. If the file being copied is not newer, the file is not copied. The caller is not notified.
SP_COPY_WARNIFSKIP
If the user tries to skip a file, warn them that skipping a file may affect the installation. (Used for system-critical files.)
MsgHandler
This optional parameter must be specified if Flags includes SPINST-FILES. Specifies a callback function to be used when the file queue built by this routine internally is committed with the SetupCommitFileQueue function.
Context
This optional parameter must be specified if Flags includes SPINST_FIlLES. Specifies a value to be passed to the callback function when the file queue built by this routine internally is committed via SetupCommitFileQueue.
DeviceInfoSet
This optional parameter supplies a handle to a device information set. For more information about the Device Installer setup functions, see the DDK Programmer's Guide.
DeviceInfoData
This optional parameter supplies a pointer to the SP_DEVINFO_DATA structure that provides a context to a specific element in the set specified by DeviceInfoSet. For more information about the Device Installer setup functions, see the DDK Programmer's Guide.

Return Values

If the function succeeds, the return value is a non-zero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

If a UNC directory is specified as the target directory of a file copy operation, you must ensure it exists before you call SetupInstallFromInfSection. 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 will fail.

QuickInfo

  Windows NT: Use version 4.0 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in setupapi.h.
  Import Library: Link with setupapi.lib.

See Also

Overview, Functions, SetupInstallFilesFromInfSection, SetupInstallServicesFromInfSection