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#]Declare and instantiate variable during runtime?
Goto page 1, 2  Next
 
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: Thu May 21, 2009 6:33 pm    Post subject: [C#]Declare and instantiate variable during runtime? Reply with quote

Is there a way for me to do that?

(I have a faint idea on how to do it, I just want to know if somebody already knows how. It'll save me many hours of blood, sweat, and tears.)
.
EDIT:

Does anyone know if I can use PostMessage to send arrow keys if HackShield Pro is the hack protection.[/b]

_________________


Last edited by yoyonerd on Mon May 25, 2009 1:17 am; edited 1 time in total
Back to top
View user's profile Send private message AIM Address
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Thu May 21, 2009 6:46 pm    Post subject: Re: [C#]How can I instantiate a variable during runtime? Reply with quote

yoyonerd wrote:
Does anyone know if I can use PostMessage to send arrow keys if HackShield Pro is the hack protection.


Yes, you can.
Back to top
View user's profile Send private message Visit poster's website
yoyonerd
Grandmaster Cheater
Reputation: 0

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

PostPosted: Thu May 21, 2009 7:06 pm    Post subject: Re: [C#]How can I instantiate a variable during runtime? Reply with quote

talker0 wrote:
yoyonerd wrote:
Does anyone know if I can use PostMessage to send arrow keys if HackShield Pro is the hack protection.


Yes, you can.


So do you know if I can use PostMessage (un-trampoline'd) to make my character move left or right in say a game that was once allowed in this forum.

_________________
Back to top
View user's profile Send private message AIM Address
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu May 21, 2009 7:20 pm    Post subject: Re: [C#]How can I instantiate a variable during runtime? Reply with quote

yoyonerd wrote:
talker0 wrote:
yoyonerd wrote:
Does anyone know if I can use PostMessage to send arrow keys if HackShield Pro is the hack protection.


Yes, you can.


So do you know if I can use PostMessage (un-trampoline'd) to make my character move left or right in say a game that was once allowed in this forum.


PostMessage won't do the trick. Use SendInput with CrippleHS which removes kernel hooks.
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: Thu May 21, 2009 7:57 pm    Post subject: Reply with quote

Ahh, thank you!

Neckson switching to HackShield Pro really screwed themselves up.

_________________
Back to top
View user's profile Send private message AIM Address
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Fri May 22, 2009 5:07 pm    Post subject: Reply with quote

yoyonerd wrote:
Ahh, thank you!

Neckson switching to HackShield Pro really screwed themselves up.


Not really. SendInput was already easy to bypass when GameGuard was still here.
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: Fri May 22, 2009 5:27 pm    Post subject: Reply with quote

Was it just the regular trampoline bypass?

I never knew SendInput could be used for arrow keys >.>

_________________
Back to top
View user's profile Send private message AIM Address
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Fri May 22, 2009 6:10 pm    Post subject: Reply with quote

yoyonerd wrote:
Was it just the regular trampoline bypass?

I never knew SendInput could be used for arrow keys >.>


SendInput is hooked in kernel mode. So you have two choices: Hop the kernel hook or copy it. I just copied it and registered a new service pointing at my sendinput and it works. Now that we have HS, this isn't needed unless your not using CrippleHS.
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: Fri May 22, 2009 6:15 pm    Post subject: Reply with quote

dnsi0 wrote:
yoyonerd wrote:
Was it just the regular trampoline bypass?

I never knew SendInput could be used for arrow keys >.>


SendInput is hooked in kernel mode. So you have two choices: Hop the kernel hook or copy it. I just copied it and registered a new service pointing at my sendinput and it works. Now that we have HS, this isn't needed unless your not using CrippleHS.


Is hopping the kernel hook the same as when we used to hook hop GG? As in trampolining the first 5 bytes?

If it isn't to hard to do, I might just do that instead of using CrippleHS since I can't get the injection code I'm using to work...(I'm using the one that was made in GP+)

Well it works, but when I inject nothing opens up, me thinks it might be vista but I've never really had a problem hacking before.

dnsi0, do you have an MSN or AIM?

_________________
Back to top
View user's profile Send private message AIM Address
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Fri May 22, 2009 8:25 pm    Post subject: Reply with quote

yoyonerd wrote:


Well it works, but when I inject nothing opens up, me thinks it might be vista but I've never really had a problem hacking before.


Nothin is supposed to come up..it just cripples it silently, no need for an interface.

_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sat May 23, 2009 7:06 am    Post subject: Reply with quote

yoyonerd wrote:
dnsi0 wrote:
yoyonerd wrote:
Was it just the regular trampoline bypass?

I never knew SendInput could be used for arrow keys >.>


SendInput is hooked in kernel mode. So you have two choices: Hop the kernel hook or copy it. I just copied it and registered a new service pointing at my sendinput and it works. Now that we have HS, this isn't needed unless your not using CrippleHS.


Is hopping the kernel hook the same as when we used to hook hop GG? As in trampolining the first 5 bytes?

If it isn't to hard to do, I might just do that instead of using CrippleHS since I can't get the injection code I'm using to work...(I'm using the one that was made in GP+)

Well it works, but when I inject nothing opens up, me thinks it might be vista but I've never really had a problem hacking before.

dnsi0, do you have an MSN or AIM?


Not really. Its actually really REALLY messy... Since Kernel Mode only has a function called MMGetSystemRouteinAddress() it pretty much screwed at getting Win32k.sys's functions. Since that function only retrieves addresses in Ntoskrnl.exe and Hal.dll X.X. So the other way is to retrieve it by KeServiceDescriptorTableShadow (FerrisBullerYourMyHero's Method). However this method FAILs on my computer because I have kaspersky internet security and it hooks SendInput into klif.sys so thats bs... So the method I used was a copied the bytes from the first 2 pushes of the code and just made a scan for it in win32k.sys. And return the address from it. Since not everyone's first 7 bytes are the same (because its PUSH xx then PUSH XXXXXXXX) (The first is the same but the second is not always) So you have to use CopyMemory and copy it into your Naked function. So you need to put like 7 nops there to do that.

My NtUserSendInput's Fist Few Bytes:

Code:
bf8c31a9 6a18            push    18h
bf8c31ab 68d8d798bf      push    offset win32k!`string'+0x5b8 (bf98d7d8)
bf8c31b0 e8b3d9f3ff      call    win32k!_SEH_prolog (bf800b68)
bf8c31b5 8365e400        and     dword ptr [ebp-1Ch],0
bf8c31b9 e8fcd8f3ff      call    win32k!EnterCrit (bf800aba)
bf8c31be 837d101c        cmp     dword ptr [ebp+10h],1Ch
bf8c31c2 0f85c8000000    jne     win32k!NtUserSendInput+0xff (bf8c3290)
bf8c31c8 8b7508          mov     esi,dword ptr [ebp+8]


I don't like this way so I just did:

Allocate some non-paged memory and copied the entire Win32k.sys over XD. Then I used the same method as above to get the address of SendInput then I did this: (SendInput-REadWin32k.sys)+FakeWin32k.sys

That's the new address. So I just registered a new service with that address and have my application all that. It works very well.
Code:
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: Sat May 23, 2009 6:33 pm    Post subject: Reply with quote

Damn, I'm still learning all of this stuff lol.

I've known how to program for a while, but all this low-level stuff is what I'm doing now.

So exciting to me =D

I'm going to guess you use C++ for this stuff though.

BTW, last question, I noticed SendInput does not have a Handle Parameter, does that mean it will only work on the foreground window?

_________________
Back to top
View user's profile Send private message AIM Address
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sat May 23, 2009 7:55 pm    Post subject: Reply with quote

yoyonerd wrote:
Damn, I'm still learning all of this stuff lol.

I've known how to program for a while, but all this low-level stuff is what I'm doing now.

So exciting to me =D

I'm going to guess you use C++ for this stuff though.

BTW, last question, I noticed SendInput does not have a Handle Parameter, does that mean it will only work on the foreground window?


Yes
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Sun May 24, 2009 12:51 pm    Post subject: Reply with quote

Why would it be benefitable to init a var at runtime?
_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
yoyonerd
Grandmaster Cheater
Reputation: 0

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

PostPosted: Mon May 25, 2009 1:17 am    Post subject: Reply with quote

Beloved Hero wrote:
Why would it be benefitable to init a var at runtime?


I actually meant declare AND instantiate variables at runtime. I was sleepy when I made the thread, now I look like an idiot ._.

If you wanna know, I'm making a macro program, having variables as part of a script would be pretty useful.

_________________
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
Goto page 1, 2  Next
Page 1 of 2

 
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