SetFileSizeDirect Method
Resizes a file by passing the request directly to the filesystem.
Syntax
bool SetFileSizeDirect(qint64 lFileHandle, qint64 lSize);
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
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.