mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 21:14:58 -06:00
9.06 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
829409452d
commit
c99f3ebdd6
@@ -111,12 +111,12 @@ static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 ind
|
||||
HRESULT CCodecs::LoadCodecs()
|
||||
{
|
||||
CCodecLib &lib = Libs.Back();
|
||||
lib.GetMethodProperty = (GetMethodPropertyFunc)lib.Lib.GetProcAddress("GetMethodProperty");
|
||||
lib.GetMethodProperty = (GetMethodPropertyFunc)lib.Lib.GetProc("GetMethodProperty");
|
||||
if (lib.GetMethodProperty == NULL)
|
||||
return S_OK;
|
||||
|
||||
UInt32 numMethods = 1;
|
||||
GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)lib.Lib.GetProcAddress("GetNumberOfMethods");
|
||||
GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)lib.Lib.GetProc("GetNumberOfMethods");
|
||||
if (getNumberOfMethodsFunc != NULL)
|
||||
{
|
||||
RINOK(getNumberOfMethodsFunc(&numMethods));
|
||||
@@ -210,10 +210,11 @@ static void SplitString(const UString &srcString, UStringVector &destStrings)
|
||||
destStrings.Add(s);
|
||||
}
|
||||
|
||||
void CArcInfoEx::AddExts(const wchar_t* ext, const wchar_t* addExt)
|
||||
void CArcInfoEx::AddExts(const wchar_t *ext, const wchar_t *addExt)
|
||||
{
|
||||
UStringVector exts, addExts;
|
||||
SplitString(ext, exts);
|
||||
if (ext != 0)
|
||||
SplitString(ext, exts);
|
||||
if (addExt != 0)
|
||||
SplitString(addExt, addExts);
|
||||
for (int i = 0; i < exts.Size(); i++)
|
||||
@@ -236,19 +237,16 @@ HRESULT CCodecs::LoadFormats()
|
||||
{
|
||||
const NDLL::CLibrary &lib = Libs.Back().Lib;
|
||||
GetHandlerPropertyFunc getProp = 0;
|
||||
GetHandlerPropertyFunc2 getProp2 = (GetHandlerPropertyFunc2)
|
||||
lib.GetProcAddress("GetHandlerProperty2");
|
||||
GetHandlerPropertyFunc2 getProp2 = (GetHandlerPropertyFunc2)lib.GetProc("GetHandlerProperty2");
|
||||
if (getProp2 == NULL)
|
||||
{
|
||||
getProp = (GetHandlerPropertyFunc)
|
||||
lib.GetProcAddress("GetHandlerProperty");
|
||||
getProp = (GetHandlerPropertyFunc)lib.GetProc("GetHandlerProperty");
|
||||
if (getProp == NULL)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
UInt32 numFormats = 1;
|
||||
GetNumberOfFormatsFunc getNumberOfFormats = (GetNumberOfFormatsFunc)
|
||||
lib.GetProcAddress("GetNumberOfFormats");
|
||||
GetNumberOfFormatsFunc getNumberOfFormats = (GetNumberOfFormatsFunc)lib.GetProc("GetNumberOfFormats");
|
||||
if (getNumberOfFormats != NULL)
|
||||
{
|
||||
RINOK(getNumberOfFormats(&numFormats));
|
||||
@@ -294,37 +292,48 @@ HRESULT CCodecs::LoadFormats()
|
||||
}
|
||||
|
||||
#ifdef NEW_FOLDER_INTERFACE
|
||||
void CCodecLib::LoadIcons()
|
||||
void CCodecIcons::LoadIcons(HMODULE m)
|
||||
{
|
||||
UString iconTypes = MyLoadStringW((HMODULE)Lib, kIconTypesResId);
|
||||
UString iconTypes = MyLoadStringW(m, kIconTypesResId);
|
||||
UStringVector pairs;
|
||||
SplitString(iconTypes, pairs);
|
||||
for (int i = 0; i < pairs.Size(); i++)
|
||||
{
|
||||
const UString &s = pairs[i];
|
||||
int pos = s.Find(L':');
|
||||
if (pos < 0)
|
||||
continue;
|
||||
CIconPair iconPair;
|
||||
const wchar_t *end;
|
||||
UString num = s.Mid(pos + 1);
|
||||
iconPair.IconIndex = (UInt32)ConvertStringToUInt64(num, &end);
|
||||
if (*end != L'\0')
|
||||
continue;
|
||||
iconPair.IconIndex = -1;
|
||||
if (pos < 0)
|
||||
pos = s.Length();
|
||||
else
|
||||
{
|
||||
UString num = s.Mid(pos + 1);
|
||||
if (!num.IsEmpty())
|
||||
{
|
||||
const wchar_t *end;
|
||||
iconPair.IconIndex = (UInt32)ConvertStringToUInt64(num, &end);
|
||||
if (*end != L'\0')
|
||||
continue;
|
||||
}
|
||||
}
|
||||
iconPair.Ext = s.Left(pos);
|
||||
IconPairs.Add(iconPair);
|
||||
}
|
||||
}
|
||||
|
||||
int CCodecLib::FindIconIndex(const UString &ext) const
|
||||
bool CCodecIcons::FindIconIndex(const UString &ext, int &iconIndex) const
|
||||
{
|
||||
iconIndex = -1;
|
||||
for (int i = 0; i < IconPairs.Size(); i++)
|
||||
{
|
||||
const CIconPair &pair = IconPairs[i];
|
||||
if (ext.CompareNoCase(pair.Ext) == 0)
|
||||
return pair.IconIndex;
|
||||
{
|
||||
iconIndex = pair.IconIndex;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -335,8 +344,9 @@ extern "C"
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT CCodecs::LoadDll(const CSysString &dllPath)
|
||||
HRESULT CCodecs::LoadDll(const CSysString &dllPath, bool needCheckDll)
|
||||
{
|
||||
if (needCheckDll)
|
||||
{
|
||||
NDLL::CLibrary library;
|
||||
if (!library.LoadEx(dllPath, LOAD_LIBRARY_AS_DATAFILE))
|
||||
@@ -358,13 +368,13 @@ HRESULT CCodecs::LoadDll(const CSysString &dllPath)
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
if (g_LargePageSize != 0)
|
||||
{
|
||||
SetLargePageModeFunc setLargePageMode = (SetLargePageModeFunc)lib.Lib.GetProcAddress("SetLargePageMode");
|
||||
SetLargePageModeFunc setLargePageMode = (SetLargePageModeFunc)lib.Lib.GetProc("SetLargePageMode");
|
||||
if (setLargePageMode != 0)
|
||||
setLargePageMode();
|
||||
}
|
||||
#endif
|
||||
|
||||
lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProcAddress("CreateObject");
|
||||
lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProc("CreateObject");
|
||||
if (lib.CreateObject != 0)
|
||||
{
|
||||
int startSize = Codecs.Size();
|
||||
@@ -391,7 +401,7 @@ HRESULT CCodecs::LoadDllsFromFolder(const CSysString &folderPrefix)
|
||||
{
|
||||
if (fi.IsDir())
|
||||
continue;
|
||||
RINOK(LoadDll(folderPrefix + fi.Name));
|
||||
RINOK(LoadDll(folderPrefix + fi.Name, true));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -408,6 +418,10 @@ static inline void SetBuffer(CByteBuffer &bb, const Byte *data, int size)
|
||||
|
||||
HRESULT CCodecs::Load()
|
||||
{
|
||||
#ifdef NEW_FOLDER_INTERFACE
|
||||
InternalIcons.LoadIcons(g_hInstance);
|
||||
#endif
|
||||
|
||||
Formats.Clear();
|
||||
#ifdef EXTERNAL_CODECS
|
||||
Codecs.Clear();
|
||||
@@ -430,7 +444,7 @@ HRESULT CCodecs::Load()
|
||||
}
|
||||
#ifdef EXTERNAL_CODECS
|
||||
const CSysString baseFolder = GetBaseFolderPrefixFromRegistry();
|
||||
RINOK(LoadDll(baseFolder + kMainDll));
|
||||
RINOK(LoadDll(baseFolder + kMainDll, false));
|
||||
RINOK(LoadDllsFromFolder(baseFolder + kCodecsFolderName TEXT(STRING_PATH_SEPARATOR)));
|
||||
RINOK(LoadDllsFromFolder(baseFolder + kFormatsFolderName TEXT(STRING_PATH_SEPARATOR)));
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user