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


C++ ATLASSERT函数代码示例

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


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

示例1: GetRegister

 /// returns processor register
 BYTE GetRegister(RegisterID enRegisterID)
 {
     ATLASSERT(enRegisterID <= regLast);
     return m_abRegister[enRegisterID];
 }
开发者ID:vividos,项目名称:OldStuff,代码行数:6,代码来源:Processor6510.hpp

示例2: ATLASSERT

BOOL CNBLogicalDevice::InitConnectionInfo(PNDASCOMM_CONNECTION_INFO ci, BOOL bWriteAccess)
{
	ATLASSERT(m_mapUnitDevices.size());

	return PrimaryUnitDevice()->InitConnectionInfo(ci, bWriteAccess);
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:6,代码来源:nbdev.cpp

示例3: ThreadProc

DWORD CALLBACK ThreadProc(PVOID pv)
{
    HANDLE hEvent = *(PHANDLE)pv;

    HANDLE hEvents[PIPES];
    OVERLAPPEDEX Ovlxs[PIPES];

    SID_IDENTIFIER_AUTHORITY sia = SECURITY_WORLD_SID_AUTHORITY;
    PSID psid = NULL;

    ATLASSERT(::AllocateAndInitializeSid(
        &sia,
        1,
        SECURITY_WORLD_RID,
        0,
        0,
        0,
        00,
        0,
        0,
        0,
        &psid));

    EXPLICIT_ACCESS ea = { 0 };
    ea.grfAccessPermissions = FILE_ALL_ACCESS;
    ea.grfAccessMode = SET_ACCESS;
    ea.grfInheritance = NO_INHERITANCE;
    ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
    ea.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP;
    ea.Trustee.ptstrName = (LPTSTR)psid;

    PACL pacl = NULL;
    ATLASSERT(::SetEntriesInAcl(1, &ea, NULL, &pacl) == ERROR_SUCCESS);

    PSECURITY_DESCRIPTOR psd = ::LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
    ATLASSERT(::InitializeSecurityDescriptor(psd, SECURITY_DESCRIPTOR_REVISION));

    ATLASSERT(::SetSecurityDescriptorDacl(psd, TRUE, pacl, FALSE));

    SECURITY_ATTRIBUTES sa = { 0 };
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
    sa.lpSecurityDescriptor = psd;
    sa.bInheritHandle = FALSE;

    for (int i = 0; i < PIPES; i++)
    {
        ZeroMemory(&Ovlxs[i], sizeof(OVERLAPPEDEX));

        Ovlxs[i].hPipe = (CHandle)::CreateNamedPipe(
            NAMED_PIPE,
            PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
            PIPE_WAIT | PIPE_READMODE_MESSAGE | PIPE_TYPE_MESSAGE,
            PIPES,
            BUF_SIZE,
            BUF_SIZE,
            2500,
            &sa);

        //::_tprintf(_T("CreateNamedPipe(): %ld\n"), ::GetLastError());
        ATLASSERT(Ovlxs[i].hPipe != INVALID_HANDLE_VALUE);

        hEvents[i] = Ovlxs[i].Ovl.hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
        //::_tprintf(_T("CreateEvent(): %ld\n"), ::GetLastError());
        ATLASSERT(hEvents[i] != NULL);

        ATLASSERT(::ConnectNamedPipe(Ovlxs[i].hPipe, (LPOVERLAPPED)&Ovlxs[i]) == 0);
        //::_tprintf(_T("ConnectNamedPipe(): %ld\n"), ::GetLastError());
        ATLASSERT(::GetLastError() == ERROR_IO_PENDING);
    }

    ::SetEvent(hEvent);

    TCHAR szBuf[BUF_SIZE];

    while (::_tcscmp(szBuf, _T("QUIT")))
    {
        //::_tprintf(_T("Connecting...\n"));
        DWORD dwIndex = ::WaitForMultipleObjects(PIPES, hEvents, FALSE, INFINITE) - WAIT_OBJECT_0;
        //::_tprintf(_T("Connected.\n"));

        DWORD dwBytes = 0;
        BOOL bRes = ::GetOverlappedResult(Ovlxs[dwIndex].hPipe, (LPOVERLAPPED)&Ovlxs[dwIndex], &dwBytes, FALSE);

        bRes = ::ReadFile(Ovlxs[dwIndex].hPipe, szBuf, sizeof(szBuf), &dwBytes, NULL);
        if (bRes && dwBytes > 0)
            ::_tprintf(_T("[%s]\n"), szBuf);

        ATLASSERT(::DisconnectNamedPipe(Ovlxs[dwIndex].hPipe));

        ATLASSERT(::ConnectNamedPipe(Ovlxs[dwIndex].hPipe, (LPOVERLAPPED)&Ovlxs[dwIndex]) == 0);
        ATLASSERT(::GetLastError() == ERROR_IO_PENDING);
    }

    for (int i = 0; i < PIPES; i++)
    {
        ::DisconnectNamedPipe(Ovlxs[i].hPipe);
        ::CloseHandle(Ovlxs[i].Ovl.hEvent);
    }

    ::FreeSid(psid);
//.........这里部分代码省略.........
开发者ID:dranger003,项目名称:Win32ConsoleApplication10,代码行数:101,代码来源:Win32ConsoleApplication1.cpp

示例4: ATLTRACE

STDMETHODIMP CCUBRIDRowset::DeleteRows(HCHAPTER hReserved, DBCOUNTITEM cRows,
				const HROW rghRows[], DBROWSTATUS rgRowStatus[])
{
	ATLTRACE(atlTraceDBProvider, 2, "CCUBRIDRowset::DeleteRows\n");

	ClearError();
	if(m_nStatus==1) return RaiseError(E_UNEXPECTED, 1, __uuidof(IRowsetChange), L"This object is in a zombie state");

	CHECK_UPDATABILITY(DBPROPVAL_UP_DELETE);

	if(cRows==0) return S_OK;
	if(rghRows==NULL && cRows>=1) return RaiseError(E_INVALIDARG, 0, __uuidof(IRowsetChange));

	// Determine if we're in immediate or deferred mode
	bool bDeferred = IsDeferred(this);

	int hConn = GetSessionPtr()->GetConnection();
	UINT uCodepage = GetSessionPtr()->GetCodepage();
	BOOL bSuccess = false;
	BOOL bFailed = false;
	for(DBCOUNTITEM i=0;i<cRows;i++)
	{
		HROW hRow = rghRows[i];

		// Attempt to locate the row in our map
		CCUBRIDRowsetRow *pRow;
		{
			bool bFound = m_rgRowHandles.Lookup((ULONG)hRow, pRow);
			if(!bFound || pRow==NULL)
			{	// invalid handle
				bFailed = true;
				if(rgRowStatus) rgRowStatus[i] = DBROWSTATUS_E_INVALID;
				continue;
			}
		}

		if(pRow->m_status==DBPENDINGSTATUS_DELETED)
		{	// already deleted
			if(rgRowStatus) rgRowStatus[i] = DBROWSTATUS_E_DELETED;
			bFailed  = true;
			continue;
		}

		ATLASSERT( pRow->m_iRowset==(ULONG)-1 || pRow->m_iRowset<m_rgRowData.GetCount() );

		DBROWSTATUS rowStat = DBROWSTATUS_S_OK;

		// mark the row as deleted
		if(pRow->m_status==DBPENDINGSTATUS_INVALIDROW)
		{
			bFailed = true;
			// unsigned high bit signified neg. number
			if(pRow->m_dwRef & 0x80000000)		
				rowStat = DBROWSTATUS_E_INVALID;
			else
				rowStat = DBROWSTATUS_E_DELETED;
		}
		else if(pRow->m_iRowset==(ULONG)-1 && pRow->m_status!=DBPENDINGSTATUS_NEW)
		{	// 새로 삽입되었고 Storage로 전송됐다.
			bFailed = true;
			rowStat = DBROWSTATUS_E_NEWLYINSERTED;
		}
		else
		{
			bSuccess = true;
			rowStat = DBROWSTATUS_S_OK;
			if(pRow->m_status==DBPENDINGSTATUS_NEW)
				MakeRowInvalid(this, pRow);
			else
				pRow->m_status = DBPENDINGSTATUS_DELETED;
		}

		if(!bDeferred && pRow->m_status==DBPENDINGSTATUS_DELETED)
		{	// 변화를 지금 적용
			// CCUBRIDRowsetRow의 delete는 ReleaseRows에서 이루어진다.
			HRESULT hr = pRow->WriteData(hConn, uCodepage, GetRequestHandle(), m_strTableName);
			if(FAILED(hr)) return hr;

			MakeRowInvalid(this, pRow);
		}

		if(rgRowStatus) rgRowStatus[i] = rowStat;
	}

	if(!bDeferred)
		DoCommit(this); // commit

	if(bFailed)
	{
		if(bSuccess)
			return DB_S_ERRORSOCCURRED;
		else
			return RaiseError(DB_E_ERRORSOCCURRED, 0, __uuidof(IRowsetChange));
	}
	else
		return S_OK;
}
开发者ID:CUBRID,项目名称:cubrid-oledb,代码行数:97,代码来源:RowsetChange.cpp

示例5: CLocalResult

 CLocalResult()
 {
     ATLASSERT(false);
 }
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:4,代码来源:LocalResult.cpp

示例6: SetRegister

 /// sets processor register
 void SetRegister(RegisterID enRegisterID, BYTE bValue)
 {
     ATLASSERT(enRegisterID <= regLast);
     m_abRegister[enRegisterID] = bValue;
 }
开发者ID:vividos,项目名称:OldStuff,代码行数:6,代码来源:Processor6510.hpp

示例7: ATLASSERT

void CStatistic::ReplacePlaceholders( CString & szUrl, const CString & szType, const CString & szAction )
{
    if (szUrl.IsEmpty())
    {
        ATLASSERT(FALSE);
        return;
    }

    if (m_szPID.IsEmpty())
    {
        m_szPID = GetPID();
    }

    if (m_szMID.IsEmpty())
    {
        GetMID(m_szMID.GetBufferSetLength(MAX_PATH), MAX_PATH);
    }

    if (m_szAppVer.IsEmpty())
    {
        WCHAR szFile[MAX_PATH] = {};
        GetModuleFileName(g_hModule, szFile, MAX_PATH);
        PathRemoveFileSpec(szFile);
        PathRemoveFileSpec(szFile);
        PathAppend(szFile, APP_NAME);

        GetFileVer(szFile, m_szAppVer.GetBufferSetLength(MAX_PATH), MAX_PATH);
    }

    if (m_szModVer.IsEmpty())
    {
        WCHAR szFile[MAX_PATH] = {};
        GetModuleFileName(g_hModule, szFile, MAX_PATH);

        GetFileVer(szFile, m_szModVer.GetBufferSetLength(MAX_PATH), MAX_PATH);
    }

    if (szUrl.Find(URL_PID) > 0)
    {
        szUrl.Replace(URL_PID, m_szPID);
    }

    if (szUrl.Find(URL_MID) > 0)
    {
        szUrl.Replace(URL_MID, m_szMID);
    }

    if (szUrl.Find(URL_APP_VER) > 0)
    {
        szUrl.Replace(URL_APP_VER, m_szAppVer);
    }

    if (szUrl.Find(URL_MOD_VER) > 0)
    {
        szUrl.Replace(URL_MOD_VER, m_szModVer);
    }

    if (szUrl.Find(URL_TYPE) > 0)
    {
        szUrl.Replace(URL_TYPE, szType);
    }

    if (szUrl.Find(URL_ACTION) > 0)
    {
        szUrl.Replace(URL_ACTION, szAction);
    }
}
开发者ID:N2oBeef,项目名称:vc_scan,代码行数:67,代码来源:Statistics.cpp

示例8: ATLASSERT

CMsgOnlyWnd::~CMsgOnlyWnd() 
{
	ATLASSERT(NULL == hwnd_);

}
开发者ID:SammyLan,项目名称:Raptor,代码行数:5,代码来源:MsgOnlyWnd.cpp

示例9: _tmain

int _tmain(int argc, _TCHAR* argv[])
{
    {
        //TP_CALLBACK_ENVIRON cbe = { 0 };
        //::InitializeThreadpoolEnvironment(&cbe);

        //PTP_POOL ptpp = ::CreateThreadpool(NULL);
        //ATLASSERT(ptpp != NULL);

        //::SetThreadpoolThreadMaximum(ptpp, 16);
        //::SetThreadpoolCallbackPool(&cbe, ptpp);

        //PTP_CLEANUP_GROUP ptpcg = ::CreateThreadpoolCleanupGroup();
        //::SetThreadpoolCallbackCleanupGroup(&cbe, ptpcg, NULL);

        //PTP_WORK ptpw = ::CreateThreadpoolWork(&WorkCallback1, (PVOID)&cbe, &cbe);
        //::SubmitThreadpoolWork(ptpw);

        {
            CHandle hEvent = (CHandle)::CreateEvent(NULL, TRUE, FALSE, NULL);

            DWORD dwThreadId = 0;
            CHandle hThread = (CHandle)::CreateThread(NULL, 0, &ThreadProc, (PVOID)&hEvent, 0, &dwThreadId);

            ::WaitForSingleObject(hEvent, INFINITE);

            ::InstallHook();
            ::_getch();
            ::UninstallHook();

            CHandle hPipe = (CHandle)::CreateFile(
                NAMED_PIPE,
                GENERIC_WRITE,
                0,
                NULL,
                OPEN_EXISTING,
                0,
                NULL);
            DWORD dwLastError = ::GetLastError();
            ATLASSERT(hPipe != INVALID_HANDLE_VALUE);

            DWORD dwMode = PIPE_READMODE_MESSAGE;
            ATLASSERT(::SetNamedPipeHandleState(hPipe, &dwMode, NULL, NULL));

            TCHAR szBuf[BUF_SIZE];
            DWORD dwBytes = 0;

            ::_stprintf_s(szBuf, _T("QUIT"));
            ::WriteFile(hPipe, szBuf, sizeof(szBuf), &dwBytes, NULL);

            ::FlushFileBuffers(hPipe);
            ::DisconnectNamedPipe(hPipe);

            ::WaitForSingleObject(hThread, INFINITE);
        }

        //::WaitForThreadpoolWorkCallbacks(ptpw, FALSE);

        //::CloseThreadpoolCleanupGroupMembers(ptpcg, FALSE, NULL);
        //::CloseThreadpoolCleanupGroup(ptpcg);
        //::CloseThreadpool(ptpp);
    }

    ::_getch();

    return 0;
}
开发者ID:dranger003,项目名称:Win32ConsoleApplication10,代码行数:67,代码来源:Win32ConsoleApplication1.cpp

示例10: ATLENSURE_RETURN_HR

HRESULT ThreadController::Resume(_In_ BREAKRESUMEACTION breakResumeAction, _In_ ERRORRESUMEACTION errorResumeAction)
{
    ATLENSURE_RETURN_HR(ThreadHelpers::IsOnDispatchThread(m_dispatchThreadId), E_UNEXPECTED);

    if (!this->IsConnected() || !this->IsAtBreak())
    {
        return E_NOT_VALID_STATE;
    }

    HRESULT hr = S_OK;

    // Scope for the CallFrame lock, the local smart pointer's addref will keep it alive after the lock
    CComPtr<IRemoteDebugApplicationThread> spDebugThreadKeepAlive;
    {
        // Lock the callstack, so that we are thread safe
        CComCritSecLock<CComAutoCriticalSection> lock(m_csCallFramesLock);

        // Create a local smart pointer to addRef so that it won't be released by the other thread while we are using it
        spDebugThreadKeepAlive = m_spCurrentBrokenThread;
    }

    if (spDebugThreadKeepAlive.p != nullptr)
    {
        // Since we are about to resume, we clear all the current break information
        this->ClearBreakInfo();

        // By default we abort any errors so that exceptions execute the expected path.
        // If we want to support 'continue from exception' such as after using setNextStatement during an exception break, 
        // we should pass in ERRORRESUMEACTION_SkipErrorStatement,
        // But we should not do that by default as it changes the behavior of exceptions when running under the debugger and should only be
        // enabled through a user action.
        unique_ptr<ResumeFromBreakpointInfo> spResumeFromBreakpointInfo(new ResumeFromBreakpointInfo());
        spResumeFromBreakpointInfo->spDebugThread = spDebugThreadKeepAlive;
        spResumeFromBreakpointInfo->breakResumeAction = breakResumeAction;
        spResumeFromBreakpointInfo->errorResumeAction = errorResumeAction;

        // Get the IRemoteDebugApplication using our helper function that keeps it thread safe
        CComPtr<IRemoteDebugApplication> spDebugAppKeepAlive;
        hr = this->GetRemoteDebugApplication(spDebugAppKeepAlive);

        // We need to check if spDebugAppKeepAlive is null, since the debugger may have been activated
        // while debugging was disabled (e.g.: after the profiler started).
        // If that happened, then m_spDebugApplication would be null when we tried to AddRef it.
        if (hr == S_OK && spDebugAppKeepAlive.p != nullptr)
        {
            // Get the IDebugApplicationThread interface used to make the actual thread switch call
#ifdef _WIN64
            CComQIPtr<IDebugApplicationThread64> spDebugThread(spDebugThreadKeepAlive);
#else
            CComQIPtr<IDebugApplicationThread> spDebugThread(spDebugThreadKeepAlive);
#endif
            ATLENSURE_RETURN_HR(spDebugThread.p != nullptr, E_NOINTERFACE);

            CComQIPtr<IDebugApplication> spDebugApp(spDebugAppKeepAlive);
            ATLENSURE_RETURN_HR(spDebugApp.p != nullptr, E_NOINTERFACE);

            // Create an object for thread switching on to the debugger thread
            CComObject<PDMThreadCallback>* pCall;
            hr = CComObject<PDMThreadCallback>::CreateInstance(&pCall);
            BPT_FAIL_IF_NOT_S_OK(hr);

            // We need to make sure that all pending 'Eval' calls have been completed on the current thread before we resume, otherwise the PDM will attempt 
            // to dequeue and execute an eval after we have resumed, causing chakra to assert that the debugging session has changed (eval started on previous break)
            // Queuing a request onto the Sync Queue in the PDM will make sure that the Async evals have completed before we execute our resume.
            // This is because the PDM executes all Async requests before any Sync ones (see CProcessThread::DoRequest() - debugger\pdm\scpthred.cpp)
            CComObjPtr<PDMThreadCallback> spCall(pCall);
            hr = spDebugThread->SynchronousCallIntoThread(spCall, (DWORD)PDMThreadCallbackMethod::CompleteEvals, (DWORD_PTR)spDebugApp.p, (DWORD_PTR)nullptr);
            ATLASSERT(hr == S_OK); // We want to try a resume even if this fails (in retail bits)
        }

        // We need to call resume on the debugger thread so that we get the internal pdm locks in the correct order:
        // m_csCrossThreadCallLock then m_csBreakPoint
        // If we call ResumeFromBreakPoint directly, we will end up getting the locks in the reverse order which can cause a deadlock.
        hr = this->CallDebuggerThread(PDMThreadCallbackMethod::Resume, (DWORD_PTR)nullptr, (DWORD_PTR)spResumeFromBreakpointInfo.release());
            
        // This could fail if we already disconnected, so don't assert, but do return the hr
    }
    else
    {
        // We are no longer at a break
        return E_NOT_VALID_STATE;
    }

    // The synchronous call to resume can occasionally cause a PDM break, if that happens, we will still be at a break here, so don't update IE
    if (!this->IsAtBreak())
    {
        // Inform the BHO that we have resumed from the break
        // We need to use send message to make sure that the pipe handler has sent the message to the BHO before we
        // continue processing messages
        ::SendMessageW(m_hwndDebugPipeHandler, WM_BREAKMODECHANGED, /*IsAtBreak=*/ FALSE, NULL);
    }

    return hr;
}
开发者ID:DickvdBrink,项目名称:IEDiagnosticsAdapter,代码行数:94,代码来源:ThreadController.cpp

示例11: switch

BOOL CNBLogicalDevice::GetCommandAbility(int nID)
{
	if (IsGroup()) {
		switch(nID)
		{
		case IDM_TOOL_BIND:
			return TRUE;
		case IDM_TOOL_UNBIND:
			// Cannot unbind devices in use.
			return !(GetStatus() & NDASBIND_LOGICAL_DEVICE_STATUS_MOUNTED);
		case IDM_TOOL_ADDMIRROR:
			return FALSE;
		case IDM_TOOL_MIGRATE:
			return (
				IsHDD() && IsMigrationRequired() && IsOperatableAll() && !HasMissingMember());
		case IDM_TOOL_REPLACE_DEVICE:
			return FALSE;
		case IDM_TOOL_USE_AS_MEMBER:
			return FALSE;
		case IDM_TOOL_SPAREADD:
			return (IsFaultTolerant() && !IsMigrationRequired() && IsOperatableAll() && IsHealthy() && DevicesSpare(FALSE)==0);
		case IDM_TOOL_RESET_BIND_INFO:
			return FALSE;
		case IDM_TOOL_CLEAR_DEFECTIVE:
			return FALSE;
		case IDM_TOOL_USE_AS_BASIC:
			return FALSE;
		case IDM_TOOL_REMOVE_FROM_RAID:
			return FALSE;
		default:
			ATLASSERT(FALSE);
			return FALSE;
		}
	} else {
		// Basic disk type.
		switch(nID)
		{
		case IDM_TOOL_BIND:
			return TRUE;
		case IDM_TOOL_UNBIND:
			return FALSE;
		case IDM_TOOL_ADDMIRROR:
			return (IsHDD() && IsOperatableAll());
		case IDM_TOOL_MIGRATE:
			return FALSE;
		case IDM_TOOL_REPLACE_DEVICE:
			return FALSE;
		case IDM_TOOL_USE_AS_MEMBER:
			return FALSE;
		case IDM_TOOL_SPAREADD:
			return FALSE;
		case IDM_TOOL_RESET_BIND_INFO:
			return (IsHDD() && IsOperatable());
		case IDM_TOOL_CLEAR_DEFECTIVE:
			return FALSE;
		case IDM_TOOL_USE_AS_BASIC:
			return FALSE;
		case IDM_TOOL_REMOVE_FROM_RAID:
			return FALSE;
		default:
			ATLASSERT(FALSE);
			return FALSE;
		}
	}
	return FALSE;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:66,代码来源:nbdev.cpp

示例12: pCacheMsiToSystem


//.........这里部分代码省略.........
	LPTSTR szCachedMsiFile,
	DWORD cchMax)
{
	TCHAR szMsiFileFullPath[MAX_PATH] = {0};
	LPTSTR lpFilePart = NULL;
	
	DWORD nChars = ::GetFullPathName(
		szMsiFile, 
		MAX_PATH, 
		szMsiFileFullPath, 
		&lpFilePart);
	
	if (0 == nChars) {
		DWORD dwErr = GetLastError();
		DBGPRT_ERR_EX(_FT("GetFullPathName %s failed: "), szMsiFile);
		return dwErr;
	}

	TCHAR szCacheFile[MAX_PATH] = {0};
	// nChars = GetSystemWindowsDirectory(szCacheFile, MAX_PATH);
	nChars = GetWindowsDirectory(szCacheFile, MAX_PATH);
	if (0 == nChars) {
		DWORD dwErr = GetLastError();
		DBGPRT_ERR_EX(_FT("GetSystemWindowsDirectory failed: "));
		return dwErr;
	}

	HRESULT hr = StringCchCat(szCacheFile, MAX_PATH, _T("\\"));
	if (FAILED(hr)) {
		DBGPRT_ERR_EX(_FT("StringCchCat failed: "));
		return HRESULT_CODE(hr);
	}

	hr = StringCchCat(szCacheFile, MAX_PATH, MSICACHE_DIRECTORY);
	if (FAILED(hr)) {
		DBGPRT_ERR_EX(_FT("StringCchCat failed: "));
		return HRESULT_CODE(hr);
	}

	LPTSTR szPackageCode = pGetMsiPackageCode(szMsiFile);

	if (NULL == szPackageCode) {
		DWORD dwErr = GetLastError();
		return dwErr;
	}

	if (szPackageCode[0] != _T('\0')) {

		hr = StringCchCat(szCacheFile, MAX_PATH, _T("\\"));
		if (FAILED(hr)) {
			DBGPRT_ERR_EX(_FT("StringCchCat failed: "));
			GlobalFree((HGLOBAL)szPackageCode);
			return HRESULT_CODE(hr);
		}

		hr = StringCchCat(szCacheFile, MAX_PATH, szPackageCode);
		if (FAILED(hr)) {
			DBGPRT_ERR_EX(_FT("StringCchCat failed: "));
			GlobalFree((HGLOBAL)szPackageCode);
			return HRESULT_CODE(hr);
		}

		GlobalFree((HGLOBAL)szPackageCode);
	}

	hr = StringCchCat(szCacheFile, MAX_PATH, _T("\\"));
	if (FAILED(hr)) {
		DBGPRT_ERR_EX(_FT("StringCchCat failed: "));
		return HRESULT_CODE(hr);
	}

	hr = StringCchCat(szCacheFile, MAX_PATH, lpFilePart);
	if (FAILED(hr)) {
		DBGPRT_ERR_EX(_FT("StringCchCat failed: "));
		return HRESULT_CODE(hr);
	}

	SHFILEOPSTRUCT shop;
	shop.hwnd = pSetupUI->GetCurrentWindow();
	shop.wFunc = FO_COPY;
	shop.pFrom = szMsiFileFullPath; // doubly NULL-terminated!!
	shop.pTo = szCacheFile;
	shop.fFlags = FOF_FILESONLY | FOF_NOCONFIRMMKDIR | FOF_NOCONFIRMATION |
		FOF_NOCOPYSECURITYATTRIBS |
		FOF_SILENT;

	INT iRet = SHFileOperation(&shop);

	if (ERROR_SUCCESS != iRet) {
		DWORD dwErr = GetLastError();
		CString str;
		str.FormatMessage(IDS_ERR_CACHING_TO_SYSTEM_FMT,szCacheFile);
		pSetupUI->PostErrorMessageBox(GetLastError(),str);
		return dwErr;
	}

	hr = StringCchCopy(szCachedMsiFile, cchMax, szCacheFile);
	ATLASSERT(SUCCEEDED(hr));
	return ERROR_SUCCESS;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:101,代码来源:winutil.cpp

示例13: CenterWindow

LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
	// center the dialog on the screen
	CenterWindow();
	
  // Set window icon
  SetIcon(::LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDR_MAINFRAME)), 0);

  // Load heading icon
  HMODULE hExeModule = LoadLibrary(m_sImageName);
  if(hExeModule)
  {
    // Use IDR_MAINFRAME icon which is the default one for the crashed application.
    m_HeadingIcon = ::LoadIcon(hExeModule, MAKEINTRESOURCE(IDR_MAINFRAME));
  }  

  // If there is no IDR_MAINFRAME icon in crashed EXE module, use IDI_APPLICATION system icon
  if(m_HeadingIcon == NULL)
  {
    m_HeadingIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
  }  
 
  m_link.SubclassWindow(GetDlgItem(IDC_LINK));   
  m_link.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);

  m_linkMoreInfo.SubclassWindow(GetDlgItem(IDC_MOREINFO));
  m_linkMoreInfo.SetHyperLinkExtendedStyle(HLINK_COMMANDBUTTON);

  m_statEmail = GetDlgItem(IDC_STATMAIL);
  m_editEmail = GetDlgItem(IDC_EMAIL);
  m_statDesc = GetDlgItem(IDC_DESCRIBE);
  m_editDesc = GetDlgItem(IDC_DESCRIPTION);
  m_statCrashRpt = GetDlgItem(IDC_CRASHRPT);
  m_statHorzLine = GetDlgItem(IDC_HORZLINE);
  m_btnOk = GetDlgItem(IDOK);
  m_btnCancel = GetDlgItem(IDCANCEL);

  CRect rc1, rc2;
  m_linkMoreInfo.GetWindowRect(&rc1);
  m_statHorzLine.GetWindowRect(&rc2);
  m_nDeltaY = rc1.bottom+15-rc2.top;

  LOGFONT lf;
  memset(&lf, 0, sizeof(LOGFONT));
  lf.lfHeight = 25;
  lf.lfWeight = FW_NORMAL;
  lf.lfQuality = ANTIALIASED_QUALITY;
  _TCSCPY_S(lf.lfFaceName, 32, _T("Tahoma"));
  m_HeadingFont.CreateFontIndirect(&lf);

  ShowMoreInfo(FALSE);

  m_dlgProgress.Create(m_hWnd);

	// register object for message filtering and idle updates
	CMessageLoop* pLoop = _Module.GetMessageLoop();
	ATLASSERT(pLoop != NULL);
	pLoop->AddMessageFilter(this);
	pLoop->AddIdleHandler(this);

	UIAddChildWindowContainer(m_hWnd);

	return TRUE;
}
开发者ID:doo,项目名称:CrashRpt,代码行数:64,代码来源:MainDlg.cpp

示例14: pGetMsiPackageCode

//
// Caller should free the resource for non-NULL return values
// with GlobalFree
//
static
LPTSTR
pGetMsiPackageCode(LPCTSTR szMsiFile)
{
	MSIHANDLE hSummaryInfo = 0;

	CMsiApi msiApi;
	BOOL fSuccess = msiApi.Initialize();
	if (!fSuccess) {
		DBGPRT_ERR(_FT("MSIAPI functions are not available.\n"));
		SetLastError(ERROR_PROC_NOT_FOUND);
		return NULL;
	}

	UINT uiRet = msiApi.GetSummaryInformation(0, szMsiFile, 0, &hSummaryInfo);
	if (ERROR_SUCCESS != uiRet) {
		SetLastError(uiRet);
		DBGPRT_ERR_EX(_FT("MsiGetSummaryInformation failed: "));
		return NULL;
	}

	UINT uiDataType;
	INT iValue;
	FILETIME ftValue;
	DWORD cchMax = 0;

	//
	// Get Package Code (PID_REVNUMBER)
	//
	uiRet = msiApi.SummmaryInfoGetProperty(
		hSummaryInfo, 
		PID_REVNUMBER,
		&uiDataType,
		&iValue, 
		&ftValue,
		_T(""), // do not pass NULL
		&cchMax);

	ATLASSERT(VT_LPSTR == uiDataType);

	if (ERROR_SUCCESS == uiRet) {
		ATLASSERT(FALSE);
		return _T("");
	} else if (ERROR_MORE_DATA != uiRet) {
		SetLastError(uiRet);
		DBGPRT_ERR_EX(_FT("MsiSummaryInfoGetProperty PID_REVNUMBER failed: "));
		return NULL;
	}

	++cchMax; // Add NULL
	LPTSTR szPackageCode = (LPTSTR)
		::GlobalAlloc(GPTR, (cchMax) * sizeof(TCHAR));

	if (NULL == szPackageCode) {
		DBGPRT_ERR_EX(_FT("GlobalAlloc %d chars failed: "), cchMax );
		return NULL;
	}

	uiRet = msiApi.SummmaryInfoGetProperty(
		hSummaryInfo,
		PID_REVNUMBER,
		&uiDataType,
		&iValue,
		&ftValue,
		szPackageCode,
		&cchMax);

	ATLASSERT(VT_LPSTR == uiDataType);

	if (ERROR_SUCCESS != uiRet) {
		DBGPRT_ERR_EX(_FT("SummmaryInfoGetProperty PID_REVNUMBER failed for %d chars: "), cchMax);
		::GlobalFree((HGLOBAL)szPackageCode);
		return NULL;
	}

	return szPackageCode;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:81,代码来源:winutil.cpp

示例15: ATLASSERT

STDMETHODIMP CLHTMLWindow2::GetIDsOfNames(
		REFIID riid, LPOLESTR* rgszNames, UINT cNames,
		LCID lcid, DISPID* rgdispid
	)
{
	HRESULT hr;

	hr = IDispatchExImpl<CLHTMLWindow2, DispILHTMLWindow, &IID_DispILHTMLWindow, &LIBID_LHTMLLib>::GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid);
	if (SUCCEEDED(hr))
	{
		return hr;
	}

	ATLASSERT(0);
#if 0	// TODO have this
	if (m_pActiveDocument->m_containerScriptDispatch)
	{
		hr = m_pActiveDocument->m_containerScriptDispatch->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid);
		if (SUCCEEDED(hr))
		{
			ATLASSERT(rgdispid[0] >= 0);
			rgdispid[0] += 2000;
			return hr;
		}
	}
#endif

	return hr;

#if 0
	for (int i = 0; i < cNames; i++)
	{
		DISPID dispid;

		hr = IDispatchImpl<DispILHTMLWindow, &IID_DispILHTMLWindow, &LIBID_LHTMLLib>::GetIDsOfNames(riid, &rgszNames[i], 1, lcid, &dispid);
		if (SUCCEEDED(hr))
		{
			rgdispid[i] = dispid;
			continue;
		}

		hr = m_pActiveDocument->m_containerScriptDispatch->GetIDsOfNames(riid, &rgszNames[i], 1, lcid, &dispid);
		if (SUCCEEDED(hr))
		{
			ATLASSERT(dispid >= 0);
			rgdispid[i] = dispid+2000;
			continue;
		}
	}
#endif

#if 0
	hr = m_pFrame->m_pHTMLWindowImpl->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid);
	if (FAILED(hr)) hr = m_pFrame->m_pHTMLDialogImpl->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid);
	if (FAILED(hr))
	{
		hr = m_pFrame->m_pScriptDisp->GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid);

		if (SUCCEEDED(hr))
		{
			if (*rgdispid < 100)
				ATLASSERT(0);
		}
	}
#endif
	return hr;
}
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:67,代码来源:LHTMLWindow.cpp


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