| View previous topic :: View next topic |
| Author |
Message |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sun Aug 10, 2008 3:06 pm Post subject: Getting Directory of a process |
|
|
Is it possible to get the directory of a process?
Or even better, the directory of where the DLL was before it was injected?
Thanks.
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Aug 10, 2008 3:43 pm Post subject: |
|
|
| Since your injector is usually with your DLL, GetCurrentDirectory
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sun Aug 10, 2008 3:44 pm Post subject: |
|
|
Are you talking about getting the path of a loaded dll in the current exe?
If so, then you can just loop through the modules (CreateToolhelp32Snapshot() + Module32First()/Next()) and find yours, then get the szExePath param, I think.
_________________
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Sun Aug 10, 2008 3:46 pm Post subject: |
|
|
GetModuleFileName/Ex.
_________________
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sun Aug 10, 2008 4:47 pm Post subject: |
|
|
| samuri25404 wrote: | Are you talking about getting the path of a loaded dll in the current exe?
If so, then you can just loop through the modules (CreateToolhelp32Snapshot() + Module32First()/Next()) and find yours, then get the szExePath param, I think. |
Eh, that only returns the exe name. =(
I think.
Edit: Opps, I made a mistake. I was thinking of Process32Next.
Thanks!
Last edited by kitterz on Sun Aug 10, 2008 5:56 pm; edited 1 time in total |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Aug 10, 2008 5:50 pm Post subject: |
|
|
| slovach wrote: | | Since your injector is usually with your DLL, GetCurrentDirectory |
GetCurrentDirectory can be changed during runtime, so it doesn't make for a feasible solution in an application that reads data from various locations. (If it uses this and SetCurrentDirectory to flip flop between things.)
I would go with what sponge suggested as it would be static.
_________________
- Retired. |
|
| Back to top |
|
 |
|