/******************************************************************** WcaInitializeWow64() - Initializes the Wow64 API ********************************************************************/ extern "C" HRESULT WIXAPI WcaInitializeWow64() { AssertSz(WcaIsInitialized(), "WcaInitialize() should be called before calling WcaInitializeWow64()"); AssertSz(!WcaIsWow64Initialized(), "WcaInitializeWow64() should not be called twice without calling WcaFinalizeWow64()"); s_fWow64Initialized = FALSE; HRESULT hr = S_OK; s_Wow64FSRevertState = NULL; s_fWow64FSDisabled = false; // Test if we have access to the Wow64 API, and store the result in bWow64APIPresent s_hKernel32 = ::GetModuleHandleW(L"kernel32.dll"); if (!s_hKernel32) { ExitWithLastError(hr, "failed to get handle to kernel32.dll"); } // This will test if we have access to the Wow64 API s_pfnIsWow64Process = (BOOL (*)(HANDLE, PBOOL))::GetProcAddress(s_hKernel32, "IsWow64Process"); if (NULL != s_pfnIsWow64Process) { s_pfnDisableWow64 = (BOOL (*)(PVOID *))::GetProcAddress(s_hKernel32, "Wow64DisableWow64FsRedirection"); // If we fail, log the error but proceed, because we may not need a particular function, or the Wow64 API at all if (!s_pfnDisableWow64) { return S_FALSE; } s_pfnRevertWow64 = (BOOL (*)(PVOID))::GetProcAddress(s_hKernel32, "Wow64RevertWow64FsRedirection"); if (!s_pfnRevertWow64) { return S_FALSE; } if (s_pfnDisableWow64 && s_pfnRevertWow64) { s_fWow64Initialized = TRUE; } } else { return S_FALSE; } LExit: return hr; }
FARINTERNAL_(void) UtRemoveExtraOlePresStreams(LPSTORAGE pstg, int iStart) { VDATEHEAP(); HRESULT hr; // error code from stream deletion OLECHAR szName[sizeof(OLE_PRESENTATION_STREAM)/sizeof(OLECHAR)]; // space for the stream names // if the stream number is invalid, do nothing if ((iStart < 0) || (iStart >= OLE_MAX_PRES_STREAMS)) return; // create presentation stream name _xstrcpy(szName, OLE_PRESENTATION_STREAM); UtGetPresStreamName(szName, iStart); // for each of these streams that exists, get rid of it while((hr = pstg->DestroyElement(szName)) == NOERROR) { // if we've gotten to the end of the possible streams, quit if (++iStart >= OLE_MAX_PRES_STREAMS) break; // Get the next presentation stream name UtGetPresStreamName(szName, iStart); } // since the only reason these streams should be open, the first // failure had better be that the file was not found, and not // anything else (such as STG_E_ACCESSDENIED) AssertSz(hr == STG_E_FILENOTFOUND, "UtRemoveExtraOlePresStreams failure"); }
/******************************************************************** WcaFetchSingleRecord() - gets a single record from a view on the installing database ********************************************************************/ extern "C" HRESULT WIXAPI WcaFetchSingleRecord( __in MSIHANDLE hView, __out MSIHANDLE* phRec ) { if (!hView|| !phRec) { return E_INVALIDARG; } HRESULT hr = S_OK; UINT er = ::MsiViewFetch(hView, phRec); if (ERROR_NO_MORE_ITEMS == er) { hr = S_FALSE; } else { hr = HRESULT_FROM_WIN32(er); } ExitOnFailure(hr, "failed to fetch single record from view"); #ifdef DEBUG // only do this in debug to verify that a single record was returned MSIHANDLE hRecTest; er = ::MsiViewFetch(hView, &hRecTest); AssertSz(ERROR_NO_MORE_ITEMS == er && NULL == hRecTest, "WcaSingleFetch() did not fetch a single record"); ::MsiCloseHandle(hRecTest); #endif LExit: return hr; }
/******************************************************************** RmuEndSession - Ends the session. If the session was joined by RmuJoinSession, any remaining resources are registered before the session is ended (left). ********************************************************************/ extern "C" HRESULT DAPI RmuEndSession( __in PRMU_SESSION pSession ) { HRESULT hr = S_OK; DWORD er = ERROR_SUCCESS; AssertSz(vcRmuInitialized, "Restart Manager was not properly initialized."); // Make sure all resources are registered if we joined the session. if (!pSession->fStartedSessionHandle) { hr = RmuRegisterResources(pSession); ExitOnFailure(hr, "Failed to register remaining resources."); } er = vpfnRmEndSession(pSession->dwSessionHandle); ExitOnWin32Error(er, hr, "Failed to end the Restart Manager session."); LExit: if (pSession->fInitialized) { ::DeleteCriticalSection(&pSession->cs); } ReleaseNullStrArray(pSession->rgsczFilenames, pSession->cFilenames); ReleaseNullApplicationArray(pSession->rgApplications, pSession->cApplications); ReleaseNullStrArray(pSession->rgsczServiceNames, pSession->cServiceNames); ReleaseNullMem(pSession); RmuUninitialize(); return hr; }
//+--------------------------------------------------------------------------- // // Member: CDispRoot::SetDestination // // Synopsis: Set destination rendering surface. // // Arguments: hdc DC destination // pSurface IDirectDrawSurface // fOnscreen TRUE if rendering surface is onscreen // // Notes: // //---------------------------------------------------------------------------- void CDispRoot::SetDestination(HDC hdc, IDirectDrawSurface* pDDSurface) { AssertSz(!_fDrawLock, "Illegal call to SetDestination inside Draw()"); CDispSurface* pSurface = NULL; if(hdc) { pSurface = new CDispSurface(hdc); } else if(pDDSurface) { pSurface = new CDispSurface(pDDSurface); } if(pSurface) { if(_pRenderSurface) { delete _pRenderSurface; } _pRenderSurface = pSurface; _drawContext.SetDispSurface(_pRenderSurface); } }
extern "C" HRESULT DependencyExecutePackageProviderAction( __in const BURN_EXECUTE_ACTION* pAction ) { AssertSz(BURN_EXECUTE_ACTION_TYPE_PACKAGE_PROVIDER == pAction->type, "Execute action type not supported by this function."); HRESULT hr = S_OK; const BURN_PACKAGE* pPackage = pAction->packageProvider.pPackage; // Register or unregister the package provider(s). if (BURN_DEPENDENCY_ACTION_REGISTER == pAction->packageProvider.action) { hr = RegisterPackageProvider(pPackage); ExitOnFailure(hr, "Failed to register the package providers."); } else if (BURN_DEPENDENCY_ACTION_UNREGISTER == pAction->packageProvider.action) { UnregisterPackageProvider(pPackage); } LExit: if (!pPackage->fVital) { hr = S_OK; } return hr; }
/******************************************************************** RmuRegisterResources - Registers resources for the Restart Manager. This should be called rarely because it is expensive to run. Call functions like RmuAddFile for multiple resources then commit them as a batch of updates to RmuRegisterResources. Duplicate resources appear to be handled by Restart Manager. Only one WM_QUERYENDSESSION is being sent for each top-level window. ********************************************************************/ extern "C" HRESULT DAPI RmuRegisterResources( __in PRMU_SESSION pSession ) { HRESULT hr = S_OK; DWORD er = ERROR_SUCCESS; HMODULE hModule = NULL; PFNRMREGISTERRESOURCES pfnRmRegisterResources = NULL; AssertSz(vcRmuInitialized, "Restart Manager was not properly initialized."); ::EnterCriticalSection(&pSession->cs); er = vpfnRmRegisterResources( pSession->dwSessionHandle, pSession->cFilenames, pSession->rgsczFilenames, pSession->cApplications, pSession->rgApplications, pSession->cServiceNames, pSession->rgsczServiceNames ); ExitOnWin32Error(er, hr, "Failed to register the resources with the Restart Manager session."); // Empty the arrays if registered in case additional resources are added later. ReleaseNullStrArray(pSession->rgsczFilenames, pSession->cFilenames); ReleaseNullApplicationArray(pSession->rgApplications, pSession->cApplications); ReleaseNullStrArray(pSession->rgsczServiceNames, pSession->cServiceNames); LExit: ::LeaveCriticalSection(&pSession->cs); return hr; }
/* * CRchTxtPtr::InitRunPtrs(cp) * * @mfunc * Initialize Run Ptrs of this rich-text ptr to correspond to * document given by ped and to cp given by cp. */ void CRchTxtPtr::InitRunPtrs( LONG cp) // @parm character position to move RunPtrs to { TRACEBEGIN(TRCSUBSYSBACK, TRCSCOPEINTERN, "CRchTxtPtr::InitRunPtrs"); CTxtStory *pStory; AssertSz(GetPed(), "RTP::InitRunPtrs: illegal GetPed()"); if( IsRich() || IsIMERich() ) { pStory = GetPed()->GetTxtStory(); if(pStory->_pCFRuns) // and there's RichData, { // initialize format-run ptrs _rpCF.SetRunArray((CRunArray *)pStory->_pCFRuns); _rpCF.BindToCp(cp); } if (pStory->_pPFRuns) { _rpPF.SetRunArray((CRunArray *)pStory->_pPFRuns); _rpPF.BindToCp(cp); } } }
extern "C" HRESULT DependencyExecutePackageDependencyAction( __in BOOL fPerMachine, __in const BURN_EXECUTE_ACTION* pAction ) { AssertSz(BURN_EXECUTE_ACTION_TYPE_PACKAGE_DEPENDENCY == pAction->type, "Execute action type not supported by this function."); HRESULT hr = S_OK; const BURN_PACKAGE* pPackage = pAction->packageDependency.pPackage; // Register or unregister the bundle as a dependent of each package dependency provider. if (BURN_DEPENDENCY_ACTION_REGISTER == pAction->packageDependency.action) { hr = RegisterPackageDependency(fPerMachine, pPackage, pAction->packageDependency.sczBundleProviderKey); ExitOnFailure(hr, "Failed to register the dependency on the package provider."); } else if (BURN_DEPENDENCY_ACTION_UNREGISTER == pAction->packageDependency.action) { UnregisterPackageDependency(fPerMachine, pPackage, pAction->packageDependency.sczBundleProviderKey); } LExit: if (!pPackage->fVital) { hr = S_OK; } return hr; }
/******************************************************************* PipeTerminateChildProcess - *******************************************************************/ extern "C" HRESULT PipeTerminateChildProcess( __in BURN_PIPE_CONNECTION* pConnection, __in DWORD dwParentExitCode, __in BOOL fRestart ) { HRESULT hr = S_OK; BYTE* pbData = NULL; SIZE_T cbData = 0; // Prepare the exit message. hr = BuffWriteNumber(&pbData, &cbData, dwParentExitCode); ExitOnFailure(hr, "Failed to write exit code to message buffer."); hr = BuffWriteNumber(&pbData, &cbData, fRestart); ExitOnFailure(hr, "Failed to write restart to message buffer."); // Send the messages. if (INVALID_HANDLE_VALUE != pConnection->hCachePipe) { hr = WritePipeMessage(pConnection->hCachePipe, static_cast<DWORD>(BURN_PIPE_MESSAGE_TYPE_TERMINATE), pbData, cbData); ExitOnFailure(hr, "Failed to post terminate message to child process cache thread."); } hr = WritePipeMessage(pConnection->hPipe, static_cast<DWORD>(BURN_PIPE_MESSAGE_TYPE_TERMINATE), pbData, cbData); ExitOnFailure(hr, "Failed to post terminate message to child process."); // If we were able to get a handle to the other process, wait for it to exit. if (pConnection->hProcess) { if (WAIT_FAILED == ::WaitForSingleObject(pConnection->hProcess, PIPE_WAIT_FOR_CONNECTION * PIPE_RETRY_FOR_CONNECTION)) { ExitWithLastError(hr, "Failed to wait for child process exit."); } #ifdef DEBUG DWORD dwChildExitCode = 0; DWORD dwErrorCode = ERROR_SUCCESS; BOOL fReturnedExitCode = ::GetExitCodeProcess(pConnection->hProcess, &dwChildExitCode); if (!fReturnedExitCode) { dwErrorCode = ::GetLastError(); // if the other process is elevated and we are not, then we'll get ERROR_ACCESS_DENIED. // The unit test use a thread instead of a process so try to get the exit code from // the thread because we failed to get it from the process. if (ERROR_INVALID_HANDLE == dwErrorCode) { fReturnedExitCode = ::GetExitCodeThread(pConnection->hProcess, &dwChildExitCode); } } AssertSz((fReturnedExitCode && dwChildExitCode == dwParentExitCode) || (!fReturnedExitCode && ERROR_ACCESS_DENIED == dwErrorCode), "Child elevated process did not return matching exit code to parent process."); #endif } LExit: return hr; }
void CAdorner::HandleViewChange( DWORD flags, const RECT* prcClient, // global coordinates const RECT* prcClip, // global coordinates CDispNode* pDispNode) { AssertSz(0, "Unexpected/Unimplemented method called in CAdorner"); }
BOOL CAdorner::HitTestBorder( const POINT* pptHit, CDispNode* pDispNode, void* pClientData) { AssertSz(0, "CAdorner- unexpected and unimplemented method called"); return FALSE; }
void CDispRoot::RecalcRoot() { AssertSz(_cOpen==1, "Display Tree: Unexpected call to RecalcRoot"); AssertSz(!_fDrawLock, "Illegal call to RecalcRoot inside Draw()"); if(IsSet(CDispFlags::s_recalc)) { // set initial clip _drawContext._rcClip = _rcContainer; _drawContext._offset = _rcContainer.TopLeft().AsSize(); BOOL fSizeChanged = IsSet(CDispFlags::s_inval); _fRecalcLock = TRUE; Recalc(fSizeChanged, fSizeChanged, &_drawContext); _fRecalcLock = FALSE; } }
/******************************************************************* Dutil_Trace *******************************************************************/ extern "C" void DAPI Dutil_Trace( __in LPCSTR szFile, __in int iLine, __in REPORT_LEVEL rl, __in LPCSTR szFormat, ... ) { AssertSz(REPORT_NONE != rl, "REPORT_NONE is not a valid tracing level"); HRESULT hr = S_OK; char szOutput[DUTIL_STRING_BUFFER]; char szMsg[DUTIL_STRING_BUFFER]; if (Dutil_rlCurrentTrace < rl) return; va_list args; va_start(args, szFormat); hr = StringCchVPrintfA(szOutput, countof(szOutput), szFormat, args); va_end(args); if (SUCCEEDED(hr)) { LPCSTR szPrefix = "Trace/u"; char szMsg[DUTIL_STRING_BUFFER]; switch (rl) { case REPORT_STANDARD: szPrefix = "Trace/s"; break; case REPORT_VERBOSE: szPrefix = "Trace/v"; break; case REPORT_DEBUG: szPrefix = "Trace/d"; break; } if (Dutil_fTraceFilenames) hr = StringCchPrintfA(szMsg, countof(szMsg), "%s [%s,%d]: %s\r\n", szPrefix, szFile, iLine, szOutput); else hr = StringCchPrintfA(szMsg, countof(szMsg), "%s: %s\r\n", szPrefix, szOutput); if (SUCCEEDED(hr)) OutputDebugStringA(szMsg); // else fall through to the case below } if (FAILED(hr)) { if (Dutil_fTraceFilenames) StringCchPrintfA(szMsg, countof(szMsg), "Trace [%s,%d]: message too long, skipping\r\n", szFile, iLine); else StringCchPrintfA(szMsg, countof(szMsg), "Trace: message too long, skipping\r\n"); OutputDebugStringA(szMsg); } }
extern "C" LPVOID DAPI MemAlloc( __in SIZE_T cbSize, __in BOOL fZero ) { // AssertSz(vfMemInitialized, "MemInitialize() not called, this would normally crash"); AssertSz(cbSize > 0, "MemAlloc() called with invalid size"); return ::HeapAlloc(::GetProcessHeap(), fZero ? HEAP_ZERO_MEMORY : 0, cbSize); }
void CAdorner::DrawClientScrollbarFiller( const RECT* prcBounds, const RECT* prcRedraw, CDispSurface* pDispSurface, CDispNode* pDispNode, void* pClientData, DWORD dwFlags) { AssertSz(0, "CAdorner- unexpected and unimplemented method called"); }
/* * CArrayBase::ArInsert * * @mfunc Inserts <p celIns> new elements at index <p iel> * * @rdesc A pointer to the newly inserted elements. Will be NULL on * failure. */ void* CArrayBase::ArInsert( DWORD iel, //@parm the index at which to insert DWORD celIns) //@parm the number of elements to insert { char* pel; DWORD celNew; HRESULT hr; AssertSz(iel<=_cel, "CArrayBase::Insert() - Insert out of range"); if(iel >= _cel) { return ArAdd(celIns, NULL); } if(_cel+celIns > _celMax) // need to grow { AssertSz(_prgel, "CArrayBase::Insert() - Growing a non existent array !"); celNew = max(DWORD(celGrow), celIns+celGrow-celIns%celGrow); pel = _prgel; hr = MemRealloc((void**)&pel, (_celMax+celNew)*_cbElem); if(hr) { AssertSz(FALSE, "CArrayBase::Insert() - Couldn't realloc line array"); return NULL; } MemSetName((pel, "CArrayBase data - %d elements", celNew)); _prgel = pel; _celMax += celNew; } pel = _prgel + iel*_cbElem; if(iel < _cel) // Nove Elems up to make room for new ones { memmove(pel+celIns*_cbElem, pel, (_cel-iel)*_cbElem); ZeroMemory(pel, celIns*_cbElem); } _cel += celIns; return pel; }
CLine& CLinePtr::operator[](long dRun) { if(_prgRun) { return *CRunPtr<CLine>::GetRunRel(dRun); } AssertSz(dRun+GetIRun()==0 , "LP::[]: inconsistent line ptr"); return *(CLine*)CRunPtr<CLine>::GetRunAbs(GetIRun()); }
/******************************************************************** WcaDisableWow64FSRedirection() - Disables Wow64 FS Redirection ********************************************************************/ extern "C" HRESULT WIXAPI WcaDisableWow64FSRedirection() { AssertSz(s_fWow64Initialized && s_pfnDisableWow64 != NULL, "WcaDisableWow64FSRedirection() called, but Wow64 API was not initialized"); #ifdef DEBUG AssertSz(!s_fWow64FSDisabled, "You must call WcaRevertWow64FSRedirection() before calling WcaDisableWow64FSRedirection() again"); #endif HRESULT hr = S_OK; if (s_pfnDisableWow64(&s_Wow64FSRevertState)) { s_fWow64FSDisabled = TRUE; } else { ExitWithLastError(hr, "Failed to disable WOW64."); } LExit: return hr; }
ULONG CBaseFT::Release() { ULONG ulRefs = (ULONG)InterlockedDecrement((LONG*)&_ulRefs); if(ulRefs == 0) { Passivate(); AssertSz(_ulRefs==0, "CBaseFT::AddRef occured after last release"); SubRelease(); } return ulRefs; }
/******************************************************************** WcaCaScriptCreateKey() - creates a unique script key for this CustomAction. ********************************************************************/ extern "C" HRESULT WIXAPI WcaCaScriptCreateKey( __out LPWSTR* ppwzScriptKey ) { AssertSz(WcaIsInitialized(), "WcaInitialize() should have been called before calling this function."); HRESULT hr = S_OK; hr = StrAllocStringAnsi(ppwzScriptKey, WcaGetLogName(), 0, CP_ACP); ExitOnFailure(hr, "Failed to create script key."); LExit: return hr; }
/******************************************************************** WcaIsUnicodePropertySet() - returns TRUE if property is set ********************************************************************/ extern "C" BOOL WIXAPI WcaIsUnicodePropertySet( __in LPCWSTR wzProperty ) { DWORD cchProperty = 0; wchar_t wzEmpty[1] = L""; #ifdef DEBUG UINT er = #endif ::MsiGetPropertyW(WcaGetInstallHandle(), wzProperty, wzEmpty, &cchProperty); AssertSz(ERROR_INVALID_PARAMETER != er && ERROR_INVALID_HANDLE != er, "Unexpected return value from ::MsiGetProperty()"); return 0 < cchProperty; // property is set if the length is greater than zero }
/******************************************************************** WcaGlobalFinalize() - finalizes the Wca library, should be the called once per custom action Dll during DllMain on DLL_PROCESS_DETACH ********************************************************************/ extern "C" void WIXAPI WcaGlobalFinalize() { #ifdef DEBUG if (WcaIsInitialized()) { CHAR szBuf[2048]; StringCchPrintfA(szBuf, countof(szBuf), "CustomAction %s called WcaInitialize() but not WcaFinalize()", WcaGetLogName()); AssertSz(FALSE, szBuf); } #endif MemUninitialize(); g_hInstCADLL = NULL; }
void CAdorner::DrawClientScrollbar( int whichScrollbar, const RECT* prcBounds, const RECT* prcRedraw, LONG contentSize, LONG containerSize, LONG scrollAmount, CDispSurface* pSurface, CDispNode* pDispNode, void* pClientData, DWORD dwFlags) { AssertSz(0, "Unexpected/Unimplemented method called in CAdorner"); }
//+--------------------------------------------------------------------------- // // Member: CDispRoot::SetContentOffset // // Synopsis: Set an offset that shifts displayed content (used by printing // to effectively scroll content between pages). // // Arguments: sizeOffset offset amount, where positive values display // content farther to the right and bottom // // Returns: TRUE if the content offset amount was successfully set. // // Notes: // //---------------------------------------------------------------------------- BOOL CDispRoot::SetContentOffset(const SIZE& sizeOffset) { AssertSz(_cOpen==1, "Display Tree: Unexpected call to SetContentOffset"); if(_pFirstChildNode != NULL) { if(_pFirstChildNode->IsScroller()) { CDispScroller* pScroller = DYNCAST(CDispScroller, _pFirstChildNode); pScroller->ForceScrollOffset(sizeOffset); return TRUE; } } return FALSE; }
/******************************************************************** XmUninitialize - *********************************************************************/ extern "C" void DAPI XmlUninitialize( ) { AssertSz(vcXmlInitialized, "XmlUninitialize called when not initialized"); LONG cInitialized = ::InterlockedDecrement(&vcXmlInitialized); if (0 == cInitialized) { memset(&vclsidXMLDOM, 0, sizeof(vclsidXMLDOM)); if (fComInitialized) { ::CoUninitialize(); } } }
//+--------------------------------------------------------------------------- // // Member: CDispRoot::SetRootSize // // Synopsis: Set the size of the root container. // // Arguments: size new size // fInvalidateAll TRUE if entire area should be invalidated // // Notes: // //---------------------------------------------------------------------------- void CDispRoot::SetRootSize(const SIZE& size, BOOL fInvalidateAll) { AssertSz(!_fDrawLock, "Illegal call to SetRootSize inside Draw()"); if(fInvalidateAll) { _rcContainer.SetSize(size); _rcVisBounds.SetSize(size); InvalidateRoot(_rcVisBounds, FALSE, FALSE); SetFlag(CDispFlags::s_invalAndRecalcChildren); RequestRecalc(); return; } if(_rcContainer.Size() == size) { return; } // invalidate uncovered area CRect rcNew(_rcContainer.TopLeft(), size); if(rcNew.right != _rcContainer.right) { InvalidateRoot( CRect(min(rcNew.right, _rcContainer.right), _rcContainer.top, max(rcNew.right, _rcContainer.right), max(rcNew.bottom, _rcContainer.bottom)), FALSE, FALSE); } if(rcNew.bottom != _rcContainer.bottom) { InvalidateRoot( CRect(_rcContainer.left, min(rcNew.bottom, _rcContainer.bottom), max(rcNew.right, _rcContainer.right), max(rcNew.bottom, _rcContainer.bottom)), FALSE, FALSE); } // set new container size _rcContainer.SetSize(size); _rcVisBounds.SetSize(size); SetFlag(CDispFlags::s_recalcChildren); RequestRecalc(); }
/* * CArrayBase::Replace * * @mfunc Replaces the <p celRepl> elements at index <p ielRepl> with the * contents of the array specified by <p par>. If <p celRepl> is negative, * then the entire contents of <p this> array starting at <p ielRepl> should * be replaced. * * @rdesc Returns TRUE on success, FALSE otherwise. */ BOOL CArrayBase::Replace( DWORD ielRepl,//@parm the index at which replacement should occur LONG celRepl,//@parm the number of elements to replace (may be negative, indicating that all). CArrayBase* par) //@parm the array to use as the replacement source { DWORD celMove = 0; DWORD celIns = par->Count(); if(celRepl < 0) { celRepl = _cel - ielRepl; } AssertSz(ielRepl+celRepl<=_cel, "CArrayBase::ArReplace() - Replacing out of range"); celMove = min(celRepl, (LONG)celIns); if(celMove > 0) { memmove(Elem(ielRepl), par->Elem(0), celMove*_cbElem); celIns -= celMove; celRepl -= celMove; ielRepl += celMove; } Assert(celIns >= 0); Assert(celRepl >= 0); Assert(celIns+celMove == par->Count()); if(celIns > 0) { Assert(celRepl == 0); void* pelIns = ArInsert(ielRepl, celIns); if(!pelIns) { return FALSE; } memmove(pelIns, par->Elem(celMove), celIns*_cbElem); } else if(celRepl > 0) { Remove(ielRepl, celRepl, AF_DELETEMEM); } return TRUE; }
//+--------------------------------------------------------------------------- // // Member: CScrollbarController::OnMessage // // Synopsis: Handle messages sent to this scroll bar controller. // // Arguments: // // Notes: // //---------------------------------------------------------------------------- LRESULT CScrollbarController::OnMessage(UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_MOUSEMOVE: MouseMove(CPoint(MAKEPOINTS(lParam).x, MAKEPOINTS(lParam).y)); break; case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: AssertSz(FALSE, "CScrollbarController got unexpected message"); break; case WM_LBUTTONUP: if(_partPressed != SBP_NONE) { // invalidate just the part that was pressed _partPressed = SBP_NONE; CSize scrollOffset; _pDispScroller->GetScrollOffset(&scrollOffset); LONG containerSize = _rcScrollbar.Size(_direction); Verify(_pLayout->OpenView()); InvalidatePart( _partPressedStart, _direction, _rcScrollbar, _pDispScroller->GetContentSize()[_direction], containerSize, scrollOffset[_direction], _buttonWidth, _pDispScroller, &_drawInfo); } // fall thru to Terminate... case WM_CAPTURECHANGED: goto Terminate; } return 0; Terminate: StopScrollbarController(); return 0; }
/******************************************************************** WcaExecuteView() - executes a parameterized open view on the installing database ********************************************************************/ extern "C" HRESULT WIXAPI WcaExecuteView( __in MSIHANDLE hView, __in MSIHANDLE hRec ) { if (!hView) { return E_INVALIDARG; } AssertSz(hRec, "Use WcaOpenExecuteView() if you don't need to pass in a record"); HRESULT hr = S_OK; UINT er = ::MsiViewExecute(hView, hRec); ExitOnWin32Error(er, hr, "failed to execute view"); LExit: return hr; }