summaryrefslogtreecommitdiffstats
path: root/other-licenses/7zstub/src/7zip/Archive/7z/7zMethods.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-03-29 16:04:01 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-03-29 16:04:01 +0100
commit88083f8c683c18f4de68a20c863a82a9da65db8f (patch)
tree926656892d9d80260da02ea8ea71031b140c51df /other-licenses/7zstub/src/7zip/Archive/7z/7zMethods.cpp
parentf999f544aad04069b03704d994a99352263f600b (diff)
parent843e4ceffd6ce21a6e6db37419335eafdc543e18 (diff)
downloadUXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar.gz
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar.lz
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.tar.xz
UXP-88083f8c683c18f4de68a20c863a82a9da65db8f.zip
Merge branch 'master' into Sync-weave
Diffstat (limited to 'other-licenses/7zstub/src/7zip/Archive/7z/7zMethods.cpp')
-rw-r--r--other-licenses/7zstub/src/7zip/Archive/7z/7zMethods.cpp174
1 files changed, 0 insertions, 174 deletions
diff --git a/other-licenses/7zstub/src/7zip/Archive/7z/7zMethods.cpp b/other-licenses/7zstub/src/7zip/Archive/7z/7zMethods.cpp
deleted file mode 100644
index 32f59003b..000000000
--- a/other-licenses/7zstub/src/7zip/Archive/7z/7zMethods.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-// 7zMethods.cpp
-
-#include "StdAfx.h"
-
-#include "7zMethods.h"
-
-#include "../../../Windows/FileFind.h"
-#include "../../../Windows/DLL.h"
-#include "../../../Windows/PropVariant.h"
-#include "../../../Windows/Synchronization.h"
-
-#include "../../ICoder.h"
-#include "../Common/CodecsPath.h"
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace N7z {
-
-static CObjectVector<CMethodInfo2> g_Methods;
-static bool g_Loaded = false;
-
-typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods);
-
-typedef UInt32 (WINAPI *GetMethodPropertyFunc)(
- UInt32 index, PROPID propID, PROPVARIANT *value);
-
-static void Load(const CSysString &folderPrefix)
-{
- NFile::NFind::CEnumerator enumerator(folderPrefix + CSysString(TEXT("*")));
- NFile::NFind::CFileInfo fileInfo;
- while (enumerator.Next(fileInfo))
- {
- if (fileInfo.IsDirectory())
- continue;
- CSysString filePath = folderPrefix + fileInfo.Name;
- {
- NDLL::CLibrary library;
- if (!library.LoadEx(filePath, LOAD_LIBRARY_AS_DATAFILE))
- continue;
- }
- NDLL::CLibrary library;
- if (!library.Load(filePath))
- continue;
- GetMethodPropertyFunc getMethodProperty = (GetMethodPropertyFunc)
- library.GetProcAddress("GetMethodProperty");
- if (getMethodProperty == NULL)
- continue;
-
- UInt32 numMethods = 1;
- GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)
- library.GetProcAddress("GetNumberOfMethods");
- if (getNumberOfMethodsFunc != NULL)
- if (getNumberOfMethodsFunc(&numMethods) != S_OK)
- continue;
-
- for(UInt32 i = 0; i < numMethods; i++)
- {
- CMethodInfo2 info;
- info.FilePath = filePath;
-
- NWindows::NCOM::CPropVariant propVariant;
- if (getMethodProperty(i, NMethodPropID::kID, &propVariant) != S_OK)
- continue;
- if (propVariant.vt != VT_BSTR)
- continue;
- info.MethodID.IDSize = SysStringByteLen(propVariant.bstrVal);
- memmove(info.MethodID.ID, propVariant.bstrVal, info.MethodID.IDSize);
- propVariant.Clear();
-
- if (getMethodProperty(i, NMethodPropID::kName, &propVariant) != S_OK)
- continue;
- if (propVariant.vt == VT_EMPTY)
- {
- }
- else if (propVariant.vt == VT_BSTR)
- info.Name = propVariant.bstrVal;
- else
- continue;
- propVariant.Clear();
-
- if (getMethodProperty (i, NMethodPropID::kEncoder, &propVariant) != S_OK)
- continue;
- if (propVariant.vt == VT_EMPTY)
- info.EncoderIsAssigned = false;
- else if (propVariant.vt == VT_BSTR)
- {
- info.EncoderIsAssigned = true;
- info.Encoder = *(const GUID *)propVariant.bstrVal;
- }
- else
- continue;
- propVariant.Clear();
-
- if (getMethodProperty (i, NMethodPropID::kDecoder, &propVariant) != S_OK)
- continue;
- if (propVariant.vt == VT_EMPTY)
- info.DecoderIsAssigned = false;
- else if (propVariant.vt == VT_BSTR)
- {
- info.DecoderIsAssigned = true;
- info.Decoder = *(const GUID *)propVariant.bstrVal;
- }
- else
- continue;
- propVariant.Clear();
-
- if (getMethodProperty (i, NMethodPropID::kInStreams, &propVariant) != S_OK)
- continue;
- if (propVariant.vt == VT_EMPTY)
- info.NumInStreams = 1;
- else if (propVariant.vt == VT_UI4)
- info.NumInStreams = propVariant.ulVal;
- else
- continue;
- propVariant.Clear();
-
- if (getMethodProperty (i, NMethodPropID::kOutStreams, &propVariant) != S_OK)
- continue;
- if (propVariant.vt == VT_EMPTY)
- info.NumOutStreams = 1;
- else if (propVariant.vt == VT_UI4)
- info.NumOutStreams = propVariant.ulVal;
- else
- continue;
- propVariant.Clear();
-
- g_Methods.Add(info);
- }
- }
-}
-
-static NSynchronization::CCriticalSection g_CriticalSection;
-
-void LoadMethodMap()
-{
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- if (g_Loaded)
- return;
- g_Loaded = true;
- Load(GetCodecsFolderPrefix());
-}
-
-bool GetMethodInfo(const CMethodID &methodID, CMethodInfo &methodInfo)
-{
- for(int i = 0; i < g_Methods.Size(); i++)
- {
- const CMethodInfo2 &method = g_Methods[i];
- if (method.MethodID == methodID)
- {
- methodInfo = (CMethodInfo)method;
- return true;
- }
- }
- return false;
-}
-
-bool GetMethodInfo(const UString &name, CMethodInfo2 &methodInfo)
-{
- for(int i = 0; i < g_Methods.Size(); i++)
- {
- const CMethodInfo2 &method = g_Methods[i];
- if (method.Name.CompareNoCase(name) == 0)
- {
- methodInfo = method;
- return true;
- }
- }
- return false;
-}
-
-}}
-
-