You want information about disk partition for the file name?

Hi all.

The required log analyzer for windows audit file names in C#. In the log output format of messages about file operations looks like this:


You want to get the file name in the format \Device\HarddiskVolumeNN (NN is the partition number)\path\to\file.ext name of the file. Quite satisfied with the drive as "\Device\HarddiskVolume", and the letter I then replaced using replace.

Found that "seems" this can be done via WMI, but it seems to me that this is a long operation, at the same time the logging system does this without any noticeable delays.
July 8th 19 at 15:49
1 answer
July 8th 19 at 15:51
Thank you. The QueryDosDevice function came very handy. If anyone is interested to expand its application on C#, see example:

Only in my case a funny joke happened. After upgrading Windoze (I have 8) suddenly began to get out of the event not only with physical paths to the partitions, but ordinary letters. It is not clear!? - ima.Halvorson commented on July 8th 19 at 15:54

Find more questions by tags ProgrammingC#.NETVisual Studio