SOL9 Sample: NetUserLocalGroup

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * NetUserLocalGroup.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


#include <sol/nm/NetUser.h>

#include <sol/nm/UserInfo0.h>
#include <sol/nm/GroupInfo0.h>

#include <sol/Locale.h>

void _tmain(int argc, TCHAR** argv)
{
  Locale locale;

  try {
    wchar_t* server = NULL;

    NetUser netUser(server);

    UserInfo0  user0;

    netUser.enumerateAll(user0);
    USER_INFO_0* ptr = user0.getInfo();

    int count = user0.getEntriesRead();
    printf("USER_INFO_0 count=%d\n", count);
    for (int i = 0; i<count; i++) {
      if (ptr) {
        GroupInfo0 info0;
        printf("UserName: %S\n", ptr->usri0_name);
        netUser.getLocalGroups(ptr->usri0_name, 0, info0);
        info0.display();
      }
      ptr++;
    }
    

  } catch (...) {
    printf("Exception \n");
  }

  printf("OK. Please hit [enter] key\n");
  getchar();
}

Last modified: 2 May 2016

Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.