snowie2000 / mactype

Better font rendering for Windows.
https://mactype.net
GNU General Public License v3.0
9.75k stars 439 forks source link

MacTray control via the command line #934

Open LilywhiteLilith opened 1 year ago

LilywhiteLilith commented 1 year ago

Hello, i have a question / suggestion. I would like to ask if it would be possible to enable control of MacTray.exe via the command line.

The following commands would be helpful:

This would allow to control MacTray from an application in a way that profiles can be changed without having to open the popup menu of MacTray via a mouse click and having to click on the command "Restart". Background: I have developed a program that works with chess fonts whose hatching (black board squares) is only very weakly displayed under Windows (MacType is a really fantastic and very big help here!!!). From my program, 3 predefined profiles can be optionally written into the MacType.ini under [AlternativeFile]. Now it would be nice if it would be possible to activate the changed profile from within the program via a "shell" command ("mactray.exe /restart").

Would this be feasible/conceivable? :-)

snowie2000 commented 1 year ago

Not possible yet, but they can be accomplished without too much trouble, at least that's what I thought.

Do you have any good ideas about CLI controlling other than stopping and restarting?

LilywhiteLilith commented 1 year ago

Thank you very much @snowie2000 for your kind reply! I'm very glad that my suggestion meets with a positive response! :-)

It would be wonderful and most welcome if you would implement it! From my point of view, these two commands are enough. The Ini-files (i love these configuration files from the old Windows days very much!) offer a lot of possibilities to configure MacType as desired. Maybe other program developers are reading here and have ideas for further commands for the command line. The possibility to restart MacTray via a command line command would have a nice side effect in connection with custom profile icons. If custom icons are stored for profiles, the MacTray icon is not replaced by the custom icon of the activated profile immediately after starting MacTray, but only when the profile is clicked in the popup menu. Also after changing a profile via the entry as "AlternativeFile" in the MacTray.ini, this profile is immediately shown as selected in the popup menu of MacTray, but the icon of the new profile is not automatically shown as the new MacTray icon, but only after a restart of MacTray.

I am infinitely glad that I discovered MacType!!! It was (and is!) nerve-wracking enough for me to develop my program compatible with all Windows versions, from XP to 11. But it gets really unpleasant when you realize that a chess font ("1Echecs.ttf", which is the most important for my program, because he contains fairy chess pieces) is suddenly rendered so badly that the hatchings are almost unrecognizable! This started with Windows 7 and made me spend useless hours looking for the cause, "experimenting" with ClearType/compatibility options and searching in vain for solutions to this (for me) serious problem in various forums.

Here's an image comparison that shows why I'm so excited about MacType:

image

My 3 profiles are based on the "Clean Dark" profile @sammilucia (fine work!). I only changed the value "RenderWeight" from 1.2 to 1.6 respectively 2.0. Profile 3 with [Include] 1Echecs, Profile 1 without [Include].

With that in mind, thank you from the bottom of my heart for this project, for what is truly an excellent program, in which certainly a lot of work is involved! MacType is really great and a jewel! :-)

snowie2000 commented 1 year ago

Glad that mactype does make some improvements to your digital life😀

There is still a question I would like to know: In which way do you prefer the CLI control to be invoked?

Do you keep an instance of mactray.exe running in the background (as it usually should be) and would like to "dispatch" a command to it via the command line? or Mactray.exe runs once and exits thereafter, leaving the rendering application running on itself, and then you'd like to issue a new rendering or something if you would like some other apps or changes to be made.

LilywhiteLilith commented 1 year ago

In the way as described in the first case. There is already an instance of MacTray.exe running, I want to be able to send the commands from my application to the running instance via command line, which otherwise can only be triggered by mouse click via the command in the popup menu.

:-)

LilywhiteLilith commented 1 year ago

Do you have any good ideas about CLI controlling other than stopping and restarting?

This two commands could still be helpful:

snowie2000 commented 1 year ago

Hi, I would like you to know that a preview build has been released and has this CLI controlling feature implemented.

Please give it a try.

LilywhiteLilith commented 1 year ago

Hi @snowie2000 !

After a lot of testing, I have now noticed something that is very strange. After executing the commands "disable" or "stop", which are executed quite correctly, my program "disappears" afterwards under Windows 11.

Please have a look at the picture. It reflects the situation after the command "/s disable":

image

If the commands "Disable" and "Exit" are executed by mouse click in the popup menu of MacTray, the result is the same: my program is "gone" afterwards.

And here is a screenshot showing the situation under Windows 10, where there are no problems at all:

image

It is noticeable that here "mt64agnt.exe" appears as a subprocess, whereas under Windows 11 it does not!

Of course I can do without the two commands in case of need, it is already super and absolutely helpful that the command "/s restart" works so wonderfully!

Best regards,

Lilywhite Lilith

snowie2000 commented 1 year ago

This means when Mactype tries to ask processes to unload Dlls, something wrong happened, and it crashed.

mt64agnt.exe should be in your task manager all the time because that's what is needed for mactype to "talk" to 64bit programs since mactray.exe itself is only a 32bit exe. Can you check your eventlog and see if there is anything reported about the crash?

On Thu, Jun 15, 2023 at 4:25 PM Lilywhite Lilith @.***> wrote:

Hi @snowie2000 https://github.com/snowie2000 !

Mir ist nach vielen Test nun doch etwas aufgefallen, das sehr seltsam ist und lediglich Windows 11 betrifft.

MacTray.exe wird aus meinem Programm heraus mit dem SHELL-Befehl gestartet: Die Steuerung von MacTray.exe ĂŒber den Befehl "/s restart" funktioniert unter sĂ€mtlichen von mir getesteten Windows-Versionen (7/8/10/11) einwandfrei!

Lediglich bei den Befehlen "/s disable" und "/s stop" gibt es ein seltsames PhĂ€nomen, seltsamerweise nur unter Windows 11! In diesem Fall werden die Befehle zwar korrekt ausgefĂŒhrt, aber danach ist mein Programm "verschwunden".

Bitte schaue Dir das Bild an. Es spiegelt die Situation nach dem Befehl "/s disable" unter Windows 11:

[image: image] https://user-images.githubusercontent.com/18245882/246042945-7ce2ef24-b379-4970-b256-98f6e2f7b681.png

Und hier unter Windows 10, wo der Befehl "/s disable" ohne Probleme ausgefĂŒhrt wurde:

[image: image] https://user-images.githubusercontent.com/18245882/246043852-42ae78ec-218e-407a-90f1-b22b8d2fecce.png

Werden die Befehle "Disable" und "Exit" durch Mausklick im Popup-MenĂŒ von MacTray ausgefĂŒhrt, ist das Ergebnis das selbe: mein Programm ist danach "verschwunden".

Was mir auffÀllt: Unter Windows 10 wird im Task-Manager als Unterprozess meines Programms "mt64agnt.exe" angezeigt, unter Windows 11 nicht!

NatĂŒrlich kann ich zur Not auf die beiden Befehle verzichten, es ist schon super und absolut hilfreich, dass der Befehl "/s restart" so wunderbar funktioniert! :-)

GrĂŒĂŸe,

Lilywhite Lilith

— Reply to this email directly, view it on GitHub https://github.com/snowie2000/mactype/issues/934#issuecomment-1592595302, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZY3FMEVWWJYFWUXCC5XR3XLLBHHANCNFSM6AAAAAAYDUGRD4 . You are receiving this because you were mentioned.Message ID: @.***>

LilywhiteLilith commented 1 year ago

The same error always appears in the Windows event viewer:

image

Yesterday MacType showed me several times an error window after I had executed the command "Exit" or "Deactivate" via the popup menu of MacTray. Before that I had started MacTray.exe from Chessdiagrammer as usual with the "SHELL" command. You can find the error report below.

Kind regards

Lilywhite Lilith

Bug report:

`date/time : 2023-06-14, 08:49:22, 754ms computer name : THINKPAD user name : Lilywhite Lilith registered owner : Lilywhite Lilith operating system : Windows 10 x64 build 22621 system language : German system up time : 30 minutes 35 seconds program up time : 2 minutes 49 seconds processors : 2x Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz physical memory : 5729/8179 MB (free/total) free disk space : (C:) 2.17 GB display mode : 1280x720, 32 bit process id : $170c allocated memory : 39.54 MB largest free block : 1.67 GB executable : MacTray.exe exec. date/time : 2023-06-01 03:39 version : 1.0.2023.5 compiled with : Delphi XE madExcept version : 5.0.0 contact name : Lilywhite Lilith contact email : lilith@windharfe.de callstack crc : $77524ef5, $2c5989de, $1138e06d exception number : 1 exception class : EAccessViolation exception message : Access violation at address 77524EF5 in module 'ntdll.dll'. Write of address 00000014.

thread $1740 (TMacTypeOnDemandLoader): 77524ef5 +95 ntdll.dll 77503d54 +44 ntdll.dll RtlEnterCriticalSection 004c3508 +04 MacTray.exe SyncObjs 994 +0 TCriticalSection.Acquire 005aab4d +05 MacTray.exe untProcessManager 481 +0 TProcessMan.BeginUpdate 005aaee4 +10 MacTray.exe untProcessManager 596 +1 TProcessMan.FindProcessByPID 00611f02 +ce MacTray.exe untMain 3492 +20 TMacTypeOnDemandLoader.Execute 004789f3 +2b MacTray.exe madExcept 17478 +3 HookedTThreadExecute 004befae +42 MacTray.exe Classes 11407 +11 ThreadProc 0040704c +28 MacTray.exe System 16524 +45 ThreadWrapper 004788d5 +0d MacTray.exe madExcept 17411 +6 CallThreadProcSafe 0047893f +37 MacTray.exe madExcept 17461 +9 ThreadExceptFrame 76937d57 +17 KERNEL32.DLL BaseThreadInitThunk

created by main thread ($17d4) at: 00611d5c +18 MacTray.exe untMain 3444 +1 TMacTypeOnDemandLoader.Create

main thread ($17d4): 75f11c4c +04c USER32.dll MsgWaitForMultipleObjectsEx 75f213ca +01a USER32.dll MsgWaitForMultipleObjects 004bfe5b +06f MacTray.exe Classes 12092 +13 TThread.WaitFor 004bf19f +033 MacTray.exe Classes 11491 +6 TThread.Destroy 00612425 +089 MacTray.exe untMain 3657 +11 TASyncProcLoader.Destroy 0040561c +008 MacTray.exe System 11069 +1 TObject.Free 0060c76a +09e MacTray.exe untMain 1729 +14 TfrmPsInfo.FormDestroy 0056cc79 +031 MacTray.exe Forms 3332 +3 TCustomForm.DoDestroy 0056ca8e +06a MacTray.exe Forms 3265 +7 TCustomForm.BeforeDestruction 00405bf5 +009 MacTray.exe System 12216 +10 @BeforeDestruction 0056ca9e +006 MacTray.exe Forms 3274 +0 TCustomForm.Destroy 004c02d7 +057 MacTray.exe Classes 12319 +10 TComponent.DestroyComponents 0056a7d9 +035 MacTray.exe Forms 1773 +9 DoneApplication 0048e9d2 +026 MacTray.exe SysUtils 4694 +6 DoExitProc 00406ef9 +065 MacTray.exe System 16270 +41 @Halt0 006229a5 +58d MacTray.exe MacTray 184 +110 initialization 76937d57 +017 KERNEL32.DLL BaseThreadInitThunk

thread $2a4: 764b2aa9 +189 KERNELBASE.dll WaitForMultipleObjectsEx 004788d5 +00d MacTray.exe madExcept 17411 +6 CallThreadProcSafe 0047893f +037 MacTray.exe madExcept 17461 +9 ThreadExceptFrame 76937d57 +017 KERNEL32.DLL BaseThreadInitThunk

created by main thread ($17d4) at: 7618d28e +000 combase.dll

thread $1a1c (TASyncProcLoader): 764b0c92 +082 KERNELBASE.dll WaitForSingleObjectEx 764b0bfd +00d KERNELBASE.dll WaitForSingleObject 0046f1a7 +36b MacTray.exe madExcept 13589 +86 HandleException 00478a32 +06a MacTray.exe madExcept 17482 +7 HookedTThreadExecute 77538751 +021 ntdll.dll KiUserExceptionDispatcher 77504919 +0f9 ntdll.dll LdrGetDllFullName 764afdb0 +3f0 KERNELBASE.dll lstrcmpiW 005aab4d +005 MacTray.exe untProcessManager 481 +0 TProcessMan.BeginUpdate 005aaee4 +010 MacTray.exe untProcessManager 596 +1 TProcessMan.FindProcessByPID 0060f203 +577 MacTray.exe untMain 2642 +132 CheckForProcess 00612583 +0cb MacTray.exe untMain 3696 +17 TASyncProcLoader.Execute 004789f3 +02b MacTray.exe madExcept 17478 +3 HookedTThreadExecute 004befae +042 MacTray.exe Classes 11407 +11 ThreadProc 0040704c +028 MacTray.exe System 16524 +45 ThreadWrapper 004788d5 +00d MacTray.exe madExcept 17411 +6 CallThreadProcSafe 0047893f +037 MacTray.exe madExcept 17461 +9 ThreadExceptFrame 76937d57 +017 KERNEL32.DLL BaseThreadInitThunk

created by main thread ($17d4) at: 0061234c +018 MacTray.exe untMain 3639 +1 TASyncProcLoader.Create

thread $c18: 76937d57 +17 KERNEL32.DLL BaseThreadInitThunk

thread $1720: 76937d57 +17 KERNEL32.DLL BaseThreadInitThunk

thread $16d8: 76937d57 +17 KERNEL32.DLL BaseThreadInitThunk

modules: 00400000 MacTray.exe 1.0.2023.5 C:\Chessdiagrammer14\mactype 71a50000 DSPARSE.dll 10.0.22621.1105 C:\Windows\SYSTEM32 71a60000 dwrite.dll 10.0.22621.1635 C:\Windows\SYSTEM32 71c80000 d2d1.dll 10.0.22621.1635 C:\Windows\SYSTEM32 72170000 MacType.Core.dll 1.2023.531.1 C:\Chessdiagrammer14\mactype 72290000 Easyhk32.dll 2.8.0.0 C:\Chessdiagrammer14\mactype 722e0000 MacType.dll 1.2021.621.2 C:\Chessdiagrammer14\mactype 72310000 mstask.dll 10.0.22621.1 C:\Windows\System32 72340000 FaultRep.dll 10.0.22621.1635 C:\Windows\SYSTEM32 723b0000 winsta.dll 10.0.22621.1635 C:\Windows\SYSTEM32 72400000 wsock32.dll 10.0.22621.1 C:\Windows\SYSTEM32 72410000 msimg32.dll 10.0.22621.608 C:\Windows\SYSTEM32 72420000 MPR.dll 10.0.22621.1 C:\Windows\SYSTEM32 72440000 ntmarta.dll 10.0.22621.1 C:\Windows\SYSTEM32 72470000 dwmapi.dll 10.0.22621.1635 C:\Windows\SYSTEM32 724a0000 AcGenral.DLL 10.0.22621.1555 C:\Windows\SYSTEM32 72700000 OneCoreUAPCommonProxyStub.dll 10.0.22621.1635 C:\Windows\System32 72980000 Bcp47Langs.dll 10.0.22621.608 C:\Windows\System32 729d0000 appresolver.dll 10.0.22621.1635 C:\Windows\System32 72a50000 Wldp.dll 10.0.22621.1485 C:\Windows\SYSTEM32 72aa0000 virtdisk.dll 10.0.22621.1 C:\Windows\SYSTEM32 72ac0000 SspiCli.dll 10.0.22621.1485 C:\Windows\SYSTEM32 72af0000 srvcli.dll 10.0.22621.1 C:\Windows\SYSTEM32 72b10000 iertutil.dll 11.0.22621.1702 C:\Windows\SYSTEM32 72d40000 urlmon.dll 11.0.22621.1485 C:\Windows\SYSTEM32 72ef0000 Windows.StateRepositoryPS.dll 10.0.22621.1344 C:\Windows\System32 72f50000 edputil.dll 10.0.22621.1 C:\Windows\SYSTEM32 72f80000 MSACM32.dll 10.0.22621.1 C:\Windows\SYSTEM32 73260000 WINMM.dll 10.0.22621.1635 C:\Windows\SYSTEM32 732a0000 PROPSYS.dll 7.0.22621.608 C:\Windows\SYSTEM32 73370000 WINSPOOL.DRV 10.0.22621.1485 C:\Windows\SYSTEM32 735a0000 CoreUIComponents.dll 10.0.22621.1635 C:\Windows\SYSTEM32 73830000 windows.storage.dll 10.0.22621.1635 C:\Windows\SYSTEM32 73f10000 CFGMGR32.dll 10.0.22621.1344 C:\Windows\SYSTEM32 73f50000 CoreMessaging.dll 10.0.22621.1635 C:\Windows\SYSTEM32 74020000 textinputframework.dll 10.0.22621.1635 C:\Windows\SYSTEM32 74120000 CRYPTBASE.DLL 10.0.22621.1 C:\Windows\SYSTEM32 741a0000 wintypes.dll 10.0.22621.1485 C:\Windows\SYSTEM32 74270000 apphelp.dll 10.0.22621.1635 C:\Windows\SYSTEM32 74720000 TextShaping.dll 10.0.22621.1635 C:\Windows\SYSTEM32 747c0000 comctl32.dll 6.10.22621.1635 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.1635_none_6ebca75c88023f94 749f0000 MpOav.dll 4.18.23050.5 C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.23050.5-0\X86 74a60000 profapi.dll 10.0.22621.1 C:\Windows\SYSTEM32 74a80000 USERENV.dll 10.0.22621.1 C:\Windows\SYSTEM32 74aa0000 amsi.dll 10.0.22621.1 C:\Windows\SYSTEM32 74ac0000 fastprox.dll 10.0.22621.1635 C:\Windows\system32\wbem 74b90000 wbemsvc.dll 10.0.22621.1 C:\Windows\system32\wbem 74bd0000 wbemprox.dll 10.0.22621.1 C:\Windows\system32\wbem 74be0000 wbemcomn.dll 10.0.22621.1 C:\Windows\SYSTEM32 74cc0000 samcli.dll 10.0.22621.1 C:\Windows\SYSTEM32 74e10000 netutils.dll 10.0.22621.674 C:\Windows\SYSTEM32 74f30000 VERSION.dll 10.0.22621.1 C:\Windows\SYSTEM32 74fd0000 UxTheme.dll 10.0.22621.1635 C:\Windows\SYSTEM32 75050000 kernel.appcore.dll 10.0.22621.1 C:\Windows\SYSTEM32 751d0000 ole32.dll 10.0.22621.1702 C:\Windows\System32 75760000 advapi32.dll 10.0.22621.1485 C:\Windows\System32 75840000 SHELL32.dll 10.0.22621.1635 C:\Windows\System32 75eb0000 psapi.dll 10.0.22621.1 C:\Windows\System32 75ec0000 win32u.dll 10.0.22621.1635 C:\Windows\System32 75ef0000 USER32.dll 10.0.22621.1635 C:\Windows\System32 760a0000 combase.dll 10.0.22621.1485 C:\Windows\System32 76320000 SHLWAPI.dll 10.0.22621.1635 C:\Windows\System32 76370000 KERNELBASE.dll 10.0.22621.1702 C:\Windows\System32 765f0000 sechost.dll 10.0.22621.1635 C:\Windows\System32 76680000 GDI32.dll 10.0.22621.1635 C:\Windows\System32 766b0000 bcryptPrimitives.dll 10.0.22621.1344 C:\Windows\System32 76830000 gdi32full.dll 10.0.22621.1635 C:\Windows\System32 76920000 KERNEL32.DLL 10.0.22621.1702 C:\Windows\System32 76a10000 MSCTF.dll 10.0.22621.1635 C:\Windows\System32 76b50000 IMM32.DLL 10.0.22621.1344 C:\Windows\System32 76b90000 shcore.dll 10.0.22621.900 C:\Windows\System32 76c50000 comdlg32.dll 10.0.22621.1344 C:\Windows\System32 76d00000 msvcrt.dll 7.0.22621.608 C:\Windows\System32 76dd0000 msvcp_win.dll 10.0.22621.608 C:\Windows\System32 76e50000 OLEAUT32.dll 10.0.22621.608 C:\Windows\System32 76f50000 RPCRT4.dll 10.0.22621.1702 C:\Windows\System32 77010000 clbcatq.dll 2001.12.10941.16384 C:\Windows\System32 770a0000 WS2_32.dll 10.0.22621.1 C:\Windows\System32 77390000 ucrtbase.dll 10.0.22621.608 C:\Windows\System32 774c0000 ntdll.dll 10.0.22621.1485 C:\Windows\SYSTEM32

processes: 0000 Idle 0 0 0 0004 System 0 0 0 0058 Registry 0 0 0 0188 smss.exe 0 0 0 0248 csrss.exe 0 0 0 0290 wininit.exe 0 0 0 029c csrss.exe 1 0 0 02d4 winlogon.exe 1 0 0 0314 services.exe 0 0 0 0320 lsass.exe 0 0 0 0388 svchost.exe 0 0 0 039c fontdrvhost.exe 1 0 0 03a4 fontdrvhost.exe 0 0 0 01b8 svchost.exe 0 0 0 0194 svchost.exe 0 0 0 01e0 dwm.exe 1 0 0 041c svchost.exe 0 0 0 0470 svchost.exe 0 0 0 0478 svchost.exe 0 0 0 04d8 svchost.exe 0 0 0 04ec svchost.exe 0 0 0 0528 svchost.exe 0 0 0 053c VBoxService.exe 0 0 0 0554 svchost.exe 0 0 0 0588 svchost.exe 0 0 0 05a4 svchost.exe 0 0 0 05d4 svchost.exe 0 0 0 0600 svchost.exe 0 0 0 0618 svchost.exe 0 0 0 0620 svchost.exe 0 0 0 0628 svchost.exe 0 0 0 0690 svchost.exe 0 0 0 06a4 svchost.exe 0 0 0 06ac svchost.exe 0 0 0 0710 Memory Compression 0 0 0 0744 svchost.exe 0 0 0 07fc svchost.exe 0 0 0 0838 svchost.exe 0 0 0 088c svchost.exe 0 0 0 08a4 svchost.exe 0 0 0 0920 svchost.exe 0 0 0 0928 svchost.exe 0 0 0 0950 svchost.exe 0 0 0 0974 spoolsv.exe 0 0 0 09e8 svchost.exe 0 0 0 0a00 svchost.exe 0 0 0 0a18 svchost.exe 0 0 0 0b1c svchost.exe 0 0 0 0b24 svchost.exe 0 0 0 0b2c svchost.exe 0 0 0 0b38 svchost.exe 0 0 0 0b74 svchost.exe 0 0 0 0b80 svchost.exe 0 0 0 0b90 svchost.exe 0 0 0 078c svchost.exe 0 0 0 0e54 AggregatorHost.exe 0 0 0 0d24 svchost.exe 0 0 0 0f18 svchost.exe 0 0 0 0f8c svchost.exe 0 0 0 0fc4 svchost.exe 0 0 0 00a4 svchost.exe 0 0 0 04b0 SgrmBroker.exe 0 0 0 0518 uhssvc.exe 0 0 0 06d4 svchost.exe 0 0 0 0be0 svchost.exe 0 0 0 0848 svchost.exe 0 0 0 0820 sihost.exe 1 0 9 normal C:\Windows\System32 0f50 svchost.exe 1 0 1 normal C:\Windows\System32 06c4 svchost.exe 1 0 1 normal C:\Windows\System32 0220 svchost.exe 0 0 0 04fc svchost.exe 1 0 4 normal C:\Windows\System32 0840 taskhostw.exe 1 8 6 normal C:\Windows\System32 1054 svchost.exe 0 0 0 1114 explorer.exe 1 532 443 normal C:\Windows 1128 svchost.exe 0 0 0 121c svchost.exe 0 0 0 12c4 SearchIndexer.exe 0 0 0 1330 StartMenu.exe 1 0 5 normal C:\Program Files\Open-Shell 1384 svchost.exe 1 0 15 normal C:\Windows\System32 13c8 svchost.exe 0 0 0 13e8 ctfmon.exe 1 0 0 1240 WmiPrvSE.exe 0 0 0 0dcc SearchHost.exe 1 14 114 normal C:\Windows\SystemApps\MicrosoftWindows.Client.CBS_cw5n1h2txyewy 1280 StartMenuExperienceHost.exe 1 0 17 normal C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy 025c svchost.exe 1 0 1 normal C:\Windows\System32 0914 RuntimeBroker.exe 1 0 4 normal C:\Windows\System32 03ac RuntimeBroker.exe 1 40 4 normal C:\Windows\System32 0544 svchost.exe 1 0 1 normal C:\Windows\System32 1174 dllhost.exe 1 0 3 normal C:\Windows\System32 1310 SecurityHealthSystray.exe 1 7 5 normal C:\Windows\System32 0b54 VBoxTray.exe 1 7 23 normal C:\Windows\System32 12ec OneDrive.exe 1 234 95 normal C:\Users\Lilywhite Lilith\AppData\Local\Microsoft\OneDrive 07cc SecurityHealthService.exe 0 0 0 10a8 msedge.exe 1 2 40 normal C:\Program Files (x86)\Microsoft\Edge\Application 1528 msedge.exe 1 0 3 normal C:\Program Files (x86)\Microsoft\Edge\Application 1644 msedge.exe 1 3 7 above normal C:\Program Files (x86)\Microsoft\Edge\Application 1660 msedge.exe 1 0 0 normal C:\Program Files (x86)\Microsoft\Edge\Application 1730 msedge.exe 1 0 1 normal C:\Program Files (x86)\Microsoft\Edge\Application 0e24 WmiPrvSE.exe 0 0 0 0b88 svchost.exe 0 0 0 1830 Widgets.exe 1 0 4 normal C:\Program Files\WindowsApps\MicrosoftWindows.Client.WebExperience_423.11600.0.0_x64cw5n1h2txyewy\Dashboard 194c WidgetService.exe 1 0 4 normal C:\Program Files\WindowsApps\MicrosoftWindows.Client.WebExperience_423.11600.0.0_x64cw5n1h2txyewy\Dashboard 1200 svchost.exe 0 0 0 04d0 svchost.exe 0 0 0 103c smartscreen.exe 1 0 1 normal C:\Windows\System32 19d8 svchost.exe 0 0 0 0614 svchost.exe 0 0 0 07e0 SystemSettings.exe 1 11 33 normal C:\Windows\ImmersiveControlPanel 0ba8 ApplicationFrameHost.exe 1 17 12 normal C:\Windows\System32 0b70 UserOOBEBroker.exe 1 0 1 normal C:\Windows\System32\oobe 17d8 PhoneExperienceHost.exe 1 0 17 normal C:\Program Files\WindowsApps\Microsoft.YourPhone_1.23042.108.0_x64__8wekyb3d8bbwe 0eb8 MsMpEng.exe 0 0 0 1224 NisSrv.exe 0 0 0 0cb0 SearchProtocolHost.exe 0 0 0 1b5c unsecapp.exe 1 0 4 normal C:\Windows\System32\wbem 170c MacTray.exe 1 78 88 normal C:\Chessdiagrammer14\mactype 08b0 svchost.exe 0 0 0

hardware:

cpu registers: eax = 00000000 ebx = fffffffa ecx = ffffffff edx = fffffffa esi = 02563ee4 edi = 02563ef4 eip = 77524ef5 esp = 05f7fd60 ebp = 05f7fdf0

stack dump: 05f7fd60 e8 3e 56 02 e8 3e 56 02 - 00 00 00 00 a2 12 33 31 .>V..>V.......31 05f7fd70 ff ff ff ff 17 92 d1 00 - bc fa 7a 7e 00 00 00 00 ..........z~.... 05f7fd80 fa ff ff ff 00 00 00 00 - 46 56 9d f0 78 23 ab 4e ........FV..x#.N 05f7fd90 00 00 00 00 55 08 40 90 - ab f7 bf 6f ab f7 bf 6f ....U.@....o...o 05f7fda0 e6 ff 83 02 00 00 00 00 - 00 00 00 00 00 00 00 00 ................ 05f7fdb0 e4 3e 56 02 00 b0 28 00 - 00 00 00 00 e0 6a b1 e9 .>V...(......j.. 05f7fdc0 94 00 00 00 f0 fd f7 05 - dc 8c f2 75 00 00 00 00 ...........u.... 05f7fdd0 00 00 00 00 02 00 00 00 - 03 00 00 00 00 00 00 00 ................ 05f7fde0 3c 61 53 77 98 0c 4b 76 - a4 06 00 00 bc 91 04 4f <aSw..Kv.......O 05f7fdf0 38 fe f7 05 98 3f 50 77 - 24 19 00 00 b4 fe f7 05 8....?Pw$....... 05f7fe00 24 19 00 00 24 00 00 00 - 00 00 00 00 e8 3e 56 02 $...$........>V. 05f7fe10 00 00 00 00 e8 3e 56 02 - 01 00 00 00 00 00 00 00 .....>V......... 05f7fe20 e4 3e 56 02 fa ff ff ff - 00 00 00 00 e8 3e 56 02 .>V..........>V. 05f7fe30 00 00 00 00 00 00 00 01 - 40 fe f7 05 59 3d 50 77 ........@...Y=Pw 05f7fe40 60 fe f7 05 0d 35 4c 00 - e4 3e 56 02 4f ab 5a 00 ....5L..>V.O.Z. 05f7fe50 e9 ae 5a 00 60 13 53 02 - 00 00 00 00 98 c5 55 02 ..Z..S.......U. 05f7fe60 b8 fe f7 05 07 1f 61 00 - 74 fe f7 05 24 67 40 00 ......a.t...$g@. 05f7fe70 b8 fe f7 05 c0 fe f7 05 - 24 67 40 00 b8 fe f7 05 ........$g@..... 05f7fe80 08 89 47 00 60 13 53 02 - 34 1e 61 00 00 00 00 00 ..G.`.S.4.a..... 05f7fe90 00 00 00 00 01 00 00 00 - 80 b9 52 02 00 00 00 00 ..........R.....

disassembling: 004c3504 public SyncObjs.TCriticalSection.Acquire: ; function entry point 004c3504 994 add eax, 4 004c3507 push eax 004c3508 > call -$b655d ($40cfb0) ; Windows.EnterCriticalSection 004c350d 995 ret

error details: I closed MacTray.exe via MacTray popup command. This crashed my application, from where i had started MacTray.exe via "Shell" command. No problems with the exact same situation under Windows 10

`

snowie2000 commented 1 year ago

That is a really detailed and helpful report. I'll look into it.

snowie2000 commented 1 year ago

Please try this one.

MacTray-cli-hotfix1.zip

LilywhiteLilith commented 1 year ago

I will test it right today! :-)

LilywhiteLilith commented 1 year ago

Unfortunately, the behavior under Windows 11 has not changed. Did you link the correct version? I compared the version numbers and was surprised that they both have the same number 1.0.2023.5. Please let me know if you need the error report and I will send it to you. Kind regards!

snowie2000 commented 1 year ago

I didn't change the version number so what you have observed is expected.

Do you have new crash report?

LilywhiteLilith commented 1 year ago

bugreport_04072023.txt

snowie2000 commented 1 year ago

It crashed for somewhat slightly different reason. Hmm..

LilywhiteLilith commented 1 year ago

Hmm, for me Windows resembles a horrible, huge labyrinth, and I almost didn't find my way out on several occasions... ;-) P.S. If you need separate bug reports for each command, please let me know!

snowie2000 commented 1 year ago

Okay, the destruction sequence of a thread is incorrect, it should be fixed for now.

I also bumped the version number.

MacTray-cli-hotfix3.zip

LilywhiteLilith commented 1 year ago

Unfortunately no change! An error report is only generated when the command /s stop is sent. The command /s disable does not generate an error report, it works insofar as MacTray is correctly disabled afterwards. MacTray.exe is still in the system tray. Only my application disappeared afterwards. Here are the new bug reports:

bugreport_command_stop_07042023.txt

bugreport_stop_via_popup_mouseclick_07042023.txt

snowie2000 commented 1 year ago

I've checked some more code and looks like the exit procedure is quite problematic. It needs a small refinement.

I'll finish it later.

snowie2000 commented 1 year ago

I made a simple change. Now the exit procedure calls the disabe procedure before closing the app.

MacTray-cli-hotfix4.zip

LilywhiteLilith commented 1 year ago

Hi!

What I noticed: Hotfix 2 -> MacTray version number: 1.0.2023.7 Hotfix 4 -> MacTray version number: 1.0.2023.5 (?)

Windows 11

Test 1 Disable MacType with /s disable

This still causes MacTray and my application to crash every time. Rendering is still active afterwards.

Test 2 Quit MacType with /s quit

Here the behavior is different now. Still my application crashes in most cases when I quit with /s quit the first time, sometimes only when I quit MacTray.exe for the second time from within my application. What is new is that the bug report window is now only visible for a very short time and disappears immediately. So no bug report can be created anymore. In all cases, rendering remains active after quitting with /s quit, even if my application has not crashed.

After restarting my application (there were no traces of MacType in the task manager) the bug report window was displayed briefly and also disappeared immediately. Rendering was no longer active after this restart of my application. Very strange?

Windows 10

On the very first quit of MacTray.exe with /s quit, the bug report window appears briefly, but disappears again immediately (as also observed under Windows 11). However, my application does not crash. Rendering remains active afterwards.

Disabling MacType with /s disable works under Windows 10!

So there are no crashes of my application here, only the described "abnormalities".

snowie2000 commented 1 year ago

Thanks, I'll take care of it.

snowie2000 commented 1 year ago

Try this one.

In this version, whenever a crash happened, the crash report will be copied to your clipboard automatically.

MacTray-cli-hotfix5.zip

snowie2000 commented 1 year ago

@LilywhiteLilith Does the last patch work for you?

LilywhiteLilith commented 1 year ago

Hello @snowie2000 I'm very sorry, I completely misunderstood that last patch! I had assumed that the change to this patch was solely that a log is now copied to the clipboard on crashes anyway, and didn't test it further at all. Sorry, must have something to do with the heat! ;-) Will test it right after a cup of coffee! :-)

LilywhiteLilith commented 1 year ago

Here is the test result under Windows 11 Pro 22H2 The command /s restart works fine! The two commands, /s disable and /s quit unfortunately still cause my application to crash. The same thing happens when I execute the commands by mouse click in the MacTray popup. No bug report window is displayed in all cases, and the clipboard is also empty in all cases (?)

snowie2000 commented 1 year ago

No crash then no report. What you have seen is that Mactype is behaving normally on its exit. It's your application that crashed, and the app's crash report is what we need to investigate what went wrong when mactype unloads itself from the process.

Does every app crashes on exit? Or is it only one or two specific apps that crash every time?

Besides, restart and exit are totally different, no matter how similar they sound like. Restart does not stop and start mactype, it only signals the running mactype process to reload the profile under the hood, so it may be stabler than the typical stop-start cycling way.

LilywhiteLilith commented 1 year ago

My application is programmed with VB 6.0. I had lastly also thought that maybe it is my application that is generating the error? Everything works fine under Windows 10, also under Windows 8.1. The problems only occur under Windows 7 and WIndows 11. I send all commands from my application with the "Shell" command:

MTCmdID = Shell(MacTypePath & "\" & MacTrayExe & " " & cmd, vbNormalFocus). 'This is where the crash occurs

Unfortunately, after sending the commands from my application, no evaluable error is returned in MTCmdID, the application just crashes. Maybe others have already worked with the MacType control and are reading along here?

I have only tested MacType with this one application so far. It is my only application that uses MacType.

Under no circumstances do I want to tie up your energy on a problem that may not be a MacType problem at all. In my application, I have included a command ("Advanced Command Control") that enables or disables the two critical commands. After all, the restart that allows you to switch profiles works just fine!

LilywhiteLilith commented 1 year ago

I replaced the "Shell" command with "ShellExecute", and under Win 7 it seems to work now. I will test it with other Windows versions and give a feedback, if this solves the problem

snowie2000 commented 1 year ago

I don't much about VB6 and I have no idea how the Shell command works. Maybe it is a blocking call that waits for mactray.exe to return something while simultaneously unloading the mactype? If that's how it works, please don't use anything synchronize to run another program that may in turn affects the caller.

LilywhiteLilith commented 1 year ago

Both "Shell" and "ShellExecute" are asynchronous functions. As I understand it, the only "blocking" that occurs in both calls is the time it takes for the function to determine the status of whether the operating system can or cannot fulfill the request. This delay is identical to what would occur with each function call. After all, this is what defines a "function"?

What is most irritating, after all, is the fact that no problems occur under Windows 10! Also, under Windows 7, at least with MacType 1.0.2023.7, my application no longer crashes. Here is another observation: During the last test under Windows 7, I noticed that after the very first "disable" command in the popup menu of MacTray, "Disabled" was indeed marked, but this had no effect on my application. Only after I clicked with the mouse on the MacTray icon (!), rendering was disabled in my application! And after that: ALL commands could be executed without any problems!

Under Windows 11, i got a bug report with MacType 1.0.2023.7: bug report_20230712.txt

As I said, I can live with the current status, even if I am of course very interested in what is going wrong where, and how it can be solved, if at all (the Windows versions react differently, as we have seen).

LilywhiteLilith commented 1 year ago

Hello @snowie2000 , I just tested MacType again under Windows 10. The following commands were executed one after the other: /s disable -> OK /s enable -> OK /s stop -> OK /s start -> bug report window, but no crash of my application. The bug report window was displayed again and again after pressing the "save" button in a loop. After saving the same report a second time, the rendering stopped. After closing the bug report window, it was not displayed again.

bugreport_20230713.txt

Maybe i can help with this.

Kind regards, Lilywhite Lilith