• 枚举NT系统用户


    #define UNICODE
    #include <windows.h>
    #include <stdio.h>
    #include <lm.h>

    void main( int argc, char *argv[ ] )
    {
       PNET_DISPLAY_USER pBuff, p;
       DWORD res, dwRec, i = 0;
       //
       // You can pass a NULL or empty string
       //  to retrieve the local information.
       //
       TCHAR szServer[255]=TEXT("");

       if(argc > 1)
          //
          // Check to see if a server name was passed;
          //  if so, convert it to Unicode.
          //
          MultiByteToWideChar(CP_ACP, 0, argv[1], -1, szServer, 255);

       do // begin do
       {
          //
          // Call the NetQueryDisplayInformation function;
          //   specify information level 1 (user account information).
          //
          res = NetQueryDisplayInformation(szServer, 1, i, 1000, MAX_PREFERRED_LENGTH, &dwRec, (void**)&pBuff);
          //
          // If the call succeeds,
          //
          if((res==ERROR_SUCCESS) || (res==ERROR_MORE_DATA))
          {
             p = pBuff;
             for(;dwRec>0;dwRec--)
             {
                //
                // Print the retrieved group information.
                //
                printf("Name:      %S\n"
                      "Comment:   %S\n"
                      "Group ID:  %u\n"
                      "Attributes: %u\n"
                      "--------------------------------\n",
                      p->usri1_name,
                      p->usri1_comment,
                      p->usri1_user_id,
                      p->usri1_flags);
                //
                // If there is more data, set the index.
                //
                i = p->usri1_next_index;
                p++;
             }
             //
             // Free the allocated memory.
             //
             NetApiBufferFree(pBuff);
          }
          else
             printf("Error: %u\n", res);
       //
       // Continue while there is more data.
       //
       } while (res==ERROR_MORE_DATA); // end do
       return;
    }

  • 相关阅读:
    将myeclipse里的web项目导入到eclipse中并加入到Server,解决Tomcat6不支持JDK6
    为VisualSVN Server增加在线修改用户密码的功能
    ANDROID转载
    HELP // Configuring Email Notifications in VisualSVN Server
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    hibernate annotations @Entity hql "XX not mapped"
    Hibernate exception
    svn
    struts2 FilterDispatcher StrutsPrepareAndExecuteFilter
    持续交付的8条原则
  • 原文地址:https://www.cnblogs.com/MaxWoods/p/319095.html
Copyright © 2020-2023  润新知