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


C++ MoveMemory函数代码示例

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


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

示例1: MoveMemory

void Mac::AddToRecord()
{
	MoveMemory(IP_MAC_STABLE[CUR_IP_MAC_LEN].IP, DestIpAddr, 4);
	MoveMemory(IP_MAC_STABLE[CUR_IP_MAC_LEN].MAC, DestMacAddr, 6);
	if(CUR_IP_MAC_LEN < _IP_MAC_LEN-1)
		CUR_IP_MAC_LEN ++;
}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:NDIS,代码行数:7,代码来源:Mac.cpp

示例2: BufferPool_ShiftAvailable

static BOOL BufferPool_ShiftAvailable(wBufferPool* pool, int index, int count)
{
	if (count > 0)
	{
		if (pool->aSize + count > pool->aCapacity)
		{
			wBufferPoolItem *newArray;
			int newCapacity = pool->aCapacity * 2;

			newArray = (wBufferPoolItem*) realloc(pool->aArray, sizeof(wBufferPoolItem) * newCapacity);
			if (!newArray)
				return FALSE;
			pool->aArray = newArray;
			pool->aCapacity = newCapacity;
		}

		MoveMemory(&pool->aArray[index + count], &pool->aArray[index], (pool->aSize - index) * sizeof(wBufferPoolItem));
		pool->aSize += count;
	}
	else if (count < 0)
	{
		MoveMemory(&pool->aArray[index], &pool->aArray[index - count], (pool->aSize - index) * sizeof(wBufferPoolItem));
		pool->aSize += count;
	}
	return TRUE;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:26,代码来源:BufferPool.c

示例3: MoveMemory

//----------------------------------------------------------------------------------------------
//	Delete
//----------------------------------------------------------------------------------------------
VOID CSetting::Delete()
{
	//	コントローラーの設定数を更新する
	SettingCount --;
	if( CurrentSettingIndex < SettingCount )
	{
		//	コントローラーの設定、設定の名称を1つずつスライドする
		MoveMemory(
			 &Setting[CurrentSettingIndex]
			,&Setting[CurrentSettingIndex + 1]
			,sizeof( SETTING ) * ( SettingCount - CurrentSettingIndex ) );
		LocalFree( SettingName[CurrentSettingIndex] );
		MoveMemory(
			 &SettingName[CurrentSettingIndex]
			,&SettingName[CurrentSettingIndex + 1]
			,sizeof( WCHAR * ) * ( SettingCount - CurrentSettingIndex ) );
	} else {
		//	現在のコントローラーの設定の順番を更新する
		CurrentSettingIndex --;
	}
	//	現在のコントローラーの設定を更新する
	CopyMemory( &CurrentSetting, &Setting[CurrentSettingIndex], sizeof( SETTING ) );
	//	不要なメモリを開放する
	Setting	= (SETTING *)LocalReAlloc(
				 Setting
				,SettingCount * sizeof( SETTING )
				,LMEM_MOVEABLE );
	SettingName	= (WCHAR * *)LocalReAlloc(
					 SettingName
					,SettingCount * sizeof( WCHAR * )
					,LMEM_MOVEABLE );

	//	変更済みフラグを更新する
	ModifiedFlag	= FALSE;
}
开发者ID:MasashiWada,项目名称:Xbox360-Controller-Driver,代码行数:38,代码来源:setting.cpp

示例4: WorkThread

unsigned int _stdcall WorkThread(void *p)
{
	//open pipe , get process name and dll path.
	try{
	const DWORD dwProcessSize = PROCESSSIZE;
	const DWORD dwDllPath = DLLPATHSIZE;
	TCHAR tszProcess[dwProcessSize] = { 0 };
	TCHAR tszDllPath[dwDllPath] = { 0 };
	HANDLE hReadPipe = NULL;
	do{
		hReadPipe = CreateFileW(PIPENAME, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
		Sleep(1000);
	} while (hReadPipe == INVALID_HANDLE_VALUE);
	DWORD dwRead = 0;
	ReadFile(hReadPipe, tszProcess, dwProcessSize, &dwRead, NULL);
	if (dwRead != dwProcessSize)
		throw 3;
	ReadFile(hReadPipe, tszDllPath, dwDllPath, &dwRead, NULL);
	CloseHandle(hReadPipe);
	if (dwRead != dwDllPath)
		throw 3;
	MoveMemory(g_szInjectDll, tszDllPath, dwDllPath);
	MoveMemory(g_szInjectProcessName, tszProcess, dwProcessSize);
	//inject dll to process.
	InjectMain();
	}
	catch(int e){

	}
	return 0;
}
开发者ID:wyrover,项目名称:InjectSolution,代码行数:31,代码来源:dllmain.cpp

示例5: CmdMacAddress

CMD_STATUS CmdMacAddress(PWLAN_ADAPTER pAdapter, USHORT nCmdAct, NDIS_802_11_MAC_ADDRESS* pMA)
{
	CMD_STATUS stat = CmdQueryBuffer(pAdapter);
	PHostCmd_DS_CMD_MAC_ADDRESS pCmd = (PHostCmd_DS_CMD_MAC_ADDRESS)&pAdapter->m_ucCmdBuffer[0];
	WORD nRet;

	if (stat != CMD_ERROR_SUCCESS)
		return stat;

	pCmd->Action = nCmdAct;
	if (nCmdAct == CMD_ACT_SET) {
		MoveMemory(pCmd->MacAddress, pMA, sizeof(pCmd->MacAddress));
		TRACE("Setting MAC Addr: %02X-%02X-%02X-%02X-%02X-%02X\r\n", pMA[0], pMA[1], pMA[2], pMA[3], pMA[4], pMA[5]);
	}
	CmdSetCmdInfo(pAdapter, HostCmd_CMD_MAC_ADDRESS, pCmd, sizeof(*pCmd), pCmd, ADAPTER_CMD_BUFFER_LENGTH);

	nRet = CmdProcessCmd(pAdapter, CMD_TIMEOUT_MAX);
	if (!nRet)
		stat = CMD_ERROR_UNKNOWN;

	if (nCmdAct == CMD_ACT_GET) {
		MoveMemory(pMA, pCmd->MacAddress, sizeof(*pMA));
		TRACE("Got MAC Addr: %02X-%02X-%02X-%02X-%02X-%02X\r\n", pCmd->MacAddress[0], pCmd->MacAddress[1], pCmd->MacAddress[2], pCmd->MacAddress[3], pCmd->MacAddress[4], pCmd->MacAddress[5]);
	}
	CmdReleaseBuffer(pAdapter);

	return stat;
}
开发者ID:Paolo-Maffei,项目名称:webled-node,代码行数:28,代码来源:WlanCmd.c

示例6: switch

VOID CPokemonCodec::SetNickName(BYTE bCode[POKEMON_NICK_NAME_SIZE])
{
	if(m_pPokemon == NULL)
		return;

	if(m_pPokemon->Header.bNickNameLanguage == 0x00)
	{
		if(m_dwLang == lang_jp)
			m_pPokemon->Header.bNickNameLanguage = 0x01;
		else
			m_pPokemon->Header.bNickNameLanguage = 0x02;
	}

	switch(m_pPokemon->Header.bNickNameLanguage)
	{
	case 0x01:		// jp version
		MoveMemory(m_pPokemon->Header.bNickName, bCode, 5);
		m_pPokemon->Header.bNickName[5] = 0xFF;
		FillMemory(m_pPokemon->Header.bNickName + 6, POKEMON_NICK_NAME_SIZE - 6, 0x00);
		break;

	default:		// en version
		MoveMemory(m_pPokemon->Header.bNickName, bCode, POKEMON_NICK_NAME_SIZE);
		break;
	}
}
开发者ID:h16o2u9u,项目名称:rtoss,代码行数:26,代码来源:PokemonCodec.cpp

示例7: reconst

/* reconstruction of tree */
void reconst(void)
{
  int i, j, k;
  int f, l;

  /* collect leaf nodes in the first half of the table */
  /* and replace the freq by (freq + 1) / 2. */
  j = 0;
  for (i = 0; i < T; i++)
  {
    if (son[i] >= T)
    {
      freq[j] = (freq[i] + 1) / 2;
      son[j] = son[i];
      j++;
    }
  }
  /* begin constructing tree by connecting sons */
  for (i = 0, j = N_CHAR; j < T; i += 2, j++)
  {
    k = i + 1;
    f = freq[j] = freq[i] + freq[k];
    for (k = j - 1; f < freq[k]; k--);
    k++;
    l = (j - k) * sizeof(*freq);
    MoveMemory(&freq[k + 1], &freq[k], l);
    freq[k] = f;
    MoveMemory(&son[k + 1], &son[k], l);
    son[k] = i;
  }
  /* connect prnt */
  for (i = 0; i < T; i++)
    if ((k = son[i]) >= T) prnt[k] = i;
    else prnt[k] = prnt[k + 1] = i;
}
开发者ID:BGCX262,项目名称:zx-evo-fpga-svn-to-git,代码行数:36,代码来源:wldr_td0.cpp

示例8: DbgOut

int CBgDisp2::Copy2VertexBuffer()
{
	if( !m_VB ){
		DbgOut( "bgdisp2 : Copy2VertexBuffer : m_VB null error !!!\n" );
		return 1;
	}

	
	if( multitexok == 0 ){
		D3DTLVERTEX* pVertices;
		if( FAILED( m_VB->Lock( 0, 0, (void**)&pVertices, NULL ) ) ){
			DbgOut( "bgdisp2 : Copy2VertexBuffer : m_VB Lock error !!!\n" );
			return 1;
		}

		MoveMemory( pVertices, m_tlv1, BGTLVNUM * sizeof( D3DTLVERTEX ) );

	}else{
		D3DTLVERTEX2* pVertices;
		if( FAILED( m_VB->Lock( 0, 0, (void**)&pVertices, NULL ) ) ){
			DbgOut( "bgdisp2 : Copy2VertexBuffer : m_VB Lock error !!!\n" );
			return 1;
		}

		MoveMemory( pVertices, m_tlv2, BGTLVNUM * sizeof( D3DTLVERTEX2 ) );
	}

	m_VB->Unlock();

	return 0;

}
开发者ID:toughie88,项目名称:Easy3D-1,代码行数:32,代码来源:bgdisp2.cpp

示例9: FillMemory

VOID CPokemonCodec::GetCatcherName(BYTE bCode[POKEMON_TRAINER_NAME_SIZE])
{
	if(m_pPokemon == NULL)
		return;

	if(m_pPokemon->Header.bNickNameLanguage == 0x00)
	{
		FillMemory(bCode, POKEMON_TRAINER_NAME_SIZE, 0xFF);
	}
	else
	{
		switch(m_dwLang)
		{
		case lang_jp:	// jp version
			MoveMemory(bCode, m_pPokemon->Header.bCatcherName, 5);
			bCode[5] = 0xFF;
			FillMemory(bCode + 6, POKEMON_TRAINER_NAME_SIZE - 6, 0x00);
			break;

		default:		// en version
			MoveMemory(bCode, m_pPokemon->Header.bCatcherName, POKEMON_TRAINER_NAME_SIZE);
			break;
		}
	}
}
开发者ID:h16o2u9u,项目名称:rtoss,代码行数:25,代码来源:PokemonCodec.cpp

示例10: StreamPool_ShiftUsed

void StreamPool_ShiftUsed(wStreamPool* pool, int index, int count)
{
	if (count > 0)
	{
		if (pool->uSize + count > pool->uCapacity)
		{
			int new_cap;
			wStream **new_arr;

			new_cap = pool->uCapacity * 2;
			new_arr = (wStream**) realloc(pool->uArray, sizeof(wStream*) * new_cap);
			if (!new_arr)
				return;
			pool->uCapacity = new_cap;
			pool->uArray = new_arr;
		}

		MoveMemory(&pool->uArray[index + count], &pool->uArray[index], (pool->uSize - index) * sizeof(wStream*));
		pool->uSize += count;
	}
	else if (count < 0)
	{
		if (pool->uSize - index + count > 0)
		{
			MoveMemory(&pool->uArray[index], &pool->uArray[index - count],
					(pool->uSize - index + count) * sizeof(wStream*));
		}

		pool->uSize += count;
	}
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:31,代码来源:StreamPool.c

示例11: CommandLineKey

static void CommandLineKey(int id, WPARAM wParam, int keytype)
{
	TCHAR code = (TCHAR)wParam;
	int len = (int)wcslen(commandLine);
	if (keytype == KEYCHAR) {
		if (!commandLineFocus && code == L':') {
			CreateCaret(g_hWnd, (HBITMAP)NULL, 1, FONTSIZE_CMD);
			commandLineFocus = 1;
			commandLine[commandLinePos++] = L':';
			commandLine[commandLinePos] = L'\0';
			CommandLineSetpos();
			ShowCaret(g_hWnd);
		}
		else if (commandLineFocus) {
			if (code == L'\r' || code == VK_ESCAPE) {
				if(code == L'\r' && LoaderRun(commandLine + 1))
					ErrorPrintf(L"CommandLineError: Cannot parse the command");
				commandLine[0] = L'\0';
				commandLinePos = 0;
				commandLineFocus = 0;
				HideCaret(g_hWnd);
				DestroyCaret();
				memset(KeyboardIsDown, 0, sizeof(KeyboardIsDown));
			}
			if (code < L' ' || len == MAX_COMMANDLINEBUFFER) return;
			MoveMemory(commandLine + commandLinePos + 1, commandLine + commandLinePos, (len - commandLinePos + 1) * sizeof(TCHAR));
			commandLine[commandLinePos++] = code;
			CommandLineSetpos();
		}
	}
	else if (keytype == KEYDOWN && commandLineFocus) {
		switch (code)
		{
		case VK_LEFT:
			if (commandLinePos > 1) --commandLinePos;
			CommandLineSetpos();
			break;
		case VK_RIGHT:
			if (commandLinePos < len) ++commandLinePos;
			CommandLineSetpos();
			break;
		case VK_HOME:
			commandLinePos = 1;
			break;
		case VK_END:
			commandLinePos = len;
			break;
		case VK_BACK:
			if (commandLinePos > 1) {
				MoveMemory(commandLine + commandLinePos - 1, commandLine + commandLinePos, (len - commandLinePos + 1) * sizeof(TCHAR));
				commandLinePos--;
			}
			CommandLineSetpos();
			break;
		}
	}
}
开发者ID:sunziping2016,项目名称:Escape,代码行数:57,代码来源:commonui.cpp

示例12: GetTickCount

BOOL Mac::SendWithMac(unsigned char* &packet ,int PacketLen, HANDLE DriverHandle)
{
	//分配缓冲区
	UINT dwStart = GetTickCount();

	unsigned char *MacPacket=(unsigned char*)malloc(PacketLen + sizeof(ETH_HEADER));
	memset(MacPacket,0,PacketLen + sizeof(ETH_HEADER));
	MoveMemory(MacPacket + sizeof(ETH_HEADER), packet, PacketLen);

	//如果子网掩码为空,则首先得到子网掩码
	if(IsEmpty(SubNetMask,4))
		GetSubNetMask();

	if(IsEmpty(SrcMacAddr,4))
		GetSrcMac(DriverHandle);

	GetSrcAndDestIpAddr(packet);
	
	//如果通信双方在同一网段
	if(BothInLocalNetwork())
	{
		//如果对应表中没有双方信息,发ARP查询; 如果有查询的同时就将
		//DestMacAddr赋值
		if(!CheckRecord())
		{
			//发ARP查询MAC,并在表中添加双方信息
			if(SendArpToGetMac(DriverHandle))
				AddToRecord();
		}
	}
	else
	{
		if(IsEmpty(GateWayMacAddr, 6))
		{
			if(SendArpToGetMac(DriverHandle))
				MoveMemory(GateWayMacAddr,DestMacAddr,6);
		}
		else
			MoveMemory(DestMacAddr, GateWayMacAddr, 6);
	}

	//组包
	MoveMemory(MacPacket, DestMacAddr, 6);
	MoveMemory(MacPacket+6, SrcMacAddr, 6);
	MacPacket[12] = 0x08;
	MacPacket[13] = 0x00;

	//替换原有包
	unsigned char *temp = packet;
	packet = MacPacket;
	temp = NULL;

	dwStart = GetTickCount() - dwStart;

	return TRUE;
}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:NDIS,代码行数:56,代码来源:Mac.cpp

示例13: ValidateIndex

/**
 * @param pszSubstring - inserted string buffer.
 * @param nPosition - start position.
 * @param nLength - length of the inserted string.
 */
void CStrStream::Insert(PCTSTR pszSubstring, size_t nPosition, size_t nLength)
{
	ValidateIndex(nPosition);
	size_t nNewLength = m_nLength + nLength;
	EnsureSize(nNewLength + 1, true);
	size_t nNextPosition = nPosition + nLength;
	size_t nNextLength = m_nLength - nPosition;
	MoveMemory(m_pszData + nNextPosition, m_pszData + nPosition, (nNextLength + 1) * sizeof(TCHAR));
	MoveMemory(m_pszData + nPosition, pszSubstring, nLength * sizeof(TCHAR));
	m_nLength = nNewLength;
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:16,代码来源:StrStream.cpp

示例14: CmdSetTxPowerLevel

CMD_STATUS CmdSetTxPowerLevel(PWLAN_ADAPTER pAdapter, USHORT nPowerLevel)
{
	CMD_STATUS stat = CmdQueryBuffer(pAdapter);
	WORD nRet;

	if (1) {
		OID_MRVL_DS_TPC_CFG cfg;
		POID_MRVL_DS_TPC_CFG pTpcCfg = &cfg;
		PHostCmd_DS_802_11_TPC_CFG pCmd = (PHostCmd_DS_802_11_TPC_CFG)&pAdapter->m_ucCmdBuffer[0];
		
		ZeroMemory(&cfg,sizeof(cfg));
		pCmd->Action = CMD_ACT_SET;
		MoveMemory(&pCmd->Enable, &pTpcCfg->Enable,sizeof(*pCmd)-MEMBER_OFFSET(HostCmd_DS_802_11_TPC_CFG,Enable));

		CmdSetCmdInfo(pAdapter, HostCmd_CMD_802_11_TPC_CFG, pCmd, sizeof(*pCmd), pCmd, ADAPTER_CMD_BUFFER_LENGTH);
		nRet = CmdProcessCmd(pAdapter, CMD_TIMEOUT_MAX);
		if (nRet != sizeof(*pCmd))
			stat = CMD_ERROR_UNKNOWN;
	}

	if(1) { //stat == CMD_ERROR_SUCCESS) {
		USHORT bEnablePA=TRUE;
		int nTxSize;
		MrvlIEtypes_PowerAdapt_Group_t iePag;
		MrvlIEtypes_PowerAdapt_Group_t* pIePag = &iePag;
		PHostCmd_DS_802_11_POWER_ADAPT_CFG_EXT pCmd = (PHostCmd_DS_802_11_POWER_ADAPT_CFG_EXT)&pAdapter->m_ucCmdBuffer[0];

		iePag.Header.Type=0x114;
		iePag.Header.Len=sizeof(PA_Group_t)*3;
		iePag.PA_Group[0].PowerAdaptLevel = nPowerLevel;
		iePag.PA_Group[0].RateBitmap=0x1800;
		iePag.PA_Group[1].PowerAdaptLevel = nPowerLevel;
		iePag.PA_Group[1].RateBitmap=0x07e0;
		iePag.PA_Group[2].PowerAdaptLevel = nPowerLevel;
		iePag.PA_Group[2].RateBitmap=0x000f;
	
		pCmd->Action = CMD_ACT_SET;
		pCmd->EnablePA = bEnablePA;
		MoveMemory(&pCmd->PowerAdaptGroup,pIePag,sizeof(*pIePag));
		nTxSize = MEMBER_OFFSET(HostCmd_DS_802_11_POWER_ADAPT_CFG_EXT,PowerAdaptGroup);
		nTxSize+=sizeof(pCmd->PowerAdaptGroup.Header)+pCmd->PowerAdaptGroup.Header.Len;

		CmdSetCmdInfo(pAdapter, HostCmd_CMD_802_11_POWER_ADAPT_CFG_EXT, pCmd, nTxSize, pCmd, ADAPTER_CMD_BUFFER_LENGTH);
		nRet = CmdProcessCmd(pAdapter, CMD_TIMEOUT_MAX);
		if (nRet != nTxSize)
			stat = CMD_ERROR_UNKNOWN;
	}

	CmdReleaseBuffer(pAdapter);

	return stat;
}
开发者ID:Paolo-Maffei,项目名称:webled-node,代码行数:52,代码来源:WlanCmd.c

示例15: CmdSetupScanCmd

static void CmdSetupScanCmd(PWLAN_ADAPTER pAdapter, char* pszSsid)
{
	PBYTE pCur = &pAdapter->m_ucCmdBuffer[0];
	PHostCmd_DS_802_11_SCAN pCmd = (PHostCmd_DS_802_11_SCAN) pCur;

	pCmd->BSSType = HostCmd_BSS_TYPE_ANY;
	FillMemory(pCmd->BSSID, 0xff, sizeof(pCmd->BSSID));
	pCur += MEMBER_OFFSET(HostCmd_DS_802_11_SCAN, SsIdParamSet);

	if (strlen(pszSsid) > 0) {
		MrvlIEtypes_SsIdParamSet_t* pSsid = (MrvlIEtypes_SsIdParamSet_t*)pCur;

		pSsid->Header.Type = TLV_TYPE_SSID;
		pSsid->Header.Len = (USHORT)strlen(pszSsid);
		MoveMemory(pSsid->SsId, pszSsid, strlen(pszSsid));

		pCur += sizeof(pSsid->Header) + pSsid->Header.Len;
	}
	if (1) {
		int i;
		MrvlIEtypes_ChanListParamSet_t* pChanList = (MrvlIEtypes_ChanListParamSet_t*)pCur;
		ChanScanParamSet_t* pChanScan;

		pChanList->Header.Type = TLV_TYPE_CHANLIST;
		pChanList->Header.Len = 0;
		pCur += sizeof(pChanList->Header);
		for (i = CMD_SCAN_CHANNEL_MIN; i <= CMD_SCAN_CHANNEL_MAX; i++) {
			pChanScan = (ChanScanParamSet_t*)pCur;
			pChanScan->ChanNumber = i;
			pChanScan->RadioType = HostCmd_SCAN_RADIO_TYPE_BG;
			pChanScan->ScanType = HostCmd_SCAN_TYPE_ACTIVE;
			pChanScan->MinScanTime = HostCmd_SCAN_MIN_CH_TIME;
			pChanScan->ScanTime = HostCmd_SCAN_MIN_CH_TIME;
			pChanList->Header.Len += sizeof(ChanScanParamSet_t);
			pCur += sizeof(ChanScanParamSet_t);
		}
	}
	if(1) {
		MrvlIEtypes_RatesParamSet_t* pRates=(MrvlIEtypes_RatesParamSet_t*)pCur;

		pRates->Header.Type=TLV_TYPE_RATES;
		pRates->Header.Len=sizeof(m_aSupportRate_G);
		MoveMemory(pRates->Rates, m_aSupportRate_G, pRates->Header.Len);

		pCur+=sizeof(pRates->Header)+pRates->Header.Len;
	}

	CmdSetCmdInfo(pAdapter, HostCmd_CMD_802_11_SCAN, pCmd, pCur - (PBYTE)pCmd, pCmd, ADAPTER_CMD_BUFFER_LENGTH);

	return ;
}
开发者ID:Paolo-Maffei,项目名称:webled-node,代码行数:51,代码来源:WlanCmd.c


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