Jump to content

Kas Ob.

Members
  • Content Count

    613
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Kas Ob.

  1. This is easier i think, But Let the child process check the command line in case of named pipes being passed then child will CreateFile with OPEN_EXISTING then use SetStdHandle to switch, and you are good to go, parent will create them with CreateNamedPipe. In that case parent can switch between standard and named, named can be fixed while you are debugging, parent can be debugged and another debugger will spawn the child on its own with fixed names, This will work, i used this many times, but and unless there is so many other parameters/commandline then it will revert to cumbersome to adjust the child command by hand, yet again these parameter could be temporarily (in debugging mode) to be used form/within a file created by Parent and signaled by specific command to child to process... I think you got the idea, the performance drop between named and standard is negligible.
  2. Kas Ob.

    Madexcept leaks show false positives?

    Well looking at the log again, i see it differently, and it is madexcept fault, the first log is nice main thread ($24b0): 7a26999b madExcept32.dll madExceptDbg 1773 GetMemCallback 006973f0 Posserver.exe System 4966 @GetMem 0069c5fa Posserver.exe System 26079 @NewUnicodeString 0069c83b Posserver.exe System 26693 @UStrFromPWCharLen 0069d93e Posserver.exe System 32005 @UStrCopy 00ec5dc6 Posserver.exe DEFSa 2399 LOADTRANSLATIONS 00ec5e59 Posserver.exe DEFSa 2408 LOADTRANSLATIONS 00ec5e98 Posserver.exe DEFSa 2413 LOADTRANSLATIONS 00eaa910 Posserver.exe Unitmain 678 TMain.FormCreate 00eaacff Posserver.exe Unitmain 740 TMain.FormCreate 009134d5 Posserver.exe Vcl.Forms 5534 TCustomForm.DoCreate 00912ff4 Posserver.exe Vcl.Forms 5401 TCustomForm.AfterConstruction 0069ae25 Posserver.exe System 19736 @AfterConstruction 00912fb0 Posserver.exe Vcl.Forms 5391 TCustomForm.Create 00920a12 Posserver.exe Vcl.Forms 13527 TApplication.CreateForm 00ee3510 Posserver.exe Posserver 132 initialization 7649fcc7 KERNEL32.DLL BaseThreadInitThunk It end with GetMem as it should, but include GetMemCallBack which is the hook for madexcept, and i am not familiar with madexcept, but i think the reasonable action is to strip the hook. In any case the log is nice, Later it lose control, as all these stack traces should be ended with either GetMem or ReallocMem, and be deleted form record later when FreeMem being called on the same address, Yet in the middle of that log, we see it start to count two or three GetMem before stopping, in the end of the log file ( the most later entries) it looks like it hit hard point to continue and stop This one from the middle 7a26999b madExcept32.dll madExceptDbg 1773 GetMemCallback 006973f0 Posserver.exe System 4966 @GetMem <----------- 0069c5fa Posserver.exe System 26079 @NewUnicodeString 0069c83b Posserver.exe System 26693 @UStrFromPWCharLen 0069c912 Posserver.exe System 26870 InternalUStrFromPCharLen 006973f0 Posserver.exe System 4966 @GetMem <----------- 0069c5fa Posserver.exe System 26079 @NewUnicodeString 0069d6af Posserver.exe System 31391 @UStrSetLength 006f2771 Posserver.exe System.SysUtils 8486 _IntToStr32 006f2aa8 Posserver.exe System.SysUtils 8601 IntToStr 006f52f8 Posserver.exe System.SysUtils 13425 WideFormatBuf 006f584b Posserver.exe System.SysUtils 13565 WideFormatBuf 006a3437 Posserver.exe System 41854 LocaleCharsFromUnicode 006983f7 Posserver.exe System 11904 TextOut 0069c5fa Posserver.exe System 26079 @NewUnicodeString 00ea26a4 Posserver.exe http 3486 TTCPHttpThrd.ProcessHttpRequest 006f49a0 Posserver.exe System.SysUtils 12905 FormatBuf 006f4981 Posserver.exe System.SysUtils 12898 FormatBuf 006f6f9f Posserver.exe System.SysUtils 20007 AppendNumber 006f6f41 Posserver.exe System.SysUtils 19991 AppendChars 006f7b98 Posserver.exe System.SysUtils 20444 AppendFormat 006f7c31 Posserver.exe System.SysUtils 20449 DateTimeToString 006f7d67 Posserver.exe System.SysUtils 20460 DateTimeToString 006973f0 Posserver.exe System 4966 @GetMem <----------- 00e94450 Posserver.exe http 1155 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 006f6943 Posserver.exe System.SysUtils 19661 TryEncodeTime 006f697e Posserver.exe System.SysUtils 19668 EncodeTime 006f6e1b Posserver.exe System.SysUtils 19871 Now 006f7dd3 Posserver.exe System.SysUtils 20518 FormatDateTime 00e945b0 Posserver.exe http 1174 TTCPHttpThrd.ProcessHttpRequest 00e945ef Posserver.exe http 1174 TTCPHttpThrd.ProcessHttpRequest 00ea26a4 Posserver.exe http 3486 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 00e80a16 Posserver.exe http 673 TTCPHttpThrd.Execute 007506bb Posserver.exe madExcept HookedTThreadExecute 00750726 Posserver.exe madExcept HookedTThreadExecute 007dd4d9 Posserver.exe System.Classes 16396 ThreadProc 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 0075067c Posserver.exe madExcept ThreadExceptFrame 007506bb Posserver.exe madExcept HookedTThreadExecute 00750726 Posserver.exe madExcept HookedTThreadExecute 006973f0 Posserver.exe System 4966 @GetMem <----------- 0069c5fa Posserver.exe System 26079 @NewUnicodeString 0069d6af Posserver.exe System 31391 @UStrSetLength 00701456 Posserver.exe System.SysUtils 30732 TStringHelper.Create 006f7d18 Posserver.exe System.SysUtils 20459 DateTimeToString 006f7d67 Posserver.exe System.SysUtils 20460 DateTimeToString 006973f0 Posserver.exe System 4966 @GetMem <----------- shoudl stopped here 00e94450 Posserver.exe http 1155 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 00eac77b Posserver.exe misc 262 html2sg 00e98c33 Posserver.exe http 1981 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 007506bb Posserver.exe madExcept HookedTThreadExecute 007dd4d9 Posserver.exe System.Classes 16396 ThreadProc 0069c548 Posserver.exe System 25850 ThreadWrapper 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 7649fcc7 KERNEL32.DLL BaseThreadInitThunk Now that make sense at least from me.
  3. Kas Ob.

    Madexcept leaks show false positives?

    Not exactly confused as much it is catching the temporary string, see the common thing between these worrying lines is the temp string, Copy will generate temp string, like the concatenation with "+", to confirm this extract these into their own declared string var then put that var in-place to see if the report change. That is little problem, the problem i am afraid of is the unreadable and none sense stack trace, take as example TryEncodeTime i mentioned earlier, it is low level and has should not raise exception, also it is end point, meaning it should never ever seen at a stack unless it raised an exception or in this very case and because we (madexcept) are tracking memory allocation, it should be ended with the real memory allocation, that is not what reported, as madexcept call trace shows it passed ProcessHttpRequest, this makes no sense, pointing that the call trace (stack) is wrong and not trust worthy, madexcept failed to build clean stack trace. There is also a temp string introduced by compiler every time you use or pass different string type, like concatenation a Ansistring with different string type, so it could be "thisip" is declared an Ansi on newer Delphi while pos will force the compiler to do the temp conversion.. Also TryEncodeTime is allocating temp string to pass it as result (out to be exact and not result), so it really could like the first lines i wrote the cause is failure to handle tempstring that compiler is generating behind the scene. Anyway, these all may be false positive as you asked, but the shuffled stack makes me afraid from sinister behavior coming form madexcept, is this is missed up and broken then what else ?! Didn't mention what Delphi you are using and if madexcept is up to date, and i really think it is miss configuration in madexcept or a bug, but has little to do with Delphi, unless you are using Delphi version that is not supported by your madexcept.
  4. Kas Ob.

    Madexcept leaks show false positives?

    Hi, They doesn't look like that, looks innocent. What is really strange and make no sense at all is the log you attached, take an example this one thread $34f0 (TTCPHttpThrd): 7a26999b madExcept32.dll madExceptDbg 1773 GetMemCallback 006973f0 Posserver.exe System 4966 @GetMem 0069c5fa Posserver.exe System 26079 @NewUnicodeString 0069c83b Posserver.exe System 26693 @UStrFromPWCharLen 0069c912 Posserver.exe System 26870 InternalUStrFromPCharLen 006973f0 Posserver.exe System 4966 @GetMem 0069c5fa Posserver.exe System 26079 @NewUnicodeString 0069d6af Posserver.exe System 31391 @UStrSetLength 006f2771 Posserver.exe System.SysUtils 8486 _IntToStr32 006f2aa8 Posserver.exe System.SysUtils 8601 IntToStr 006f52f8 Posserver.exe System.SysUtils 13425 WideFormatBuf 006f584b Posserver.exe System.SysUtils 13565 WideFormatBuf 006a3437 Posserver.exe System 41854 LocaleCharsFromUnicode 006983f7 Posserver.exe System 11904 TextOut 0069c5fa Posserver.exe System 26079 @NewUnicodeString 00ea26a4 Posserver.exe http 3486 TTCPHttpThrd.ProcessHttpRequest 006f49a0 Posserver.exe System.SysUtils 12905 FormatBuf 006f4981 Posserver.exe System.SysUtils 12898 FormatBuf 006f6f9f Posserver.exe System.SysUtils 20007 AppendNumber 006f6f41 Posserver.exe System.SysUtils 19991 AppendChars 006f7b98 Posserver.exe System.SysUtils 20444 AppendFormat 006f7c31 Posserver.exe System.SysUtils 20449 DateTimeToString 006f7d67 Posserver.exe System.SysUtils 20460 DateTimeToString 006973f0 Posserver.exe System 4966 @GetMem 00e94450 Posserver.exe http 1155 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 006f6943 Posserver.exe System.SysUtils 19661 TryEncodeTime <------ 006f697e Posserver.exe System.SysUtils 19668 EncodeTime 006f6e1b Posserver.exe System.SysUtils 19871 Now 006f7dd3 Posserver.exe System.SysUtils 20518 FormatDateTime 00e945b0 Posserver.exe http 1174 TTCPHttpThrd.ProcessHttpRequest 00e945ef Posserver.exe http 1174 TTCPHttpThrd.ProcessHttpRequest 00ea26a4 Posserver.exe http 3486 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 00e80a16 Posserver.exe http 673 TTCPHttpThrd.Execute 007506bb Posserver.exe madExcept HookedTThreadExecute 00750726 Posserver.exe madExcept HookedTThreadExecute 007dd4d9 Posserver.exe System.Classes 16396 ThreadProc 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 0075067c Posserver.exe madExcept ThreadExceptFrame 007506bb Posserver.exe madExcept HookedTThreadExecute 00750726 Posserver.exe madExcept HookedTThreadExecute 006973f0 Posserver.exe System 4966 @GetMem 0069c5fa Posserver.exe System 26079 @NewUnicodeString 0069d6af Posserver.exe System 31391 @UStrSetLength 00701456 Posserver.exe System.SysUtils 30732 TStringHelper.Create 006f7d18 Posserver.exe System.SysUtils 20459 DateTimeToString 006f7d67 Posserver.exe System.SysUtils 20460 DateTimeToString 006973f0 Posserver.exe System 4966 @GetMem 00e94450 Posserver.exe http 1155 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 00eac77b Posserver.exe misc 262 html2sg <------ 00e98c33 Posserver.exe http 1981 TTCPHttpThrd.ProcessHttpRequest 00e805f0 Posserver.exe http 622 TTCPHttpThrd.Execute 007506bb Posserver.exe madExcept HookedTThreadExecute 007dd4d9 Posserver.exe System.Classes 16396 ThreadProc 0069c548 Posserver.exe System 25850 ThreadWrapper 007505a1 Posserver.exe madExcept CallThreadProcSafe 00750606 Posserver.exe madExcept ThreadExceptFrame 7649fcc7 KERNEL32.DLL BaseThreadInitThunk What do we see ? TTCPHttpThrd.ProcessHttpRequest behave like recursive !! but no it is not recursive, yet walking the call stack is illogical, html2sg does raise an exception ? or it doesn't ?, the exception most likely is handled inside try..except..end clause, yet two calls after that come from madexcept then the stack point to TTCPHttpThrd.Execute, that is unexplainable Also TryEncodeTime is raising an exception !? or not ? No need to answer the above, as the log might be wrong. I am not expert with madexcept, but i want to point that you might be miss configured it and caused this reports, so if you asked it to capture handled exception then it might be the cause, but i am not sure. As suggestion, start with the simplest thing which is make sure to pass strings as const in these two function ProcessHttpRequest(const Request, uri, protocol, params: string; var keepalive: boolean; var nosettype, linkclose: boolean): integer; procedure debug(const s: string); VAR I: integer; begin if (debughook <> 0) OR inparams('Z', I) then begin writeln(F1, s); flush(F1); end; In case your code failed to compile then just add local strings and load the content form the parameters, this easily could be the solution for the above unexplained madexcept log. Suggestion : Fix the declaration to const and try to change/tweak madexcept behavior then capture a new log then share, in case the problem persist. and Good luck!
  5. I see it now, NavigateToString doesn't have an origin, hence doesn't have SecurityContext, and no SecurityContext means no media access as these are protected. Thank you and good luck !
  6. Kas Ob.

    TSslCertTools for generate CSR

    May i ask what is the problem with using RSA_public_encrypt directly instead of this unknown EncryptPublicRSA, which might be wrong in its parameters. Try to use RSA_private_encrypt directly, just check the return value, as it is not a Boolean, and the size/length is per documentation is RSA_size(rsa), and don't forget to trim, as these functions be called with extra length and the result is the exact length. From OverbyteIcsLIBEAY.pas RSA_private_decrypt : function(flen: Integer; from: PAnsiChar; to_: PAnsiChar; rsa: PRSA; padding: Integer): Integer; cdecl = nil; RSA_public_encrypt : function(flen: Integer; from: PAnsiChar; to_: PAnsiChar; rsa: PRSA; padding: Integer): Integer; cdecl = nil; @Angus Robertson While the above two functions should be what OP is asking for, this unit misses the other pair RSA_private_encrypt : function(flen: Integer; from: PAnsiChar; to_: PAnsiChar; rsa: PRSA; padding: Integer): Integer; cdecl = nil; RSA_public_decrypt : function(flen: Integer; from: PAnsiChar; to_: PAnsiChar; rsa: PRSA; padding: Integer): Integer; cdecl = nil; Sources https://docs.openssl.org/1.0.2/man3/RSA_public_encrypt/ https://docs.openssl.org/1.0.2/man3/RSA_private_encrypt/
  7. Kas Ob.

    Amazon Echoes

    This is strange ! The lack of Server Name explain some of it but not all, so 1) Your server is configure to not accept default web server or redirect from HTTP to HTTPS (it might be though but in this case it was HTTPS), the connection came with connecting to an IP and a redirect is due to host name (default one) that can server, but in this case Amazon was performing some sort of IP scanning to reverse IP to host lookup (collecting data), like hit in the dark to get the real WebServer. 2) Did the client provided client certificate and the log missed handling or missed logging it ? there is no mention for such certificate in these log lines, and the question is "why?" and "what?" did the server tried to validate and didn't find a CA for it, was it an IP ? Just my thoughts on this two logged lines.
  8. Hi, Thank you for sharing, though can't compile this project or test as don't have Delphi 12 and never used Edge, but seeing this in the readme Trigger me to ask and may be point you to a path you didn't know of, or you tried, in case you already tried or researched, then please share with us your result, i myself very interested in your findings. 1) Edge does support WebRTC, WebRTC has Acoustic Echo Cancellation (AEC), and it does work fine, removing the the need to block capture when playing, though switching media from EdgeAudio to WebRTC might not be a small adjustment and not by any mean a trivial task, yet small part is feasible, like Audio Capture and Playback, what is your experience on that? have you tried it ? in case of yes then why ditched it ? What issues did you face with WebRTC audio capture and play? 2) CORS is pain in the back, that we know, but what about injecting/loading the app directly without the need to navigate after the navigation to empty page, or... there is other means like there is "NavigateToString" https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#navigatetostring At these lines https://github.com/MaxiDonkey/EdgeAudio/blob/main/source/Edge.Audio.pas#L596-L602 i see virtualhostfolder is set yet it followed by Navigate, i expected to be followed by NavigateToString This one allow to load the content from memory removing the virtual host need, have you tried it ? ( i mean feed all the content from memory, even if they are files on disk) can JSBridge (the really nice and impressive bridge you made) be used with it ? will it simplify the structure in whole? in case of it didn't work then please share with us the "Why?" (your finding about feeding the data/content from memory) What issues did you face ?
  9. Kas Ob.

    procedure of class

    For me that looks tightly coupled and hard to maintain in the long run, and i am always against such approach "REPLACE CONTROLLER...", if you need to replace then it is too late either get the correct one form the beginning or create new one and dispose them both later, swapping/replacing only will lead to complex design with high error/malfunctioning probability (if not now then modifying the code later). Lars gave a great example, but i would do it a little different, by slicing things into pieces. Look at Lars example, 1) a Factory will be perfect to return an IDeviceController from TSignature (the HardwareID) 2) Devices could have their own units and will register them self if the Unit is included in the project, (Initialization clause) 3) Factory will parse and return from what available (runtime registered) IDevices/IDeviceController ... 4) the Verbs (command/capabilities) could be an interface, each one is an interface, so a device could have 10 interfaces (more or less), each represent small functionality, like IDeviceCapName which will handle the device.. well ..name, IDeviceCapWrite, IDeviceCapRead.... so the the returned Interface cab tested/checked against a specific command/verb by simply call Supports() or with "is" or "as" ... , so when it comes to execute command a simple call like Supports to check if the device can return IDeviceCapOnlineTime then perform the required call on that .. 5) With separated and isolated commands/verbs like that, it is easier to accompany them with extra attached interface that will bring what type of hardware steps or code should be performed, in other words you can have script like (even it is code) in default interfaces specific for each device, so i device like IDeviceDoorController can have IDeviceDoorControllerCloseAndLock and IDeviceDoorControllerUnLock ...IDeviceDoorControllerOpenFroAll.. which are returned by it own smaller factory from the DoorController unit which is also registered and returned by IDeviceDoorController. I am sure i missed many steps here, but i hope the idea is clear to at least entertain, this will be expandable easy to read and maintain, and most importantly (importanter) it is testable, in fact it is the easiest way to develop for such hardware design, were each can have their own commands.
  10. Kas Ob.

    Using "Claude Code" with Delphi

    Agree, also lately i am trying to get handle on some use of AI. But, here one incident with Claude just less than 2 weeks ago, (free Claude as i am not ready to join the mass hallucinations with money yet), i had this piece of code that i just optimized, four functions that calculate some variations of an algorithm, but it was mess in commented lines and the original implementation, so out of laziness i pasted it for Claude and asked it to format it and extract/keep the original algorithms as comments, and it did beautifully in seconds, i checked the commented lines and it is right and correct, replaced the original code and all looked fine, Next day and out of pure luck, i was looking on different place in that unit file, and dropped the new/modified unit against the old in BeyondCompare, also by pure luck i noticed small difference in those lines, Clause changed one constant from (-8.427913) to (-7.779733), returned to my question in its history and it is there, i have no idea why and from where that constant came, but that indicate to me it is way far from being trusted, the four functions each have 7 constants that i calculated/simplified, yet it decide to change only one. That is big red flag. Another story on the opposite side; two days ago there was a certificate expiration problem in this very forum, and i have used Tampermonkey and Greasemonkey for years now, yet it is pain in the back still for me writing a simple script, searching the net for long time and failure goes hand by hand writing script for TM and GM, anyway, i had a script that i did years back which pop a small notification when loading visiting a site and its certificate will expire within 10 days. So i went with Grok and asked for Chrome Extension to do the same, without providing my GM script, and it gave a full instruction and code for such extension, the extension didn't work as there was problem in manifest file, with 2 consequential questions and report of the problem the extension was running perfectly on my Chrome ( i don't really use Chrome it self but a fork called Supermium, the portable version), it was smooth experience and just saved me lot of time, just brilliant, and huge time saving. Both Claude and Grok fail with Pascal/Delphi in so many ways sometimes fundamentally, yet Grok is do evolve from question to another unlike Claude which revert and keep returning to the original mistakes, as example when i asked them both to extract test vectors from C files, the test vectors where huge and more than 1000 bytes in hex values, both replaced some values out of the blue, just single byte (hex value) is different, Grok remembered the one broken value i pointed to in later questions, Claude fixed it once and after a question it reverted to the wrong value, trying to correct it second time it did drop the whole approach of constant and tried to convince me reading the data from external file is better and correct way ! I tried only the free Grok and Free Claude, as for resources extraction as the best to my short experience with AI is perplexity, it give extensive resources and sources to read when asked. For now i am on the watcher bench, waiting for some real advancement when this hype frenzy start to calm down like its dust.
  11. Kas Ob.

    TSslCertTools for generate CSR

    This is wrong. I believe ICS have all what you need, switching between singing RSA or ECDSA should be viable and easy, so check ICS demos.
  12. Kas Ob.

    TSslCertTools for generate CSR

    You gave me a heart attack ! I am sorry i don't read French 🙂
  13. Kas Ob.

    TSslCertTools for generate CSR

    Delete that ! Never post you private key
  14. Kas Ob.

    TSslCertTools for generate CSR

    Bad wording 😭 Fact: RSA only can sign with private key, in this case you must use the same key that included its public key in the CSR itself.
  15. Kas Ob.

    TSslCertTools for generate CSR

    Until Angus answer you, and if we still talking about CSR, then you sign with your private key not public key. Fact: RSA only can sign with private key, in this case you must use the same key that included in the CSR itself.
  16. Kas Ob.

    Libreoffice integration struggles

    Here is the output of what seems working capture of all the events/actions from LB, though tested in one instance with text file Document loaded successfully Global event listener registered Document loaded. Press Enter to exit. Event: OnLayoutFinished Other event: OnLayoutFinished Event: OnTitleChanged Other event: OnTitleChanged Event: OnModifyChanged Other event: OnModifyChanged Event: OnLayoutFinished Other event: OnLayoutFinished Event: OnSave Save event detected! Event: OnCopyTo Other event: OnCopyTo Event: OnCopyToDone Other event: OnCopyToDone Captured data: Hi From Delphi !.1 Event: OnSaveFailed SaveFailed event detected! Event: OnModeChanged Other event: OnModeChanged Event: DialogExecute Other event: DialogExecute Event: OnModeChanged Other event: OnModeChanged Event: DialogClosed Other event: DialogClosed Event: OnLayoutFinished Other event: OnLayoutFinished Event: OnSave Save event detected! Event: OnCopyTo Other event: OnCopyTo Event: OnCopyToDone Other event: OnCopyToDone Captured data: Hi From Delphi !.13 Event: OnSaveFailed SaveFailed event detected! Event: OnModeChanged Other event: OnModeChanged Event: DialogExecute Other event: DialogExecute Event: OnModeChanged Other event: OnModeChanged Event: DialogClosed Other event: DialogClosed Event: OnPrepareViewClosing Other event: OnPrepareViewClosing Event: OnPrepareUnload Other event: OnPrepareUnload Event: OnModeChanged Other event: OnModeChanged Event: DialogExecute Other event: DialogExecute Event: OnModeChanged Other event: OnModeChanged Event: DialogClosed Other event: DialogClosed Event: OnViewClosed Other event: OnViewClosed Event: OnUnload Other event: OnUnload Event: OnUnfocus Other event: OnUnfocus Event: OnCloseApp Other event: OnCloseApp @Pierre le Riche i am DM my work, and can't guarantee it to be error/mistake free, yet it looks working and didn't dig more in the dialog handling, (like how to stop them ) and i expected the pipe for saving (output) is for one use.
  17. Kas Ob.

    Libreoffice integration struggles

    Nice to hear and you are welcome. The good news is that i solved the GetFuncDesc, use it, it is working now fine function TDocumentEventListener.GetFuncDesc(index: Integer; out pfuncdesc: PFuncDesc): HResult; var FuncDesc: TFuncDesc; ElemDescList: PElemDescList; begin Writeln('EventListener GetFuncDesc: index=', index); if index in [0, 1] then begin FillChar(FuncDesc, SizeOf(TFuncDesc), 0); // Allocate array of one ElemDescList := CoTaskMemAlloc(SizeOf(TElemDesc)); FillChar(ElemDescList^, SizeOf(TElemDesc), 0); ElemDescList^[0].tdesc.vt := VT_VARIANT; ElemDescList^[0].paramdesc.wParamFlags := PARAMFLAG_FIN; if index = 0 then begin FuncDesc.memid := 1; FuncDesc.lprgelemdescParam := ElemDescList; FuncDesc.cParams := 1; end else begin FuncDesc.memid := 4; FuncDesc.lprgelemdescParam := ElemDescList; FuncDesc.cParams := 1; end; FuncDesc.funckind := FUNC_DISPATCH; FuncDesc.invkind := INVOKE_FUNC; FuncDesc.elemdescFunc.tdesc.vt := VT_HRESULT; pfuncdesc := CoTaskMemAlloc(SizeOf(TFuncDesc)); Move(FuncDesc, pfuncdesc^, SizeOf(TFuncDesc)); Result := S_OK; end else begin pfuncdesc := nil; Result := DISP_E_BADINDEX; end; end; I feel like i am implementing the whole UNO interface with this one 🤬 Anyway stopped at handling Invoke (as it is called now smoothly) and HandleDocumentEvent (my own field in the eventlister), HandleDocumentEvent is hell to handle, and can't find a real nice documentation for events and their parameters, its like shooting darts in the dark. ps still using two separated CoTaskMemAlloc and they can be merged in one by aligning the memory, as will be released together, yet not touching it for now.
  18. Kas Ob.

    Libreoffice integration struggles

    I would leave this to the last, as from what i got once pipe is closed then it is closed and need replacing, but ... who knows. For few hours i also was trying to do the same, but the code is not working fully because i am stuck with again UNO layer, which is causing this, anyway you need to call ".addDocumentEventListener(EventListener as IDispatch);" on either 'com.sun.star.frame.GlobalEventBroadcaster' or LDocument, both working the same from what i see, yet the problem is in EventListener implementation It should be TDocumentEventListener = class(TInterfacedObject, IDispatch, ITypeInfo) And i see callbacks being triggering GetTypeInfo and GetFuncDesc, but filling and answering GetFuncDesc is really confusing, Invoke on other hand being called once at least but i thinkit is the one belongs to IDispathc, ... don't know what to say more, but hope that put you on the road and i might try again later but for today i am now in full hate mode for LibreOffice and its documentation, also its source, it is hard to read and follow. Also debugging is hard, on top of LB is crashing and stop responding, don't know if this happen with your setup, but after some crashes it stop to respond and i need full system restart to bring it up again, though it might be failure on OS side to clean OLE machine. I am stuck at GetFuncDesc, tried many things but it still causing AV, as it went all the way to execute Invoke, yet i am failing to point/pass/fill it right.
  19. Kas Ob.

    Libreoffice integration struggles

    At last ! 😎 @Pierre le Riche found a solution, by using Pipe (com.sun.star.io.Pipe) instead of stream, one can get your needed result. https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1io_1_1Pipe.html program LibreOfficeLoadingFromStream; {$APPTYPE CONSOLE} uses System.SysUtils, System.Win.ComObj, Winapi.ActiveX; procedure LoadWriterDocumentFromBytes(const ADocumentData: TBytes; const aFilterName: string = 'Text'; aFilterOptions: string = ''); var LServiceManager, LDesktop, LProperties: Variant; LPipe: Variant; LPropertyArray: TArray<Variant>; begin {Connect to LibreOffice} LServiceManager := CreateOleObject('com.sun.star.ServiceManager'); LDesktop := LServiceManager.createInstance('com.sun.star.frame.Desktop'); LPipe := LServiceManager.createInstance('com.sun.star.io.Pipe'); LPipe.writeBytes(Variant(ADocumentData)); LPipe.closeOutput; // Important: close output to signal end of data (adding and simulating EOF) SetLength(LPropertyArray, 2); LPropertyArray[0] := LServiceManager.Bridge_GetStruct('com.sun.star.beans.PropertyValue'); LPropertyArray[0].Name := 'InputStream'; LPropertyArray[0].Value := LPipe; LPropertyArray[1] := LServiceManager.Bridge_GetStruct('com.sun.star.beans.PropertyValue'); LPropertyArray[1].Name := 'FilterName'; LPropertyArray[1].Value := aFilterName; if aFilterOptions <> '' then begin SetLength(LPropertyArray, 3); LPropertyArray[2] := LServiceManager.Bridge_GetStruct('com.sun.star.beans.PropertyValue'); LPropertyArray[2].Name := 'FilterOptions'; LPropertyArray[2].Value := aFilterOptions; end; LProperties := LPropertyArray; LDesktop.loadComponentFromURL('private:stream', '_blank', 0, LProperties); end; const {(*} TXTData = 'Hi From Delphi !.'; HTMLData = '<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>'; // don't know how ! RTFData = ' {\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard This is some {\b bold} text.\par }'; // also still missing something CSVData = 'Name,Age,City,Country' + #13#10 + 'John Doe,30,New York,USA' + #13#10 + 'Jane Smith,25,London,UK' + #13#10 + 'Bob Johnson,35,Toronto,Canada' + #13#10 + 'Alice Brown,28,Sydney,Australia';{*)} CSVFilterOption = '44,34,76,1,1/5/2/1/3/5/4/5,0,true,true,true'; // for the above CSVData begin CoInitialize(nil); try LoadWriterDocumentFromBytes(BytesOf(TXTData)); //LoadWriterDocumentFromBytes(BytesOf(HTMLData),'HTML Document (Writer)'); // missing something may be //LoadWriterDocumentFromBytes(BytesOf(RTFData),'Rich Text'); // also LoadWriterDocumentFromBytes(BytesOf(CSVData), 'Text - txt - csv (StarCalc)', CSVFilterOption); // for some reason 'csv' is not enough except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Writeln('Done.'); Readln; end. The result is smooth loading of two instances SWriter and SCalc Tried to load HML and RTF but didn't work, and i really got bored with this, and believe this is a solution for your obstacle for now. ps if you managed to make it load html or pdf, then please share ! extra info the opened instances has document named as "private:stream" but this is easy to rename the most complete supported filters is this https://help.libreoffice.org/25.2/en-US/text/shared/guide/convertfilters.html Good luck !
  20. Kas Ob.

    Libreoffice integration struggles

    This is exactly what i do understand now, UNO only exist for Java and C++, and it is higher level abstraction, like there is no Initialize you tried to use in the API but it is only exist in UNO API. Also, the usage i mentioned about Input/Output is there, and it is confusing, as in my example above only Output can write and read, but the Input is to receive only. What get to mind, is the similarity between of this get/load from memory in Open/LibreOffice and embedded Internet Explorer, it doesn't allow to load/navigate to stream or memory data, but you should navigate to an blank then load the content form memory, this lead me now to this working example with SWriter program LibreOfficeFromDelphi; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.Win.ComObj, Winapi.ActiveX, Variants; procedure LoadSWriterDocumentFromTBytes(const ADocumentData: string); var LServiceManager, LDesktop, LDocument, LText, LTextCursor: Variant; begin {Connect to LibreOffice} LServiceManager := CreateOleObject('com.sun.star.ServiceManager'); LDesktop := LServiceManager.createInstance('com.sun.star.frame.Desktop'); LDocument := LDesktop.loadComponentFromURL('private:factory/swriter', '_blank', 0, VarArrayCreate([0, -1], varVariant)); LText := LDocument.Text; LTextCursor := LText.createTextCursor; LText.insertString(LTextCursor, ADocumentData, False); end; var SomeTextForWriter: string; begin CoInitialize(nil); try SomeTextForWriter := ' Hello, from Delphi'; LoadSWriterDocumentFromTBytes(SomeTextForWriter); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Writeln('Done.'); Readln; end. The result But the core is inserting text !, simple text, may be there is a way to insert formatted text !? And for SCalc, also opening blank is working fine, but there is no text but sheets and stuff. The whole thing is very similar to DOM, may be it is XComponent , but really can't find useful information here, all internet resources leads to the blocked road with UNO API.
  21. Kas Ob.

    Libreoffice integration struggles

    This works fine program LibreOfficeLoadingFromStream; {$APPTYPE CONSOLE} uses System.SysUtils, System.Win.ComObj, Winapi.ActiveX; procedure LoadWriterDocumentFromStream(const ADocumentData: TBytes); var LServiceManager, LDesktop, LStream, LDocData, LProperties: Variant; LPropertyArray: TArray<Variant>; WrittenBytes: TBytes; begin {Connect to LibreOffice} LServiceManager := CreateOleObject('com.sun.star.ServiceManager'); LDesktop := LServiceManager.createInstance('com.sun.star.frame.Desktop'); {Instantiate in input stream to load the document data from} //LInputStream := LServiceManager.createInstance('com.sun.star.io.SequenceInputStream'); LStream := LServiceManager.createInstance('com.sun.star.io.SequenceOutputStream'); // <- {Populate the input stream with the document data} LDocData := ADocumentData; //LInputStream.createStreamFromSequence(LDocData); // <- error here LStream.writeBytes(LDocData); WrittenBytes := LStream.getWrittenBytes; Writeln(StringOf(WrittenBytes)); // test again Writeln('Test again'); LStream.writeBytes(Variant(BytesOf(#13#10'Another TExt'))); Writeln(StringOf(LStream.getWrittenBytes)); end; var LDocData: TBytes; begin CoInitialize(nil); //SetLength(LDocData, 10000); //In an actual application LDocData would contain the .odt document file content LDocData := BytesOf('Sample text 123!@#'); try LoadWriterDocumentFromStream(LDocData); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end. the output is The problem is in API naming and assumption of simple logical naming, it seems the Output/Input words (and meaning) are reversed in the whole SDK, so you should look at them in reverse (from the binary/exe perspective) https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1io.html and the one you need is https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1io_1_1SequenceOutputStream.html
  22. Kas Ob.

    Need help investigating an app crash

    Yes i don't like seeing these on the call stack captured and reported by OS This interpreted as the exception handling did fail and returned to the OS, hence the shut down. I don't have any experience with JclHookExcept, never used it, and looking at its code https://github.com/bematech/jcl/blob/master/windows/JclHookExcept.pas#L383 leading to https://github.com/bematech/jcl/blob/master/windows/JclHookExcept.pas#L322 Now what, did you tried to resolve or access the custom exception ? may be trying to report some buffer, return values, or any thing was on a thread stack that might be already gone ? This is very plausible scenario.
  23. Kas Ob.

    Need help investigating an app crash

    1) Windows version 2) Confirm if this crash happen with the same exact addresses/parameters , specially the "Fault Offset", it is important. 3) How frequent this happen ? can you reproduce or predict the moment of this crash ? 4) Get the ProcDump with full dump like this "procdump -ma -e 1 -t MyStuff.exe MyStuffCrash.dmp" , this is loadable with WinDBG then try to understand what exist at 0xf0a79e3d with "!address" Theories: 1) That fault offset is not out of thin air, it might be coming from hidden WOW64, yet the looks like 32bit hence the unexplained address, these emulator DLLs are 64bit and loaded in 32bit, though impossible to see or interact with them from the process itself, only you see their exception when they raised, as always their exceptions are fatal. 2) handling the exception did in fact corrupt the stack and triggered cascade of problems in Windows trying to unwind , so i don't like these two calls appears on the call stack they looks the cause, just remove them and see if things changes, but this has to do with the extra information above (3) how the above will help, well, you can't solve such crash without pinpoint specific operation, those are (form my experience) a conflict in IO operation combined with stack usage for buffer (or some return values) from different thread, missing or forgetting about these return values, so review your code and make sure your local variable are not passed to different threads, or handling the exception itself triggered extra corruption.
  24. Never used WSAConnectByList, i barely remember testing it, but blocking only without overlapped makes it usable only in specific cases. My suggestion is neither approaches, implement connect with multiple socket at the same time, one Select will do and can be used with up to 64 IPs, the first connect will be used the rest will be closed, this how i do it. lets say you resolved a host (they almost always returned in random order), i pair one IPv4 with IPv6 and connect to them both, the fastest kept and the other dropped without sending anyting. On side note; IPv6 sometimes outperform IPv4, but not always, my ISP doesn't provide IPv6 in my region, so i use 6in4 tunnels on my router, the tunnels from two providers http://tb.netassist.ua/ and https://tunnelbroker.net/ , the setting are on the router and have punch of end points, now; how they do perform is unpredictable, connecting to north America using NA is slow as turtle, and connecting to Asia using HE is slower then IPv4 by a lot like 2 seconds, yet with NA IPv6 to EU is faster than IPv4, this is just a suggestion to enhance the quality and the speed of the connection by selecting the faster SYN/ACK. Hope that help.
  25. Hi, Not really a clue but a guess reading the log above and the steps, the shut down triggered at 16kb of sending, i read this as clue, it looks like the pending response ( aka blocking request) translated into disconnect and wrongly handled as failure instead. So; 1) a question on side but might be important, were did these numbers 1476 and 1468 come from ?, did you calculate the MTU and decided it should be like that ? the lack of client side successful recv means the log entry wasn't from successful send event, track those, (but again of ICS have them, as i don't know) 2) i can't tell how ICS works for websocket, but i think Angus can tell if the blocking handled right in your version, yet he recommended that you update, then update, also reproducing such behavior should be fairly easy, @FrozenK if you can provide short project reproducing that shutdown trigger, then that behavior can be solved once and for all. 3) Have you missed around with TCP buffers sizes ? (namely sending buffer) , are you tweaking some socket options ? the default send buffer on Windows is 8kb, but this doesn't means you can't send more, it is just little more long story to explain. 4) Also, the problem in my opinion is that ACK hadn't been received and sending party reached some a limit around 16kb (limit but not receiving peer ACK), this triggered blocking request (pending), and this translated into error with lead to shut down, in other words handled, the socket is not checking if ready to send while handling WSAEWOULDBLOCK as fatal connection error, while it is not. Hope that helps.
×