示例#1
0
文件: setfile.c 项目: nmlgc/dokany
NTSTATUS
DokanSetAllocationInformation(
	 PEVENT_CONTEXT		EventContext,
	 PDOKAN_FILE_INFO	FileInfo,
	 PDOKAN_OPERATIONS	DokanOperations)
{
	PFILE_ALLOCATION_INFORMATION allocInfo =
		(PFILE_ALLOCATION_INFORMATION)((PCHAR)EventContext + EventContext->Operation.SetFile.BufferOffset);

	// A file's allocation size and end-of-file position are independent of each other,
	// with the following exception: The end-of-file position must always be less than
	// or equal to the allocation size. If the allocation size is set to a value that
	// is less than the end-of-file position, the end-of-file position is automatically
	// adjusted to match the allocation size.

	if (DokanOperations->SetAllocationSize) {
		return DokanOperations->SetAllocationSize(
			EventContext->Operation.SetFile.FileName,
			allocInfo->AllocationSize.QuadPart,
			FileInfo);
	}
	// How can we check the current end-of-file position?
	if (allocInfo->AllocationSize.QuadPart == 0) {
		return DokanOperations->SetEndOfFile(
			EventContext->Operation.SetFile.FileName,
			allocInfo->AllocationSize.QuadPart,
			FileInfo);
	} else {
		DbgPrint("  SetAllocationInformation %I64d, can't handle this parameter.\n",
				allocInfo->AllocationSize.QuadPart);
	}

	return STATUS_SUCCESS;
}
示例#2
0
文件: setfile.c 项目: nmlgc/dokany
NTSTATUS
DokanSetValidDataLengthInformation(
	PEVENT_CONTEXT		EventContext,
	PDOKAN_FILE_INFO	FileInfo,
	PDOKAN_OPERATIONS	DokanOperations)
{
	PFILE_VALID_DATA_LENGTH_INFORMATION validInfo =
		(PFILE_VALID_DATA_LENGTH_INFORMATION)((PCHAR)EventContext + EventContext->Operation.SetFile.BufferOffset);

	if (!DokanOperations->SetEndOfFile)
		return STATUS_NOT_IMPLEMENTED;

	return DokanOperations->SetEndOfFile(
		EventContext->Operation.SetFile.FileName,
		validInfo->ValidDataLength.QuadPart,
		FileInfo);
}
示例#3
0
文件: setfile.c 项目: nmlgc/dokany
NTSTATUS
DokanSetEndOfFileInformation(
	 PEVENT_CONTEXT		EventContext,
	 PDOKAN_FILE_INFO	FileInfo,
	 PDOKAN_OPERATIONS	DokanOperations)
{
	PFILE_END_OF_FILE_INFORMATION endInfo =
		(PFILE_END_OF_FILE_INFORMATION)((PCHAR)EventContext + EventContext->Operation.SetFile.BufferOffset);

	if (!DokanOperations->SetEndOfFile)
		return STATUS_NOT_IMPLEMENTED;

	return DokanOperations->SetEndOfFile(
		EventContext->Operation.SetFile.FileName,
		endInfo->EndOfFile.QuadPart,
		FileInfo);
}