microsoft / microsoft/win32metadata
CreateRemoteThread(Ex) is not really usable
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 149
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
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:
```cs
internal static extern unsafe winmdroot.Foundation.HANDLE CreateRemoteThread(winmdroot.Foundation.HANDLE hProcess, [Optional] winmdroot.Security.SECURITY_ATTRIBUTES* lpThreadAttributes, nuint dwStackSize, winmdroot.System.Threading.LPTHREAD_START_ROUTINE lpStartAddress, [Optional] void* lpParameter, uint dwCreationFlags, [Optional] uint* lpThreadId);
```
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 either `void *` or `nint`?
Contributor guide
Assessment
This issue has not been assessed yet.