device path to dos path

hi,
i want to convert device path to dos path…
actually I want to get process name by process id,so i am using this code…
PsLookupProcessByProcessId(processId,&pEProcess);
ObOpenObjectByPointer(pEProcess,
OBJ_KERNEL_HANDLE,
NULL,
0,
NULL,
KernelMode,
&hProcess);
ObDereferenceObject (pEProcess);

nts = ZwQueryInformationProcess (hProcess,
27,
0,0,
&ulSize);

but it gives path as “\Device\hardDiskVolume1\windows\system32\taskmgr.exe”
and i want this as dos format “C:\windows\system32\taskmgr.exe”

How can i do it…I searched net and find some functions like IoVolumeDeviceToDosName() etc but i am not able to correctly use them and got BSOD serval times.
please help me.
thanks.

IoQueryFileDosDeviceName - but you need as a file object for the file and
all you have is a process object. A little googling will reveal that this is
a bit difficult.

Start Here: http://www.osronline.com/showThread.CFM?link=88362 good luck.

Mark Roddy

On Thu, Sep 2, 2010 at 8:34 AM, wrote:

> hi,
> i want to convert device path to dos path…
> actually I want to get process name by process id,so i am using this
> code…
> PsLookupProcessByProcessId(processId,&pEProcess);
> ObOpenObjectByPointer(pEProcess,
> OBJ_KERNEL_HANDLE,
> NULL,
> 0,
> NULL,
> KernelMode,
> &hProcess);
> ObDereferenceObject (pEProcess);
>
> nts = ZwQueryInformationProcess (hProcess,
> 27,
> 0,0,
> &ulSize);
>
> but it gives path as “\Device\hardDiskVolume1\windows\system32\taskmgr.exe”
> and i want this as dos format “C:\windows\system32\taskmgr.exe”
>
> How can i do it…I searched net and find some functions like
> IoVolumeDeviceToDosName() etc but i am not able to correctly use them and
> got BSOD serval times.
> please help me.
> thanks.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

thanks Mark,
for IoQueryFileDosDeviceName,i have to make a FILE_OBJECT,but i am not able
to get a file object for the device name.I am very new to driver programming
and actually i wantto make a process blocking application,thats the only
need.Frankly i have no intrest in WDM.
so, can u give me any code for do so,please.
thaks.

On Thu, Sep 2, 2010 at 8:40 PM, Mark Roddy wrote:
>
>> IoQueryFileDosDeviceName - but you need as a file object for the file and
>> all you have is a process object. A little googling will reveal that this is
>> a bit difficult.
>>
>> Start Here: http://www.osronline.com/showThread.CFM?link=88362 good
>> luck.
>>
>> Mark Roddy
>>
>>
>> On Thu, Sep 2, 2010 at 8:34 AM, wrote:
>>
>>> hi,
>>> i want to convert device path to dos path…
>>> actually I want to get process name by process id,so i am using this
>>> code…
>>> PsLookupProcessByProcessId(processId,&pEProcess);
>>> ObOpenObjectByPointer(pEProcess,
>>> OBJ_KERNEL_HANDLE,
>>> NULL,
>>> 0,
>>> NULL,
>>> KernelMode,
>>> &hProcess);
>>> ObDereferenceObject (pEProcess);
>>>
>>> nts = ZwQueryInformationProcess (hProcess,
>>> 27,
>>> 0,0,
>>> &ulSize);
>>>
>>> but it gives path as
>>> “\Device\hardDiskVolume1\windows\system32\taskmgr.exe”
>>> and i want this as dos format “C:\windows\system32\taskmgr.exe”
>>>
>>> How can i do it…I searched net and find some functions like
>>> IoVolumeDeviceToDosName() etc but i am not able to correctly use them and
>>> got BSOD serval times.
>>> please help me.
>>> thanks.
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>
>> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
>> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
>> the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>
>
>
>
>
>
> –
> -Dheeraj Patni
> Live and let Live
>

Start Here: http://www.osronline.com/showThread.CFM?link=88362 good luck.

Mark Roddy

On Fri, Sep 3, 2010 at 9:01 AM, Dheeraj Patni wrote:

> thanks Mark,
> for IoQueryFileDosDeviceName,i have to make a FILE_OBJECT,but i am not able
> to get a file object for the device name.I am very new to driver programming
> and actually i wantto make a process blocking application,thats the only
> need.Frankly i have no intrest in WDM.
> so, can u give me any code for do so,please.
> thaks.
>
>
> On Thu, Sep 2, 2010 at 8:40 PM, Mark Roddy wrote:
>>
>>> IoQueryFileDosDeviceName - but you need as a file object for the file
>>> and all you have is a process object. A little googling will reveal that
>>> this is a bit difficult.
>>>
>>> Start Here: http://www.osronline.com/showThread.CFM?link=88362 good
>>> luck.
>>>
>>> Mark Roddy
>>>
>>>
>>> On Thu, Sep 2, 2010 at 8:34 AM, wrote:
>>>
>>>> hi,
>>>> i want to convert device path to dos path…
>>>> actually I want to get process name by process id,so i am using this
>>>> code…
>>>> PsLookupProcessByProcessId(processId,&pEProcess);
>>>> ObOpenObjectByPointer(pEProcess,
>>>> OBJ_KERNEL_HANDLE,
>>>> NULL,
>>>> 0,
>>>> NULL,
>>>> KernelMode,
>>>> &hProcess);
>>>> ObDereferenceObject (pEProcess);
>>>>
>>>> nts = ZwQueryInformationProcess (hProcess,
>>>> 27,
>>>> 0,0,
>>>> &ulSize);
>>>>
>>>> but it gives path as
>>>> “\Device\hardDiskVolume1\windows\system32\taskmgr.exe”
>>>> and i want this as dos format “C:\windows\system32\taskmgr.exe”
>>>>
>>>> How can i do it…I searched net and find some functions like
>>>> IoVolumeDeviceToDosName() etc but i am not able to correctly use them and
>>>> got BSOD serval times.
>>>> please help me.
>>>> thanks.
>>>>
>>>> —
>>>> NTDEV is sponsored by OSR
>>>>
>>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>>> http://www.osr.com/seminars
>>>>
>>>> To unsubscribe, visit the List Server section of OSR Online at
>>>> http://www.osronline.com/page.cfm?name=ListServer
>>>>
>>>
>>> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
>>> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
>>> the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>
>>
>>
>>
>>
>>
>> –
>> -Dheeraj Patni
>> Live and let Live
>>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

> Frankly i have no intrest in WDM. so, can u give me any code for do so,please.

I just don’t know what to do - I was about to give you an easy solution but the above phrase just made me
lose any interest in helping you. Therefore, the maximum that I can do for you is to give you a function name as a hint. ZwQuerySymbolicLinkObject() is your friend here, but leave it for you to make heads and tails out of this info…

Anton Bassov

Wait, wait, wait…

You’re:

a) New to driver development
b) Trying to make a process blocking application AND
c) You have no interest in WDM?

“Which of these things, is not like the other?”

If you’re (a) and are trying to do (b), you need to learn (c).

You can’t modify the Windows Operating System by just having somebody throw you some code that you compile and like. This is THE OPERATING SYSTEM we’re talking about. People, like, USE IT to DO STUFF. When some hacked-up shite that you’ve thrown together because you “have no interest in WDM” fails to work, and somebody loses something valuable to them, are you gonna just say “oh well?”

This kind of “please somebody, give me some code because I can’t be bothered to do any real work” is becoming frighteningly common on this forum, and gives engineers a bad name and reputation.

Peter
OSR

i said that have no intrest just because after 10 of days i have no simple
answer of just how to convert a device name to dos name.i was using google 4
to 5 hours a day for 10 days just to find a easy solution.I am learning
wdm.i was so frustrated that windows WDM have many many many functions but
not a function that do such a important thing.thats why i said that.i also
tried some of code like ZwQuerySymbolicLinkObject etc but it converts DOS to
Device name as i found on google,so actually no use for me,and when i want
to do something with my own,i got BSOD.after a lot of gogle seach now,i am
able to get the drive name from a device name by*
IoVolumeDeviceToDosName()*.So,actually i am learning and intreasted
WDM.and i apologize to say that
phrase.sorry for my noobness.
but it gives only drive name and i want to convert the whole path to dos
name.after find the drive name ,now i can convert by repacing drive letter
at the head,but i dont want this solution because according to me it will be
slow.
thank you.i am realizing that its very very helping community.please all
forgive me for my noobness.

On Sun, Sep 5, 2010 at 7:48 AM, wrote:

>


>
> Wait, wait, wait…
>
> You’re:
>
> a) New to driver development
> b) Trying to make a process blocking application AND
> c) You have no interest in WDM?
>
> “Which of these things, is not like the other?”
>
> If you’re (a) and are trying to do (b), you need to learn (c).
>
> You can’t modify the Windows Operating System by just having somebody throw
> you some code that you compile and like. This is THE OPERATING SYSTEM we’re
> talking about. People, like, USE IT to DO STUFF. When some hacked-up shite
> that you’ve thrown together because you “have no interest in WDM” fails to
> work, and somebody loses something valuable to them, are you gonna just say
> “oh well?”
>
> This kind of “please somebody, give me some code because I can’t be
> bothered to do any real work” is becoming frighteningly common on this
> forum, and gives engineers a bad name and reputation.
>
> Peter
> OSR
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


-Dheeraj Patni
Live and let Live

>

> Frankly i have no intrest in WDM. so, can u give me any code for do
> so,please.

I just don’t know what to do - I was about to give you an easy
solution but
the above phrase just made me
lose any interest in helping you. Therefore, the maximum that I can do
for you
is to give you a function name as a hint. ZwQuerySymbolicLinkObject()
is your
friend here, but leave it for you to make heads and tails out of this
info…

Does it sound to you like the OP uses English as a first language? I
think he meant ‘knowledge’ or ‘understanding’ when he said ‘interest’.

James

use this:
PsReferenceProcessFilePointer (look at reactos for more info)
then use the
IoQueryFileDosDeviceName

8 year old post!

Please don’t resurrect kid discussions.