Example #1
0
int render(winampVisModule* pVisModule){
if(!running)
	return -1;
#	ifdef USE_STACK_WALKER
	__try {
		return MyRender(pVisModule);
	}
	__except(ExpFilter(GetExceptionInformation(), GetExceptionCode()))
  {
		MessageBoxA(NULL, "Fatal error in render. see alienfx_vis_crashlog for details", "Error", MB_OK | MB_ICONERROR);
		return -1;
  }
}
Example #2
0
UINT CNetManager::executePacket_Gen_Exception(Packet* pPacket)
{
	CHAR szTitle[MAX_PATH];
	_snprintf(szTitle, MAX_PATH, "Packet: %d", pPacket->GetPacketID());

	__try 
	{
		return executePacket_CPP_Exception(pPacket);
	}
	__except (tProcessInnerException(GetExceptionInformation(), g_hMainWnd, szTitle), EXCEPTION_EXECUTE_HANDLER) {}

	return PACKET_EXE_CONTINUE;
}
void DumpMiniDump(PEXCEPTION_POINTERS excpInfo)
{
	if (excpInfo == NULL) 
	{
		// Generate exception to get proper context in dump
		__try 
		{
			RaiseException(EXCEPTION_BREAKPOINT, 0, 0, NULL);
		} 
		__except(DumpMiniDump(GetExceptionInformation()),EXCEPTION_EXECUTE_HANDLER) 
		{
		}
	} 
Example #4
0
NTSTATUS
AFSFSControl( IN PDEVICE_OBJECT LibDeviceObject,
              IN PIRP Irp)
{

    NTSTATUS ntStatus = STATUS_SUCCESS;
    IO_STACK_LOCATION *pIrpSp;

    pIrpSp = IoGetCurrentIrpStackLocation( Irp);

    __try
    {

        switch( pIrpSp->MinorFunction)
        {

            case IRP_MN_USER_FS_REQUEST:

                ntStatus = AFSProcessUserFsRequest( Irp);

                break;

            case IRP_MN_MOUNT_VOLUME:

                break;

            case IRP_MN_VERIFY_VOLUME:

                break;

            default:

                break;
        }

        AFSCompleteRequest( Irp,
                              ntStatus);

    }
    __except( AFSExceptionFilter( __FUNCTION__, GetExceptionCode(), GetExceptionInformation()) )
    {

        AFSDbgLogMsg( 0,
                      0,
                      "EXCEPTION - AFSFSControl\n");

        AFSDumpTraceFilesFnc();
    }

    return ntStatus;
}
Example #5
0
static int openprinter_ps (void)
{
	TCHAR *gsargv[] = {
		L"-dNOPAUSE", L"-dBATCH", L"-dNOPAGEPROMPT", L"-dNOPROMPT", L"-dQUIET", L"-dNoCancel",
		L"-sDEVICE=mswinpr2", NULL
	};
	int gsargc, gsargc2, i;
	TCHAR *tmpparms[100];
	TCHAR tmp[MAX_DPATH];
	char *gsparms[100];

	if (ptr_gsapi_new_instance (&gsinstance, NULL) < 0)
		return 0;
	cmdlineparser (currprefs.ghostscript_parameters, tmpparms, 100 - 10);

	gsargc2 = 0;
	gsparms[gsargc2++] = ua (L"WinUAE");
	for (gsargc = 0; gsargv[gsargc]; gsargc++) {
		gsparms[gsargc2++] = ua (gsargv[gsargc]);
	}
	for (i = 0; tmpparms[i]; i++)
		gsparms[gsargc2++] = ua (tmpparms[i]);
	if (currprefs.prtname[0]) {
		_stprintf (tmp, L"-sOutputFile=%%printer%%%s", currprefs.prtname);
		gsparms[gsargc2++] = ua (tmp);
	}
	if (postscript_print_debugging) {
		for (i = 0; i < gsargc2; i++) {
			TCHAR *parm = au (gsparms[i]);
			write_log (L"GSPARM%d: '%s'\n", i, parm);
			xfree (parm);
		}
	}
	__try {
		int rc = ptr_gsapi_init_with_args (gsinstance, gsargc2, gsparms);
		for (i = 0; i < gsargc2; i++) {
			xfree (gsparms[i]);
		}
		if (rc != 0) {
			write_log (L"GS failed, returncode %d\n", rc);
			return 0;
		}
		ptr_gsapi_run_string_begin (gsinstance, 0, &gs_exitcode);
	} __except (ExceptionFilter (GetExceptionInformation (), GetExceptionCode ())) {
		write_log (L"GS crashed\n");
		return 0;
	}
	psmode = 1;
	return 1;
}
Example #6
0
int __cdecl HandleCrash(PEXCEPTION_POINTERS pExceptPtrs)
{
	if(pExceptPtrs == 0)
	{
		// Raise an exception :P
		__try
		{
			RaiseException(EXCEPTION_BREAKPOINT, 0, 0, 0);
		}
		__except(HandleCrash(GetExceptionInformation()), EXCEPTION_CONTINUE_EXECUTION)
		{

		}		
	}
Example #7
0
void moduleripper (void)
{
	int size;
	uae_u8 *buf, *p;

	size = currprefs.chipmem_size;
	for (int i = 0; i < MAX_RAM_BOARDS; i++) {
		size += currprefs.fastmem[i].size;
		size += currprefs.z3fastmem[i].size;
	}
	size += currprefs.bogomem_size;
	size += currprefs.mbresmem_low_size;
	size += currprefs.mbresmem_high_size;
	buf = p = xmalloc (uae_u8, size);
	if (!buf)
		return;
	memcpy (p, chipmem_bank.baseaddr, currprefs.chipmem_size);
	p += currprefs.chipmem_size;
	for (int i = 0; i < MAX_RAM_BOARDS; i++) {
		mc (p, fastmem_bank[i].start, currprefs.fastmem[i].size);
		p += currprefs.fastmem[i].size;
	}
	mc (p, bogomem_bank.start, currprefs.bogomem_size);
	p += currprefs.bogomem_size;
	mc (p, a3000lmem_bank.start, currprefs.mbresmem_low_size);
	p += currprefs.mbresmem_low_size;
	mc (p, a3000hmem_bank.start, currprefs.mbresmem_high_size);
	p += currprefs.mbresmem_high_size;
	for (int i = 0; i < MAX_RAM_BOARDS; i++) {
		mc (p, z3fastmem_bank[i].start, currprefs.z3fastmem[i].size);
		p += currprefs.z3fastmem[i].size;
	}

	got = 0;
	canceled = 0;
#ifdef _WIN32
	__try {
#endif
		prowizard_search (buf, size);
#ifdef _WIN32
	} __except(ExceptionFilter (GetExceptionInformation (), GetExceptionCode ())) {
		write_log (_T("prowizard scan crashed\n"));
	}
#endif
	if (!got)
		notify_user (NUMSG_MODRIP_NOTFOUND);
	else if (!canceled)
		notify_user (NUMSG_MODRIP_FINISHED);
	xfree (buf);
}
Example #8
0
/*
* FindDlgAddTypes
*
* Purpose:
*
* Enumerate object types and fill combobox with them.
*
*/
VOID FindDlgAddTypes(
    HWND hwnd
)
{
    ULONG  i;
    HWND   hComboBox;
    SIZE_T sz;
    LPWSTR lpType;

    POBJECT_TYPE_INFORMATION  pObject;

    hComboBox = GetDlgItem(hwnd, ID_SEARCH_TYPE);
    if (hComboBox == NULL) {
        return;
    }

    SendMessage(hComboBox, CB_RESETCONTENT, (WPARAM)0, (LPARAM)0);

    if (g_pObjectTypesInfo == NULL) {
        SendMessage(hComboBox, CB_ADDSTRING, (WPARAM)0, (LPARAM)L"*");
        SendMessage(hComboBox, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
        return;
    }

    //
    // Warning: not all object types are listed.
    //
    __try {
        //type collection available, list it
        pObject = (POBJECT_TYPE_INFORMATION)&g_pObjectTypesInfo->TypeInformation;
        for (i = 0; i < g_pObjectTypesInfo->NumberOfTypes; i++) {
            sz = pObject->TypeName.MaximumLength + sizeof(UNICODE_NULL);
            lpType = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sz);
            if (lpType) {
                _strncpy(lpType, sz / sizeof(WCHAR),
                    pObject->TypeName.Buffer, pObject->TypeName.Length / sizeof(WCHAR));
                SendMessage(hComboBox, CB_ADDSTRING, (WPARAM)0, (LPARAM)lpType);
                HeapFree(GetProcessHeap(), 0, lpType);
            }
            pObject = (POBJECT_TYPE_INFORMATION)((PCHAR)(pObject + 1) +
                ALIGN_UP(pObject->TypeName.MaximumLength, sizeof(ULONG_PTR)));
        }
        SendMessage(hComboBox, CB_ADDSTRING, (WPARAM)0, (LPARAM)L"*");
        SendMessage(hComboBox, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
    }
    __except (exceptFilter(GetExceptionCode(), GetExceptionInformation())) {
        return;
    }
}
Example #9
0
int _tmain(int argc, _TCHAR* argv[])
{
	::SetUnhandledExceptionFilter(ExceptionFilter);

	__try
	{
		RaiseException();
	}
	__except(filter(GetExceptionCode(), GetExceptionInformation()))
	{
		std::wcout << L"in handler" << std::endl;
	}
	
	return 0;
}
Example #10
0
	static int executeShell(int argc, char *argv[])
	{
		int code = 0;
		
		__try
		{
			code = avmthane::Shell::run(argc, argv);
		}
		__except(avmthane::CrashFilter(GetExceptionInformation(), GetExceptionCode()))
		{
			code = -1;
		}

		return code;
	}
Example #11
0
LPCWSTR ExchangeOps::GlobalInit(LPCWSTR lpMAPITarget, LPCWSTR lpAdminUsername, LPCWSTR
    lpAdminPassword)
{
	LPWSTR exceptionmsg=NULL;
	internalEOInit();	
	__try
	{
		return _GlobalInit(lpMAPITarget, lpAdminUsername, lpAdminPassword);
	}
	__except(Zimbra::Util::MiniDumpGenerator::GenerateCoreDump(GetExceptionInformation(),exceptionmsg))
	{
		dloge(exceptionmsg);
	}
	return exceptionmsg;
}
//����Ҫ�ĺ���, ����Dump
static void DumpMiniDump(HANDLE hFile, PEXCEPTION_POINTERS excpInfo)
{
	if (excpInfo == NULL) //����û�д����쳣, �������ڳ����������õ�, ����һ���쳣
	{
		// Generate exception to get proper context in dump
		__try
		{
			OutputDebugString(_T("raising exception\r\n"));
			RaiseException(EXCEPTION_BREAKPOINT, 0, 0, NULL);
		}
		__except (DumpMiniDump(hFile, GetExceptionInformation()),
			EXCEPTION_CONTINUE_EXECUTION)
		{
		}
	}
Example #13
0
/**********************************************************************
 *          dpmi_exception_handler
 *
 * Handle EXCEPTION_VM86_STI exceptions generated
 * when there are pending asynchronous events.
 */
static WINE_EXCEPTION_FILTER(dpmi_exception_handler)
{
#ifdef __i386__
    EXCEPTION_RECORD *rec = GetExceptionInformation()->ExceptionRecord;
    CONTEXT *context = GetExceptionInformation()->ContextRecord;

    if (rec->ExceptionCode == EXCEPTION_VM86_STI)
    {
        if (ISV86(context))
            ERR( "Real mode STI caught by protected mode handler!\n" );
        DOSVM_SendQueuedEvents(context);
        return EXCEPTION_CONTINUE_EXECUTION;
    }
    else if (rec->ExceptionCode == EXCEPTION_VM86_INTx)
    {
        if (ISV86(context))
            ERR( "Real mode INTx caught by protected mode handler!\n" );
        DPMI_retval = (BYTE)rec->ExceptionInformation[0];
        return EXCEPTION_EXECUTE_HANDLER;
    }

#endif
    return EXCEPTION_CONTINUE_SEARCH;
}
Example #14
0
int FakeLuaPcall(lua_State *L, int nargs, int nresults, int errfunc)
{
	EXCEPTION_POINTERS* xp = nullptr;
	int results = 0;
	__try
	{
		results = aero::c_call<int>(RealLuaPcall, L, nargs, nresults, errfunc);
	}
	__except(xp = GetExceptionInformation(), EXCEPTION_EXECUTE_HANDLER)
	{
		char buf[256];
		sprintf(buf, "SEH exception: '0x%08X'", xp->ExceptionRecord->ExceptionCode);
		lua_pushstring(L, buf);
		return LUA_ERRRUN;
	}
Example #15
0
/*
 * Run emulator
 */
static void do_run_machine (void)
{
#if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER )
    extern int EvalException ( LPEXCEPTION_POINTERS blah, int n_except );
    __try
#endif
    {
	m68k_go (1);
    }
#if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER )
    __except( EvalException( GetExceptionInformation(), GetExceptionCode() ) )
    {
	// EvalException does the good stuff...
    }
#endif
}
//
// Calls hostfxr_main with the hostfxr and application as arguments.
// Method should be called with only
// Need to have __try / __except in methods that require unwinding.
// Note, this will not
//
HRESULT
IN_PROCESS_APPLICATION::RunDotnetApplication(DWORD argc, CONST PCWSTR* argv, hostfxr_main_fn pProc)
{
    HRESULT hr = S_OK;
    __try
    {
        m_ProcessExitCode = pProc(argc, argv);
    }
    __except (FilterException(GetExceptionCode(), GetExceptionInformation()))
    {
        // TODO Log error message here.
        hr = E_APPLICATION_ACTIVATION_EXEC_FAILURE;
    }

    return hr;
}
Example #17
0
/* static */
bool wxCrashReport::GenerateNow(int flags)
{
    bool rc = false;

    __try
    {
        RaiseException(0x1976, 0, 0, NULL);
    }
    __except( rc = Generate(flags, (EXCEPTION_POINTERS *)GetExceptionInformation()),
              EXCEPTION_CONTINUE_EXECUTION )
    {
        // never executed because of EXCEPTION_CONTINUE_EXECUTION above
    }

    return rc;
}
Example #18
0
bool FileManager::loadFileData(Document doc, const char * filename, Utf8_16_Read * UnicodeConvertor, LangType language) {
	const int blockSize = 128 * 1024;	//128 kB
	char data[blockSize];

	__try {
		FILE *fp = fopen(filename, "rb");
		if (!fp)
			return false;

		//Setup scratchtilla for new filedata
		_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, doc);
		bool ro = _pscratchTilla->execute(SCI_GETREADONLY) != 0;
		if (ro) {
			_pscratchTilla->execute(SCI_SETREADONLY, false);
		}
		_pscratchTilla->execute(SCI_CLEARALL);
		if (language < L_EXTERNAL) {
			_pscratchTilla->execute(SCI_SETLEXER, ScintillaEditView::langNames[language].lexerID);
		} else {
			int id = language - L_EXTERNAL;
			char * name = NppParameters::getInstance()->getELCFromIndex(id)._name;
			_pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, (LPARAM)name);
		}

		size_t lenFile = 0;
		size_t lenConvert = 0;	//just in case conversion results in 0, but file not empty
		do {
			lenFile = fread(data, 1, blockSize, fp);
			lenConvert = UnicodeConvertor->convert(data, lenFile);
			_pscratchTilla->execute(SCI_APPENDTEXT, lenConvert, (LPARAM)(UnicodeConvertor->getNewBuf()));
		} while (lenFile > 0);

		fclose(fp);

		_pscratchTilla->execute(SCI_EMPTYUNDOBUFFER);
		_pscratchTilla->execute(SCI_SETSAVEPOINT);
		if (ro) {
			_pscratchTilla->execute(SCI_SETREADONLY, true);
		}
		_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
		return true;

	}__except(filter(GetExceptionCode(), GetExceptionInformation())) {
		printStr("File is too big to be opened by Notepad++");
		return false;
   } 
}
int main(int argc, char* argv[])
#endif
{

	if( !Begin() )
		return -1;

	DWORD time = 0;
	while(true)
	{
#if !defined(_DEBUG) && defined(WIN32)
		__try
		{
#endif
			if (MainServer.getServerState() == EStateStopping) {
				break;
			}
			Logic();		

			if( timeGetTime() - time > 2000 )
			{
				time = timeGetTime();

				Output();
			}

#if !defined(_DEBUG) && defined(WIN32)
		}
		__except (HandleException(GetExceptionInformation(), "CentralServers"))
		{
			// We don't actually do anything inside the handler. All of the
			// work is done by HandleException()
		}
#endif
#ifdef _WIN32
		Sleep(1);
#else
#ifdef __linux__
		usleep(1000);
#endif
#endif
	}

	End();

	return 0;
}
Example #20
0
bool MonitorThread::Run_Dll(LPFUNC func,int buflen)
{
	bool bret=false;

	__try{

		bret=(*func)(m_InBuf,m_RetBuf,buflen);
	}
	__except(filter(GetExceptionCode(), GetExceptionInformation()))
	{
		throw MSException("__try find --RunMonitor-Execute monitor happen exception");

	}


	return bret;
}
Example #21
0
    static int executeShell(int argc, char *argv[])
    {
        int code = 0;

        __try
        {
            code = avmshell::Shell::run(argc, argv);
            if (code == avmshell::OUT_OF_MEMORY)
                ::OutputDebugStringA("OUT OF MEMORY\n");
        }
        __except(avmshell::CrashFilter(GetExceptionInformation(), GetExceptionCode()))
        {
            code = -1;
        }

        return code;
    }
Example #22
0
unsigned int bpdi(unsigned short _bp, unsigned short _di)
{
	volatile unsigned int res = 0;

	_try {
		_asm {
			mov di, _di	
			mov bp, _bp
			_emit 0x67
			mov ax, [ebx]	// [bp+di]
		}
	}
	_except(res = (GetExceptionInformation())->ExceptionRecord->ExceptionInformation[1], 1) {
	}

	return res;
}
Example #23
0
NTSTATUS
DokanBuildRequest(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
    BOOLEAN             AtIrqlPassiveLevel = FALSE;
    BOOLEAN             IsTopLevelIrp = FALSE;
    NTSTATUS            Status = STATUS_UNSUCCESSFUL;

    __try {

        __try {

            AtIrqlPassiveLevel = (KeGetCurrentIrql() == PASSIVE_LEVEL);

            if (AtIrqlPassiveLevel) {
                FsRtlEnterFileSystem();
            }

            if (!IoGetTopLevelIrp()) {
                IsTopLevelIrp = TRUE;
                IoSetTopLevelIrp(Irp);
            }

            Status = DokanDispatchRequest(DeviceObject, Irp);

        }
        __except (DokanExceptionFilter(Irp, GetExceptionInformation()))
        {

            Status = DokanExceptionHandler(DeviceObject, Irp, GetExceptionCode());
        }

    }
    __finally {

        if (IsTopLevelIrp) {
            IoSetTopLevelIrp(NULL);
        }

        if (AtIrqlPassiveLevel) {
            FsRtlExitFileSystem();
        }
    }

    return Status;
}
Example #24
0
/*************************************************************************
*
* Function: Ext2Close()
*
* Description:
*	The I/O Manager will invoke this routine to handle a close
*	request
*
* Expected Interrupt Level (for execution) :
*
*  IRQL_PASSIVE_LEVEL (invocation at higher IRQL will cause execution
*	to be deferred to a worker thread context)
*
* Return Value: Does not matter!
*
*************************************************************************/
NTSTATUS NTAPI Ext2Close(
PDEVICE_OBJECT		DeviceObject,		// the logical volume device object
PIRP					Irp)					// I/O Request Packet
{
	NTSTATUS				RC = STATUS_SUCCESS;
	PtrExt2IrpContext	PtrIrpContext = NULL;
	BOOLEAN				AreWeTopLevel = FALSE;

	DebugTrace(DEBUG_TRACE_IRP_ENTRY, "Close IRP Received...", 0);
	

	FsRtlEnterFileSystem();

	ASSERT(DeviceObject);
	ASSERT(Irp);

	// set the top level context
	AreWeTopLevel = Ext2IsIrpTopLevel(Irp);

	try 
	{

		// get an IRP context structure and issue the request
		PtrIrpContext = Ext2AllocateIrpContext(Irp, DeviceObject);
		ASSERT(PtrIrpContext);

		RC = Ext2CommonClose(PtrIrpContext, Irp, TRUE);

	}
	except (Ext2ExceptionFilter(PtrIrpContext, GetExceptionInformation())) 
	{

		RC = Ext2ExceptionHandler(PtrIrpContext, Irp);
		Ext2LogEvent(EXT2_ERROR_INTERNAL_ERROR, RC);
	}

	if (AreWeTopLevel) 
	{
		IoSetTopLevelIrp(NULL);
	}

	FsRtlExitFileSystem();

	return(RC);
}
Example #25
0
int main(int argc,
		 char** pp_argv)
{
	// TODO: http://blog.kalmbachnet.de/?postid=75 beachten (StackWalker-Homepage: http://stackwalker.codeplex.com/releases/view/35258)

#ifdef _DEBUG
	return runTheGame(argc, pp_argv);
#else
	__try
	{
		return runTheGame(argc, pp_argv);
	}
	__except(expFilter(GetExceptionInformation(), GetExceptionCode()))
	{
		return 1;
	}
#endif
}
Example #26
0
unsigned int bx(unsigned short _bx)
{
	volatile unsigned int res = 0;

	_try {
		_asm {
			mov bx, _bx	
			_emit 0x67
			_emit 0x66
			_emit 0x8b
			_emit 0x07
		}
	}
	_except(res = (GetExceptionInformation())->ExceptionRecord->ExceptionInformation[1], 1) {
	}

	return res;
}
Example #27
0
unsigned int bpsi(unsigned short _bp, unsigned short _si)
{
	volatile unsigned int res = 0;

	_try {
		_asm {
			mov esi, 0x10000
			mov si, _si	
			mov bp, _bp
			_emit 0x67
			mov ax, [edx]	// [bp+si]
		}
	}
	_except(res = (GetExceptionInformation())->ExceptionRecord->ExceptionInformation[1], 1) {
	}

	return res;
}
Example #28
0
unsigned int si(unsigned short _si)
{
	volatile unsigned int res = 0;

	_try {
		_asm {
			mov si, _si	
			_emit 0x67
			_emit 0x66
			_emit 0x8b
			_emit 0x04
		}
	}
	_except(res = (GetExceptionInformation())->ExceptionRecord->ExceptionInformation[1], 1) {
	}

	return res;
}
Example #29
0
unsigned int disp16(void)
{
	volatile unsigned int res = 0;

	_try {
		_asm {
			_emit 0x67
			_emit 0x66
			_emit 0x8b
			_emit 0x06
			_emit 0xee
			_emit 0xee
		}
	}
	_except(res = (GetExceptionInformation())->ExceptionRecord->ExceptionInformation[1], 1) {
	}

	return res;
}
Example #30
0
unsigned int bxsi(unsigned short _bx, unsigned short _si)
{
	volatile unsigned int res = 0;

	_try {
		_asm {
			mov ebx, 0x10000
			mov esi, 0x10000
			mov bx, _bx
			mov si, _si
			_emit 0x67
			mov ax, [eax]	// [bx+si]
		}
	}
	_except(res = (GetExceptionInformation())->ExceptionRecord->ExceptionInformation[1], 1) {
	}

	return res;
}