29 #ifndef __UPX_EXCEPT_H 30 #define __UPX_EXCEPT_H 1 34 const char *prettyName(
const char *n) NOTHROW;
41 class Throwable :
public std::exception
43 typedef std::exception super;
45 Throwable(
const char *m = 0,
int e = 0,
bool w =
false) NOTHROW;
47 Throwable(const Throwable &) NOTHROW;
48 virtual ~Throwable() NOTHROW;
49 const
char *getMsg() const NOTHROW {
return msg; }
50 int getErrno() const NOTHROW {
return err; }
51 bool isWarning() const NOTHROW {
return is_warning; }
60 Throwable& operator= (
const Throwable &);
65 static unsigned long counter;
70 class Exception :
public Throwable
72 typedef Throwable super;
74 Exception(
const char *m = 0,
int e = 0,
bool w =
false) NOTHROW : super(m,e,w) { }
79 class Error :
public Throwable
81 typedef Throwable super;
83 Error(
const char *m = 0,
int e = 0) NOTHROW : super(m,e) { }
91 class OutOfMemoryException :
public Exception
93 typedef Exception super;
95 OutOfMemoryException(
const char *m = 0,
int e = 0) NOTHROW : super(m,e) { }
99 class IOException :
public Exception
101 typedef Exception super;
103 IOException(
const char *m = 0,
int e = 0) NOTHROW : super(m,e) { }
107 class EOFException :
public IOException
109 typedef IOException super;
111 EOFException(
const char *m = 0,
int e = 0) NOTHROW : super(m,e) { }
115 class FileNotFoundException :
public IOException
117 typedef IOException super;
119 FileNotFoundException(
const char *m = 0,
int e = 0) NOTHROW : super(m,e) { }
123 class FileAlreadyExistsException :
public IOException
125 typedef IOException super;
127 FileAlreadyExistsException(
const char *m = 0,
int e = 0) NOTHROW : super(m,e) { }
135 class OverlayException :
public Exception
137 typedef Exception super;
139 OverlayException(
const char *m = 0,
bool w =
false) NOTHROW : super(m,0,w) { }
142 class CantPackException :
public Exception
144 typedef Exception super;
146 CantPackException(
const char *m = 0,
bool w =
false) NOTHROW : super(m,0,w) { }
149 class UnknownExecutableFormatException :
public CantPackException
151 typedef CantPackException super;
153 UnknownExecutableFormatException(
const char *m = 0,
bool w =
false) NOTHROW : super(m,w) { }
156 class AlreadyPackedException :
public CantPackException
158 typedef CantPackException super;
160 AlreadyPackedException(
const char *m = 0) NOTHROW : super(m) { is_warning =
true; }
163 class NotCompressibleException :
public CantPackException
165 typedef CantPackException super;
167 NotCompressibleException(
const char *m = 0) NOTHROW : super(m) { }
171 class CantUnpackException :
public Exception
173 typedef Exception super;
175 CantUnpackException(
const char *m = 0,
bool w =
false) NOTHROW : super(m,0,w) { }
178 class NotPackedException :
public CantUnpackException
180 typedef CantUnpackException super;
182 NotPackedException(
const char *m = 0) NOTHROW : super(m,true) { }
190 class InternalError :
public Error
194 InternalError(
const char *m = 0) NOTHROW : super(m,0) { }
203 #if 1 && defined(__GNUC__) 204 #define NORET __attribute__((__noreturn__)) 209 void throwCantPack(
const char *msg) NORET;
210 void throwCantPackExact() NORET;
211 void throwUnknownExecutableFormat(const
char *msg = NULL,
bool warn = false) NORET;
212 void throwNotCompressible(const
char *msg = NULL) NORET;
213 void throwAlreadyPacked(const
char *msg = NULL) NORET;
214 void throwAlreadyPackedByUPX(const
char *msg = NULL) NORET;
215 void throwCantUnpack(const
char *msg) NORET;
216 void throwNotPacked(const
char *msg = NULL) NORET;
217 void throwFilterException() NORET;
218 void throwBadLoader() NORET;
219 void throwChecksumError() NORET;
220 void throwCompressedDataViolation() NORET;
221 void throwInternalError(const
char *msg) NORET;
222 void throwOutOfMemoryException(const
char *msg = NULL) NORET;
223 void throwIOException(const
char *msg = NULL,
int e = 0) NORET;
224 void throwEOFException(const
char *msg = NULL,
int e = 0) NORET;