NT_LogonUser username password logonType

In order to use NT_LogonUser, the user running the script must have the "Act as a part of the Operating System" privilege.  You can give the user this privilege in User Manager.  Note that the user being authenticated does not need the privilege.

NT_LogonUser returns a handle for use with NT_ImpersonateUser and NT_CreateProcessAsUser

NT_ImpersonateUser handle

NT_RevertToSelf

NT_CreateProcessAsUser handle commandLine

NT_AccessCheck securityDescriptor accessFlags

NT_SetStationSecurity securityDescriptorHandle

This function allows you to set the security of your desktop station.  This means that you can set security, then start a process in another user's context (NT_CreateProcessAsUser) and have it display on the console of the currently logged-on user.