--- tcom/src/refCmd.cpp.orig	2003-11-06 18:29:01.000000000 +0300
+++ tcom/src/refCmd.cpp	2005-12-22 15:07:36.000000000 +0300
@@ -61,13 +61,32 @@
 
     // Append description.
     const wchar_t *pWide = static_cast<const wchar_t *>(description);
+
     if (pWide == 0) {
-        pWide = L"Unknown error";
-    }
+        wchar_t *buffer;
+		bool freebuf=true;
+		FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER|
+			FORMAT_MESSAGE_FROM_SYSTEM,
+			NULL,
+			hresult,
+			MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
+			(LPWSTR) &buffer,
+			0,NULL);
+		if (buffer == 0) {
+		  buffer = L"Unknown error";
+		  freebuf=false;
+		}
+		TclObject descriptionObj(buffer);
+		errorCode.lappend(descriptionObj);
+		result=descriptionObj;
+		if (freebuf) {
+			LocalFree(buffer);
+		}
+	} else {
     TclObject descriptionObj(pWide);
     errorCode.lappend(descriptionObj);
     result.lappend(descriptionObj);
-
+	}
 #ifndef NDEBUG
     // Append file and line number.
     std::ostringstream fileLine;
