I'm asking this question because it turns out that there's some difficulty in writing a screensaver app in Delphi that's capable of running from the Logon screen.
See question: Windows 7 logon screensaver in Delphi
I've narrowed down the problem (or at least one problem) to a particular Win API call CreateEvent
.
SyncEvent := CreateEvent(nil, True, False, '');
if SyncEvent = 0 then
RaiseLastOSError;
This code only fails if called from the Logon screen. And GetLastError returns that access is denied. So clearly the security restrictions on the Logon screen prevent CreateEvent(nil, True, False, '');
from creating the event as desired.
(I don't really see how an Event could be an exploitable security risk.)
So, the question is: Is it possible to create an Event from the Logon screen? Presumably via either:
- Using an appropriate
lpEventAttributes
- Or calling CreatingEventEx instead.
Although the problem was experienced in Delphi, this is more about the Win API. So feel free to answer in your language of choice.
CreateEvent()
tonil
instead of''
. There is a difference between a nil pointer and a pointer to a zero-length string. The documentation does not say anything about a zero-length string being treated any differently than any other named string. If you want an unnamed event, usenil
. – Angleaangler