This is the AMP version of this page.
If you want to load the real page instead, click this text.

Help! Calling hooked function with string arg crashes game

fshn06

Platinian
Game: Growtopia
Native c++ game , armeabi-v7a

I am hooking the SendPacket symbol, everything is fine until I call SendPacket

SendPacket(int type, std::string& text, ENetPeer* peer)

C++:
void oSendPacket(int, std::string&, ENetPeer*);
void hkSendPacket(int type, std::string& text, ENetPeer* peer) {
    oSendPacket(type, text, peer);
}

C++:
std::string packet = "action|log\nmsg|test";
oSendPacket(3, packet, GetPeer());

All other hooks without string param have no issues

Crash Report
 
Try changing the function signature
SendPacket(int type, std::string* text, ENetPeer* peer)

And then you call it like
std::string packet = "action|log\nmsg|test"; oSendPacket(3, &packet, GetPeer());