ReactOS 0.4.17-dev-1190-g4c812f4
lockctrl.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS NTFS driver
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Byte range locks
5 * COPYRIGHT: Copyright 2026 Justin Miller <justinmiller100@gmail.com>
6 */
7
8/* INCLUDES *****************************************************************/
9
10#include "ntfs.h"
11
12#define NDEBUG
13#include <debug.h>
14
15/* FUNCTIONS ****************************************************************/
16
20 _In_ PNTFS_IRP_CONTEXT IrpContext)
21{
23
24 DPRINT("NtfsLockControl(%p)\n", IrpContext);
25
26 if (IrpContext->DeviceObject == NtfsGlobalData->DeviceObject)
28
29 /* Only the data of regular files can be locked */
30 if (!NtfsIsRegularFileObject(IrpContext->FileObject))
32
33 Fcb = (PNTFS_FCB)IrpContext->FileObject->FsContext;
34
35 /* FsRtl completes the IRP, or keeps it until a conflicting lock goes away */
36 IrpContext->Flags &= ~IRPCONTEXT_COMPLETE;
37
38 return FsRtlProcessFileLock(&Fcb->FileLock, IrpContext->Irp, NULL);
39}
40
41/* EOF */
LONG NTSTATUS
Definition: precomp.h:26
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define NULL
Definition: types.h:112
PNTFS_GLOBAL_DATA NtfsGlobalData
Definition: ntfs.c:36
#define IRPCONTEXT_COMPLETE
Definition: ntfs.h:506
struct _FCB * PNTFS_FCB
NTSTATUS NTAPI FsRtlProcessFileLock(IN PFILE_LOCK FileLock, IN PIRP Irp, IN PVOID Context OPTIONAL)
Definition: filelock.c:1156
#define _In_
Definition: no_sal2.h:158
BOOLEAN NTAPI NtfsIsRegularFileObject(_In_ PFILE_OBJECT FileObject)
Definition: fcb.c:153
NTSTATUS NTAPI NtfsLockControl(_In_ PNTFS_IRP_CONTEXT IrpContext)
Definition: lockctrl.c:19
#define DPRINT
Definition: sndvol32.h:73
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:175
Definition: cdstruc.h:902
FILE_LOCK FileLock
Definition: fatstruc.h:1071
PFILE_OBJECT FileObject
Definition: ntfs.h:599
#define NTAPI
Definition: typedefs.h:36
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135