昨天发了一个问题,因为给的分太少了,结果没有人回答!
现在将我的所有身家都给压上去了,只要回答,就给大分!
急!求救:VC下关于Windows域编程的问题 请大侠们指点一下SDK或MFC中与域操作相关的函数。非常感激!需要做的工作如下:
获取本机对应的Windows域名,然后向对应的域服务器进行验证,以确定本机的登陆用户是否有效、有什么级别的权限。
现在将我的所有身家都给压上去了,只要回答,就给大分!
急!求救:VC下关于Windows域编程的问题 请大侠们指点一下SDK或MFC中与域操作相关的函数。非常感激!需要做的工作如下:
获取本机对应的Windows域名,然后向对应的域服务器进行验证,以确定本机的登陆用户是否有效、有什么级别的权限。
解决方案 »
- 关于剪贴板格式
- postthreadmessage能否传指针参数,是否会出问题啊????
- 内嵌对象指针的问题!~~~
- 怎么用VC实现改变目录属性为隐藏?
- 急!!! isapi 接受表单内容的问题!
- 在资源里加入可执行文件(或者多个自定义资源,合并成一个可执行文件),然后在把它一个一个释放...
- 请教一个问题,谢谢
- 控制台程序支持MFC,如何调进MFC的AfxWinMain呢?
- 关于vc++程序的调试
- C++程序内写的SetDlgItemText却提示SetDlgItemTextA不接受两个参数
- 对一个窗口发消息,怎样找到该窗口的句柄,问题解决一定加满
- 直接使用WindowsAPI怎样创建ToolBar?
可以读取注册表内的信息!
Q197948
http://support.microsoft.com/default.aspx?scid=kb;en-us;197948
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
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中截取的,你看了就明白了