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


C++ VERIFY函数代码示例

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


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

示例1: u32

void CWallmarksEngine::Render()
{
//	if (marks.empty())			return;
	// Projection and xform
	float	_43					= Device.mProject._43;
	Device.mProject._43			-= ps_r__WallmarkSHIFT; 
	RCache.set_xform_world		(Fidentity);
	RCache.set_xform_project	(Device.mProject);

	Fmatrix	mSavedView			= Device.mView;
	Fvector	mViewPos			;
			mViewPos.mad		(Device.vCameraPosition, Device.vCameraDirection,ps_r__WallmarkSHIFT_V);
	Device.mView.build_camera_dir	(mViewPos,Device.vCameraDirection,Device.vCameraTop);
	RCache.set_xform_view		(Device.mView);

	Device.Statistic->RenderDUMP_WM.Begin	();
	Device.Statistic->RenderDUMP_WMS_Count	= 0;
	Device.Statistic->RenderDUMP_WMD_Count	= 0;
	Device.Statistic->RenderDUMP_WMT_Count	= 0;

	float	ssaCLIP				= r_ssaDISCARD/4;

	lock.Enter		();			// Physics may add wallmarks in parallel with rendering

	for (WMSlotVecIt slot_it=marks.begin(); slot_it!=marks.end(); slot_it++){
		u32			w_offset;
		FVF::LIT	*w_verts, *w_start;
		BeginStream	(hGeom,w_offset,w_verts,w_start);
		wm_slot* slot			= *slot_it;	
		// static wallmarks
		for (StaticWMVecIt w_it=slot->static_items.begin(); w_it!=slot->static_items.end(); ){
			static_wallmark* W	= *w_it;
			if (RImplementation.ViewBase.testSphere_dirty(W->bounds.P,W->bounds.R)){
				Device.Statistic->RenderDUMP_WMS_Count++;
				float dst	= Device.vCameraPosition.distance_to_sqr(W->bounds.P);
				float ssa	= W->bounds.R * W->bounds.R / dst;
				if (ssa>=ssaCLIP)	{
					u32 w_count		= u32(w_verts-w_start);
					if ((w_count+W->verts.size())>=(MAX_TRIS*3)){
						FlushStream	(hGeom,slot->shader,w_offset,w_verts,w_start,FALSE);
						BeginStream	(hGeom,w_offset,w_verts,w_start);
					}
					static_wm_render	(W,w_verts);
				}
				W->ttl	-= 0.1f*Device.fTimeDelta;	// visible wallmarks fade much slower
			} else {
				W->ttl	-= Device.fTimeDelta;
			}
			if (W->ttl<=EPS){	
				static_wm_destroy	(W);
				*w_it				= slot->static_items.back();
				slot->static_items.pop_back();
			}else{
				w_it++;
			}
		}
		// Flush stream
		FlushStream				(hGeom,slot->shader,w_offset,w_verts,w_start,FALSE);	//. remove line if !(suppress cull needed)
		BeginStream				(hGeom,w_offset,w_verts,w_start);

		// dynamic wallmarks
		for (xr_vector<intrusive_ptr<CSkeletonWallmark> >::iterator w_it=slot->skeleton_items.begin(); w_it!=slot->skeleton_items.end(); w_it++){
			intrusive_ptr<CSkeletonWallmark> W	= *w_it;
			if (!W){
				continue	;
			}

#ifdef DEBUG
			if(W->used_in_render != Device.dwFrame)			
			{
				Log("W->used_in_render",W->used_in_render);
				Log("Device.dwFrame",Device.dwFrame);
				VERIFY(W->used_in_render == Device.dwFrame);
			}
#endif

			float dst	= Device.vCameraPosition.distance_to_sqr(W->m_Bounds.P);
			float ssa	= W->m_Bounds.R * W->m_Bounds.R / dst;
			if (ssa>=ssaCLIP){
				Device.Statistic->RenderDUMP_WMD_Count++;
				u32 w_count		= u32(w_verts-w_start);
				if ((w_count+W->VCount())>=(MAX_TRIS*3)){
					FlushStream	(hGeom,slot->shader,w_offset,w_verts,w_start,TRUE);
					BeginStream	(hGeom,w_offset,w_verts,w_start);
				}

				FVF::LIT	*w_save = w_verts;
				try {
					W->Parent()->RenderWallmark	(W,w_verts);
				} catch (...)
				{
					Msg		("! Failed to render dynamic wallmark");
					w_verts = w_save;
				}
			}
			#ifdef	DEBUG
			 W->used_in_render	= u32(-1);
			#endif
		}
		slot->skeleton_items.clear();
//.........这里部分代码省略.........
开发者ID:Karlan88,项目名称:xray,代码行数:101,代码来源:WallmarksEngine.cpp

示例2: GetActiveWin

wyInt32
EditorBase::OnContextMenuHelper(LPARAM lParam)
{
	wyBool	    nmenuselect;
	LONG	    lstyle=0;
	HMENU	    hmenu, htrackmenu;
	POINT	    pnt;
	wyInt32		pos;
    RECT        rect;
    MDIWindow*  wnd = GetActiveWin();

	VERIFY(hmenu = GetMenu(pGlobals->m_pcmainwin->m_hwndmain));

	//lStyle = GetWindowLongPtr ( m_hwndparent, GWL_STYLE );
	lstyle = GetWindowLongPtr(GetParent(m_hwndparent), GWL_STYLE);

    if ((lstyle & WS_MAXIMIZE) && wyTheme::IsSysmenuEnabled(GetParent(m_hwndparent)))
		VERIFY(htrackmenu =	GetSubMenu(hmenu, 2));
	else
		VERIFY(htrackmenu =	GetSubMenu(hmenu, 1));

	//If we are pressing the context button,then lParam is -1.
	if(lParam == -1)
	{		
		//for getting the current cursor pos.
		pos = SendMessage(m_hwnd, SCI_GETCURRENTPOS, 0, 0);
		pnt.x = SendMessage(m_hwnd, SCI_POINTXFROMPOSITION, 0, pos) ; 
		pnt.y = SendMessage(m_hwnd, SCI_POINTYFROMPOSITION, 0, pos); 
		VERIFY(ClientToScreen(m_hwnd, &pnt));
	}
	else
	{
		pnt.x = GET_X_LPARAM(lParam); 
		pnt.y = GET_Y_LPARAM(lParam); 
	}

    GetClientRect(m_hwnd, &rect);
    MapWindowPoints(m_hwnd, NULL, (LPPOINT)&rect, 2);

    if(!PtInRect(&rect, pnt))
    {
        return -1;
    }

	//VERIFY(ClientToScreen(m_hwnd, &pnt));
    SetFocus(m_hwnd);

	// Now change the menu item.
	ChangeEditMenuItem(htrackmenu);

    pGlobals->m_pcmainwin->m_connection->HandleTagsMenu((HMENU)hmenu);

    if(wnd)
    {
        //FrameWindow::RecursiveMenuEnable(htrackmenu, wyFalse, MF_ENABLED);

        if(wnd->m_executing == wyTrue || wnd->m_pingexecuting == wyTrue)
        {
            FrameWindow::RecursiveMenuEnable(htrackmenu, wyFalse, MF_DISABLED);
        }

        wyTheme::SetMenuItemOwnerDraw(htrackmenu);
	    nmenuselect = (wyBool)TrackPopupMenu(htrackmenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, pnt.x, pnt.y, 0, pGlobals->m_pcmainwin->m_hwndmain, NULL);
    }
    return 1;
}
开发者ID:Fale,项目名称:sqlyog,代码行数:66,代码来源:EditorBase.cpp

示例3: VERIFY

void	CDetailManager::hw_Render_dump		(ref_constant x_array, u32 var_id, u32 lod_id, u32 c_offset)
{
	RDEVICE.Statistic->RenderDUMP_DT_Count	= 0;

	// Matrices and offsets
	u32		vOffset	=	0;
	u32		iOffset	=	0;

	vis_list& list	=	m_visibles	[var_id];

	Fvector					c_sun,c_ambient,c_hemi;
#ifndef _EDITOR
	CEnvDescriptor&	desc	= *g_pGamePersistent->Environment().CurrentEnv;
	c_sun.set				(desc.sun_color.x,	desc.sun_color.y,	desc.sun_color.z);	c_sun.mul(.5f);
	c_ambient.set			(desc.ambient.x,	desc.ambient.y,		desc.ambient.z);
	c_hemi.set				(desc.hemi_color.x, desc.hemi_color.y,	desc.hemi_color.z);
#else
	c_sun.set				(1,1,1);	c_sun.mul(.5f);
	c_ambient.set			(1,1,1);
	c_hemi.set				(1,1,1);
#endif    

	VERIFY(objects.size()<=list.size());

	// Iterate
	for (u32 O=0; O<objects.size(); O++){
		CDetail&	Object				= *objects	[O];
		xr_vector <SlotItemVec* >& vis	= list		[O];
		if (!vis.empty()){
			// Setup matrices + colors (and flush it as nesessary)
			RCache.set_Element				(Object.shader->E[lod_id]);
			RImplementation.apply_lmaterial	();
			u32			c_base				= x_array->vs.index;
			Fvector4*	c_storage			= RCache.get_ConstantCache_Vertex().get_array_f().access(c_base);

			u32 dwBatch	= 0;

			xr_vector <SlotItemVec* >::iterator _vI = vis.begin();
			xr_vector <SlotItemVec* >::iterator _vE = vis.end();
			for (; _vI!=_vE; _vI++){
				SlotItemVec*	items		= *_vI;
				SlotItemVecIt _iI			= items->begin();
				SlotItemVecIt _iE			= items->end();
				for (; _iI!=_iE; _iI++){
					SlotItem&	Instance	= **_iI;
					u32			base		= dwBatch*4;

					// Build matrix ( 3x4 matrix, last row - color )
					float		scale		= Instance.scale_calculated;
					Fmatrix&	M			= Instance.mRotY;
					c_storage[base+0].set	(M._11*scale,	M._21*scale,	M._31*scale,	M._41	);
					c_storage[base+1].set	(M._12*scale,	M._22*scale,	M._32*scale,	M._42	);
					c_storage[base+2].set	(M._13*scale,	M._23*scale,	M._33*scale,	M._43	);

					// Build color
#if RENDER==R_R1
					Fvector C;
					C.set					(c_ambient);
//					C.mad					(c_lmap,Instance.c_rgb);
					C.mad					(c_hemi,Instance.c_hemi);
					C.mad					(c_sun,	Instance.c_sun);
					c_storage[base+3].set	(C.x,			C.y,			C.z,			1.f		);
#else
					// R2 only needs hemisphere
					float		h			= Instance.c_hemi;
					float		s			= Instance.c_sun;
					c_storage[base+3].set	(s,				s,				s,				h		);
#endif
					dwBatch	++;
					if (dwBatch == hw_BatchSize)	{
						// flush
						RDEVICE.Statistic->RenderDUMP_DT_Count					+=	dwBatch;
						u32 dwCNT_verts			= dwBatch * Object.number_vertices;
						u32 dwCNT_prims			= (dwBatch * Object.number_indices)/3;
						RCache.get_ConstantCache_Vertex().b_dirty				=	TRUE;
						RCache.get_ConstantCache_Vertex().get_array_f().dirty	(c_base,c_base+dwBatch*4);
						RCache.Render			(D3DPT_TRIANGLELIST,vOffset, 0, dwCNT_verts,iOffset,dwCNT_prims);
						RCache.stat.r.s_details.add	(dwCNT_verts);

						// restart
						dwBatch					= 0;
					}
				}
			}
			// flush if nessecary
			if (dwBatch)
			{
				RDEVICE.Statistic->RenderDUMP_DT_Count	+= dwBatch;
				u32 dwCNT_verts			= dwBatch * Object.number_vertices;
				u32 dwCNT_prims			= (dwBatch * Object.number_indices)/3;
				RCache.get_ConstantCache_Vertex().b_dirty				=	TRUE;
				RCache.get_ConstantCache_Vertex().get_array_f().dirty	(c_base,c_base+dwBatch*4);
				RCache.Render				(D3DPT_TRIANGLELIST,vOffset,0,dwCNT_verts,iOffset,dwCNT_prims);
				RCache.stat.r.s_details.add	(dwCNT_verts);
			}
			// Clean up
			vis.clear_not_free			();
		}
		vOffset		+=	hw_BatchSize * Object.number_vertices;
		iOffset		+=	hw_BatchSize * Object.number_indices;
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:xray-16,代码行数:101,代码来源:DetailManager_VS.cpp

示例4: memset

/////////////////////////////////////////////////////////////////////////////
// class AgentDisplay
AgentDisplay::AgentDisplay(MesaAgent::AgentIndex agentIndex, void * pFCB, u16 * pDisplayMem) : MesaAgent::Agent(agentIndex, pFCB)
{
    FCB * pDisplayFCB = (FCB *)pFCB;
    memset(pDisplayFCB, 0, sizeof(FCB));

    DawnView * pView = DawnApp::GetDawnView();
    CRect viewRect;
    pView->GetClientRect(&viewRect);

    // set up FCB
    pDisplayFCB->m_nDisplayType =   C_TO_MESA_UNSPECIFIED(kMonochrome);
    pDisplayFCB->m_nDisplayWidth =  C_TO_MESA_UNSPECIFIED(viewRect.Width());
    pDisplayFCB->m_nDisplayHeight = C_TO_MESA_UNSPECIFIED(viewRect.Height());
    pDisplayFCB->m_nInverseVideo =  C_TO_MESA_UNSPECIFIED(0);
    pDisplayFCB->m_n32mpBitmap =    C_TO_MESA_LONG_UNSPECIFIED((u32)pDisplayMem);

    // make sure the width is a multiple of eight
    ASSERT(0 == (viewRect.Width() % 8));
    
    // set up windows bitmap stuff
    //RGBQUAD black = { 96, 96, 96, 0 };
    //RGBQUAD white = { 192, 192, 192, 0 };
    RGBQUAD black = { 255, 0, 0, 0 };
    RGBQUAD white = { 255, 255, 255, 0 };

    m_colorBlack = black;
    m_colorWhite = white;
    m_pDisplayMemory = (u8 *)pDisplayMem;
    m_nDisplayBytesPerLine = viewRect.Width() / 8;

    m_bitmapInfo.bmiHeader.biSize = sizeof(m_bitmapInfo.bmiHeader); 
    m_bitmapInfo.bmiHeader.biWidth = viewRect.Width();
    m_bitmapInfo.bmiHeader.biHeight = -viewRect.Height(); 
    m_bitmapInfo.bmiHeader.biPlanes = 1; 
    m_bitmapInfo.bmiHeader.biBitCount = 1; 
    m_bitmapInfo.bmiHeader.biCompression = BI_RGB; 
    m_bitmapInfo.bmiHeader.biSizeImage = 0; 
    m_bitmapInfo.bmiHeader.biXPelsPerMeter = 0; 
    m_bitmapInfo.bmiHeader.biYPelsPerMeter = 0; 
    m_bitmapInfo.bmiHeader.biClrUsed = 0; 
    m_bitmapInfo.bmiHeader.biClrImportant = 0;
    m_bitmapInfo.bmiColors[0] = m_colorWhite;
    m_bitmapInfo.bmiColors[1] = m_colorBlack;

    // put a nice pattern into our bits
    unsigned char * pBits;
    for (int row = 0; row < viewRect.Height(); row++)
    {
        pBits = m_pDisplayMemory + row * m_nDisplayBytesPerLine;
        unsigned char byte = (row % 2) ? 0xAA : ~0xAA;
        //if (row < 20) byte = 0xFF; else byte = (row % 2) ? 0xFF : 0x00;
        //byte = 0x00;
        for (unsigned int col = 0; col < m_nDisplayBytesPerLine; col++) *pBits++ = byte;
    }

    // load our mp code bitmap for the cursor
    VERIFY(m_bitmapMP.LoadBitmap(IDB_BITMAP_MPCODE));

    m_hCursor = NULL;
    m_hCursorOrig = (HCURSOR)::GetClassLong(pView->GetSafeHwnd(), GCL_HCURSOR);
}
开发者ID:gcasa,项目名称:Mesa,代码行数:63,代码来源:AgentDisplay.cpp

示例5: VERIFY

bool TestExtString::test_strnatcasecmp() {
  VERIFY(f_strnatcasecmp("a", "Ab") < 0);
  return Count(true);
}
开发者ID:wanghong1987,项目名称:hiphop-php,代码行数:4,代码来源:test_ext_string.cpp

示例6: AfxGetAppSettings

BOOL CPPageOutput::OnInitDialog()
{
	__super::OnInitDialog();

	AppSettings& s = AfxGetAppSettings();

	m_iDSVideoRendererType	= s.iDSVideoRendererType;
	m_iRMVideoRendererType	= s.iRMVideoRendererType;
	m_iQTVideoRendererType	= s.iQTVideoRendererType;
	m_iAPSurfaceUsage		= s.iAPSurfaceUsage;
	m_fVMRSyncFix			= s.fVMRSyncFix;
	m_iDX9Resizer			= s.iDX9Resizer;
	m_fVMR9MixerMode		= s.fVMR9MixerMode;
	m_fVMR9MixerYUV			= s.fVMR9MixerYUV;
	m_fD3DFullscreen		= s.fD3DFullscreen;
	m_iEvrBuffers			= s.iEvrBuffers-3;

	// Multi-Monitor code
	CString str;
	m_iMonitorType = 0;

	CMonitor monitor;
	CMonitors monitors;

	m_iMonitorTypeCtrl.AddString(ResStr(IDS_FULLSCREENMONITOR_CURRENT));
	m_MonitorDisplayNames.Add(_T("Current"));
	if(s.f_hmonitor == _T("Current"))
	{
		m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1;
	}

	for ( int i = 0; i < monitors.GetCount(); i++ )
	{
		monitor = monitors.GetMonitor( i );
		monitor.GetName(str);
		
		if(monitor.IsMonitor())
		{
			DISPLAY_DEVICE displayDevice;
			ZeroMemory(&displayDevice, sizeof(displayDevice));
			displayDevice.cb = sizeof(displayDevice);
			VERIFY(EnumDisplayDevices(str, 0,  &displayDevice, 0));
						
			m_iMonitorTypeCtrl.AddString(str+_T(" - ")+displayDevice.DeviceString);
			m_MonitorDisplayNames.Add(str);
			
			if(s.f_hmonitor == str && m_iMonitorType == 0)
			{
				m_iMonitorType = m_iMonitorTypeCtrl.GetCount()-1;
			}
		}
	}

	//(m_iMonitorTypeCtrl.GetCount() > 2)	? {GetDlgItem(IDC_COMBO2)->EnableWindow(TRUE)} : GetDlgItem(IDC_COMBO2)->EnableWindow(FALSE);
	if(m_iMonitorTypeCtrl.GetCount() > 2)
	{
		GetDlgItem(IDC_COMBO2)->EnableWindow(TRUE);
	}
	else
	{
		m_iMonitorType = 0;
		GetDlgItem(IDC_COMBO2)->EnableWindow(FALSE);
	}

	m_AudioRendererDisplayNames.Add(_T(""));
	m_iAudioRendererTypeCtrl.AddString(_T("System Default"));
	m_iAudioRendererType = 0;

	BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
	{
		LPOLESTR olestr = NULL;
		if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr)))
			continue;

		CStringW str(olestr);
		CoTaskMemFree(olestr);

		m_AudioRendererDisplayNames.Add(CString(str));

		CComPtr<IPropertyBag> pPB;
		if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
		{
			CComVariant var;
			pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);

			CString fstr(var.bstrVal);

			var.Clear();
			if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
			{			
				BSTR* pbstr;
				if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr)))
				{
					fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
					SafeArrayUnaccessData(var.parray);
				}
			}

			m_iAudioRendererTypeCtrl.AddString(fstr);
		}
//.........这里部分代码省略.........
开发者ID:banduladh,项目名称:meplayer,代码行数:101,代码来源:PPageOutput.cpp

示例7: dsl_pool_create

dsl_pool_t *
dsl_pool_create(spa_t *spa, nvlist_t *zplprops, uint64_t txg)
{
	int err;
	dsl_pool_t *dp = dsl_pool_open_impl(spa, txg);
	dmu_tx_t *tx = dmu_tx_create_assigned(dp, txg);
	objset_t *os;
	dsl_dataset_t *ds;
	uint64_t obj;

	rrw_enter(&dp->dp_config_rwlock, RW_WRITER, FTAG);

	/* create and open the MOS (meta-objset) */
	dp->dp_meta_objset = dmu_objset_create_impl(spa,
	    NULL, &dp->dp_meta_rootbp, DMU_OST_META, tx);

	/* create the pool directory */
	err = zap_create_claim(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
	    DMU_OT_OBJECT_DIRECTORY, DMU_OT_NONE, 0, tx);
	ASSERT0(err);

	/* Initialize scan structures */
	VERIFY0(dsl_scan_init(dp, txg));

	/* create and open the root dir */
	dp->dp_root_dir_obj = dsl_dir_create_sync(dp, NULL, NULL, tx);
	VERIFY0(dsl_dir_hold_obj(dp, dp->dp_root_dir_obj,
	    NULL, dp, &dp->dp_root_dir));

	/* create and open the meta-objset dir */
	(void) dsl_dir_create_sync(dp, dp->dp_root_dir, MOS_DIR_NAME, tx);
	VERIFY0(dsl_pool_open_special_dir(dp,
	    MOS_DIR_NAME, &dp->dp_mos_dir));

	if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
		/* create and open the free dir */
		(void) dsl_dir_create_sync(dp, dp->dp_root_dir,
		    FREE_DIR_NAME, tx);
		VERIFY0(dsl_pool_open_special_dir(dp,
		    FREE_DIR_NAME, &dp->dp_free_dir));

		/* create and open the free_bplist */
		obj = bpobj_alloc(dp->dp_meta_objset, SPA_MAXBLOCKSIZE, tx);
		VERIFY(zap_add(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
		    DMU_POOL_FREE_BPOBJ, sizeof (uint64_t), 1, &obj, tx) == 0);
		VERIFY0(bpobj_open(&dp->dp_free_bpobj,
		    dp->dp_meta_objset, obj));
	}

	if (spa_version(spa) >= SPA_VERSION_DSL_SCRUB)
		dsl_pool_create_origin(dp, tx);

	/* create the root dataset */
	obj = dsl_dataset_create_sync_dd(dp->dp_root_dir, NULL, 0, tx);

	/* create the root objset */
	VERIFY0(dsl_dataset_hold_obj(dp, obj, FTAG, &ds));
	VERIFY(NULL != (os = dmu_objset_create_impl(dp->dp_spa, ds,
	    dsl_dataset_get_blkptr(ds), DMU_OST_ZFS, tx)));
#ifdef _KERNEL
	zfs_create_fs(os, kcred, zplprops, tx);
	//zfs_create_fs(os, kcred, ZPL_VERSION, tx);// FIXME, should be props
#endif
	dsl_dataset_rele(ds, FTAG);

	dmu_tx_commit(tx);

	rrw_exit(&dp->dp_config_rwlock, FTAG);

	return (dp);
}
开发者ID:RJVB,项目名称:zfs,代码行数:71,代码来源:dsl_pool.c

示例8: _OX_WINDOWS_VERSION

	_OX_WINDOWS_VERSION()
	{
		OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
		VERIFY(::GetVersionEx(&OSVersion));
	}
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:5,代码来源:OXNetBrowseTree.cpp

示例9: IdAuthCreateWithFork

static AuthorizationRef
IdAuthCreateWithFork(void)
{
   int fds[2] = { -1, -1, };
   pid_t child;
   AuthorizationRef auth = NULL;
   struct {
      Bool success;
      AuthorizationExternalForm ext;
   } data;
   uint8 buf;

   /*
    * XXX One more Apple bug related to thread credentials:
    *     AuthorizationCreate() incorrectly uses process instead of thread
    *     credentials. So for this code to properly work in the VMX for
    *     example, we must do this elaborate fork/handshake dance. Fortunately
    *     this function is only called once very early when a process starts.
    */

   if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
      Warning("%s: socketpair() failed.\n", __func__);
      goto out;
   }

   child = fork();
   if (child < 0) {
      Warning("%s: fork() failed.\n", __func__);
      goto out;
   }

   if (child) {
      size_t rcvd;
      int status;
      pid_t result;

      // Parent: use fds[0]

      // Wait until the child has created its process ref to the auth session.
      for (rcvd = 0; rcvd < sizeof data; ) {
         ssize_t actual;

         actual = read(fds[0], (void *)&data + rcvd, sizeof data - rcvd);
         ASSERT(actual <= sizeof data - rcvd);
         if (actual < 0) {
            ASSERT(errno == EPIPE);
            Warning("%s: parent read() failed because child died.\n",
                    __func__);
            data.success = FALSE;
            break;
         }

         rcvd += actual;
      }

      if (data.success) {
         if (AuthorizationCreateFromExternalForm(&data.ext, &auth)
             != errAuthorizationSuccess) {
            Warning("%s: parent AuthorizationCreateFromExternalForm() "
                    "failed.\n", __func__);
         }
      }

      // Tell the child it can now destroy its process ref to the auth session.
      write(fds[0], &buf, sizeof buf);

      // Reap the child, looping if we get interrupted by a signal.
      do {
         result = waitpid(child, &status, 0);
      } while (result == -1 && errno == EINTR);

      VERIFY(result == child);
   } else {
      // Child: use fds[1]

      data.success = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
                                         kAuthorizationFlagDefaults, &auth)
                     == errAuthorizationSuccess;
      if (data.success) {
         data.success = AuthorizationMakeExternalForm(auth, &data.ext)
                        == errAuthorizationSuccess;
         if (!data.success) {
            Warning("%s: child AuthorizationMakeExternalForm() failed.\n",
                    __func__);
         }
      } else {
         Warning("%s: child AuthorizationCreate() failed.\n", __func__);
      }

      // Tell the parent it can now create a process ref to the auth session.
      if (write(fds[1], &data, sizeof data) == sizeof data) {
         /*
          * Wait until the child can destroy its process ref to the auth
          * session.
          */

         for (;;) {
            ssize_t actual = read(fds[1], &buf, sizeof buf);

            ASSERT(actual <= sizeof buf);
//.........这里部分代码省略.........
开发者ID:AlissonGiron,项目名称:open-vm-tools,代码行数:101,代码来源:idLinux.c

示例10: WNetOpenEnum

BOOL COXNetBrowseTree::CreateChildren(HTREEITEM hParentItem, NETRESOURCE* pParentNetResources)
// --- In  : hParentItem : Node of which the children nodes have to be created
//			 pParentNetResources : Net resource of this parent node
// --- Out : 
// --- Returns :
// --- Effect : Computes the netresources of the children and creates the child nodes
{
	HANDLE hEnum = NULL;
	DWORD dwScope = pParentNetResources == NULL ? m_nResourceScope : pParentNetResources->dwScope;
	DWORD nResult = WNetOpenEnum(
		dwScope,				// scope of enumeration 
		RESOURCETYPE_ANY,		// resource types to list 
		0,						// resource usage to list 
		pParentNetResources,	// pointer to resource structure 
		&hEnum);				// pointer to enumeration handle buffer 
	if (nResult != NO_ERROR)
	{
		TRACE2("COXNetBrowseTree::CreateChildren : WNetOpenEnum failed with error code %i == 0x%X\n",
			nResult, nResult);
		ReportNetError(nResult, pParentNetResources == NULL ? NULL : pParentNetResources->lpRemoteName);
		return FALSE;
	}

	DWORD nCurrentCount(0);
	DWORD nCurrentSkipCount(0);
	/* =============================================================================== */	

	// The problem with the WNetEnumResoiurce fuction is that allthough you use 
	// 0xFFFFFFFF as requested resource count (this means everything) the function
	// does NOT return ERROR_MORE_DATA if the buffer is too small.  It only returns
	// this value if the buffer supplied is too small even for one value, in this
	// case the space needed to hold the first resource found in the enumeration
	// Normally the size of this resource should be sizeof(NETRESOURCE) which is 
	// 32 bytes but experience learned that this fluctuates between 32 bytes and 
	// more than 1000 bytes.  This is probably due to the fact that WNetEnumResource
	// also needs allocated memory for the strings inside the NETRESOURCE struct.
	// This leads to the conclusion that we cannot calculate with certainty the size
	// of the buffer we need for a certain number of resources.  The most robust
	// solution to this problem is to request a absolute number of resources, make
	// an serious and realistic estimation of the maximum amount of memory needed
	// to hold ALL requested resources and then test to see whether you have retrieved
	// all requested resources.  If this is TRUE then again enumerate the resources
	// to determine whether there aren't any left and so on until the returned
	// number of resources is smaller than the requested number.  This last remark
	// explains why we need to be sure that the requested number of resources 
	// allways fit in the amount of memory we allocated for the buffer.  We could 
	// alocated a very big buffer but we prefer the loop.

	// Also note that we don't use NETRESOURCE* pRes = new NETRESOURCE[Count]
	// because the array allocated will be an array of structs of size sizeof(NETRESOURCE)
	// and that's just not correct to  hold one netresource. That's why we use
	// GlobalAlloc.

	// USERS WHO WANT TO TUNE THE PERFORMANCE OF THIS FUNCTION CAN PLAY WITH THE 
	// NUMBER OF NETRESOURCES VIA THE nCOUNT VARIABLE AND WITH THE SIZE OF THE 
	// ALLOCATED BUFFER VIA THE nBUFFERSIZE VARIABLE BUT KEEP THE REMARKS ABOVE
	// IN MIND.
	/* =============================================================================== */
	// Start with a reasonable buffer size
	DWORD nCount = 5;
	DWORD nBufferSize = 5000;
	LPNETRESOURCE rgpNetResources = (LPNETRESOURCE)GlobalAlloc(GPTR, nBufferSize);

	while (TRUE)
	{
		DWORD nTempCount = nCount;
		DWORD nTempBufferSize = nBufferSize;
		memset(rgpNetResources, 0, nBufferSize);
		DWORD nResult2 = WNetEnumResource(
			hEnum,					// handle to enumeration 
			&nTempCount,				// pointer to entries to list 
			(LPVOID)rgpNetResources, // pointer to buffer for results 
			&nTempBufferSize);			// pointer to buffer size variable 
		TRACE2("COXNetBrowseTree::WNetEnumResource : Number of Netresources (%i), in buffersize (0x%X)\n", nTempCount, nTempBufferSize);

		if ((nResult2 != NO_ERROR) && (nResult2 != ERROR_NO_MORE_ITEMS) &&
			(nResult2 != ERROR_MORE_DATA))
		{
			TRACE2("COXNetBrowseTree::CreateChildren : WNetEnumResource failed with error code %i == 0x%X\n",
				nResult2, nResult2);
			ReportNetError(nResult2, pParentNetResources == NULL ? NULL : pParentNetResources->lpRemoteName);
			// ... Cleanup the handle and memeory allocated
			VERIFY(WNetCloseEnum(hEnum) == NO_ERROR);
			GlobalFree((HGLOBAL)rgpNetResources);
			return FALSE;
		}

		if (nResult2 == ERROR_NO_MORE_ITEMS)
			nTempCount = 0;

		// Loop the requested number of NetResources and make tree item nodes
		{
			HTREEITEM hNewItem;
			NETRESOURCE* pSourceNetResource = NULL;
			NETRESOURCE* pCopyNetResource = NULL;
			DWORD nIndex;
			DWORD nSkipCount = 0;
			for (nIndex = 0; nIndex < nTempCount; nIndex++)
			{
				pSourceNetResource  = &rgpNetResources[nIndex];
//.........这里部分代码省略.........
开发者ID:drupalhunter-team,项目名称:TrackMonitor,代码行数:101,代码来源:OXNetBrowseTree.cpp

示例11: defined

HRESULT CPkcs10::put_PublicKey(HCRYPTPROV hprov, DWORD dwKeySpec)
// Store the indicated public key in the subjectPublicKeyInfo field
// of the CertificationRequest. From PKCS #10:
//
//		subjectPublicKeyInfo contains information about the public 
//		key being certified. The information identifies the entity's 
//		public-key algorithm (and any associated parameters); examples 
//		of public-key algorithms include X.509's rsa and PKCS #1's 
//		rsaEncryption. 
//
//		The information also includes a bit-string representation of 
//		the entity's public key. For both public-key algorithms just 
//		mentioned, the bit string contains the BER encoding of a 
//		value of X.509/PKCS #1 type RSAPublicKey
//	
	{
	HRESULT hr = m_pworld->HprovToSubjectPublicKeyInfo(
					hprov, 
                    dwKeySpec,
					m_preq->certificationRequestInfo.subjectPublicKeyInfo
					);
	#if defined(_DEBUG) 
    // Check to to make sure we can read what we wrote
    if (hr==S_OK)
		{
		HCRYPTKEY hkeyuser;
		VERIFY(CryptGetUserKey(hprov, dwKeySpec, &hkeyuser));
		BYTE rgb1[1024];	DWORD cb1 = 1024;
//		BYTE rgb2[1024];	DWORD cb2 = 1024;
		VERIFY(CryptExportKey(hkeyuser, 0, PUBLICKEYBLOB, 0, rgb1, &cb1));
//		VERIFY(CryptExportKey(hkeypub,  0, PUBLICKEYBLOB, 0, rgb2, &cb2));
//			Would like to do the above, but CAPI won't let us export an imported key
//			(*(&(*##$^*&. So, having verified we can successfully fully import, we just
//			go get the raw bits again.
		BLOB b;	m_pworld->Init(b);
		
        HCRYPTKEY hkeypub;
		if (get_PublicKey(hprov, &hkeypub) == S_OK)
            {
		    VERIFY(CryptDestroyKey(hkeypub));
            }
        else
            OutputDebugString("DigSig: Public key retrieval failed\n");

		VERIFY(m_pworld->PublicKeyBlobFromBitString(m_preq->certificationRequestInfo.subjectPublicKeyInfo, dwKeySpec, &b) == S_OK);
		DWORD cb2 = b.cbSize; BYTE* rgb2 = b.pBlobData;
		VERIFY(cb1 == cb2);
		if (cb1 != cb2)
            {
            cb1 = min(cb1,cb2);
            cb2 = cb1;
            }
        ((PUBLICKEYSTRUC*)rgb1)->reserved = 0;
		((PUBLICKEYSTRUC*)rgb2)->reserved = 0;
		VERIFY(memcmp(rgb1, rgb2, cb1) == 0);
		VERIFY(CryptDestroyKey(hkeyuser));

		m_pworld->Free(b);
		}
	#endif

	MakeDirty();
	return hr;
	}
开发者ID:mingpen,项目名称:OpenNT,代码行数:64,代码来源:pkcs10.cpp

示例12: VERIFY

template<class T, USHORT default_port> void CHttpAgentT<T, default_port>::DoStartHttp(TAgentSocketObj* pSocketObj)
{
	THttpObj* pHttpObj = m_objPool.PickFreeHttpObj(this, pSocketObj);
	VERIFY(SetConnectionReserved(pSocketObj, pHttpObj));
}
开发者ID:huazhipeng,项目名称:HP-Socket,代码行数:5,代码来源:HttpAgent.cpp

示例13: Close

CRARFile::~CRARFile()
{
	Close();
	if (m_hLibUnRar)
		VERIFY( FreeLibrary(m_hLibUnRar) );
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:6,代码来源:RARFile.cpp

示例14: _T

LONG WINAPI CMiniDump::UnhandledExceptionFilter(_EXCEPTION_POINTERS* lpTopLevelExceptionFilter)
{
    LONG    retval = EXCEPTION_CONTINUE_SEARCH;
    BOOL    bDumpCreated = FALSE;
    HMODULE hDll = nullptr;
    TCHAR   szResult[800];
    szResult[0] = _T('\0');
    CPath   dumpPath;

#if ENABLE_MINIDUMP
    hDll = ::LoadLibrary(_T("dbghelp.dll"));

    if (hDll != nullptr) {
        MINIDUMPWRITEDUMP pMiniDumpWriteDump = (MINIDUMPWRITEDUMP)::GetProcAddress(hDll, "MiniDumpWriteDump");
        if (pMiniDumpWriteDump != nullptr && AfxGetMyApp()->GetAppSavePath(dumpPath)) {
            // Check that the folder actually exists
            if (!FileExists(dumpPath)) {
                VERIFY(CreateDirectory(dumpPath, nullptr));
            }

            CString strDumpName = AfxGetApp()->m_pszExeName;
            strDumpName.Append(_T(".exe.") + VersionInfo::GetVersionString() + _T(".dmp"));
            dumpPath.Append(strDumpName);

            // create the file
            HANDLE hFile = ::CreateFile(dumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS,
                                        FILE_ATTRIBUTE_NORMAL, nullptr);

            if (hFile != INVALID_HANDLE_VALUE) {
                _MINIDUMP_EXCEPTION_INFORMATION ExInfo;

                ExInfo.ThreadId = ::GetCurrentThreadId();
                ExInfo.ExceptionPointers = lpTopLevelExceptionFilter;
                ExInfo.ClientPointers = FALSE;

                // write the dump
                bDumpCreated = pMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, nullptr, nullptr);
                if (bDumpCreated) {
                    _stprintf_s(szResult, _countof(szResult), ResStr(IDS_MPC_CRASH), dumpPath);
                    retval = EXCEPTION_EXECUTE_HANDLER;
                } else {
                    _stprintf_s(szResult, _countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), dumpPath, GetLastError());
                }

                ::CloseHandle(hFile);
            } else {
                _stprintf_s(szResult, _countof(szResult), ResStr(IDS_MPC_MINIDUMP_FAIL), dumpPath, GetLastError());
            }
        }
        FreeLibrary(hDll);
    }

    if (szResult[0]) {
        switch (MessageBox(nullptr, szResult, _T("MPC-HC - Mini Dump"), bDumpCreated ? MB_YESNO : MB_OK)) {
            case IDYES:
                ShellExecute(nullptr, _T("open"), BUGS_URL, nullptr, nullptr, SW_SHOWDEFAULT);
                ExploreToFile(dumpPath);
                break;
            case IDNO:
                retval = EXCEPTION_CONTINUE_SEARCH; // rethrow the exception to make easier attaching a debugger
                break;
        }
    }
#else
    if (MessageBox(nullptr, ResStr(IDS_MPC_BUG_REPORT), ResStr(IDS_MPC_BUG_REPORT_TITLE), MB_YESNO) == IDYES) {
        ShellExecute(nullptr, _T("open"), DOWNLOAD_URL, nullptr, nullptr, SW_SHOWDEFAULT);
    }
#endif // DISABLE_MINIDUMP

    return retval;
}
开发者ID:DanHenebry,项目名称:mpc-hc,代码行数:71,代码来源:MiniDump.cpp

示例15: if

void CLightProjector::calculate	()
{
	if (receivers.empty())		return;

	// perform validate / markup
	for (u32 r_it=0; r_it<receivers.size(); r_it++)
	{
		// validate
		BOOL				bValid	= TRUE;
		IRenderable*		O		= receivers[r_it];
		CROS_impl*			LT		= (CROS_impl*)O->renderable_ROS();
		int					slot	= LT->shadow_recv_slot;
		if (slot<0 || slot>=P_o_count)								bValid = FALSE;	// invalid slot
		else if (cache[slot].O!=O)									bValid = FALSE;	// not the same object
		else {
			// seems to be valid
			Fbox	bb;		bb.xform		(O->renderable.visual->vis.box,O->renderable.xform);
			if (cache[slot].BB.contains(bb))	{
				// inside, but maybe timelimit exceeded?
				if (Device.dwTimeGlobal > cache[slot].dwTimeValid)	bValid = FALSE;	// timeout
			} else													bValid = FALSE;	// out of bounds
		}

		// 
		if (bValid)			{
			// Ok, use cached version
			cache[slot].dwFrame	= Device.dwFrame;
		} else {
			taskid.push_back	(r_it);
		}
	}
	if (taskid.empty())			return;

	// Begin
	Device.Statistic->RenderDUMP_Pcalc.Begin	();
	RCache.set_RT				(RT->pRT);
	RCache.set_ZB				(RImplementation.Target->pTempZB);
	CHK_DX(HW.pDevice->Clear	(0,0, D3DCLEAR_ZBUFFER | (HW.Caps.bStencil?D3DCLEAR_STENCIL:0), 0,1,0 ));
	RCache.set_xform_world		(Fidentity);

	// reallocate/reassociate structures + perform all the work
	for (u32 c_it=0; c_it<cache.size(); c_it++)
	{
		if (taskid.empty())							break;
		if (Device.dwFrame==cache[c_it].dwFrame)	continue;

		// found not used slot
		int				tid		= taskid.back();	taskid.pop_back();
		recv&			R		= cache		[c_it];
		IRenderable*	O		= receivers	[tid];
		CROS_impl*	LT		= (CROS_impl*)O->renderable_ROS();
		VERIFY2			(_valid(O->renderable.xform),"Invalid object transformation");
		VERIFY2			(_valid(O->renderable.visual->vis.sphere.P),"Invalid object's visual sphere");

		Fvector			C;		O->renderable.xform.transform_tiny		(C,O->renderable.visual->vis.sphere.P);
		R.O						= O;
		R.C						= C;
		R.C.y					+= O->renderable.visual->vis.sphere.R*0.1f;		//. YURA: 0.1 can be more
		R.BB.xform				(O->renderable.visual->vis.box,O->renderable.xform).scale(0.1f);
		R.dwTimeValid			= Device.dwTimeGlobal + ::Random.randI(time_min,time_max);
		LT->shadow_recv_slot	= c_it; 

		// Msg					("[%f,%f,%f]-%f",C.C.x,C.C.y,C.C.z,C.O->renderable.visual->vis.sphere.R);
		// calculate projection-matrix
		Fmatrix		mProject;
		float		p_R			=	R.O->renderable.visual->vis.sphere.R * 1.1f;
		VERIFY2		(p_R>EPS_L,"Object has no physical size");
		float		p_hat		=	p_R/P_cam_dist;
		float		p_asp		=	1.f;
		float		p_near		=	P_cam_dist-EPS_L;									
		float		p_far		=	P_cam_dist+p_R+P_cam_range;	
		mProject.build_projection_HAT	(p_hat,p_asp,p_near,p_far);
		RCache.set_xform_project		(mProject);
		
		// calculate view-matrix
		Fmatrix		mView;
		Fvector		v_C, v_Cs, v_N;
		v_C.set					(R.C);
		v_Cs					= v_C;
		v_C.y					+=	P_cam_dist;
		v_N.set					(0,0,1);
		VERIFY					(_valid(v_C) && _valid(v_Cs) && _valid(v_N));

		// validate
		Fvector		v;
		v.sub		(v_Cs,v_C);;
#ifdef DEBUG
		if ((v.x*v.x+v.y*v.y+v.z*v.z)<=flt_zero)	{
			CObject* OO = dynamic_cast<CObject*>(R.O);
			Msg("Object[%s] Visual[%s] has invalid position. ",*OO->cName(),*OO->cNameVisual());
			Fvector cc;
			OO->Center(cc);
			Log("center=",cc);

			Log("visual_center=",OO->Visual()->vis.sphere.P);
			
			Log("full_matrix=",OO->XFORM());

			Log	("v_N",v_N);
			Log	("v_C",v_C);
//.........这里部分代码省略.........
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:101,代码来源:LightProjector.cpp


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