Open lowleveldesign opened 2 weeks ago
Are you using CsWin32? @AArnott
Yes, I use it through cswin32.
While metadata uses delegates to describe unmanaged function pointers, they are not intended to represent actual C# delegates. When these types are encountered, CsWin32 could potentially decompose them into IntPtr. (However, I recognize that this approach would result in a loss of type safety and other benefits.)
@AArnott Is there a way to instruct CsWin32 to emit raw bindings for APIs like this on an individual basis (e.g., via NativeMethods.json
)?
When trying to use the CreateRemoteThread(Ex) function, I found that the generated signatures are not really usable as the lpStartAddress is of a delegate type:
The problem is that the remote function address is almost certainly invalid in the context of the calling process and creating a delegate to such an address (by using, for example,
Marshal.GetDelegateForFunctionPointer
) will fail. If there is a way to create this delegate, please let me know. Otherwise, could you please change the lpStartAddress type to eithervoid *
ornint
?