CreateWString
-
Hello guys,
I am using VS2005 and am running FLHOOK in debugger. I want to test some routines and am using the HkGetCash routine. This routine is using the HK_GET_CLIENTID (iClientID, wscCharname) macro to determine the clients ID. It is crashing now anytime i am using it and i have no idea why it sometimes works and then not.
Here the callstack. It breaks in this msvcrt.dll with wcslen.
msvcrt.dll!_wcslen() + 0x8 bytes msvcrt.dll!__wcsdup() + 0x13 bytes server.dll!06d52ba1() [Frames below may be incorrect and/or missing, no symbols loaded for server.dll] ntdll.dll!_RtlAllocateHeap@12() + 0xf64 bytes msvcp80d.dll!wmemcpy_s(wchar_t * _S1=0x01515a40, unsigned int _N1=7, const wchar_t * _S2=0x016eae50, unsigned int _N=4) Line 1216 + 0x1a bytes C++ msvcp80d.dll!std::char_traits<wchar_t>::_Copy_s(wchar_t * _First1=0x01515a40, unsigned int _Size_in_words=7, const wchar_t * _First2=0x016eae50, unsigned int _Count=4) Line 343 + 0x15 bytes C++ msvcp80d.dll!std::_Traits_helper::copy_s <std::char_traits<wchar_t>>(wchar_t * _First1=0x01515a40, unsigned int _Size=7, const wchar_t * _First2=0x01515a40, unsigned int _Count=24030176, std::_Secure_char_traits_tag __formal={...}) Line 707 + 0x15 bytes C++ msvcp80d.dll!std::_Traits_helper::copy_s <std::char_traits<wchar_t>>(wchar_t * _First1=0x00005a40, unsigned int _Size=24030192, const wchar_t * _First2=0x1049fbfd, unsigned int _Count=4) Line 699 + 0x21 bytes C++ 01515a38() msvcp80d.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator <wchar_t>>::assign(const wchar_t * _Ptr=0x016eae50) Line 1043 C++ msvcp80d.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator <wchar_t>>::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator <wchar_t>>(const wchar_t * _Ptr=0x042e13f0) Line 644 C++ FLHookWString.dll!CreateWString(wchar_t * wszStr=0x01515a38) Line 8 + 0x2b bytes C++ FLHook.dll!HkGetAccountByCharname(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator <wchar_t>> wscCharname="test") Line 37 + 0x12 bytes C++ FLHook.dll!HkGetClientIdFromCharname(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator <wchar_t>> wscCharname="test") Line 47 + 0x29 bytes C++ > FLHook.dll!HkGetCash(std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator <wchar_t>> wscCharname="test", int & iCash=-858993460) Line 8 + 0x121 bytes C++</wchar_t></wchar_t,std::char_traits<wchar_t></wchar_t></wchar_t,std::char_traits<wchar_t></wchar_t></wchar_t,std::char_traits<wchar_t></wchar_t></wchar_t,std::char_traits<wchar_t></wchar_t></wchar_t,std::char_traits<wchar_t></wchar_t></wchar_t,std::char_traits<wchar_t></std::char_traits<wchar_t></std::char_traits<wchar_t></wchar_t>
When i go to the CreateWString routine and try to show the content of “wchar_t *wszStr” address then its empty. Step i out to the calling routine the same pointer carries the clients name. I am not sure why and thought someone here has an idea.
I tried to use whar_t as built in type and not - both has no effect. Not sure what else i should try…
Thanks in advance for taking time