Show notifications via dll

05/05/2020 18:03 sonzenbi#1
i'm trying add to dll , but crash .
what wrong ?
thx for any help :D
Code:
	const DWORD Blue = 0x0077B580;
	const DWORD Blue2 = 0x008C9C30;
	const DWORD Blue3 = 0x00EEDE90;

	void Game::Blue(const wchar_t* msg)
	{
		void* _ecx = SroPP::detail::MemoryHack::RefPtr<void*>(0x110F80C);
		__asm
		{
			push msg;
			mov ecx, Blue3;
			call Blue2;
			mov ecx, _ecx;
			push eax;
			call Blue;
		}
	}
05/05/2020 23:33 Laag#82#2
PHP Code:
void CGInterface::ShowPinkNotify(std::wstringmsg)
{
    
reinterpret_cast<void(__thiscall *)(CGInterface*, std::wstring*)>(0x00777BF0)(thismsg);
}

void CGInterface::ShowBlueNotify(std::wstringmsg)
{
    
reinterpret_cast<void(__thiscall *)(CGInterface*, std::wstring*)>(0x0077B580)(thismsg);
}

void CGInterface::ShowGreenNotify(std::wstringmsg)
{
    
reinterpret_cast<void(__thiscall *)(CGInterface*, std::wstring*)>(0x0077B5B0)(thismsg);

PHP Code:
    void ShowPinkNotify(std::wstringmsg);
    
void ShowBlueNotify(std::wstringmsg);
    
void ShowGreenNotify(std::wstringmsg); 
[Only registered and activated users can see links. Click Here To Register...]
05/06/2020 00:28 Piskota#3
Quote:
Originally Posted by khaleed2010 View Post
PHP Code:
void CGInterface::ShowPinkNotify(std::wstringmsg)
{
    
reinterpret_cast<void(__thiscall *)(CGInterface*, std::wstring*)>(0x00777BF0)(thismsg);
}

void CGInterface::ShowBlueNotify(std::wstringmsg)
{
    
reinterpret_cast<void(__thiscall *)(CGInterface*, std::wstring*)>(0x0077B580)(thismsg);
}

void CGInterface::ShowGreenNotify(std::wstringmsg)
{
    
reinterpret_cast<void(__thiscall *)(CGInterface*, std::wstring*)>(0x0077B5B0)(thismsg);

PHP Code:
    void ShowPinkNotify(std::wstringmsg);
    
void ShowBlueNotify(std::wstringmsg);
    
void ShowGreenNotify(std::wstringmsg); 
@[Only registered and activated users can see links. Click Here To Register...]ebi you may find @[Only registered and activated users can see links. Click Here To Register...] 's [Only registered and activated users can see links. Click Here To Register...]
interesting
05/06/2020 06:46 sonzenbi#4
thanks for helping me, but i want to know something wrong with my code .
05/06/2020 08:52 florian0#5
Quote:
Originally Posted by sonzenbi View Post
thanks for helping me, but i want to know something wrong with my code .
The code doesn't look wrong, just not pretty.

Blue = CGInterface::ShowMessage_Warning
Blue2 = CTextStringManager::GetString
Blue3 = g_CTextStringManager
_ecx = g_pCGInterface

Code:
push msg;
mov ecx, g_tsm;
call GetString;
mov ecx, g_interface;
push eax;
call ShowMessage_Warning;
1. How are you calling it? What string are you putting into it? GetString only works for these UIIT_BLAH_BLAH-translation-tokens.

2. Can you run it in a debugger and check where it crashes (address and stack)?
05/06/2020 11:00 sonzenbi#6
Quote:
Originally Posted by florian0 View Post
The code doesn't look wrong, just not pretty.

Blue = CGInterface::ShowMessage_Warning
Blue2 = CTextStringManager::GetString
Blue3 = g_CTextStringManager
_ecx = g_pCGInterface

Code:
push msg;
mov ecx, g_tsm;
call GetString;
mov ecx, g_interface;
push eax;
call ShowMessage_Warning;
1. How are you calling it? What string are you putting into it? GetString only works for these UIIT_BLAH_BLAH-translation-tokens.

2. Can you run it in a debugger and check where it crashes (address and stack)?
Sadly, I have no knowledge of C ++ :( maybe a little bit
The only thing I can do was try again and again :rolleyes:
I sent the source code to you via private messenger, it would be better if you see it.
Thank you for spending the time helping me
05/06/2020 12:21 florian0#7
GetString only works with these UIIT_BLAH_BLAH. You are passing a string that should be displayed to it. Thats not going to work.

Code:
const wchar_t* killmsg = Convert(" [ " + killname + " ] " + " §· KÕt LiÔu " + " [ " + Mobname + " ] ");
SroPP::Game::Blue((killmsg));
If the string given to GetString is not found in the translation database, an empty string is returned. But that shouldn't crash your client. No idea why it happens unless you open your client in x32dbg and check where it crashes.

Anyhow: ShowMessage_Warning expects a std::wstring in VC80's ABI format. You need to put your message into that structure and pass it to ShowMessage_Warning. Using GetString is not going work for you in this case.
05/06/2020 16:33 sonzenbi#8
It seems, i'm having trouble with the basic knowledge
I will try to take advantage of your suggestions
05/06/2020 18:46 florian0#9
Quote:
Originally Posted by sonzenbi View Post
It seems, i'm having trouble with the basic knowledge
I will try to take advantage of your suggestions
I made a guide for handling strings in Silkroad: [Only registered and activated users can see links. Click Here To Register...]

Maybe this helps you understanding strings.