Google "Sample SSPI Code" to implement doamin user authentication under Windows.