• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NetApiBufferFree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NetApiBufferFree函数的典型用法代码示例。如果您正苦于以下问题:C++ NetApiBufferFree函数的具体用法?C++ NetApiBufferFree怎么用?C++ NetApiBufferFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NetApiBufferFree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NetGetDCName

/*!
 @brief ユーザフルネームの取得 (Unicode)
*/
BOOL CUserInfoDlg::GetFullNameW(wchar_t *UserName, wchar_t *, wchar_t *dest)
{
	LPBYTE ComputerName = 0;
  
	struct _USER_INFO_2 *ui;          // User structure

	BOOL bFoundDC = TRUE;
	DWORD nRet = NetGetDCName(NULL, NULL, &ComputerName );
	// Get the computer name of a DC for the specified domain.
	if (nRet != NERR_Success) {
		printf("Error getting user information.\n" );
		bFoundDC = FALSE;
	}

	// Look up the user on the DC.
	nRet = NetUserGetInfo((LPWSTR) ComputerName,
		(LPWSTR) UserName, 2, (LPBYTE *) &ui);
	if (nRet != NERR_Success) {

		if (bFoundDC == TRUE) {
			NetApiBufferFree(ComputerName);
		}
		printf("Error getting user information.\n" );
		return(FALSE );
	}
	if (bFoundDC == TRUE) {
		NetApiBufferFree(ComputerName);
	}

	wcsncpy_s(dest, 256, ui->usri2_full_name, _TRUNCATE);
	
	return(TRUE );
}
开发者ID:todesmarz,项目名称:InspectUsefulTools,代码行数:36,代码来源:UserInfoDlg.cpp


示例2: NetUserGetProfilePath

NET_API_STATUS 
NetUserGetProfilePath( LPCWSTR Domain, LPCWSTR UserName, char * profilePath, 
                       DWORD profilePathLen )
{
    NET_API_STATUS code;
    LPWSTR ServerName = NULL;
    LPUSER_INFO_3 p3 = NULL;

    NetGetAnyDCName(NULL, Domain, (LPBYTE *)&ServerName);
    /* if NetGetAnyDCName fails, ServerName == NULL
     * NetUserGetInfo will obtain local user information 
     */
    code = NetUserGetInfo(ServerName, UserName, 3, (LPBYTE *)&p3);
    if (code == NERR_Success)
    {
        code = NERR_UserNotFound;
        if (p3) {
            if (p3->usri3_profile) {
                DWORD len = lstrlenW(p3->usri3_profile);
                if (len > 0) {
                    /* Convert From Unicode to ANSI (UTF-8 for future) */
                    len = len < profilePathLen ? len : profilePathLen - 1;
                    WideCharToMultiByte(CP_UTF8, 0, p3->usri3_profile, len, profilePath, len, NULL, NULL);
                    profilePath[len] = '\0';
                    code = NERR_Success;
                }
            }
            NetApiBufferFree(p3);
        }
    }
    if (ServerName) 
        NetApiBufferFree(ServerName);
    return code;
}
开发者ID:stevenjenkins,项目名称:openafs,代码行数:34,代码来源:afslogon.c


示例3: InitName

/*	InitName - initialize name translation
 *
 *	pszServer   machine name for symref daemon
 */
void InitName (IN PSZ pszServer)
{
    PSERVICE_INFO_0 psi;
    PWKSTA_INFO_100 pwi;

    //
    //	Set up daemon server name
    //

    strcpy (szServer, pszServer);

    //
    //	See if our own server is started
    //

    if (NetServiceGetInfo (NULL, "SERVER", 0, (LPBYTE *) &psi) == 0) {
	fServerStarted = TRUE;
	NetApiBufferFree (psi);
	}


    //
    //	Set up workstation name
    //

    NetWkstaGetInfo (NULL, 100, (LPBYTE *) &pwi);

    strcpy (szWksta, pwi->wki100_computername);

    NetApiBufferFree (pwi);
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:35,代码来源:symref.c


示例4: EnumerateUsers

static
NET_API_STATUS
EnumerateUsers(VOID)
{
    PUSER_INFO_0 pBuffer = NULL;
    PSERVER_INFO_100 pServer = NULL;
    DWORD dwRead = 0, dwTotal = 0;
    DWORD i;
    DWORD_PTR ResumeHandle = 0;
    NET_API_STATUS Status;

    Status = NetServerGetInfo(NULL,
                              100,
                              (LPBYTE*)&pServer);
    if (Status != NERR_Success)
        return Status;

    ConPuts(StdOut, L"\n");
    ConResPrintf(StdOut, IDS_USER_ACCOUNTS, pServer->sv100_name);
    ConPuts(StdOut, L"\n\n");
    PrintPadding(L'-', 79);
    ConPuts(StdOut, L"\n");

    NetApiBufferFree(pServer);

    do
    {
        Status = NetUserEnum(NULL,
                             0,
                             0,
                             (LPBYTE*)&pBuffer,
                             MAX_PREFERRED_LENGTH,
                             &dwRead,
                             &dwTotal,
                             &ResumeHandle);
        if ((Status != NERR_Success) && (Status != ERROR_MORE_DATA))
            return Status;

        qsort(pBuffer,
              dwRead,
              sizeof(PUSER_INFO_0),
              CompareInfo);

        for (i = 0; i < dwRead; i++)
        {
            if (pBuffer[i].usri0_name)
                ConPrintf(StdOut, L"%s\n", pBuffer[i].usri0_name);
        }

        NetApiBufferFree(pBuffer);
        pBuffer = NULL;
    }
    while (Status == ERROR_MORE_DATA);

    return NERR_Success;
}
开发者ID:reactos,项目名称:reactos,代码行数:56,代码来源:cmdUser.c


示例5: ErrorHandler

bool CWfpNET::PasswordPolicy_get(void)
{
	USER_MODALS_INFO_0 *pBuf0 = NULL;
	USER_MODALS_INFO_3 *pBuf3 = NULL;
	NET_API_STATUS nStatus = NULL;
	CString tmp;

	if((nStatus = NetUserModalsGet(node.szComputerW, 0,(LPBYTE *)&pBuf0)) != NERR_Success)
		ErrorHandler("NetUserModalsGet", nStatus);
	else
	{
		//m_output.operator +=(_T("Password Policy:\n"));
		if (pBuf0 != NULL)
		{
			tmp.Format("\tMinimum password length:  %d\n", pBuf0->usrmod0_min_passwd_len);
			Users.Add(tmp);
			if(pBuf0->usrmod0_max_passwd_age == TIMEQ_FOREVER)
				tmp.Format("\tMaximum password age: Forever\n");
			else
				tmp.Format("\tMaximum password age : %d days\n", pBuf0->usrmod0_max_passwd_age/86400);
			Users.Add(tmp);
			tmp.Format("\tMinimum password age : %d days\n", pBuf0->usrmod0_min_passwd_age/86400);
			Users.Add(tmp);
			if(pBuf0->usrmod0_force_logoff == TIMEQ_FOREVER)
				tmp.Format("\tForced log off time : Never\n");
			else
				tmp.Format("\tForced log off time :  %d seconds\n", pBuf0->usrmod0_force_logoff);
			Users.Add(tmp);
			tmp.Format("\tPassword history length:  %d\n", pBuf0->usrmod0_password_hist_len);
			Users.Add(tmp);
      }
	}
 
	if (pBuf0 != NULL)
		NetApiBufferFree(pBuf0);
	if((nStatus = NetUserModalsGet(node.szComputerW, 3,(LPBYTE *)&pBuf3)) != NERR_Success)
		ErrorHandler("NetUserModalsGet", nStatus);
	else
	{
		if(pBuf3 != NULL)
		{
			tmp.Format("\tAttempts before Lockout: %d\n",pBuf3->usrmod3_lockout_threshold);
			Users.Add(tmp);
			tmp.Format("\tTime between two failed login attempts: %d seconds\n",pBuf3->usrmod3_lockout_duration);
			Users.Add(tmp);
			tmp.Format("\tLockout Duration: %d minutes\n",pBuf3->usrmod3_lockout_duration/60);
			Users.Add(tmp);
		}
	}

	if (pBuf3 != NULL)
		NetApiBufferFree(pBuf3);

	return true;
}
开发者ID:kkuehl,项目名称:winfingerprint,代码行数:55,代码来源:WfpNET.cpp


示例6: MultiByteToWideChar

/*!
 @brief ユーザグループの取得 (MBCS)
*/
BOOL CUserInfoDlg::GetGroupNameA(char *UserName, char *dest)
{
	WCHAR  wszUserName[256];           // Unicode user name
	LPBYTE ComputerName = 0;
  
	// Convert ASCII user name and domain to Unicode.
	MultiByteToWideChar(CP_ACP, 0, UserName, strlen(UserName) + 1, wszUserName, sizeof(wszUserName) / sizeof(WCHAR));

	// Get the computer name of a DC for the specified domain.
	BOOL bFoundDC = TRUE;
	DWORD nRet = NetGetDCName(NULL, NULL, &ComputerName );
	if (nRet != NERR_Success) {
		printf("Error getting group information.\n" );
		bFoundDC = FALSE;
	}

	LPLOCALGROUP_USERS_INFO_0 pBuf = NULL;
	DWORD dwEntriesRead = 0;
	DWORD dwTotalEntries = 0;	// Look up the user on the DC.
	nRet = NetUserGetLocalGroups((LPWSTR) ComputerName,
		(LPWSTR) wszUserName, 0, LG_INCLUDE_INDIRECT, (LPBYTE *) &pBuf, MAX_PREFERRED_LENGTH, &dwEntriesRead, &dwTotalEntries);
	if (nRet != NERR_Success) {
		if (bFoundDC == TRUE) {
			NetApiBufferFree(ComputerName);
		}
		printf("Error getting group information.\n" );
		return(FALSE );
	}
	if (bFoundDC == TRUE) {
		NetApiBufferFree(ComputerName);
	}

	LPLOCALGROUP_USERS_INFO_0 pTmpBuf = pBuf;
	for (unsigned int i = 0; i < dwEntriesRead; i++) {
		if (pTmpBuf == NULL) {
		   fprintf(stderr, "An access violation has occurred\n");
		   break;
		}
		strcat_s(dest, (GNLEN + 1) * 5, ",");

		char szGroupName[GNLEN + 1];
		// Convert the Unicode full name to ASCII.
		WideCharToMultiByte(CP_ACP, 0, pTmpBuf->lgrui0_name, -1, szGroupName, GNLEN, NULL, NULL );

		strcat_s(dest, (GNLEN + 1) * 5, szGroupName);
		pTmpBuf++;
	}
	NetApiBufferFree(pBuf);

	
	return (TRUE);
}
开发者ID:todesmarz,项目名称:InspectUsefulTools,代码行数:55,代码来源:UserInfoDlg.cpp


示例7: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
nsUserInfo::GetFullname(PRUnichar **aFullname)
{
  NS_ENSURE_ARG_POINTER(aFullname);
  *aFullname = nullptr;

  PRUnichar fullName[512];
  DWORD size = mozilla::ArrayLength(fullName);

  if (GetUserNameExW(NameDisplay, fullName, &size)) {
    *aFullname = ToNewUnicode(nsDependentString(fullName));
  } else {
    DWORD getUsernameError = GetLastError();

    // Try to use the net APIs regardless of the error because it may be
    // able to obtain the information.
    PRUnichar username[UNLEN + 1];
    size = mozilla::ArrayLength(username);
    if (!GetUserNameW(username, &size)) {
      // ERROR_NONE_MAPPED means the user info is not filled out on this computer
      return getUsernameError == ERROR_NONE_MAPPED ?
             NS_ERROR_NOT_AVAILABLE : NS_ERROR_FAILURE;
    }

    const DWORD level = 2;
    LPBYTE info;
    // If the NetUserGetInfo function has no full name info it will return
    // success with an empty string.
    NET_API_STATUS status = NetUserGetInfo(nullptr, username, level, &info);
    if (status != NERR_Success) {
      // We have an error with NetUserGetInfo but we know the info is not
      // filled in because GetUserNameExW returned ERROR_NONE_MAPPED.
      return getUsernameError == ERROR_NONE_MAPPED ?
             NS_ERROR_NOT_AVAILABLE : NS_ERROR_FAILURE;
    }

    nsDependentString fullName =
      nsDependentString(reinterpret_cast<USER_INFO_2 *>(info)->usri2_full_name);

    // NetUserGetInfo returns an empty string if the full name is not filled out
    if (fullName.Length() == 0) {
      NetApiBufferFree(info);
      return NS_ERROR_NOT_AVAILABLE;
    }

    *aFullname = ToNewUnicode(fullName);
    NetApiBufferFree(info);
  }

  return (*aFullname) ? NS_OK : NS_ERROR_FAILURE;
}
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:51,代码来源:nsUserInfoWin.cpp


示例8: find_rts

USHORT find_rts(TCHAR FAR * buf, USHORT buflen)

{
    USHORT                       err;                   /* API return status */
    struct server_info_0 FAR * si;
    USHORT2ULONG               eread;

    UNREFERENCED_PARAMETER(buflen) ;

    /* find a reliable time server */
    err = MNetServerEnum(NULL,0,(LPBYTE*)&si, &eread,
             (ULONG) SV_TYPE_TIME_SOURCE, NULL);

    /* there are none -- bag it */
    if (err != NERR_Success || eread == 0)
        return APE_TIME_RtsNotFound;

    /* copy over name into buffer */
    _tcscpy(buf,TEXT("\\\\"));
    _tcscat(buf,si->sv0_name);

    NetApiBufferFree((TCHAR FAR *) si);

    return 0;

}
开发者ID:mingpen,项目名称:OpenNT,代码行数:26,代码来源:time.c


示例9: GetLoggedInUsers

    virtual void GetLoggedInUsers(const std::wstring& ComputerName, OBJ_LIST& loggedInUsers, OBJ_LIST& domains)
	{
		LPWKSTA_USER_INFO_1 pBuf = NULL;
		LPWKSTA_USER_INFO_1 pTmpBuf;
		DWORD dwLevel = 1;
		DWORD dwPrefMaxLen = -1;
		DWORD dwEntriesRead = 0;
		DWORD dwTotalEntries = 0;
		DWORD dwResumeHandle = 0;
		NET_API_STATUS nStatus;

		do
		{
			nStatus = NetWkstaUserEnum((wchar_t*)ComputerName.c_str(), dwLevel, (LPBYTE*)&pBuf, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries, &dwResumeHandle);
			if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
			{
				pTmpBuf = pBuf;
				
				// Loop through the entries.
				for (DWORD i = 0; (i < dwEntriesRead); i++)
				{
					loggedInUsers.push_back(pTmpBuf->wkui1_username);
					domains.push_back(pTmpBuf->wkui1_logon_domain);

					pTmpBuf++;
				}

				NetApiBufferFree(pBuf);
			}
			else
				KLSTD_THROW_LASTERROR_CODE(nStatus);
		}
		while (nStatus == ERROR_MORE_DATA);
	}
开发者ID:hackshields,项目名称:antivirus,代码行数:34,代码来源:WindowsNetInfo.cpp


示例10: netgetjoinableous

JSBool netgetjoinableous(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
	LPWSTR domain, account, password;
	JS_BeginRequest(cx);
	if(!JS_ConvertArguments(cx, argc, argv, "W W W", &domain, &account, &password))
	{
		JS_ReportError(cx, "Error parsing arguments in NetGetJoinableOUs");
		JS_EndRequest(cx);
	}

	JS_YieldRequest(cx);
	DWORD ouCount = 0;
	LPWSTR * ous = NULL;
	DWORD status = NetGetJoinableOUs(NULL, domain, (JSVAL_IS_NULL(argv[1]) ? NULL : account), (JSVAL_IS_NULL(argv[2]) ? NULL : password), &ouCount, &ous);
	if(status != NERR_Success)
	{
		JS_NewNumberValue(cx, status, rval);
		JS_EndRequest(cx);
		return JS_TRUE;
	}

	JSObject * arrayObj = JS_NewArrayObject(cx, 0, NULL);
	*rval = OBJECT_TO_JSVAL(arrayObj);
	for(DWORD i = 0; i < ouCount; i++)
	{
		JSString * curOu = JS_NewUCStringCopyZ(cx, (jschar*)ous[i]);
		JS_DefineElement(cx, arrayObj, i, STRING_TO_JSVAL(curOu), NULL, NULL, 0);
	}
	NetApiBufferFree(ous);
	JS_EndRequest(cx);
	return JS_TRUE;
}
开发者ID:z4y4,项目名称:njord,代码行数:32,代码来源:js_xdeploy.cpp


示例11: qDebug

QString SystemInfo::getJoinInformation(bool *isJoinedToDomain, const QString &serverName){
    qDebug()<<"--SystemInfo::getJoinInformation()";


    QString workgroupName = "";
    NET_API_STATUS err;
    LPWSTR lpNameBuffer = new wchar_t[256];
    NETSETUP_JOIN_STATUS bufferType;
    LPCWSTR lpServer = NULL; // The server is the default local computer.
    if(!serverName.trimmed().isEmpty()){
        lpServer = serverName.toStdWString().c_str();
    }

    err = NetGetJoinInformation(lpServer, &lpNameBuffer, &bufferType);
    if(err == NERR_Success){
        workgroupName = QString::fromWCharArray(lpNameBuffer);
    }else{
        QMessageBox::critical(this, tr("Error"), tr("Can not get join status information!"));
    }

    NetApiBufferFree(lpNameBuffer);
    if(isJoinedToDomain){
        *isJoinedToDomain = (bufferType == NetSetupDomainName)?true:false;
    }

    return workgroupName;

}
开发者ID:RallyWRT,项目名称:qtapplications,代码行数:28,代码来源:systeminfo.cpp


示例12: get_user_local_groups

static int get_user_local_groups(WCHAR *user, struct oscap_list *list)
{
	NET_API_STATUS status;

	LOCALGROUP_USERS_INFO_0 *buffer = NULL;
	DWORD preffered_max_len = MAX_PREFERRED_LENGTH;
	DWORD entries_read = 0;
	DWORD total_entries = 0;
	/*
	 * LG_INCLUDE_INDIRECT means the function also returns the names of
	 * the local groups in which the user is indirectly a member (that is,
	 * the user has membership in a global group that is itself a member
	 * of one or more local groups).
	 */
	status = NetUserGetLocalGroups(NULL, user, 0, LG_INCLUDE_INDIRECT, (LPBYTE *)&buffer, preffered_max_len, &entries_read, &total_entries);
	if (status != NERR_Success) {
		dD("NetUserGetLocalGroups failed: %d", status);
		return 1;
	}
	for (DWORD i = 0; i < entries_read; i++) {
		WCHAR *group_name = buffer[i].lgrui0_name;
		oscap_list_add(list, wcsdup(group_name));
	}
	NetApiBufferFree(buffer);
	return 0;
}
开发者ID:jan-cerny,项目名称:openscap,代码行数:26,代码来源:accesstoken_probe.c


示例13: MNetAccessGetInfo

USHORT MNetAccessGetInfo (
    const CHAR FAR * pszServer,
    CHAR       FAR * pszResource,
    SHORT	     Level,
    CHAR     FAR **  ppBuffer ) {

    USHORT	     usReturnCode,
		     cbTotalAvail;

    // get a small buffer
    *ppBuffer = MGetBuffer(LITTLE_BUFFER_SIZE);
    if (*ppBuffer == NULL)
    {
	return(ERROR_NOT_ENOUGH_MEMORY);
    }


    usReturnCode = NetAccessGetInfo(pszServer, pszResource, Level, *ppBuffer,
	    LITTLE_BUFFER_SIZE, & cbTotalAvail);

    // If we're returning an error that's not moredata, free the buffer first

    if (usReturnCode && usReturnCode != ERROR_MORE_DATA &&
	usReturnCode != NERR_BufTooSmall) {
	    NetApiBufferFree(*ppBuffer);
    }

    return (usReturnCode);

}
开发者ID:mingpen,项目名称:OpenNT,代码行数:30,代码来源:paccess.c


示例14: pthread_mutex_lock

/**
 * Lookup a user based on a user ID. Calling functions should
 * free the result with authz_free_buffer().
 *
 * @param userid    user name to lookup
 *
 * @return a user info structure or NULL on error
 */
userinfo_t *authz_lookup_user(const char *userid)
{
    struct USER_INFO_23 *buf = NULL;
    userinfo_t *result = NULL;
    NET_API_STATUS status;

    pthread_mutex_lock(&_ctxmtx);

    if (!userid || !_netapictx) {
        pthread_mutex_unlock(&_ctxmtx);
        return NULL;
    }

    status = NetUserGetInfo(_host, userid, 23, (uint8_t **)&buf);
    if (status != NET_API_STATUS_SUCCESS) {
        log_warn("NetApi lookup for user %s failed (%d)", userid, status);
        pthread_mutex_unlock(&_ctxmtx);
        return NULL;
    }

    result = (userinfo_t *)malloc(sizeof(userinfo_t));
    bzero(result, sizeof(userinfo_t));

    result->logon_name = strdup(userid);
    result->display_name = strdup(buf->usri23_full_name);

    ConvertSidToStringSid(buf->usri23_user_sid, &result->sid);

    NetApiBufferFree(buf);
    pthread_mutex_unlock(&_ctxmtx);

    log_debug("found user %s with SID %s", userid, result->sid);
    return result;
}
开发者ID:rcarz,项目名称:bonsai,代码行数:42,代码来源:authz.c


示例15: NetUserGetLocalGroups

std::vector<Group*> UserUtilities::GetUserGroupList(CString strUserName)
{
	std::vector<Group*> lstUserGroups;
	LOCALGROUP_USERS_INFO_0 *grpInfo = NULL;
	LOCALGROUP_USERS_INFO_0 *tempgrpInfo = NULL;
	DWORD entriesRead = 0;
	DWORD totalEntries = 0;
	int res = NetUserGetLocalGroups(NULL, strUserName, 0, 0, (LPBYTE*)&grpInfo, MAX_PREFERRED_LENGTH, &entriesRead, &totalEntries);
	if(entriesRead > 0)
	{
		tempgrpInfo = grpInfo;
		for(int i = 0;i < entriesRead;i++)
		{
			Group* grp = new Group();
			grp->m_StrGroupName = tempgrpInfo->lgrui0_name;
			lstUserGroups.push_back(grp);
			
			tempgrpInfo++;
		}
	}

	if(grpInfo)
	{
		NetApiBufferFree(grpInfo);
		grpInfo = NULL;
	}

	return lstUserGroups;
}
开发者ID:hksonngan,项目名称:mytesgnikrow,代码行数:29,代码来源:UserUtils.cpp


示例16: NetWkstaUserGetInfo

void SystemUserMappingWindows::GetUserCredentialsForCurrentUser(
    xtreemfs::pbrpc::UserCredentials* user_credentials) {
  LPWKSTA_USER_INFO_1 user_info = NULL;
  NET_API_STATUS result = NetWkstaUserGetInfo(
      NULL,
      1,
      reinterpret_cast<LPBYTE*>(&user_info));
  if (result == NERR_Success) {
    if (user_info != NULL) {
      string username = ConvertWindowsToUTF8(user_info->wkui1_username);
      string groupname = ConvertWindowsToUTF8(user_info->wkui1_logon_domain);
      NetApiBufferFree(user_info);

      if (additional_user_mapping_.get()) {
        string local_username(username);
        string local_groupname(groupname);
        additional_user_mapping_->LocalToGlobalUsername(local_username,
                                                        &username);
        additional_user_mapping_->LocalToGlobalGroupname(local_groupname,
                                                         &groupname);
      }

      user_credentials->set_username(username);
      user_credentials->add_groups(groupname);
    }
  } else {
     Logging::log->getLog(LEVEL_ERROR) <<
       "Failed to retrieve the current username and domain name, error"
       " code: " << result << endl;
  }
}
开发者ID:2510,项目名称:xtreemfs,代码行数:31,代码来源:system_user_mapping_windows.cpp


示例17: initializeAfsAdminGroup

UINT initializeAfsAdminGroup(void) {
    PSID psidAdmin = NULL;
    SID_IDENTIFIER_AUTHORITY auth = SECURITY_NT_AUTHORITY;
    NET_API_STATUS status;
    LOCALGROUP_MEMBERS_INFO_0 *gmAdmins = NULL;
    DWORD dwNEntries, dwTEntries;
    WCHAR AdminGroupName[UNLEN+1];
    DWORD cchName = UNLEN;

    if (!LookupAliasFromRid( NULL, DOMAIN_ALIAS_RID_ADMINS, AdminGroupName, &cchName )) 
    {
        /* if we fail, we will try the English string "Administrators" */
        wcsncpy(AdminGroupName, L"Administrators", UNLEN+1);
        AdminGroupName[UNLEN] = 0;
    }

    status = NetLocalGroupGetMembers(NULL, AdminGroupName, 0, (LPBYTE *) &gmAdmins, MAX_PREFERRED_LENGTH, &dwNEntries, &dwTEntries, NULL);
    if(status)
        return status;

    status = NetLocalGroupAddMembers(NULL, AFSCLIENT_ADMIN_GROUPNAMEW, 0, (LPBYTE) gmAdmins, dwNEntries);

    NetApiBufferFree( gmAdmins );

    return status;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:26,代码来源:afscustom.cpp


示例18: NetApiBufferFree

        ~Private()
        {
            if (userInfo)
                NetApiBufferFree(userInfo);

            delete[] sid;
        }
开发者ID:crayonink,项目名称:calligra-2,代码行数:7,代码来源:kuser_win.cpp


示例19: DistDomainNameToNT4Name

	virtual std::wstring DistDomainNameToNT4Name(const std::wstring& domain)
	{
		KLSTD_CHKINPTR(m_fnDsGetDcName);

		std::wstring wstrDNSDomain(domain.begin() + 3, domain.end());

		size_t nPos = wstrDNSDomain.find(L",DC=");
		while(nPos != std::wstring::npos)
		{
			wstrDNSDomain.replace(nPos, 4, L".");
			nPos = wstrDNSDomain.find(L",DC=", nPos + 1);
		}

		PDOMAIN_CONTROLLER_INFO pDomainControllerInfo = NULL;
		DWORD dwResult = m_fnDsGetDcName(NULL, KLSTD_W2T2(wstrDNSDomain.c_str()), NULL, NULL, 
										 DS_DIRECTORY_SERVICE_REQUIRED | DS_IS_DNS_NAME | DS_RETURN_FLAT_NAME,
										 &pDomainControllerInfo);
		if (dwResult != NO_ERROR)
		{
			KLSTD_TRACE3(1, L"DistDomainNameToNT4Name(DN:'%ls', DNS:'%ls')::DsGetDcName - Error '%u'\n", domain.c_str(), wstrDNSDomain.c_str(), dwResult);
			KLSTD_THROW(KLSTD::STDE_FAULT);
		}
		
		std::wstring rc = KLSTD_T2W2(pDomainControllerInfo->DomainName);
		NetApiBufferFree(pDomainControllerInfo);
		return rc;
	}
开发者ID:hackshields,项目名称:antivirus,代码行数:27,代码来源:WindowsNetInfo.cpp


示例20: UpdateGroupProperties

static VOID
UpdateGroupProperties(HWND hwndDlg)
{
    TCHAR szGroupName[UNLEN];
    INT iItem;
    HWND hwndLV;
    PLOCALGROUP_INFO_1 pGroupInfo = NULL;

    hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
    iItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
    if (iItem == -1)
        return;

    /* Get the group name */
    ListView_GetItemText(hwndLV,
                         iItem, 0,
                         szGroupName,
                         UNLEN);

    NetLocalGroupGetInfo(NULL, szGroupName, 1, (LPBYTE*)&pGroupInfo);

    ListView_SetItemText(hwndLV, iItem, 1,
                         pGroupInfo->lgrpi1_comment);

    NetApiBufferFree(pGroupInfo);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:26,代码来源:groups.c



注:本文中的NetApiBufferFree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NetReceive函数代码示例发布时间:2022-05-30
下一篇:
C++ Need_Float函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap