ReactOS  0.4.14-dev-315-gbb6fece
groupprops.c File Reference
#include "usrmgr.h"
Include dependency graph for groupprops.c:

Go to the source code of this file.

Classes

struct  _GENERAL_GROUP_DATA
 

Typedefs

typedef struct _GENERAL_GROUP_DATA GENERAL_GROUP_DATA
 
typedef struct _GENERAL_GROUP_DATAPGENERAL_GROUP_DATA
 

Functions

static VOID GetTextSid (PSID pSid, LPTSTR pTextSid)
 
static VOID InitGroupMembersList (HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
 
static BOOL AddSelectedUsersToGroup (HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
 
INT_PTR CALLBACK AddUsersToGroupDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID AddUsersToGroup (HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
 
static VOID RemoveUserFromGroup (HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
 
static BOOL OnGroupPropSheetNotify (HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData, LPARAM lParam)
 
static VOID GetGeneralGroupData (HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
 
static BOOL SetGeneralGroupData (HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
 
INT_PTR CALLBACK GroupGeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID InitGroupPropSheetPage (PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPTSTR pszGroup)
 
BOOL GroupProperties (HWND hwndDlg)
 

Typedef Documentation

◆ GENERAL_GROUP_DATA

◆ PGENERAL_GROUP_DATA

Function Documentation

◆ AddSelectedUsersToGroup()

static BOOL AddSelectedUsersToGroup ( HWND  hwndDlg,
PGENERAL_GROUP_DATA  pGroupData 
)
static

Definition at line 152 of file groupprops.c.

154 {
155  HWND hwndLV;
156  INT nSelectedItems;
157  INT nItem;
158  TCHAR szUserName[UNLEN];
159  BOOL bResult = FALSE;
160  LOCALGROUP_MEMBERS_INFO_3 memberInfo;
162 
163  hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST);
164 
165  nSelectedItems = ListView_GetSelectedCount(hwndLV);
166  if (nSelectedItems > 0)
167  {
168  nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
169  while (nItem != -1)
170  {
171  /* Get the new user name */
172  ListView_GetItemText(hwndLV,
173  nItem, 0,
174  szUserName,
175  UNLEN);
176 
177  DebugPrintf(_TEXT("Selected user: %s"), szUserName);
178 
179  memberInfo.lgrmi3_domainandname = szUserName;
180 
182  (LPBYTE)&memberInfo, 1);
184  {
185  TCHAR szText[256];
186  wsprintf(szText, TEXT("Error: %u"), status);
187  MessageBox(NULL, szText, TEXT("NetLocalGroupAddMembers"), MB_ICONERROR | MB_OK);
188  }
189  else
190  {
191  bResult = TRUE;
192  }
193 
194  nItem = ListView_GetNextItem(hwndLV, nItem, LVNI_SELECTED);
195  }
196  }
197 
198  return bResult;
199 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define TRUE
Definition: types.h:120
NET_API_STATUS WINAPI NetLocalGroupAddMembers(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries)
Definition: local_group.c:520
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2680
#define LVNI_SELECTED
Definition: commctrl.h:2420
int32_t INT
Definition: typedefs.h:56
#define NERR_Success
Definition: lmerr.h:5
unsigned char * LPBYTE
Definition: typedefs.h:52
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2705
static const WCHAR szText[]
Definition: dialog.c:139
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID DebugPrintf(LPTSTR szFormat,...)
Definition: misc.c:13
smooth NULL
Definition: ftsmooth.c:416
#define _TEXT(x)
Definition: tchar.h:1543
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MB_ICONERROR
Definition: winuser.h:781
#define ERROR_MEMBER_IN_ALIAS
Definition: winerror.h:859
#define MessageBox
Definition: winuser.h:5723
#define TEXT(s)
Definition: k32.h:26
#define IDC_USER_ADD_MEMBERSHIP_LIST
Definition: resource.h:83
#define UNLEN
Definition: sspi.c:28
#define MB_OK
Definition: winuser.h:784
TCHAR szGroupName[1]
Definition: groupprops.c:14
#define wsprintf
Definition: winuser.h:5766
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by AddUsersToGroupDlgProc().

◆ AddUsersToGroup()

static VOID AddUsersToGroup ( HWND  hwndDlg,
PGENERAL_GROUP_DATA  pGroupData 
)
static

Definition at line 247 of file groupprops.c.

249 {
250  HWND hwndLV;
251 // NET_API_STATUS status;
252  PLOCALGROUP_MEMBERS_INFO_1 membersInfo = NULL;
253  DWORD dwRead;
254  DWORD dwTotal;
255  DWORD_PTR resumeHandle = 0;
256  DWORD i;
257  LV_ITEM lvi;
258  TCHAR szGroupName[256];
259 
262  hwndDlg,
264  (LPARAM)pGroupData) == IDOK)
265  {
266  hwndLV = GetDlgItem(hwndDlg, IDC_GROUP_GENERAL_MEMBERS);
267 
268  (void)ListView_DeleteAllItems(hwndLV);
269 
270 // DebugPrintf(_T("Removed all users from the list!"));
271 
272  /* Set group members */
273  NetLocalGroupGetMembers(NULL, pGroupData->szGroupName, 1, (LPBYTE*)&membersInfo,
274  MAX_PREFERRED_LENGTH, &dwRead, &dwTotal,
275  &resumeHandle);
276 
277  for (i = 0; i < dwRead; i++)
278  {
279  ZeroMemory(&lvi, sizeof(lvi));
280  lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
281  lvi.pszText = membersInfo[i].lgrmi1_name;
282  lvi.state = 0;
283  lvi.iImage = (membersInfo[i].lgrmi1_sidusage == SidTypeGroup ||
284  membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) ? 1 : 0;
285 
286  if (membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup)
287  {
288  TCHAR szSid[256];
289 
290  GetTextSid(membersInfo[i].lgrmi1_sid, szSid);
291 
292  wsprintf(szGroupName,
293  TEXT("%s (%s)"),
294  membersInfo[i].lgrmi1_name,
295  szSid);
296 
297  lvi.pszText = szGroupName;
298  }
299 
300 
301  (void)ListView_InsertItem(hwndLV, &lvi);
302  }
303 
304  NetApiBufferFree(membersInfo);
305  }
306 }
#define LV_ITEM
Definition: commctrl.h:2333
#define MAX_PREFERRED_LENGTH
Definition: lmcons.h:48
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDOK
Definition: winuser.h:824
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define IDC_GROUP_GENERAL_MEMBERS
Definition: resource.h:45
SID_NAME_USE lgrmi1_sidusage
Definition: lmaccess.h:520
#define ZeroMemory
Definition: winbase.h:1642
INT_PTR CALLBACK AddUsersToGroupDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: groupprops.c:203
HINSTANCE hApplet
Definition: access.c:17
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
#define LVIF_TEXT
Definition: commctrl.h:2305
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
#define IDD_USER_ADD_MEMBERSHIP
Definition: resource.h:82
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
NET_API_STATUS WINAPI NetLocalGroupGetMembers(LPCWSTR servername, LPCWSTR localgroupname, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR resumehandle)
Definition: local_group.c:1354
#define LVIF_IMAGE
Definition: commctrl.h:2306
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DialogBoxParam
Definition: winuser.h:5665
static VOID GetTextSid(PSID pSid, LPTSTR pTextSid)
Definition: groupprops.c:19
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define TEXT(s)
Definition: k32.h:26
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
#define LVIF_STATE
Definition: commctrl.h:2308
#define wsprintf
Definition: winuser.h:5766
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2410

Referenced by GroupGeneralPageProc().

◆ AddUsersToGroupDlgProc()

INT_PTR CALLBACK AddUsersToGroupDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 203 of file groupprops.c.

207 {
208  PGENERAL_GROUP_DATA pGroupData;
209 
211 
212  pGroupData = (PGENERAL_GROUP_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
213 
214  switch (uMsg)
215  {
216  case WM_INITDIALOG:
217  pGroupData = (PGENERAL_GROUP_DATA)lParam;
218  SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pGroupData);
219  InitGroupMembersList(hwndDlg, pGroupData);
220  break;
221 
222  case WM_COMMAND:
223  switch (LOWORD(wParam))
224  {
225  case IDOK:
226  if (AddSelectedUsersToGroup(hwndDlg, pGroupData))
227  EndDialog(hwndDlg, IDOK);
228  else
229  EndDialog(hwndDlg, IDCANCEL);
230  break;
231 
232  case IDCANCEL:
233  EndDialog(hwndDlg, IDCANCEL);
234  break;
235  }
236  break;
237 
238  default:
239  return FALSE;
240  }
241 
242  return TRUE;
243 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
int32_t INT_PTR
Definition: typedefs.h:62
struct _GENERAL_GROUP_DATA * PGENERAL_GROUP_DATA
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static VOID InitGroupMembersList(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
Definition: groupprops.c:64
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
static BOOL AddSelectedUsersToGroup(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
Definition: groupprops.c:152
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by AddUsersToGroup().

◆ GetGeneralGroupData()

static VOID GetGeneralGroupData ( HWND  hwndDlg,
PGENERAL_GROUP_DATA  pGroupData 
)
static

Definition at line 388 of file groupprops.c.

390 {
391  PLOCALGROUP_INFO_1 groupInfo = NULL;
392  PLOCALGROUP_MEMBERS_INFO_2 membersInfo = NULL;
393  DWORD dwRead;
394  DWORD dwTotal;
395  DWORD_PTR resumeHandle = 0;
396  DWORD i;
397  LV_ITEM lvi;
398  HWND hwndLV;
400  RECT rect;
401  HIMAGELIST hImgList;
402  HICON hIcon;
403  TCHAR szGroupName[256];
404 
405 
406  hwndLV = GetDlgItem(hwndDlg, IDC_GROUP_GENERAL_MEMBERS);
407 
408  /* Create the image list */
409  hImgList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 5, 5);
411  ImageList_AddIcon(hImgList, hIcon);
414  ImageList_AddIcon(hImgList, hIcon);
416 
417  (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL);
418 
419  /* Set the list column */
420  GetClientRect(hwndLV, &rect);
421 
422  memset(&column, 0x00, sizeof(column));
424  column.fmt = LVCFMT_LEFT;
425  column.cx = (INT)(rect.right - rect.left);
426  column.iSubItem = 0;
427  (void)ListView_InsertColumn(hwndLV, 0, &column);
428 
429  /* Set group name */
430  SetDlgItemText(hwndDlg, IDC_GROUP_GENERAL_NAME, pGroupData->szGroupName);
431 
432  /* Set group description */
433  NetLocalGroupGetInfo(NULL, pGroupData->szGroupName, 1, (LPBYTE*)&groupInfo);
435  NetApiBufferFree(groupInfo);
436 
437  /* Set group members */
438  NetLocalGroupGetMembers(NULL, pGroupData->szGroupName, 2, (LPBYTE*)&membersInfo,
439  MAX_PREFERRED_LENGTH, &dwRead, &dwTotal,
440  &resumeHandle);
441 
442  for (i = 0; i < dwRead; i++)
443  {
444  ZeroMemory(&lvi, sizeof(lvi));
445  lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
446  lvi.state = 0;
447  if (membersInfo[i].lgrmi2_sidusage == SidTypeGroup ||
448  membersInfo[i].lgrmi2_sidusage == SidTypeWellKnownGroup)
449  {
450  lvi.iImage = 0;
451  }
452  else if (membersInfo[i].lgrmi2_sidusage == SidTypeUser)
453  {
454  /* FIXME: handle locked user properly! */
455  lvi.iImage = 1;
456  }
457 
458  if (membersInfo[i].lgrmi2_sidusage == SidTypeWellKnownGroup)
459  {
460  TCHAR szSid[256];
461 
462  GetTextSid(membersInfo[i].lgrmi2_sid, szSid);
463 
464  wsprintf(szGroupName,
465  TEXT("%s (%s)"),
466  membersInfo[i].lgrmi2_domainandname,
467  szSid);
468 
469  lvi.pszText = szGroupName;
470  }
471  else
472  {
473  LPWSTR ptr;
474 
475  ptr = wcschr(membersInfo[i].lgrmi2_domainandname, L'\\');
476  if (ptr != NULL)
477  {
478  lvi.pszText = ++ptr;
479  }
480  else
481  {
482  lvi.pszText = membersInfo[i].lgrmi2_domainandname;
483  }
484  }
485 
486  (void)ListView_InsertItem(hwndLV, &lvi);
487  }
488 
489  NetApiBufferFree(membersInfo);
490 }
#define LV_ITEM
Definition: commctrl.h:2333
#define MAX_PREFERRED_LENGTH
Definition: lmcons.h:48
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDI_GROUP
Definition: resource.h:8
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define LVSIL_SMALL
Definition: commctrl.h:2295
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define IDC_GROUP_GENERAL_MEMBERS
Definition: resource.h:45
#define LV_COLUMN
Definition: commctrl.h:2543
#define INT
Definition: polytest.cpp:20
#define LVCFMT_LEFT
Definition: commctrl.h:2594
#define ZeroMemory
Definition: winbase.h:1642
LPWSTR lgrpi1_comment
Definition: lmaccess.h:510
HINSTANCE hApplet
Definition: access.c:17
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
& rect
Definition: startmenu.cpp:1413
#define ILC_COLOR32
Definition: commctrl.h:354
#define LVIF_TEXT
Definition: commctrl.h:2305
#define LVCF_SUBITEM
Definition: commctrl.h:2585
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDC_GROUP_GENERAL_NAME
Definition: resource.h:43
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2632
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
unsigned char * LPBYTE
Definition: typedefs.h:52
NET_API_STATUS WINAPI NetLocalGroupGetInfo(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE *bufptr)
Definition: local_group.c:1225
static PVOID ptr
Definition: dispmode.c:27
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2300
smooth NULL
Definition: ftsmooth.c:416
char TCHAR
Definition: xmlstorage.h:189
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
NET_API_STATUS WINAPI NetLocalGroupGetMembers(LPCWSTR servername, LPCWSTR localgroupname, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR resumehandle)
Definition: local_group.c:1354
#define LVIF_IMAGE
Definition: commctrl.h:2306
unsigned long DWORD
Definition: ntddk_ex.h:95
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define SetDlgItemText
Definition: winuser.h:5750
#define IDC_GROUP_GENERAL_DESCRIPTION
Definition: resource.h:44
static const WCHAR L[]
Definition: oid.c:1250
static VOID GetTextSid(PSID pSid, LPTSTR pTextSid)
Definition: groupprops.c:19
#define ILC_MASK
Definition: commctrl.h:347
uint32_t DWORD_PTR
Definition: typedefs.h:63
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2582
#define TEXT(s)
Definition: k32.h:26
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
HICON hIcon
Definition: msconfig.c:44
#define IDI_USER
Definition: resource.h:6
TCHAR szGroupName[1]
Definition: groupprops.c:14
#define LoadImage
Definition: winuser.h:5716
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define LVIF_STATE
Definition: commctrl.h:2308
#define wsprintf
Definition: winuser.h:5766
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define memset(x, y, z)
Definition: compat.h:39

Referenced by GroupGeneralPageProc().

◆ GetTextSid()

static VOID GetTextSid ( PSID  pSid,
LPTSTR  pTextSid 
)
static

Definition at line 19 of file groupprops.c.

21 {
23  DWORD dwSubAuthorities;
24  DWORD dwSidRev = SID_REVISION;
26  DWORD dwSidSize;
27 
29 
30  dwSubAuthorities = *GetSidSubAuthorityCount(pSid);
31 
32  dwSidSize = wsprintf(pTextSid, TEXT("S-%lu-"), dwSidRev);
33 
34  if ((psia->Value[0] != 0) || (psia->Value[1] != 0))
35  {
36  dwSidSize += wsprintf(pTextSid + lstrlen(pTextSid),
37  TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"),
38  (USHORT)psia->Value[0],
39  (USHORT)psia->Value[1],
40  (USHORT)psia->Value[2],
41  (USHORT)psia->Value[3],
42  (USHORT)psia->Value[4],
43  (USHORT)psia->Value[5]);
44  }
45  else
46  {
47  dwSidSize += wsprintf(pTextSid + lstrlen(pTextSid),
48  TEXT("%lu"),
49  (ULONG)(psia->Value[5]) +
50  (ULONG)(psia->Value[4] << 8) +
51  (ULONG)(psia->Value[3] << 16) +
52  (ULONG)(psia->Value[2] << 24));
53  }
54 
55  for (dwCounter = 0 ; dwCounter < dwSubAuthorities ; dwCounter++)
56  {
57  dwSidSize += wsprintf(pTextSid + dwSidSize, TEXT("-%lu"),
59  }
60 }
* PSID_IDENTIFIER_AUTHORITY
Definition: setypes.h:436
#define SID_REVISION
Definition: setypes.h:453
PDWORD WINAPI GetSidSubAuthority(PSID pSid, DWORD nSubAuthority)
Definition: security.c:775
DWORD dwCounter
Definition: mutex.c:10
unsigned long DWORD
Definition: ntddk_ex.h:95
PUCHAR WINAPI GetSidSubAuthorityCount(PSID pSid)
Definition: security.c:787
#define lstrlen
Definition: winbase.h:3700
#define TEXT(s)
Definition: k32.h:26
unsigned short USHORT
Definition: pedump.c:61
static PSID pSid
Definition: security.c:74
unsigned int ULONG
Definition: retypes.h:1
#define wsprintf
Definition: winuser.h:5766
PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID pSid)
Definition: security.c:764

Referenced by AddUsersToGroup(), and GetGeneralGroupData().

◆ GroupGeneralPageProc()

INT_PTR CALLBACK GroupGeneralPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 530 of file groupprops.c.

534 {
535  PGENERAL_GROUP_DATA pGroupData;
536 
539  UNREFERENCED_PARAMETER(hwndDlg);
540 
541  pGroupData= (PGENERAL_GROUP_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
542 
543  switch (uMsg)
544  {
545  case WM_INITDIALOG:
548  sizeof(GENERAL_GROUP_DATA) +
549  lstrlen((LPTSTR)((PROPSHEETPAGE *)lParam)->lParam) * sizeof(TCHAR));
550  lstrcpy(pGroupData->szGroupName, (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam);
551 
552  SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pGroupData);
553 
554  GetGeneralGroupData(hwndDlg,
555  pGroupData);
556  break;
557 
558  case WM_COMMAND:
559  switch (LOWORD(wParam))
560  {
562  if (HIWORD(wParam) == EN_CHANGE)
563  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
564  break;
565 
567  AddUsersToGroup(hwndDlg, pGroupData);
568  break;
569 
571  RemoveUserFromGroup(hwndDlg, pGroupData);
572  break;
573  }
574  break;
575 
576  case WM_NOTIFY:
577  if (((LPPSHNOTIFY)lParam)->hdr.code == PSN_APPLY)
578  {
579  SetGeneralGroupData(hwndDlg, pGroupData);
580  return TRUE;
581  }
582  else
583  {
584  return OnGroupPropSheetNotify(hwndDlg, pGroupData, lParam);
585  }
586  break;
587 
588  case WM_DESTROY:
589  HeapFree(GetProcessHeap(), 0, pGroupData);
590  break;
591  }
592 
593  return FALSE;
594 }
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static VOID GetGeneralGroupData(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
Definition: groupprops.c:388
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:62
struct _GENERAL_GROUP_DATA * PGENERAL_GROUP_DATA
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define IDC_GROUP_GENERAL_REMOVE
Definition: resource.h:47
#define WM_DESTROY
Definition: winuser.h:1591
char TCHAR
Definition: xmlstorage.h:189
static VOID AddUsersToGroup(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
Definition: groupprops.c:247
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static BOOL SetGeneralGroupData(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
Definition: groupprops.c:494
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDC_GROUP_GENERAL_ADD
Definition: resource.h:46
#define IDC_GROUP_GENERAL_DESCRIPTION
Definition: resource.h:44
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetParent(_In_ HWND)
#define lstrlen
Definition: winbase.h:3700
#define lstrcpy
Definition: winbase.h:3698
static BOOL OnGroupPropSheetNotify(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData, LPARAM lParam)
Definition: groupprops.c:357
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
TCHAR szGroupName[1]
Definition: groupprops.c:14
static VOID RemoveUserFromGroup(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
Definition: groupprops.c:310
#define HIWORD(l)
Definition: typedefs.h:246
struct _GENERAL_GROUP_DATA GENERAL_GROUP_DATA
#define GetWindowLongPtr
Definition: treelist.c:73
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
#define PROPSHEETPAGE
Definition: prsht.h:371
#define WM_NOTIFY
Definition: richedit.h:61
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by GroupProperties().

◆ GroupProperties()

BOOL GroupProperties ( HWND  hwndDlg)

Definition at line 611 of file groupprops.c.

612 {
613  PROPSHEETPAGE psp[1];
614  PROPSHEETHEADER psh;
615  TCHAR szGroupName[UNLEN];
616  INT nItem;
617  HWND hwndLV;
618 
619  hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
620  nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
621  if (nItem == -1)
622  return FALSE;
623 
624  /* Get the new user name */
625  ListView_GetItemText(hwndLV,
626  nItem, 0,
627  szGroupName,
628  UNLEN);
629 
630  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
631  psh.dwSize = sizeof(PROPSHEETHEADER);
632  psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
633  psh.hwndParent = hwndDlg;
634  psh.hInstance = hApplet;
635  psh.hIcon = NULL;
636  psh.pszCaption = szGroupName;
637  psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
638  psh.nStartPage = 0;
639  psh.ppsp = psp;
640 
642 
643  return (PropertySheet(&psh) == IDOK);
644 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define IDOK
Definition: winuser.h:824
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2680
#define IDD_GROUP_GENERAL
Definition: resource.h:42
#define ZeroMemory
Definition: winbase.h:1642
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2420
int32_t INT
Definition: typedefs.h:56
INT_PTR CALLBACK GroupGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: groupprops.c:530
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define UNLEN
Definition: sspi.c:28
static VOID InitGroupPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPTSTR pszGroup)
Definition: groupprops.c:598
#define PropertySheet
Definition: prsht.h:382
#define PROPSHEETPAGE
Definition: prsht.h:371
#define IDC_GROUPS_LIST
Definition: resource.h:16

Referenced by GroupsPageProc().

◆ InitGroupMembersList()

static VOID InitGroupMembersList ( HWND  hwndDlg,
PGENERAL_GROUP_DATA  pGroupData 
)
static

Definition at line 64 of file groupprops.c.

66 {
67  HWND hwndLV;
69  RECT rect;
70  TCHAR szStr[32];
71  HIMAGELIST hImgList;
72  HICON hIcon;
73 
74  NET_API_STATUS netStatus;
75  PUSER_INFO_20 pUserBuffer;
76  DWORD entriesread;
77  DWORD totalentries;
78  DWORD resume_handle = 0;
79  DWORD i;
80  LV_ITEM lvi;
81  INT iItem;
82 
83  hwndLV = GetDlgItem(hwndDlg, IDC_USER_ADD_MEMBERSHIP_LIST);
84  GetClientRect(hwndLV, &rect);
85 
86  hImgList = ImageList_Create(16,16,ILC_COLOR32 | ILC_MASK,5,5);
88  ImageList_AddIcon(hImgList,hIcon);
91  ImageList_AddIcon(hImgList, hIcon);
94  ImageList_AddIcon(hImgList, hIcon);
96 
97  (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL);
99 
100  memset(&column, 0x00, sizeof(column));
102  column.fmt = LVCFMT_LEFT;
103  column.cx = (INT)((rect.right - rect.left) * 0.40);
104  column.iSubItem = 0;
105  LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0]));
106  column.pszText = szStr;
107  (void)ListView_InsertColumn(hwndLV, 0, &column);
108 
109  column.cx = (INT)((rect.right - rect.left) * 0.60);
110  column.iSubItem = 1;
111  LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0]));
112  column.pszText = szStr;
113  (void)ListView_InsertColumn(hwndLV, 1, &column);
114 
115  /* TODO: Enumerate global groups and add them to the list! */
116 
117  for (;;)
118  {
119  netStatus = NetUserEnum(NULL, 20, FILTER_NORMAL_ACCOUNT,
120  (LPBYTE*)&pUserBuffer,
121  1024, &entriesread,
122  &totalentries, &resume_handle);
123  if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA)
124  break;
125 
126  for (i = 0; i < entriesread; i++)
127  {
128  memset(&lvi, 0x00, sizeof(lvi));
129  lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
130  lvi.pszText = pUserBuffer[i].usri20_name;
131  lvi.state = 0;
132  lvi.iImage = (pUserBuffer[i].usri20_flags & UF_ACCOUNTDISABLE) ? 2 : 1;
133  iItem = ListView_InsertItem(hwndLV, &lvi);
134 
135  ListView_SetItemText(hwndLV, iItem, 1,
136  pUserBuffer[i].usri20_full_name);
137 
138  ListView_SetItemText(hwndLV, iItem, 2,
139  pUserBuffer[i].usri20_comment);
140  }
141 
142  NetApiBufferFree(pUserBuffer);
143 
144  /* No more data left */
145  if (netStatus != ERROR_MORE_DATA)
146  break;
147  }
148 }
#define LV_ITEM
Definition: commctrl.h:2333
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDI_GROUP
Definition: resource.h:8
static HICON
Definition: imagelist.c:84
#define IMAGE_ICON
Definition: winuser.h:212
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define LVSIL_SMALL
Definition: commctrl.h:2295
#define LVCF_TEXT
Definition: commctrl.h:2584
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define LV_COLUMN
Definition: commctrl.h:2543
#define IDS_DESCRIPTION
Definition: resource.h:92
#define INT
Definition: polytest.cpp:20
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2730
#define LVCFMT_LEFT
Definition: commctrl.h:2594
HINSTANCE hApplet
Definition: access.c:17
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
#define IDI_LOCKED_USER
Definition: resource.h:7
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
#define NERR_Success
Definition: lmerr.h:5
#define ILC_COLOR32
Definition: commctrl.h:354
#define LVIF_TEXT
Definition: commctrl.h:2305
#define LVCF_SUBITEM
Definition: commctrl.h:2585
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2632
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
unsigned char * LPBYTE
Definition: typedefs.h:52
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2300
smooth NULL
Definition: ftsmooth.c:416
LPWSTR usri20_name
Definition: lmaccess.h:329
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2687
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define LVIF_IMAGE
Definition: commctrl.h:2306
DWORD usri20_flags
Definition: lmaccess.h:332
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2721
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
#define ILC_MASK
Definition: commctrl.h:347
#define ERROR_MORE_DATA
Definition: dderror.h:13
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2582
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
#define IDC_USER_ADD_MEMBERSHIP_LIST
Definition: resource.h:83
HICON hIcon
Definition: msconfig.c:44
#define IDI_USER
Definition: resource.h:6
#define UF_ACCOUNTDISABLE
Definition: lmaccess.h:24
#define FILTER_NORMAL_ACCOUNT
Definition: lmaccess.h:40
#define IDS_NAME
Definition: resource.h:90
#define LoadImage
Definition: winuser.h:5716
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
#define LVIF_STATE
Definition: commctrl.h:2308
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define memset(x, y, z)
Definition: compat.h:39
#define LoadString
Definition: winuser.h:5720
NET_API_STATUS WINAPI NetUserEnum(LPCWSTR servername, DWORD level, DWORD filter, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle)
Definition: user.c:2740

Referenced by AddUsersToGroupDlgProc().

◆ InitGroupPropSheetPage()

static VOID InitGroupPropSheetPage ( PROPSHEETPAGE psp,
WORD  idDlg,
DLGPROC  DlgProc,
LPTSTR  pszGroup 
)
static

Definition at line 598 of file groupprops.c.

599 {
600  ZeroMemory(psp, sizeof(PROPSHEETPAGE));
601  psp->dwSize = sizeof(PROPSHEETPAGE);
602  psp->dwFlags = PSP_DEFAULT;
603  psp->hInstance = hApplet;
604  psp->pszTemplate = MAKEINTRESOURCE(idDlg);
605  psp->pfnDlgProc = DlgProc;
606  psp->lParam = (LPARAM)pszGroup;
607 }
WORD idDlg
Definition: desk.c:109
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define ZeroMemory
Definition: winbase.h:1642
HINSTANCE hApplet
Definition: access.c:17
LONG_PTR LPARAM
Definition: windef.h:208
#define PSP_DEFAULT
Definition: prsht.h:22
DLGPROC DlgProc
Definition: desk.c:110
#define PROPSHEETPAGE
Definition: prsht.h:371

Referenced by GroupProperties().

◆ OnGroupPropSheetNotify()

static BOOL OnGroupPropSheetNotify ( HWND  hwndDlg,
PGENERAL_GROUP_DATA  pGroupData,
LPARAM  lParam 
)
static

Definition at line 357 of file groupprops.c.

360 {
361  LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lParam;
362 
363  switch (((LPNMHDR)lParam)->idFrom)
364  {
366  switch (((LPNMHDR)lParam)->code)
367  {
368  case NM_CLICK:
369  EnableWindow(GetDlgItem(hwndDlg, IDC_GROUP_GENERAL_REMOVE), (lpnmlv->iItem != -1));
370  break;
371 
372  case LVN_KEYDOWN:
373  if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE)
374  {
375  RemoveUserFromGroup(hwndDlg, pGroupData);
376  }
377  break;
378 
379  }
380  break;
381  }
382 
383  return FALSE;
384 }
#define IDC_GROUP_GENERAL_MEMBERS
Definition: resource.h:45
#define LVN_KEYDOWN
Definition: commctrl.h:3180
#define IDC_GROUP_GENERAL_REMOVE
Definition: resource.h:47
#define VK_DELETE
Definition: winuser.h:2208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define NM_CLICK
Definition: commctrl.h:130
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
struct tagNMLISTVIEW * LPNMLISTVIEW
static VOID RemoveUserFromGroup(HWND hwndDlg, PGENERAL_GROUP_DATA pGroupData)
Definition: groupprops.c:310
LPARAM lParam
Definition: combotst.c:139

Referenced by GroupGeneralPageProc().

◆ RemoveUserFromGroup()

static VOID RemoveUserFromGroup ( HWND  hwndDlg,
PGENERAL_GROUP_DATA  pGroupData 
)
static

Definition at line 310 of file groupprops.c.

312 {
313  TCHAR szUserName[UNLEN];
314  TCHAR szText[256];
315  LOCALGROUP_MEMBERS_INFO_3 memberInfo;
316  HWND hwndLV;
317  INT nItem;
319 
320  hwndLV = GetDlgItem(hwndDlg, IDC_GROUP_GENERAL_MEMBERS);
321  nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
322  if (nItem == -1)
323  return;
324 
325  /* Get the new user name */
326  ListView_GetItemText(hwndLV,
327  nItem, 0,
328  szUserName,
329  UNLEN);
330 
331  /* Display a warning message because the remove operation cannot be reverted */
332  wsprintf(szText, TEXT("Do you really want to remove the user \"%s\" from the group \"%s\"?"),
333  szUserName, pGroupData->szGroupName);
334  if (MessageBox(NULL, szText, TEXT("User Accounts"), MB_ICONWARNING | MB_YESNO) == IDNO)
335  return;
336 
337  memberInfo.lgrmi3_domainandname = szUserName;
338 
340  3, (LPBYTE)&memberInfo, 1);
341  if (status != NERR_Success)
342  {
343  TCHAR szText[256];
344  wsprintf(szText, TEXT("Error: %u"), status);
345  MessageBox(NULL, szText, TEXT("NetLocalGroupDelMembers"), MB_ICONERROR | MB_OK);
346  return;
347  }
348 
349  (void)ListView_DeleteItem(hwndLV, nItem);
350 
351  if (ListView_GetItemCount(hwndLV) == 0)
353 }
NET_API_STATUS WINAPI NetLocalGroupDelMembers(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries)
Definition: local_group.c:817
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define IDC_GROUP_GENERAL_MEMBERS
Definition: resource.h:45
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2680
#define LVNI_SELECTED
Definition: commctrl.h:2420
int32_t INT
Definition: typedefs.h:56
#define MB_ICONWARNING
Definition: winuser.h:780
#define NERR_Success
Definition: lmerr.h:5
unsigned char * LPBYTE
Definition: typedefs.h:52
#define MB_YESNO
Definition: winuser.h:811
static const WCHAR szText[]
Definition: dialog.c:139
#define IDC_GROUP_GENERAL_REMOVE
Definition: resource.h:47
smooth NULL
Definition: ftsmooth.c:416
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2407
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
char TCHAR
Definition: xmlstorage.h:189
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5723
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define TEXT(s)
Definition: k32.h:26
#define UNLEN
Definition: sspi.c:28
#define MB_OK
Definition: winuser.h:784
TCHAR szGroupName[1]
Definition: groupprops.c:14
#define IDNO
Definition: winuser.h:830
#define wsprintf
Definition: winuser.h:5766
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by GroupGeneralPageProc(), and OnGroupPropSheetNotify().

◆ SetGeneralGroupData()

static BOOL SetGeneralGroupData ( HWND  hwndDlg,
PGENERAL_GROUP_DATA  pGroupData 
)
static

Definition at line 494 of file groupprops.c.

496 {
497  LOCALGROUP_INFO_1 groupInfo;
498  LPTSTR pszComment = NULL;
499  INT nLength;
501  DWORD dwIndex;
502 
503  /* Get the group description */
505  if (nLength == 0)
506  {
507  groupInfo.lgrpi1_comment = NULL;
508  }
509  else
510  {
511  pszComment = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(TCHAR));
512  GetDlgItemText(hwndDlg, IDC_GROUP_GENERAL_DESCRIPTION, pszComment, nLength + 1);
513  groupInfo.lgrpi1_comment = pszComment;
514  }
515 
516  status = NetLocalGroupSetInfo(NULL, pGroupData->szGroupName, 1, (LPBYTE)&groupInfo, &dwIndex);
517  if (status != NERR_Success)
518  {
519  DebugPrintf(_T("Status: %lu Index: %lu"), status, dwIndex);
520  }
521 
522  if (pszComment)
523  HeapFree(GetProcessHeap(), 0, pszComment);
524 
525  return TRUE;
526 }
#define TRUE
Definition: types.h:120
_In_ DWORD nLength
Definition: wincon.h:461
LPWSTR lgrpi1_comment
Definition: lmaccess.h:510
int32_t INT
Definition: typedefs.h:56
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define NERR_Success
Definition: lmerr.h:5
NET_API_STATUS WINAPI NetLocalGroupSetInfo(LPCWSTR servername, LPCWSTR groupname, DWORD level, LPBYTE buf, LPDWORD parm_err)
Definition: local_group.c:1732
unsigned char * LPBYTE
Definition: typedefs.h:52
VOID DebugPrintf(LPTSTR szFormat,...)
Definition: misc.c:13
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define GetDlgItemText
Definition: winuser.h:5686
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_GROUP_GENERAL_DESCRIPTION
Definition: resource.h:44
TCHAR szGroupName[1]
Definition: groupprops.c:14
#define GetWindowTextLength
Definition: winuser.h:5700
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: ps.c:97

Referenced by GroupGeneralPageProc().