mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 04:39:22 +02:00
LCL, Win32: fix 32 bit truncation of pointers in SetWindowLong/GetWindowLong. Issue #39502
This commit is contained in:
parent
f7d2d0a690
commit
defb345dc8
@ -67,7 +67,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if iMsg = WM_USER + uIDTrayIcon then
|
if iMsg = WM_USER + uIDTrayIcon then
|
||||||
begin
|
begin
|
||||||
vwsTrayIcon := TCustomTrayIcon(PtrUInt(GetWindowLong(Handle, GWL_USERDATA)));
|
vwsTrayIcon := TCustomTrayIcon(PtrUInt(GetWindowLongPtrW(Handle, GWL_USERDATA)));
|
||||||
case LParam_ of
|
case LParam_ of
|
||||||
WM_RBUTTONUP:
|
WM_RBUTTONUP:
|
||||||
begin
|
begin
|
||||||
@ -137,13 +137,13 @@ begin
|
|||||||
if iMsg = WM_CREATE then
|
if iMsg = WM_CREATE then
|
||||||
begin
|
begin
|
||||||
msgTaskbarRestart := RegisterWindowMessage('TaskbarCreated');
|
msgTaskbarRestart := RegisterWindowMessage('TaskbarCreated');
|
||||||
SetWindowLong(Handle, GWL_USERDATA, PtrInt(PCREATESTRUCT(LParam_)^.lpCreateParams));
|
SetWindowLongPtrW(Handle, GWL_USERDATA, PtrInt(PCREATESTRUCT(LParam_)^.lpCreateParams));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (iMsg = msgTaskbarRestart) then
|
if (iMsg = msgTaskbarRestart) then
|
||||||
begin
|
begin
|
||||||
// add taskbar icon
|
// add taskbar icon
|
||||||
vwsTrayIcon := TCustomTrayIcon(PtrUInt(GetWindowLong(Handle, GWL_USERDATA)));
|
vwsTrayIcon := TCustomTrayIcon(PtrUInt(GetWindowLongPtrW(Handle, GWL_USERDATA)));
|
||||||
if Assigned(vwsTrayIcon) then
|
if Assigned(vwsTrayIcon) then
|
||||||
TWin32WSCustomTrayIcon.AddIcon(vwsTrayIcon);
|
TWin32WSCustomTrayIcon.AddIcon(vwsTrayIcon);
|
||||||
end;
|
end;
|
||||||
|
@ -247,12 +247,12 @@ begin
|
|||||||
WindowInfo^.WinControl := AWinControl;
|
WindowInfo^.WinControl := AWinControl;
|
||||||
AWinControl.Handle := Window;
|
AWinControl.Handle := Window;
|
||||||
if Assigned(SubClassWndProc) then
|
if Assigned(SubClassWndProc) then
|
||||||
WindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLong(
|
WindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLongPtrW(
|
||||||
Window, GWL_WNDPROC, PtrInt(SubClassWndProc)));
|
Window, GWL_WNDPROC, PtrInt(SubClassWndProc)));
|
||||||
// Set control ID to map WinControl. This is required for messages that sent to parent
|
// Set control ID to map WinControl. This is required for messages that sent to parent
|
||||||
// to extract control from the passed ID.
|
// to extract control from the passed ID.
|
||||||
// In case of subclassing this ID will be set in WM_NCCREATE message handler
|
// In case of subclassing this ID will be set in WM_NCCREATE message handler
|
||||||
SetWindowLong(Window, GWL_ID, PtrInt(AWinControl));
|
SetWindowLongPtrW(Window, GWL_ID, PtrInt(AWinControl));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AWinControl.Font.IsDefault then
|
if AWinControl.Font.IsDefault then
|
||||||
@ -274,7 +274,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
BuddyWindowInfo := AllocWindowInfo(Buddy);
|
BuddyWindowInfo := AllocWindowInfo(Buddy);
|
||||||
BuddyWindowInfo^.AWinControl := AWinControl;
|
BuddyWindowInfo^.AWinControl := AWinControl;
|
||||||
BuddyWindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLong(
|
BuddyWindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLongPtrW(
|
||||||
Buddy, GWL_WNDPROC, PtrInt(SubClassWndProc)));
|
Buddy, GWL_WNDPROC, PtrInt(SubClassWndProc)));
|
||||||
if AWinControl.Font.IsDefault then
|
if AWinControl.Font.IsDefault then
|
||||||
lhFont := Win32Widgetset.DefaultFont
|
lhFont := Win32Widgetset.DefaultFont
|
||||||
@ -576,7 +576,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Handle := AWinControl.Handle;
|
Handle := AWinControl.Handle;
|
||||||
{$ifdef RedirectDestroyMessages}
|
{$ifdef RedirectDestroyMessages}
|
||||||
SetWindowLong(Handle, GWL_WNDPROC, PtrInt(@DestroyWindowProc));
|
SetWindowLongPtrW(Handle, GWL_WNDPROC, PtrInt(@DestroyWindowProc));
|
||||||
{$endif}
|
{$endif}
|
||||||
// Instead of calling DestroyWindow directly, we need to call WM_MDIDESTROY for MDI children
|
// Instead of calling DestroyWindow directly, we need to call WM_MDIDESTROY for MDI children
|
||||||
if Assigned(Application.MainForm) and (Application.MainForm.FormStyle=fsMDIForm) and
|
if Assigned(Application.MainForm) and (Application.MainForm.FormStyle=fsMDIForm) and
|
||||||
|
@ -187,7 +187,7 @@ class function TWin32WSScrollBox.CreateHandle(const AWinControl: TWinControl;
|
|||||||
WindowInfo^.needParentPaint := true;
|
WindowInfo^.needParentPaint := true;
|
||||||
WindowInfo^.WinControl := AWinControl;
|
WindowInfo^.WinControl := AWinControl;
|
||||||
if SubClassWndProc <> nil then
|
if SubClassWndProc <> nil then
|
||||||
WindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLong(
|
WindowInfo^.DefWndProc := Windows.WNDPROC(SetWindowLongPtrW(
|
||||||
Window, GWL_WNDPROC, PtrInt(SubClassWndProc)));
|
Window, GWL_WNDPROC, PtrInt(SubClassWndProc)));
|
||||||
lhFont := FDefaultFont;
|
lhFont := FDefaultFont;
|
||||||
Windows.SendMessage(Window, WM_SETFONT, WPARAM(lhFont), 0);}
|
Windows.SendMessage(Window, WM_SETFONT, WPARAM(lhFont), 0);}
|
||||||
|
@ -392,7 +392,7 @@ begin
|
|||||||
WindowInfo^.WinControl.Handle := Window;
|
WindowInfo^.WinControl.Handle := Window;
|
||||||
WindowInfo^.DefWndProc := NCCreateParams^.DefWndProc;
|
WindowInfo^.DefWndProc := NCCreateParams^.DefWndProc;
|
||||||
WindowInfo^.needParentPaint := False;
|
WindowInfo^.needParentPaint := False;
|
||||||
SetWindowLong(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
|
SetWindowLongPtrW(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
|
||||||
NCCreateParams^.Handled := True;
|
NCCreateParams^.Handled := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -723,7 +723,7 @@ begin
|
|||||||
WindowInfo^.DefWndProc := NCCreateParams^.DefWndProc;
|
WindowInfo^.DefWndProc := NCCreateParams^.DefWndProc;
|
||||||
// listbox is not a transparent control -> no need for parentpainting
|
// listbox is not a transparent control -> no need for parentpainting
|
||||||
WindowInfo^.needParentPaint := False;
|
WindowInfo^.needParentPaint := False;
|
||||||
SetWindowLong(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
|
SetWindowLongPtrW(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
|
||||||
NCCreateParams^.Handled := True;
|
NCCreateParams^.Handled := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user