bitte problem med min buffer, kan i se fejlen ?
først lige lidt kode da (microsoft visual c++ 6.0) :bool CHookDlg::HookClient (char *location, char *ip)
{
PROCESS_INFORMATION pi;
STARTUPINFO si = {0};
char* space = " ";
char* setting = " -noupdate";
char* buf = new char[strlen(location)+strlen(space)+strlen(ip)+strlen(setting)];
char* buf_ptr= buf; // done so we can mover buf_ptr to were we need to memcpy
memcpy(buf_ptr, location, strlen(location));
buf_ptr+=strlen(location);
memcpy(buf_ptr, space, strlen(space));
buf_ptr+=strlen(space);
memcpy(buf_ptr, ip, strlen(ip));
buf_ptr+=strlen(ip);
memcpy(buf_ptr, setting, strlen(setting));
Log2File(TRUE, "Attempting to run and hook %s\n", buf);
/* Ok, load the client into suspended mode */
if (!CreateProcess("Game Windows Client", buf, 0, 0, 0, CREATE_SUSPENDED | CREATE_NEW_PROCESS_GROUP, 0, 0, &si, &pi))
HookError("CreateProcess()", (HANDLE)NULL);
delete buf;
return true;
}
okay her er hvad min buffer siger den har:
[07:22:38] Attempting to run and hook c:\games\mitspil\hej.exe 80.164.0.0 -noupdateýýýý
skulle være
[07:22:38] Attempting to run and hook c:\games\mitspil\hej.exe 80.164.0.0 -noupdate
nogle gange ser bufferen helt anderledes ud, og jeg kan ikke liiige se hvor det er galt henne.
en quick fix måske ?
tror selv det er den måde jeg regner bufferens størelse ud, men kan ikke lige sætte fingeren på det.
ved godt det er lidt kluntet kode :)