News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

name of file from where process was stared from

Started by setty, July 11, 2007, 04:41:47 PM

Previous topic - Next topic

setty

How can i find the only name of file from where process was stared from?
Sure i know about GetCommandLine but this return full path to that file with name while i need only name.

Vortex

Have a look at the path functions described in Masmlib.hlp :

QuoteGetAppPath
NameFromPath
GetPathOnly

lingo

If you know PID you can use ZwQueryInformationProcess  :bdg
It is documented in "Windows NT/2000 Native API Reference" by Gary Nebbett
http://www.amazon.com/Windows-2000-Native-API-Reference/dp/1 578701996/sr=8-1/qid=1167832363/ref=sr_1_1/102-9267251-80489 01?ie=UTF8&s=books

Regards,
Lingo

MichaelW

Also documented by Microsoft: MSDN:ZwQueryInformationProcess, and I think there are multiple undocumented methods, but I suspect that the request was actually for something along the lines of GetCommandLine combined with NameFromPath.
eschew obfuscation

hutch--

setty,

The API that probably does what you need is GetModuleFileName() which is used in the GetAppPath() procedure in the masm32 library. This API gets the raw path of the running process which you can then parse to get either the file name or the path.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php