Jump to content
Jako

[C++] Remove Show Process from all users in Taskmgr.exe

Recommended Posts

This works on windows 7 / windows server 2012


BOOL CALLBACK EnumChildProc(
    _In_ HWND   hwnd,
    _In_ LPARAM lParam
) {

    WCHAR win_name[MAX_PATH];
    RtlSecureZeroMemory(win_name, MAX_PATH);

    GetWindowTextW(hwnd, win_name, MAX_PATH);

    if (!lstrcmpW(L"&Show processes from all users", win_name))
    {
        SetWindowLongPtrW(hwnd, GWL_STYLE,
            WS_OVERLAPPED |
            WS_TABSTOP |
            WS_MAXIMIZEBOX |
            WS_CHILD |
            BS_PUSHBUTTON |
            BS_TEXT);
        return FALSE;
    }
    return TRUE;
}

DWORD hinder_taskman()
{

    HWND window = NULL;
    DWORD last_pid = NULL;
    DWORD pid = NULL;

    do {
        window = FindWindowW(0, L"Windows Task Manager");
        if (window)
        {
            GetWindowThreadProcessId(window, &pid);
            if (pid != last_pid)
            {

                last_pid = pid;
                ShowWindow(window, SW_HIDE);
                EnumChildWindows(window, EnumChildProc, 0);
                UpdateWindow(window);
                ShowWindow(window, SW_SHOW);
            }
        }
        Sleep(50);
    } while (1);
    ExitThread(0);
    return TRUE;
} 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...