How to handle custom reparse points?

That doesn’t look like a valid reparse tag (see the IsReparseTagValid macro in ntifs.h). Not sure if that’s the problem but it certainly can’t help.

No, removing and putting back the reparse point would be a very bad design and is not necessary. You’d basically need to open every single file in PreCreate to know if it’s your reparse point or not. And then you’d be thrashing the disk adding and removing the reparse point for no reason. The inbox Cloud Filter uses this feature so it definitely works.

Sorry to say you need to keep debugging to figure out what’s going on. Is WordPad the ONLY app that doesn’t work? Do you see opens for your reparse point in your filter (by path) that are NOT acknowledged? Note that your WordPad ProcMon trace has a STATUS_REPARSE result which would indicate that you’re not capturing all opens of your reparse point.

(I’ll also say that you might want to invest in taking a seminar or getting some consulting help. Not sure what the ultimate goal of all this is but you want to make sure you understand how all of this is supposed to work before plowing forward to an implementation. If it’s just for learning then whatever, but if you’re trying to build a product it’s a good to take a step back before you get too far down a rat hole.)

In order to avoid conflict with reserved reparse tag in Microsoft, I just choose a different number for reparse tag. GUID is random-generated and I just didn’t type all of it down. Reparse data is simply 33. I’ll check if “IsReparseTagValid” but it might be okay since it works fine by FileTest.
I am seeing the same behavior using Notepad as well, so it is a general issue here. My filter driver is simple and similar to the minifilter sample. Maybe I should strip everything else down and just test the code you posted.
Another related question: Can I call FltFsControlFile to FSCTL_SET_REPARSE_POINT and FSCTL_GET_REPARSE_POINT in pre-create?

@Cal said:
Maybe I should strip everything else down and just test the code you posted.

I think that’s a good idea.

Another related question: Can I call FltFsControlFile to FSCTL_SET_REPARSE_POINT and FSCTL_GET_REPARSE_POINT in pre-create?

No, those require an opened File Object (i.e. FsContext != NULL) and the File Object is not open in PreCreate.