/********************************************************************* * _CxxThrowException (MSVCRT.@) */ void WINAPI _CxxThrowException( exception *object, const cxx_exception_type *type ) { ULONG_PTR args[3]; args[0] = CXX_FRAME_MAGIC_VC6; args[1] = (ULONG_PTR)object; args[2] = (ULONG_PTR)type; RaiseException( CXX_EXCEPTION, EH_NONCONTINUABLE, 3, args ); }
void SetThreadName(LPCSTR szThreadName) { THREADNAME_INFO info; info.dwType = 0x1000; info.szName = szThreadName; info.dwThreadID = -1; info.dwFlags = 0; __try { RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD), (ULONG_PTR *)&info); } __except (EXCEPTION_CONTINUE_EXECUTION) {} }
void zmq::zmq_abort(const char *errmsg_) { #if defined ZMQ_HAVE_WINDOWS // Raise STATUS_FATAL_APP_EXIT. ULONG_PTR extra_info [1]; extra_info [0] = (ULONG_PTR) errmsg_; RaiseException (0x40000015, EXCEPTION_NONCONTINUABLE, 1, extra_info); #else abort (); #endif }
CURLMcode __stdcall vbcurl_multi_cleanup(MULTI_CONTEXT* pmc) { CURLMcode ret; if (pmc->_magic != MULTI_MAGIC) RaiseException(0xE0000000, EXCEPTION_NONCONTINUABLE, 0, NULL); ret = curl_multi_cleanup(pmc->_multi); free(pmc); return ret; }
SV *NewReference(PERL_CALL SV *refObj) { SV *reference = NULL; if(!refObj || !(reference = newRV(refObj))) RaiseException(STATUS_NO_MEMORY, 0, 0, NULL); return reference; }
//--------------------------------------------------------------------------------------- void _set_invalid_parameter_handler_callback( PCTSTR expression, PCTSTR function, PCTSTR file, unsigned int line, uintptr_t pReserved ) { printf ( "_set_invalid_parameter_handler_callback \n" ); RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, 0, NULL); exit(0); }
void pony_throw() { //Continuable exception with no arguments. RaiseException involves a kernel //mode transition. RaiseException(PONY_EXCEPTION_CLASS, 0, 0, NULL); //Never reaches here, since exceptions are always handled. abort(); }
unsigned char * __RPC_USER STGMEDIUM_UserUnmarshal(unsigned long *pFlags, unsigned char *pBuffer, STGMEDIUM *pStgMedium) { DWORD content; DWORD releaseunk; ALIGN_POINTER(pBuffer, 3); TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", pBuffer, pStgMedium); pStgMedium->tymed = *(DWORD *)pBuffer; pBuffer += sizeof(DWORD); if (pStgMedium->tymed != TYMED_NULL) { content = *(DWORD *)pBuffer; pBuffer += sizeof(DWORD); } releaseunk = *(DWORD *)pBuffer; pBuffer += sizeof(DWORD); switch (pStgMedium->tymed) { case TYMED_NULL: TRACE("TYMED_NULL\n"); break; case TYMED_HGLOBAL: TRACE("TYMED_HGLOBAL\n"); pBuffer = HGLOBAL_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hGlobal); break; case TYMED_FILE: FIXME("TYMED_FILE\n"); break; case TYMED_ISTREAM: FIXME("TYMED_ISTREAM\n"); break; case TYMED_ISTORAGE: FIXME("TYMED_ISTORAGE\n"); break; case TYMED_GDI: FIXME("TYMED_GDI\n"); break; case TYMED_MFPICT: FIXME("TYMED_MFPICT\n"); break; case TYMED_ENHMF: TRACE("TYMED_ENHMF\n"); pBuffer = HENHMETAFILE_UserUnmarshal(pFlags, pBuffer, &pStgMedium->u.hEnhMetaFile); break; default: RaiseException(DV_E_TYMED, 0, 0, NULL); } pStgMedium->pUnkForRelease = NULL; if (releaseunk) FIXME("unmarshal pUnkForRelease\n"); return pBuffer; }
CURLMcode __stdcall vbcurl_multi_fdset(MULTI_CONTEXT* pmc) { CURLMcode cl; if (pmc->_magic != MULTI_MAGIC) RaiseException(0xE0000000, EXCEPTION_NONCONTINUABLE, 0, NULL); cl = curl_multi_fdset(pmc->_multi, &pmc->_readSet, &pmc->_writeSet, &pmc->_excSet, &pmc->_maxFD); return cl; }
static BOOL is_xpoint_break(int bpnum) { int type = dbg_curr_process->bp[bpnum].xpoint_type; if (type == be_xpoint_break || type == be_xpoint_watch_exec) return TRUE; if (type == be_xpoint_watch_read || type == be_xpoint_watch_write) return FALSE; RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); return FALSE; /* never reached */ }
CURLMcode __stdcall vbcurl_multi_perform(MULTI_CONTEXT* pmc, int* runningHandles) { CURLMcode cl; if (pmc->_magic != MULTI_MAGIC) RaiseException(0xE0000000, EXCEPTION_NONCONTINUABLE, 0, NULL); cl = curl_multi_perform(pmc->_multi, runningHandles); return cl; }
static void __cdecl gl_msvc_invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t dummy) { RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); }
AV *NewArray(PERL_CALL_SINGLE) { AV *array = newAV(); if(!array) RaiseException(STATUS_NO_MEMORY, 0, 0, NULL); return array; }
HV *NewHash(PERL_CALL_SINGLE) { HV *hash = newHV(); if(!hash) RaiseException(STATUS_NO_MEMORY, 0, 0, NULL); return hash; }
unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(unsigned long *pFlags, unsigned char *pBuffer, HENHMETAFILE *phEmf) { ULONG fContext; TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", pBuffer, phEmf); fContext = *(ULONG *)pBuffer; pBuffer += sizeof(ULONG); if (((fContext == WDT_INPROC_CALL) && (sizeof(*phEmf) < 8)) || ((fContext == WDT_INPROC64_CALL) && (sizeof(*phEmf) == 8))) { *phEmf = *(HENHMETAFILE *)pBuffer; pBuffer += sizeof(*phEmf); } else if (fContext == WDT_REMOTE_CALL) { ULONG handle; handle = *(ULONG *)pBuffer; pBuffer += sizeof(ULONG); if (handle) { ULONG size; size = *(ULONG *)pBuffer; pBuffer += sizeof(ULONG); if (size != *(ULONG *)pBuffer) { RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL); return pBuffer; } pBuffer += sizeof(ULONG); *phEmf = SetEnhMetaFileBits(size, pBuffer); pBuffer += size; } else *phEmf = NULL; } else RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL); return pBuffer; }
// 从CByteArray获取数据块 void* _GetBufferFromByteArray(BYTE* pSource, long &lPtr, void* pBuf, long lLen, long bufSize) { if( bufSize != -1 && bufSize < lPtr+lLen ) RaiseException(0x1000A, EXCEPTION_NONCONTINUABLE, 0, 0);// 0x1000A buffer err //copy memcpy(pBuf,pSource+lPtr,lLen); lPtr += lLen; return pBuf; }
/****************************************************************************** * _invalid_parameter (MSVCRT.@) */ void __cdecl MSVCRT__invalid_parameter(const MSVCRT_wchar_t *expr, const MSVCRT_wchar_t *func, const MSVCRT_wchar_t *file, unsigned int line, MSVCRT_uintptr_t arg) { if (invalid_parameter_handler) invalid_parameter_handler( expr, func, file, line, arg ); else { ERR( "%s:%u %s: %s %lx\n", debugstr_w(file), line, debugstr_w(func), debugstr_w(expr), arg ); RaiseException( STATUS_INVALID_CRUNTIME_PARAMETER, EXCEPTION_NONCONTINUABLE, 0, NULL ); } }
VOID ReportException (LPCTSTR UserMessage, DWORD ExcetionCode) /* Сообщает, как о нефатальной ошибке */ { ReportError(UserMessage, 0, TRUE); /* Если ошибка фатальна, вызывает исключение */ if (ExcetionCode != 0) RaiseException ( (0x0FFFFFFF & ExcetionCode) | 0xE0000000, 0, 0, NULL); return; }
static unsigned long __RPC_USER handle_UserSize(unsigned long *pFlags, unsigned long StartingSize, HANDLE *handle) { if (LOWORD(*pFlags) == MSHCTX_DIFFERENTMACHINE) { ERR("can't remote a local handle\n"); RaiseException(RPC_S_INVALID_TAG, 0, 0, NULL); return StartingSize; } return StartingSize + sizeof(RemotableHandle); }
static void _TlsClose() { LogDef* p = (LogDef*)TlsGetValue(tlsIDX); if ( p ) { delete p; p=NULL; if ( !TlsSetValue(tlsIDX, p) ) RaiseException(UNABLE_TLS_SET_VALUE,0,0,NULL); } }
CURLMcode __stdcall vbcurl_multi_remove_handle(MULTI_CONTEXT* pmc, void* pvEasyContext) { void* pvEasy; if (pmc->_magic != MULTI_MAGIC) RaiseException(0xE0000000, EXCEPTION_NONCONTINUABLE, 0, NULL); pvEasy = easy_get_inner(pvEasyContext); if (!pvEasy) return CURLM_BAD_EASY_HANDLE; return curl_multi_remove_handle(pmc->_multi, pvEasy); }
void BGBCC_DieFatal() { //#ifdef WIN32 #if 0 ULONG_PTR args[8]; RaiseException(BGBCC_EXCEPTION, EXCEPTION_NONCONTINUABLE, 1, args); #else *(int *)-1=-1; #endif }
static LogDef* _TlsInit() { LogDef* p = new LogDef[1]; p->_endPtr = p->_startPtr = p->_pageNbr = 0; p->_pageLimit = p->_pageSize = 0 ; p->_loggerBase = 0; if (! TlsSetValue(tlsIDX, p)) RaiseException(UNABLE_TLS_SET_VALUE,0,0,NULL); return p; }
UCHAR CNCB::ChainSend(UCHAR wSessionNumber,LPSTR lpPacket1, UINT wLength1, LPSTR lpPacket2, UINT wLength2 ) { ClearNCB(); if (wLength1 > 0xffff) RaiseException(EXCEPTION_ACCESS_VIOLATION,0,0,NULL); m_NCB.ncb_lana_num = m_iLanaNum; m_NCB.ncb_command = NCBCHAINSEND; m_NCB.ncb_lsn = wSessionNumber; m_NCB.ncb_length = wLength1; m_NCB.ncb_buffer = (unsigned char *)lpPacket1; return (fp?((*fp)(&m_NCB)):(0x3f)); };
std::string Element::GetName(void) { if (!this->parentElement) { RaiseException( std::runtime_error("Element has no name")); } else { Element::Iterator i = this->parentElement->Find(*this); if (i == this->parentElement->End()) { RaiseException( std::runtime_error("Cannot find element in parent")); } return i.GetName(); } return std::string(""); }
std::size_t Element::GetIndex(void) { if (!this->parentElement) { RaiseException( std::runtime_error("Element has no index")); } else { Element::Iterator i = this->parentElement->Find(*this); if (i == this->parentElement->End()) { RaiseException( std::runtime_error("Cannot find element in parent")); } return i.GetIndex(); } return 0U; }
UCHAR CNCB::SendNoAck(UCHAR wSessionNumber,LPSTR lpPacket, UINT wLength) { ClearNCB(); if (wLength > 0xffff) RaiseException(EXCEPTION_ACCESS_VIOLATION,0,0,NULL); m_NCB.ncb_lana_num = m_iLanaNum; m_NCB.ncb_command = NCBSENDNA; m_NCB.ncb_lsn = wSessionNumber; m_NCB.ncb_length = wLength; m_NCB.ncb_buffer = (unsigned char *)lpPacket; return (fp?((*fp)(&m_NCB)):(0x3f)); return 0; };
void VDSetThreadDebugName(VDThreadID tid, const char *name) { THREADNAME_INFO info; info.dwType = 0x1000; info.szName = name; info.dwThreadID = tid; info.dwFlags = 0; __try { RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD), (ULONG_PTR *)&info); } __except (EXCEPTION_CONTINUE_EXECUTION) { } }
/** Closes winsock (wrapper around WSACleanup() **/ int L2PNet_Cleanup() { WSACleanup_func WSACleanup_ws2 = (WSACleanup_func)GetProcAddress( l2pnet_hws2_32, "WSACleanup" ); if( !WSACleanup_ws2 ) { MessageBox( NULL, TEXT("L2Packets cannot load ws2_32.dll!WSACleanup(void)\nFailing application!"), TEXT("L2Packets Error!"), MB_ICONSTOP ); RaiseException( ERROR_FILE_NOT_FOUND, 0, 0, NULL ); return -1; } return WSACleanup_ws2(); }
/*********************************************************************** * OutputDebugStringA (KERNEL32.@) * * Output by an application of an ascii string to a debugger (if attached) * and program log. * * PARAMS * str [I] The message to be logged and given to the debugger. * * RETURNS * * Nothing. */ void WINAPI OutputDebugStringA( LPCSTR str ) { static HANDLE DBWinMutex = NULL; static BOOL mutex_inited = FALSE; BOOL caught_by_dbg = TRUE; if (!str) str = ""; WARN("%s\n", debugstr_a(str)); /* raise exception, WaitForDebugEvent() will generate a corresponding debug event */ __TRY { ULONG_PTR args[2]; args[0] = strlen(str) + 1; args[1] = (ULONG_PTR)str; RaiseException( DBG_PRINTEXCEPTION_C, 0, 2, args ); } __EXCEPT(debug_exception_handler) { caught_by_dbg = FALSE; } __ENDTRY if (caught_by_dbg) return; /* for some unknown reason Windows sends the exception a second time, if a * debugger is attached, and the event wasn't handled in the first attempt */ if (NtCurrentTeb()->Peb->BeingDebugged) { __TRY { ULONG_PTR args[2]; args[0] = strlen(str) + 1; args[1] = (ULONG_PTR)str; RaiseException( DBG_PRINTEXCEPTION_C, 0, 2, args ); } __EXCEPT(debug_exception_handler) { } __ENDTRY }