IWMDMStorage::GetAttributes
The GetAttributes method retrieves the attributes of a storage object.
Syntax
HRESULT GetAttributes(
DWORD* pdwAttributes,
_WAVEFORMATEX* pFormat
);
Parameters
pdwAttributes
[out] Pointer to a DWORD containing the attributes. The following table lists the object attributes that can be returned by the pdwAttributes parameter.
Attribute | Description |
WMDM_STORAGE_ATTR_FILESYSTEM | This object is the top-level storage medium, for example, a storage card or some other type of on-board storage. |
WMDM_STORAGE_ATTR_REMOVABLE | This storage medium is removable. |
WMDM_STORAGE_ATTR_NONREMOVABLE | This storage medium is not removable. |
WMDM_STORAGE_ATTR_FOLDERS | This storage medium supports folders and file hierarchy. |
WMDM_STORAGE_ATTR_HAS_FILES | This storage object, if it is a folder, contains at least one file. |
WMDM_STORAGE_ATTR_HAS_FOLDERS | This storage object, if it is a folder, also has sub-folders. |
WMDM_STORAGE_ATTR_CANEDITMETADATA | This storage can edit metadata. |
WMDM_FILE_ATTR_FILE | This is a file on the storage medium. |
WMDM_FILE_ATTR_FOLDER | This is a folder on the storage medium. |
WMDM_FILE_ATTR_LINK | This is a link that creates an association between multiple files. |
WMDM_FILE_ATTR_AUDIO | This file contains audio data. |
WMDM_FILE_ATTR_DATA | This file contains non-audio data. |
WMDM_FILE_ATTR_CANPLAY | This audio file can be played by the device. |
WMDM_FILE_ATTR_CANDELETE | This file can be deleted. |
WMDM_FILE_ATTR_CANMOVE | This file or folder can be moved around on the storage medium. |
WMDM_FILE_ATTR_CANRENAME | This file or folder can be renamed. |
WMDM_FILE_ATTR_CANREAD | This file can be read by the host computer. |
WMDM_FILE_ATTR_MUSIC | This audio file contains music. |
WMDM_FILE_ATTR_AUDIOBOOK | This is an audio book file. |
WMDM_FILE_ATTR_VIDEO | This file contains video data. |
WMDM_FILE_ATTR_HIDDEN | This file is hidden on the file system |
WMDM_FILE_ATTR_SYSTEM | This is a system file |
WMDM_FILE_ATTR_READONLY | This is a read-only file. |
WMDM_STORAGE_ATTR_VIRTUAL | This storage is virtual and does not correspond to an actual storage on the file system of the device. (Folders created based on metadata are one example of virtual storage.) |
WMDM_STORAGE_IS_DEFAULT | This storage is the default location for putting new digital media on the device. |
WMDM_STORAGE_CONTAINS_DEFAULT | This storage contains the default storage where new digital media should be placed. |
* pFormat*
[out] Pointer to a _WAVEFORMATEX structure that contains attribute information about the object.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider can return any of the following classes of error codes:
- Standard COM error codes
- Windows error codes converted to HRESULT values
- Windows Media Device Manager error codes
For a complete list of possible error codes, see Error Codes.
Possible values include, but are not limited to, those in the following table.
Return code | Description |
S_OK | The method succeeded. |
E_INVALIDARG | The pdwAttributes parameter is an invalid or NULL pointer. |
E_FAIL | An unspecified error occurred. |
Remarks
Evaluation of attributes is a crucial step when exposing the contents of the media device. Some devices do not support hierarchical storage of data on storage media. The GetAttributes method is used to infer the support and format of the file system by discovering its structure through object attributes.
For example, the attributes of a top-level IWMDMStorage interface indicates a storage medium, and IWMDMEnumStorage exposes the contents of the medium. For an .mp3 file, the attributes indicate a file whose type can be determined by further examination of both the attributes and the file name. In a hierarchical medium, the attributes can indicate a directory whose contents can be exposed by IWMDMStorage::EnumStorage.
The pformat parameter is optional. If you pass a valid _WAVEFORMATEX pointer to an audio file, GetAttributes passes descriptive information back into the structure. However, if the file is not audio, the pFormat (_WAVEFORMATEX) parameter is ignored.
Requirements
Header: Defined in wmdm.idl.
Library: mssachlp.lib
See Also