-
winApi CopyMemory
Hi, its possible pass length as reference? I have function what get BSTRptr (pointer to BSTR struct), so length pointer is BSTRptr - 4. Its possible pass this pointer directly, or its necessary do somethig as...
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, Length As Long)
.....
dim i as long
CopyMemory i, byval BSTRptr - 4, byval 4
.....
... dereference and pass value?
-
Maybe 2 steps?
But your second CopyMemory looks like it will put too much at the location of the 4 byte "I", overwriting what follows
Code:
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, Length As Long)
Sub test()
Dim i As Long, L As Long
CopyMemory L, ByVal BSTRptr - 4, 4
CopyMemory i, ByVal BSTRptr - 4, L
End Sub
-
I know, but is possible do it in one step? When i know address where is length saved?