Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

SetupCopyOEMInf (setupapi)
 
.
Summary
TODO - a short description

C# Signature:

            [DllImport( "setupapi.dll" )]
            public static extern bool SetupCopyOEMInf(

                string                SourceInfFileName,
                string                OEMSourceMediaLocation,
                OemSourceMediaType    OEMSourceMediaType,
                OemCopyStyle        CopyStyle,
                string                DestinationInfFileName,
                int                    DestinationInfFileNameSize,
                ref int                RequiredSize,
                string                DestinationInfFileNameComponent

                );

VB Signature:

Declare Function SetupCopyOEMInf Lib "setupapi.dll" (TODO) As TODO

User-Defined Types:

        /// <summary>
        /// Driver media type
        /// </summary>
        internal enum OemSourceMediaType
        {
            SPOST_NONE  = 0,
            SPOST_PATH  = 1,
            SPOST_URL   = 2,
            SPOST_MAX   = 3
        }

        /// <summary>
        /// Driver file copy style
        /// </summary>
        internal enum OemCopyStyle
        {
            SP_COPY_DELETESOURCE    = 0x0000001,   // delete source file on successful copy
            SP_COPY_REPLACEONLY     = 0x0000002,   // copy only if target file already present
            SP_COPY_NEWER           = 0x0000004,   // copy only if source newer than or same as target
            SP_COPY_NEWER_OR_SAME       = SP_COPY_NEWER,
            SP_COPY_NOOVERWRITE     = 0x0000008,   // copy only if target doesn't exist
            SP_COPY_NODECOMP        = 0x0000010,   // don't decompress source file while copying
            SP_COPY_LANGUAGEAWARE       = 0x0000020,   // don't overwrite file of different language
            SP_COPY_SOURCE_ABSOLUTE     = 0x0000040,   // SourceFile is a full source path
            SP_COPY_SOURCEPATH_ABSOLUTE = 0x0000080,   // SourcePathRoot is the full path
            SP_COPY_IN_USE_NEEDS_REBOOT = 0x0000100,   // System needs reboot if file in use
            SP_COPY_FORCE_IN_USE    = 0x0000200,   // Force target-in-use behavior
            SP_COPY_NOSKIP          = 0x0000400,   // Skip is disallowed for this file or section
            SP_FLAG_CABINETCONTINUATION = 0x0000800,   // Used with need media notification
            SP_COPY_FORCE_NOOVERWRITE   = 0x0001000,   // like NOOVERWRITE but no callback nofitication
            SP_COPY_FORCE_NEWER     = 0x0002000,   // like NEWER but no callback nofitication
            SP_COPY_WARNIFSKIP      = 0x0004000,   // system critical file: warn if user tries to skip
            SP_COPY_NOBROWSE        = 0x0008000,   // Browsing is disallowed for this file or section
            SP_COPY_NEWER_ONLY      = 0x0010000,   // copy only if source file newer than target
            SP_COPY_SOURCE_SIS_MASTER   = 0x0020000,   // source is single-instance store master
            SP_COPY_OEMINF_CATALOG_ONLY = 0x0040000,   // (SetupCopyOEMInf only) don't copy INF--just catalog
            SP_COPY_REPLACE_BOOT_FILE   = 0x0080000,   // file must be present upon reboot (i.e., it's needed by the loader), this flag implies a reboot
            SP_COPY_NOPRUNE         = 0x0100000   // never prune this file
        }

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation

  Platform SDK: Setup API

SetupCopyOEMInf

The SetupCopyOEMInf function copies a specified INF file to the /Inf directory.

A caller of this function is required have administrative privileges, otherwise the function fails.

BOOL WINAPI SetupCopyOEMInf(

  PCTSTR SourceInfFileName,
  PCTSTR OEMSourceMediaLocation,
  DWORD OEMSourceMediaType,
  DWORD CopyStyle,
  PTSTR DestinationInfFileName,
  DWORD DestinationInfFileNameSize,
  PDWORD RequiredSize,
  PTSTR DestinationInfFileNameComponent

);

Parameters

SourceInfFileName

in Full path to the source INF file. You should use a null-terminated string. This path should not exceed MAX_PATH in size, including the terminating NULL.

OEMSourceMediaLocation

in Source location information to be stored in the precompiled INF (.pnf). This location information is specific to the source media type specified. You should use a null-terminated string. This path should not exceed MAX_PATH in size, including the terminating NULL.

OEMSourceMediaType

in Source media type referenced by the location information. This parameter may be one of the following values. Value Meaning

SPOST_NONE No source media information is stored in the PNF file. The value of OEMSourceMediaLocation is ignored in this case.

SPOST_PATH OEMSourceMediaLocation contains a path to the source media. For example, if the media is on a floppy, this path might be "A:\". If OEMSourceMediaLocation is NULL, the path is assumed to be the path where the INF is located. If the INF has a corresponding PNF in that location, the PNF file's source media information will be transferred to the destination PNF file.

SPOST_URL OEMSourceMediaLocation contains a universal resource locator (URL) specifying the Internet location from where the INF/driver files were retrieved. If OEMSourceMediaLocation is NULL, it is assumed that the default Code Download Manager location was used.

CopyStyle

in Specifies how the INF file is copied into the INF directory. The following flags can be combined. Value Meaning

SP_COPY_DELETESOURCE Delete source file on successful copy.

SP_COPY_REPLACEONLY Copy only if this file already exists in the INF directory. This flag could be used to update the source location information for an existing INF.

SP_COPY_NOOVERWRITE Copy only if the specified files don't currently exist in the INF directory. If the INF does currently exist, this API will fail and GetLastError returns ERROR_FILE_EXISTS. In this case, the existing INF file's filename will be placed into the appropriate field in the destination INF file's information output buffers.

SP_COPY_OEMINF_CATALOG_ONLY The specified INF file's corresponding catalog files is copied to \Inf. If this flag is specified, the destination filename information is entered upon successful return if the specified INF file already exists in the Inf directory.

DestinationInfFileName

[out, optional] Pointer to a buffer to receive the INF file name assigned to it at the time it was copied to the INF directory. The buffer, if specified, should typically be MAX_PATH in length. If the SP_COPY_NOOVERWRITE flag is specified and the SetupCopyOEMInf function fails with a return code of ERROR_FILE_EXISTS, this buffer will contain the name of the existing INF file. If the SP_COPY_OEMINF_CATALOG_ONLY flag is specified, this buffer will contain the destination INF filename if the INF file is already present in the INF directory. Otherwise, this buffer will be set to the empty string. This parameter can be NULL.

DestinationInfFileNameSize

in Size of the DestinationInfFileName buffer, in characters, or zero if the buffer is not specified. If DestinationInfFileName is specified and this buffer size is less than the size required to return the destination INF filename (including full path), this function will fail. In this case GetLastError will return ERROR_INSUFFICIENT_BUFFER.

RequiredSize

[out, optional] Pointer to a variable that receives the size (in characters) required to store the destination INF file name including a terminating NULL. If the SP_COPY_OEMINF_CATALOG_ONLY flag is specified, this variable will receive a string length only if the INF file already exists in the INF directory. Otherwise, this variable will be set to zero. This parameter can be NULL.

DestinationInfFileNameComponent

[out, optional] Pointer to a string that is set upon successful return (or ERROR_FILE_EXISTS) to point to the beginning of the filename component of the path stored in the DestinationInfFileName parameter. If the SP_COPY_OEMINF_CATALOG_ONLY flag is specified, the DestinationInfFileName parameter may be an empty string. In this case, the character pointer will be set to NULL upon successful return. This parameter can be NULL.

Return Values

TRUE

The SetupCopyOEMInf function succeeded.

FALSE

The SetupCopyOEMInf function failed. For extended error information, call GetLastError.

Remarks

The SetupCopyOEMInf function copies a specified INF file into the \Inf directory. SetupCopyOEMInf does not recopy the file if it finds that a binary image of the specified INF file already exists in the INF directory with the same name or a name of the form OEM*.INF. When SetupCopyOEMInf copies a file, it renames the copied file to OEM*.INF. Name provided is unique and cannot be predicted.

SetupCopyOEMInf uses the following procedure to determine if the INF file already exists in the INF directory:

All INF files with names of the form OEM*.INF are enumerated and any files that have the same file size as the specified INF file are binary compared.

The INF directory is searched for the source filename of the INF file. If an INF file of the same name exists and is the same size as that of the specified INF file, the two files are binary compared to determine if they are identical.

If the specified INF file already exists a further check is performed to determine if the specified INF file contains a CatalogFile= entry in its Version section. If it does, the INF files's \Inf primary filename with a ".CAT" extension is used to determine if the catalog is already installed. If there is a catalog installed, but it isn't the same as the catalog associated with the source INF, this is not considered to be a match and enumerations continue. It is possible to have multiple identical INF files with unique catalogs contained in \Inf directory. If an existing match is not found, the INF and CAT files are installed under a new and unique name.

OEM INFs that don't specify a CatalogFile= entry are considered invalid with respect to digital signature verification.

In cases where the INF file must be copied to the \Inf directory, any digital signature verification failures are reported

If the INF and CAT files already exist, these existing filenames are used and the file replacement behavior is based on the specified CopyStyle flags. Replacement behavior refers only to the source media information stored in the PNF. Existing INF, PNF, and CAT files are not modified.

Requirements

Client
Included in Windows XP and Windows 2000 Professional.
Server
Included in Windows Server 2003 and Windows 2000 Server.
Unicode
Implemented as Unicode and ANSI versions.
Header
Declared in Setupapi.h.
Library
Use Setupapi.lib.

See Also

Overview, Functions

Platform SDK Release: February 2003 What did you think of this topic?

  Order a Platform SDK CD

Requirements

Client
Included in Windows XP and Windows 2000 Professional.
Server
Included in Windows Server 2003 and Windows 2000 Server.
Unicode
Implemented as Unicode and ANSI versions.
Header
Declared in Setupapi.h.
Library
Use Setupapi.lib.

See Also

Overview, Functions

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions