What 4 threads work under the empty new VCL forms application?

Possible duplicate:
What are the other threads in the VCL application by default and can they be named for their intended purpose?

When starting a new empty VCL Forms application in Delphi XE2 (32 bit), I see 4 threads running in the Task Manager for this application. Obviously, any application requires at least 1 thread, but in this case, what are 3 more threads? I would like to better understand which threads use the VCL application for forms by default. I thought that maybe it was the fact that I was working in debug mode from RAD Studio, so I ran the EXE myself and it also had 4 threads. I also tried compiling in the "release" configuration (thus disabling the compilation of debugging information), and there are still 4 threads.

enter image description here

+6
source share
2 answers

To determine the source of the threads, you can check the starting address of the threads with a tool such as a process guide or a hacker .

enter image description here

In this case, for example, you can see

  • ntdll.dll! TpCallbackIndependent + 0x ????? which is part of the Windows threadpool APIs.
  • ntdll.dll! RtlMoveMemory + 0x ????? is a call to the RtlMoveMemory WinAPi function.
  • Project??. Exe + 0x ????? The main thread of the application.
+8
source

All other threads except the main thread are created on my computer because the application window is registered to receive session change notifications using the Wtsapi32.WTSRegisterSessionNotification API. You can see the implementation inside the Vcl.Forms -> TApplication.CreateHandle procedure. This should be related to how the application works / looks when you log in to Terminal Services / Remote Desktop. Some other threads may exist because some other / s programs load code into your executable.

+5
source

Source: https://habr.com/ru/post/919464/


All Articles