Exemplo n.º 1
0
void d_redirect (long from, long to, unsigned char* rbuf, long len=0)
{
    // enable write to code pages
    d_enable_write (from);
    // copy orig code stub to our "ret_code"
    len = len ? len : sizeof(d_jmp_code)-1; // - trailing 0x00
    memcpy ((void *) rbuf, (const void *) from, len);
    // make ret code
    *(long *)(d_jmp_code + 1) = from + len;
    memcpy ((char *) rbuf + len, (const void *) d_jmp_code, 6);
    // make hook code
    *(long *)(d_jmp_code + 1) = to;
    memcpy ((void *) from, (const void *) d_jmp_code, 6);
}
Exemplo n.º 2
0
char* CNWNXReset::OnRequest(char *gameObject, char* Request, char* Parameters)
{
	// This assumes you call SetLocalString like this
	// SetLocalString(oObject, "NWNX!RESETPLUGIN!SHUTDOWN", "...................................");

	if (stricmp (Request, "SHUTDOWN") == 0)
	{
		// This will output "SHUTDOWN" as the request
		Log("* NWNXResetPlugin - Got request: %s.\n", Request);

		char *pShutdown = (char*)0x00402700;
		if(pShutdown[0] == 0x75)
		{
			d_enable_write((unsigned long)pShutdown);
			pShutdown[0] = 0x74;
		}
	}

	return NULL;
}