# IsProcessRunningAsAdmin2

```
typedef BOOL(WINAPI* ISNTADMIN)(DWORD, LPDWORD);

BOOL IsProcessRunningAsAdmin2(VOID)
{
	ISNTADMIN IsNtAdmin = NULL;
	HMODULE hMod = NULL;
	BOOL bFlag = FALSE;

	hMod = LoadLibraryW(L"advpack.dll");
	if (hMod == NULL)
		goto EXIT_ROUTINE;

	IsNtAdmin = (ISNTADMIN)GetProcAddress(hMod, "IsNTAdmin");
	if (!IsNtAdmin)
		goto EXIT_ROUTINE;

	bFlag = IsNtAdmin(0, NULL);

EXIT_ROUTINE:

	if (hMod)
		FreeLibrary(hMod);

	return bFlag;
}
```

