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

C++ IsBadReadPtr函数代码示例

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

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



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

示例1: MessageBoxIndirectW_new

/* MAKE_EXPORT MessageBoxIndirectW_new=MessageBoxIndirectW */
int WINAPI MessageBoxIndirectW_new(const LPMSGBOXPARAMSW lpMsgBoxParams)
{
	LPSTR lpszText = NULL;
	LPSTR lpszCaption = NULL;
	LPSTR lpszIcon = NULL;
	MSGBOXPARAMSA mbp;

	if(IsBadReadPtr(lpMsgBoxParams, sizeof(MSGBOXPARAMSW)))
		return 0;

	memcpy(&mbp, lpMsgBoxParams, sizeof(MSGBOXPARAMSA));

	STACK_WtoA(lpMsgBoxParams->lpszText, lpszText);
	STACK_WtoA(lpMsgBoxParams->lpszCaption, lpszCaption);
	STACK_WtoA(lpMsgBoxParams->lpszIcon, lpszIcon);

	mbp.lpszText = lpszText;
	mbp.lpszCaption = lpszCaption;
	mbp.lpszIcon = lpszIcon;

	return MessageBoxIndirectA(&mbp);
}
开发者ID:metaxor,项目名称:KernelEx,代码行数:23,代码来源:uniuser32.c


示例2: Accept

BOOL 
CNamedPipeTransport::
Accept(
	LPOVERLAPPED lpOverlapped)
{
	_ASSERTE(
		(NULL == lpOverlapped) || 
		(!IsBadReadPtr(lpOverlapped, sizeof(OVERLAPPED)) &&
        NULL != lpOverlapped->hEvent &&
		INVALID_HANDLE_VALUE != lpOverlapped->hEvent));

	BOOL fConnected = ::ConnectNamedPipe(m_hPipe, lpOverlapped);

	if (fConnected) {
		XTLTRACE1(TRACE_LEVEL_VERBOSE, 
			"Accepting a new connection.\n");
		return TRUE;
	}

	if (lpOverlapped) {
		// if overlapped operation ConnectNamedPipe should return FALSE;
		DWORD dwError = ::GetLastError();
		switch (dwError) {
		case ERROR_PIPE_CONNECTED:	
			::SetEvent(lpOverlapped->hEvent);
			// omitting break is intentional
		case ERROR_IO_PENDING:
			XTLTRACE1(TRACE_LEVEL_INFORMATION, 
				"Accepting a new connection.\n");
			return TRUE;
		default: // An error occurs during the connect operation
			XTLTRACE1(TRACE_LEVEL_ERROR, 
				"ConnectNamedPipe failed, error=0x%X\n", GetLastError());
			return FALSE;
		}
	}

	return FALSE;
}
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:39,代码来源:transport.cpp


示例3: unit_useMenu

INT unit_useMenu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
	CDebug cDbg("unit useMenu");

	myUnit* lpUnit = (myUnit*)JS_GetPrivate(cx, obj);
	*rval = JSVAL_FALSE;

	if(argc < 1 || !JSVAL_IS_INT(argv[0]))
		return JS_TRUE;

	if(!lpUnit || IsBadReadPtr(lpUnit, sizeof(myUnit)) || lpUnit->_dwPrivateType != PRIVATE_UNIT)
		return JS_TRUE;

	UnitAny* pUnit = D2CLIENT_FindUnit(lpUnit->dwUnitId, lpUnit->dwType);

	if(!pUnit)
		return JS_TRUE;

	*rval = BOOLEAN_TO_JSVAL(ClickNPCMenu(pUnit->dwTxtFileNo, JSVAL_TO_INT(argv[0])));

	return JS_TRUE;
}
开发者ID:ds-hwang,项目名称:d2bs,代码行数:22,代码来源:JSUnit.cpp


示例4: invokeResponseCallback

//请求返回后,调用回调函数
void BaseHTTPRequestHandler::invokeResponseCallback(char *buf,size_t len) {

    CALLBACK_DATA callback_data;
    if(buf == NULL || len == 0)
        return;

    if(IsBadReadPtr(buf,len))
        return;

    memset(&callback_data, 0, sizeof(CALLBACK_DATA));
    callback_data.buf=(char*)malloc(len);
    memset(callback_data.buf,0,len);
    memcpy_s(callback_data.buf,len,buf,len);

    m_pHttpService_Params->response_callback(&callback_data);

    //处理完之后,清理掉内存
    if (callback_data.buf != NULL) {
        free(callback_data.buf);
        callback_data.buf = NULL;
    }
}
开发者ID:xxxxnnxxxx,项目名称:HttpProxy,代码行数:23,代码来源:BaseHTTPRequestHandler.cpp


示例5: lock

int	CStockManager::GetStocksList(CArray<CodeInfo>* pArInfo, CArray<StockUserInfo>& stockInfo, BOOL bCompareOnlyMainMarket)
{
	if ( m_ayStocks.GetCount() <= 0)
	{
		return 0;
	}
	if (pArInfo != NULL )
	{
		CHSDSStockInfoIntact* pStock = NULL;
		CSingleLock lock(&m_mutexStock);
		if (lock.Lock())
		{
			if (pArInfo->GetSize() > 0)
			for ( int i=0; i<pArInfo->GetCount(); i++ )
			{
				CodeInfo* pCode = &pArInfo->GetAt(i);
				if ( pCode && !IsBadReadPtr(pCode, sizeof(CodeInfo)))
				{
					int nIndex = -1;
					m_mapIndex.Lookup(pCode->GetCode(), (CObject*&)nIndex);
					if ( nIndex >=0 && nIndex<m_ayStocks.GetCount() )
					{
						CHSDSStockInfoIntact* pStock = m_ayStocks.GetAt(nIndex);
						if (pStock != NULL)
						{
							StockUserInfo stock;
							memset(&stock, 0, sizeof(StockUserInfo));
							stock.Copy(&pStock->m_stockInfo);
							stockInfo.Add(stock);
						}
					}
				}
			}
		}
		lock.Unlock();
		return stockInfo.GetSize();
	}
	return 0;
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:39,代码来源:stockManager.cpp


示例6: dll_intercept

static int dll_intercept(register void* addr)
{
	IMAGE_DOS_HEADER*	dosp = (IMAGE_DOS_HEADER*)addr;
	IMAGE_NT_HEADERS*	ntp;
	IMAGE_EXPORT_DIRECTORY*	exp;
	register int		i;
	register int		j;
	register int		base;
	DWORD*			names;
	WORD*			ordinals;
	DWORD*			functions;
	char*			name;
	void*			fun;

	if (IsBadReadPtr(addr, sizeof(*dosp)))
		return 0;
	if (dosp->e_magic != IMAGE_DOS_SIGNATURE)
		return 0;
	ntp = ptr(IMAGE_NT_HEADERS, dosp, dosp->e_lfanew);
	exp = ptr(IMAGE_EXPORT_DIRECTORY, addr, ntp->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress);
	if ((void*)exp == (void*)ntp)
		return 1;
	base = exp->Base - 1;
	names = ptr(DWORD, addr, exp->AddressOfNames);
	ordinals = ptr(WORD, addr, exp->AddressOfNameOrdinals);
	functions = ptr(DWORD, addr, exp->AddressOfFunctions);
	for (i = j = 0; i < (int)exp->NumberOfNames; i++)
	{
		name = ptr(char, addr, names[i]);
		if (strcmp(name, sys_call[j].name) == 0)
		{
			fun = ptr(void, addr, functions[ordinals[i]-base]);
			sys_call[j].actual = (Syscall_f)fun;
			trace_error(-2, "%3d %3d %p %s", i, j, fun, name);
			if (++j >= elementsof(sys_call))
				return 1;
		}
	}
开发者ID:braincat,项目名称:uwin,代码行数:38,代码来源:tracedll.c


示例7: VFindNextFileW

NEWAPI
BOOL
WINAPI
VFindNextFileW(
	HANDLE hFindFile,
	LPWIN32_FIND_DATAW lpFindFileData
	)
{
	BOOL retValue = FALSE;

	//find a file
	RESTORE_API(FindNextFileW);
	OLDCALL(FindNextFileW, 2);
	REPLACE_API(FindNextFileW);

	if (retValue)
	{
		if (!IsBadReadPtr(lpFindFileData, sizeof(WIN32_FIND_DATAW)))
		{
			//while we are finding a hidden file
			RESTORE_API(FindNextFileW);
			while (posw0(lpFindFileData->cFileName) != MAXDWORD)
			{
				//get next file
				retValue = FindNextFileW(hFindFile, lpFindFileData);

				//if there is no file to get then fail
				if (!retValue)
				{
					//we keep the error from FindNextFileW, NO SetLastError(ERROR_NO_MORE_FILES);
					break;
				}
			}
			REPLACE_API(FindNextFileW);
		}
	}
	return retValue;
}
开发者ID:Artorios,项目名称:rootkit.com,代码行数:38,代码来源:vHideFiles.cpp


示例8: recPaketProcces_BATTLE_PRACTICE_BATTINGTRADE_CANCEL

void CGonryunPractice_Decoder::
recPaketProcces_BATTLE_PRACTICE_BATTINGTRADE_CANCEL(playerCharacter_t* pPlayer)
{
	if((TRUE == IsBadWritePtr(pPlayer,sizeof(playerCharacter_t))) ||
	   (TRUE == IsBadReadPtr(pPlayer,sizeof(playerCharacter_t)))) {
		
		return;
	}

	if( (playerCharacter_t::tagGonryunBattlePractice::MEMBERSHIP_LEADER != pPlayer->GonryunBattlePractice.MemberShip) &&
	(playerCharacter_t::tagGonryunBattlePractice::MEMBERSHIP_OPENENT != pPlayer->GonryunBattlePractice.MemberShip) ) {
		GTH_DisconnectPlayer(pPlayer,FALSE);
		return;
	}

	int Tagetidx = MSG_ReadShort();
	playerCharacter_t* pTargetPlayer= gcpTools->GetPlayerRecordPointer(Tagetidx);

	if(NULL == pTargetPlayer){
		GTH_DisconnectPlayer(pPlayer,FALSE);
		return;
	}
	
	if( (playerCharacter_t::tagGonryunBattlePractice::MEMBERSHIP_LEADER != pTargetPlayer->GonryunBattlePractice.MemberShip) &&
	(playerCharacter_t::tagGonryunBattlePractice::MEMBERSHIP_OPENENT != pTargetPlayer->GonryunBattlePractice.MemberShip) ) {
		GTH_DisconnectPlayer(pPlayer,FALSE);
		return;
	}

	pPlayer->GonryunBattlePractice.bBattingOkSignal = FALSE;
	pPlayer->GonryunBattlePractice.bBattingAdmitSignal = FALSE;
	
	pTargetPlayer->GonryunBattlePractice.bBattingOkSignal = FALSE;
	pTargetPlayer->GonryunBattlePractice.bBattingAdmitSignal = FALSE;

	m_cpVirtualEncoder->SendMessage_BattingTrade_CancelBatting( pPlayer, TRUE );
	m_cpVirtualEncoder->SendMessage_BattingTrade_CancelBatting( pTargetPlayer,FALSE );
}
开发者ID:gthgame,项目名称:gth,代码行数:38,代码来源:CGonryunPractice_Decoder.cpp


示例9: GetValue

// Get string file info.
// Key name is something like "CompanyName".
BOOL CVersion::GetValue(LPCTSTR lpKeyName,LPTSTR szValue)
{
    TCHAR sz[MAX_PATH];
    UINT iLenVal;
    LPVOID lpvi;

    if (!this->pVersionInfo)
        return FALSE;

    if (IsBadWritePtr(szValue,1))
        return FALSE;

    if (IsBadReadPtr(lpKeyName,1))
        return FALSE;

    *szValue=0;

    // To get a string value must pass query in the form
    //
    //    "\StringFileInfo\<langID><codepage>\keyname"
    //
    // where <lang-codepage> is the languageID concatenated with the
    // code page, in hex. Wow.
    //

    _stprintf(sz,_TEXT("\\StringFileInfo\\%04x%04x\\%s"),
        this->LangAndCodePage.wLanguage,
        this->LangAndCodePage.wCodePage,
        lpKeyName);

    if(!VerQueryValue(this->pVersionInfo,sz,&lpvi,&iLenVal))
        return FALSE;
    if (iLenVal>MAX_PATH)
        iLenVal=MAX_PATH;
    memcpy(szValue,lpvi,iLenVal*sizeof(TCHAR));

    return TRUE;
}
开发者ID:340211173,项目名称:hf-2011,代码行数:40,代码来源:Version.cpp


示例10: guard

BOOL CHSDownloadData::DownLoadData()
{
	CriticalGuard guard(&m_critical);
	long lLen;
	StockUserInfo* pStock = NULL;
	short nPeriod;
	SetTaskMask(m_nCulType);
	m_nCulType ++;
	if ( m_nCulType >= 4)
		m_nCulType = 1;
	GetNextCode(&pStock, nPeriod);
	char* pBuffer = MakeReqPacket(&pStock->m_ciStockCode,nPeriod,lLen);

	if(pBuffer == NULL)
	{
		DownLoadData();
	}
	else
	{
		HSMarketDataType market = pStock->m_ciStockCode.m_cCodeType & 0xF000;
		char cServerType = CEV_Connect_HQ;

		if(market == FUTURES_MARKET)
		{
			//cServerType = CEV_Connect_QH;  //期货
		}

		if (market == HK_MARKET)
		{
			//cServerType = CEV_Connect_GG;  //港股
		}
		if ( m_pDataSource && !IsBadReadPtr(m_pDataSource,1))
			m_pDataSource->HSDataSource_RequestAsyncData(m_nDataSourceID,pBuffer,lLen,-1,e_DataSouceSend_Normal|e_DataSourceSend_HQDataDownLoad,
			                     m_lHandle);
		TRACE2("\r\n send packet code:%s, nPeriod:%d \r\n", pStock->GetName(),nPeriod);
	}
	return TRUE;	
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:38,代码来源:HSDownloadData.cpp


示例11: recPaketProcces_BATTLE_PRACTICE_BATTINGTRADE_OK

void CGonryunPractice_Decoder::
recPaketProcces_BATTLE_PRACTICE_BATTINGTRADE_OK(playerCharacter_t* pPlayer)
{
	if((TRUE == IsBadWritePtr(pPlayer,sizeof(playerCharacter_t))) || 
	   (TRUE == IsBadReadPtr(pPlayer,sizeof(playerCharacter_t)))) {
		
		return;
	}
	
	int TargetIdx = MSG_ReadShort();
	playerCharacter_t* pTargetPlayer= gcpTools->GetPlayerRecordPointer(TargetIdx);
	
	if(NULL == pTargetPlayer) {
	
		GTH_DisconnectPlayer(pPlayer,FALSE);
		return;	
	}

	pPlayer->GonryunBattlePractice.bBattingOkSignal = TRUE;
	m_cpVirtualEncoder->SendMessage_BattingTrade_OkBatting( pPlayer, TRUE );
	m_cpVirtualEncoder->SendMessage_BattingTrade_OkBatting( pTargetPlayer, FALSE );
	
}
开发者ID:gthgame,项目名称:gth,代码行数:23,代码来源:CGonryunPractice_Decoder.cpp


示例12: hexdump8

static char * hexdump8(char * out,unsigned address,const char * msg,int from,int to)
{
	unsigned max = (to-from)*16;
	if (!IsBadReadPtr((const void*)(address+(from*16)),max))
	{
		out += sprintf(out,"%s (%08Xh):",msg,address);
		unsigned n;
		const unsigned char * src = (const unsigned char*)(address)+(from*16);
		
		for(n=0;n<max;n++)
		{
			if (n%16==0)
			{
				out += sprintf(out,"\n%08Xh: ",src);
			}

			out += sprintf(out," %02X",*(src++));
		}
		*(out++) = '\n';
		*out=0;
	}
	return out;
}
开发者ID:Annovae,项目名称:desmume,代码行数:23,代码来源:crash_info.cpp


示例13: ReplaceToolTipText

//-----------------------------------------------------------------------------
// Name: ReplaceText
// Object: change text of a button
// Parameters :
//     in  : int ButtonID : button id
//           TCHAR* NewToolTipText : new text associated with tooltip
//     out :
//     return : TRUE on success, FALSE on error
//-----------------------------------------------------------------------------
BOOL CToolbar::ReplaceToolTipText(int ButtonID,TCHAR* NewToolTipText)
{
    TBBUTTONINFO  ButtonInfo={0};
    // retrieve button param
    ButtonInfo.dwMask=TBIF_LPARAM;
    ButtonInfo.cbSize=sizeof(TBBUTTONINFO);

    // get button info
    if (SendMessage( this->hwndTB,(UINT) TB_GETBUTTONINFO,(WPARAM) ButtonID,(LPARAM) &ButtonInfo)==-1)
        return FALSE;

    if (IsBadReadPtr((PVOID)ButtonInfo.lParam,sizeof(CToolbarButtonUserData)))
        return FALSE;

    // change tooltip
    ((CToolbarButtonUserData*)ButtonInfo.lParam)->SetToolTip(NewToolTipText);

    // set button info
    if (SendMessage( this->hwndTB,(UINT) TB_SETBUTTONINFO,(WPARAM) ButtonID,(LPARAM) &ButtonInfo)==-1)
        return FALSE;

    return TRUE;
}
开发者ID:340211173,项目名称:hf-2011,代码行数:32,代码来源:Toolbar.cpp


示例14: get_valid_frame

PBYTE get_valid_frame(PBYTE esp)
{
	PDWORD cur_stack_loc = NULL;
	const int max_search = 400;
	WCHAR	module_name[MAX_PATH];
	PBYTE	module_addr = 0;

	// round to highest multiple of four
	esp = (esp + (4 - ((int)esp % 4)) % 4);

	// scroll through stack a few hundred places.
	for (cur_stack_loc = (PDWORD) esp; cur_stack_loc < (PDWORD)esp + max_search; cur_stack_loc += 1)
	{
		// if you can read the pointer,
		if (IsBadReadPtr(cur_stack_loc, sizeof(PDWORD)))
		{
			continue;
		}

		//  check if it's in a module
		if (!Get_Module_By_Ret_Addr((PBYTE)*cur_stack_loc, module_name, module_addr))
		{
			continue;
		}

		// check if the code before the instruction ptr is a call 
		if(!has_valid_call_before(cur_stack_loc))
		{
			continue;
		}
		
		// if these all pass, return that ebp, otherwise continue till we're dead
		return (PBYTE)(cur_stack_loc - 1);
	}

	return NULL;
}
开发者ID:VirtualReality,项目名称:Viewer,代码行数:37,代码来源:llwindebug.cpp


示例15: stack_first

bool dbgsymengine::stack_first (CONTEXT* pctx)
{
	if (!pctx || IsBadReadPtr(pctx, sizeof(CONTEXT))) 
		return false;

	if (!check())
		return false;

	if (!m_pframe) 
	{
		m_pframe = new STACKFRAME;
		if (!m_pframe) return false;
	}
				
	memset(m_pframe, 0, sizeof(STACKFRAME));

    #ifdef _X86_
    m_pframe->AddrPC.Offset       = pctx->Eip;
    m_pframe->AddrPC.Mode         = AddrModeFlat;
    m_pframe->AddrStack.Offset    = pctx->Esp;
    m_pframe->AddrStack.Mode      = AddrModeFlat;
    m_pframe->AddrFrame.Offset    = pctx->Ebp;
    m_pframe->AddrFrame.Mode      = AddrModeFlat;
    #else
    m_pframe->AddrPC.Offset       = (DWORD)pctx->Fir;
    m_pframe->AddrPC.Mode         = AddrModeFlat;
    m_pframe->AddrReturn.Offset   = (DWORD)pctx->IntRa;
    m_pframe->AddrReturn.Mode     = AddrModeFlat;
    m_pframe->AddrStack.Offset    = (DWORD)pctx->IntSp;
    m_pframe->AddrStack.Mode      = AddrModeFlat;
    m_pframe->AddrFrame.Offset    = (DWORD)pctx->IntFp;
    m_pframe->AddrFrame.Mode      = AddrModeFlat;
    #endif

	m_pctx = pctx;
	return stack_next();
}
开发者ID:jjuiddong,项目名称:Dx3D-Study,代码行数:37,代码来源:dbgsymengine.cpp


示例16: while

int KFuncTable::InterceptWin32(const char *ModuleName, const char * baseAddress)
{
	int no = 0;

    PIMAGE_DOS_HEADER pDOSHeader = (PIMAGE_DOS_HEADER) baseAddress;
    
    if ( IsBadReadPtr(baseAddress, sizeof(PIMAGE_NT_HEADERS)) )
        return 0;
    
    if ( pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE )
        return 0;

    PIMAGE_NT_HEADERS pNTHeader = (PIMAGE_NT_HEADERS) ( baseAddress + pDOSHeader->e_lfanew);
    if ( pNTHeader->Signature != IMAGE_NT_SIGNATURE )
        return 0;
    
    PIMAGE_IMPORT_DESCRIPTOR pImportDesc = 
		(PIMAGE_IMPORT_DESCRIPTOR) ( baseAddress + 
		pNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress );
                        
    // Bail out if the RVA of the imports section is 0 (it doesn't exist)
    if ( pImportDesc == (PIMAGE_IMPORT_DESCRIPTOR) pNTHeader )
        return 0;

    while ( pImportDesc->Name )
    {
        no += InterceptWin32(ModuleName,
                             (const char *) ( baseAddress + pImportDesc->Name ),
                             (PIMAGE_THUNK_DATA) ( baseAddress + (unsigned) pImportDesc->OriginalFirstThunk),
                             (PIMAGE_THUNK_DATA) ( baseAddress + (unsigned) pImportDesc->FirstThunk),
                             baseAddress);
        pImportDesc++;
    }
    
    return no;
}
开发者ID:b2kguga,项目名称:CodesAndNotes,代码行数:36,代码来源:Function.cpp


示例17: BuildStackTrace

void BuildStackTrace( char* buffer, int size ) {
	int i, j;
	DWORD* sp;
	DWORD stackTrace[MAX_STACK_TRACE_LINES];

	sp = ( DWORD * )( m_exPointers->ContextRecord->Ebp );
	for ( i = 0; i < MAX_STACK_TRACE_LINES; i++ ) {
		if ( !IsBadReadPtr( sp, sizeof( DWORD ) ) && *sp ) {
			DWORD* np = (DWORD*)*sp;
			stackTrace[i] = *( sp + 1 );

			sp = np;
		} else {
			stackTrace[i] = 0;
		}
	}

	for ( i = 0; i < MAX_STACK_TRACE_LINES; i++ ) {
		if ( i == 0 ) {
			Q_strcat( buffer, size, "Stack Trace    : " );
		} else {
			Q_strcat( buffer, size, "               : " );
		}

		for ( j = 0; j < 4 && i < MAX_STACK_TRACE_LINES; i++, j++ ) {
			char minibuffer[16];
			Com_sprintf( minibuffer, sizeof( minibuffer ), "%.8x ", stackTrace[i] );

			Q_strcat( buffer, size, minibuffer );
		}

		Q_strcat( buffer, size, "\r\n" );
	}

//		MessageBox( g_hWnd, buffer, "Arf!", MB_OK );
}
开发者ID:ethr,项目名称:ETXrealPro,代码行数:36,代码来源:win_eh.cpp


示例18: get_pdata_string

static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
{
	int index=params[1];
	CHECK_ENTITY(index);

	int iOffset=params[2];
	CHECK_OFFSET(iOffset);

#if defined( __linux__ )
	iOffset += params[6];
#elif defined( __APPLE__ )
	// Use Linux offset in older plugins
	if (params[0] / sizeof(cell) == 6 || params[7] == CELL_MIN)
		iOffset += params[6];
	else
		iOffset += params[7];
#endif
	edict_t *pEdict = TypeConversion.id_to_edict(index);

	char *szData;
	if (params[5])
	{
		szData = get_pdata<char*>(pEdict, iOffset);
	} else {
		szData = get_pdata_direct<char*>(pEdict, iOffset);
	}

	if (IsBadReadPtr(szData, 1))
	{
		return 0;
	}

	MF_SetAmxString(amx, params[3], szData, params[4]);

	return 1;
}
开发者ID:HamletEagle,项目名称:amxmodx,代码行数:36,代码来源:pdata.cpp


示例19: FixThunk

	BOOL FixThunk(LONG dwLong)
	{
		_WndProcThunk* pThunk = (_WndProcThunk*)dwLong;

		MEMORY_BASIC_INFORMATION mbi;
		DWORD dwOldProtect;

		if (IsBadReadPtr(pThunk, sizeof(_WndProcThunk)) || !CheckThunk(pThunk))
		{
			return TRUE;
		}

		if (VirtualQuery((LPCVOID)pThunk, &mbi, sizeof(MEMORY_BASIC_INFORMATION)) == 0)
		{
			return FALSE;
		}
		// The memory is already PAGE_EXECUTE_READWRITE, so don't need fixing
		if (mbi.AllocationProtect == PAGE_EXECUTE_READWRITE)
		{
			return TRUE;
		}

		return VirtualProtect((LPVOID)pThunk, sizeof(_WndProcThunk), PAGE_EXECUTE_READWRITE, &dwOldProtect);
	}
开发者ID:jiaofeng,项目名称:COBA,代码行数:24,代码来源:AtlDepHook.cpp


示例20: SetMenuItemInfoW_new

/* MAKE_EXPORT SetMenuItemInfoW_new=SetMenuItemInfoW */
BOOL WINAPI SetMenuItemInfoW_new(HMENU hMenu, UINT uItem, BOOL fByPosition, LPCMENUITEMINFO lpmii)
{
	MENUITEMINFOA mii;
	BOOL result;
	LPSTR lpTypeData;

	if(IsBadReadPtr(lpmii, sizeof(MENUITEMINFOW)))
		return FALSE;

	memcpy(&mii, lpmii, sizeof(MENUITEMINFOA));

	lpTypeData = NULL;

	STACK_WtoA(lpmii->dwTypeData, lpTypeData);

	mii.dwTypeData = lpTypeData;

	result = SetMenuItemInfoA(hMenu, uItem, fByPosition, lpmii);

	if(!result)
		return FALSE;

	return TRUE;
}
开发者ID:metaxor,项目名称:KernelEx,代码行数:25,代码来源:uniuser32.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IsBag函数代码示例发布时间:2022-05-30
下一篇:
C++ IsBadCodePtr函数代码示例发布时间: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