Example #1
0
void WndProcEater::Release() {
	while (numExtraProcs) ReleaseExtraProc(extraProcs[0].proc);
	if (hWndEaten && IsWindow(hWndEaten)) {
		RemoveProp(hWndEaten, L"LilyHaxxor");
		SetWindowLongPtr(hWndEaten, GWLP_WNDPROC, (LONG_PTR)eatenWndProc);
		hWndEaten = 0;
		eatenWndProc = 0;
	}
}
	void Deactivate() {
		FreeState();
		if (active) {
			if (!wmm)
				ReleaseExtraProc(WindowsMessagingWndProc);
			active = 0;
			wmk = 0;
		}
		// hWndDlg = 0;
	}
Example #3
0
LRESULT WndProcEater::_OverrideWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    if (hWnd != hWndEaten)
        fprintf(stderr, "Totally mismatched window handles on OverrideWndProc!\n");

    ExtraWndProcResult res = CONTINUE_BLISSFULLY;
    LRESULT out = 0;
    // Here because want it for binding, even when no keyboard mode is selected.
    if (uMsg == WM_GETDLGCODE) {
        return DLGC_WANTALLKEYS | CallWindowProc(eatenWndProc, hWnd, uMsg, wParam, lParam);
    }

    for (int i = 0; i < numExtraProcs; i++) {
        // Note:  Second bit of deviceUpdateQueued is only set when I receive a device change
        // notification, which is handled in the GS thread in one of the extraProcs, so this
        // is all I need to prevent bad things from happening while updating devices.  No mutex needed.
        // if ((deviceUpdateQueued&2) && (extraProcs[i].flags & EATPROC_NO_UPDATE_WHILE_UPDATING_DEVICES)) continue;

        ExtraWndProcResult res2 = extraProcs[i].proc(hWnd, uMsg, wParam, lParam, &out);
        if (res2 != res) {
            if (res2 == CONTINUE_BLISSFULLY_AND_RELEASE_PROC) {
                ReleaseExtraProc(extraProcs[i].proc);
                i--;
            } else if (res2 > res)
                res = res2;
        }
    }

    if (res != NO_WND_PROC) {
        if (out == WM_DESTROY) {
            Release();
        }
        if (res == CONTINUE_BLISSFULLY)
            out = CallWindowProc(eatenWndProc, hWnd, uMsg, wParam, lParam);
        else if (res == USE_DEFAULT_WND_PROC)
            out = DefWindowProc(hWnd, uMsg, wParam, lParam);
    }
    return out;
}