[fpc-devel] Windows Service Preshutdown Notifications

MegaBrutal megabrutal at gmail.com
Mon Oct 29 21:30:00 CET 2018


Hi all,

I propose to add the Windows Service PRESHUTDOWN constants to the Windows unit.

Preshutdown Notifications exist since Windows Vista. It allows Windows
services to receive a preshutdown notification those are fired earlier
than normal shutdown notifications, which allows a service more time
to shut down properly. It's useful for services those take a longer
time to shut down.

Here's a patch to add the necessary constants to process Preshutdown
Notifications in Windows service applications:


Index: rtl/win/wininc/defines.inc
===================================================================
--- rtl/win/wininc/defines.inc    (revision 40091)
+++ rtl/win/wininc/defines.inc    (working copy)
@@ -248,6 +248,7 @@
      SERVICE_ACCEPT_STOP = 1;
      SERVICE_ACCEPT_PAUSE_CONTINUE = 2;
      SERVICE_ACCEPT_SHUTDOWN = 4;
+     SERVICE_ACCEPT_PRESHUTDOWN = 256;
   { CheckDlgButton  }
      BST_CHECKED = 1;
      BST_INDETERMINATE = 2;
@@ -355,6 +356,7 @@
      SERVICE_CONTROL_CONTINUE = 3;
      SERVICE_CONTROL_INTERROGATE = 4;
      SERVICE_CONTROL_SHUTDOWN = 5;
+     SERVICE_CONTROL_PRESHUTDOWN = 15;
   { CopyImage, LoadImage  }
      IMAGE_BITMAP = 0;
      IMAGE_CURSOR = 2;


Best regards,
MegaBrutal



More information about the fpc-devel mailing list