Skip to content

Latest commit

 

History

History
99 lines (78 loc) · 3.01 KB

nf-ntifs-iocheckfileobjectopenedascopysource.md

File metadata and controls

99 lines (78 loc) · 3.01 KB
UID tech.root title ms.date targetos description prerelease req.assembly req.construct-type req.ddi-compliance req.dll req.header req.idl req.include-header req.irql req.kmdf-ver req.lib req.max-support req.namespace req.redist req.target-min-winverclnt req.target-min-winversvr req.target-type req.type-library req.umdf-ver req.unicode-ansi topic_type api_type api_location api_name f1_keywords dev_langs helpviewer_keywords
NF:ntifs.IoCheckFileObjectOpenedAsCopySource
kernel
IoCheckFileObjectOpenedAsCopySource
08/01/2022
Windows
Learn more about the IoCheckFileObjectOpenedAsCopySource function.
false
function
ntifs.h
Wdm.h, Ntddk.h, Ntifs.h
PASSIVE_LEVEL
Windows 11, version 22H2
apiref
DllExport
ntifs.h
IoCheckFileObjectOpenedAsCopySource
IoCheckFileObjectOpenedAsCopySource
ntifs/IoCheckFileObjectOpenedAsCopySource
c++
IoCheckFileObjectOpenedAsCopySource

-description

The IoCheckFileObjectOpenedAsCopySource routine checks whether a file was previously opened with copy intent as a source file.

-parameters

-param FileObject [in]

Pointer to the source file object to check for copy intent.

-returns

IoCheckFileObjectOpenedAsCopySource returns TRUE if the file object represents a source file that was previously opened with copy file intent; otherwise it returns FALSE. A return value of TRUE only signals the intent at create time; it does not mean that all operations on the file object are all part of copies.

-remarks

The following example shows how to check if a file object was opened with copy intent.

typedef  
BOOLEAN (*PIO_CHECK_FILE_OBJECT_OPENED_AS_COPY_SOURCE)( 
    _In_ PFILE_OBJECT FileObject 
); 
typedef  
BOOLEAN (*PIO_CHECK_FILE_OBJECT_OPENED_AS_COPY_DESTINATION)( 
    _In_ PFILE_OBJECT FileObject 
); 

PIO_CHECK_FILE_OBJECT_OPENED_AS_COPY_SOURCE IoCheckFileObjectOpenedAsCopySource; 
PIO_CHECK_FILE_OBJECT_OPENED_AS_COPY_DESTINATION IoCheckFileObjectOpenedAsCopyDestination;

// First resolve the API 
RtlInitUnicodeString(&RoutineName, L"IoCheckFileObjectOpenedAsCopySource"); 
IoCheckFileObjectOpenedAsCopySource = (PIO_CHECK_FILE_OBJECT_OPENED_AS_COPY_SOURCE)MmGetSystemRoutineAddress(&RoutineName); 

RtlInitUnicodeString(&RoutineName, L"IoCheckFileObjectOpenedAsCopyDestination"); 
IoCheckFileObjectOpenedAsCopyDestination = (PIO_CHECK_FILE_OBJECT_OPENED_AS_COPY_DESTINATION)MmGetSystemRoutineAddress(&RoutineName); 

// Now use the API 
IoCheckFileObjectOpenedAsCopySource(FltObjects->FileObject); 
IoCheckFileObjectOpenedAsCopyDestination(FltObjects->FileObject);

See Kernel-mode file copy and detecting copy file scenarios for more information.

-see-also

EXTENDED_CREATE_INFORMATION

IoCheckFileObjectOpenedAsCopyDestination

NtCopyFileChunk

NtCreateFile