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


C++ IsBadCodePtr函数代码示例

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


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

示例1: mds_CheckParamters

static CSSM_RETURN mds_CheckParamters(
	const BioAPI_MEMORY_FUNCS * pMemoryFunctions,
	MDS_FUNCS * pDlFunctions,
	MDS_HANDLE *hMds)
{
	if (IsBadReadPtr(pMemoryFunctions, sizeof(BioAPI_MEMORY_FUNCS)) ||
		IsBadCodePtr((CSSM_PROC_ADDR)pMemoryFunctions->Malloc_func) ||
		IsBadCodePtr((CSSM_PROC_ADDR)pMemoryFunctions->Free_func) ||
		IsBadCodePtr((CSSM_PROC_ADDR)pMemoryFunctions->Calloc_func) ||
		IsBadCodePtr((CSSM_PROC_ADDR)pMemoryFunctions->Realloc_func))
	{
		return CSSMERR_DL_INVALID_POINTER;
	}

	if (IsBadWritePtr(pDlFunctions, sizeof(MDS_FUNCS_PTR)))
	{
		return CSSMERR_DL_INVALID_POINTER;
	}

	if (IsBadWritePtr(hMds, sizeof(MDS_HANDLE)))
	{
		return CSSMERR_DL_INVALID_POINTER;
	}

	return CSSM_OK;
}
开发者ID:amuntasim,项目名称:jbioapi,代码行数:26,代码来源:mds.cpp

示例2: if

char *GetGroupCountsText(struct ClcData *dat,struct ClcContact *contact)
{
	static char szName[32];
	int onlineCount,totalCount;
	struct ClcGroup *group,*topgroup;
  if (IsBadCodePtr((FARPROC)contact) || IsBadCodePtr((FARPROC)dat)) return NULL;
	if(contact->type!=CLCIT_GROUP || !(dat->exStyle&CLS_EX_SHOWGROUPCOUNTS))
		return NULL;
	group=topgroup=contact->group;
	onlineCount=0;
  if (IsBadCodePtr((FARPROC)group)) return NULL;
	totalCount=group->totalMembers;
	group->scanIndex=0;
	for(;;) {
		if(group->scanIndex==group->contactCount) {
			if(group==topgroup) break;
			group=group->parent;
		}
		else if(group->contact[group->scanIndex].type==CLCIT_GROUP) {
			group=group->contact[group->scanIndex].group;
			group->scanIndex=0;
			totalCount+=group->totalMembers;
			continue;
		}
		else if(group->contact[group->scanIndex].type==CLCIT_CONTACT)
			if(group->contact[group->scanIndex].flags&CONTACTF_ONLINE && !group->contact[group->scanIndex].isSubcontact) onlineCount++;
		group->scanIndex++;
	}
	if(onlineCount==0 && dat->exStyle&CLS_EX_HIDECOUNTSWHENEMPTY) return NULL;
	_snprintf(szName,sizeof(szName),"(%u/%u)",onlineCount,totalCount);
	return mir_strdup(szName);
}
开发者ID:BackupTheBerlios,项目名称:modernb-svn,代码行数:32,代码来源:clcutils.c

示例3: main

/**
 * main
 * 
 * executable entry point
 */
INT __cdecl main(INT argc, CHAR **argv)
{
    BOOL ResultValue = 0;
  
    /*
     * Initialize the PAL and return FAILURE if this fails
     */

    if(0 != (PAL_Initialize(argc, argv)))
    {
        return FAIL;
    }     

    /* This should be readable, and return 0 */
    ResultValue = IsBadCodePtr((FARPROC)main);
    if(ResultValue != 0) 
    {
        Fail("ERROR: IsBadCodePtr returned %d instead of 0, when pointing "
             "at readable memory.\n",ResultValue);    
    }

    /* 0x00 is usually unreadable memory so the function should 
       return non zero */
    ResultValue = IsBadCodePtr((FARPROC)0x00);

    if(ResultValue == 0)
    {
        Fail("ERROR: IsBadCodePtr returned %d instead of non zero  "
             "when checking on unreadable memory.\n",ResultValue);
    }

    PAL_Terminate();
    return PASS;
}
开发者ID:ArildF,项目名称:masters,代码行数:39,代码来源:test1.c

示例4: MyStrCmp

int __cdecl MyStrCmp (const char *a, const char *b)
{
	
	if (a==NULL&&b==NULL) return 0;
	if ((int)a<1000||(int)b<1000||IsBadCodePtr((FARPROC)a)||IsBadCodePtr((FARPROC)b)) 
	{
		return 1;
	}
	//TRACE("MY\r\n");
	//undef();
	return (strcmp(a,b));
};
开发者ID:BackupTheBerlios,项目名称:modernb-svn,代码行数:12,代码来源:commonheaders.c

示例5: mdsutil_GetRecord

BioAPI_RETURN BioAPI mdsutil_GetRecord(CSSM_DL_DB_HANDLE hDLDB,
									  CSSM_QUERY Query,
									  CSSM_DB_RECORDTYPE RecordType,
									  uint32 NumAttributes,
									  CSSM_HANDLE_PTR ResultsHandle,
									  CSSM_DB_ATTRIBUTE_DATA *OutputAttributeData)
{
	CSSM_DB_UNIQUE_RECORD_PTR RecordId = NULL;
	CSSM_DB_RECORD_ATTRIBUTE_DATA OutputAttributes;
	BioAPI_RETURN retValue = CSSM_OK;

	memset (&OutputAttributes, 0, sizeof (CSSM_DB_RECORD_ATTRIBUTE_DATA));

	/* We want to get NumAttributes back */
	OutputAttributes.DataRecordType = RecordType;
	OutputAttributes.NumberOfAttributes = NumAttributes;
	OutputAttributes.AttributeData = OutputAttributeData;

	if (0 == *ResultsHandle)
	{
		if( !IsBadCodePtr((CSSM_PROC_ADDR)MDSFuncs.DataGetFirst))
		{
			retValue = MDSFuncs.DataGetFirst (hDLDB, /* DLDBHandle */
											  &Query,
											  ResultsHandle,
											  &OutputAttributes,
											  NULL,
											  &RecordId);
		}
	} else {
		if( !IsBadCodePtr((CSSM_PROC_ADDR)MDSFuncs.DataGetNext))
		{
			retValue = MDSFuncs.DataGetNext (hDLDB, /* DLDBHandle */
											 *ResultsHandle,
											 &OutputAttributes,
											 NULL,
											 &RecordId);
		}
	}

	if (retValue != CSSM_OK)
		return retValue;

	if (!IsBadCodePtr((CSSM_PROC_ADDR)MDSFuncs.FreeUniqueRecord))
		MDSFuncs.FreeUniqueRecord(hDLDB, RecordId);

	return (retValue);
}
开发者ID:mr-c,项目名称:bioapi-linux,代码行数:48,代码来源:mds_util_query.c

示例6: PatchFuncByName

// Searches for [cOrigFuncName] starting from [pOrigFirstThunk].
// Only used on Win9x, where patching by pointer doesn't seem to work
int PatchFuncByName(HMODULE hMod, PIMAGE_THUNK_DATA pOrigFirstThunk, PIMAGE_THUNK_DATA pImpFirstThunk, char* cOrigFuncName, void* pNewFunc)
{
	PIMAGE_THUNK_DATA pOT, pIT;

	// Verify that the newFunc is valid
	if(!pNewFunc || IsBadCodePtr((FARPROC)pNewFunc))	return 0;

	for(pOT = pOrigFirstThunk, pIT = pImpFirstThunk; pOT->u1.Function; pOT++, pIT++)
	{
		if((pOT->u1.Ordinal & IMAGE_ORDINAL_FLAG) != IMAGE_ORDINAL_FLAG)
        {
			PIMAGE_IMPORT_BY_NAME pByName =(PIMAGE_IMPORT_BY_NAME)((DWORD)hMod+(DWORD)(pOT->u1.AddressOfData));
            if(pByName->Name[0] == '\0')
            {
                return 0;
            }
            
            if(_stricmp(cOrigFuncName, (char*)pByName->Name) == 0)
            {
				return PatchFunc(pIT, pNewFunc);
			}
		}
	}
	// Function not found
	return 0;
}
开发者ID:nmlgc,项目名称:thvorbis,代码行数:28,代码来源:patch.c

示例7: AddItemToGroup

static int AddItemToGroup(struct ClcGroup *group,int iAboveItem)
{
	if (group==NULL) return 0;

	if(++group->contactCount>group->allocedCount) {
		group->allocedCount+=GROUP_ALLOCATE_STEP;
      //  if (group->contact) mir_free(group->contact);
		if(group->contact)	
		group->contact=(struct ClcContact*)mir_realloc(group->contact,sizeof(struct ClcContact)*group->allocedCount);
			else 
			group->contact=(struct ClcContact*)mir_alloc(sizeof(struct ClcContact)*group->allocedCount);
			
		if (group->contact==NULL||IsBadCodePtr((FARPROC)group->contact))
		{
			TRACE("!!!Bad Realloc AddItemToGroup");
			DebugBreak();
		}
	}
	memmove(group->contact+iAboveItem+1,group->contact+iAboveItem,sizeof(struct ClcContact)*(group->contactCount-iAboveItem-1));
    memset(&(group->contact[iAboveItem]),0,sizeof((group->contact[iAboveItem])));
	group->contact[iAboveItem].type=CLCIT_DIVIDER;
	//group->contact[iAboveItem].flags=0;
	memset(group->contact[iAboveItem].iExtraImage,0xFF,sizeof(group->contact[iAboveItem].iExtraImage));
  group->contact[iAboveItem].szText=NULL;
  group->contact[iAboveItem].szSecondLineText=NULL;
  group->contact[iAboveItem].szThirdLineText=NULL;
  group->contact[iAboveItem].SubAllocated=0;
  group->contact[iAboveItem].subcontacts=NULL;
	group->contact[iAboveItem].SubExpanded=0;
	
	ClearRowByIndexCache();
	return iAboveItem;
}
开发者ID:BackupTheBerlios,项目名称:modernb-svn,代码行数:33,代码来源:clcitems.c

示例8: EnsureVisible

void EnsureVisible(HWND hwnd,struct ClcData *dat,int iItem,int partialOk)
{
	int itemy,newy;
	int moved=0;
	RECT clRect;


	if (dat==NULL||IsBadCodePtr((void *)dat)||!dat->row_heights) 
	{
		TRACE("dat is null __FILE____LINE__");
		return ;
	};

	GetClientRect(hwnd,&clRect);
	itemy=RowHeights_GetItemTopY(dat,iItem);
	if(partialOk) {
		if(itemy+dat->row_heights[iItem]-1<dat->yScroll) {newy=itemy; moved=1;}
		else if(itemy>=dat->yScroll+clRect.bottom) {newy=itemy-clRect.bottom+dat->row_heights[iItem]; moved=1;}
	}
	else {
		if(itemy<dat->yScroll) {newy=itemy; moved=1;}
		else if(itemy>=dat->yScroll+clRect.bottom-dat->row_heights[iItem]) {newy=itemy-clRect.bottom+dat->row_heights[iItem]; moved=1;}
	}
	if(moved)
		ScrollTo(hwnd,dat,newy,0);
}
开发者ID:BackupTheBerlios,项目名称:modernb-svn,代码行数:26,代码来源:clcutils.c

示例9: DirectDrawEnumerateExA

HRESULT
WINAPI
DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA lpCallback,
                       LPVOID lpContext,
                       DWORD dwFlags)
{
    HKEY hKey;
    DWORD cbData = 0;
    DWORD Value = 0;
    LONG rc;
    BOOL  EnumerateAttachedSecondaries = FALSE;
    DWORD privateDWFlags = 0;
    CHAR strMsg[RC_STRING_MAX_SIZE];
    HRESULT retVal = DDERR_INVALIDPARAMS;

    DX_WINDBG_trace();

    if ((IsBadCodePtr((LPVOID)lpCallback) == 0) &&
       ((dwFlags & ~(DDENUM_NONDISPLAYDEVICES |
                    DDENUM_DETACHEDSECONDARYDEVICES |
                    DDENUM_ATTACHEDSECONDARYDEVICES)) == 0))
    {
        LoadStringA(hDllModule, STR_PRIMARY_DISPLAY, (LPSTR)&strMsg, RC_STRING_MAX_SIZE);

        rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, REGSTR_PATH_DDHW, &hKey);
        if (rc == ERROR_SUCCESS)
        {
            /* Enumerate Attached Secondaries */
            cbData = sizeof(DWORD);
            rc = RegQueryValueExA(hKey, "EnumerateAttachedSecondaries", NULL, NULL, (LPBYTE)&Value, &cbData);
            if (rc == ERROR_SUCCESS)
            {
                if (Value != 0)
                {
                    EnumerateAttachedSecondaries = TRUE;
                    privateDWFlags = DDENUM_ATTACHEDSECONDARYDEVICES;
                }
            }
            RegCloseKey(hKey);
        }

        /* Call the user supplied callback function */
        rc = lpCallback(NULL, strMsg, "display", lpContext, NULL);

        /* If the callback function returns DDENUMRET_CANCEL, we will stop enumerating devices */
        if(rc == DDENUMRET_CANCEL)
        {
            retVal = DD_OK;
        }
        else
        {
            // not finished
            retVal = DDERR_UNSUPPORTED;
        }
    }

    return retVal;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:58,代码来源:main.c

示例10: PreReadConsoleInput

// Helper function
void PreReadConsoleInput(HANDLE hConIn, DWORD nFlags/*enum CEReadConsoleInputFlags*/, CESERVER_CONSOLE_APP_MAPPING** ppAppMap = NULL)
{
	#if defined(_DEBUG) && defined(PRE_PEEK_CONSOLE_INPUT)
	INPUT_RECORD ir = {}; DWORD nRead = 0, nBuffer = 0;
	BOOL bNumGot = GetNumberOfConsoleInputEvents(hConIn, &nBuffer);
	BOOL bConInPeek = nBuffer ? PeekConsoleInputW(hConIn, &ir, 1, &nRead) : FALSE;
	#endif

	if (gbPowerShellMonitorProgress)
	{
		CheckPowershellProgressPresence();
	}

	if (gbCurDirChanged)
	{
		gbCurDirChanged = false;

		if (ghConEmuWndDC)
		{
			if (gFarMode.cbSize
				&& gFarMode.OnCurDirChanged
				&& !IsBadCodePtr((FARPROC)gFarMode.OnCurDirChanged))
			{
				gFarMode.OnCurDirChanged();
			}
			else
			{
				CmdArg szDir;
				if (GetDirectory(szDir) > 0)
				{
					// Sends CECMD_STORECURDIR into RConServer
					SendCurrentDirectory(ghConWnd, szDir);
				}
			}
		}
	}

	if (!(nFlags & rcif_Peek))
	{
		// On the one hand - there is a problem with unexpected Enter/Space keypress
		// github#19: After executing php.exe from command prompt (it runs by Enter KeyDown)
		//            the app gets in its input queue unexpected Enter KeyUp
		// On the other hand - application must be able to understand if the key was released
		// Powershell's 'get-help Get-ChildItem -full | out-host -paging' or Issue 1927 (jilrun.exe)
		CESERVER_CONSOLE_APP_MAPPING* pAppMap = gpAppMap ? gpAppMap->Ptr() : NULL;
		if (pAppMap)
		{
			DWORD nSelfPID = GetCurrentProcessId();
			if (nFlags & rcif_LLInput)
				pAppMap->nReadConsoleInputPID = nSelfPID;
			else
				pAppMap->nReadConsolePID = nSelfPID;
			pAppMap->nLastReadInputPID = nSelfPID;
			pAppMap->nActiveAppFlags = gnExeFlags;
			if (ppAppMap) *ppAppMap = pAppMap;
		}
	}
}
开发者ID:qyqx,项目名称:ConEmu,代码行数:59,代码来源:hkConsoleInput.cpp

示例11: SetDropDownMenuCallBack

//-----------------------------------------------------------------------------
// Name: SetDropDownMenuCallBack
// Object: set drop down menu callback
// Parameters :
//     in  : tagDropDownMenuCallBack pDropDownMenuCallBack : pointer to callback
//           PVOID UserParam : user parameter that will be transmit to callback
//     out :
//     return : TRUE on success, FALSE on error
//-----------------------------------------------------------------------------
BOOL CToolbar::SetDropDownMenuCallBack(tagDropDownMenuCallBack pDropDownMenuCallBack,PVOID UserParam)
{
    if (IsBadCodePtr((FARPROC)pDropDownMenuCallBack))
        return FALSE;

    this->pDropDownMenuCallBack=pDropDownMenuCallBack;
    this->DropDownMenuUserParam=UserParam;
    return TRUE;
}
开发者ID:340211173,项目名称:hf-2011,代码行数:18,代码来源:Toolbar.cpp

示例12: IsValidInterface

/******************************************************************************
 *		IsValidInterface	[[email protected]]
 *
 * Determines whether a pointer is a valid interface.
 *
 * PARAMS
 *  punk [I] Interface to be tested.
 *
 * RETURNS
 *  TRUE, if the passed pointer is a valid interface, or FALSE otherwise.
 */
BOOL WINAPI IsValidInterface(LPUNKNOWN punk)
{
	return !(
		IsBadReadPtr(punk,4)					||
		IsBadReadPtr(punk->lpVtbl,4)				||
		IsBadReadPtr(punk->lpVtbl->QueryInterface,9)	||
		IsBadCodePtr((FARPROC)punk->lpVtbl->QueryInterface)
	);
}
开发者ID:pstrealer,项目名称:wine,代码行数:20,代码来源:ifs.c

示例13: SetElementEventsCallBackEx

//-----------------------------------------------------------------------------
// Name: SetElementEventsCallBackEx
// Object: set extended document events callback
// Parameters :
//     in  : 
//     out : 
//     return : 
//-----------------------------------------------------------------------------
BOOL CElementEvents::SetElementEventsCallBackEx(pfElementEventsCallBackEx ElementEventsCallBackEx,LPVOID UserParam)
{
    if (IsBadCodePtr((FARPROC)ElementEventsCallBackEx) && (ElementEventsCallBackEx!=0))
        return FALSE;

    this->ElementEventsCallBackEx=ElementEventsCallBackEx;
    this->ElementEventsCallBackExUserParam=UserParam;

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

示例14: SetElementEventsCallBack

//-----------------------------------------------------------------------------
// Name: SetElementsEventsCallBack
// Object: set simple document events callback
// Parameters :
//     in  : 
//     out : 
//     return : 
//-----------------------------------------------------------------------------
BOOL CElementEvents::SetElementEventsCallBack(pfElementEventsCallBack ElementEventsCallBack,LPVOID UserParam)
{
    if (IsBadCodePtr((FARPROC)ElementEventsCallBack) && (ElementEventsCallBack!=0))
        return FALSE;

    this->ElementEventsCallBack=ElementEventsCallBack;
    this->ElementEventsCallBackUserParam=UserParam;

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

示例15: CalculateLength

	uint32_t CalculateLength() {
		uint32_t dwIndex = 0;
		if (!m_pOriginalVMTable) return 0;
		for (dwIndex = 0; m_pOriginalVMTable[dwIndex]; dwIndex++) {
			if (IsBadCodePtr((FARPROC)m_pOriginalVMTable[dwIndex])) {
				break;
			}
		}
		return dwIndex;
	}
开发者ID:sstokic-tgm,项目名称:HSDK,代码行数:10,代码来源:VMTManager.hpp


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