mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 14:07:13 -06:00
Update to 7-Zip Version 21.02
This commit is contained in:
@@ -2,21 +2,25 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
#if !defined(_UNICODE) || !defined(_WIN32)
|
||||
#include "../Common/StringConvert.h"
|
||||
#endif
|
||||
|
||||
#include "ErrorMsg.h"
|
||||
|
||||
#ifndef _UNICODE
|
||||
#ifdef _WIN32
|
||||
#if !defined(_UNICODE)
|
||||
extern bool g_IsNT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace NWindows {
|
||||
namespace NError {
|
||||
|
||||
static bool MyFormatMessage(DWORD errorCode, UString &message)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
LPVOID msgBuf;
|
||||
#ifndef _UNICODE
|
||||
if (!g_IsNT)
|
||||
@@ -38,8 +42,63 @@ static bool MyFormatMessage(DWORD errorCode, UString &message)
|
||||
}
|
||||
::LocalFree(msgBuf);
|
||||
return true;
|
||||
|
||||
#else // _WIN32
|
||||
|
||||
AString m;
|
||||
|
||||
const char *s = NULL;
|
||||
|
||||
switch ((Int32)errorCode)
|
||||
{
|
||||
// case ERROR_NO_MORE_FILES : s = "No more files"; break;
|
||||
// case ERROR_DIRECTORY : s = "Error Directory"; break;
|
||||
case E_NOTIMPL : s = "E_NOTIMPL : Not implemented"; break;
|
||||
case E_NOINTERFACE : s = "E_NOINTERFACE : No such interface supported"; break;
|
||||
case E_ABORT : s = "E_ABORT : Operation aborted"; break;
|
||||
case E_FAIL : s = "E_FAIL : Unspecified error"; break;
|
||||
|
||||
case STG_E_INVALIDFUNCTION : s = "STG_E_INVALIDFUNCTION"; break;
|
||||
case CLASS_E_CLASSNOTAVAILABLE : s = "CLASS_E_CLASSNOTAVAILABLE"; break;
|
||||
|
||||
case E_OUTOFMEMORY : s = "E_OUTOFMEMORY : Can't allocate required memory"; break;
|
||||
case E_INVALIDARG : s = "E_INVALIDARG : One or more arguments are invalid"; break;
|
||||
|
||||
// case MY__E_ERROR_NEGATIVE_SEEK : s = "MY__E_ERROR_NEGATIVE_SEEK"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* strerror() for unknow errors still shows message "Unknown error -12345678")
|
||||
So we must trasfer error codes before strerror() */
|
||||
if (!s)
|
||||
{
|
||||
if ((errorCode & 0xFFFF0000) == (UInt32)((MY__FACILITY__WRes << 16) | 0x80000000))
|
||||
errorCode &= 0xFFFF;
|
||||
else if ((errorCode & ((UInt32)1 << 31)))
|
||||
return false; // we will show hex error later for that case
|
||||
|
||||
s = strerror((int)errorCode);
|
||||
|
||||
// if (!s)
|
||||
{
|
||||
m += "errno=";
|
||||
m.Add_UInt32(errorCode);
|
||||
if (s)
|
||||
m += " : ";
|
||||
}
|
||||
}
|
||||
|
||||
if (s)
|
||||
m += s;
|
||||
|
||||
MultiByteToUnicodeString2(message, m);
|
||||
return true;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
UString MyFormatMessage(DWORD errorCode)
|
||||
{
|
||||
UString m;
|
||||
|
||||
Reference in New Issue
Block a user