mirror of
https://github.com/reactos/reactos.git
synced 2024-08-29 14:48:37 +00:00
[NETAPI32]
Add information level 2 and 3 for NetUserEnum and NetUserGetInfo. svn path=/trunk/; revision=58118
This commit is contained in:
parent
f7dbb49d4c
commit
638a8ff859
|
@ -169,6 +169,8 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
LPVOID LocalBuffer = NULL;
|
||||
PUSER_INFO_0 UserInfo0;
|
||||
PUSER_INFO_1 UserInfo1;
|
||||
PUSER_INFO_2 UserInfo2;
|
||||
PUSER_INFO_3 UserInfo3;
|
||||
PUSER_INFO_10 UserInfo10;
|
||||
PUSER_INFO_20 UserInfo20;
|
||||
LPWSTR Ptr;
|
||||
|
@ -195,11 +197,67 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
Size += UserInfo->AdminComment.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->ScriptPath.Length > 0)
|
||||
Size = UserInfo->ScriptPath.Length + sizeof(WCHAR);
|
||||
Size += UserInfo->ScriptPath.Length + sizeof(WCHAR);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Size = sizeof(USER_INFO_2) +
|
||||
UserInfo->UserName.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->HomeDirectory.Length > 0)
|
||||
Size += UserInfo->HomeDirectory.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->AdminComment.Length > 0)
|
||||
Size += UserInfo->AdminComment.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->ScriptPath.Length > 0)
|
||||
Size += UserInfo->ScriptPath.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->FullName.Length > 0)
|
||||
Size += UserInfo->FullName.Length + sizeof(WCHAR);
|
||||
|
||||
/* FIXME: usri2_usr_comment */
|
||||
/* FIXME: usri2_parms */
|
||||
|
||||
if (UserInfo->WorkStations.Length > 0)
|
||||
Size += UserInfo->WorkStations.Length + sizeof(WCHAR);
|
||||
|
||||
/* FIXME: usri2_logon_hours */
|
||||
/* FIXME: usri2_logon_server */
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Size = sizeof(USER_INFO_3) +
|
||||
UserInfo->UserName.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->HomeDirectory.Length > 0)
|
||||
Size += UserInfo->HomeDirectory.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->AdminComment.Length > 0)
|
||||
Size += UserInfo->AdminComment.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->ScriptPath.Length > 0)
|
||||
Size += UserInfo->ScriptPath.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->FullName.Length > 0)
|
||||
Size += UserInfo->FullName.Length + sizeof(WCHAR);
|
||||
|
||||
/* FIXME: usri3_usr_comment */
|
||||
/* FIXME: usri3_parms */
|
||||
|
||||
if (UserInfo->WorkStations.Length > 0)
|
||||
Size += UserInfo->WorkStations.Length + sizeof(WCHAR);
|
||||
|
||||
/* FIXME: usri3_logon_hours */
|
||||
/* FIXME: usri3_logon_server */
|
||||
|
||||
if (UserInfo->ProfilePath.Length > 0)
|
||||
Size += UserInfo->ProfilePath.Length + sizeof(WCHAR);
|
||||
|
||||
if (UserInfo->HomeDirectoryDrive.Length > 0)
|
||||
Size += UserInfo->HomeDirectoryDrive.Length + sizeof(WCHAR);
|
||||
break;
|
||||
|
||||
// case 2:
|
||||
// case 3:
|
||||
// case 4:
|
||||
|
||||
case 10:
|
||||
|
@ -311,8 +369,232 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
}
|
||||
break;
|
||||
|
||||
// case 2:
|
||||
// case 3:
|
||||
case 2:
|
||||
UserInfo2 = (PUSER_INFO_2)LocalBuffer;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)UserInfo2 + sizeof(USER_INFO_2));
|
||||
|
||||
UserInfo2->usri2_name = Ptr;
|
||||
|
||||
memcpy(UserInfo2->usri2_name,
|
||||
UserInfo->UserName.Buffer,
|
||||
UserInfo->UserName.Length);
|
||||
UserInfo2->usri2_name[UserInfo->UserName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->UserName.Length + sizeof(WCHAR));
|
||||
|
||||
/* FIXME: usri2_password */
|
||||
/* FIXME: usri2_password_age */
|
||||
/* FIXME: usri2_priv */
|
||||
|
||||
if (UserInfo->HomeDirectory.Length > 0)
|
||||
{
|
||||
UserInfo2->usri2_home_dir = Ptr;
|
||||
|
||||
memcpy(UserInfo2->usri2_home_dir,
|
||||
UserInfo->HomeDirectory.Buffer,
|
||||
UserInfo->HomeDirectory.Length);
|
||||
UserInfo2->usri2_home_dir[UserInfo->HomeDirectory.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->HomeDirectory.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if (UserInfo->AdminComment.Length > 0)
|
||||
{
|
||||
UserInfo2->usri2_comment = Ptr;
|
||||
|
||||
memcpy(UserInfo2->usri2_comment,
|
||||
UserInfo->AdminComment.Buffer,
|
||||
UserInfo->AdminComment.Length);
|
||||
UserInfo2->usri2_comment[UserInfo->AdminComment.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->AdminComment.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri2_flags */
|
||||
|
||||
if (UserInfo->ScriptPath.Length > 0)
|
||||
{
|
||||
UserInfo2->usri2_script_path = Ptr;
|
||||
|
||||
memcpy(UserInfo2->usri2_script_path,
|
||||
UserInfo->ScriptPath.Buffer,
|
||||
UserInfo->ScriptPath.Length);
|
||||
UserInfo2->usri2_script_path[UserInfo->ScriptPath.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->ScriptPath.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri2_auth_flags */
|
||||
|
||||
if (UserInfo->FullName.Length > 0)
|
||||
{
|
||||
UserInfo2->usri2_full_name = Ptr;
|
||||
|
||||
memcpy(UserInfo2->usri2_full_name,
|
||||
UserInfo->FullName.Buffer,
|
||||
UserInfo->FullName.Length);
|
||||
UserInfo2->usri2_full_name[UserInfo->FullName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->FullName.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri2_usr_comment */
|
||||
/* FIXME: usri2_parms */
|
||||
|
||||
if (UserInfo->WorkStations.Length > 0)
|
||||
{
|
||||
UserInfo2->usri2_workstations = Ptr;
|
||||
|
||||
memcpy(UserInfo2->usri2_workstations,
|
||||
UserInfo->WorkStations.Buffer,
|
||||
UserInfo->WorkStations.Length);
|
||||
UserInfo2->usri2_workstations[UserInfo->WorkStations.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->WorkStations.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri2_last_logon */
|
||||
/* FIXME: usri2_last_logoff */
|
||||
/* FIXME: usri2_acct_expires */
|
||||
/* FIXME: usri2_max_storage */
|
||||
/* FIXME: usri2_units_per_week */
|
||||
/* FIXME: usri2_logon_hours */
|
||||
/* FIXME: usri2_bad_pw_count */
|
||||
/* FIXME: usri2_num_logons */
|
||||
/* FIXME: usri2_logon_server */
|
||||
/* FIXME: usri2_country_code */
|
||||
/* FIXME: usri2_code_page */
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
UserInfo3 = (PUSER_INFO_3)LocalBuffer;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)UserInfo3 + sizeof(USER_INFO_3));
|
||||
|
||||
UserInfo3->usri3_name = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_name,
|
||||
UserInfo->UserName.Buffer,
|
||||
UserInfo->UserName.Length);
|
||||
UserInfo3->usri3_name[UserInfo->UserName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->UserName.Length + sizeof(WCHAR));
|
||||
|
||||
/* FIXME: usri3_password */
|
||||
/* FIXME: usri3_password_age */
|
||||
/* FIXME: usri3_priv */
|
||||
|
||||
if (UserInfo->HomeDirectory.Length > 0)
|
||||
{
|
||||
UserInfo3->usri3_home_dir = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_home_dir,
|
||||
UserInfo->HomeDirectory.Buffer,
|
||||
UserInfo->HomeDirectory.Length);
|
||||
UserInfo3->usri3_home_dir[UserInfo->HomeDirectory.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->HomeDirectory.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if (UserInfo->AdminComment.Length > 0)
|
||||
{
|
||||
UserInfo3->usri3_comment = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_comment,
|
||||
UserInfo->AdminComment.Buffer,
|
||||
UserInfo->AdminComment.Length);
|
||||
UserInfo3->usri3_comment[UserInfo->AdminComment.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->AdminComment.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri3_flags */
|
||||
|
||||
if (UserInfo->ScriptPath.Length > 0)
|
||||
{
|
||||
UserInfo3->usri3_script_path = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_script_path,
|
||||
UserInfo->ScriptPath.Buffer,
|
||||
UserInfo->ScriptPath.Length);
|
||||
UserInfo3->usri3_script_path[UserInfo->ScriptPath.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->ScriptPath.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri3_auth_flags */
|
||||
|
||||
if (UserInfo->FullName.Length > 0)
|
||||
{
|
||||
UserInfo3->usri3_full_name = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_full_name,
|
||||
UserInfo->FullName.Buffer,
|
||||
UserInfo->FullName.Length);
|
||||
UserInfo3->usri3_full_name[UserInfo->FullName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->FullName.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri3_usr_comment */
|
||||
/* FIXME: usri3_parms */
|
||||
|
||||
if (UserInfo->WorkStations.Length > 0)
|
||||
{
|
||||
UserInfo3->usri3_workstations = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_workstations,
|
||||
UserInfo->WorkStations.Buffer,
|
||||
UserInfo->WorkStations.Length);
|
||||
UserInfo3->usri3_workstations[UserInfo->WorkStations.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->WorkStations.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri3_last_logon */
|
||||
/* FIXME: usri3_last_logoff */
|
||||
/* FIXME: usri3_acct_expires */
|
||||
/* FIXME: usri3_max_storage */
|
||||
/* FIXME: usri3_units_per_week */
|
||||
/* FIXME: usri3_logon_hours */
|
||||
/* FIXME: usri3_bad_pw_count */
|
||||
/* FIXME: usri3_num_logons */
|
||||
/* FIXME: usri3_logon_server */
|
||||
/* FIXME: usri3_country_code */
|
||||
/* FIXME: usri3_code_page */
|
||||
|
||||
UserInfo3->usri3_user_id = RelativeId;
|
||||
UserInfo3->usri3_primary_group_id = UserInfo->PrimaryGroupId;
|
||||
|
||||
if (UserInfo->ProfilePath.Length > 0)
|
||||
{
|
||||
UserInfo3->usri3_profile = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_profile,
|
||||
UserInfo->ProfilePath.Buffer,
|
||||
UserInfo->ProfilePath.Length);
|
||||
UserInfo3->usri3_profile[UserInfo->ProfilePath.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->ProfilePath.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
if (UserInfo->HomeDirectoryDrive.Length > 0)
|
||||
{
|
||||
UserInfo3->usri3_home_dir_drive = Ptr;
|
||||
|
||||
memcpy(UserInfo3->usri3_home_dir_drive,
|
||||
UserInfo->HomeDirectoryDrive.Buffer,
|
||||
UserInfo->HomeDirectoryDrive.Length);
|
||||
UserInfo3->usri3_home_dir_drive[UserInfo->HomeDirectoryDrive.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->HomeDirectoryDrive.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: usri3_password_expired */
|
||||
break;
|
||||
|
||||
// case 4:
|
||||
|
||||
case 10:
|
||||
|
@ -341,7 +623,7 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->AdminComment.Length + sizeof(WCHAR));
|
||||
}
|
||||
|
||||
/* FIXME: UserInfo10->usri10_usr_comment */
|
||||
/* FIXME: usri10_usr_comment */
|
||||
|
||||
if (UserInfo->FullName.Length > 0)
|
||||
{
|
||||
|
@ -351,6 +633,8 @@ BuildUserInfoBuffer(PUSER_ACCOUNT_INFORMATION UserInfo,
|
|||
UserInfo->FullName.Buffer,
|
||||
UserInfo->FullName.Length);
|
||||
UserInfo10->usri10_full_name[UserInfo->FullName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
Ptr = (LPWSTR)((ULONG_PTR)Ptr + UserInfo->FullName.Length + sizeof(WCHAR));
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue