NetUserEnum我想用这个函数获得Administrator域下的几个帐户,并不想获得本地计算机的所有帐号。对这个参数设置了都没什么做用。
FILTER_TEMP_DUPLICATE_ACCOUNT Enumerates local user account data on a domain controller.
FILTER_NORMAL_ACCOUNT Enumerates global user account data on a computer.
FILTER_INTERDOMAIN_TRUST_ACCOUNT Enumerates domain trust account data on a domain controller. The data is associated with the accounts of domains trusting the specified domain.
FILTER_WORKSTATION_TRUST_ACCOUNT Enumerates workstation or member server account data on a domain controller.
FILTER_SERVER_TRUST_ACCOUNT 请问大家我该怎么判断。谢谢!!!并且我该怎么获得帐号的密码!!!!
FILTER_TEMP_DUPLICATE_ACCOUNT Enumerates local user account data on a domain controller.
FILTER_NORMAL_ACCOUNT Enumerates global user account data on a computer.
FILTER_INTERDOMAIN_TRUST_ACCOUNT Enumerates domain trust account data on a domain controller. The data is associated with the accounts of domains trusting the specified domain.
FILTER_WORKSTATION_TRUST_ACCOUNT Enumerates workstation or member server account data on a domain controller.
FILTER_SERVER_TRUST_ACCOUNT 请问大家我该怎么判断。谢谢!!!并且我该怎么获得帐号的密码!!!!
解决方案 »
- glGetIntegerv怎么使用的啊???help me
- dll中无法响应PreTranslateMessage(MSG *pMsg)
- 关于控件SetFont的问题,内存释放!
- 关于列举某个进程的信息的问题,急!
- 不错的电子书下载网址
- MFC做编译器有关的小问题,请高手指教?
- 关于软件定制的问题
- 能不能只改变程序中的窗口标题栏的高度而不影响系统(即其它程序窗口的标题栏高度不受影响)?(很急!)
- 加分~~~~加分?
- who can tell me the difference between "static_cast" and "dynamic_cast"
- 求一坐标映射算法
- VC 如何在网页里添加隐藏信息
LPUSER_INFO_0 pBuf = NULL;
LPUSER_INFO_0 pTmpBuf;
DWORD dwLevel = 0;
DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;
DWORD dwEntriesRead = 0;
DWORD dwTotalEntries = 0;
DWORD dwResumeHandle = 0;
DWORD i;
DWORD dwTotalCount = 0;
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL; // The server is not the default local computer.
//
pszServerName = _T("\\\\HOLD"); // <<<<<<<<<<<<<<<<<<<< 域名, 必须以\\开头
wprintf(L"\nUser account on %s: \n", pszServerName);
//
// Call the NetUserEnum function, specifying level 0;
// enumerate global user account types only.
//
do // begin do
{
nStatus = NetUserEnum(pszServerName,
dwLevel,
FILTER_NORMAL_ACCOUNT, // global users
(LPBYTE*)&pBuf,
dwPrefMaxLen,
&dwEntriesRead,
&dwTotalEntries,
&dwResumeHandle);
//
// If the call succeeds,
//
if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
{
if ((pTmpBuf = pBuf) != NULL)
{
//
// Loop through the entries.
//
for (i = 0; (i < dwEntriesRead); i++)
{
assert(pTmpBuf != NULL); if (pTmpBuf == NULL)
{
fprintf(stderr, "An access violation has occurred\n");
break;
}
//
// Print the name of the user account.
//
wprintf(L"\t-- %s\n", pTmpBuf->usri0_name);
pTmpBuf++;
dwTotalCount++;
}
}
}
//
// Otherwise, print the system error.
//
else
fprintf(stderr, "A system error has occurred: %d\n", nStatus);
//
// Free the allocated buffer.
//
if (pBuf != NULL)
{
NetApiBufferFree(pBuf);
pBuf = NULL;
}
}
// Continue to call NetUserEnum while
// there are more entries.
//
while (nStatus == ERROR_MORE_DATA); // end do
//
// Check again for allocated memory.
//
if (pBuf != NULL)
NetApiBufferFree(pBuf);
你这个参数就是这样设置的?
dwLevel,
FILTER_NORMAL_ACCOUNT, // global users
(LPBYTE*)&pBuf,
dwPrefMaxLen,
&dwEntriesRead,
&dwTotalEntries,
&dwResumeHandle);
你这样改一下试试