Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

How to open a file with with a object path containing UNICODE non-ascii characters with ZwOpenFile?

blangeblange Member Posts: 20


Based on the Storport Miniport example I have created a virtual file backed USB block storage. It works well, when the underlying file is stored in a path, which only contains ascii-like characters.

Now I created a path which contains arabic unicode symbols (e.g to allow for different locales) and try to open the file in the Kernel with ZwOpenFile resulting in NTSTATUS Code STATUS_OBJECT_PATH_NOT_FOUND (0xc000003a).

The file is created in the user space code and visible with i.e. Windows Explorer. Strings in the code are represented as wchar_t arrays.
The user space code then prepends L"\DosDevices\" to the absolute file path and sends it into the Kernel space.
Hexdumps of the UNICODE String Buffer in the Kernel and the wchar_t in the userspace are identical and the path printed with DebugView seems correct.
(If the DebugView output is stored to a log file, a unicode capable editor shows the correct path.)

I am not sure if the "conversion" to a DosDevice is correct. My understanding is that \DosDevices\C: is a link to the C: drive and the I do not need to modify the following path. Is this correct?

Has anyone experience how to deal with UNICODE paths in Kernel space?


  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,401

    Shouldn't be anything special that needs done. Is the request making it to the file system?


  • blangeblange Member Posts: 20

    Hi Scott,
    Thank you very much for your reply. Some moments ago I saw an error in my unicode codepage in user space. So the Kernel was correct that the path is not available. I do not fully understand why my logfile was able to show the correct string, but the issue itself is resolved. You are absolutely right: Nothing special to it, if you control your unicode ;-)

    Sorry for the discussion. If possible we should close it.

  • Scott_Noone_(OSR)Scott_Noone_(OSR) Administrator Posts: 3,401

    Nice! Glad it's fixed, thanks for following up.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE