Help in converting AA script to C++
<p>I've this AA script (Cheat Engine scripting language):</p>

<pre><code>[ENABLE]
alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(exit)

00415e19:
jmp newmem

returnhere:
newmem:
mov [00451104],0//moves 0 to the clock variable
//nop//nops the clock increaser

exit:
jmp returnhere

[DISABLE]
dealloc(newmem)
00415e19:
mov [00451104],eax
//Alt: db A3 04 11 45 00
</code></pre>

<p>It's working - stopping the game clock. Now, I'm trying to convert this code to C++. Here's what I did so far:</p>

<pre><code>#include &lt;windows.h&gt;

HWND FindIcyTower()
{
    return FindWindowA(NULL, "Icy Tower v1.4");
}

void WPM(HWND hWnd,int address, byte *data, int dataSize)
{
    DWORD proc_id;
    GetWindowThreadProcessId(hWnd, &amp;proc_id);

    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);

    if(!hProcess) 
        return;

    WriteProcessMemory(hProcess, (LPVOID)address, data, dataSize, NULL);

    CloseHandle(hProcess); 
}

void EnableClockHack()
{
    WPM(FindIcyTower(), 0x00415E19, {0xc7, 0x05, 0x04, 0x11 ,0x45, 0x00, 0x00, 0x00, 0x00, 0x00}, 9);
}

void DisableClockHack()
{
    WPM(FindIcyTower(), 0x00415E19, {0xA3, 0x04, 0x11, 0x45, 0x00}, 4);
}
</code></pre>

<p>but it crashes the game, instead of stopping the clock. Any ideas?return FindWindowA(NULL, "Icy Tower v1.4");</p>
