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 


[C#]Injecting a DLL

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

Joined: 26 Apr 2008
Posts: 699
Location: -->formerly yoyonerd<--

PostPosted: Sat Oct 24, 2009 10:52 pm    Post subject: [C#]Injecting a DLL Reply with quote

So I'm using samurai's class to inject my dlls, I just had one question.

-How come the injection code works sometimes, while other times it just doesn't work at all

The error that always stops me is WriteProcessMemory not working correctly, any idea why it wouldn't work?

_________________
Back to top
View user's profile Send private message AIM Address
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sat Oct 24, 2009 11:43 pm    Post subject: Reply with quote

or you know, you could just debug it instead of expecting us to be psychic

also: GetLastError()
Back to top
View user's profile Send private message
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Sat Oct 24, 2009 11:55 pm    Post subject: Reply with quote

slovach is psychic.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Sun Oct 25, 2009 10:51 am    Post subject: Reply with quote

nwongfeiying wrote:
slovach is psychic.

and your a spammer.

Also what happens? Does it throw exceptions or what?

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Sun Oct 25, 2009 11:59 am    Post subject: Reply with quote

I sometimes have injection errors too: it always happens the first time after a reboot, and only once. After that it always works.
Is that also what happens to you?
Back to top
View user's profile Send private message
yoyonerd
Grandmaster Cheater
Reputation: 0

Joined: 26 Apr 2008
Posts: 699
Location: -->formerly yoyonerd<--

PostPosted: Sun Oct 25, 2009 1:02 pm    Post subject: Reply with quote

Oh crap, sorry for forgetting to put the actual error

I get error code 1008 which according to this website

http://help.netop.com/support/errorcodes/win32_error_codes.htm

is:

1008 An attempt was made to reference a token that does not exist. ERROR_NO_TOKEN

The error always appears right after the WPM line.

I'm on Vista, 32, UAC disabled

What makes this weird is that sometimes it works perfectly, other times I can't inject anything at all with his code.

No exceptions are thrown btw to answer that question.

_________________
Back to top
View user's profile Send private message AIM Address
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Oct 25, 2009 2:10 pm    Post subject: Reply with quote

Since we don't know where the source you're using is, I decided to take a trek over to that crappy forum of yours. Having found it, I can tell you that your pinvoke of WriteProcessMemory is incorrect, and that checking the last error as a condition is bad form as when it is set it is not unset, meaning anything could trigger it. Therefore, you should fix your pinvoke and check the return value.
Back to top
View user's profile Send private message
yoyonerd
Grandmaster Cheater
Reputation: 0

Joined: 26 Apr 2008
Posts: 699
Location: -->formerly yoyonerd<--

PostPosted: Sun Oct 25, 2009 9:03 pm    Post subject: Reply with quote

I'm using the file from:

http://forum.cheatengine.org/viewtopic.php?t=193237

_________________
Back to top
View user's profile Send private message AIM Address
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sun Oct 25, 2009 9:13 pm    Post subject: Reply with quote

set the privileges with adjusttokenprivileges
Back to top
View user's profile Send private message
yoyonerd
Grandmaster Cheater
Reputation: 0

Joined: 26 Apr 2008
Posts: 699
Location: -->formerly yoyonerd<--

PostPosted: Mon Oct 26, 2009 5:52 pm    Post subject: Reply with quote

How come I would be adjusting priveleges if the error is that there is no token?
_________________
Back to top
View user's profile Send private message AIM Address
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