mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Allowed drops from less privileged processes.
By default, UAC will prevent less privileged processes from sending these messages. This resolves that on Windows 7 and later. Windows Vista is still affected by this issue, as it has UAC but lacks ChangeWindowMessageFilterEx. Fixes #227.
This commit is contained in:
parent
6fef0f1351
commit
cf177905e5
@ -96,6 +96,8 @@ static GLboolean initLibraries(void)
|
||||
{
|
||||
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
|
||||
GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
|
||||
_glfw.win32.user32.ChangeWindowMessageFilterEx = (CHANGEWINDOWMESSAGEFILTEREX_T)
|
||||
GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
|
||||
}
|
||||
|
||||
_glfw.win32.dwmapi.instance = LoadLibrary(L"dwmapi.dll");
|
||||
|
@ -77,6 +77,20 @@
|
||||
#ifndef WM_DWMCOMPOSITIONCHANGED
|
||||
#define WM_DWMCOMPOSITIONCHANGED 0x031E
|
||||
#endif
|
||||
#ifndef WM_COPYGLOBALDATA
|
||||
#define WM_COPYGLOBALDATA 0x0049
|
||||
#endif
|
||||
#ifndef MSGFLT_ALLOW
|
||||
#define MSGFLT_ALLOW 1
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
typedef struct tagCHANGEFILTERSTRUCT
|
||||
{
|
||||
DWORD cbSize;
|
||||
DWORD ExtStatus;
|
||||
} CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT;
|
||||
#endif /*__MINGW32__*/
|
||||
|
||||
|
||||
//========================================================================
|
||||
@ -107,7 +121,9 @@ typedef DWORD (WINAPI * TIMEGETTIME_T) (void);
|
||||
|
||||
// user32.dll function pointer typedefs
|
||||
typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
|
||||
typedef BOOL (WINAPI * CHANGEWINDOWMESSAGEFILTEREX_T)(HWND,UINT,DWORD,PCHANGEFILTERSTRUCT);
|
||||
#define _glfw_SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware
|
||||
#define _glfw_ChangeWindowMessageFilterEx _glfw.win32.user32.ChangeWindowMessageFilterEx
|
||||
|
||||
// dwmapi.dll function pointer typedefs
|
||||
typedef HRESULT (WINAPI * DWMISCOMPOSITIONENABLED_T)(BOOL*);
|
||||
@ -192,6 +208,7 @@ typedef struct _GLFWlibraryWin32
|
||||
struct {
|
||||
HINSTANCE instance;
|
||||
SETPROCESSDPIAWARE_T SetProcessDPIAware;
|
||||
CHANGEWINDOWMESSAGEFILTEREX_T ChangeWindowMessageFilterEx;
|
||||
} user32;
|
||||
|
||||
// dwmapi.dll
|
||||
|
@ -901,6 +901,16 @@ static int createWindow(_GLFWwindow* window,
|
||||
|
||||
free(wideTitle);
|
||||
|
||||
if (_glfw_ChangeWindowMessageFilterEx)
|
||||
{
|
||||
_glfw_ChangeWindowMessageFilterEx(window->win32.handle,
|
||||
WM_DROPFILES, MSGFLT_ALLOW, NULL);
|
||||
_glfw_ChangeWindowMessageFilterEx(window->win32.handle,
|
||||
WM_COPYDATA, MSGFLT_ALLOW, NULL);
|
||||
_glfw_ChangeWindowMessageFilterEx(window->win32.handle,
|
||||
WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL);
|
||||
}
|
||||
|
||||
DragAcceptFiles(window->win32.handle, TRUE);
|
||||
|
||||
if (!window->win32.handle)
|
||||
|
Loading…
Reference in New Issue
Block a user