#ifndef __RILEXCEPTIONS_H__ #define __RILEXCEPTIONS_H__ struct win32_error { public: std::string name; DWORD err; win32_error(const std::string& name) : err(GetLastError()), name(name) { } ~win32_error() { printf("RIL-win32error: %08lx - %s\n", err, name.c_str()); } }; struct ril_error { public: std::string name; HRESULT err; ril_error(const std::string& name, HRESULT err) : name(name), err(err) { } ~ril_error() { printf("RIL-error: %08lx - %s\n", err, name.c_str()); } }; struct ril_structsize_error { public: size_t got; size_t expect; ril_structsize_error(size_t got, size_t expect) : got(got), expect(expect) { } ~ril_structsize_error() { printf("RIL-size error: got: %08lx, expected; %08lx\n", got, expect); } }; inline void checkminsize(const void *p, size_t got, size_t minimum) { if (minimum && p==NULL) throw ril_structsize_error(-1,minimum); if (got