CascLib API Reference

CascGetStorageInfo

Description


  bool WINAPI CascGetStorageInfo(
      HANDLE hStorage,                      // Handle to an open storage
      CASC_STORAGE_INFO_CLASS InfoClass,    // Pointer to a structure with extra arguments
      void * pvStorageInfo,                 // Specifies whether to open a local or an online storage
      size_t cbStorageInfo,                 // Length, in bytes, of the buffer pointed by pvStorageInfo
      size_t * pcbLengthNeeded              // Pointer to a required length, in bytes
      );

Function CascGetStorageInfo retrieves various parameters of an open storage. The type of information depends on the value of the InfoClass parameter.

Parameters

hStorage [in]
Handle to an opened storage. Use CascOpenStorageEx, CascOpenStorage or CascOpenOnlineStorage to retrieve such handle.
InfoClass [in]
Type of information to retrieve. See Return Value for more information.
pvStorageInfo [out]
Pointer to the buffer which will receive the requested information.
cbStorageInfo [in]
Length, in bytes, of the buffer pointed by pvStorageInfo.
pcbLengthNeeded [out, optional]
Required length, of the buffer. This value is set both on success and on failure, unless it's NULL.

Return Value

On success, the function returns true.
On failure, the function returns false and GetLastError() returns the error code.

The following table shows the possible type of information that are obtainable by CascGetFileInfo:

Value of InfoClass pvStorageInfo points to Returned information
CascStorageLocalFileCount DWORD Number of local files in the storage. Note that a file can be referenced by different names, so the total number of files in the storage may be higher than physical number of files.
CascStorageTotalFileCount DWORD Total file count in the storage. This includes the files that are offline (not downloaded).
CascStorageFeatures DWORD Bit mask containing various CASC storage features. The mask can be a combination of the following values:
  • CASC_FEATURE_FILE_NAMES (0x00000001) - File names are supported by the storage
  • CASC_FEATURE_ROOT_CKEY (0x00000002) - Present if the storage's ROOT returns CKey. If not present, the root contains EKeys.
  • CASC_FEATURE_TAGS (0x00000004) - Tags are supported by the storage.
  • CASC_FEATURE_FNAME_HASHES (0x00000008) - The storage contains file name hashes on ALL files.
  • CASC_FEATURE_FNAME_HASHES_OPTIONAL (0x00000010) - The storage contains file name hashes for SOME files.
  • CASC_FEATURE_FILE_DATA_IDS (0x00000020) - The storage indexes files by FileDataId.
  • CASC_FEATURE_LOCALE_FLAGS (0x00000040) - Locale flags are supported by the storage.
  • CASC_FEATURE_CONTENT_FLAGS (0x00000080) - Content flags are supported by the storage.
  • CASC_FEATURE_ONLINE (0x00000100) - The storage is an online storage.
CascStorageProduct CASC_STORAGE_PRODUCT Information abot the product - product printable name, build number, and CASC_PRODUCT enum.
CascStorageTags CASC_STORAGE_TAGS Information about tags included in the storage.
CascStoragePathProduct TCHAR Buffer Open parameters of the storage, aka LocalPath:ProductCode.