Getting full directory name in IRP_MJ_DIRECTORY_CONTROL handler for IRP_MN_QUERY_DIRECTORY requests

Good day.

How can I query a full directory name in my IRP_MJ_DIRECTORY_CONTROL
handler? I saw while debugging my virtual file system driver that file
objects for directories with partial (relative) names have a pointer to
the respective RelatedFileObject, but DDK claims that face=“Arial” size=“-1”>this pointer is
not valid during the processing of IRP_MJ_DIRECTORY_CONTROL and should
not be used. But how can I build a full directory name? I tried to use
IoQueryFileInformation(), but this call leads to deadlock because of
FO_SYNCHRONOUS_IO flag set in a file object. I cleared this flag
during a call to IoQueryFileInformation() and restored it back upon
return and everything worked fine, but maybe there’s a better and more
reliable and safe way to get this name???

Many thanks beforehand, any suggestions will be highly appreciated.

Konstantin Manurin