当前位置: 首页>>代码示例>>C++>>正文


C++ NdisZeroMemory函数代码示例

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


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

示例1: the

/* 
    ==========================================================================
    Description:
        When waiting joining the (I)BSS, beacon received from external
    ==========================================================================
 */
static VOID ApCliPeerProbeRspAtJoinAction(
	IN PRTMP_ADAPTER pAd, 
	IN MLME_QUEUE_ELEM *Elem) 
{
	USHORT LenVIE;
	UCHAR *VarIE = NULL;
	NDIS_802_11_VARIABLE_IEs *pVIE = NULL;
	APCLI_CTRL_MSG_STRUCT ApCliCtrlMsg;
	PAPCLI_STRUCT pApCliEntry = NULL;
#ifdef DOT11_N_SUPPORT
	UCHAR CentralChannel;
#endif /* DOT11_N_SUPPORT */
	USHORT ifIndex = (USHORT)(Elem->Priv);
	ULONG *pCurrState;
	BCN_IE_LIST *ie_list = NULL;

	if (ifIndex >= MAX_APCLI_NUM)
		return;

	/* Init Variable IE structure */
	os_alloc_mem(NULL, (UCHAR **)&VarIE, MAX_VIE_LEN);
	if (VarIE == NULL)
	{
		MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s: Allocate memory fail!!!\n", __FUNCTION__));
		goto LabelErr;
	}
	pVIE = (PNDIS_802_11_VARIABLE_IEs) VarIE;
	pVIE->Length = 0;
	
	os_alloc_mem(NULL, (UCHAR **)&ie_list, sizeof(BCN_IE_LIST));
	if (ie_list == NULL)
	{
		MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("%s: Allocate ie_list fail!!!\n", __FUNCTION__));
		goto LabelErr;
	}
	NdisZeroMemory(ie_list, sizeof(BCN_IE_LIST));

	pCurrState = &pAd->ApCfg.ApCliTab[ifIndex].SyncCurrState;
	if (PeerBeaconAndProbeRspSanity(pAd, 
								Elem->Msg, 
								Elem->MsgLen, 
								Elem->Channel,
								ie_list,
								&LenVIE,
								pVIE,
								TRUE))
	{
		/*
			BEACON from desired BSS/IBSS found. We should be able to decide most
			BSS parameters here.
			Q. But what happen if this JOIN doesn't conclude a successful ASSOCIATEION?
				Do we need to receover back all parameters belonging to previous BSS?
			A. Should be not. There's no back-door recover to previous AP. It still need
				a new JOIN-AUTH-ASSOC sequence.
		*/
		INT ssidEqualFlag = FALSE;
#ifdef WSC_AP_SUPPORT
		INT ssidEmptyFlag = FALSE;
#endif /* WSC_AP_SUPPORT */
		INT bssidEqualFlag = FALSE;
		INT bssidEmptyFlag = FALSE;
		INT matchFlag = FALSE;

		ULONG   Bssidx;

		/* Update ScanTab */
		Bssidx = BssTableSearch(&pAd->ScanTab, ie_list->Bssid, ie_list->Channel);
		if (Bssidx == BSS_NOT_FOUND)
		{
			/* discover new AP of this network, create BSS entry */
			Bssidx = BssTableSetEntry(pAd, &pAd->ScanTab, ie_list, -127, LenVIE, pVIE);
			
			if (Bssidx == BSS_NOT_FOUND) /* return if BSS table full */
			{
				DBGPRINT(RT_DEBUG_ERROR, ("ERROR: Driver ScanTable Full In Apcli ProbeRsp Join\n"));
				goto LabelErr;
			}

			NdisMoveMemory(pAd->ScanTab.BssEntry[Bssidx].PTSF, &Elem->Msg[24], 4);
			NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[0], &Elem->TimeStamp.u.LowPart, 4);
			NdisMoveMemory(&pAd->ScanTab.BssEntry[Bssidx].TTSF[4], &Elem->TimeStamp.u.LowPart, 4);
			pAd->ScanTab.BssEntry[Bssidx].MinSNR = Elem->Signal % 10;
			if (pAd->ScanTab.BssEntry[Bssidx].MinSNR == 0)
				pAd->ScanTab.BssEntry[Bssidx].MinSNR = -5;
			
			NdisMoveMemory(pAd->ScanTab.BssEntry[Bssidx].MacAddr, ie_list->Addr2, MAC_ADDR_LEN);
		}

#if defined(RT_CFG80211_P2P_CONCURRENT_DEVICE) || defined(CFG80211_MULTI_STA)
		CHAR Rssi0 = ConvertToRssi(pAd, &Elem->rssi_info, RSSI_IDX_0);
                CHAR Rssi1 = ConvertToRssi(pAd, &Elem->rssi_info, RSSI_IDX_1);
                CHAR Rssi2 = ConvertToRssi(pAd, &Elem->rssi_info, RSSI_IDX_2);
		LONG RealRssi = (LONG)(RTMPMaxRssi(pAd, Rssi0, Rssi1, Rssi2));
                DBGPRINT(RT_DEBUG_TRACE, ("Info: Update the SSID %s in Kernel Table\n", ie_list->Ssid));
//.........这里部分代码省略.........
开发者ID:AnyoeDove,项目名称:mtk-sources,代码行数:101,代码来源:apcli_sync.c

示例2: block


//.........这里部分代码省略.........
    c = pMD5_CTX->HashValue[2];
    d = pMD5_CTX->HashValue[3];

    /*
     *  Round 1
     *  Let [abcd k s i] denote the operation 
     *  a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s)
     */
    ROUND1(a, b, c, d, X[ 0],  7, 0xd76aa478); /* 1 */   
    ROUND1(d, a, b, c, X[ 1], 12, 0xe8c7b756); /* 2 */
    ROUND1(c, d, a, b, X[ 2], 17, 0x242070db); /* 3 */
    ROUND1(b, c, d, a, X[ 3], 22, 0xc1bdceee); /* 4 */
    ROUND1(a, b, c, d, X[ 4],  7, 0xf57c0faf); /* 5 */    
    ROUND1(d, a, b, c, X[ 5], 12, 0x4787c62a); /* 6 */
    ROUND1(c, d, a, b, X[ 6], 17, 0xa8304613); /* 7 */
    ROUND1(b, c, d, a, X[ 7], 22, 0xfd469501); /* 8 */
    ROUND1(a, b, c, d, X[ 8],  7, 0x698098d8); /* 9 */
    ROUND1(d, a, b, c, X[ 9], 12, 0x8b44f7af); /* 10 */
    ROUND1(c, d, a, b, X[10], 17, 0xffff5bb1); /* 11 */
    ROUND1(b, c, d, a, X[11], 22, 0x895cd7be); /* 12 */
    ROUND1(a, b, c, d, X[12],  7, 0x6b901122); /* 13 */
    ROUND1(d, a, b, c, X[13], 12, 0xfd987193); /* 14 */
    ROUND1(c, d, a, b, X[14], 17, 0xa679438e); /* 15 */
    ROUND1(b, c, d, a, X[15], 22, 0x49b40821); /* 16 */

    /*
     *  Round 2
     *  Let [abcd k s i] denote the operation 
     *  a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s)
     */
    ROUND2(a, b, c, d, X[ 1],  5, 0xf61e2562); /* 17 */
    ROUND2(d, a, b, c, X[ 6],  9, 0xc040b340); /* 18 */
    ROUND2(c, d, a, b, X[11], 14, 0x265e5a51); /* 19 */
    ROUND2(b, c, d, a, X[ 0], 20, 0xe9b6c7aa); /* 20 */
    ROUND2(a, b, c, d, X[ 5],  5, 0xd62f105d); /* 21 */
    ROUND2(d, a, b, c, X[10],  9,  0x2441453); /* 22 */
    ROUND2(c, d, a, b, X[15], 14, 0xd8a1e681); /* 23 */
    ROUND2(b, c, d, a, X[ 4], 20, 0xe7d3fbc8); /* 24 */
    ROUND2(a, b, c, d, X[ 9],  5, 0x21e1cde6); /* 25 */
    ROUND2(d, a, b, c, X[14],  9, 0xc33707d6); /* 26 */
    ROUND2(c, d, a, b, X[ 3], 14, 0xf4d50d87); /* 27 */ 
    ROUND2(b, c, d, a, X[ 8], 20, 0x455a14ed); /* 28 */
    ROUND2(a, b, c, d, X[13],  5, 0xa9e3e905); /* 29 */
    ROUND2(d, a, b, c, X[ 2],  9, 0xfcefa3f8); /* 30 */
    ROUND2(c, d, a, b, X[ 7], 14, 0x676f02d9); /* 31 */
    ROUND2(b, c, d, a, X[12], 20, 0x8d2a4c8a); /* 32 */ 

    /*
     *  Round 3
     *  Let [abcd k s t] denote the operation 
     *  a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s)
     */
    ROUND3(a, b, c, d, X[ 5],  4, 0xfffa3942); /* 33 */
    ROUND3(d, a, b, c, X[ 8], 11, 0x8771f681); /* 34 */
    ROUND3(c, d, a, b, X[11], 16, 0x6d9d6122); /* 35 */
    ROUND3(b, c, d, a, X[14], 23, 0xfde5380c); /* 36 */
    ROUND3(a, b, c, d, X[ 1],  4, 0xa4beea44); /* 37 */
    ROUND3(d, a, b, c, X[ 4], 11, 0x4bdecfa9); /* 38 */
    ROUND3(c, d, a, b, X[ 7], 16, 0xf6bb4b60); /* 39 */
    ROUND3(b, c, d, a, X[10], 23, 0xbebfbc70); /* 40 */
    ROUND3(a, b, c, d, X[13],  4, 0x289b7ec6); /* 41 */
    ROUND3(d, a, b, c, X[ 0], 11, 0xeaa127fa); /* 42 */
    ROUND3(c, d, a, b, X[ 3], 16, 0xd4ef3085); /* 43 */
    ROUND3(b, c, d, a, X[ 6], 23,  0x4881d05); /* 44 */
    ROUND3(a, b, c, d, X[ 9],  4, 0xd9d4d039); /* 45 */
    ROUND3(d, a, b, c, X[12], 11, 0xe6db99e5); /* 46 */
    ROUND3(c, d, a, b, X[15], 16, 0x1fa27cf8); /* 47 */
    ROUND3(b, c, d, a, X[ 2], 23, 0xc4ac5665); /* 48 */

    /*
     *  Round 4
     *  Let [abcd k s t] denote the operation 
     *  a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s)
     */
    ROUND4(a, b, c, d, X[ 0],  6, 0xf4292244); /* 49 */
    ROUND4(d, a, b, c, X[ 7], 10, 0x432aff97); /* 50 */
    ROUND4(c, d, a, b, X[14], 15, 0xab9423a7); /* 51 */
    ROUND4(b, c, d, a, X[ 5], 21, 0xfc93a039); /* 52 */
    ROUND4(a, b, c, d, X[12],  6, 0x655b59c3); /* 53 */
    ROUND4(d, a, b, c, X[ 3], 10, 0x8f0ccc92); /* 54 */
    ROUND4(c, d, a, b, X[10], 15, 0xffeff47d); /* 55 */
    ROUND4(b, c, d, a, X[ 1], 21, 0x85845dd1); /* 56 */
    ROUND4(a, b, c, d, X[ 8],  6, 0x6fa87e4f); /* 57 */
    ROUND4(d, a, b, c, X[15], 10, 0xfe2ce6e0); /* 58 */
    ROUND4(c, d, a, b, X[ 6], 15, 0xa3014314); /* 59 */
    ROUND4(b, c, d, a, X[13], 21, 0x4e0811a1); /* 60 */
    ROUND4(a, b, c, d, X[ 4],  6, 0xf7537e82); /* 61 */
    ROUND4(d, a, b, c, X[11], 10, 0xbd3af235); /* 62 */
    ROUND4(c, d, a, b, X[ 2], 15, 0x2ad7d2bb); /* 63 */
    ROUND4(b, c, d, a, X[ 9], 21, 0xeb86d391); /* 64 */  

    /* Compute the i^th intermediate hash value H^(i) */
    pMD5_CTX->HashValue[0] += a;
    pMD5_CTX->HashValue[1] += b;
    pMD5_CTX->HashValue[2] += c;
    pMD5_CTX->HashValue[3] += d;

    NdisZeroMemory(pMD5_CTX->Block, MD5_BLOCK_SIZE);
    pMD5_CTX->BlockLen = 0;
} /* End of RT_MD5_Hash */
开发者ID:0x000000FF,项目名称:MT7601u,代码行数:101,代码来源:crypt_md5.c

示例3: domain

/*
========================================================================
Routine Description:
	Apply new regulatory rule.

Arguments:
	pAdCB			- WLAN control block pointer
	pWiphy			- Wireless hardware description
	pAlpha2			- Regulation domain (2B)

Return Value:
	NONE

Note:
	Can only be called when interface is up.

	For general mac80211 device, it will be set to new power by Ops->config()
	In rt2x00/, the settings is done in rt2x00lib_config().
========================================================================
*/
VOID CFG80211_RegRuleApply(
	IN VOID						*pAdCB,
	IN VOID						*pWiphy,
	IN UCHAR					*pAlpha2)
{
	PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB;
	VOID *pBand24G, *pBand5G;
	UINT32 IdBand, IdChan, IdPwr;
	UINT32 ChanNum, ChanId, Power, RecId, DfsType;
	BOOLEAN FlgIsRadar;
	ULONG IrqFlags;
#ifdef DFS_SUPPORT	
	RADAR_DETECT_STRUCT	*pRadarDetect;
#endif /* DFS_SUPPORT */


	CFG80211DBG(RT_DEBUG_ERROR, ("crda> CFG80211_RegRuleApply ==>\n"));

	/* init */
	pBand24G = NULL;
	pBand5G = NULL;

	if (pAd == NULL)
		return;

	RTMP_IRQ_LOCK(&pAd->irq_lock, IrqFlags);

	/* zero first */
	NdisZeroMemory(pAd->ChannelList,
					MAX_NUM_OF_CHANNELS * sizeof(CHANNEL_TX_POWER));

	/* 2.4GHZ & 5GHz */
	RecId = 0;
#ifdef DFS_SUPPORT	
	pRadarDetect = &pAd->CommonCfg.RadarDetect;
#endif /* DFS_SUPPORT */

	/* find the DfsType */
	DfsType = CE;

	pBand24G = NULL;
	pBand5G = NULL;

	if (CFG80211OS_BandInfoGet(CFG80211CB, pWiphy, &pBand24G, &pBand5G) == FALSE)
		return;

#ifdef AUTO_CH_SELECT_ENHANCE
#ifdef EXT_BUILD_CHANNEL_LIST
	if ((pAlpha2[0] != '0') && (pAlpha2[1] != '0'))
	{
		UINT32 IdReg;

		if (pBand5G != NULL)
		{
			for(IdReg=0; ; IdReg++)
			{
				if (ChRegion[IdReg].CountReg[0] == 0x00)
					break;
				/* End of if */
	
				if ((pAlpha2[0] == ChRegion[IdReg].CountReg[0]) &&
					(pAlpha2[1] == ChRegion[IdReg].CountReg[1]))
				{
					DfsType = ChRegion[IdReg].DfsType;
	
					CFG80211DBG(RT_DEBUG_ERROR,
								("crda> find region %c%c, DFS Type %d\n",
								pAlpha2[0], pAlpha2[1], DfsType));
					break;
				} /* End of if */
			} /* End of for */
		} /* End of if */
	} /* End of if */
#endif /* EXT_BUILD_CHANNEL_LIST */
#endif /* AUTO_CH_SELECT_ENHANCE */

	for(IdBand=0; IdBand<2; IdBand++)
	{
		if (((IdBand == 0) && (pBand24G == NULL)) ||
			((IdBand == 1) && (pBand5G == NULL)))
//.........这里部分代码省略.........
开发者ID:aircross,项目名称:ray,代码行数:101,代码来源:cfg80211drv.c

示例4: DBGPRINT

static void *usb_rtusb_probe(struct usb_device *dev, UINT interface,
				const struct usb_device_id *id_table)
{	
	PRTMP_ADAPTER       pAd = (PRTMP_ADAPTER)NULL;
	int                 i;
	struct net_device   *netdev;
	int                 res = -ENOMEM;

	DBGPRINT(RT_DEBUG_TRACE, "%s-->\n", __FUNCTION__);

	for (i = 0; i < rtusb_usb_id_len; i++)
	{
		if (dev->descriptor.idVendor == rtusb_usb_id[i].idVendor &&
			dev->descriptor.idProduct == rtusb_usb_id[i].idProduct)
		{
			printk("idVendor = 0x%x, idProduct = 0x%x \n",dev->descriptor.idVendor, dev->descriptor.idProduct);
			break;
		}
	}
	if (i == rtusb_usb_id_len) {
		printk("Device Descriptor not matching\n");
		return NULL;
	}

	netdev = alloc_etherdev(sizeof(PRTMP_ADAPTER));
	if(!netdev)
	{
		printk("alloc_etherdev failed\n");
			
		MOD_DEC_USE_COUNT;
		usb_dec_dev_use(dev);
		return NULL;
	}
	
	netdev->priv = (PVOID)vmalloc(sizeof(RTMP_ADAPTER));
	pAd = netdev->priv;
	
	if(pAd == NULL)
	{
		kfree(pAd->net_dev);
		printk("vmalloc failed\n");
		return NULL;
	}

	NdisZeroMemory(pAd, sizeof(RTMP_ADAPTER));
	pAd->net_dev = netdev;
	netif_stop_queue(netdev);
	pAd->config = dev->config;
	pAd->pUsb_Dev= dev;
	SET_MODULE_OWNER(pAd->net_dev);
	ether_setup(pAd->net_dev);
	
	netdev->priv_flags = INT_MAIN;
	netdev->open = usb_rtusb_open;
	netdev->hard_start_xmit = usb_rtusb_sendpkt;
	netdev->stop = usb_rtusb_close;
	netdev->priv = pAd;
	netdev->get_stats = rt73_get_ether_stats;
#if (WIRELESS_EXT >= 12)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
	netdev->get_wireless_stats = rt73_get_wireless_stats;
#endif
	netdev->wireless_handlers = (struct iw_handler_def *) &rt73_iw_handler_def;
#endif
	netdev->do_ioctl = rt73_ioctl;
	pAd->net_dev->hard_header_len = 14;
	pAd->net_dev->mtu = 1500;
	pAd->net_dev->addr_len = 6;

	pAd->net_dev->weight = 64;

	OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);

	{// find available 
		int 	i=0;
		char	slot_name[IFNAMSIZ];
		struct  net_device	*device;
		struct  usb_interface *ifp= &dev->actconfig->interface[interface];  // get interface from system           
		struct  usb_interface_descriptor *as;
		struct  usb_endpoint_descriptor *ep;             

		for (i = 0; i < 8; i++)
		{
			sprintf(slot_name, "rausb%d", i);
			
			read_lock_bh(&dev_base_lock); // avoid multiple init
//Benson modify -->
    			for (device = dev_base; device != NULL; device = device->next)
//<-- Benson modify
			{
				if (strncmp(device->name, slot_name, 4) == 0)
				{
					break;
				}
			}
			read_unlock_bh(&dev_base_lock);

			if(device == NULL)	break;
		}

//.........这里部分代码省略.........
开发者ID:fgoncalves,项目名称:Ralink-Driver-Hack,代码行数:101,代码来源:rtmp_main.c

示例5: BasePortTranslateTxNBLsToTxPackets

NDIS_STATUS
BasePortTranslateTxNBLsToTxPackets(
    __in  PMP_PORT                Port,
    __in  PNET_BUFFER_LIST        NetBufferLists,
    __out PMP_TX_MSDU  *          PacketList
    )
{
    PMP_TX_MSDU                 outputPacketList = NULL;
    PMP_TX_MSDU                 currentPacket, prevPacket = NULL;
    PMP_TX_MPDU                 currentFragment;
    USHORT                      fragmentIndex = 0;
    PNET_BUFFER_LIST            currentNetBufferList = NetBufferLists, nextNetBufferList;
    PNET_BUFFER                 currentNetBuffer;
    NDIS_STATUS                 ndisStatus = NDIS_STATUS_SUCCESS;
    PDOT11_EXTSTA_SEND_CONTEXT  osSendContext, mySendContext;  // This is same for ExtAP & ExtSTA

    *PacketList = NULL;

    // Convert each NBL and NB to our structure    
    while (currentNetBufferList != NULL)
    {
        nextNetBufferList = NET_BUFFER_LIST_NEXT_NBL(currentNetBufferList);

        // First the MP_TX_MSDU  
        currentPacket = NdisAllocateFromNPagedLookasideList(&(Port->TxPacketLookaside));
        if (currentPacket == NULL)
        {
            MpTrace(COMP_SEND, DBG_SERIOUS, ("Failed to allocate MP_TX_MSDU   for NET_BUFFER_LIST\n"));        
            ndisStatus = NDIS_STATUS_RESOURCES;
            break;
        }
        NdisZeroMemory(currentPacket, sizeof(MP_TX_MSDU  ));
        
        // Populate the TX_PACKET
        MP_TX_MSDU_WRAPPED_NBL(currentPacket) = currentNetBufferList;
        // Save the TX_MSDU in the NET_BUFFER_LIST for debugging purpose
        MP_NBL_WRAPPED_TX_MSDU(currentNetBufferList) = currentPacket;

        osSendContext = MP_GET_SEND_CONTEXT(currentNetBufferList);
        mySendContext = MP_TX_MSDU_SEND_CONTEXT(currentPacket);
        NdisMoveMemory(mySendContext, osSendContext, sizeof(DOT11_EXTSTA_SEND_CONTEXT));
        
        if (outputPacketList == NULL)
        {
            outputPacketList = currentPacket;
        }
        else
        {
            MP_TX_MSDU_NEXT_MSDU(prevPacket) = currentPacket;
        }
        // The Next NBL's PACKET would be added after the current NBL's PACKET
        prevPacket = currentPacket;

        // Now we go through the NBs in this NB
        fragmentIndex = 0;
        for (currentNetBuffer = NET_BUFFER_LIST_FIRST_NB(currentNetBufferList);
             currentNetBuffer != NULL;
             currentNetBuffer = NET_BUFFER_NEXT_NB(currentNetBuffer))
        {
            currentFragment = NdisAllocateFromNPagedLookasideList(&(Port->TxFragmentLookaside));
            if (currentFragment == NULL)
            {
                MpTrace(COMP_SEND, DBG_SERIOUS, ("Failed to allocate MP_TX_MPDU     for NET_BUFFER\n"));        
                ndisStatus = NDIS_STATUS_RESOURCES;
                break;
            }
            NdisZeroMemory(currentFragment, sizeof(MP_TX_MPDU    ));

            // Populate the TX_FRAGMENT
            MP_TX_MPDU_WRAPPED_NB(currentFragment) = currentNetBuffer;
            MP_TX_MPDU_MSDU(currentFragment) = currentPacket;

            // Add it to the fragment list of the packet
            MP_TX_MSDU_MPDU_AT(currentPacket, fragmentIndex) = currentFragment;
            fragmentIndex++;
        }
        MP_TX_MSDU_MPDU_COUNT(currentPacket) = fragmentIndex;        
        
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }
        
        currentNetBufferList = nextNetBufferList;
    }


    if (ndisStatus != NDIS_STATUS_SUCCESS)
    {
        if (outputPacketList != NULL)
        {
            BasePortFreeTranslatedTxPackets(Port, outputPacketList);
            outputPacketList = NULL;
        }
    }

    *PacketList = outputPacketList;

    return ndisStatus;
}
开发者ID:kcrazy,项目名称:winekit,代码行数:100,代码来源:base_port_send.c

示例6: RtmpUSB_FinalWriteTxResource

void RtmpUSB_FinalWriteTxResource(struct rt_rtmp_adapter *pAd,
				  struct rt_tx_blk *pTxBlk,
				  u16 totalMPDUSize, u16 TxIdx)
{
	u8 QueIdx;
	struct rt_ht_tx_context *pHTTXContext;
	u32 fillOffset;
	struct rt_txinfo *pTxInfo;
	struct rt_txwi *pTxWI;
	u32 USBDMApktLen, padding;
	unsigned long IrqFlags;
	u8 *pWirelessPacket;

	QueIdx = pTxBlk->QueIdx;
	pHTTXContext = &pAd->TxContext[QueIdx];

	RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);

	if (pHTTXContext->bCurWriting == TRUE) {
		fillOffset = pHTTXContext->CurWritePosition;
		if (((pHTTXContext->ENextBulkOutPosition ==
		      pHTTXContext->CurWritePosition)
		     || ((pHTTXContext->ENextBulkOutPosition - 8) ==
			 pHTTXContext->CurWritePosition))
		    && (pHTTXContext->bCopySavePad == TRUE))
			pWirelessPacket = (u8 *)(&pHTTXContext->SavedPad[0]);
		else
			pWirelessPacket =
			    (u8 *)(&pHTTXContext->TransferBuffer->field.
				      WirelessPacket[fillOffset]);

		/* */
		/* Update TxInfo->USBDMApktLen , */
		/*              the length = TXWI_SIZE + 802.11_hdr + 802.11_hdr_pad + payload_of_all_batch_frames + Bulk-Out-padding */
		/* */
		pTxInfo = (struct rt_txinfo *)(pWirelessPacket);

		/* Calculate the bulk-out padding */
		USBDMApktLen = pTxBlk->Priv - TXINFO_SIZE;
		padding = (4 - (USBDMApktLen % 4)) & 0x03;	/* round up to 4 byte alignment */
		USBDMApktLen += padding;

		pTxInfo->USBDMATxPktLen = USBDMApktLen;

		/* */
		/* Update TXWI->MPDUtotalByteCount , */
		/*              the length = 802.11 header + payload_of_all_batch_frames */
		pTxWI = (struct rt_txwi *) (pWirelessPacket + TXINFO_SIZE);
		pTxWI->MPDUtotalByteCount = totalMPDUSize;

		/* */
		/* Update the pHTTXContext->CurWritePosition */
		/* */
		pHTTXContext->CurWritePosition += (TXINFO_SIZE + USBDMApktLen);
		if ((pHTTXContext->CurWritePosition + 3906) > MAX_TXBULK_LIMIT) {	/* Add 3906 for prevent the NextBulkOut packet size is a A-RALINK/A-MSDU Frame. */
			pHTTXContext->CurWritePosition = 8;
			pTxInfo->SwUseLastRound = 1;
		}
		pHTTXContext->CurWriteRealPos = pHTTXContext->CurWritePosition;

		/* */
		/*      Zero the last padding. */
		/* */
		pWirelessPacket =
		    (&pHTTXContext->TransferBuffer->field.
		     WirelessPacket[fillOffset + pTxBlk->Priv]);
		NdisZeroMemory(pWirelessPacket, padding + 8);

		/* Finally, set bCurWriting as FALSE */
		pHTTXContext->bCurWriting = FALSE;

	} else {		/* It should not happened now unless we are going to shutdown. */
		DBGPRINT(RT_DEBUG_ERROR,
			 ("FinalWriteTxResource():bCurWriting is FALSE when handle last frames.\n"));
	}

	RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);

}
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:79,代码来源:cmm_data_usb.c

示例7: RtmpUSB_WriteFragTxResource

u16 RtmpUSB_WriteFragTxResource(struct rt_rtmp_adapter *pAd,
				   struct rt_tx_blk *pTxBlk,
				   u8 fragNum, u16 * FreeNumber)
{
	struct rt_ht_tx_context *pHTTXContext;
	u16 hwHdrLen;	/* The hwHdrLen consist of 802.11 header length plus the header padding length. */
	u32 fillOffset;
	struct rt_txinfo *pTxInfo;
	struct rt_txwi *pTxWI;
	u8 *pWirelessPacket = NULL;
	u8 QueIdx;
	int Status;
	unsigned long IrqFlags;
	u32 USBDMApktLen = 0, DMAHdrLen, padding;
	BOOLEAN TxQLastRound = FALSE;

	/* */
	/* get Tx Ring Resource & Dma Buffer address */
	/* */
	QueIdx = pTxBlk->QueIdx;
	pHTTXContext = &pAd->TxContext[QueIdx];

	RTMP_IRQ_LOCK(&pAd->TxContextQueueLock[QueIdx], IrqFlags);

	pHTTXContext = &pAd->TxContext[QueIdx];
	fillOffset = pHTTXContext->CurWritePosition;

	if (fragNum == 0) {
		/* Check if we have enough space for this bulk-out batch. */
		Status = RtmpUSBCanDoWrite(pAd, QueIdx, pHTTXContext);
		if (Status == NDIS_STATUS_SUCCESS) {
			pHTTXContext->bCurWriting = TRUE;

			/* Reserve space for 8 bytes padding. */
			if ((pHTTXContext->ENextBulkOutPosition ==
			     pHTTXContext->CurWritePosition)) {
				pHTTXContext->ENextBulkOutPosition += 8;
				pHTTXContext->CurWritePosition += 8;
				fillOffset += 8;
			}
			pTxBlk->Priv = 0;
			pHTTXContext->CurWriteRealPos =
			    pHTTXContext->CurWritePosition;
		} else {
			RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx],
					IrqFlags);

			RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket,
					    NDIS_STATUS_FAILURE);
			return (Status);
		}
	} else {
		/* For sub-sequent frames of this bulk-out batch. Just copy it to our bulk-out buffer. */
		Status =
		    ((pHTTXContext->bCurWriting ==
		      TRUE) ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE);
		if (Status == NDIS_STATUS_SUCCESS) {
			fillOffset += pTxBlk->Priv;
		} else {
			RTMP_IRQ_UNLOCK(&pAd->TxContextQueueLock[QueIdx],
					IrqFlags);

			RELEASE_NDIS_PACKET(pAd, pTxBlk->pPacket,
					    NDIS_STATUS_FAILURE);
			return (Status);
		}
	}

	NdisZeroMemory((u8 *)(&pTxBlk->HeaderBuf[0]), TXINFO_SIZE);
	pTxInfo = (struct rt_txinfo *)(&pTxBlk->HeaderBuf[0]);
	pTxWI = (struct rt_txwi *) (&pTxBlk->HeaderBuf[TXINFO_SIZE]);

	pWirelessPacket =
	    &pHTTXContext->TransferBuffer->field.WirelessPacket[fillOffset];

	/* copy TXWI + WLAN Header + LLC into DMA Header Buffer */
	/*hwHdrLen = ROUND_UP(pTxBlk->MpduHeaderLen, 4); */
	hwHdrLen = pTxBlk->MpduHeaderLen + pTxBlk->HdrPadLen;

	/* Build our URB for USBD */
	DMAHdrLen = TXWI_SIZE + hwHdrLen;
	USBDMApktLen = DMAHdrLen + pTxBlk->SrcBufLen;
	padding = (4 - (USBDMApktLen % 4)) & 0x03;	/* round up to 4 byte alignment */
	USBDMApktLen += padding;

	pTxBlk->Priv += (TXINFO_SIZE + USBDMApktLen);

	/* For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload */
	RTMPWriteTxInfo(pAd, pTxInfo, (u16)(USBDMApktLen), FALSE, FIFO_EDCA,
			FALSE /*NextValid */ , FALSE);

	if (fragNum == pTxBlk->TotalFragNum) {
		pTxInfo->USBDMATxburst = 0;
		if ((pHTTXContext->CurWritePosition + pTxBlk->Priv + 3906) >
		    MAX_TXBULK_LIMIT) {
			pTxInfo->SwUseLastRound = 1;
			TxQLastRound = TRUE;
		}
	} else {
		pTxInfo->USBDMATxburst = 1;
//.........这里部分代码省略.........
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:101,代码来源:cmm_data_usb.c

示例8: NdisAcquireSpinLock

MAC_TABLE_ENTRY *MacTableInsertEntry(
	IN RTMP_ADAPTER *pAd,
	IN UCHAR *pAddr,
	IN struct wifi_dev *wdev,
	IN UINT32 ent_type,
	IN UCHAR OpMode,
	IN BOOLEAN CleanAll)
{
	UCHAR HashIdx;
	int i, FirstWcid;
	MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry;
	STA_TR_ENTRY *tr_entry = NULL;

	if (pAd->MacTab.Size >= MAX_LEN_OF_MAC_TABLE)
		return NULL;

	FirstWcid = 1;


	/* allocate one MAC entry*/
	NdisAcquireSpinLock(&pAd->MacTabLock);
	for (i = FirstWcid; i< MAX_LEN_OF_MAC_TABLE; i++)   /* skip entry#0 so that "entry index == AID" for fast lookup*/
	{
		/* pick up the first available vacancy*/
		if (IS_ENTRY_NONE(&pAd->MacTab.Content[i]))
		{
			pEntry = &pAd->MacTab.Content[i];
			tr_entry = &pAd->MacTab.tr_entry[i];

			mac_entry_reset(pAd, pEntry, CleanAll);
			
			/* ENTRY PREEMPTION: initialize the entry */
			pEntry->wdev = wdev;
			pEntry->wcid = i;
			pEntry->func_tb_idx = wdev->func_idx;
			pEntry->bIAmBadAtheros = FALSE;
			pEntry->pAd = pAd;
			pEntry->CMTimerRunning = FALSE;

			COPY_MAC_ADDR(pEntry->Addr, pAddr);
			pEntry->Sst = SST_NOT_AUTH;
			pEntry->AuthState = AS_NOT_AUTH;
			pEntry->Aid = (USHORT)i;
			pEntry->CapabilityInfo = 0;
			pEntry->AssocDeadLine = MAC_TABLE_ASSOC_TIMEOUT;
			
			pEntry->PsMode = PWR_ACTIVE;
			pEntry->NoDataIdleCount = 0;
			pEntry->ContinueTxFailCnt = 0;
#ifdef WDS_SUPPORT
			pEntry->LockEntryTx = FALSE;
#endif /* WDS_SUPPORT */
			pEntry->TimeStamp_toTxRing = 0;
			// TODO: shiang-usw,  remove upper setting becasue we need to migrate to tr_entry!
			pAd->MacTab.tr_entry[i].PsMode = PWR_ACTIVE;
			pAd->MacTab.tr_entry[i].NoDataIdleCount = 0;
			pAd->MacTab.tr_entry[i].ContinueTxFailCnt = 0;
			pAd->MacTab.tr_entry[i].LockEntryTx = FALSE;
			pAd->MacTab.tr_entry[i].TimeStamp_toTxRing = 0;
			pAd->MacTab.tr_entry[i].PsDeQWaitCnt = 0;

			pEntry->EnqueueEapolStartTimerRunning = EAPOL_START_DISABLE;
			pEntry->GTKState = REKEY_NEGOTIATING;
			pEntry->PairwiseKey.KeyLen = 0;
			pEntry->PairwiseKey.CipherAlg = CIPHER_NONE;
			pEntry->PMKID_CacheIdx = ENTRY_NOT_FOUND;
			pEntry->RSNIE_Len = 0;
			NdisZeroMemory(pEntry->R_Counter, sizeof(pEntry->R_Counter));
			pEntry->ReTryCounter = PEER_MSG1_RETRY_TIMER_CTR;
			tr_entry->PortSecured = WPA_802_1X_PORT_NOT_SECURED;			

			do
			{

#ifdef CONFIG_AP_SUPPORT
#ifdef APCLI_SUPPORT
				if (ent_type == ENTRY_APCLI)
				{
					SET_ENTRY_APCLI(pEntry);
					//SET_ENTRY_AP(pEntry);//Carter, why set entry to APCLI then set to AP????
					COPY_MAC_ADDR(pEntry->bssid, pAddr);
					pEntry->AuthMode = pAd->ApCfg.ApCliTab[pEntry->func_tb_idx].wdev.AuthMode;
					pEntry->WepStatus = pAd->ApCfg.ApCliTab[pEntry->func_tb_idx].wdev.WepStatus;
					if (pEntry->AuthMode < Ndis802_11AuthModeWPA)
					{
						pEntry->WpaState = AS_NOTUSE;
						pEntry->PrivacyFilter = Ndis802_11PrivFilterAcceptAll;
					}
					else
					{
						pEntry->WpaState = AS_PTKSTART;
						pEntry->PrivacyFilter = Ndis802_11PrivFilter8021xWEP;
					}
					break;
				}
#endif /* APCLI_SUPPORT */
#ifdef WDS_SUPPORT
				if (ent_type == ENTRY_WDS)
				{
					SET_ENTRY_WDS(pEntry);
//.........这里部分代码省略.........
开发者ID:andy-padavan,项目名称:rt-n56u,代码行数:101,代码来源:mgmt_entrytb.c

示例9: StaInitializeStationConfig

VOID
StaInitializeStationConfig(
    __in PSTATION         pStation
    )
{
    PSTA_CURRENT_CONFIG         pConfig = &pStation->Config;

    //
    // free PrivacyExemptionList
    //
    if (pConfig->PrivacyExemptionList)
    {
        MP_FREE_MEMORY(pStation->Config.PrivacyExemptionList);
    }

    //
    // free IBSS params
    //
    if (pConfig->AdditionalIEData)
    {
        MP_FREE_MEMORY(pConfig->AdditionalIEData);
    }

    //
    // Any dynamically allocated structure must be freed prior to this point.
    //
    NdisZeroMemory(pConfig, sizeof(STA_CURRENT_CONFIG));

    pConfig->BSSType = dot11_BSS_type_infrastructure;
    // Wildcard SSID
    pConfig->SSID.uSSIDLength = 0;

    // Setup to accept an BSSID
    pConfig->DesiredBSSIDList[0][0] = 0xFF;
    pConfig->DesiredBSSIDList[0][1] = 0xFF;
    pConfig->DesiredBSSIDList[0][2] = 0xFF;
    pConfig->DesiredBSSIDList[0][3] = 0xFF;
    pConfig->DesiredBSSIDList[0][4] = 0xFF;
    pConfig->DesiredBSSIDList[0][5] = 0xFF;
    pConfig->DesiredBSSIDCount = 1;
    pConfig->AcceptAnyBSSID = TRUE;

    //
    // Reset other configuration parameters.
    //
    pConfig->UnreachableDetectionThreshold = 2000;
    pConfig->ExcludeUnencrypted = FALSE;

    pConfig->AID = 0;
    pConfig->ValidAID = FALSE;
    pConfig->ListenInterval = 3;        // TODO: FIX this.

    pConfig->MediaStreamingEnabled = FALSE;
    pConfig->UnicastUseGroupEnabled = TRUE;
    pConfig->HiddenNetworkEnabled = FALSE;
    
    //
    // Reset desired PHY ID list
    //
    pConfig->DesiredPhyCount = 1;
    pConfig->DesiredPhyList[0] = DOT11_PHY_ID_ANY;
    pConfig->ActivePhyId = DOT11_PHY_ID_ANY;

    //
    // This is scan specific setting 
    //
    pStation->ScanContext.SSIDInProbeRequest = TRUE;         // True until we go to low power state

}
开发者ID:kcrazy,项目名称:winekit,代码行数:69,代码来源:st_main.c

示例10: SxLibIssueOidRequest

NDIS_STATUS
SxLibIssueOidRequest(
    _In_ PSX_SWITCH_OBJECT Switch,
    _In_ NDIS_REQUEST_TYPE RequestType,
    _In_ NDIS_OID Oid,
    _In_opt_ PVOID InformationBuffer,
    _In_ ULONG InformationBufferLength,
    _In_ ULONG OutputBufferLength,
    _In_ ULONG MethodId,
    _In_ UINT Timeout,
    _Out_ PULONG BytesNeeded
    )
{
    NDIS_STATUS status;
    PSX_OID_REQUEST oidRequest;
    PNDIS_OID_REQUEST ndisOidRequest;
    ULONG bytesNeeded;
    BOOLEAN asyncCompletion;

    status = NDIS_STATUS_SUCCESS;
    oidRequest = NULL;
    bytesNeeded = 0;
    asyncCompletion = FALSE;

    NdisInterlockedIncrement(&Switch->PendingOidCount);

    if (Switch->ControlFlowState != SxSwitchAttached)
    {
        status = NDIS_STATUS_CLOSING;
        goto Cleanup;
    }

    //
    // Dynamically allocate filter request so that we can handle asynchronous
    // completion.
    //
    oidRequest = (PSX_OID_REQUEST)ExAllocatePoolWithTag(NonPagedPoolNx,
                                                        sizeof(SX_OID_REQUEST),
                                                        SxExtAllocationTag);
    if (oidRequest == NULL)
    {
        goto Cleanup;
    }

    NdisZeroMemory(oidRequest, sizeof(SX_OID_REQUEST));
    ndisOidRequest = &oidRequest->NdisOidRequest;
    NdisInitializeEvent(&oidRequest->ReqEvent);

    ndisOidRequest->Header.Type = NDIS_OBJECT_TYPE_OID_REQUEST;
    ndisOidRequest->Header.Revision = NDIS_OID_REQUEST_REVISION_1;
    ndisOidRequest->Header.Size = sizeof(NDIS_OID_REQUEST);
    ndisOidRequest->RequestType = RequestType;
    ndisOidRequest->Timeout = Timeout;

    switch (RequestType)
    {
    case NdisRequestQueryInformation:
         ndisOidRequest->DATA.QUERY_INFORMATION.Oid = Oid;
         ndisOidRequest->DATA.QUERY_INFORMATION.InformationBuffer =
             InformationBuffer;
         ndisOidRequest->DATA.QUERY_INFORMATION.InformationBufferLength =
             InformationBufferLength;
        break;

    case NdisRequestSetInformation:
         ndisOidRequest->DATA.SET_INFORMATION.Oid = Oid;
         ndisOidRequest->DATA.SET_INFORMATION.InformationBuffer =
             InformationBuffer;
         ndisOidRequest->DATA.SET_INFORMATION.InformationBufferLength =
             InformationBufferLength;
        break;

    case NdisRequestMethod:
         ndisOidRequest->DATA.METHOD_INFORMATION.Oid = Oid;
         ndisOidRequest->DATA.METHOD_INFORMATION.MethodId = MethodId;
         ndisOidRequest->DATA.METHOD_INFORMATION.InformationBuffer =
             InformationBuffer;
         ndisOidRequest->DATA.METHOD_INFORMATION.InputBufferLength =
             InformationBufferLength;
         ndisOidRequest->DATA.METHOD_INFORMATION.OutputBufferLength =
             OutputBufferLength;
         break;

    default:
        NT_ASSERT(FALSE);
        break;
    }

    ndisOidRequest->RequestId = (PVOID)SxExtOidRequestId;
    status = NdisFOidRequest(Switch->NdisFilterHandle, ndisOidRequest);

    if (status == NDIS_STATUS_PENDING)
    {
        asyncCompletion = TRUE;
        NdisWaitEvent(&oidRequest->ReqEvent, 0);
    }
    else
    {
        SxpNdisCompleteInternalOidRequest(Switch, ndisOidRequest, status);
    }
//.........这里部分代码省略.........
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:101,代码来源:SxLibrary.c

示例11: SxLibIssueNicStatusIndicationUnsafe

VOID
SxLibIssueNicStatusIndicationUnsafe(
    _In_ PSX_SWITCH_OBJECT Switch,
    _In_ NDIS_STATUS StatusCode,
    _In_ NDIS_SWITCH_PORT_ID PortId,
    _In_ NDIS_SWITCH_NIC_INDEX NicIndex,
    _In_ BOOLEAN IsDestination,
    _In_opt_ PVOID StatusBuffer,
    _In_ ULONG StatusBufferSize
    )
{
    NDIS_STATUS_INDICATION statusIndication;
    NDIS_STATUS_INDICATION wrappedIndication;
    NDIS_SWITCH_NIC_STATUS_INDICATION nicIndication;
    
    NdisZeroMemory(&wrappedIndication, sizeof(wrappedIndication));
    
    wrappedIndication.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
    wrappedIndication.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
    wrappedIndication.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1;
    
    wrappedIndication.SourceHandle = Switch->NdisFilterHandle;
    wrappedIndication.PortNumber = NDIS_DEFAULT_PORT_NUMBER;
    
    wrappedIndication.StatusCode = StatusCode;
    wrappedIndication.StatusBuffer = StatusBuffer;
    wrappedIndication.StatusBufferSize = StatusBufferSize;
    
    NdisZeroMemory(&nicIndication, sizeof(nicIndication));
    
    nicIndication.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
    nicIndication.Header.Revision = NDIS_SWITCH_NIC_STATUS_INDICATION_REVISION_1;
    nicIndication.Header.Size = NDIS_SIZEOF_SWITCH_NIC_STATUS_REVISION_1;
    nicIndication.StatusIndication = &wrappedIndication;
    
    if (IsDestination)
    {
        nicIndication.DestinationPortId = PortId;
        nicIndication.DestinationNicIndex = NicIndex;
    }
    else
    {
        nicIndication.SourcePortId = PortId;
        nicIndication.SourceNicIndex = NicIndex;
    }
    
    NdisZeroMemory(&statusIndication, sizeof(statusIndication));
    
    statusIndication.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
    statusIndication.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
    statusIndication.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1;
    
    statusIndication.SourceHandle = Switch->NdisFilterHandle;
    statusIndication.PortNumber = NDIS_DEFAULT_PORT_NUMBER;
    
    statusIndication.StatusCode = NDIS_STATUS_SWITCH_NIC_STATUS;
    statusIndication.StatusBuffer = &nicIndication;
    statusIndication.StatusBufferSize = sizeof(nicIndication);
    
    NdisFIndicateStatus(Switch->NdisFilterHandle,
                        &statusIndication);
}
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:62,代码来源:SxLibrary.c

示例12: GingkoNdisRegisterDevice

NDIS_STATUS
GingkoNdisRegisterDevice(
    VOID
    )
/*++

Routine Description:

    Register an ioctl interface - a device object to be used for this
    purpose is created by NDIS when we call NdisMRegisterDevice.

    This routine is called whenever a new miniport instance is
    initialized. However, we only create one global device object,
    when the first miniport instance is initialized. This routine
    handles potential race conditions with PtDeregisterDevice via
    the ControlDeviceState and MiniportCount variables.

    NOTE: do not call this from DriverEntry; it will prevent the driver
    from being unloaded (e.g. on uninstall).

Arguments:

    None

Return Value:

    NDIS_STATUS_SUCCESS if we successfully register a device object.

--*/
{
    NDIS_STATUS            Status = NDIS_STATUS_SUCCESS;
    UNICODE_STRING         DeviceName;
    UNICODE_STRING         DeviceLinkUnicodeString;
    PDRIVER_DISPATCH       DispatchTable[IRP_MJ_MAXIMUM_FUNCTION+1];

    KdPrint(("==>PtRegisterDevice\n"));

    NdisAcquireSpinLock(&GlobalLock);

    ++MiniportCount;
    
    if (1 == MiniportCount)
    {
        ASSERT(ControlDeviceState != PS_DEVICE_STATE_CREATING);

        //
        // Another thread could be running PtDeregisterDevice on
        // behalf of another miniport instance. If so, wait for
        // it to exit.
        //
        while (ControlDeviceState != PS_DEVICE_STATE_READY)
        {
            NdisReleaseSpinLock(&GlobalLock);
            NdisMSleep(1);
            NdisAcquireSpinLock(&GlobalLock);
        }

        ControlDeviceState = PS_DEVICE_STATE_CREATING;

        NdisReleaseSpinLock(&GlobalLock);

    
        NdisZeroMemory(DispatchTable, (IRP_MJ_MAXIMUM_FUNCTION+1) * sizeof(PDRIVER_DISPATCH));

        DispatchTable[IRP_MJ_CREATE] = GingkoNdisDispatch;
        DispatchTable[IRP_MJ_CLEANUP] = GingkoNdisDispatch;
        DispatchTable[IRP_MJ_CLOSE] = GingkoNdisDispatch;
        DispatchTable[IRP_MJ_DEVICE_CONTROL] = GingkoNdisDispatch;
        

        NdisInitUnicodeString(&DeviceName, NTDEVICE_STRING);
        NdisInitUnicodeString(&DeviceLinkUnicodeString, LINKNAME_STRING);

        //
        // Create a device object and register our dispatch handlers
        //
        
        Status = NdisMRegisterDevice(
                    NdisWrapperHandle, 
                    &DeviceName,
                    &DeviceLinkUnicodeString,
                    &DispatchTable[0],
                    &ControlDeviceObject,
                    &NdisDeviceHandle
                    );

        NdisAcquireSpinLock(&GlobalLock);

        ControlDeviceState = PS_DEVICE_STATE_READY;
    }

    NdisReleaseSpinLock(&GlobalLock);

    KdPrint(("<==PtRegisterDevice: %x\n", Status));

    return (Status);
}
开发者ID:shimbongsu,项目名称:secure-share-fss,代码行数:97,代码来源:gingko_networks.c

示例13: GingkoNdisDriverEntry

NTSTATUS GingkoNdisDriverEntry(
    IN PDRIVER_OBJECT        DriverObject,
    IN PUNICODE_STRING       RegistryPath
    )
{
	NDIS_STATUS                        Status;
    NDIS_PROTOCOL_CHARACTERISTICS      PChars;
    NDIS_MINIPORT_CHARACTERISTICS      MChars;
    NDIS_STRING                        Name;

    Status = NDIS_STATUS_SUCCESS;
    NdisAllocateSpinLock(&GlobalLock);
    NdisMInitializeWrapper(&NdisWrapperHandle, DriverObject, RegistryPath, NULL);
	KdPrint(("Calling NdisMInitializeWrapper Before\n"));

    do
    {
        //
        // Register the miniport with NDIS. Note that it is the miniport
        // which was started as a driver and not the protocol. Also the miniport
        // must be registered prior to the protocol since the protocol's BindAdapter
        // handler can be initiated anytime and when it is, it must be ready to
        // start driver instances.
        //

        NdisZeroMemory(&MChars, sizeof(NDIS_MINIPORT_CHARACTERISTICS));

        MChars.MajorNdisVersion = PASSTHRU_MAJOR_NDIS_VERSION;
        MChars.MinorNdisVersion = PASSTHRU_MINOR_NDIS_VERSION;

        MChars.InitializeHandler = GingkoNdisInitialize;
        MChars.QueryInformationHandler = GingkoNdisQueryInformation;
        MChars.SetInformationHandler = GingkoNdisSetInformation;
        MChars.ResetHandler = NULL;
        MChars.TransferDataHandler = GingkoNdisTransferData;
        MChars.HaltHandler = GingkoNdisHalt;
#ifdef NDIS51_MINIPORT
        MChars.CancelSendPacketsHandler = GingkoNdisCancelSendPackets;
        MChars.PnPEventNotifyHandler = GingkoNdisDevicePnPEvent;
        MChars.AdapterShutdownHandler = GingkoNdisAdapterShutdown;
#endif // NDIS51_MINIPORT

        //
        // We will disable the check for hang timeout so we do not
        // need a check for hang handler!
        //
        MChars.CheckForHangHandler = NULL;
        MChars.ReturnPacketHandler = GingkoNdisReturnPacket;

        //
        // Either the Send or the SendPackets handler should be specified.
        // If SendPackets handler is specified, SendHandler is ignored
        //
        MChars.SendHandler = NULL;    // MPSend;
        MChars.SendPacketsHandler = GingkoNdisSendPackets;

        Status = NdisIMRegisterLayeredMiniport(NdisWrapperHandle,
                                                  &MChars,
                                                  sizeof(MChars),
                                                  &DriverHandle);

		KdPrint(("Calling NdisIMRegisterLayeredMiniport After\n"));
		///return 0;
        if (Status != NDIS_STATUS_SUCCESS)
        {
            break;
        }


#ifndef WIN9X
        NdisMRegisterUnloadHandler(NdisWrapperHandle, GingkoNdisUnload);
#endif

        //
        // Now register the protocol.
        //
        NdisZeroMemory(&PChars, sizeof(NDIS_PROTOCOL_CHARACTERISTICS));
        PChars.MajorNdisVersion = PASSTHRU_PROT_MAJOR_NDIS_VERSION;
        PChars.MinorNdisVersion = PASSTHRU_PROT_MINOR_NDIS_VERSION;

        //
        // Make sure the protocol-name matches the service-name
        // (from the INF) under which this protocol is installed.
        // This is needed to ensure that NDIS can correctly determine
        // the binding and call us to bind to miniports below.
        //
        NdisInitUnicodeString(&Name, L"GingkoFilter");    // Protocol name
        PChars.Name = Name;
        PChars.OpenAdapterCompleteHandler = GingkoNdisOpenAdapterComplete;
        PChars.CloseAdapterCompleteHandler = GingkoNdisCloseAdapterComplete;
        PChars.SendCompleteHandler = GingkoNdisSendComplete;
        PChars.TransferDataCompleteHandler = GingkoNdisTransferDataComplete;
    
        PChars.ResetCompleteHandler = GingkoNdisResetComplete;
        PChars.RequestCompleteHandler = GingkoNdisRequestComplete;
        PChars.ReceiveHandler = GingkoNdisReceive;
        PChars.ReceiveCompleteHandler = GingkoNdisReceiveComplete;
        PChars.StatusHandler = GingkoNdisStatus;
        PChars.StatusCompleteHandler = GingkoNdisStatusComplete;
        PChars.BindAdapterHandler = GingkoNdisBindAdapter;
//.........这里部分代码省略.........
开发者ID:shimbongsu,项目名称:secure-share-fss,代码行数:101,代码来源:gingko_networks.c

示例14: ApCliEnqueueProbeRequest

/* 
	==========================================================================
	Description:
	==========================================================================
 */
static VOID ApCliEnqueueProbeRequest(
	IN PRTMP_ADAPTER pAd,
	IN UCHAR SsidLen,
	OUT PCHAR Ssid,
	IN USHORT ifIndex)
{
	NDIS_STATUS     NState;
	PUCHAR          pOutBuffer;
	ULONG           FrameLen = 0;
	HEADER_802_11   Hdr80211;
	UCHAR           SsidIe    = IE_SSID;
	UCHAR           SupRateIe = IE_SUPP_RATES;
	UCHAR ssidLen;
	CHAR ssid[MAX_LEN_OF_SSID];
	APCLI_STRUCT *pApCliEntry = NULL;
	BOOLEAN bHasWscIe = FALSE;

	MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("force out a ProbeRequest ...\n"));

	if (ifIndex >= MAX_APCLI_NUM)
		return;

	pApCliEntry = &pAd->ApCfg.ApCliTab[ifIndex];
	
	NState = MlmeAllocateMemory(pAd, &pOutBuffer);  /* Get an unused nonpaged memory */
	if(NState != NDIS_STATUS_SUCCESS)
	{
		MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("EnqueueProbeRequest() allocate memory fail\n"));
		return;
	}
	else
	{
		if(MAC_ADDR_EQUAL(pAd->ApCfg.ApCliTab[ifIndex].CfgApCliBssid, ZERO_MAC_ADDR))
			ApCliMgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0,
				BROADCAST_ADDR, BROADCAST_ADDR, ifIndex);
		else
			ApCliMgtMacHeaderInit(pAd, &Hdr80211, SUBTYPE_PROBE_REQ, 0,
				pAd->ApCfg.ApCliTab[ifIndex].CfgApCliBssid, pAd->ApCfg.ApCliTab[ifIndex].CfgApCliBssid, ifIndex);

		ssidLen = SsidLen;
		NdisZeroMemory(ssid, MAX_LEN_OF_SSID);
		NdisMoveMemory(ssid, Ssid, ssidLen);

		/* this ProbeRequest explicitly specify SSID to reduce unwanted ProbeResponse */
		MakeOutgoingFrame(pOutBuffer,		&FrameLen,
			sizeof(HEADER_802_11),			&Hdr80211,
			1,								&SsidIe,
			1,								&ssidLen,
			ssidLen,						ssid,
			1,								&SupRateIe,
			1,								&pApCliEntry->MlmeAux.SupRateLen,
			pApCliEntry->MlmeAux.SupRateLen,		pApCliEntry->MlmeAux.SupRate,
			END_OF_ARGS);

		/* Add the extended rate IE */
		if (pApCliEntry->MlmeAux.ExtRateLen != 0)
		{
			ULONG            tmp;
		
			MakeOutgoingFrame(pOutBuffer + FrameLen,    &tmp,
				1,                        &ExtRateIe,
				1,                        &pApCliEntry->MlmeAux.ExtRateLen,
				pApCliEntry->MlmeAux.ExtRateLen,  pApCliEntry->MlmeAux.ExtRate,
				END_OF_ARGS);
			FrameLen += tmp;
		}

#ifdef DOT11_VHT_AC
		if (WMODE_CAP_AC(pAd->CommonCfg.PhyMode) &&
			(pAd->CommonCfg.Channel > 14))
		{
			FrameLen += build_vht_ies(pAd, (UCHAR *)(pOutBuffer + FrameLen), SUBTYPE_PROBE_REQ);
		}
#endif /* DOT11_VHT_AC */

#if defined(RT_CFG80211_P2P_CONCURRENT_DEVICE) || defined(CFG80211_MULTI_STA)
         if ((pAd->StaCfg.wpa_supplicant_info.WpaSupplicantUP != WPA_SUPPLICANT_DISABLE) &&
		    (pAd->cfg80211_ctrl.ExtraIeLen > 0))
        {
                ULONG           ExtraIeTmpLen = 0;

                MakeOutgoingFrame(pOutBuffer+ FrameLen,              &ExtraIeTmpLen,
                                                pAd->cfg80211_ctrl.ExtraIeLen,  pAd->cfg80211_ctrl.pExtraIe,
                                                END_OF_ARGS);

                FrameLen += ExtraIeTmpLen;
        }
#endif /* RT_CFG80211_P2P_CONCURRENT_DEVICE || CFG80211_MULTI_STA */		
		if ((pAd->ApCfg.ApCliTab[ifIndex].WscControl.WscConfMode != WSC_DISABLE) &&
			(pAd->ApCfg.ApCliTab[ifIndex].WscControl.bWscTrigger))
		{
			bHasWscIe = TRUE;
		}
#ifdef WSC_V2_SUPPORT
		else if (pAd->ApCfg.ApCliTab[ifIndex].WscControl.WscV2Info.bEnableWpsV2)
//.........这里部分代码省略.........
开发者ID:AnyoeDove,项目名称:mtk-sources,代码行数:101,代码来源:apcli_sync.c

示例15: DriverEntry

NTSTATUS
DriverEntry(
    IN    PDRIVER_OBJECT        DriverObject,
    IN    PUNICODE_STRING       RegistryPath
    )
/*++

Routine Description:

    First entry point to be called, when this driver is loaded.
    Register with NDIS as an intermediate driver.

Arguments:

    DriverObject - pointer to the system's driver object structure
        for this driver
    
    RegistryPath - system's registry path for this driver
    
Return Value:

    STATUS_SUCCESS if all initialization is successful, STATUS_XXX
    error code if not.

--*/
{
    NDIS_STATUS                     Status;
    NDIS_PROTOCOL_DRIVER_CHARACTERISTICS   PChars;
    NDIS_MINIPORT_DRIVER_CHARACTERISTICS   MChars;
    NDIS_HANDLE  MiniportDriverContext;
    NDIS_HANDLE  ProtocolDriverContext;
    NDIS_STRING                     Name;
    

    NdisInitializeListHead(&AdapterList);
    NdisInitializeListHead(&VElanList);
    MiniportDriverContext=NULL;
    ProtocolDriverContext=NULL;
    
    MUX_INIT_MUTEX(&GlobalMutex);
    MUX_INIT_MUTEX(&ControlDeviceMutex);
    NdisAllocateSpinLock(&GlobalLock);


    do
    {

        //
        // Register the miniport with NDIS. Note that it is the
        // miniport which was started as a driver and not the protocol.
        // Also the miniport must be registered prior to the protocol
        // since the protocol's BindAdapter handler can be initiated
        // anytime and when it is, it must be ready to
        // start driver instances.
        //
        NdisZeroMemory(&MChars, sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS));

        MChars.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
        MChars.Header.Size = sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS);
        MChars.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
        
        MChars.MajorNdisVersion = MUX_MAJOR_NDIS_VERSION;
        MChars.MinorNdisVersion = MUX_MINOR_NDIS_VERSION;

        MChars.MajorDriverVersion = MUX_MAJOR_DRIVER_VERSION;
        MChars.MinorDriverVersion = MUX_MINOR_DRIVER_VERSION;

        MChars.SetOptionsHandler = MpSetOptions;
        MChars.InitializeHandlerEx = MPInitialize;
        MChars.UnloadHandler = MPUnload;
        MChars.HaltHandlerEx = MPHalt;

        MChars.OidRequestHandler = MPOidRequest;

        MChars.CancelSendHandler = MPCancelSendNetBufferLists;
        MChars.DevicePnPEventNotifyHandler = MPDevicePnPEvent;
        MChars.ShutdownHandlerEx = MPAdapterShutdown;
        MChars.CancelOidRequestHandler =  MPCancelOidRequest;

        //
        // We will disable the check for hang timeout so we do not
        // need a check for hang handler!
        //
        MChars.CheckForHangHandlerEx = NULL;

        MChars.ReturnNetBufferListsHandler = MPReturnNetBufferLists;
        MChars.SendNetBufferListsHandler = MPSendNetBufferLists;

        MChars.PauseHandler = MPPause;
        MChars.RestartHandler = MPRestart;

        MChars.Flags = NDIS_INTERMEDIATE_DRIVER;
        Status = NdisMRegisterMiniportDriver(DriverObject,
                                             RegistryPath,
                                             MiniportDriverContext,
                                             &MChars,
                                             &DriverHandle);

        if (Status != NDIS_STATUS_SUCCESS)
        {
//.........这里部分代码省略.........
开发者ID:340211173,项目名称:Windows-driver-samples,代码行数:101,代码来源:mux.c


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