Hi,
I've written my own packer-plugin. Extraction and copying works well.
I've compiled my packer-plugin PK_CAPS_SEARCHTEXT. If I'm doing a search including packer, total commander crashes after the first call of my plugins's ReadHeader:
First-chance exception at 0x004027e1 in TOTALCMD.EXE: 0xC0000005: Access violation writing location 0x0067c9a6.
Unhandled exception at 0x004027e1 in TOTALCMD.EXE: 0xC0000005: Access violation writing location 0x0067c9a6.
The disassembly-line reads
004027E0 std
004027E1 rep movs dword ptr es:[edi],dword ptr [esi]
[ESI] points to the last character of my archive-name (in multi-byte notation), CX is 0xB (string length/2), and the direction flag is set (that is, the string-copying is performed backwards).
The address es:edi is invalid.
The code looks like some memcpy (string assignment) to an unallocated memory.
I could reproduce this with TC7.5 and 7.55a.
My plugin only currently supports the ANSI-functions. Searching inside a ZIP did not crash, but I suppose the internal ZIP packer supports/uses the unicode interface.
Is this a TC problem or plugin-problem?
TC7.55a, crash in searchdialog after PackerPlugin ReadHeader
Moderators: Hacker, petermad, Stefan2, white
- ghisler(Author)
- Site Admin
- Posts: 50518
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I haven't seen this error with any other plugins. Can you send me a sample plugin so I can check it in the debugger, please?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50518
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Thanks, I will check it! Please do not post my e-mail address in clear text here, I'm already getting enough spam. (I have changed it in your post.)
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Problem solved, wrong calling convention
To everyone facing the same problem and reading this thread:
Christian debugged my example and found the reason. I've used a wrong calling convention (DLLIMPORT(a) extern "C" __declspec (dllexport) a).
But Total Commander needs __stdcall, hence
#define DLLIMPORT(a) a APIENTRY
DLLIMPORT(int) someFunc() {}
does the trick.
Thanks.
Christian debugged my example and found the reason. I've used a wrong calling convention (DLLIMPORT(a) extern "C" __declspec (dllexport) a).
But Total Commander needs __stdcall, hence
#define DLLIMPORT(a) a APIENTRY
DLLIMPORT(int) someFunc() {}
does the trick.
Thanks.
Last edited by Holyhead on 2010-07-26, 06:29 UTC, edited 1 time in total.