I always use one Declare for RtlMoveMemory for all purposes. Creating a declare with an alias and specific param types is called a Type Safe declare. Personally I find it unnecessary. More declares just take more space in the EXE.
Declare Sub RtlMoveMemory Lib "kernel32.dll" _
(ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
Since the first two params are ByRef As Any, you are allowed to pass anything as an argument. It is not necessary to alter this declare, only specify ByVal for certain arguments. You must understand what you are passing to avoid problems.
If you plan to pass a pointer, you must pass it ByVal:
Code:
Dim b() As Byte
Redim b(3)
RtlMoveMemory b(0), ByVal lPointer, 4
That would pass the value of the pointer (address) and copy 4 bytes at that address into a byte array.
If you're copying a pointer into a string, you must buffer the string first and pass it ByVal. VB will convert the ansi string to unicode and copy it into the string. If you'd rather copy unicode data directly into the unicode BSTR in VB, use ByVal StrPtr(s).
Code:
RtlMoveMemory ByVal s, ByVal lPointer, Len(s)
To sum it up, ByRef passes the address of something, usually a struct or first item of an array. ByVal is to pass a pointer or string buffer.