Anyone know how I would do a manual netlogon or any other way to authenticate a user on a remote domain? I need to test authentication.

Right now we're using impersonation and calling an arbitrary function. The problem is that arbitrary winapi function that will login. The problem is that some domains allow that function to be called by null session thus causing false positives.

The only goal of this is to get reliable, fast authentication against a remote domain that the local computer is not added to so I wouldn't deny another approach.

This is the solution that we got from filing a MSDN ticket.

```
if(!LogonUser(username.c_str(), domain.c_str(), password.c_str(), LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_WINNT50, &token))
{
    debug->DebugMessage(Error::GetErrorMessageW(GetLastError()));
    CloseHandle(token);
    RevertToSelf();
    return false;
}

if(!ImpersonateLoggedOnUser(token))
{
    debug->DebugMessage(Error::GetErrorMessageW(GetLastError()));
    CloseHandle(token);
    RevertToSelf();
    return false;
}
...

int err = NetUserModalsGet ....

if (err != ERROR_SUCCESS) logged_on = false;
RevertToSelf();

```