--- errhnd.cpp +++ errhnd.cpp @@ -318,7 +318,11 @@ mprintf(L"\n%s\n",St(MProgAborted)); #endif SetErrorCode(Code); +#ifdef ALLOW_EXCEPTIONS throw Code; +#else + exit(Code); +#endif } --- rar.cpp +++ rar.cpp @@ -32,7 +32,9 @@ bool ShutdownOnClose=false; #endif +#ifdef ALLOW_EXCEPTIONS try +#endif { CommandData *Cmd=new CommandData; @@ -79,6 +81,7 @@ Cmd->ProcessCommand(); delete Cmd; } +#ifdef ALLOW_EXCEPTIONS catch (RAR_EXIT ErrCode) { ErrHandler.SetErrorCode(ErrCode); @@ -92,6 +95,7 @@ { ErrHandler.SetErrorCode(RARX_FATAL); } +#endif #if defined(_WIN_ALL) && !defined(SFX_MODULE) if (ShutdownOnClose && ErrHandler.IsShutdownEnabled()) --- unpack50frag.cpp +++ unpack50frag.cpp @@ -47,7 +47,11 @@ Size-=Size/32; } if (NewMem==NULL) +#ifdef ALLOW_EXCEPTIONS throw std::bad_alloc(); +#else + ErrHandler.MemoryError(); +#endif // Clean the window to generate the same output when unpacking corrupt // RAR files, which may access to unused areas of sliding dictionary. @@ -59,7 +63,11 @@ BlockNum++; } if (TotalSize