开发者

Is it possible to determine the working directory of another process?

开发者 https://www.devze.com 2023-01-01 22:23 出处:网络
Given a HANDLE (or ProcessID) to process \'A\' is it possible on 开发者_StackOverflow中文版Win32 for an unrelated process \'B\' to determine the current working directory of process \'A\' ?Yes, but it

Given a HANDLE (or ProcessID) to process 'A' is it possible on 开发者_StackOverflow中文版Win32 for an unrelated process 'B' to determine the current working directory of process 'A' ?


Yes, but it's non-trivial. The only way of which I'm aware is to use CreateRemoteThread to execute GetCurrentDirectory in the context of the target program.


I thought this may be possible using the same technique you can use to get an external processes command line and there does seem to be a _RTL_USER_PROCESS_PARAMETERS->CurrentDirectoryPath which sounds promising.

(The example doesn't state that the APIs are largely undocumented and that they are not future proof, so YMMV)

0

精彩评论

暂无评论...
验证码 换一张
取 消