Hi all,
I'm writing a packer plugin for opening Unix mailbox files (read-only).
After reading 'WCX Writer's Reference.hlp' (Ver. 2.1), I have some questions:
a) SetChangeVolProc() and SetProcessDataProc():
Are these procedures mandatory or not?
In the contents of 'WCX Writer's Reference.hlp' they are listed in the category 'optional', but in the chapter 'Overview' it reads:
<quote>
The minimum functions needed for a read-only plugin are:
OpenArchive ...
ReadHeader ...
ProcessFile ...
CloseArchive ...
SetChangeVolProc ...
SetProcessDataProc ...
<unquote>
b) In the chapter 'ProcessFile', it reads:
<quote>
Either DestName contains the full path and file name and DestPath is NULL, or DestName contains only the file name and DestPath the file path.
<unquote>
So I think I'll write something like this:
---------------------------------------------------
if lpszDestPath != 0 then
DestName = DestPath & "\" & DestName
end if
---------------------------------------------------
What about putting the backslash between 'DestPath' and 'DestName'? Is it required here, or does 'DestPath' always have a trailing backslash, or must my plugin check each time, whether or not 'DestPath' has a trailing backslash?
TIA, and best regards,
Juergen
Packer plugin for opening Unix mailbox files
Moderators: Hacker, petermad, Stefan2, white
Packer plugin for opening Unix mailbox files
My add-ons and plugins for TC: NiftyLink, mbox, Sequences
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
a) Yes, SetChangeVolProc() and SetProcessDataProc() are needed. You can implement them as empty functions, though, if you don't want to implement the callback functions.
b) To be on the safe side, you should always check whether there is a trailing backslash or not. Total Commander doesn't use the DestPath, but other programs may use the plugins too, and could use it.
I'm using the following function in my own code. It only appends a backslash if there isn't any yet.
LPTSTR strlcatbackslash(char* thedir,int maxlen)
{
if (thedir[0] && strlen(thedir)<(DWORD)maxlen)
if (thedir[strlen(thedir)-1]!='\\')
strcat(thedir,"\\");
return thedir;
}
Call it like this:
strlcatbackslash(thedir,sizeof(thedir)-1);
b) To be on the safe side, you should always check whether there is a trailing backslash or not. Total Commander doesn't use the DestPath, but other programs may use the plugins too, and could use it.
I'm using the following function in my own code. It only appends a backslash if there isn't any yet.
LPTSTR strlcatbackslash(char* thedir,int maxlen)
{
if (thedir[0] && strlen(thedir)<(DWORD)maxlen)
if (thedir[strlen(thedir)-1]!='\\')
strcat(thedir,"\\");
return thedir;
}
Call it like this:
strlcatbackslash(thedir,sizeof(thedir)-1);
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com