Skip to content

Commit efe585b

Browse files
committed
Update dokan, dokan_fuse and dokan_np implementation from Dokany v2.3.0.1000.
1 parent 03c9000 commit efe585b

34 files changed

+140
-120
lines changed

Mile.Dokany/Include/dokan/dokan.h

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77
@@ -56,7 +56,7 @@ extern "C" {
5656
/** @{ */
5757

5858
/** The current Dokan version (200 means ver 2.0.0). \ref DOKAN_OPTIONS.Version */
59-
#define DOKAN_VERSION 220
59+
#define DOKAN_VERSION 230
6060
/** Minimum Dokan version (ver 2.0.0) accepted. */
6161
#define DOKAN_MINIMUM_COMPATIBLE_VERSION 200
6262
/** Driver file name including the DOKAN_MAJOR_API_VERSION */
@@ -204,8 +204,14 @@ typedef struct _DOKAN_FILE_INFO {
204204
* Must be set in \ref DOKAN_OPERATIONS.ZwCreateFile if the file appears to be a folder.
205205
*/
206206
UCHAR IsDirectory;
207-
/** Flag if the file has to be deleted during DOKAN_OPERATIONS. Cleanup event. */
208-
UCHAR DeleteOnClose;
207+
/**
208+
* Flag if the file has to be deleted during \ref DOKAN_OPERATIONS.Cleanup event.
209+
*
210+
* If a prior \ref DOKAN_OPERATIONS.ZwCreateFile call with \c FILE_FLAG_DELETE_ON_CLOSE or \ref DOKAN_OPERATIONS.DeleteFile
211+
* / \ref DOKAN_OPERATIONS.DeleteDirectory with DOKAN_FILE_INFO.DeletePending set to \c TRUE succeed on an object,
212+
* the last handle open on that object will have this variable set to \c TRUE and therefore will have to delete the object.
213+
*/
214+
UCHAR DeletePending;
209215
/** Read or write is paging IO. */
210216
UCHAR PagingIo;
211217
/** Read or write is synchronous IO. */
@@ -294,7 +300,7 @@ typedef struct _DOKAN_OPERATIONS {
294300
*
295301
* Cleanup request before \ref CloseFile is called.
296302
*
297-
* When DOKAN_FILE_INFO.DeleteOnClose is \c TRUE, the file in Cleanup must be deleted.
303+
* When DOKAN_FILE_INFO.DeletePending is \c TRUE, the file in Cleanup must be deleted.
298304
* The function cannot fail therefore the filesystem need to ensure ahead
299305
* that a the delete can safely happen during Cleanup.
300306
* See DeleteFile documentation for explanation.
@@ -480,7 +486,7 @@ typedef struct _DOKAN_OPERATIONS {
480486
*
481487
* Check if it is possible to delete a file.
482488
*
483-
* DeleteFile will also be called with DOKAN_FILE_INFO.DeleteOnClose set to \c FALSE
489+
* DeleteFile will also be called with DOKAN_FILE_INFO.DeletePending set to \c FALSE
484490
* to notify the driver when the file is no longer requested to be deleted.
485491
*
486492
* The file in DeleteFile should not be deleted, but instead the file
@@ -489,9 +495,9 @@ typedef struct _DOKAN_OPERATIONS {
489495
* appropriate error codes, such as \c STATUS_ACCESS_DENIED or
490496
* \c STATUS_OBJECT_NAME_NOT_FOUND, should be returned.
491497
*
492-
* When \c STATUS_SUCCESS is returned, a Cleanup call is received afterwards with
493-
* DOKAN_FILE_INFO.DeleteOnClose set to \c TRUE. Only then must the closing file
494-
* be deleted.
498+
* When \c STATUS_SUCCESS is returned, a Cleanup call is received afterwards
499+
* on the last context open on this object with DOKAN_FILE_INFO.DeletePending set to \c TRUE,
500+
* Only then must the closing file be deleted.
495501
*
496502
* \param FileName File path requested by the Kernel on the FileSystem.
497503
* \param DokanFileInfo Information about the file or directory.
@@ -507,7 +513,7 @@ typedef struct _DOKAN_OPERATIONS {
507513
*
508514
* Check if it is possible to delete a directory.
509515
*
510-
* DeleteDirectory will also be called with DOKAN_FILE_INFO.DeleteOnClose set to \c FALSE
516+
* DeleteDirectory will also be called with DOKAN_FILE_INFO.DeletePending set to \c FALSE
511517
* to notify the driver when the file is no longer requested to be deleted.
512518
*
513519
* The Directory in DeleteDirectory should not be deleted, but instead
@@ -517,9 +523,9 @@ typedef struct _DOKAN_OPERATIONS {
517523
* \c STATUS_OBJECT_PATH_NOT_FOUND, or \c STATUS_DIRECTORY_NOT_EMPTY, should
518524
* be returned.
519525
*
520-
* When \c STATUS_SUCCESS is returned, a Cleanup call is received afterwards with
521-
* DOKAN_FILE_INFO.DeleteOnClose set to \c TRUE. Only then must the closing file
522-
* be deleted.
526+
* When \c STATUS_SUCCESS is returned, a Cleanup call is received afterwards
527+
* on the last context open on this object with DOKAN_FILE_INFO.DeletePending set to \c TRUE,
528+
* Only then must the closing file be deleted.
523529
*
524530
* \param FileName File path requested by the Kernel on the FileSystem.
525531
* \param DokanFileInfo Information about the file or directory.

Mile.Dokany/Include/dokan/dokanc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77

Mile.Dokany/Include/dokan/fileinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77

Mile.Dokany/Include/dokan/public.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2017 - 2023 Google, Inc.
4+
Copyright (C) 2017 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77
@@ -105,6 +105,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
105105
#define DOKAN_RETRY_CREATE 512
106106
#define DOKAN_EVER_USED_IN_NOTIFY_LIST 1024
107107
#define DOKAN_FILE_CHANGE_LAST_WRITE 2048
108+
#define DOKAN_FCB_STATE_DELETE_PENDING 4096
108109

109110
// used in DOKAN_START->DeviceType
110111
#define DOKAN_DISK_FILE_SYSTEM 0
@@ -376,7 +377,7 @@ typedef struct _EVENT_INFORMATION {
376377
LARGE_INTEGER CurrentByteOffset;
377378
} Write;
378379
struct {
379-
UCHAR DeleteOnClose;
380+
UCHAR DeletePending;
380381
} Delete;
381382
struct {
382383
ULONG Timeout;

Mile.Dokany/Mile.Dokany.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ errno_to_ntstatus_error
116116
convert_args
117117
free_converted_args
118118

119-
; Utils
119+
; Utils
120120
utf8_to_wchar_buf_old
121121
utf8_to_wchar_buf
122122
wchar_to_utf8_cstr

Mile.Dokany/Source/access.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77

Mile.Dokany/Source/cleanup.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77
@@ -36,6 +36,10 @@ VOID DispatchCleanup(PDOKAN_IO_EVENT IoEvent) {
3636
: -1,
3737
IoEvent);
3838

39+
if (IoEvent->EventContext->FileFlags & DOKAN_DELETE_ON_CLOSE) {
40+
IoEvent->DokanFileInfo.DeletePending = 1;
41+
}
42+
3943
if (IoEvent->DokanInstance->DokanOperations->Cleanup) {
4044
// ignore return value
4145
IoEvent->DokanInstance->DokanOperations->Cleanup(

Mile.Dokany/Source/close.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77

Mile.Dokany/Source/create.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77

Mile.Dokany/Source/directory.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Dokan : user-mode file system library for Windows
33
4-
Copyright (C) 2020 - 2023 Google, Inc.
4+
Copyright (C) 2020 - 2025 Google, Inc.
55
Copyright (C) 2015 - 2019 Adrien J. <liryna.stark@gmail.com> and Maxime C. <maxime@islog.com>
66
Copyright (C) 2007 - 2011 Hiroki Asakawa <info@dokan-dev.net>
77
@@ -620,6 +620,11 @@ VOID DispatchDirectoryInformation(PDOKAN_IO_EVENT IoEvent) {
620620

621621
CheckFileName(IoEvent->EventContext->Operation.Directory.DirectoryName);
622622

623+
CreateDispatchCommon(IoEvent,
624+
IoEvent->EventContext->Operation.Directory.BufferLength,
625+
/*UseExtraMemoryPool=*/FALSE,
626+
/*ClearNonPoolBuffer=*/TRUE);
627+
623628
// check whether this is handled FileInfoClass
624629
if (fileInfoClass != FileDirectoryInformation &&
625630
fileInfoClass != FileFullDirectoryInformation &&
@@ -638,11 +643,6 @@ VOID DispatchDirectoryInformation(PDOKAN_IO_EVENT IoEvent) {
638643
return;
639644
}
640645

641-
CreateDispatchCommon(IoEvent,
642-
IoEvent->EventContext->Operation.Directory.BufferLength,
643-
/*UseExtraMemoryPool=*/FALSE,
644-
/*ClearNonPoolBuffer=*/TRUE);
645-
646646
IoEvent->EventResult->Operation.Directory.Index =
647647
IoEvent->EventContext->Operation.Directory.FileIndex;
648648

0 commit comments

Comments
 (0)