For arguments that are simple data types, such as bytes, or integers, PInvoke marshals the managed argument to the corresponding unmanaged data type. The next table summarizes the rules.
If you need to marshal the data in a different way, simply wrap the call with a routine that does the required marshaling.