/*---------------------------------------------------------------------------------------------- Read the given number of bytes from the stream / file. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::Read(void * pv, ULONG cb, ULONG * pcbRead) { BEGIN_COM_METHOD; ChkComArrayArg((byte *)pv, cb); ChkComArgPtrN(pcbRead); if (m_hfile == NULL) ThrowHr(WarnHr(E_UNEXPECTED)); if (cb == 0) { if (pcbRead) *pcbRead = 0; return S_OK; } if (!SetFilePosRaw()) ThrowHr(WarnHr(STG_E_SEEKERROR)); DWORD cbRead = 0; if (!ReadFile(m_hfile, pv, cb, &cbRead, NULL)) ThrowHr(WarnHr(STG_E_READFAULT)); m_ibFilePos.QuadPart += cbRead; if (pcbRead) *pcbRead = cbRead; END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Static method that returns the path name of the dll or exe. ----------------------------------------------------------------------------------------------*/ LPCTSTR ModuleEntry::GetModulePathName() { #if WIN32 if (s_strbpPath.Length() == 0) { ULONG cchMod; s_strbpPath.SetLength(MAX_PATH); cchMod = GetModuleFileName(s_hmod, &s_strbpPath[0], MAX_PATH); s_strbpPath.SetLength(cchMod); if (!cchMod) ThrowHr(WarnHr(E_FAIL)); } return s_strbpPath.Chars(); #else if (s_strbpPath[0] == 0) { ULONG cchMod; cchMod = GetModuleFileName(s_hmod, &s_strbpPath[0], MAX_PATH); if (!cchMod) ThrowHr(WarnHr(E_FAIL)); } return s_strbpPath; #endif }
/*---------------------------------------------------------------------------------------------- Write the given number of bytes to the stream / file. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::Write(const void * pv, ULONG cb, ULONG * pcbWritten) { BEGIN_COM_METHOD; ChkComArrayArg((byte *)pv, cb); ChkComArgPtrN(pcbWritten); if (m_hfile == NULL) ThrowHr(WarnHr(E_UNEXPECTED)); if (cb == 0) { if (pcbWritten) *pcbWritten = 0; return S_OK; } if (!SetFilePosRaw()) ThrowHr(WarnHr(STG_E_SEEKERROR)); DWORD cbWritten = 0; if (!WriteFile(m_hfile, pv, cb, &cbWritten, NULL)) ThrowHr(WarnHr(STG_E_WRITEFAULT)); m_ibFilePos.QuadPart += cbWritten; if (pcbWritten) *pcbWritten = cbWritten; END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Attach the given hwnd to this AfWnd. This means that we save hwnd as m_hwns, and store a pointer to this AfWnd object as the user data associated with the hwnd. This is normally called when WM_CREATE is processed, but may be called at a later time, especially for controls in dialogs. @param hwnd Handle to a window. ----------------------------------------------------------------------------------------------*/ void AfWnd::AttachHwnd(HWND hwnd) { AssertObj(this); Assert(hwnd != NULL); if (m_hwnd) { if (m_hwnd == hwnd) return; AssertMsg(false, "AfWnd already attached to a different HWND."); ThrowHr(E_FAIL); } AfWnd * pwnd = reinterpret_cast<AfWnd *>(::GetWindowLong(hwnd, GWL_USERDATA)); if (pwnd) { AssertMsg(false, "Hwnd already attached to an AfWnd"); ThrowHr(E_FAIL); } ::SetWindowLong(hwnd, GWL_USERDATA, (long)this); AddRef(); m_hwnd = hwnd; PostAttach(); }
STDMETHODIMP LgLanguageEnumerator::Next(int * pnLoc, BSTR * pbstrName) { BEGIN_COM_METHOD ChkComOutPtr(pnLoc); ChkComOutPtr(pbstrName); if (!m_prgLangIds) ThrowHr(WarnHr(E_UNEXPECTED)); if (m_iLangId >= m_ulCount) return S_OK; // past end, leave *pnLoc 0 and *pbstrName null. wchar szLangName[MAX_PATH]; //Get the language name and print it to the debug window. if( 0 == GetLocaleInfoW(MAKELCID(m_prgLangIds[m_iLangId], SORT_DEFAULT), LOCALE_SLANGUAGE, szLangName, MAX_PATH)) { //InKey can give values that are not supported by the operating system. //Return the bad id with an error message *pnLoc = m_prgLangIds[m_iLangId++]; return E_FAIL; } *pbstrName = SysAllocString(szLangName); if (!*pbstrName) ThrowHr(WarnHr(E_OUTOFMEMORY)); *pnLoc = m_prgLangIds[m_iLangId++]; END_COM_METHOD(g_factLang, IID_ILgLanguageEnumerator); }
/*---------------------------------------------------------------------------------------------- Detach the given hwnd from this AfWnd. This is normally called when WM_NCDESTROY is processed, but may be called earlier. @param hwnd Handle to a window. ----------------------------------------------------------------------------------------------*/ void AfWnd::DetachHwnd(HWND hwnd) { AssertObj(this); Assert(hwnd != NULL); if (!m_hwnd) { AssertMsg(false, "AfWnd not attached to the HWND."); ThrowHr(E_FAIL); } AfWnd * pwnd = reinterpret_cast<AfWnd *>(::GetWindowLong(hwnd, GWL_USERDATA)); if (pwnd != this) { AssertMsg(false, "Hwnd not attached to this AfWnd"); ThrowHr(E_FAIL); } ::SetWindowLong(hwnd, GWL_USERDATA, 0); if (m_wnpDefWndProc) { ::SetWindowLong(hwnd, GWL_WNDPROC, (long)m_wnpDefWndProc); m_wnpDefWndProc = NULL; } m_hwnd = NULL; Release(); }
/*---------------------------------------------------------------------------------------------- Get the status of an open IStream (file). If the caller uses the value STATFLAG_DEFAULT for grfStatFlag then the user must free the memory which this method allocates for the file name at pstatstg->pwcsName. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::Stat(STATSTG * pstatstg, DWORD grfStatFlag) { BEGIN_COM_METHOD; ChkComArgPtr(pstatstg); if (m_hfile == NULL) ThrowHr(WarnHr(E_UNEXPECTED)); BY_HANDLE_FILE_INFORMATION bhfi; if (!GetFileInformationByHandle(m_hfile, &bhfi)) { // The caller does not have sufficient permissions for accessing statistics for this // stream object. ThrowHr(WarnHr(STG_E_ACCESSDENIED)); } pstatstg->pwcsName = NULL; switch (grfStatFlag) { case STATFLAG_DEFAULT: // Requests that the statistics include the pwcsName member of the STATSTG structure. { StrUniBufPath stubpName = m_staPath.Chars(); pstatstg->pwcsName = (wchar *)CoTaskMemAlloc( (stubpName.Length() + 1) * isizeof(wchar)); if (NULL == pstatstg->pwcsName) ThrowHr(WarnHr(STG_E_INSUFFICIENTMEMORY)); memcpy(pstatstg->pwcsName, stubpName.Chars(), stubpName.Length() * isizeof(wchar)); pstatstg->pwcsName[stubpName.Length()] = 0; } // Fall Through. case STATFLAG_NONAME: // Requests that the statistics not include the pwcsName member of the STATSTG // structure. If the name is omitted, there is no need for the Stat methods to allocate // and free memory for the string value for the name and the method can save an Alloc // and the caller a Free operation. pstatstg->type = STGTY_STREAM; pstatstg->cbSize.HighPart = bhfi.nFileSizeHigh; pstatstg->cbSize.LowPart = bhfi.nFileSizeLow; pstatstg->mtime = bhfi.ftLastWriteTime; pstatstg->ctime = bhfi.ftCreationTime; pstatstg->atime = bhfi.ftLastAccessTime; pstatstg->grfMode = m_grfstgm; pstatstg->grfLocksSupported = 0; pstatstg->clsid = CLSID_NULL; pstatstg->grfStateBits = 0; return S_OK; default: ThrowHr(WarnHr(STG_E_INVALIDFLAG)); } END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Collapses all Undo items back to a specified mark and creates a single Undo task for all of them. Also discards the mark. If there are no sequences following the mark, then simply discard the mark. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP ActionHandler::CollapseToMark(int hMark, BSTR bstrUndo, BSTR bstrRedo, ComBool * pf) { BEGIN_COM_METHOD; // It's only valid to collapse to a mark while no action sequence is in progress. if (m_nDepth > 0) { ThrowHr(WarnHr(E_UNEXPECTED)); } m_fCanContinueTask = false; // Can't merge another action into the current task. *pf = false; // no actions collapsed yet // The handle hMark is 1 + the position of the mark in the mark stack. int iMarkGoal = (hMark == 0) ? m_viMarks.Size() - 1 : hMark - 1; if (iMarkGoal >= m_viMarks.Size() || iMarkGoal < 0) ThrowHr(E_INVALIDARG, L"hMark value too great. Don't have that many marks available."); CleanUpRedoActions(true); bool fSeqFoundAfterMark = false; // Find the task the mark points to and delete tasks following the mark. for (int iuSeq = m_viSeqStart.Size() - 1; iuSeq >= 0 && m_viSeqStart[iuSeq] >= m_viMarks[iMarkGoal]; iuSeq--) { m_viSeqStart.Delete(iuSeq); m_vstuUndo.Delete(iuSeq); m_vstuRedo.Delete(iuSeq); fSeqFoundAfterMark = true; } if (fSeqFoundAfterMark) { // Now create a new task that includes all the actions following the mark. m_viSeqStart.Push(m_viMarks[iMarkGoal]); m_vstuUndo.Push(bstrUndo); m_vstuRedo.Push(bstrRedo); // Make sure the current task pointer points to a valid task. if (m_iCurrSeq >= m_viSeqStart.Size()) m_iCurrSeq = m_viSeqStart.Size() - 1; m_fCanContinueTask = true; // At this point we DO have an existing task we could append to. *pf = true; } //// Delete all actions that are already undone - after collapsing they can't be //// redone any more. //for (int iuAct = m_vquact.Size() - 1; iuAct >= 0 && m_iuactCurr < iuAct; iuAct--) // m_vquact.Delete(iuAct); // Delete the mark (and any that follow) we're collapsing to. for (int iMarkTmp = m_viMarks.Size() - 1; iMarkTmp >= iMarkGoal; iMarkTmp--) m_viMarks.Delete(iMarkTmp); END_COM_METHOD(g_factActh, IID_IActionHandler); }
/*---------------------------------------------------------------------------------------------- Copy cb bytes from the current position in this stream to the current position in the stream *pstm. Uses FileStream ${#Read} and ${#Write} methods. Note that though it would be more efficient in some cases to bypass the Read method for several consecutive reads, the case of copying to a clone would require special handling. There is no check for overlapping read & write areas. REVIEW (JohnL): Should there be? ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::CopyTo(IStream * pstm, ULARGE_INTEGER cb, ULARGE_INTEGER * pcbRead, ULARGE_INTEGER * pcbWritten) { BEGIN_COM_METHOD; ChkComArgPtr(pstm); ChkComArgPtrN(pcbRead); ChkComArgPtrN(pcbWritten); if (cb.HighPart) ThrowHr(WarnHr(STG_E_INVALIDPARAMETER)); // handle only 32-bit byte counts // REVIEW JohnL: should we nevertheless handle cb == max ULARGE_INTEGER as a special case? if (pstm == this) ThrowHr(WarnHr(STG_E_INVALIDPARAMETER)); // prevent copy to self // REVIEW JohnL: is this correct? if (pcbRead) (*pcbRead).QuadPart = 0; if (pcbWritten) (*pcbWritten).QuadPart = 0; const ULONG kcbBufferSize = 4096; ULONG cbReadTotal; ULONG cbWrittenTotal = 0; byte prgbBuffer[kcbBufferSize]; ULONG cbRead = 0; ULONG cbWritten; ULONG cbr = 0; for (cbReadTotal = 0; (cbReadTotal < cb.LowPart) && (cbRead == cbr); ) { cbr = cb.LowPart - cbReadTotal; if (cbr > kcbBufferSize) cbr = kcbBufferSize; CheckHr(Read((void *)prgbBuffer, cbr, &cbRead)); cbReadTotal += cbRead; if (cbRead) { CheckHr(pstm->Write((void *)prgbBuffer, cbRead, &cbWritten)); cbWrittenTotal += cbWritten; } } if (pcbRead) (*pcbRead).LowPart = cbReadTotal; if (pcbWritten) (*pcbWritten).LowPart = cbWrittenTotal; // REVIEW JohnL: How do we define "success" for CopyTo? Should we return a failure if // cbWrittenTotal != cbReadTotal? END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Flush the file's buffer. Since we are dealing with a file opened in director mode, we just flush the buffer and ignore the grfCommitFlags. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::Commit(DWORD grfCommitFlags) { BEGIN_COM_METHOD; // FlushFileBuffers may return an error if m_hfile doesn't have GENERIC_WRITE access. if (!(m_grfstgm & (kfstgmReadWrite | kfstgmWrite))) ThrowHr(WarnHr(STG_E_INVALIDFUNCTION)); if (!FlushFileBuffers(m_hfile)) { // REVIEW JohnL: Should we check for medium full before returning this code? ThrowHr(WarnHr(STG_E_MEDIUMFULL)); } END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Create and subclass the HWND associated with this AfWnd object. @param wcs Pointer to the object containing the values for calling ::CreateWindowEx. ----------------------------------------------------------------------------------------------*/ void AfWnd::CreateAndSubclassHwnd(WndCreateStruct & wcs) { AssertObj(this); Assert(!m_hwnd); PreCreateHwnd(wcs); HWND hwnd = ::CreateWindowEx(wcs.dwExStyle, wcs.lpszClass, wcs.lpszName, wcs.style, wcs.x, wcs.y, wcs.cx, wcs.cy, wcs.hwndParent, wcs.hMenu, wcs.hInstance, wcs.lpCreateParams); Assert(!m_hwnd); if (!hwnd) ThrowHr(WarnHr(E_FAIL)); try { SubclassHwnd(hwnd); } catch (...) { ::DestroyWindow(hwnd); throw; } }
/*---------------------------------------------------------------------------------------------- Create the HWND associated with this AfWnd object. @param wcs Pointer to the object containing the values for calling ::CreateWindowEx. ----------------------------------------------------------------------------------------------*/ void AfWnd::CreateHwnd(WndCreateStruct & wcs) { AssertObj(this); Assert(!m_hwnd); PreCreateHwnd(wcs); AfWndCreate afwc = { this, wcs.lpCreateParams }; HWND hwnd = ::CreateWindowEx(wcs.dwExStyle, wcs.lpszClass, wcs.lpszName, wcs.style, wcs.x, wcs.y, wcs.cx, wcs.cy, wcs.hwndParent, wcs.hMenu, wcs.hInstance, &afwc); Assert(m_hwnd == hwnd); if (!hwnd) { #if 0 // Popup DEBUG explanation of failure. LPVOID lpMsgBuf; ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); ::MessageBox(NULL, (LPCTSTR)lpMsgBuf, _T("DEBUG"), MB_OK); ::LocalFree(lpMsgBuf); #endif ThrowHr(WarnHr(E_FAIL)); } }
const Normalizer2* SilUtil::GetIcuNormalizer(UNormalizationMode mode) { UErrorCode uerr = U_ZERO_ERROR; const Normalizer2* norm = NULL; switch (mode) { case UNORM_NFD: norm = Normalizer2::getInstance(NULL, "nfc_fw", UNORM2_DECOMPOSE, uerr); break; case UNORM_NFC: norm = Normalizer2::getInstance(NULL, "nfc_fw", UNORM2_COMPOSE, uerr); break; case UNORM_NFKD: norm = Normalizer2::getInstance(NULL, "nfkc_fw", UNORM2_DECOMPOSE, uerr); break; case UNORM_NFKC: norm = Normalizer2::getInstance(NULL, "nfkc_fw", UNORM2_COMPOSE, uerr); break; case UNORM_FCD: norm = Normalizer2::getInstance(NULL, "nfc_fw", UNORM2_FCD, uerr); break; } if (!U_SUCCESS(uerr)) ThrowHr(E_FAIL); return norm; }
STDMETHODIMP VwInvertedEnv::AddLazyVecItems(int tag, IVwViewConstructor * pvvc, int frag) { BEGIN_COM_METHOD; Assert(false); // "This type of box is not yet supported in inverted views"); ThrowHr(WarnHr(E_NOTIMPL)); END_COM_METHOD(dfactEnv, IID_IVwEnv); }
/*---------------------------------------------------------------------------------------------- Allocate our TLS slot. ----------------------------------------------------------------------------------------------*/ void TextServGlobals::ProcessAttach(void) { #if WIN32 s_luTls = TlsAlloc(); if (0xFFFFFFFF == s_luTls) ThrowHr(WarnHr(E_FAIL)); #else if (pthread_key_create(&s_luTls, 0) != 0) ThrowHr(WarnHr(E_FAIL)); #endif //WIN32 #if WIN32 InitializeCriticalSection(&g_crs); #else pthread_mutex_init(&g_crs, 0); #endif //WIN32 }
STDMETHODIMP VwInvertedEnv::OpenMappedPara() { BEGIN_COM_METHOD; Assert(false); // "This type of box is not yet supported in inverted views"); ThrowHr(WarnHr(E_NOTIMPL)); END_COM_METHOD(dfactEnv, IID_IVwEnv); }
/*---------------------------------------------------------------------------------------------- Creates a new stream object with its own seek pointer that references the same bytes as the original stream. The m_qstrmBase member in the clone is set to the IStream interface pointer of the original FileStream object for ${#AddRef} and ${#Release} calls which are used to prevent that object from being deleted until after all clones have been deleted. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::Clone(IStream ** ppstm) { BEGIN_COM_METHOD; ChkComOutPtr(ppstm); FileStream * pfist; pfist = NewObj FileStream; if (!pfist) ThrowHr(WarnHr(STG_E_INSUFFICIENTMEMORY)); pfist->m_staPath = m_staPath; // If this is the first clone, a pointer to the current object is fine. Otherwise (if we // are making a clone from a clone) copy the current pointer. if (!m_qstrmBase) { pfist->m_qstrmBase = this; } else { pfist->m_qstrmBase = m_qstrmBase; } pfist->m_hfile = m_hfile; pfist->m_ibFilePos = m_ibFilePos; pfist->m_grfstgm = m_grfstgm; *ppstm = pfist; END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Adjust the stream seek pointer, returning the new value. @return STG_E_SEEKERROR if the new position would be negative. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER * plibNewPosition) { BEGIN_COM_METHOD; ChkComArgPtrN(plibNewPosition); if (m_hfile == NULL) ThrowHr(WarnHr(E_UNEXPECTED)); DWORD dwLow; long dwHigh; LARGE_INTEGER dlibNew; // attempted new seek position switch (dwOrigin) { case STREAM_SEEK_SET: dlibNew.QuadPart = dlibMove.QuadPart; break; case STREAM_SEEK_CUR: dlibNew.QuadPart = (int64)m_ibFilePos.QuadPart + dlibMove.QuadPart; break; case STREAM_SEEK_END: // Find out where EOF is by calling for a zero move of the file pointer dwHigh = 0; dwLow = SetFilePointer(m_hfile, 0, &dwHigh, FILE_END); if (dwLow == 0xFFFFFFFF && GetLastError() != NO_ERROR) ThrowHr(WarnHr(STG_E_SEEKERROR)); // Work out new attempted seek pointer value dlibNew.LowPart = dwLow; dlibNew.HighPart = dwHigh; dlibNew.QuadPart += dlibMove.QuadPart; break; default: ThrowHr(WarnHr(STG_E_INVALIDFUNCTION)); } if (dlibNew.QuadPart < 0) ThrowHr(WarnHr(STG_E_SEEKERROR)); // Update the current position. m_ibFilePos.QuadPart = (uint64)dlibNew.QuadPart; if (plibNewPosition) plibNewPosition->QuadPart = (uint64)dlibNew.QuadPart; END_COM_METHOD(g_fact, IID_IStream); }
void LgIcuResourceBundle::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv) { AssertPtr(ppv); Assert(!*ppv); if (punkCtl) ThrowHr(WarnHr(CLASS_E_NOAGGREGATION)); ComSmartPtr<LgIcuResourceBundle> qlcpe; StrUtil::InitIcuDataDir(); UErrorCode uerr = U_ZERO_ERROR; ResourceBundle rbt(NULL, Locale("en"), uerr); if (U_FAILURE(uerr)) ThrowHr(E_FAIL); qlcpe.Attach(NewObj LgIcuResourceBundle(rbt)); // ref count initialy 1 CheckHr(qlcpe->QueryInterface(riid, ppv)); }
/*---------------------------------------------------------------------------------------------- Change the size of the data stream. NOTE: this is not supported by ResourceStream. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP ResourceStream::SetSize(ULARGE_INTEGER libNewSize) { BEGIN_COM_METHOD; ThrowHr(WarnHr(STG_E_ACCESSDENIED)); END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Ensure that any changes made to this transacted stream are reflected in the parent storage object. NOTE: this is not supported by ResourceStream. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP ResourceStream::Commit(DWORD grfCommitFlags) { BEGIN_COM_METHOD; ThrowHr(WarnHr(STG_E_INVALIDFUNCTION)); END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Discard all changes that have been made to this transacted stream since the last IStream::Commit call. NOTE: this is not supported by ResourceStream. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP ResourceStream::Revert(void) { BEGIN_COM_METHOD; ThrowHr(WarnHr(STG_E_INVALIDFUNCTION)); END_COM_METHOD(g_fact, IID_IStream); }
STDMETHODIMP VwInvertedEnv::OpenConcPara(int ichMinItem, int ichLimItem, VwConcParaOpts cpoFlags, int dmpAlign) { BEGIN_COM_METHOD; Assert(false); // "This type of box is not yet supported in inverted views"); ThrowHr(WarnHr(E_NOTIMPL)); END_COM_METHOD(dfactEnv, IID_IVwEnv); }
STDMETHODIMP VwInvertedEnv::OpenOverridePara(int cOverrideProperties, DispPropOverride *prgOverrideProperties) { BEGIN_COM_METHOD; Assert(false); // "This type of box is not yet supported in inverted views"); ThrowHr(WarnHr(E_NOTIMPL)); END_COM_METHOD(dfactEnv, IID_IVwEnv); }
HRESULT VwGraphicsCairo::GetGlyphMetrics(int chw, int * psBoundingWidth, int * pyBoundingHeight, int * pxBoundingX, int * pyBoundingY, int * pxAdvanceX, int * pyAdvanceY) { BEGIN_COM_METHOD; ThrowHr(E_NOTIMPL); END_COM_METHOD(g_fact, IID_IVwGraphics); }
// Get the nth locale variant. (ICU getVariant.) STDMETHODIMP LgIcuLocaleEnumerator::get_Variant(int iloc, BSTR * pbstrName) { BEGIN_COM_METHOD ChkComOutPtr(pbstrName); if (iloc >= m_clocale) ThrowHr(WarnHr(E_INVALIDARG)); *pbstrName = AsciiToBstr(m_prgLocales[iloc].getVariant()); END_COM_METHOD(g_factLocEnum, IID_ILgIcuLocaleEnumerator); }
/*---------------------------------------------------------------------------------------------- Remove the access restriction on a range of bytes previously restricted with IStream::LockRegion. NOTE: this is not supported by FileStream. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { BEGIN_COM_METHOD; ThrowHr(WarnHr(STG_E_INVALIDFUNCTION)); END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- This should just return the appropriate error code. See the definition of IStream. ----------------------------------------------------------------------------------------------*/ STDMETHODIMP FileStream::Revert(void) { BEGIN_COM_METHOD; // This should not be implemented, no transaction support. ThrowHr(WarnHr(STG_E_INVALIDFUNCTION)); END_COM_METHOD(g_fact, IID_IStream); }
/*---------------------------------------------------------------------------------------------- Called by the GenericFactory to "create" an ITsPropsFactory. It just returns the global one. ----------------------------------------------------------------------------------------------*/ void TsPropsFact::CreateCom(IUnknown * punkOuter, REFIID iid, void ** ppv) { AssertPtr(ppv); Assert(!*ppv); if (punkOuter) ThrowHr(WarnHr(CLASS_E_NOAGGREGATION)); CheckHr(g_tpf.QueryInterface(iid, ppv)); }
STDMETHODIMP VwInvertedEnv::OpenTable(int ccolm, VwLength vlenWidth, int mpBorder, VwAlignment vwalign, VwFramePosition frmpos, VwRule vwrule, int mpSpacing, int mpPadding, ComBool fSelectOneCol) { BEGIN_COM_METHOD; Assert(false); // "This type of box is not yet supported in inverted views"); ThrowHr(WarnHr(E_NOTIMPL)); END_COM_METHOD(dfactEnv, IID_IVwEnv); }