This may be a much simpler approach for XP and up...
Code:#include <windows.h> #include <stdio.h> #include <tchar.h> int main(void) { typedef BOOL (WINAPI *LPFNIUA)(void); HMODULE hShell32 = LoadLibrary(_T("shell32.dll")); LPFNIUA pIsAdmin = NULL; if (hShell32) { pIsAdmin = (LPFNIUA)GetProcAddress(hShell32, MAKEINTRESOURCE(680)); if (pIsAdmin) { if(pIsAdmin()) printf(_T("User is Admin\n")); else printf(_T("User is NOT Admin\n")); } FreeLibrary(hShell32); } return 0; }