| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		GRPsuper9 Newbie cheater
  Reputation: 0
  Joined: 04 Feb 2007 Posts: 16
 
  | 
		
			
				 Posted: Thu Jan 01, 2009 12:35 am    Post subject: Freezing Time For Minesweeper With Dev-C++ | 
				       | 
			 
			
				
  | 
			 
			
				cheatengine.org/forum/viewtopic.php?p=1840234&sid=5322a6300256dd3f174a51f827c81b53
 
 
Hey guys, I've been testing out this code lately with Dev-C++ v 4.9.9.2.
 
I've copied and pasted it exactly as it is without modifying anything, and then I compiled it, and injected it with InjecTOR v1.1, but the message box saying it has been injected, didn't pop up, and the hack is not working either. I then deleted the freezing function of the hack, and just kept the DLLMain, and I kept the messagebox in there to check if it would popup the messagebox then, but it didn't.
 
 
I literly just started coding with Dev-C++ in order to start developing dlls to do some code cave injection. Can anyone help? | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Stylo Grandmaster Cheater Supreme
  Reputation: 3
  Joined: 16 May 2007 Posts: 1073 Location: Israel
  | 
		
			
				 Posted: Thu Jan 01, 2009 5:43 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				i think i got that problem once when i used dev c++ too
 
some1 told me it's might cause cuz dev is out of date and that's why dll's made by dev compiler cannot be injected (pretty sure that's the problem) try using VC++ | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		FerrisBuellerYourMyHero Master Cheater
  Reputation: 0
  Joined: 14 Feb 2007 Posts: 401 Location: Inside your <kernel>
  | 
		
			
				 Posted: Thu Jan 01, 2009 10:26 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Dll's are tricky with dev c++! there's a certain way you have to do it so that it will call DllMain on loading. It's strange and you would think a dll should always call DllMain upon being loaded. I had the same problem before with dev. So I avoid making dll's with dev for that very reason. For .exe's it works fairly well though.
 
 
as 1qaz suggested try MSVC++ 2008 Express Edition. It too is free like dev, but it's a lot better I think. Inline assembly is a piece of cake, and DllMain gets called properly without having to do anything special. _________________
 You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!
 
 
   | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		sloppy Expert Cheater
  Reputation: 0
  Joined: 17 Aug 2008 Posts: 123
 
  | 
		
			
				 Posted: Thu Jan 01, 2009 12:58 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | (Dev-C++) DllMain in C++ Modules wrote: | 	 		  | If you do not force DllMain to be a C function it will not be found by the call in the Mingw32 start up code, and the default DllMain in libmingw32.a will get called instead. If your initialization code doesn't seem to be called, and you are programming in C++, check that your DllMain function is either in a separate C source file or is forced to be a C function with extern "C". | 	  
 
 	  | Code: | 	 		  extern "C" BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved)
 
{
 
    MessageBox(NULL, "Test", "DllMain", MB_OK);
 
    return TRUE;
 
} | 	  
 
As others mentioned, I recommend you use Microsoft Visual C++. Dev-C++ is old and outdated. | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		92Garfield I'm a spammer
  Reputation: 57
  Joined: 20 Dec 2007 Posts: 5871 Location: Banana Republic Germany
  | 
		
			
				 Posted: Thu Jan 01, 2009 2:27 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Visual C++ is C++.net and not actually C++
 
1. it needs .Net
 
2. It wont run with other OS' _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		GRPsuper9 Newbie cheater
  Reputation: 0
  Joined: 04 Feb 2007 Posts: 16
 
  | 
		
			
				 Posted: Thu Jan 01, 2009 3:47 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Thanks guys for the help! It now works with Dev-c++ by using extern "C".
 
 
But I decided to try Visual C++ 2008 as you guys said and I get this error when trying to build that same code on VC++2008.
 
 
 	  | Code: | 	 		  ------ Build started: Project: MineSweeper, Configuration: Debug Win32 ------
 
Compiling...
 
hack.cpp
 
url here(18) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [27]' to 'LPCWSTR'
 
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 
Build log was saved at "url here"
 
MineSweeper - 1 error(s), 0 warning(s)
 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== | 	  
 
Any Help? | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		FerrisBuellerYourMyHero Master Cheater
  Reputation: 0
  Joined: 14 Feb 2007 Posts: 401 Location: Inside your <kernel>
  | 
		
			
				 Posted: Thu Jan 01, 2009 3:59 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | 92Garfield wrote: | 	 		  Visual C++ is C++.net and not actually C++
 
1. it needs .Net
 
2. It wont run with other OS' | 	  
 
 
You're misinformed. Where did you get your information? Visual C++ is just the name of the compiler. It can be used to code managed (.NET) code. But that sucks and its no longer supported!
 
 
You can also and should write native win32 unmanaged code with it. And if you go so far as to select /MT (Multi-threaded) instead of /MD (Multi-threaded DLL) as your runtime library. Your application will run on practically any windows machine, without needing anything extra installed. You can also write cross-platform code that can run on windows + linux + more. You can if you do it right! .NET is not required and not even used if you create native code.
 
 
Visual C# however doesn't create native code but instead creates Microsoft intermediate language (MSIL).
 
 
.NET frameworks are required in the case of C# or if you code managed C++. (not recommended) If you like managed then go with C#. the framework is required because it is what takes the MSIL and converts it into native code. Which to me sounds like a big performance hit. But go with what you like.
 
 
 	  | GRPsuper9 wrote: | 	 		  Thanks guys for the help! It now works with Dev-c++ by using extern "C".
 
 
But I decided to try Visual C++ 2008 as you guys said and I get this error when trying to build that same code on VC++2008.
 
 
 	  | Code: | 	 		  ------ Build started: Project: MineSweeper, Configuration: Debug Win32 ------
 
Compiling...
 
hack.cpp
 
url here(18) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [27]' to 'LPCWSTR'
 
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 
Build log was saved at "url here"
 
MineSweeper - 1 error(s), 0 warning(s)
 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== | 	  
 
Any Help? | 	  
 
 
Its because by default unicode is used. I recommend using ascii though as unicode is not necessary in most cases.
 
 
Just change MessageBox into MessageBoxA  
 
 
also when your using other functions that deal with strings add the A at the end (if it has two versions)
 
 
In this thread I helped someone who had the same kind of problem. Except they were passing a unicode string to an ascii function while your passing a ascii string to a unicode function. Quite the opposite but still the same issue.
 
 
http://forum.cheatengine.org/viewtopic.php?t=344696 _________________
 You know, life moves pretty fast. If you don't stop and look around once in a while, You could miss it!
 
 
  
  Last edited by FerrisBuellerYourMyHero on Thu Jan 01, 2009 9:13 pm; edited 1 time in total | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		GRPsuper9 Newbie cheater
  Reputation: 0
  Joined: 04 Feb 2007 Posts: 16
 
  | 
		
			
				 Posted: Thu Jan 01, 2009 4:31 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Cool! Thank you very much for your help. Im going to make a new post about another nooby question that I have. Gotta learn C++ somehow  . Thanks again everyone! | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |