Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[help][c++] dll injector

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
RAKO
Master Cheater
Reputation: 0

Joined: 26 Jun 2006
Posts: 454

PostPosted: Sat Aug 16, 2008 8:59 am    Post subject: [help][c++] dll injector Reply with quote

I was working on an injector for myself. just a a educational thing and maybe I can use it in the future.

the code I used I found everywhere http://www.dreamincode.net/code/snippet407.htm

anyway there are two problems. the main one is that everything seems to work but the gui doesn't pop up like when I usually inject this dll.

the other problem is I can't turn a string into a LPCTSTR but don't worry about it (ill just hard code the process name).



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.


_________________
Dark Byte wrote:
Who knows, perhaps i'm a maple gm!!!!
Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Sat Aug 16, 2008 2:10 pm    Post subject: Reply with quote

nvm i found u solution might work
GetProcessID(process.c_str(),SetOfPID);
Back to top
View user's profile Send private message
RAKO
Master Cheater
Reputation: 0

Joined: 26 Jun 2006
Posts: 454

PostPosted: Sat Aug 16, 2008 7:52 pm    Post subject: Reply with quote

thanks for that. and I figured out my problem. (I just needed a good nights sleep) anyway I just need to use absolute path and make it run as admin on vista.
I already had it running as admin part but now I just need to figure out how to get the absolute path from a relative path. and how to force it to run as admin on any vista computer(instead of right clicking).

_________________
Dark Byte wrote:
Who knows, perhaps i'm a maple gm!!!!
Back to top
View user's profile Send private message
DeviantGeek
Newbie cheater
Reputation: 0

Joined: 30 Apr 2006
Posts: 20
Location: 127.0.0.1

PostPosted: Thu Aug 21, 2008 8:19 pm    Post subject: Reply with quote

to get the absolute path, im pretty sure if you do:
Code:
GetModuleFileName(NULL, szFileName, sizeof(szFileName));


first parameter is NULL, meaning it will get the fully qualified path of the process your dll is attached to. just remove the processes name from the string by nulling out the last backslash in it:
Code:
char szAbsolutePath[2046] = {0};

GetModuleFileName(NULL, szAbsolutePath, sizeof(szAbsolutePath));

*strrchr(szAbsolutePath, '\\') = '\0';


i havent coded anything for vista tho, so not sure if anything works differently or not.
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Thu Aug 21, 2008 8:28 pm    Post subject: Reply with quote

GetCurrentDirectory. No need to remove process name.
_________________
Back to top
View user's profile Send private message
igoticecream
Grandmaster Cheater Supreme
Reputation: 0

Joined: 23 Apr 2006
Posts: 1807
Location: 0x00400000

PostPosted: Thu Aug 21, 2008 8:35 pm    Post subject: Reply with quote

or getcwd()... i use this one because return char*
_________________
+~
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sat Aug 23, 2008 6:20 am    Post subject: Reply with quote

sponge wrote:
GetCurrentDirectory. No need to remove process name.


Can return false information if the process is currently loading information from another directory after setting the current directory with 'SetCurrentDirectory'. (Just a heads up cause I have run into this before.)

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Sat Aug 23, 2008 1:33 pm    Post subject: Reply with quote

Wiccaan wrote:
sponge wrote:
GetCurrentDirectory. No need to remove process name.


Can return false information if the process is currently loading information from another directory after setting the current directory with 'SetCurrentDirectory'. (Just a heads up cause I have run into this before.)
The thing is I see no use of using SetCurrentDirectory in a simple injector.
_________________
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Sat Aug 23, 2008 2:48 pm    Post subject: Reply with quote

OpenFileDialogs changes the current directory. (not sure if all, but in some languages they do)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites