Search the Community
Showing results for tags 'winapi'.
Found 8 results
-
I have a stupid question on how to "gracefully" terminate a Windows console application. I am not very familiar with how processes are established, how parent/child relationships are handled, consoles, all that. I might be missing basics. What I am doing: I have a central application with a VCL interface It uses CreateProcess(..) to invisibly spawn some console applications in the background Some are kept running 24/7, some are just started on demand, crunch some data, then terminate These console applications get their stdIn, stdOut and stdErr pipes redirected to some pipes I created in my central applications, so I can easily process their output, and control them (if they get controlled from stdIn). So far, everything worked like a breeze My issue now: I am now integrating another console application that just runs 24/7 and has no way of gracefully shutting it down It will only end on either pressing CTRL+C on a regular terminal, or by sending it a CTRL_BREAK_EVENT from my central application by using GenerateConsoleCtrlEvent. I know that Windows will "clean up" after the process has ended, but I am not sure if this way of shutting the process down is still a bit too "rude" My question: The documentation of the GenerateConsoleCtrlEvent function states "All console processes have a default handler function that calls the ExitProcess function." The documentation on ExitProcess gets into more detail of what it actually does, but I have a hard time understanding the implications. After sending the CTRL_BREAK_EVENT to the console application, my application will still give it a few hundred milliseconds to power down until it will resort to TerminateProcess but never has to, because the console application will finish within less than 5 ms. I am just unsure whether I am doing it right or maybe there is a better way of "gracefully" shutting down a console application that does not handle CTRL+C at all.
-
Good day, I would like to have ability in my project to show certificate details of signed executables. (From other executables) Is that possible with Delphi? Would love to get hints 'how-to'! //edit For now I have ability to get raw data thats appended to executables (overlay data) by simply check PE header for filesize and compare with real physical filesize.
-
I'm able to get the PID of a processname (ex: winword.exe) but interested of getting the PID of winword.exe based on a specific filename, is this possible? I was able to look capture the PID from winword but if there are multiple instance I can't kill all instance but only a specific one. I'm not so familiar with Winapi handling, based on this post: Delphi Get the handle of a EXE he is trying to change his approach from 'Window name' to an Exe name. But parameter @processid needs to be specified. How can I get the processid in this case based on filename or window name?
-
Project reached somewhat usable state. Check it here. SChannel is Windows built-in implementation of TLS protocols. This allows supporting secure connections without any external library. Repo contains: unit with transport-agnostic helper functions for easy implementation of TLS communication by means of Windows SChannel. sample of transport-agnostic synchronous TLS handshake using callback functions for real communication API declarations borrowed from JEDI project ICS TWSocket descendant that performs TLS communication demo project for performing any textual (mainly HTTPS) requests via secure connection Note. I first started learning what TLS is a couple of weeks ago :) So units contain only a necessary minimum to interact with TLS server. Certs and other advanced stuff are in TODO. Thanks to author of TLS-Sample from http://www.coastrd.com/c-schannel-smtp and JEDI for WinAPI headers.
-
delphi Redirect all Notify Icons to a seperate window possible?
KodeZwerg posted a topic in Windows API
Hello Winapi lovers, I would like to have all notify icons (system tray?) in a seperate window. (everthing between taskbar entries and time display) Is that possible at all? Reason: I would run that program to have a OnTop window open that does not close on its own and inform me what icons are avail (usb device, network symbol, programms with their bubble[number], and such....) By default I do minimize TaskBar and having such would make my workflow alot easier! For now I even dont have a starting point. Searching Msdn did not result me any positive clue. I would also accept any pre-made application that do such to not reinvent wheels. Thank you for reading!- 19 replies
-
- winapi
- notify icon
-
(and 1 more)
Tagged with:
-
Hello all, I need to map a block of memory (a ring buffer) into the address space of multiple processes for shared access. The Windows API offers a technology called memory-mapped files for this purpose. My question: does the "Interlockedxxxx" API work reliably across process boundaries ? The windows API documentation does not state that explicitly. My hope is that these commands translate into process-agnostic cpu opcodes.
- 22 replies
-
- synchronization
- multitasking
-
(and 1 more)
Tagged with:
-
In OTL (3.0.7), OTLCommon.TOmniAffinity.GetMask calls DSiGetSystemAffinityMask, DSiGetProcessAffinityMask and DSiGetThreadAffinityMask which all call Winapi.windows.GetProcessAffinityMask, which can fail (I don't know under what conditions, but clients are reporting that it happens under Wine and also on at least one windows 10 system). If it fails, the var returns lpProcessAffinityMask and lpSystemAffinityMask are undefined. OTL release 1.40 made some changes to support 64 bit, and so I think in most places this behaviour won't show. However, for example OTLCommon.TOmniAffinity.GetCount has affMask := Mask; where affMask is a DWORD and mask is the NativeUInt property. An ERangeError won't be thrown unless: 64 bit arch range checking on GetProcessAffinityMask throws the second 64-bit param (lpProcessAffinityMask) value comes back as an invalid 32 bit value (I assume, under whatever conditions that trigger this issue, winapi doesn't change the stack val, so for example whatever was in that position happened to be an invalid 32 bit value) So my suggestion is that anywhere getProcessAffinityMask is called (I think just 3 places), it is checked for failure and if so some reasonable value is returned, eg if not GetProcessAffinityMask(GetCurrentProcess, Result, systemAffinityMask) then result := 1;
-
magnification Windows 10: How see behind full screen form inside a new desktop create by a 3rd's application
flashcoder posted a topic in General Help
I have a normal application example (the code is this, but not is a service) that make screenshots of a non secure active desktop created by a 3rd's application. For example: https://i.stack.imgur.com/NJoOG.jpg This 3rd application is a "browser application" that uses CEF to render the websites. My goal is open a fullscreen form in foreground (covering all screen above) and be able to make screenshot of the content behind of this fullscreen form (the 3rd application). I searched by some hint about this and found these similar discussions: How do I capture desktop screenshot behind full screen form? Screenshot using Magnification API: SetThreadDesktop fails when alternates to a new desktop I also had tested using PrintWindow api (to capture only the 3rd's application), but this results in a black screen (in chromium content) because probably the 3rd's application uses CEF with hardware acceleration resource active. For example: https://i.stack.imgur.com/taMdX.png All works fine in Windows XP, 7 (disabling Aero theme) - with ALPHABLEND = TRUE on fullscreen Form. The second discussion found seems more near of solution to my trouble, because this uses a api apparently able to remove a determinated window of screencapture. I tested this example left by author, works only if call ConfigMag() prodecure after routine that contains SetThreadDesktop api. Eg: if InputDesktopSelected then xGetScreenToBmp(idx) else if SelectDesktop(nil) then // result of SelectDesktop() is a routine that calls SetThreadDesktop begin ConfigMag; xGetScreenToBmp(idx); end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; Already if i want make screenshots periodically, this will fails like was said by author. Then my trouble still not was solved.- 4 replies
-
- screencapture
- winapi
-
(and 3 more)
Tagged with: