Author: ekohl
Date: Sat Jan 5 21:04:54 2013
New Revision: 58118
URL:
http://svn.reactos.org/svn/reactos?rev=58118&view=rev
Log:
[NETAPI32]
Add information level 2 and 3 for NetUserEnum and NetUserGetInfo.
Modified:
trunk/reactos/dll/win32/netapi32/user.c
Modified: trunk/reactos/dll/win32/netapi32/user.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/user.c?…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/user.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/user.c [iso-8859-1] Sat Jan 5 21:04:54 2013
@@ -169,6 +169,8 @@
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 @@
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:
-// case 3:
+ 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 4:
case 10:
@@ -311,8 +369,232 @@
}
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 @@
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 @@
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;