crypto Posted May 31, 2009 Posted May 31, 2009 (edited) Here is the loader I built. Might be useful for someone trying to patch some bytes. The code may look like a certain tutorial from arteam. But I can reassure you that it took 3 of us. To make that code work. It took us 5 hours of editing that piece of **** tutorial that arteam built to make it work properly. So here is working code as of May 30th 2009. Can be used for games or programs to patch certain memory addresses.#include "stdafx.h"#include "windows.h"#include "string.h"void GetLastErrorMsg(char *szBuf){// DWORD szBuf; LPVOID lpMsgBuf; DWORD dw = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL ); wsprintf((LPTSTR)szBuf, (LPSTR)"Loader failed with error %d: %s", dw, lpMsgBuf); LocalFree(lpMsgBuf);}BOOL CALLBACK EnumWindowsProc( HWND hWnd, // handle to parent window LPARAM lParam ) // application-defined value { char ClassName[256]; GetClassName(hWnd,(LPTSTR)ClassName, 256); char caption[256]; GetWindowText(hWnd,(LPTSTR)caption,256); if(strstr(caption,"Loader.exe")!=0) //For the function strstr. If the second string is found in the first string a pointer to the location of string 1 is returned { HWND *hw=(HWND*)lParam; *hw=hWnd; return FALSE; } return TRUE; }// A little class (C++) which is useful to store the single patch data. It Edited May 31, 2009 by crypto
crypto Posted May 31, 2009 Author Posted May 31, 2009 Fixed the problem with this line under resumethread at the end. WaitForSingleObject(pi.hThread, INFINITE);
ghandi Posted May 31, 2009 Posted May 31, 2009 (edited) "piece of **** tutorial that arteam built to make it work properly"How far would you have gotten without that piece of **** and its code? (which wasn't plagiarized in any way, mind)Why initialize a value to the lParam parameter of the Enum callback, then change it to the other param, hWnd?Makes one ask the question, was it the (tested) source code in the tutorial that was the problem? Or was it that the copy/paste of the code wasnt all that was needed to get it working in a different context than the tutorial? Finally, what version of VC++ was the source written with and what version of VC++ did you eventually compile it with? If the answer is something like: written with VC++ 6.0 and you are trying to compile the code with VC++ 9.0, then there is every possibility that the 'older' code needs tweaking to compile in the newer version.HR,Ghandi Edited May 31, 2009 by ghandi
Nieylana Posted May 31, 2009 Posted May 31, 2009 wow, a piece of **** tutorial huh? maybe next time you wont use our stuff, and be stuck on the idea even longer... how long would it have taken you to write it from scratch huh?... cuz i mean clearly you dont have the ability to do it on your own, so be thankful it helped you out and quit your bitching... (and next time... dont use our stuff if you dont like it, but keep your crying to yourself)
crypto Posted May 31, 2009 Author Posted May 31, 2009 (edited) Microsoft Visual Studio 2008 Professional EditionVersion 9.0.21022.8 RTMFor EnumWindowsProc, I had to delcare ontop of the code so I copy pasted the sample code from the msdn website and started filling it out.and yes it was a piece of **** tutorial, that didn't have the right code at all. It had over 300 errors. Your telling me that is good code. Lmao.The context of the tutorial was the same as I was using it for. The code was just bs. Yes we ended up getting it to work but it looks nothing like thetutorial at all now. I think of a tutorial especially for coding to be right and correct. Otherwise don't supply code in the tutorial. A tutorial to meshould be a step by step process on how you got the process to work with whatever you are trying to do. Even if you go out and by a 10 year old bookthe code in that book still works today. That code was ****. Edited May 31, 2009 by crypto
ghandi Posted May 31, 2009 Posted May 31, 2009 If i had a dollar for every time someone messed up something and blamed the source, i'd be a rich man. So you'll understand why i am interacting about this. "I think of a tutorial especially for coding to be right and correct. Otherwise don't supply code in the tutorial. A tutorial to meshould be a step by step process on how you got the process to work with whatever you are trying to do. Even if you go out and by a 10 year old bookthe code in that book still works today. That code was ****. "This is rubbish. A book on *general* coding concepts, yes. But a tutorial on coding a specific application with a specific compiler (version and all) will have quirks. I have code that was written in VC++ 6.0, but to compile this code in VC++ 9.0 i need to use a lot more typecasting (read: EDITING), as 9.0 checks a lot more than 6.0.Does that mean the code is poorly written? No, the author wrote what they needed at the time, using the available tools. The fact that MS broke a lot of backward compatability (requiring editing to fix) doesnt mean the code was bad, it means that MS has a poor development model.The intention of ANY tutorial should be to teach concepts, not 100% fine detail. If the tutorial was written with this in mind, it shouldnt matter if the example code was written in COBOL, the underlying principles are the same. It is then up to the student to do some work themselves, such as researching the compiler they are using (and if it is a newer version than the tutorial uses, then checking what compatibility is available), instead of just pasting a chunk of code and then bitching when it wont compile verbatim.You still havent explained what version the original example code was written in... When the tutorial was from... What the title is, etc... Can you please provide more information?HR,Ghandi
SSlEvIN Posted May 31, 2009 Posted May 31, 2009 Crypto, Mate, no need for such rude words, even the source was complete garbage, and it wasn't. If I were you, I wouldn't even dare to admit that three of you guys were necessary to make shltty loader. Regards, SSlEvIN/(A)RTeam
Hyperlisk Posted May 31, 2009 Posted May 31, 2009 Mmm... Such hate in this thread... Unbelievable, really.
mudlord Posted May 31, 2009 Posted May 31, 2009 And why the loader? Bypassing a CRC check? If thats the case, reverse it properly! >-<
Recommended Posts