Skip to content

Commit

Permalink
dir.so: Update to current observer version
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximus5 committed Dec 26, 2020
1 parent aecb2b7 commit 1305a51
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 36 deletions.
57 changes: 35 additions & 22 deletions Dir_b3/ModuleDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
// Extract progress callbacks
typedef int (CALLBACK *ExtractProgressFunc)(HANDLE, __int64);

#pragma pack(push, 1)

struct ExtractProcessCallbacks
{
HANDLE signalContext;
ExtractProgressFunc FileProgress;
};

#define ACTUAL_API_VERSION 3
#define ACTUAL_API_VERSION 6
#define STORAGE_FORMAT_NAME_MAX_LEN 32
#define STORAGE_PARAM_MAX_LEN 64

Expand All @@ -26,45 +28,63 @@ struct StorageGeneralInfo

struct StorageOpenParams
{
size_t StructSize;
const wchar_t* FilePath;
const char* Password;
const void* Data;
size_t DataSize;
};

struct StorageItemInfo
{
DWORD Attributes;
__int64 Size;
__int64 PackedSize;
DWORD Attributes;
FILETIME CreationTime;
FILETIME ModificationTime;
WORD NumHardlinks;
wchar_t Owner[64];
wchar_t Path[1024];
};

struct ExtractOperationParams
{
int item;
int flags;
const wchar_t* destFilePath;
ExtractProcessCallbacks callbacks;
int ItemIndex;
int Flags;
const wchar_t* DestPath;
const char* Password;
ExtractProcessCallbacks Callbacks;
};

typedef int (MODULE_EXPORT *OpenStorageFunc)(StorageOpenParams, HANDLE*, StorageGeneralInfo*);
typedef void (MODULE_EXPORT *CloseStorageFunc)(HANDLE);
typedef int (MODULE_EXPORT *GetItemFunc)(HANDLE, int, StorageItemInfo*);
typedef int (MODULE_EXPORT *ExtractFunc)(HANDLE, ExtractOperationParams params);
typedef int (MODULE_EXPORT *OpenStorageFunc)(StorageOpenParams params, HANDLE *storage, StorageGeneralInfo *info);
typedef int (MODULE_EXPORT *PrepareFilesFunc)(HANDLE storage);
typedef void (MODULE_EXPORT *CloseStorageFunc)(HANDLE storage);
typedef int (MODULE_EXPORT *GetItemFunc)(HANDLE storage, int item_index, StorageItemInfo* item_info);
typedef int (MODULE_EXPORT *ExtractFunc)(HANDLE storage, ExtractOperationParams params);

struct module_cbs
{
OpenStorageFunc OpenStorage;
CloseStorageFunc CloseStorage;
GetItemFunc GetItem;
ExtractFunc ExtractItem;
PrepareFilesFunc PrepareFiles;
};

struct ModuleLoadParameters
{
//IN
size_t StructSize;
const wchar_t* Settings;
//OUT
GUID ModuleId;
DWORD ModuleVersion;
DWORD ApiVersion;
OpenStorageFunc OpenStorage;
CloseStorageFunc CloseStorage;
GetItemFunc GetItem;
ExtractFunc ExtractItem;
module_cbs ApiFuncs;
};

#pragma pack(pop)

// Function that should be exported from modules
typedef int (MODULE_EXPORT *LoadSubModuleFunc)(ModuleLoadParameters*);
typedef void (MODULE_EXPORT *UnloadSubModuleFunc)(void);
Expand All @@ -88,13 +108,6 @@ typedef void (MODULE_EXPORT *UnloadSubModuleFunc)(void);
#define SER_ERROR_READ 2
#define SER_ERROR_SYSTEM 3
#define SER_USERABORT 4

// Extract error reactions
#define EEN_ABORT 1
#define EEN_RETRY 2
#define EEN_SKIP 3
#define EEN_SKIPALL 4
#define EEN_CONTINUE 5
#define EEN_CONTINUESILENT 6
#define SER_PASSWORD_REQUIRED 5

#endif
10 changes: 10 additions & 0 deletions Dir_b3/_Dir.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dir_b3", "dir_b3.vcxproj",
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dir_fmt_exe", "dir_fmt_exe.vcxproj", "{2C08961C-89C1-4263-AA60-820B4C82B4E3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dir_so", "dir_so.vcxproj", "{54892E57-F71A-4E2D-8132-B717B3FD7649}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand All @@ -29,6 +31,14 @@ Global
{2C08961C-89C1-4263-AA60-820B4C82B4E3}.Release|Win32.ActiveCfg = Release|Win32
{2C08961C-89C1-4263-AA60-820B4C82B4E3}.Release|Win32.Build.0 = Release|Win32
{2C08961C-89C1-4263-AA60-820B4C82B4E3}.Release|x64.ActiveCfg = Release|Win32
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Debug|Win32.ActiveCfg = Debug|Win32
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Debug|Win32.Build.0 = Debug|Win32
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Debug|x64.ActiveCfg = Debug|x64
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Debug|x64.Build.0 = Debug|x64
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Release|Win32.ActiveCfg = Release|Win32
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Release|Win32.Build.0 = Release|Win32
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Release|x64.ActiveCfg = Release|x64
{54892E57-F71A-4E2D-8132-B717B3FD7649}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
33 changes: 23 additions & 10 deletions Dir_b3/dir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
2) MultiArc module (*.fmt)
* ************************** */

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdlib.h>
#include "plugin.hpp"
#include "fmt.hpp"
#include <crtdbg.h>
Expand Down Expand Up @@ -117,7 +119,7 @@ struct DirInfo
return Ret;
};

bool Compare(char *Str, char *Mask, bool NonEng = false, int Len=-1)
bool Compare(const char *Str, const char *Mask, bool NonEng = false, int Len=-1)
{
int nCmp = (Len==-1) ? lstrlenA(Mask) : Len;

Expand Down Expand Up @@ -218,10 +220,10 @@ struct DirInfo

int getArcItem(struct PluginPanelItem *Item, struct ArcItemInfo *Info)
{
static char *LabelHeader[]={ " Òîì", " Volume in" };
static char *SerialHeader[]={ " Ñåðèéíûé", " Volume Serial" };
static char *DirHeader[]={ " Ñîäåðæèìîå ïàïêè", " Directory of" };
static char *DirEndHeader[]={ " Âñåãî ôàéëîâ:", " Total Files" };
static const char *LabelHeader[]={ " Òîì", " Volume in" };
static const char *SerialHeader[]={ " Ñåðèéíûé", " Volume Serial" };
static const char *DirHeader[]={ " Ñîäåðæèìîå ïàïêè", " Directory of" };
static const char *DirEndHeader[]={ " Âñåãî ôàéëîâ:", " Total Files" };
static char DirID[]="<DIR>";
static char JunID[]="<JUNCTION>";
//char* Buf = (char*)malloc(4096);
Expand Down Expand Up @@ -412,7 +414,7 @@ struct DirInfo
BOOL WINAPI _export IsArchive(char *Name, const unsigned char *Data, int DataSize)
{
_ASSERTE(gpCur!=NULL);
static char *ID[]={ " Òîì â óñòðîéñòâå ", " Volume in drive ", "Queued to drive " };
static const char *ID[]={ " Òîì â óñòðîéñòâå ", " Volume in drive ", "Queued to drive " };
BOOL lbRc =
gpCur->Compare((char *)Data, ID[0], true, min(lstrlen(ID[0]), DataSize)) ||
gpCur->Compare((char *)Data, ID[1], false, min(lstrlen(ID[1]), DataSize)) ||
Expand Down Expand Up @@ -543,18 +545,29 @@ int MODULE_EXPORT ExtractItem(HANDLE storage, ExtractOperationParams params)
return SER_ERROR_SYSTEM;
}

int MODULE_EXPORT PrepareFiles(HANDLE storage)
{
return SER_ERROR_SYSTEM;
}

//////////////////////////////////////////////////////////////////////////
// Exported Functions
//////////////////////////////////////////////////////////////////////////

// {C0651C24-3DCA-441C-8A42-C73664F942CF}
static const GUID MODULE_GUID = { 0xc0651c24, 0x3dca, 0x441c, { 0x8a, 0x42, 0xc7, 0x36, 0x64, 0xf9, 0x42, 0xcf } };;

int MODULE_EXPORT LoadSubModule(ModuleLoadParameters* LoadParams)
{
LoadParams->ModuleId = MODULE_GUID;
LoadParams->ModuleVersion = MAKEMODULEVERSION(1, 0);
LoadParams->ApiVersion = ACTUAL_API_VERSION;
LoadParams->OpenStorage = OpenStorage;
LoadParams->CloseStorage = CloseStorage;
LoadParams->GetItem = GetStorageItem;
LoadParams->ExtractItem = ExtractItem;

LoadParams->ApiFuncs.OpenStorage = OpenStorage;
LoadParams->ApiFuncs.CloseStorage = CloseStorage;
LoadParams->ApiFuncs.GetItem = GetStorageItem;
LoadParams->ApiFuncs.ExtractItem = ExtractItem;
LoadParams->ApiFuncs.PrepareFiles = PrepareFiles;

return TRUE;
}
Expand Down
4 changes: 2 additions & 2 deletions Dir_b3/dir_b3.rc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,0,5
FILEVERSION 3,0,0,6
PRODUCTVERSION 1,71,0,0
FILEFLAGSMASK 0x0L
#ifdef _DEBUG
Expand All @@ -67,7 +67,7 @@ BEGIN
BEGIN
VALUE "Comments", "Current developer: [email protected]"
VALUE "FileDescription", "DIR XP/2003/Vista/7 parse for FAR Manager"
VALUE "FileVersion", "3.0 build 5"
VALUE "FileVersion", "3.0 build 6"
VALUE "InternalName", "Dir"
VALUE "LegalCopyright", "� Alexander Arefiev 2001, � Maximus5 2012"
VALUE "OriginalFilename", "dir.so"
Expand Down
12 changes: 10 additions & 2 deletions Dir_b3/dir_so.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{54892e57-f71a-4e2d-8132-b717b3fd7649}</ProjectGuid>
<RootNamespace>dirso</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand All @@ -53,7 +53,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -93,24 +93,28 @@
<OutDir>$(Configuration)\</OutDir>
<TargetName>dir</TargetName>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<TargetExt>.so</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(Configuration)\</OutDir>
<TargetName>dir</TargetName>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<TargetExt>.so</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>dir64</TargetName>
<OutDir>$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<TargetExt>.so</TargetExt>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>dir64</TargetName>
<OutDir>$(Configuration)\</OutDir>
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
<TargetExt>.so</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand All @@ -128,6 +132,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>dir_b3.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -150,6 +155,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>dir_b3.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -168,6 +174,7 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>dir_b3.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -190,6 +197,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>dir_b3.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down

0 comments on commit 1305a51

Please sign in to comment.