OpenVolumeAsStream Method

Opens a volume as a stream.

Syntax

CBFSDirectStream* OpenVolumeAsStream(const char* lpszVolumeName, int iDesiredAccess, int bForceUnmount);
CBFSDirectStream* OpenVolumeAsStream(LPCWSTR lpszVolumeName, INT iDesiredAccess, BOOL bForceUnmount);

Remarks

This method should be used instead of the Windows API's CreateFile function to open the volume specified by VolumeName when an application needs to access it directly, bypassing the system's access control mechanisms.

If the volume is opened successfully, this method returns a stream object that provides access to its data; otherwise, it returns NULL.

The VolumeName and DesiredAccess parameters correspond to the lpFileName and dwDesiredAccess parameters of the Windows API's CreateFile function (respectively). The value passed for VolumeName may be in WinAPI or NT-native format. Please refer to Microsoft's documentation for more information on how to set these parameters appropriately.

Error Handling (C++)

This method returns a Stream; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.

 
 
Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Direct 2020 C++ Edition - Version 20.0 [Build 7836]