Export (0) Print
Expand All
Expand Minimize

SetupQuerySpaceRequiredOnDrive Function

[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 SetupQuerySpaceRequiredOnDrive function examines a disk space list to determine the space that is required to perform all the file operations listed for a specific drive.

Syntax

BOOL SetupQuerySpaceRequiredOnDrive(
  __in   HDSKSPC DiskSpace,
  __in   PCTSTR DriveSpec,
  __out  LONGLONG *SpaceRequired,
  __in   PVOID Reserved1,
  __in   UINT Reserved2
);

Parameters

DiskSpace [in]

The handle to a disk space list.

DriveSpec [in]

A pointer to a null-terminated string that specifies the drive where space information is to be returned.

This should be in the form "x:" or "\\server\share".

SpaceRequired [out]

If the function succeeds, this parameter receives the amount of additional space that is required to process all the file operations listed in the disk space list for the drive that DriveSpec specifies.

The SetupQuerySpaceRequiredOnDrive function calculates the additional space required on the target drive by checking for preexisting versions of the files on the target drive.

For example, if a file operation copies a 2000-byte file, FIRST.EXE, to the directory, C:\MYPROG\, the SetupQuerySpaceRequiredOnDrive function automatically checks for a preexisting version of that file in that directory. If a preexisting version of C:\MYPROG\FIRST.EXE has a file size of 500 bytes, the additional space required on the drive C for that operation is 1500 bytes.

The value received can be 0 (zero) or a negative number, if additional space is not required, or if space is freed on the target drive.

If FIRST.EXE in the preceding example is being deleted from the drive C, the amount of space required is 2000 bytes, or the space freed on drive C.

If the preexisting version has a file size of 5000 bytes, then the disk space required to replace it with the 2000-byte FIRST.EXE is 3000 bytes.

File sizes are rounded to disk cluster boundaries.

Reserved1 [in]

Reserved; must be 0 (zero).

Reserved2 [in]

Reserved; must be 0 (zero).

Return Value

If the function succeeds, the return value is a nonzero value and SpaceRequired receives the amount of space required by the file operations listed in the current disk space list.

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

Return codeDescription
ERROR_INVALID_DRIVE

The specified drive is not on the disk-space list.

ERROR_INVALID_HANDLE

The specified DiskSpace handle is invalid.

ERROR_INVALID_PARAMETER

The specified DriveSpec string is invalid.

 

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Setupapi.h

Library

Setupapi.lib

DLL

Setupapi.dll

Unicode and ANSI names

SetupQuerySpaceRequiredOnDriveW (Unicode) and SetupQuerySpaceRequiredOnDriveA (ANSI)

See Also

Functions
Overview
SetupQueryDrivesInDiskSpaceList

 

 

Build date: 8/19/2010

Community Additions

ADD
Show:
© 2014 Microsoft