From 100de0d7a830ad1567ff2b4867490961bdb4b384 Mon Sep 17 00:00:00 2001 From: pixel Date: Mon, 20 Oct 2003 16:27:54 +0000 Subject: Commit of the month --- lib/cdreader.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/cdreader.cpp') diff --git a/lib/cdreader.cpp b/lib/cdreader.cpp index bb785cf..33ba1b2 100644 --- a/lib/cdreader.cpp +++ b/lib/cdreader.cpp @@ -175,7 +175,17 @@ void cdreader::getsector(void *buf, int sec) throw (GeneralException) { } } if (dwErrCode != ERROR_IO_PENDING) { - throw GeneralException("Gave up on reading CD"); + LPVOID lpMsgBuf; + if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &lpMsgBuf, 0, NULL )) + throw GeneralException("Gave up on reading CD: unknown error"); + String errmsg = (LPCTSTR) lpMsgBuf; + LocalFree(lpMsgBuf); + throw GeneralException("Gave up on reading CD: " + errmsg); } } else { done = true; -- cgit v1.2.3