I've found it
Code:
FILE *fp,*fp2;
fp = fopen ("client.dll", "rb+"); // opens CLIENT.DLL file readonly
if (fp != NULL)
{
fp2 = fopen ("client.bak", "wb"); // opens backup file for writing
if (fp2 != NULL)
{
int c, count = 0;
// get the size of the CLIENT.DLL file
while ((c = fgetc (fp)) != EOF)
count++;
// if it differs from the CS 1.3 original DLL size
/* if (count != 655360)
{
printf ("CLIENT.DLL is not the genuine Counter-Strike 1.3 DLL. Patch cancelled.\n");
return -1; // don't allow it to be patched
}
*/
rewind (fp); // return back to beginning of file
while ((c = fgetc (fp)) != EOF)
fputc (c, fp2); // duplicate client.dll to client.bak
fclose (fp2); // close backup file
fseek (fp, 191620L, SEEK_SET); // seek at the start of patch offset
fputc (0x2B, fp); // actually patch client.dll (at offset 191620)
fclose (fp); // close patched file
printf ("Counter-Strike's CLIENT.DLL has been successfully patched.\n");
}
}
else
printf ("CLIENT.DLL not found in ../cstrike/cl_dlls. Patch cancelled.\n");
return 0; // end of processing
but it does not work in CS 1.5. It crashes. Of course size of client.dll is different than 1.3. If only somebody would know the position of 'patch offset' in cs 1.5 ...