SetupGetTargetPath  YHDUO1 

[New - Windows NT]

The SetupGetTargetPath function determines the target directory for a file list section. The file list section can be a Copy Files94WX0. section, a Delete Files.O07.L section, or a Rename Files2LKG_AQ section. All the files in the section must be in a single directory that is listed in a DestinationDirsWKMUVK section of the INF file.

BOOL SetupGetTargetPath(

    HINF InfHandle,

// handle of the INF file

    PINFCONTEXT InfContext,

// optional, context of the INF file

    PCTSTR Section,

// optional, section in the INF file

    PTSTR ReturnBuffer,

// optional, receives the path info

    DWORD ReturnBufferSize,

// size of the supplied buffer

    PDWORD RequiredSize

// optional, buffer size needed

   );

 

 

Parameters

InfHandle

Handle of the load INF file that contains a DestinationDirs section.

InfContext

This optional parameter points to a INF context that specifies a line in a file list section whose destination directory is to be retrieved. If InfContext is NULL, then the Section parameter is used.

Section

This optional parameter specifies the name of a section of the INF file whose handle is InfHandle. SetupGetTargetPath retrieves the target directory for this section. The Section parameter is ignored if InfContext is specified. If neither InfContext nor Section is specified, the function retrieves the default target path from the INF file.

ReturnBuffer

This optional parameter points to a caller-supplied buffer to receive the fully qualified Win32 target path. The path is guaranteed not to end with \.

ReturnBufferSize

Specifies the size of the buffer pointed to by ReturnBuffer.

RequiredSize

This optional parameter points to a caller-supplied variable that receives the required size for the buffer pointed to by ReturnBuffer. If the actual size needed is larger than the value specified by ReturnBufferSize, the function fails and a call to GetLastError11C2VS7 returns ERROR_INSUFFICIENT_BUFFER.

 

Return Values

If the function succeeds, the return value is TRUE.

If the function fails, the return value is FALSE. To get extended error information, call GetLastError11C2VS7.

Remarks

For the Unicode version of this function, the buffer sizes ReturnBufferSize and RequiredSize are specified in number of characters. This number includes the null terminator. For the ANSI version of this function, the sizes are specified in number of bytes.

If this function is called with a ReturnBuffer of NULL and a ReturnBufferSize of zero, the function puts the buffer size needed to hold the specified data into the variable pointed to by RequiredSize. If the function succeeds in this, the return value is TRUE. Otherwise, the return value is FALSE and extended error information can be obtained by calling GetLastError11C2VS7.

Thus, you can call the function once to get the required buffer size, allocate the necessary memory, and then call the function a second time to retrieve the data. Using this technique, you can avoid errors due to an insufficient buffer size.

See Also

SetupGetSourceFileLocation, SetupGetSourceInfo, SetupGetSourceFileSize