C
C#2w ago
LPeter1997

✅ CsWin32 not generating PInvoke for GetThreadContext

I'm using CsWin32 without issuees so far, except when I try to involve GetThreadContext (https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreadcontext) which is not generated by the library for some reason. All I found is the issue talking about alignment issues for the CONTEXT structure (https://github.com/microsoft/CsWin32/issues/1415) but I can't even get to the lib generating the PInvoke for the method. Note that OpenThread - which is also from the processthreads API - generates without issues.
2 Replies
LPeter1997
LPeter1997OP2w ago
Update: You need to set the platform target to be x86 or x64 since context is target platform dependent. What I missed is saving the projectfile including this. So as long as you have <PlatformTarget>x86</PlatformTarget> or (x64, depending on the target process) and this is savved, CsWin32 will generate it
MODiX
MODiX2w ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?