Solved crash c++/VS 2012

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
code:
recoiil.h
C++:
class RecoilPlayer;

class RecoilPlayer
{
public:
	__int32 Recoil; //0x0000 
char _0x0004[60];

static RecoilPlayer* Singleton (int*address)
{
return *(RecoilPlayer**)address;
}
};//Size=0x0040
main.cpp
C++:
DWORD WINAPI Game_thread (LPVOID)
{
	CreateConsole();
	DWORD Recoil_Eng = (DWORD)GetModuleHandle("Game.exe") + 0x13F135C;
	DWORD offsets[] = {0x50 , 0x138 , 0xC , 0x4 , 0x3C};
	int* locPlayer = ReadPointer(Recoil_Eng, offsets ,5);
	RecoilPlayer* localPlayer = RecoilPlayer::Singleton(locPlayer);
	printf ("address = %X\n" , localPlayer->Recoil);

	localPlayer->Recoil = 100;
When i call "
C++:
localPlayer->Recoil = 100
" - crash and if
C++:
printf ("address = %X\n" , localPlayer->Recoil);
- crash . Where is my error?
 
Last edited:

somethingsomethingdarksid

Newbie
Full Member
Apr 25, 2013
17
209
2
Your answer doesn't really give any appropriate information to your emistz.

return *(RecoilPlayer**)address; /// wtf? :O

return (RecoilPlayer *) *address; // IF THE VALUE IS STORED AT THE LOCATION (i.e. the variable's value) - and is a memory address.
return (RecoilPLayer *) address; // if you just want the address of this (which won't work anyway cuz address will go out of context when the function ends.


It looks like you're trying to 'copy' the value pointed at by address.

Anwyay, your problem could be anywhere. If you're assigning a value to address that isn't a valid memory location, that could crash - for example.
Output would be nice.

You're also doing it a bad way...

return reinterpret_cast<RecoilPLayer *>(*address); // ASSUMING that the value stored in address is a valid memory pointer....


I'm guessing you're going to still have errors.
 

emistz

Jr.Coder
Dank Tier Donator
Nobleman
May 3, 2013
71
338
0
Can't say for sure, but that pointer magic looks kinda messy:
static RecoilPlayer* Singleton (int*address)
{
return *(RecoilPlayer**)address;
}

You're casting into a RecoilPlayer ptr_ptr and then dereferncing it. Is that what you intend to do?
 

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
Can't say for sure, but that pointer magic looks kinda messy:
static RecoilPlayer* Singleton (int*address)
{
return *(RecoilPlayer**)address;
}

You're casting into a RecoilPlayer ptr_ptr and then dereferncing it. Is that what you intend to do?
i need to write "value in game class , param Recoil"
sorry for my english
 

VDV777

Jr.Coder
Full Member
Nobleman
Mar 31, 2013
87
437
1
Your answer doesn't really give any appropriate information to your emistz.

return *(RecoilPlayer**)address; /// wtf? :O

return (RecoilPlayer *) *address; // IF THE VALUE IS STORED AT THE LOCATION (i.e. the variable's value) - and is a memory address.
return (RecoilPLayer *) address; // if you just want the address of this (which won't work anyway cuz address will go out of context when the function ends.


It looks like you're trying to 'copy' the value pointed at by address.

Anwyay, your problem could be anywhere. If you're assigning a value to address that isn't a valid memory location, that could crash - for example.
Output would be nice.

You're also doing it a bad way...

return reinterpret_cast<RecoilPLayer *>(*address); // ASSUMING that the value stored in address is a valid memory pointer....


I'm guessing you're going to still have errors.
thank you help me a lot!
/close thread
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods