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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Pointer Arithmetik 32/64 Bit in ImageEn

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
swestner Posted - Nov 27 2012 : 02:44:36
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
1   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Nov 27 2012 : 07:24:41
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.