lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 6/12/2011 8:54 PM, Lorenzo Donati wrote:
On 12/06/2011 13.18, KHMan wrote:
On 6/12/2011 5:52 PM, steve donovan wrote:
On Sun, Jun 12, 2011 at 11:06 AM, Lorenzo Donati wrote:
[snip]
Add a method path() to return the actual process path in the file
system. I
don't know if this is easy to do (maybe not, since autoit doesn't
have it),
but it could be possible since Sysinternals' "ProcessExplorer"
shows it.

Ah, I see what you mean: the existing get_process_name() method
gives
the exe name but not the full path. I will investigate this
further.

GetModuleFileNameW


Are you sure?

 From [1] it seems that GetModuleFileNameW is just the Unicode
version of GetModuleFileName. Excerpt from [1] (emphasis mine):

"Retrieves the fully-qualified path for the file that contains the
specified module. THE MODULE MUST HAVE BEEN LOADED BY THE CURRENT
PROCESS."

The current process here is the lua interpreter running the script
where winapi's get_processes() is called. So this shouldn't be
able to return the path of an arbitrary process active on the
system and whose pid is returned by get_processes().

Am I missing something?

Oh, you were talking about the second part of that paragraph -- I was thinking about the first part of that paragraph. My bad :-)

Come to think of it, Cygwin provides winexename in its /proc filesystem.

The MSDN link you provided already points to the solution, which seems to be GetModuleFileNameEx. But it means going into security rights issues... I'll wait for someone else to do this, ha ha.

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia