xref: /aosp_15_r20/external/lzma/CPP/7zip/UI/FileManager/RegistryPlugins.cpp (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // RegistryPlugins.cpp
2 
3 #include "StdAfx.h"
4 
5 /*
6 #include "../../../Windows/DLL.h"
7 #include "../../../Windows/FileFind.h"
8 #include "../../../Windows/PropVariant.h"
9 
10 #include "IFolder.h"
11 */
12 #include "RegistryPlugins.h"
13 
14 // using namespace NWindows;
15 // using namespace NFile;
16 
17 /*
18 typedef UINT32 (WINAPI * Func_GetPluginProperty)(PROPID propID, PROPVARIANT *value);
19 
20 static bool ReadPluginInfo(CPluginInfo &plugin, bool needCheckDll)
21 {
22   if (needCheckDll)
23   {
24     NDLL::CLibrary lib;
25     if (!lib.LoadEx(plugin.FilePath, LOAD_LIBRARY_AS_DATAFILE))
26       return false;
27   }
28   NDLL::CLibrary lib;
29   if (!lib.Load(plugin.FilePath))
30     return false;
31   const
32   Func_GetPluginProperty
33      f_GetPluginProperty = ZIP7_GET_PROC_ADDRESS(
34   Func_GetPluginProperty, lib.Get_HMODULE(),
35       "GetPluginProperty");
36   if (!f_GetPluginProperty)
37     return false;
38 
39   NCOM::CPropVariant prop;
40   if (f_GetPluginProperty(NPlugin::kType, &prop) != S_OK)
41     return false;
42   if (prop.vt == VT_EMPTY)
43     plugin.Type = kPluginTypeFF;
44   else if (prop.vt == VT_UI4)
45     plugin.Type = (EPluginType)prop.ulVal;
46   else
47     return false;
48   prop.Clear();
49 
50   if (f_GetPluginProperty(NPlugin::kName, &prop) != S_OK)
51     return false;
52   if (prop.vt != VT_BSTR)
53     return false;
54   plugin.Name = prop.bstrVal;
55   prop.Clear();
56 
57   if (f_GetPluginProperty(NPlugin::kClassID, &prop) != S_OK)
58     return false;
59   if (prop.vt == VT_EMPTY)
60     plugin.ClassID_Defined = false;
61   else if (prop.vt != VT_BSTR)
62     return false;
63   else
64   {
65     plugin.ClassID_Defined = true;
66     plugin.ClassID = *(const GUID *)(const void *)prop.bstrVal;
67   }
68   prop.Clear();
69   return true;
70 */
71 
72 /*
73 {
74   if (f_GetPluginProperty(NPlugin::kOptionsClassID, &prop) != S_OK)
75     return false;
76   if (prop.vt == VT_EMPTY)
77     plugin.OptionsClassID_Defined = false;
78   else if (prop.vt != VT_BSTR)
79     return false;
80   else
81   {
82     plugin.OptionsClassID_Defined = true;
83     plugin.OptionsClassID = *(const GUID *)(const void *)prop.bstrVal;
84   }
85 }
86 */
87 
88     /*
89     {
90       // very old 7-zip used agent plugin in "7-zip.dll"
91       // but then agent code was moved to 7zfm.
92       // so now we don't need to load "7-zip.dll" here
93       CPluginInfo plugin;
94       plugin.FilePath = baseFolderPrefix + FTEXT("7-zip.dll");
95       if (::ReadPluginInfo(plugin, false))
96       if (plugin.Type == kPluginTypeFF)
97         plugins.Add(plugin);
98     }
99     */
100     /*
101     FString folderPath = NDLL::GetModuleDirPrefix();
102     folderPath += "Plugins" STRING_PATH_SEPARATOR;
103     NFind::CEnumerator enumerator;
104     enumerator.SetDirPrefix(folderPath);
105     NFind::CFileInfo fi;
106     while (enumerator.Next(fi))
107     {
108       if (fi.IsDir())
109         continue;
110       CPluginInfo plugin;
111       plugin.FilePath = folderPath + fi.Name;
112       if (::ReadPluginInfo(plugin, true))
113       if (plugin.Type == kPluginTypeFF)
114         plugins.Add(plugin);
115     }
116     */
117 
118   /*
119   ReadPluginInfoList(plugins);
120   for (unsigned i = 0; i < plugins.Size();)
121     if (plugins[i].Type != kPluginTypeFF)
122       plugins.Delete(i);
123     else
124       i++;
125   */
126 
127 /*
128 void ReadFileFolderPluginInfoList(CObjectVector<CPluginInfo> &plugins)
129 {
130   plugins.Clear();
131   {
132   }
133 
134   {
135     CPluginInfo &plugin = plugins.AddNew();
136     // p.FilePath.Empty();
137     plugin.Type = kPluginTypeFF;
138     plugin.Name = "7-Zip";
139     // plugin.ClassID = CLSID_CAgentArchiveHandler;
140     // plugin.ClassID_Defined = true;
141     // plugin.ClassID_Defined = false;
142     // plugin.OptionsClassID_Defined = false;
143   }
144 }
145 */
146