Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dokan/dokan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,8 +1366,8 @@ VOID DOKANAPI DokanMapKernelToUserCreateFileFlags(
}

VOID DOKANAPI DokanInit() {
// ensure 64-bit alignment
assert(FIELD_OFFSET(EVENT_INFORMATION, Buffer) % 8 == 0);
// ensure 64-byte alignment, memcpy runs much faster on 64-byte aligned buffer on moden CPU
static_assert(FIELD_OFFSET(EVENT_INFORMATION, Buffer) % 64 == 0, "alignment error");

// this is not as safe as a critical section so to some degree we rely on
// the user to do the right thing
Expand Down
1 change: 1 addition & 0 deletions sys/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ typedef struct _EVENT_INFORMATION {
ULONG64 Context;
ULONG BufferLength;
ULONG PullEventTimeoutMs;
UCHAR Padding[24]; // ensure buffer is 64-byte aligned
UCHAR Buffer[DOKAN_EVENT_INFO_MIN_BUFFER_SIZE];
} EVENT_INFORMATION, *PEVENT_INFORMATION;

Expand Down