| Option Explicit
Private Declare Function CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(dest As Any, src As Any, ByVal length As Long) As Long
Private Sub EndianReverse(lpPointer As Long, nLen As Long)
'Reverses the data pointed to by lpPointer
' nLen is the length of the data
Dim nArray() As Byte
ReDim nArray(1 To nLen)
Dim i As Long
'Copy the data to the byte array
CopyMemory nArray(1), ByVal lpPointer, nLen
'Copy the data from the byte array back to the main
' buffer, reversing the data as we go
For i = 1 To nLen
CopyMemory ByVal lpPointer + i - 1, nArray(nLen - i + 1), 1
Next
End Sub
|