23 USHORT subnamelen, printnamelen,
i;
43 if (buflen < reqlen) {
65 ERR(
"out of memory\n");
74 ERR(
"read_file returned %08lx\n",
Status);
81 ERR(
"utf8_to_utf16 1 returned %08lx\n",
Status);
100 if (buflen < reqlen) {
117 ERR(
"utf8_to_utf16 2 returned %08lx\n",
Status);
144 ERR(
"read_file returned %08lx\n",
Status);
186 if (buflen < minlen) {
187 WARN(
"buffer was less than minimum length (%lu < %lu)\n", buflen, minlen);
192 WARN(
"rdb->SymbolicLinkReparseBuffer.SubstituteNameLength was too short\n");
206 if (fileref && fileref->
dc)
212 ERR(
"truncate_file returned %08lx\n",
Status);
218 ERR(
"utf16_to_utf8 1 failed with error %08lx\n",
Status);
225 ERR(
"out of memory\n");
231 ERR(
"utf16_to_utf8 2 failed with error %08lx\n",
Status);
236 for (
i = 0;
i <
target.MaximumLength;
i++) {
278 WARN(
"tried to set a reparse point on an existing symlink\n");
286 if (buflen <
sizeof(
ULONG)) {
287 WARN(
"buffer was not long enough to hold tag\n");
293 ERR(
"FsRtlValidateReparsePointBuffer returned %08lx\n",
Status);
312 ERR(
"out of memory\n");
329 ERR(
"truncate_file returned %08lx\n",
Status);
335 Status =
write_file2(
fcb->
Vcb,
Irp,
offset, rdb, &buflen,
false,
true,
true,
false,
false,
rollback);
337 ERR(
"write_file2 returned %08lx\n",
Status);
370 void*
buffer =
Irp->AssociatedIrp.SystemBuffer;
384 ERR(
"FileObject was NULL\n");
396 ERR(
"ccb was NULL\n");
401 WARN(
"insufficient privileges\n");
408 ERR(
"fileref was NULL\n");
413 fileref = fileref->
parent;
422 ERR(
"set_reparse_point2 returned %08lx\n",
Status);
456 ERR(
"FileObject was NULL\n");
463 ERR(
"fcb was NULL\n");
470 ERR(
"ccb was NULL\n");
475 WARN(
"insufficient privileges\n");
482 ERR(
"fileref was NULL\n");
490 ERR(
"buffer was too short\n");
496 WARN(
"rdb->ReparseDataLength was not zero\n");
502 WARN(
"tried to delete reparse point on ADS\n");
512 WARN(
"reparse tag was not IO_REPARSE_TAG_SYMLINK\n");
543 fileref->
fcb->
subvol->root_item.ctransid =
fcb->
Vcb->superblock.generation;
553 ERR(
"truncate_file returned %08lx\n",
Status);
#define KeQuerySystemTime(t)
struct _file_ref * parent
void do_rollback(device_extension *Vcb, LIST_ENTRY *rollback)
void clear_rollback(LIST_ENTRY *rollback)
struct _REPARSE_DATA_BUFFER::@300::@302 SymbolicLinkReparseBuffer
#define STATUS_INSUFFICIENT_RESOURCES
NTSTATUS delete_reparse_point(PDEVICE_OBJECT DeviceObject, PIRP Irp)
#define STATUS_INVALID_PARAMETER
#define BTRFS_TYPE_BLOCKDEV
bool reparse_xattr_changed
NTSTATUS set_reparse_point(PDEVICE_OBJECT DeviceObject, PIRP Irp)
NTSTATUS set_reparse_point2(fcb *fcb, REPARSE_DATA_BUFFER *rdb, ULONG buflen, ccb *ccb, file_ref *fileref, PIRP Irp, LIST_ENTRY *rollback)
static NTSTATUS set_symlink(PIRP Irp, file_ref *fileref, fcb *fcb, ccb *ccb, REPARSE_DATA_BUFFER *rdb, ULONG buflen, bool write, LIST_ENTRY *rollback)
ANSI_STRING reparse_xattr
#define FILE_NOTIFY_CHANGE_LAST_WRITE
tFsRtlValidateReparsePointBuffer fFsRtlValidateReparsePointBuffer
NTSTATUS read_file(fcb *fcb, uint8_t *data, uint64_t start, uint64_t length, ULONG *pbr, PIRP Irp)
#define BTRFS_TYPE_CHARDEV
NTSTATUS truncate_file(fcb *fcb, uint64_t end, PIRP Irp, LIST_ENTRY *rollback)
#define FILE_WRITE_ATTRIBUTES
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
NTSTATUS get_reparse_point(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT FileObject, void *buffer, DWORD buflen, ULONG_PTR *retlen)
GLenum GLuint GLenum GLsizei const GLchar * buf
_In_ PDEVICE_OBJECT DeviceObject
void queue_notification_fcb(_In_ file_ref *fileref, _In_ ULONG filter_match, _In_ ULONG action, _In_opt_ PUNICODE_STRING stream)
void mark_fileref_dirty(_In_ file_ref *fileref)
#define FILE_ACTION_MODIFIED
#define BTRFS_TYPE_DIRECTORY
#define offsetof(TYPE, MEMBER)
void mark_fcb_dirty(_In_ fcb *fcb)
_Reserved_ PVOID Reserved
static string utf16_to_utf8(const wstring_view &utf16)
#define FILE_ATTRIBUTE_REPARSE_POINT
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
FSRTL_ADVANCED_FCB_HEADER Header
#define STATUS_INVALID_BUFFER_SIZE
#define NT_SUCCESS(StatCode)
bool user_set_change_time
struct _REPARSE_DATA_BUFFER::@300::@304 GenericReparseBuffer
wstring utf8_to_utf16(const string_view &utf8)
#define STATUS_ACCESS_DENIED
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define ExAllocatePoolWithTag(hernya, size, tag)
NTSTATUS(__stdcall * tFsRtlValidateReparsePointBuffer)(ULONG BufferLength, PREPARSE_DATA_BUFFER ReparseBuffer)
GLint const GLchar GLint stringlen
#define STATUS_NOT_A_REPARSE_POINT
#define SYMLINK_FLAG_RELATIVE
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
#define STATUS_BUFFER_OVERFLOW
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define FILE_NOTIFY_CHANGE_ATTRIBUTES
#define InitializeListHead(ListHead)
_In_ PIO_STACK_LOCATION IrpSp
#define IO_REPARSE_TAG_LX_SYMLINK
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY * rollback
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
static __inline void win_time_to_unix(LARGE_INTEGER t, BTRFS_TIME *out)
USHORT SubstituteNameOffset
#define RtlCopyMemory(Destination, Source, Length)
NTSTATUS write_file2(device_extension *Vcb, PIRP Irp, LARGE_INTEGER offset, void *buf, ULONG *length, bool paging_io, bool no_cache, bool wait, bool deferred_write, bool write_irp, LIST_ENTRY *rollback)
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
#define IO_REPARSE_TAG_SYMLINK
struct _device_extension * Vcb
#define BTRFS_TYPE_SYMLINK