Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:07:48+00:00 2026-05-26T02:07:48+00:00

I’m trying to use LsaLogonUser to create an interactive logon session, but it always

  • 0

I’m trying to use LsaLogonUser to create an interactive logon session, but it always returns STATUS_INVALID_INFO_CLASS (0xc0000003). From what I have found in searching online, the memory layout of the KERB_INTERACTIVE_LOGON structure is tricky, but I’m pretty sure I’ve done that right.

I’ve also tried using MSV1.0 instead of Kerberos, with MSV1_0_INTERACTIVE_LOGON for the authentication structure and MSV1_0_PACKAGE_NAME as the package name, but that fails with STATUS_BAD_VALIDATION_CLASS (0xc00000a7).

Can anyone tell what I’m doing wrong here? Here’s the code, with most of the error handling stripped. Clearly this isn’t production-quality; I’m just trying to get a working sample.


// see below for definitions of these
size_t wcsByteLen( const wchar_t* str );
void InitUnicodeString( UNICODE_STRING& str, const wchar_t* value, BYTE* buffer, size_t& offset );

int main( int argc, char * argv[] )
{
    // connect to the LSA
    HANDLE lsa;
    LsaConnectUntrusted( &lsa );

    const wchar_t* domain = L"mydomain";
    const wchar_t* user = L"someuser";
    const wchar_t* password = L"scaryplaintextpassword";

    // prepare the authentication info
    ULONG authInfoSize = sizeof(KERB_INTERACTIVE_LOGON) +
     wcsByteLen( domain ) + wcsByteLen( user ) + wcsByteLen( password );
    BYTE* authInfoBuf = new BYTE[authInfoSize];
    KERB_INTERACTIVE_LOGON* authInfo = (KERB_INTERACTIVE_LOGON*)authInfoBuf;
    authInfo->MessageType = KerbInteractiveLogon;
    size_t offset = sizeof(KERB_INTERACTIVE_LOGON);
    InitUnicodeString( authInfo->LogonDomainName, domain, authInfoBuf, offset );
    InitUnicodeString( authInfo->UserName, user, authInfoBuf, offset );
    InitUnicodeString( authInfo->Password, password, authInfoBuf, offset );

    // find the Kerberos security package
    char packageNameRaw[] = MICROSOFT_KERBEROS_NAME_A;
    LSA_STRING packageName;
    packageName.Buffer = packageNameRaw;
    packageName.Length = packageName.MaximumLength = (USHORT)strlen( packageName.Buffer );
    ULONG packageId;
    LsaLookupAuthenticationPackage( lsa, &packageName, &packageId );

    // create a dummy origin and token source
    LSA_STRING origin = {};
    origin.Buffer = _strdup( "TestAppFoo" );
    origin.Length = (USHORT)strlen( origin.Buffer );
    origin.MaximumLength = origin.Length;
    TOKEN_SOURCE source = {};
    strcpy( source.SourceName, "foobar" );
    AllocateLocallyUniqueId( &source.SourceIdentifier );

    void* profileBuffer;
    DWORD profileBufLen;
    LUID luid;
    HANDLE token;
    QUOTA_LIMITS qlimits;
    NTSTATUS subStatus;
    NTSTATUS status = LsaLogonUser( lsa, &origin, Interactive, packageId,
     &authInfo, authInfoSize, 0, &source, &profileBuffer, &profileBufLen,
     &luid, &token, &qlimits, &subStatus );
    if( status != ERROR_SUCCESS )
    {
        ULONG err = LsaNtStatusToWinError( status );
        printf( "LsaLogonUser failed: %x\n", status );
        return 1;
    }
}

size_t wcsByteLen( const wchar_t* str )
{
    return wcslen( str ) * sizeof(wchar_t);
}

void InitUnicodeString( UNICODE_STRING& str, const wchar_t* value,
 BYTE* buffer, size_t& offset )
{
    size_t size = wcsByteLen( value );
    str.Length = str.MaximumLength = (USHORT)size;
    str.Buffer = (PWSTR)(buffer + offset);
    memcpy( str.Buffer, value, size );
    offset += size;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:07:48+00:00Added an answer on May 26, 2026 at 2:07 am

    You goofed up on one of the parameters to LsaLogonUser(); instead of &authInfo you should pass just authInfo. Happens to everyone 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.