mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-27 21:24:17 -04:00
[core] drop direct hooking into dwmapi DLL and use delay-loading instead
* Now that we can delay-load DLLs for both MinGW and MSVC, we can also remove
the direct DLL hook that was added into dwmapi.dll due to side loading and
revert to using a direct API call instead.
* This reverts part of e1d864f755
.
* Also attempt to silence that damn Coverity warning.
This commit is contained in:
parent
3194a4dac4
commit
d029551929
9 changed files with 32 additions and 34 deletions
12
src/rufus.c
12
src/rufus.c
|
@ -2332,9 +2332,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
case IDC_LOG:
|
||||
// Place the log Window to the right (or left for RTL) of our dialog on first display
|
||||
if (first_log_display) {
|
||||
// Can't link to dwmapi.lib since it sideloads dwapi.dll *before* we get a chance
|
||||
// to prevent local directory lookup (Sideloading mitigation).
|
||||
PF_TYPE_DECL(WINAPI, HRESULT, DwmGetWindowAttribute, (HWND, DWORD, PVOID, DWORD));
|
||||
GetClientRect(GetDesktopWindow(), &DesktopRect);
|
||||
GetWindowRect(hLogDialog, &DialogRect);
|
||||
nWidth = DialogRect.right - DialogRect.left;
|
||||
|
@ -2342,14 +2339,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
GetWindowRect(hDlg, &DialogRect);
|
||||
offset = GetSystemMetrics(SM_CXBORDER);
|
||||
if (nWindowsVersion >= WINDOWS_10) {
|
||||
PF_INIT(DwmGetWindowAttribute, Dwmapi);
|
||||
// See https://stackoverflow.com/a/42491227/1069307
|
||||
// I agree with Stephen Hazel: Whoever at Microsoft thought it would be a great idea to
|
||||
// add a *FRIGGING INVISIBLE BORDER* in Windows 10 should face the harshest punishment!
|
||||
if (pfDwmGetWindowAttribute != NULL) {
|
||||
pfDwmGetWindowAttribute(hDlg, DWMWA_EXTENDED_FRAME_BOUNDS, &rc, sizeof(RECT));
|
||||
offset += 2 * (DialogRect.left - rc.left);
|
||||
}
|
||||
// Also calling this API will create DLL sideloading issues through 'dwmapi.dll' so make
|
||||
// sure you delay-load it in your application.
|
||||
DwmGetWindowAttribute(hDlg, DWMWA_EXTENDED_FRAME_BOUNDS, &rc, sizeof(RECT));
|
||||
offset += 2 * (DialogRect.left - rc.left);
|
||||
}
|
||||
if (right_to_left_mode)
|
||||
Point.x = max(DialogRect.left - offset - nWidth, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue