SetFileSizeDirect Method
Resizes a file by passing the request directly to the filesystem.
Syntax
ANSI (Cross Platform) int SetFileSizeDirect(int64 lFileHandle, int64 lSize); Unicode (Windows) INT SetFileSizeDirect(LONG64 lFileHandle, LONG64 lSize);
#define MID_CBFILTER_SETFILESIZEDIRECT 43 CBFSFILTER_EXTERNAL int CBFSFILTER_CALL CBFSFilter_CBFilter_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);
Remarks
Applications can call this method in filesystem-related event handlers to resize a file without sending the request through the filesystem filter driver stack. If the file is resized successfully, this method returns true; otherwise, it returns false.
The FileHandle parameter specifies the file that should be resized. The value passed for this parameter must be a file handle obtained from the CreateFileDirect method; please refer to its documentation for more information.
The Size parameter specifies the new file size, in bytes.
Note: This method can only be called within events.
Error Handling (C++)
This method returns a Boolean value; 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.