昨天发了一个问题,因为给的分太少了,结果没有人回答!
现在将我的所有身家都给压上去了,只要回答,就给大分!
急!求救:VC下关于Windows域编程的问题 请大侠们指点一下SDK或MFC中与域操作相关的函数。非常感激!需要做的工作如下:
获取本机对应的Windows域名,然后向对应的域服务器进行验证,以确定本机的登陆用户是否有效、有什么级别的权限。

解决方案 »

  1.   

    查一下MSDN里关于域管理的API嘛.
      

  2.   

    获取本机对应的Windows域名
    可以读取注册表内的信息!
      

  3.   

    How To Get Domain Information Using ADSI
    Q197948
    http://support.microsoft.com/default.aspx?scid=kb;en-us;197948
      

  4.   

    How To Retrieve Current User and Domain Names on Windows NT, Windows 2000, or Windows XP
    http://support.microsoft.com/default.aspx?scid=kb;en-us;111544http://support.microsoft.com/default.aspx?scid=kb;en-us;555026
    How To Force Adding Of Domain Admin Group to Local Admin Group
      

  5.   

    NetWkstaUserGetInfo可以获得当前登陆用户的用户名,域名等
      

  6.   

    The NetWkstaUserGetInfo function returns information about the currently logged-on user. This function must be called in the context of the logged-on user.
    NET_API_STATUS NetWkstaUserGetInfo(
      LPWSTR reserved,
      DWORD level,
      LPBYTE* bufptr
    );Parameters
    reserved 
    This parameter must be set to NULL. 
    level 
    [in] Specifies the information level of the data. This parameter can be one of the following values. Value Meaning 
    0 Return the name of the user currently logged on to the workstation. The bufptr parameter points to a WKSTA_USER_INFO_0 structure. 
    1 Return information about the workstation, including the name of the current user and the domains accessed by the workstation. The bufptr parameter points to a WKSTA_USER_INFO_1 structure. 
    1101 Return domains browsed by the workstation. The bufptr parameter points to a WKSTA_USER_INFO_1101 structure. bufptr 
    [out] Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter. This buffer is allocated by the system and must be freed using the NetApiBufferFree function. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths. 
    Return Values
    If the function succeeds, the return value is NERR_Success.If the function fails, the return value can be one of the following error codes.Return Code Description 
    ERROR_NOT_ENOUGH_MEMORY The system ran out of memory resources. Either the network manager configuration is incorrect, or the program is running on a system with insufficient memory. 
    ERROR_INVALID_LEVEL The level parameter is invalid. 
    ERROR_INVALID_PARAMETER One of the function parameters is invalid. Res
    The NetWkstaUserGetInfo function only works locally.Example Code 
    The following code sample demonstrates how to retrieve information about the currently logged-on user using a call to the NetWkstaUserGetInfo function. The sample calls NetWkstaUserGetInfo, specifying information level 1 ( WKSTA_USER_INFO_1). If the call succeeds, the sample prints information about the logged-on user. Finally, the sample frees the memory allocated for the information buffer.#ifndef UNICODE
    #define UNICODE
    #endif#include <stdio.h>
    #include <windows.h> 
    #include <lm.h>int wmain(void)
    {
       DWORD dwLevel = 1;
       LPWKSTA_USER_INFO_1 pBuf = NULL;
       NET_API_STATUS nStatus;
       //
       // Call the NetWkstaUserGetInfo function;
       //  specify level 1.
       //
       nStatus = NetWkstaUserGetInfo(NULL,
                                     dwLevel,
                                     (LPBYTE *)&pBuf);
       //
       // If the call succeeds, print the information
       //  about the logged-on user.
       //
       if (nStatus == NERR_Success)
       {
          if (pBuf != NULL)
          {
             wprintf(L"\n\tUser:          %s\n", pBuf->wkui1_username);
             wprintf(L"\tDomain:        %s\n", pBuf->wkui1_logon_domain);
             wprintf(L"\tOther Domains: %s\n", pBuf->wkui1_oth_domains);
             wprintf(L"\tLogon Server:  %s\n", pBuf->wkui1_logon_server);
          }
       }
       // Otherwise, print the system error.
       //
       else
          fprintf(stderr, "A system error has occurred: %d\n", nStatus);
       //
       // Free the allocated memory.
       //
       if (pBuf != NULL)
          NetApiBufferFree(pBuf);   return 0;
    }这是在PLATFORM SDK中截取的,你看了就明白了