mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 00:55:53 +00:00
[NET]
Display user group memberships. svn path=/trunk/; revision=65172
This commit is contained in:
parent
6f9a074461
commit
2f120e9e6d
1 changed files with 66 additions and 3 deletions
|
@ -130,7 +130,12 @@ DisplayUser(LPWSTR lpUserName)
|
||||||
{
|
{
|
||||||
PUSER_MODALS_INFO_0 pUserModals = NULL;
|
PUSER_MODALS_INFO_0 pUserModals = NULL;
|
||||||
PUSER_INFO_4 pUserInfo = NULL;
|
PUSER_INFO_4 pUserInfo = NULL;
|
||||||
|
PLOCALGROUP_USERS_INFO_0 pLocalGroupInfo = NULL;
|
||||||
|
PGROUP_USERS_INFO_0 pGroupInfo = NULL;
|
||||||
|
DWORD dwLocalGroupRead, dwLocalGroupTotal;
|
||||||
|
DWORD dwGroupRead, dwGroupTotal;
|
||||||
DWORD dwLastSet;
|
DWORD dwLastSet;
|
||||||
|
DWORD i;
|
||||||
NET_API_STATUS Status;
|
NET_API_STATUS Status;
|
||||||
|
|
||||||
/* Modify the user */
|
/* Modify the user */
|
||||||
|
@ -147,6 +152,27 @@ DisplayUser(LPWSTR lpUserName)
|
||||||
if (Status != NERR_Success)
|
if (Status != NERR_Success)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
Status = NetUserGetLocalGroups(NULL,
|
||||||
|
lpUserName,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
(LPBYTE*)&pLocalGroupInfo,
|
||||||
|
MAX_PREFERRED_LENGTH,
|
||||||
|
&dwLocalGroupRead,
|
||||||
|
&dwLocalGroupTotal);
|
||||||
|
if (Status != NERR_Success)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
Status = NetUserGetGroups(NULL,
|
||||||
|
lpUserName,
|
||||||
|
0,
|
||||||
|
(LPBYTE*)&pGroupInfo,
|
||||||
|
MAX_PREFERRED_LENGTH,
|
||||||
|
&dwGroupRead,
|
||||||
|
&dwGroupTotal);
|
||||||
|
if (Status != NERR_Success)
|
||||||
|
goto done;
|
||||||
|
|
||||||
PrintToConsole(L"User name %s\n", pUserInfo->usri4_name);
|
PrintToConsole(L"User name %s\n", pUserInfo->usri4_name);
|
||||||
PrintToConsole(L"Full name %s\n", pUserInfo->usri4_full_name);
|
PrintToConsole(L"Full name %s\n", pUserInfo->usri4_full_name);
|
||||||
PrintToConsole(L"Comment %s\n", pUserInfo->usri4_comment);
|
PrintToConsole(L"Comment %s\n", pUserInfo->usri4_comment);
|
||||||
|
@ -188,12 +214,49 @@ DisplayUser(LPWSTR lpUserName)
|
||||||
else
|
else
|
||||||
PrintDateTime(pUserInfo->usri4_last_logon);
|
PrintDateTime(pUserInfo->usri4_last_logon);
|
||||||
PrintToConsole(L"\n");
|
PrintToConsole(L"\n");
|
||||||
PrintToConsole(L"Logon hours allowed \n");
|
PrintToConsole(L"Logon hours allowed ");
|
||||||
|
if (pUserInfo->usri4_logon_hours == NULL)
|
||||||
|
PrintToConsole(L"All\n");
|
||||||
PrintToConsole(L"\n");
|
PrintToConsole(L"\n");
|
||||||
PrintToConsole(L"Local group memberships \n");
|
|
||||||
PrintToConsole(L"Global group memberships \n");
|
PrintToConsole(L"\n");
|
||||||
|
PrintToConsole(L"Local group memberships ");
|
||||||
|
if (dwLocalGroupTotal != 0 && pLocalGroupInfo != NULL)
|
||||||
|
{
|
||||||
|
for (i = 0; i < dwLocalGroupTotal; i++)
|
||||||
|
{
|
||||||
|
if (i != 0)
|
||||||
|
PrintToConsole(L" ");
|
||||||
|
PrintToConsole(L"*%s\n", pLocalGroupInfo[i].lgrui0_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrintToConsole(L"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintToConsole(L"Global group memberships ");
|
||||||
|
if (dwGroupTotal != 0 && pGroupInfo != NULL)
|
||||||
|
{
|
||||||
|
for (i = 0; i < dwGroupTotal; i++)
|
||||||
|
{
|
||||||
|
if (i != 0)
|
||||||
|
PrintToConsole(L" ");
|
||||||
|
PrintToConsole(L"*%s\n", pGroupInfo[i].grui0_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrintToConsole(L"\n");
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (pGroupInfo != NULL)
|
||||||
|
NetApiBufferFree(pGroupInfo);
|
||||||
|
|
||||||
|
if (pLocalGroupInfo != NULL)
|
||||||
|
NetApiBufferFree(pLocalGroupInfo);
|
||||||
|
|
||||||
if (pUserModals != NULL)
|
if (pUserModals != NULL)
|
||||||
NetApiBufferFree(pUserModals);
|
NetApiBufferFree(pUserModals);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue