I have one doubt , WTSQueryUserToken() is an inbuilt function . This function not working Not compiled successfully
#include <wtsapi32.h>
ULONG sessionID = (ULONG)WTSGetActiveConsoleSessionId();
printf("\n\t\t%ld", sessionID); // 1 because I'm first user
HANDLE hToken = 0;
int pToken = WTSQueryUserToken((ULONG)sessionID, (PHANDLE)&hToken);
if (pToken == 0)
{
puts("\n\tWTSQueryUserToken() fails");
printf("\n\tError No\t: %d\n", GetLastError());
CloseHandle(hToken);
return;
}
else
puts("\n\tWTSQueryUserToken() Success - Got primary access token");
Here I'm getting error as LNK2019 : unresolved external symbol WTSQueryUserToken referenced in function main LNK1120 : 1 unresolved externals
Its user defined function then how it'll become external symbol error I'm not able to run this code in VisualStudio 2019 in C or C++.