| View previous topic :: View next topic |
| Author |
Message |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Tue Dec 15, 2009 4:37 pm Post subject: [Help - C++] Chacnge pointer value |
|
|
i am trying to cahnge text value from edit box , in the game the character just don't have a name when i turn it on .
here is the code:
| Code: | //NAme HAck
void NameHack (HWND hWnd)
{
unsigned NameValue = GetDlgItemText(hWnd, IDC_EDIT1, NULL, FALSE);
SendMessage (GetDlgItem(hWnd, IDC_CHECKBOX1), BM_SETCHECK, true,0);
while (!NameHackExit)
{
*(DWORD*)(*(DWORD*)Name + Name1) = NameValue; //Change name //name=addres name1=offset.
Sleep (1);
}
Sleep (100);
//Off
SendMessage (GetDlgItem(hWnd, IDC_CHECKBOX1), BM_SETCHECK, false,0);
} |
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Dec 22, 2009 5:02 pm Post subject: |
|
|
Do this instead:
| Code: |
LPTSTR Buffer;
GetDlgItemText(hWnd, IDC_EDIT1, Buffer, MAX_PATH);
|
Because this:
| Code: |
unsigned NameValue = GetDlgItemText(hWnd, IDC_EDIT1, NULL, FALSE);
|
Is wrong because your not putting a buffer to the string that returns the dialog text.
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Dec 22, 2009 7:25 pm Post subject: |
|
|
| iPromise wrote: | Do this instead:
| Code: |
LPTSTR Buffer;
GetDlgItemText(hWnd, IDC_EDIT1, Buffer, MAX_PATH);
|
Because this:
| Code: |
unsigned NameValue = GetDlgItemText(hWnd, IDC_EDIT1, NULL, FALSE);
|
Is wrong because your not putting a buffer to the string that returns the dialog text. |
Your code is fundamentally flawed. Do this instead:
| Code: | TCHAR Buffer[ 256 ] = {0};
GetDlgItemText( hWnd, IDC_EDIT1, Buffer, SIZEOF Buffer / SIZEOF TCHAR ); |
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Tue Dec 22, 2009 7:35 pm Post subject: |
|
|
| Slugsnack wrote: | Your code is fundamentally flawed. Do this instead:
| Code: | TCHAR Buffer[ 256 ] = {0};
GetDlgItemText( hWnd, IDC_EDIT1, Buffer, SIZEOF Buffer / SIZEOF TCHAR ); |
|
You should use WM_GETTEXTLENGTH to get the amount of characters, then dynamically allocate the buffer to ensure the string isn't truncated.
|
|
| Back to top |
|
 |
Sharel972 Newbie cheater
Reputation: 0
Joined: 02 Nov 2009 Posts: 24 Location: israel
|
Posted: Wed Dec 23, 2009 12:55 pm Post subject: |
|
|
i get an error:
| Quote: | | hacks.cpp(1360) : error C2440: '=' : cannot convert from 'TCHAR [260]' to 'DWORD' |
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Dec 23, 2009 1:21 pm Post subject: |
|
|
| Show full code because the 2 lines I posted are fine
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Fri Dec 25, 2009 7:42 am Post subject: |
|
|
Do this:
| Code: |
char Buffer[MAX_PATH] = {0};
GetDlgItemText(hWnd, IDC_EDIT1, Buffer, MAX_PATH);
|
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Fri Dec 25, 2009 5:06 pm Post subject: |
|
|
| Slugsnack wrote: | | http://msdn.microsoft.com/en-us/library/cc500348.aspx |
Ironic you should bring up portability for an os-specific, game-specific, encode-specific, cheat program. He should use whatever encoding the game itself uses, whether that be ASCII, U-32, or one of the many flavors of wchar_t.
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Dec 29, 2009 11:20 pm Post subject: |
|
|
| @Slugsnack Does it really matter? That code works perfectly fine.
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Dec 30, 2009 8:28 am Post subject: |
|
|
| Flyte wrote: | | Slugsnack wrote: | | http://msdn.microsoft.com/en-us/library/cc500348.aspx |
Ironic you should bring up portability for an os-specific, game-specific, encode-specific, cheat program. He should use whatever encoding the game itself uses, whether that be ASCII, U-32, or one of the many flavors of wchar_t. |
Since you are so adept at demonstrating complete lack of comprehension skills, let me repeat some of the points there that are unrelated to portability:
- Unicode improves the efficiency of your application because the code performs faster and uses less memory. Windows internally does everything with Unicode characters and strings, so when you pass an ANSI character or string, Windows must allocate memory and convert the ANSI character or string to its Unicode equivalent.
- Using Unicode ensures that your application can easily call all nondeprecated Windows functions, as some Windows functions offer versions that operate only on Unicode characters and strings.
- Using Unicode ensures that your code easily integrates with COM (which requires the use of Unicode characters and strings).
- Using Unicode ensures that your code easily integrates with the .NET Framework (which also requires the use of Unicode characters and strings).
- Using Unicode ensures that your code easily manipulates your own resources (where strings are always persisted as Unicode).
*slow retarded clap for Flyte*
@iPromise : Re-read the article, unless you want a slow retarded round of applause too
|
|
| Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Wed Dec 30, 2009 9:14 am Post subject: |
|
|
and you will as well be amazed how little it takes to convert Multi Byte code to Unicode, simply not worth to not do it
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Wed Dec 30, 2009 2:11 pm Post subject: |
|
|
| Slugsnack wrote: | Since you are so adept at demonstrating complete lack of comprehension skills, let me repeat some of the points there that are unrelated to portability:
- Unicode improves the efficiency of your application because the code performs faster and uses less memory. Windows internally does everything with Unicode characters and strings, so when you pass an ANSI character or string, Windows must allocate memory and convert the ANSI character or string to its Unicode equivalent.
- Using Unicode ensures that your application can easily call all nondeprecated Windows functions, as some Windows functions offer versions that operate only on Unicode characters and strings.
- Using Unicode ensures that your code easily integrates with COM (which requires the use of Unicode characters and strings).
- Using Unicode ensures that your code easily integrates with the .NET Framework (which also requires the use of Unicode characters and strings).
- Using Unicode ensures that your code easily manipulates your own resources (where strings are always persisted as Unicode). |
Except that he is trying to replace a string in memory. He would not get the results he desired if he tried to replace an ASCII string with a Unicode string, hence why I said encode specific, and hence why you are retarded.
Honestly, Slugsnack, you're on such a crusade to attempt to prove your own ability that you miss obvious shit like that. It really is laughable.
| Slugsnack wrote: | Your code is fundamentally flawed. Do this instead:
| Code: | TCHAR Buffer[ 256 ] = {0};
GetDlgItemText( hWnd, IDC_EDIT1, Buffer, SIZEOF Buffer / SIZEOF TCHAR ); |
|
This is a very primitive and ugly way to get the length of an array. This is how I would do it:
| Code: | #include <iostream>
using namespace std;
template <typename T, unsigned int N>
const unsigned int lengthof(const T(&)[N]) {
return N;
}
int main()
{
long someArray[100];
cout << "sizeof == " << sizeof(someArray) << endl;
cout << "lengthof == " << lengthof(someArray) << endl;
return 0;
} |
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Dec 30, 2009 3:02 pm Post subject: |
|
|
| I'd argue that showing him that TCHARs should be used over ANSI, however imparted, is far more valuable than providing an answer to question he never asked. Though I'm sure you didn't realize that, since you clearly lack reading comprehension.
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Wed Dec 30, 2009 3:16 pm Post subject: |
|
|
| Slugsnack wrote: | | I'd argue that showing him that TCHARs should be used over ANSI, however imparted, is far more valuable than providing an answer to question he never asked. Though I'm sure you didn't realize that, since you clearly lack reading comprehension. |
I like how you immediately regress into passive aggressive arguments when you've got nothing intelligent to say...
It's so cute!
Really though, if you're going to try and quote me in an attempt to refute my arguments, then it would help if you did it correctly.
|
|
| Back to top |
|
 |
|