Expand Minimize

ChangeWindowMessageFilterEx function

Modifies the User Interface Privilege Isolation (UIPI) message filter for a specified window.

Syntax


BOOL WINAPI ChangeWindowMessageFilterEx(
  _In_         HWND hWnd,
  _In_         UINT message,
  _In_         DWORD action,
  _Inout_opt_  PCHANGEFILTERSTRUCT pChangeFilterStruct
);

Parameters

hWnd [in]

Type: HWND

A handle to the window whose UIPI message filter is to be modified.

message [in]

Type: UINT

The message that the message filter allows through or blocks.

action [in]

Type: DWORD

The action to be performed, and can take one of the following values:

ValueMeaning
MSGFLT_ALLOW
1

Allows the message through the filter. This enables the message to be received by hWnd, regardless of the source of the message, even it comes from a lower privileged process.

MSGFLT_DISALLOW
2

Blocks the message to be delivered to hWnd if it comes from a lower privileged process, unless the message is allowed process-wide by using the ChangeWindowMessageFilter function or globally.

MSGFLT_RESET
0

Resets the window message filter for hWnd to the default. Any message allowed globally or process-wide will get through, but any message not included in those two categories, and which comes from a lower privileged process, will be blocked.

 

pChangeFilterStruct [in, out, optional]

Type: PCHANGEFILTERSTRUCT

Optional pointer to a CHANGEFILTERSTRUCT structure.

Return value

Type:

Type: BOOL

If the function succeeds, it returns TRUE; otherwise, it returns FALSE. To get extended error information, call GetLastError.

Remarks

UIPI is a security feature that prevents messages from being received from a lower-integrity-level sender. You can use this function to allow specific messages to be delivered to a window even if the message originates from a process at a lower integrity level. Unlike the ChangeWindowMessageFilter function, which controls the process message filter, the ChangeWindowMessageFilterEx function controls the window message filter.

An application may use the ChangeWindowMessageFilter function to allow or block a message in a process-wide manner. If the message is allowed by either the process message filter or the window message filter, it will be delivered to the window.

Note that processes at or below SECURITY_MANDATORY_LOW_RID are not allowed to change the message filter. If those processes call this function, it will fail and generate the extended error code, ERROR_ACCESS_DENIED.

Certain messages whose value is smaller than WM_USER are required to be passed through the filter, regardless of the filter setting. There will be no effect when you attempt to use this function to allow or block such messages.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
ChangeWindowMessageFilter
Conceptual
Windows

 

 

Community Additions

ADD
Show:
© 2014 Microsoft