Hi,
I had a bug in my plugin where I passed an uninitialized string to tProcessDataProc as FileName in PK_TEST operation. I haven't noticed this since until recently (either because of recent TC update or my migration to Windows 7) all filenames were correctly shown in the progress bar. But now, if I use the (old) build with the bug, garbage can be seen in the progress bar instead of file names (thus showing the uninitialized string is used).
In the plugin reference it says:
"FileName can be used to pass a pointer to the currently processed filename (0 terminated string), or NULL if it is not available."
When exactly is the FileName used by TC? If I pass NULL or empty string, correct FileName is shown anyway. I tried passing some random string as FileName ("Blahblahblah") and again correct filename was shown...in all, I could only see the FileName variable being used when I passed the uninitialized garbage string.
Is it then safe to always pass NULL? Or is this string sometimes used in the progress bar (or unpacking)?
tProcessDataProc in packer plugin
Moderators: Hacker, petermad, Stefan2, white
- ghisler(Author)
- Site Admin
- Posts: 50479
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
It's safe to use NULL because it's documented like this. TC sets the name itself when telling the plugin to unpack a file. TC should pick up the name passed in via callback if the unpacking takes longer. Some packer plugins need this because they unpack files only when they have received all the name (e.g. the SQX plugin).
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
I was more concerned that proper filenames would be shown in the dialog if NULL was passed every time but it seems to work ok in my case.
Apparently the string has to change to be shown in the progress bar. That's why uninitialized garbage was shown, but "BLAH" wasn't
. Since passing NULL works fine and it's easier to do in UNICODE build (no conversion) I'll just use that
. Thanks!
Apparently the string has to change to be shown in the progress bar. That's why uninitialized garbage was shown, but "BLAH" wasn't

