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

Sept/Oct 2019 Issue of The NT Insider available

Download PDF here:

It’s a particularly BIG issue, too: 40 pages of technical goodness, ranging from WDF to Minifilters. Check it out.
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Does "physicaldrive0" always represent the HDD which installed the Windows OS ?

iFengHuangiFengHuang Member Posts: 62
edited June 21 in NTDEV

If not, how can I get the number of the HDD which installed the Windows OS in kernel driver? e.g. physicaldrive1, physicaldrive2 ...


  • anton_bassovanton_bassov Member Posts: 5,051

    Concerning your original question, consider the scenario when you have more than one Windows installation on your physical machine.

    Concerning the second one, all you ave to do is to use Google. If you bothered yourself with typing "GetSystemDirectory kernel" in a search box you would immediately get

    1. A thread where Mr.Noone answers your question.

    1. Once you are looking for"off-shelf solutions" you would get the following link

    This code sample demonstrates how to use ZwOpenSymbolicLinkObject() and ZwQuerySymbolicLinkObject() in order to query "\SystemRoot" (i.e. to do what Mr.Noone suggests in above mentioned post). If it is still not enough, this link also mentions the other possibilities like getting the info you are looking for from the registry, and even tells you the precise location where it may be found
    (i.e. HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PathName.)

    The funniest thing here that getting all this requires much less effort, compared to starting a thread and asking a question on NTDEV.

    Anton Bassov

  • iFengHuangiFengHuang Member Posts: 62

    Thank you very much..

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
Writing WDF Drivers 21 Oct 2019 OSR Seminar Space & ONLINE
Internals & Software Drivers 18 Nov 2019 Dulles, VA
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 27 Apr 2020 OSR Seminar Space & ONLINE