56 WCHAR wszUserName[256];
59 LPLOCALGROUP_USERS_INFO_0 pBuf =
nullptr;
60 LPLOCALGROUP_USERS_INFO_0 pTmpBuf;
62 DWORD dwFlags = LG_INCLUDE_INDIRECT;
63 DWORD dwPrefMaxLen = -1;
64 DWORD dwEntriesRead = 0;
65 DWORD dwTotalEntries = 0;
66 NET_API_STATUS nStatus;
68 DWORD dwTotalCount = 0;
72 MultiByteToWideChar(CP_ACP, 0, UserName,
73 strlen(UserName) + 1, wszUserName,
74 sizeof(wszUserName) /
sizeof(wszUserName[0]));
75 MultiByteToWideChar(CP_ACP, 0, Group,
76 strlen(Group) + 1, wszGroup,
sizeof(wszGroup) /
sizeof(wszGroup[0]));
86 nStatus = NetUserGetLocalGroups(
nullptr,
90 (LPBYTE *) & pBuf, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries);
94 if (nStatus == NERR_Success) {
95 if ((pTmpBuf = pBuf) !=
NULL) {
96 for (i = 0; i < dwEntriesRead; ++i) {
97 if (pTmpBuf ==
NULL) {
101 if (wcscmp(pTmpBuf->lgrui0_name, wszGroup) == 0) {
115 NetApiBufferFree(pBuf);
125 char *domain_qualify =
nullptr;
126 char DomainUser[256];
130 xstrncpy(NTDomain, UserName,
sizeof(NTDomain));
136 if (domain_qualify ==
NULL) {
137 strcpy(User, NTDomain);
140 strcpy(User, domain_qualify + 1);
141 domain_qualify[0] =
'\0';
151 strcpy(DomainUser, User);
153 strcpy(DomainUser, NTDomain);
154 strcat(DomainUser,
"\\");
155 strcat(DomainUser, User);
int Valid_User(char *USERNAME, char *PASSWORD, const char *SERVER, char *, const char *DOMAIN)
const char NTV_LOGON_ERROR_MSG[]
const char NTV_GROUP_ERROR_MSG[]
const char NTV_VALID_DOMAIN_SEPARATOR[]
const char NTV_SERVER_ERROR_MSG[]
static int Valid_Group(char *UserName, char *Group)
char Default_NTDomain[DNLEN+1]
#define NTV_DEFAULT_DOMAIN
void debug(const char *format,...)
BOOL WINAPI SSP_LogonUser(PTSTR szUser, PTSTR szPassword, PTSTR szDomain)
char * xstrncpy(char *dst, const char *src, size_t n)