RC6.1.6: Still Bugs in Win64

Have a Raize Components question that does not fit into any of the forums below? Post it here.

RC6.1.6: Still Bugs in Win64

Postby Maxx » Tue Feb 18, 2014 4:23 am

Hello
after upgrading to the version 6.1.6 we show that there are still problems with Raize components when running in 64 Bit
There are a lot of cast of objects to longint. This is not allowed for 64bit objects or pointers.
We have a lot of trouble because we have hight memory usage and because of this we have high address pointers.

Only one example:
Code: Select all
procedure TRzButton.SetDefault( Value: Boolean );
var
  Form: TCustomForm;
begin
  FDefault := Value;
  if HandleAllocated then
  begin
    Form := GetParentForm( Self );
    if Form <> nil then
      Form.Perform( cm_FocusChanged, 0, Longint( Form.ActiveControl ) ); //BUG: -> cast to a LParam!
  end;
end;


There are 16 pas files where a cast to a longint(..) or PLongint(..) is taking place and most of them are bugs for 64 bit.

Please fix all problems. We need trust and security in the code ...

Thank you
Maxx
 
Posts: 20
Joined:
Thu Dec 13, 2012 10:42 pm

Re: RC6.1.6: Still Bugs in Win64

Postby Raize Support » Wed Feb 19, 2014 1:49 pm

Hi Maxx,

Thanks for the post. We did address some of these issues with calls to SendMessage, but apparently we missed the indirect calls to SendMessage via Perform. We will definitely address these others.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 604
Joined:
Fri Mar 25, 2011 9:04 pm

Re: RC6.1.6: Still Bugs in Win64

Postby bstaggs » Fri Feb 21, 2014 2:40 pm

I've had an occasional crash report that looked really strange. After seeing this thread, I think this could be the reason for those. I already updated other (abandoned) third party controls to deal with Win64 issues but didn't think to audit the Raize code. So I made the following changes after seeing this thread -- does this all look good to you?

Code: Select all
Index: Source/RzBckgnd.pas
===================================================================
--- Source/RzBckgnd.pas   (revision 2368)
+++ Source/RzBckgnd.pas   (revision 2369)
@@ -423,7 +423,7 @@
   if FMDIActive then
   begin
     Destroying;
-    SetWindowLong( FClientHandle, gwl_WndProc, Longint( FDefClientProc ) );
+    SetWindowLongPtr( FClientHandle, gwl_WndProc, LONG_PTR( FDefClientProc ) );
     Classes.FreeObjectInstance( FClientInstance );
   end;
   inherited;
@@ -464,7 +464,7 @@
   FClientHandle := AOwner.ClientHandle;
   FClientInstance := Classes.MakeObjectInstance( EraseMDIClientBkgrnd );
   FDefClientProc := Pointer( GetWindowLong( FClientHandle, gwl_WndProc ) );
-  SetWindowLong( FClientHandle, gwl_WndProc, Longint( FClientInstance ) );
+  SetWindowLongPtr( FClientHandle, gwl_WndProc, LONG_PTR( FClientInstance ) );
 end;
 
 
Index: Source/RzLstBox.pas
===================================================================
--- Source/RzLstBox.pas   (revision 2368)
+++ Source/RzLstBox.pas   (revision 2369)
@@ -4032,12 +4032,12 @@
   if FFontDevice = fdScreen then
   begin
     DC := GetDC( 0 );
-    EnumFontFamilies( DC, nil, @EnumFontsProc, Longint( Self ) );
+    EnumFontFamilies( DC, nil, @EnumFontsProc, LPARAM( Self ) );
     ReleaseDC( 0, DC );
   end
   else
   begin
-    EnumFontFamilies( Printer.Handle, nil, @EnumFontsProc, Longint( Self ) );
+    EnumFontFamilies( Printer.Handle, nil, @EnumFontsProc, LPARAM( Self ) );
   end;
 end;
 
Index: Source/RzShellCtrls.pas
===================================================================
--- Source/RzShellCtrls.pas   (revision 2368)
+++ Source/RzShellCtrls.pas   (revision 2369)
@@ -4650,9 +4650,9 @@
 procedure TRzCustomShellTree.SortNode( Node: TTreeNode );
 begin
   if Assigned( Node ) then
-    Node.CustomSort( TreeCompareFunc, Longint( Self ) )
+    Node.CustomSort( TreeCompareFunc, NativeInt( Self ) )
   else
-    CustomSort( TreeCompareFunc, Longint( Self ) );
+    CustomSort( TreeCompareFunc, NativeInt( Self ) );
 end;
 
 
Index: Source/RzGroupBar.pas
===================================================================
--- Source/RzGroupBar.pas   (revision 2368)
+++ Source/RzGroupBar.pas   (revision 2369)
@@ -2614,7 +2614,7 @@
   begin
     Msg.Msg := cm_GroupItemSelected;
     Msg.WParam := 0;
-    Msg.LParam := Longint( Self );
+    Msg.LParam := LPARAM( Self );
     Msg.Result := 0;
 
     Group.GroupBar.Parent.Broadcast( Msg );
Index: Source/RzStringListEditor.pas
===================================================================
--- Source/RzStringListEditor.pas   (revision 2368)
+++ Source/RzStringListEditor.pas   (revision 2369)
@@ -790,7 +790,7 @@
   if FTabSize < 0 then
     FTabSize := -FTabSize;
   TabStop := FTabSize * 4;              { Roughly 4 Dialog units per character }
-  edtStrings.Perform( em_SetTabStops, 1, Longint( @TabStop ) );
+  edtStrings.Perform( em_SetTabStops, 1, LPARAM( @TabStop ) );
   edtStrings.Invalidate;
 end;
 
Index: Source/RzListVw.pas
===================================================================
--- Source/RzListVw.pas   (revision 2368)
+++ Source/RzListVw.pas   (revision 2369)
@@ -833,7 +833,7 @@
   FHeaderCanvas.Free;
 
   if HeaderHandle <> 0 then
-    SetWindowLong( HeaderHandle, GWL_WNDPROC, LongInt( FDefHeaderProc ) );
+    SetWindowLongPtr( HeaderHandle, GWL_WNDPROC, LONG_PTR( FDefHeaderProc ) );
   FreeObjectInstance( FHeaderInstance );
 
   inherited;
@@ -2050,7 +2050,7 @@
   begin
     FInternalHeaderHandle := HeaderHandle;
     FDefHeaderProc := Pointer( GetWindowLong( HeaderHandle, GWL_WNDPROC ) );
-    SetWindowLong( HeaderHandle, GWL_WNDPROC, LongInt( FHeaderInstance ) );
+    SetWindowLongPtr( HeaderHandle, GWL_WNDPROC, LONG_PTR( FHeaderInstance ) );
   end;
 
   SetHeaderODStyle;
@@ -2063,10 +2063,10 @@
   // allocation if the list view is on a control that is part of a TFrame.
 
   if HeaderHandle <> 0 then
-    SetWindowLong( HeaderHandle, GWL_WNDPROC, LongInt( FDefHeaderProc ) );
+    SetWindowLongPtr( HeaderHandle, GWL_WNDPROC, Long_PTR( FDefHeaderProc ) );
   FInternalHeaderHandle := HeaderHandle;
   FDefHeaderProc := Pointer( GetWindowLong( HeaderHandle, GWL_WNDPROC ) );
-  SetWindowLong( HeaderHandle, GWL_WNDPROC, LongInt( FHeaderInstance ) );
+  SetWindowLongPtr( HeaderHandle, GWL_WNDPROC, LONG_PTR( FHeaderInstance ) );
 end;
 
 
Index: Source/RzFilSys.pas
===================================================================
--- Source/RzFilSys.pas   (revision 2368)
+++ Source/RzFilSys.pas   (revision 2369)
@@ -2014,8 +2014,8 @@
     // wm_DeviceChange messages.
     FFormHandle := ValidParentForm( Self ).Handle;
     FObjInst := Classes.MakeObjectInstance( FormWndProc );
-    FOldWndProc := TFarProc( SetWindowLong( FFormHandle, gwl_WndProc,
-                                            Longint( FObjInst ) ) );
+    FOldWndProc := TFarProc( SetWindowLongPtr( FFormHandle, gwl_WndProc,
+                                            LONG_PTR( FObjInst ) ) );
   end;
 end;
 
@@ -2074,7 +2074,7 @@
   if FFormHandle <> 0 then
   begin
     { Restore original window procedure for parent form }
-    SetWindowLong( FFormHandle, gwl_WndProc, Longint( FOldWndProc ) );
+    SetWindowLongPtr( FFormHandle, gwl_WndProc, LONG_PTR( FOldWndProc ) );
     Classes.FreeObjectInstance( FObjInst );
     FOldWndProc := nil;
   end;
Index: Source/RzBmpBtn.pas
===================================================================
--- Source/RzBmpBtn.pas   (revision 2368)
+++ Source/RzBmpBtn.pas   (revision 2369)
@@ -1159,7 +1159,7 @@
   begin
     Msg.Msg := cm_BmpButtonPressed;
     Msg.WParam := FGroupIndex;
-    Msg.LParam := Longint( Self );
+    Msg.LParam := LPARAM( Self );
     Msg.Result := 0;
     Parent.Broadcast( Msg );
   end
Index: Source/RzButton.pas
===================================================================
--- Source/RzButton.pas   (revision 2368)
+++ Source/RzButton.pas   (revision 2369)
@@ -2826,7 +2826,7 @@
   begin
     Form := GetParentForm( Self );
     if Form <> nil then
-      Form.Perform( cm_FocusChanged, 0, Longint( Form.ActiveControl ) );
+      Form.Perform( cm_FocusChanged, 0, LPARAM( Form.ActiveControl ) );
   end;
 end;
 
@@ -2839,7 +2839,7 @@
   begin
     Msg.Msg := cm_RzButtonPressed;
     Msg.WParam := FGroupIndex;
-    Msg.LParam := Longint( Self );
+    Msg.LParam := LPARAM( Self );
     Msg.Result := 0;
     Parent.Broadcast( Msg );
   end;
@@ -5421,7 +5421,7 @@
   begin
     Msg.Msg := cm_ButtonPressed;
     Msg.WParam := FGroupIndex;
-    Msg.LParam := Longint( Self );
+    Msg.LParam := LPARAM( Self );
     Msg.Result := 0;
     Parent.Broadcast( Msg );
   end;
Index: Source/RzCmboBx.pas
===================================================================
--- Source/RzCmboBx.pas   (revision 2368)
+++ Source/RzCmboBx.pas   (revision 2369)
@@ -4698,12 +4698,12 @@
   if FFontDevice = fdScreen then
   begin
     DC := GetDC( 0 );
-    EnumFontFamilies( DC, nil, @EnumFontsProc, Longint( Self ) );
+    EnumFontFamilies( DC, nil, @EnumFontsProc, LPARAM( Self ) );
     ReleaseDC( 0, DC );
   end
   else
   begin
-    EnumFontFamilies( Printer.Handle, nil, @EnumFontsProc, Longint( Self ) );
+    EnumFontFamilies( Printer.Handle, nil, @EnumFontsProc, LPARAM( Self ) );
   end;
 end;
 

bstaggs
 
Posts: 29
Joined:
Thu Oct 27, 2011 6:36 pm

Re: RC6.1.6: Still Bugs in Win64

Postby Raize Support » Fri Feb 21, 2014 3:36 pm

Yes, that looks good.

Ray
Raize Software Support
Raize Software
http://www.raize.com
Raize Support
 
Posts: 604
Joined:
Fri Mar 25, 2011 9:04 pm


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests