Ok the issue is I am reverse engineering a game (I use IDAPRO) and detouring a function. This function happens to be AddChatMessage(uchar,long,CTString,CTString)
I have the detour working its running to my function But i can't seem to figure out how to get CTString into a readable text -
FARPROC WINAPI myAddChatMessage(char *char1,long long1,char *String1, char *String2)
-
{
-
char szTemp[1024];
-
std::string str1 = String1;
-
std::string str2 = String2;
-
sprintf(szTemp, "string: %s string2: %s",str1.c_str(),str2.c_str());
-
MessageBox(NULL,szTemp,"Add Chat Message Function",MB_OK);
-
return false;
-
}
-
The Reverse Engineered Function -
AddChatMessage(uchar,long,CTString &,CTString &)
-
I have tried several different approaches this just happened to be the last one I tried. So if someone could please shed some light on this all help would be appreciated.
2 2266
Ok the issue is I am reverse engineering a game (I use IDAPRO) and detouring a function. This function happens to be AddChatMessage(uchar,long,CTString,CTString)
I have the detour working its running to my function But i can't seem to figure out how to get CTString into a readable text -
FARPROC WINAPI myAddChatMessage(char *char1,long long1,char *String1, char *String2)
-
{
-
char szTemp[1024];
-
std::string str1 = String1;
-
std::string str2 = String2;
-
sprintf(szTemp, "string: %s string2: %s",str1.c_str(),str2.c_str());
-
MessageBox(NULL,szTemp,"Add Chat Message Function",MB_OK);
-
return false;
-
}
-
The Reverse Engineered Function -
AddChatMessage(uchar,long,CTString &,CTString &)
-
I have tried several different approaches this just happened to be the last one I tried. So if someone could please shed some light on this all help would be appreciated.
It could be that your string needs to be a wide char. You will need to make szTemp, str1, str2 all into wide chars (wchar_t or TCHAR) then use a wide printf method, if memory servers I think you want wsprintf but you'll need to double check.
You need to use the TCHAR mappings. You cannot use char, wchat_t, sprintf, etc in Windows code. Try: -
FARPROC WINAPI myAddChatMessage(PCHAR char1,long long1,PCHAR String1, PCHAR String2)
-
{
-
TCHAR szTemp[1024];
-
//could be either string or wstring based on the character set
-
//STL is incompatible with TCHAR. You will need your own #define
-
//to toggle between string and wstring based on Unicode defined or not.
-
//
-
//std::string str1 = String1;
-
//std::string str2 = String2;
-
_stprintf(szTemp, TEXT("string: %s string2: %s"),String1,String2);
-
MessageBox(NULL,szTemp,TEXT("Add Chat Message Function"),MB_OK);
-
return false;
-
}
-
MessageBox is also a TCHAR mapped function toggling between MessageBoxA and MessageBoxW.
Read http://msdn2.microsoft.com/en-us/library/ms860358.aspx.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Penn Markham |
last post by:
Hello all,
I am writing a script where I need to use the system() function to call
htpasswd. I can do this just fine on the command line...works great
(see attached file, test.php). When my...
|
by: pablo |
last post by:
Dear Newsgroupers,
The 'main' page contains a call to a function in an included file. This
function puts a html-form on the screen. Before the form gets posted (to the
'main' page) some prior...
|
by: Lenard Lindstrom |
last post by:
I was wondering if anyone has suggested having Python determine
a method's kind from its first parameter. 'self' is a de facto
reserved word; 'cls' is a good indicator of a class method
( __new__...
|
by: Brad Tilley |
last post by:
Is there an easier way to do this:
def print_whats_returned(function):
print function
print type(function)
|
by: Derek Hart |
last post by:
I wish to execute code from a string. The string will have a function name,
which will return a string:
Dim a as string
a = "MyFunctionName(param1, param2)"
I have seen a ton of people...
|
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: laredotornado |
last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to
have my Javascript function execute from the BODY's "onload" method,
but if there is already an onload method defined, I would...
|
by: Greg |
last post by:
I know I can use the Microsoft.VisualBasic.Left function to get the left
portion of a string, but I would prefer to avoid using any
Microsoft.VisualBasic namespace items. What is the equivilant in...
|
by: dlreich |
last post by:
While viewing a form, I use Find (Ctrl-F) to find a new record. In On Current for the form, I use GoToControl to adjust the display of one of the fields in the new record. Is there any way I can...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |