Fix MinGW/GCC issues

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7020 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2018-10-16 20:58:09 +00:00
parent 87139b31a3
commit 0040a97e43
3 changed files with 29 additions and 39 deletions

View file

@ -249,24 +249,24 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Window Info"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
CONTROL "", IDC_SPYDRAG, STATIC, SS_ICON | SS_NOTIFY | SS_CENTERIMAGE | SS_SUNKEN | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 20 , 20
LTEXT "Drag the finder over a window and then release the mouse...", IDC_STATIC , 39, 7, 190, 20
CONTROL "Id:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 34, 32, 10
CONTROL "", IDC_WNDID, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 34, 190, 10
CONTROL "HWND:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 44, 32, 10
CONTROL "", IDC_HWND, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 44, 190, 10
CONTROL "Class:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 54, 32, 10
CONTROL "", IDC_WNDCLASS, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 54, 190, 10
CONTROL "Data:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 64, 32, 10
CONTROL "", IDC_WNDUSERDATA, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL, 39, 64, 190, 10
CONTROL "Style:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 74, 32, 10
CONTROL "", IDC_WNDSTYLE, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 74, 190, 10
CONTROL "Size:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 84, 32, 10
CONTROL "", IDC_WNDSIZE, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 84, 190, 10
CONTROL "Info:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 94, 32, 10
CONTROL "", IDC_WNDINFO, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 94, 190, 10
CONTROL "DPI:", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 104, 32, 10
CONTROL "", IDC_WNDDPI, EDIT, ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 104, 190, 10
CONTROL "", IDC_SPYDRAG, "Static", SS_ICON | SS_NOTIFY | SS_CENTERIMAGE | SS_SUNKEN | WS_CHILD | WS_VISIBLE | WS_GROUP, 7, 7, 20 , 20
LTEXT "Drag the finder over a window and then release the mouse...", IDC_STATIC , 39, 7, 190, 20
CONTROL "Id:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 34, 32, 10
CONTROL "", IDC_WNDID, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 34, 190, 10
CONTROL "HWND:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 44, 32, 10
CONTROL "", IDC_HWND, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 44, 190, 10
CONTROL "Class:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 54, 32, 10
CONTROL "", IDC_WNDCLASS, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 54, 190, 10
CONTROL "Data:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 64, 32, 10
CONTROL "", IDC_WNDUSERDATA, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL, 39, 64, 190, 10
CONTROL "Style:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 74, 32, 10
CONTROL "", IDC_WNDSTYLE, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 74, 190, 10
CONTROL "Size:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 84, 32, 10
CONTROL "", IDC_WNDSIZE, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 84, 190, 10
CONTROL "Info:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 94, 32, 10
CONTROL "", IDC_WNDINFO, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 94, 190, 10
CONTROL "DPI:", IDC_STATIC, "Static", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP , 7, 104, 32, 10
CONTROL "", IDC_WNDDPI, "Edit", ES_LEFT | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL , 39, 104, 190, 10
END
/////////////////////////////////////////////////////////////////////////////

View file

@ -10,9 +10,9 @@
// This software is provided 'as-is', without any express or implied
// warranty.
#include "makensisw.h"
#include <windows.h>
#include <windowsx.h>
#include "makensisw.h"
#include "utils.h"
#include "resource.h"
@ -34,7 +34,7 @@ typedef struct _DPI {
static INT_PTR WINAPI Compat_SetThreadDpiAwarenessContext(INT_PTR AC)
{
return NULL;
return 0;
}
static void InitializeDpiApi()
@ -53,7 +53,7 @@ typedef struct _DIALOGDATA {
BOOL Dragging;
HWND hWndTarget;
int DialogAwarenessContext;
static struct _DIALOGDATA* Get(HWND hDlg) { return (DIALOGDATA*) GetWindowLongPtr(hDlg, DWLP_USER); }
static struct _DIALOGDATA* Get(HWND hDlg) { return (struct _DIALOGDATA*) GetWindowLongPtr(hDlg, DWLP_USER); }
} DIALOGDATA;
typedef struct {
@ -102,21 +102,10 @@ static HWND GetChildWindowFromPointHelper(POINT pt)
while(!includeHidden && hWnd && !IsWindowVisible(hWnd))
if ((hWnd2 = GetParentWindow(hWnd)))
hWnd = hWnd2;
#if 0
for (HWND hWndChild;;)
{
POINT childpt = pt;
HWND hWndParent = GetParent(hWnd);
ScreenToClient(hWndParent, &childpt);
if (!(hWndChild = RealChildWindowFromPoint(hWndParent, childpt)) || hWndChild == hWnd)
break;
hWnd = hWndChild;
}
#else
FINDCHILDDATA fcd;
fcd.Init(pt, includeHidden);
hWnd = FindChildWindowFromPoint(hWnd, &fcd);
#endif
return hWnd;
}
@ -130,14 +119,15 @@ static BOOL IsHung(HWND hWnd)
{
static FARPROC g_func = GetProcAddress(LoadLibraryA("USER32"), "IsHungAppWindow");
if (g_func) return ((BOOL(WINAPI*)(HWND))g_func)(hWnd);
LRESULT mr, rv = SendMessageTimeout(hWnd, WM_NULL, 0, 0, SMTO_ABORTIFHUNG, 500, &mr);
DWORD_PTR mr;
LRESULT rv = SendMessageTimeout(hWnd, WM_NULL, 0, 0, SMTO_ABORTIFHUNG, 500, &mr);
return rv == 0;
}
}
static void SetDragSourceImage(HWND hDlg, INT_PTR Dragging = false)
{
HCURSOR hCur = Dragging ? NULL : LoadCursor(NULL, MAKEINTRESOURCE(IDC_CROSS));
HCURSOR hCur = Dragging ? NULL : LoadCursor(NULL, IDC_CROSS);
SendDlgItemMessage(hDlg, IDC_SPYDRAG, STM_SETIMAGE, IMAGE_CURSOR, (LPARAM) hCur);
}
@ -210,7 +200,7 @@ static INT_PTR CALLBACK SpyDlgProc(HWND hDlg, UINT Msg, WPARAM WParam, LPARAM LP
pDD->hWndTarget = 0;
pDD->Dragging++;
SetDragSourceImage(hDlg, (INT_PTR) hDlg);
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_CROSS)));
SetCursor(LoadCursor(NULL, IDC_CROSS));
break;
}
break;
@ -249,9 +239,9 @@ struct ScopedThreadDpiAwarenessContext { // Note: Assumes InitializeDpiApi() has
UINT GetBits() const { return m_l; }
UINT m_l;
};
ScopedThreadDpiAwarenessContext(List ACList) : m_OrgAC(NULL)
ScopedThreadDpiAwarenessContext(List ACList) : m_OrgAC(0)
{
for (UINT s = 4, list = ACList.GetBits(); m_AC = -(int)s; --s)
for (UINT s = 4, list = ACList.GetBits(); (m_AC = -(int)s); --s)
if ((1 << s) & list)
if ((m_OrgAC = DPI::SetThreadDpiAwarenessContext((INT_PTR) m_AC)))
break;

View file

@ -306,7 +306,7 @@ template<class R, class T> inline R debugtruncate_cast(T t,const char*f,unsigned
#ifdef MAKENSIS
if (sizeof(T) > sizeof(R) && !( (t <= (T)(~((R)0))) )) {
_tprintf(_T("unsafe truncate_cast: %") NPRIns _T(":%u\n"),f,l);
if (sizeof(T) <= sizeof(void*)) _tprintf(_T("\t0x%p > %0xp\n"),(void*)(UINT_PTR)(t),(void*)(UINT_PTR)(~((R)0)));
if (sizeof(T) <= sizeof(void*)) _tprintf(_T("\t%ph > %ph\n"),(void*)(UINT_PTR)(t),(void*)(UINT_PTR)(~((R)0)));
}
#endif
return internaltruncate_cast<R>(t);