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++] How do i freeze an address?

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

Joined: 03 Jan 2008
Posts: 61
Location: registry

PostPosted: Tue Mar 31, 2009 4:23 am    Post subject: [C++] How do i freeze an address? Reply with quote

I tried to freeze the time at Vista´s Minesweeper.
But i think this is not the best way..
How would you do it?

Code:
#include <cstdlib>
#include <iostream>
#include <windows.h>

using namespace std;

int main(int argc, char *argv[])
    {
    HWND hWnd;
    DWORD processId;
    HANDLE hGame;
    bool off = 0;
    int value = 0;
   
    printf("Searching for minesweeper.exe...\n");
   
    while(1)
            {
            Sleep(50);
            if(hWnd = FindWindow(0, TEXT("Minesweeper")))
                    break;
            }
   
    system("cls");
    printf("Minesweeper Time Freezer\n");
    printf("Press F6");
   
    GetWindowThreadProcessId(hWnd, &processId);
    hGame = OpenProcess(PROCESS_ALL_ACCESS, false, processId);
   
    while(1)
            {
            Sleep(50);
            if(GetAsyncKeyState(VK_F6) & 1)
                 {
                 ReadProcessMemory(hGame, (LPVOID) 0x2011BC4, &value, sizeof(value), 0);
                 while(1)
                         {
                         value -= 1;
                         WriteProcessMemory(hGame, (LPVOID) 0x2011BC4, &value, sizeof(value), 0);
                         Sleep(1000);
                         }
                 }
            }
    return 0;
    }
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Tue Mar 31, 2009 4:28 am    Post subject: Reply with quote

More effective way: hook the function writing to the address.
Back to top
View user's profile Send private message
Silent Storm
Advanced Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 61
Location: registry

PostPosted: Tue Mar 31, 2009 5:00 am    Post subject: Reply with quote

XD Question
And how would you write that as a code?
Back to top
View user's profile Send private message
SliderMan
Expert Cheater
Reputation: 0

Joined: 17 May 2006
Posts: 138

PostPosted: Tue Mar 31, 2009 5:57 am    Post subject: Reply with quote

there is no way of "freezing address" you need to constantly set it to the value of your choice with while();
_________________
[qoute]
Edit: Server Maintenance will be extended for infinite hours and will end at the end of time. Thank you and go fuck yourself.
[/qoute]
Back to top
View user's profile Send private message
Silent Storm
Advanced Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 61
Location: registry

PostPosted: Tue Mar 31, 2009 6:15 am    Post subject: Reply with quote

Like this?
Code:
    while(1)
            {
            Sleep(50);
            if(GetAsyncKeyState(VK_F6) & 1)
                 {
                 ReadProcessMemory(hGame, (LPVOID) 0x2011BC4, &time, sizeof(time), 0);
                 value = time;
                 while(1)
                         {
                         WriteProcessMemory(hGame, (LPVOID) 0x2011BC4, &value, sizeof(value), 0);
                         }
                 }
            }


The value changes sometimes 1 up and again 1 down :(
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Mar 31, 2009 6:33 am    Post subject: Reply with quote

what the hell.. what is with that & 1 ? reading a memory value, assigning it to a variable and re-writing that variable ?!?!?! learn the language before trying crap like that ^
Back to top
View user's profile Send private message
Silent Storm
Advanced Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 61
Location: registry

PostPosted: Tue Mar 31, 2009 6:58 am    Post subject: Reply with quote

Slugsnack wrote:
what the hell.. what is with that & 1 ? reading a memory value, assigning it to a variable and re-writing that variable ?!?!?! learn the language before trying crap like that ^


omg shut up.
Why are you afraid to post your freezing code???
I bet you cant do it self.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Tue Mar 31, 2009 8:02 am    Post subject: Reply with quote

how about you post an EDIT MEMORY code and i'll tell you how to freeze..
Back to top
View user's profile Send private message
Silent Storm
Advanced Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 61
Location: registry

PostPosted: Tue Mar 31, 2009 9:57 am    Post subject: Reply with quote

first post?
idiot..
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Tue Mar 31, 2009 10:19 am    Post subject: Reply with quote

Silent Storm wrote:
XD :?:
And how would you write that as a code?
There are so many ways. First experiment with CE, then move to coding your own hook proggy. That way the value won't go anywhere unless you unhook the function.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Mar 31, 2009 1:22 pm    Post subject: Reply with quote

Set a breakpoint on your address and find where it pops. Edit the instruction(s) as you see fit.

Just keep track of the bytes that actually make up the opcodes, as you can write those later for your changes.
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Tue Mar 31, 2009 1:31 pm    Post subject: Reply with quote

ok after looking into this i found a better solution for 64 bit users..
VirtualQuery address we want to watch ..add MEM_WRITE_WATCH to the area of memory want to watch..
use GetWriteWatch to pick up write to that memory area...

but for 32 bit it says GetWriteWatch isnt supported.. but after looking at olly and looking up both GetWriteWatch and ResetWriteWatch they seem to both be there..though they probably dont function correctly.. but msdn also says 32 bit users can use the MEM_WRITE_WATCH flag with VirtualAlloc after windows 2000 .. my question is if this functionality is working on XP 32 bit where is GetWriteWatch Getting its information from..(ie where is it stored) so that i can access it without GetWriteWatch.. :}

kind regards BanMe

information obtained from MSDN(microsoft delevoper network)..and my brain..

_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.


Last edited by BanMe on Tue Mar 31, 2009 5:03 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Silent Storm
Advanced Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 61
Location: registry

PostPosted: Tue Mar 31, 2009 4:53 pm    Post subject: Reply with quote

Where did you get this information?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25859
Location: The netherlands

PostPosted: Tue Mar 31, 2009 5:04 pm    Post subject: Reply with quote

From what I understand getwritewatch just checks if the dirty flag of a page has been set. (Just like the accessed flag)

You could probably just implement this yourself by setting the page table's dirty bit to 0 and then check when it changes to 1 (using a driver)
Of course, I doubt this will bring any extra efficiency, and you won't get notified as soon as it happen, only when you request an update.
I'd say just writing, the value is better.

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
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