USER_INFO_1 (netapi32)
Last changed: -70.224.71.10

.
Summary
TODO - a short description

C# Signature:

        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
        public struct USER_INFO_1
        {
            [MarshalAs(UnmanagedType.LPWStr)] public string sUsername;
            [MarshalAs(UnmanagedType.LPWStr)] public string sPassword;
            public uint uiPasswordAge;
            public uint uiPriv;
            [MarshalAs(UnmanagedType.LPWStr)] public string sHome_Dir;
            [MarshalAs(UnmanagedType.LPWStr)] public string sComment;
            public uint uiFlags;
            [MarshalAs(UnmanagedType.LPWStr)] public string sScript_Path;
        }

        //uiPriv
        const uint USER_PRIV_GUEST = 0;
        const uint USER_PRIV_USER = 1;
        const uint USER_PRIV_ADMIN = 2;

        //uiFlags (flags)
        const uint UF_DONT_EXPIRE_PASSWD = 0x10000;
        const uint UF_MNS_LOGON_ACCOUNT = 0x20000;
        const uint UF_SMARTCARD_REQUIRED = 0x40000;
        const uint UF_TRUSTED_FOR_DELEGATION = 0x80000;
        const uint UF_NOT_DELEGATED = 0x100000;
        const uint UF_USE_DES_KEY_ONLY = 0x200000;
        const uint UF_DONT_REQUIRE_PREAUTH = 0x400000;
        const uint UF_PASSWORD_EXPIRED = 0x800000;
        const uint UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x1000000;
        const uint UF_NO_AUTH_DATA_REQUIRED = 0x2000000;
        const uint UF_PARTIAL_SECRETS_ACCOUNT = 0x4000000;
        const uint UF_USE_AES_KEYS = 0x8000000;

        //uiFlags (choice)
        const uint UF_TEMP_DUPLICATE_ACCOUNT = 0x0100;
        const uint UF_NORMAL_ACCOUNT = 0x0200;
        const uint UF_INTERDOMAIN_TRUST_ACCOUNT = 0x0800;
        const uint UF_WORKSTATION_TRUST_ACCOUNT = 0x1000;
        const uint UF_SERVER_TRUST_ACCOUNT = 0x2000;

VB Signature:

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

What's with all this unmanaged nonsense? USER_INFO_0, USER_INFO_23, and many other structures on this site, manage not to resort to such ugliness.

Tips & Tricks:

Please add some!

Sample Code:

            ArrayList users = new ArrayList();
            int EntriesRead;
            int TotalEntries;
            int Resume;
            IntPtr bufPtr;
            string sServername = ("127.0.0.1"; // local

            NetUserEnum(sServername,1, 2, out bufPtr, -1, out EntriesRead, out TotalEntries, out Resume);
            if(EntriesRead> 0)
            {
                USER_INFO_1[] Users = new USER_INFO_1[EntriesRead];
                IntPtr iter = bufPtr;
                for(int i=0; i < EntriesRead; i++)
                {
                    Users[i] = (USER_INFO_1)Marshal.PtrToStructure(iter, typeof(USER_INFO_1));
                    iter = (IntPtr)((int)iter + Marshal.SizeOf(typeof(USER_INFO_1)));

                    users.Add(Users[i]);
                }
                NetApiBufferFree(bufPtr);
            }

Documentation
USER_INFO_1 on MSDN