Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 05:39

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Casting map causes crash

Discussion on Casting map causes crash within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2019
Posts: 24
Received Thanks: 3
Question Casting map causes crash

I created .exe with a map in it like this:
Code:
typedef std::map<const char*, DWORD> tmap;
tmap myMap;
myMap.insert(std::make_pair("One", 0xFFFFF));
myMap.insert(std::make_pair("Two", 0xEEEEE));
std::cout << std::hex << &myMap << std::endl;
Then, I created a .dll like this:
Code:
typedef std::map<const char*, DWORD> tmap;
tmap myMap = *(tmap*)(Output of &myMap);
But somehow, when I inject this dll the program insta crashes. Why?
ozuromo is offline  
Old 05/16/2021, 19:42   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 166
Quote:
Originally Posted by ozuromo View Post
I created .exe with a map in it like this:
Code:
typedef std::map<const char*, DWORD> tmap;
tmap myMap;
myMap.insert(std::make_pair("One", 0xFFFFF));
myMap.insert(std::make_pair("Two", 0xEEEEE));
std::cout << std::hex << &myMap << std::endl;
Then, I created a .dll like this:
Code:
typedef std::map<const char*, DWORD> tmap;
tmap myMap = *(tmap*)(Output of &myMap);
But somehow, when I inject this dll the program insta crashes. Why?
Are you pausing your program execution after line ?:
std::cout << std::hex << &myMap << std::endl;

if not memory will be released and casting will point to invalid pointer
elmarcia is offline  
Reply


Similar Threads Similar Threads
Using Xlarge mp pot causes Client crash
03/29/2013 - SRO Private Server - 0 Replies
Hey epvpers, When people buy Xlarge mana pot 820 and either use it or log out without using, their chars are bugged and they cant login. Where should I look? I currently delete the _inventory information, well updating it to 0 for such chars to let them reconnect.. any ideas? thank you Note: If I buy them and sell them there is no problem. If I use them then client crashes and I can no longer login until update my inventory to 0 for all cells. Thx in advance, Tychus It...
[problem] Vsro add item to NPC causes Gmaeserver to Crash
11/24/2012 - Silkroad Online - 0 Replies
i used a query by IceAmStiel USE SRO_VT_SHARD /* ITEMS TO NPC FOR GOLD by Caipi */ Declare @ItemID int Declare @yourPrice int Declare @WhichTAB varchar(74) SET @ItemID = 23 /* The Item ID of the Item you want to add to the NPC*/ --## <-- SET @yourPrice = 5000 /* The price per Unit */ --## <--
Changing values causes the game to crash?
10/20/2011 - S4 League - 3 Replies
Ok i'm using neku's item manger and changing the values of the effects they do change, but when i enter a room it just crashes not even giving me a chance the effect items. Maybe it's because the Neku's Trainner has a block to it ? I mean I could change it but it just crashes after i get it right. Any solutions would be great =)
flash bang causes a crash
09/13/2011 - Soldier Front - 5 Replies
idk why this is happening but when i get hit with a flash bang in game my soldier front just closes no error no nothing it just ends any time someone hits me with a flash even the slightest bit will pay if someone finds a way to fix my problem



All times are GMT +2. The time now is 05:39.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.