ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Pointer Arithmetik 32/64 Bit in ImageEn
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

swestner

17 Posts

Posted - Nov 27 2012 :  02:44:36  Show Profile  Reply
Hello,

I compile our program under D2007 and XE2 with PEFlag $20. This means that it could use 3 GB RAM under 32 Bit.

I further use your component with 64 Bit XE 2.

Today I debugged a problem in our code which causes memory corruption. I found that I do a Integer(Pointer(somepointer))-Integer(Pointer(somepointer1))

Integer is signed and the Pointer is unsigned. If the memory to which the pointer points is above 2 GB the cast to integer goes below 0 and the arithmetik is wrong.

Same problem is in 64 Bit where integer is always 4 bytes. Casting a pointer to integer drop 4 bytes.

In D2007 a NativeUIt = Cardinal and in XE 2/3 a NativeUInt should be used.

I looked into ImageEN source and find several places where a pointer is converted to a integer like

procedure TImageEnVideoCap.SetCapture(v: boolean);
SendMessage(fWndC, WM_CAP_SET_USER_DATA, 0, integer(pointer(self)));


procedure TImageEnVideoCap.SetCallBackFrame(v: boolean);
SendMessage(fWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, integer(@CallBackFrameFunc));
SendMessage(fWndC, WM_CAP_SET_CALLBACK_ERROR, 0, integer(@capErrorCallback));
SendMessage(fWndC, WM_CAP_SET_CALLBACK_YIELD, 0, integer(@CallBackYeldFunc));
SendMessage(fWndC, WM_CAP_SET_CALLBACK_STATUS, 0, integer(@CallBackStatusFunc));

Is the component at the current state 100% tested with programs which could allocate more then 2 GB RAM (32 Bit with PEFlag, 64 Bit)?

I don't look in every unit of ImageEn.

Could you please give me a feedback if I could use ImageEn securly with mit than 2 GB RAM?

Greetings

Stefan Westner

fab

1310 Posts

Posted - Nov 27 2012 :  07:24:41  Show Profile  Reply
Porting to 64 bit (and in general >2GB pointers) is still in progress. Anyway you should not more see code like "Integer(Pointer(somepointer))-Integer(Pointer(somepointer1))" in versions >4.0.0.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: