I want to call an API in particular Windows credentials,
One way is, write particular piece of code or API in another EXE and then execute the EXE in particular windows credentials. Please let me know if you are aware of any other solution.
Thanks in advance.
You could use
LogonUser(), thenImpersonateLoggenOnUser(), then call your code, then callRevertToSelf()to get back to the original credentials. You can do that either in your thread, or create a separate thread and do it there. The latter is preferred so that you have the thread exited after that and not skip theRevertToSelf()call.