clawsoftware / clawPDF

Open Source Virtual (Network) Printer for Windows that allows you to create PDFs, OCR text, and print images, with advanced features usually available only in enterprise solutions.
https://github.com/clawsoftware/clawPDF
GNU Affero General Public License v3.0
661 stars 147 forks source link

Button e-mail send - Nothing happens #20

Closed jenastadt closed 1 year ago

jenastadt commented 4 years ago

OS: Windows 10 Enterprise LTSC 2019 (1809) E-Mail Client: Mozilla Thunderbird 68.5.0 (x86) de >>> (default e-mail client: yes)

Nothing happens when you press the Email button.

OS event viewer with two entries

Quelle: .NET Runtime
Ereignis-ID: 1026

Anwendung: clawPDF.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.OverflowException
   bei clawSoft.clawPDF.Mail.MapiMailMessage._AllocAttachments(Int32 ByRef)
   bei clawSoft.clawPDF.Mail.MapiMailMessage._ShowMail(System.Object)
   bei System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   bei System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   bei System.Threading.ThreadHelper.ThreadStart()

Quelle: Application Error
Ereignis-ID: 1000

Name der fehlerhaften Anwendung: clawPDF.exe, Version: 0.8.4.0, Zeitstempel: 0x5cffa478
Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 10.0.17763.1075, Zeitstempel: 0x148b44ee
Ausnahmecode: 0xe0434352
Fehleroffset: 0x0000000000039179
ID des fehlerhaften Prozesses: 0x1e40
Startzeit der fehlerhaften Anwendung: 0x01d5f6e4f24b7748
Pfad der fehlerhaften Anwendung: C:\Program Files (x86)\clawPDF\clawPDF.exe
Pfad des fehlerhaften Moduls: C:\Windows\System32\KERNELBASE.dll
Berichtskennung: 184d5dc5-7fe8-4d29-91a5-dead56d38649
Vollständiger Name des fehlerhaften Pakets: 
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: 

The following can be read in the LOG-File "clawPDF.log"

2020-03-10 15:06:01.6020 [Fatal] clawSoft.clawPDF.App.CurrentDomain_UnhandledException: Uncaught exception, IsTerminating: True System.OverflowException: Die arithmetische Operation hat einen Überlauf verursacht.
   bei clawSoft.clawPDF.Mail.MapiMailMessage._AllocAttachments(Int32& fileCount)
   bei clawSoft.clawPDF.Mail.MapiMailMessage._ShowMail(Object ignore)
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Threading.ThreadHelper.ThreadStart()

Windows features .NET Framework 3.5 (include .NET 2.0 and 3.0) .NET Framework 4.7 Advanced Services are activated

I am available for further error analysis.

S. Lehnert Systems engineer

jenastadt commented 4 years ago

I noticed something else

The installation path is "C:\Program Files (x86)\clawPDF" of the MSI package, but the application is recognized as 64-bit in the task manager?

There is something structurally wrong.

A 64-bit compiled application must install in the "C: \Program Files\" directory and a 32-bit compiled application must install in the "C: \Program Files (x86)\" directory.

The operating system also determines the environment in which the application runs. In our case, a 64-bit application would also have the 64-bit environment, i.e. no access to a 32-bit email client.

In this case, the program directory does not determine the environment in which the application is run, but the operating system.

A compiled 32-bit version of the "clawPDF" would also be required for users who use a 32-bit e-mail client and a compiled 64-bit version of the "clawPDF" for users who use a 64-bit e-mail client " be available.

christianpare commented 4 years ago

I have the same issue here. My email client is the built-in Windows 10 Mail application. When I hit the Email button the application crashes silently. .. Any idea? I am available for diagnostics as well.

I have tried debugging the issue in Studio and the crash occurs in MAPISendMail. I am still digging.

christianpare commented 4 years ago

Follow-up!! I think I have found the issue.

Members of the MapiFileDescriptor, MapiRecipDesc and MapiMessage classes (structures) are not in the same order as what MAPISendMail is expecting

https://docs.microsoft.com/fr-ca/windows/win32/api/mapi/ns-mapi-mapimessage

I reordered the members to match what Microsoft expects and BOOM it worked like a charm.

Not sure why the members are not in the same order as the documentation though. Has this ever worked? :-)

[MapiClient.cs.patch.txt]

(https://github.com/clawsoftware/clawPDF/files/4512170/MapiClient.cs.patch.txt)

I have attached a patch file of what I have changed in order to get this to work.

LeMerP commented 3 years ago

Follow-up!! I think I have found the issue.

Members of the MapiFileDescriptor, MapiRecipDesc and MapiMessage classes (structures) are not in the same order as what MAPISendMail is expecting

https://docs.microsoft.com/fr-ca/windows/win32/api/mapi/ns-mapi-mapimessage

I reordered the members to match what Microsoft expects and BOOM it worked like a charm.

Not sure why the members are not in the same order as the documentation though. Has this ever worked? :-)

[MapiClient.cs.patch.txt]

(https://github.com/clawsoftware/clawPDF/files/4512170/MapiClient.cs.patch.txt)

I have attached a patch file of what I have changed in order to get this to work.

Thank you @christianpare. Your patch works like a charm with Thunderbird 78.3.1 (32-Bit) on Windows 10 (64-Bit) [10.0.17763.1457]

christian1980nrw commented 2 years ago

I uploaded a compiled version of the fix here: https://github.com/christian1980nrw/clawPDF/blob/master/clawPDF.Mail.DLL E-Mail is working again after replacing the file. @hessandrew @clawsoftware Please accept my pull request and release a new Version. Please update your MSI to Ghostscript 9.55.0 too. I am already using the DLL´s without issue.

clawsoftware commented 1 year ago

Fixed with version 0.8.5