My service should store several bits of information (at least at least 20 bits or so, but I can easily use more) so that
- it persists during a service restart, even if the service crashes or is otherwise aborted abnormally
- it does not persist on reboot
- can be read and updated with very little overhead
If I store this information in the registry or in a file, it will not be automatically cleared when the system reboots.
Now, if I were in a modern POSIX system, I would use shm_openthat would create a shared memory segment that is saved for restarting the process, but not rebooting the system, and I could use shm_unlinkto clear it if the persistent data is somehow damaged.
I found MSDN: creating named shared memory and started to reorient chunks of this in my service; it basically uses CreateFileMapping(INVALID_HANDLE_NAME, ..., PAGE_READWRITE, ..., "Global\\my_service")instead shm_open("/my_service", O_RDWR, O_CREAT).
However, I have a few problems, especially in terms of the lifespan of this file with paging file support. I did not find the answers to these questions in the MSDN documentation:
- Does the display remain on reboot?
- If not, does the display disappear when all open handles to it are closed?
- , ? .
reset , .
/ ?
, , , : / (, 0,01% , ), . .