Handling FileMode Create in CreateFile

23 views
Skip to first unread message

mr.c...@gmail.com

unread,
Jul 2, 2021, 3:26:49 PM7/2/21
to Dokan
When CreateFile receives a FileMode of Create, the documentation says that the file should be truncated if it already exists.  This looks like something that I need to handle myself since SetEndOfFile is not called in this case.  

My question is, when should I truncate the file?
  1. If the CreateFile call is successful, truncate the file there.
  2. Wait until WriteFile is called and truncate it before setting the new bytes.
Any help is greatly appreciated.

Thanks,
Brian

Adrien JUND

unread,
Jul 2, 2021, 4:39:41 PM7/2/21
to do...@googlegroups.com
Hi Brian,

The file needs to be directly truncated during the CreateFile call when you see that it is a success.

--
You received this message because you are subscribed to the Google Groups "Dokan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dokan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dokan/12f55ef6-a0b4-4c8c-831b-e0d55d019f6an%40googlegroups.com.

mr.c...@gmail.com

unread,
Jul 2, 2021, 8:27:42 PM7/2/21
to Dokan
Thank you!
Reply all
Reply to author
Forward
0 new messages