Send messages with low permissions to high permissions (for example, Drag and Drop files)

Source: Internet
Author: User
Tags remove filter

BecauseUipi
When a high-permission process fails to receive a message when the high-permission process sends a message to the high-permission system;

Let's take a look at what uipi is: The following is taken from Baidu Encyclopedia:

Uipi refers to the user interface privilege isolation (User Interface privilege isolation), which is a Windows
A new security feature introduced after nt 6.0 (Vista) is the entireUACIt is an integral part of the mechanism. It is mainly used to intercept messages sent from processes with low mic levels.

According to Windows development specifications, user-defined messages are larger than wm_user. The default uipi rule is that a process fails to send messages higher than wm_user to a process at its Mic level, and the system filters custom messages selectively, some information, such as wm_dropfiles, is also filtered out.

So how to solve this problem, the famous Microsoft provides a life-saving function

Changewindowmessagefilter (adds
Or removes a message from the user interface privilege isolation (uipi) Message filter ~ The problem is solved naturally after filtering ~ PS: this function is in user32.dll ~

The function prototype is:

BOOL WINAPI ChangeWindowMessageFilter(  _In_  UINT message,  _In_  DWORD dwFlag);
Message[In]

Type:Uint

The message to be added or removed.

Dwflag[In]

Type:DWORD

Value Meaning

Msgflt_add
1

Add to filter

Msgflt_remove
2

Remove Filter

PS:Msgflt_add/Msgflt_remove
No definition for manual 1, 2 ~

Check a chestnut (solve the Drag and Drop File )~

void InitUIPIFilter(){    typedef BOOL (WINAPI *ChangeWindowMessageFilterProc)(UINT,DWORD);    HMODULE hUser = LoadLibraryA("user32.dll");    if (hUser)    {        ChangeWindowMessageFilterProc proc = (ChangeWindowMessageFilterProc)GetProcAddress(hUser, "ChangeWindowMessageFilter");        if(proc){proc(WM_COPYDATA,1);proc(WM_DROPFILES,1);}    }}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.