Kernel32.dll "RtlMoveMemory"

Blitz3D Forums/Blitz3D Userlibs/Kernel32.dll "RtlMoveMemory"

_PJ_(Posted 2010) [#1]
I am sure I read somewhere that there are some problems with this function (perhaps in Win7 or vista) ???

A forum search didn't help too much, could anyone shed any light on this, and fif possible, what fixes there may be.

It is used in a function:

 Find the correct Adress of a Bank (for C *Pointer)
Function AddressOf%(Bank)
	Local Address = CreateBank(4) 
	api_RtlMoveMemory(Address,Bank+4,4) 
	Return PeekInt(Address,0) 
End Function



Charrua(Posted 2010) [#2]
interesting

assuming that you know the order of: Return Address, Local Variable and ByRef parameters, i truly not shure about those. And that this code works, the only thing i think is that Stacks have a determined granularity, one element is 2, 4 or 8 bytes.
I spuose that for this is the +4 traing to poke from stack the address of the pased variable?.

if the system is 64 bits, surely it fail

isn't it?

i'm so sure that on this forums are many that know the answer



Juan


_PJ_(Posted 2010) [#3]
I don;t actually know any of that stuff ;)
The function was from soome code given here:

http://www.blitzbasic.com/Community/posts.php?topic=85215#963757

though I never got any responses for testers of 64-bit OS
It may well be the 64-bit versions fail, I dont understand what process you are referring to, but I trust your logic, When I originally stated "Windows 7 or Vista" maybe I had read about 64-bit OS, not necessarily those two!

I only have 32-bit to test on here, but again, I'm sure someone can definitely say if it's the 64-bit that are a problem.


Charrua(Posted 2010) [#4]
i'm sorry but i was wrong, this function didn't peek information from the stack, i was confused.

As i can see, it read 4 bytes from the Bank it self. For that reason the comment: "correct address", if i'm not wrong, blitz didn't pass the actual address of the bank, but some one knows that is 4 bytes from the address blitz pases to the function.

I do test this funtion on my poor machine and works perfect. Sorry again but didn't have a 64bits machine to test. But as it is indexing on a blitz structure i don't think that the 64bits granularity of these systems interfere but, as in many cases, i, may be wrong again.

Juan