Copies from one memory buffer to another.

Syntax

SRP_Copy_Memory(Destination, Source, Length)

Parameters

ParameterDescription
DestinationPointer to the buffer to which the data will be copied. Required.
SourcePointer to the buffer containing the data to be copied. Required.
LengthThe size, in bytes, of the data to be copied. Required.

Remarks

In some rare cases, Windows API functions supply pointers to an empty structure or array. The only way to copy data into these is to use a method that takes pointers. The SRP_Copy_Memory function accomplishes this task for you. Simply pass a destination pointer, source pointer, and length.

This can be a very dangerous function if you're not careful. If you set Length to a value greater than either buffer, then the application will crash. Make sure you check for overflow before making the call.

While this function is available for your use, you will likely never need it. Some functions in the SRP Utilities require it, which explains its inclusion into the library.

Example

* Copy the MMI structure to the one pointed to by lParam
LockVariable MMI as char
SRP_Copy_Memory(lParam, GetPointer(MMI), Len(MMI))
UnlockVariable MMI
  • No labels