GetProcessImageFileName path translation

时间:2016-08-31 18:43:02

标签: windows process path

i need to make a comparison between directory containing the image of some running process. when i use GetProcessImageFileName() the function give me a path with something like "\Device\HarddiskVolume3...." (i'll call it DevPath), instead of "C:..."(i'll call it C_Path) i need to make comparison with other C_Path style path, so i should translate in the other kind of path, is that possible?

since i don't really need the drive letter, if is too troublesome to make a correct path translation could i simply read only the part of char after the N° backslash? making somethinglike (Pseudocode)

if(  ReadAfter3Backslash(DevPath) == ReadAfter1Backslash(C_Path))...

now the second question is: the DevPath have everytime exactly 3 slash before starting with "normal" directory? if a full translation isn't viable will this work?

PS: i know that exist the function QueryFullProcessImageName() that can give the "C..." path style but i'v got a lot of problem with that function, it currently crash and is hard to make it portable to pre-vista OS. since this seemes to be a more difficult way to solve my problem i'm ignoring it until i have hope with translation solution.

0 个答案:

没有答案