When does ZwCreateFile return STATUS_BAD_NETWORK_PATH?

Sometimes, In our network redirector, ZwCreateFile fails with 0xC00000BE (STATUS_BAD_NETWORK_PATH)

But I couldn’t find any problem(The function’s inputs, and Device status etc.)
This is the code snippet.

InitializeObjectAttributes(
&ObjectAttributes,
ConnectionName,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL);

Status = ZwCreateFile(
pHandle,
SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
NULL, // Allocation size
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN_IF,
FILE_CREATE_TREE_CONNECTION | FILE_SYNCHRONOUS_IO_NONALERT,
NULL, // Ptr to EA Buffer
0); // Length of EA buffer

When does ZwCreateFile return STATUS_BAD_NETWORK_PATH?

The error occurs very rarely. But once it occurs, only rebooting can resolve the problem.

Is there anybody know this?

Thanks in advance.

The question is quite incomplete as you don’t say what you are opening. From ConnectionName I guess it is during connecting of share and your redirector is a mini-redirector. In such case inspect your implementation of following callbacks: MRxCreateSrvCall() MRxCreateVNetRoot().

Good luck!
Bronislav Gabrhelik

Thanks a lot!
I’m inspecting our implementation.

Yes, you were right.
If we open the file, the callbacks called by rdbss.

I’ve traced the log yesterday.
In unnormal situation(I mean STATUS_BAD_NETWORK_PATH), however, The callback functions even were not called. My god, What happens!