Advanced : Reading Memory and Comparing

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 36
Reputation: Raven11 is an unknown quantity at this point 
Solved Threads: 1
Raven11 Raven11 is offline Offline
Light Poster

Advanced : Reading Memory and Comparing

 
0
  #1
Jun 26th, 2005
Hello, I've been working on a security based software from which I got the idea from another program. Here are the details:

Upon load of the software a 4 digit string is given (I.E: 1kfh). Then you're prompt for a password. To find your password you would use a Memory Editor (TSearch, Artmoney, etc) and search the 3 digits given to you. Out of all the thousands results given, you are to find your password. (obviously, very hard which is the point).

This is where I'm at in my program to do the same thing:
I give user a random string (they see 6 characters; the full string contains 12). They have to search the 6 characters using a ME. The correct password will be the remaining 6 characters will they will locate.

This is my problem:
When my code searches for the remaining code it comes back in UNICODE. I convert to text using wchar_t MyString = _T. After doing so, it still does not work. I think the search part is wrong, or I'm just REALLY bad at converting lol (which I sure I am).

My Question:
I'm familiar with ArtMoney so I don't know if other memory editors are the same. I'll set up an example to make the question make some sense (otherwise everything is very confusing).

Fun.exe gives me a random 3 characters out of 12. (Lets say it gives me, "The")
Full random string = TheFunString. (I dont know this)
Manualy, I search Fun.exe using ArtMoney, "The", there are 7 accurances. I locate the correct one and find the remaning 9 characters.
I enter the remaining characters in the Password box.

How can I search the full string in the program to to compare userinput with the correct value?

Hope this makes sense.. Thanks for any help IA.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 36
Reputation: Raven11 is an unknown quantity at this point 
Solved Threads: 1
Raven11 Raven11 is offline Offline
Light Poster

Re: Advanced : Reading Memory and Comparing

 
0
  #2
Jun 27th, 2005
Sorry for double post, but I could not find the edit button. Anyways, I fixed the search so I do not need help with the question above anymore. I do have a new question which has come up.

  1. char * Serial = (char*)(LPCTSTR)PreSerial;
  2. if (strlen(Serial) > 5) Serial[5] = 0;
  3. // PreSerial = (CString)Serial;
  4. char * Input = (char*)(LPCTSTR)m_Password;
  5. if (Serial == Input) m_Warning.SetWindowText("Correct");
  6. else m_Warning.SetWindowText(PreSerial);
  7. }
Some reason whether I compare CString or Char* it always returns to the else statement. My question is, how do I compare the strings so the IF Else statement will work properly.

Other ways I have tried:

  1. if (m_Password.Compare(PreSerial) == 0) //correct
  2. else // invalid
Again it would always return invalid.

I have also tried char * MyVar = (char*)MyCstring.GetString() but that is the same as LPCTSTR.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 466
Reputation: winbatch is on a distinguished road 
Solved Threads: 18
winbatch's Avatar
winbatch winbatch is offline Offline
Posting Pro in Training

Re: Advanced : Reading Memory and Comparing

 
0
  #3
Jun 27th, 2005
You defined Input and Serial as char *. You need to you strcmp to compare.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 36
Reputation: Raven11 is an unknown quantity at this point 
Solved Threads: 1
Raven11 Raven11 is offline Offline
Light Poster

Re: Advanced : Reading Memory and Comparing

 
0
  #4
Jun 27th, 2005
Hey, I figured out the problem. I forgot to add:

  1. UpdateData();
  2. CString Password = int pID;
  3. UpdateData(FALSE);
Your post helped me with another problem I was having though. Thanks for the help.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 13
Reputation: oboler is an unknown quantity at this point 
Solved Threads: 1
oboler's Avatar
oboler oboler is offline Offline
Newbie Poster

Re: Advanced : Reading Memory and Comparing

 
0
  #5
Jun 27th, 2005
Originally Posted by winbatch
You defined Input and Serial as char *. You need to you strcmp to compare.
Don't ignore this advice. The sytax bugs are easy to fix as they usually stop it compiling. The Symantic bugs like this (you are comparing if two memory addresses are equal rather than if the strings are the same!) are a lot harder to catch. The program will compile but it will do strange things.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC