From: dc2000 on
Hi everyone:


I have a tricky situation. My app displays a message box using
MB_SERVICE_NOTIFICATION flag like this:

::MessageBox(NULL, message, title, MB_OK | MB_ICONINFORMATION |
MB_SERVICE_NOTIFICATION);

I'm using MB_SERVICE_NOTIFICATION since I need this message to be displayed
over screen-saver, or Winlogon as well.


When the window is shown on the screen I use WM_TIMER message and
FindWindow() to get the handle of the Message Box and later update text
displayed in it.

HWND hMsgBxWnd = ::FindWindow("#32770", title);

//Get handle to the static window in the Message Box
if(::GetDlgItem(hMsgBxWnd, 0xffff))
{
//Got it, now can update it
::SetDlgItemText(hMsgBxWnd, 0xffff, message_str);
}

Everything works fine when user's desktop is shown. If I go into Winlogon by
clicking Start -> Log Off -> Switch User (see picture here:
http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1), the
message is displayed but FindWindow() returns NULL. I tried EnumWindows() and
it failed as well.

I heard that one solution would be to use CBT_HOOK but for that I will need
a separate DLL module (for global hook), which I'd really like to avoid.

Does anyone know how to get a handle to this message box during Winlogon?


FYI. The currently active Terminal Session is still the same as when the
message is shown during Winlogon.
From: anton bassov on
Hi mate

> Everything works fine when user's desktop is shown. If I go into Winlogon by
> clicking Start -> Log Off -> Switch User (see picture here:
> http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1), the
> message is displayed but FindWindow() returns NULL. I tried EnumWindows() and
> it failed as well.

When you specify MB_SERVICE_NOTIFICATION flag, message box is displayed
as ZwRaiseHardError() call, so that it is owned by csrss.exe, rather
than by caller, and,as a result, it gets displayed on currently active
desktop. However, it does not mean that the caller has an access to
this destop. In general, under Windows, desktop is a security boundary.
Therefore, FindWindow() and EnumWindows() are able to find and
enumerate
only those windows that belong to the desktop the caller is associated
with



> I heard that one solution would be to use CBT_HOOK but for that I will need
> a separate DLL module (for global hook),

It is not going to work either - Windows hooks are of desktop-level
scope


> Does anyone know how to get a handle to this message box during Winlogon?

You cannot do it in your application's context - no one, apart from
Winlogon.exe, has an access to "Winlogon" desktop. If you are Admin,
you may assign yourself privileges of LocalSystem account, so that you
are able to open a handle to Winlogon.exe and inject a DLL into it

Anton Bassov

dc2000 wrote:
> Hi everyone:
>
>
> I have a tricky situation. My app displays a message box using
> MB_SERVICE_NOTIFICATION flag like this:
>
> ::MessageBox(NULL, message, title, MB_OK | MB_ICONINFORMATION |
> MB_SERVICE_NOTIFICATION);
>
> I'm using MB_SERVICE_NOTIFICATION since I need this message to be displayed
> over screen-saver, or Winlogon as well.
>
>
> When the window is shown on the screen I use WM_TIMER message and
> FindWindow() to get the handle of the Message Box and later update text
> displayed in it.
>
> HWND hMsgBxWnd = ::FindWindow("#32770", title);
>
> //Get handle to the static window in the Message Box
> if(::GetDlgItem(hMsgBxWnd, 0xffff))
> {
> //Got it, now can update it
> ::SetDlgItemText(hMsgBxWnd, 0xffff, message_str);
> }
>
> Everything works fine when user's desktop is shown. If I go into Winlogon by
> clicking Start -> Log Off -> Switch User (see picture here:
> http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1), the
> message is displayed but FindWindow() returns NULL. I tried EnumWindows() and
> it failed as well.
>
> I heard that one solution would be to use CBT_HOOK but for that I will need
> a separate DLL module (for global hook), which I'd really like to avoid.
>
> Does anyone know how to get a handle to this message box during Winlogon?
>
>
> FYI. The currently active Terminal Session is still the same as when the
> message is shown during Winlogon.

From: dc2000 on
Wow, that sucks. No way out, hah? Thanks anyway.

"anton bassov" wrote:

> Hi mate
>
> > Everything works fine when user's desktop is shown. If I go into Winlogon by
> > clicking Start -> Log Off -> Switch User (see picture here:
> > http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1), the
> > message is displayed but FindWindow() returns NULL. I tried EnumWindows() and
> > it failed as well.
>
> When you specify MB_SERVICE_NOTIFICATION flag, message box is displayed
> as ZwRaiseHardError() call, so that it is owned by csrss.exe, rather
> than by caller, and,as a result, it gets displayed on currently active
> desktop. However, it does not mean that the caller has an access to
> this destop. In general, under Windows, desktop is a security boundary.
> Therefore, FindWindow() and EnumWindows() are able to find and
> enumerate
> only those windows that belong to the desktop the caller is associated
> with
>
>
>
> > I heard that one solution would be to use CBT_HOOK but for that I will need
> > a separate DLL module (for global hook),
>
> It is not going to work either - Windows hooks are of desktop-level
> scope
>
>
> > Does anyone know how to get a handle to this message box during Winlogon?
>
> You cannot do it in your application's context - no one, apart from
> Winlogon.exe, has an access to "Winlogon" desktop. If you are Admin,
> you may assign yourself privileges of LocalSystem account, so that you
> are able to open a handle to Winlogon.exe and inject a DLL into it
>
> Anton Bassov
>
> dc2000 wrote:
> > Hi everyone:
> >
> >
> > I have a tricky situation. My app displays a message box using
> > MB_SERVICE_NOTIFICATION flag like this:
> >
> > ::MessageBox(NULL, message, title, MB_OK | MB_ICONINFORMATION |
> > MB_SERVICE_NOTIFICATION);
> >
> > I'm using MB_SERVICE_NOTIFICATION since I need this message to be displayed
> > over screen-saver, or Winlogon as well.
> >
> >
> > When the window is shown on the screen I use WM_TIMER message and
> > FindWindow() to get the handle of the Message Box and later update text
> > displayed in it.
> >
> > HWND hMsgBxWnd = ::FindWindow("#32770", title);
> >
> > //Get handle to the static window in the Message Box
> > if(::GetDlgItem(hMsgBxWnd, 0xffff))
> > {
> > //Got it, now can update it
> > ::SetDlgItemText(hMsgBxWnd, 0xffff, message_str);
> > }
> >
> > Everything works fine when user's desktop is shown. If I go into Winlogon by
> > clicking Start -> Log Off -> Switch User (see picture here:
> > http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1), the
> > message is displayed but FindWindow() returns NULL. I tried EnumWindows() and
> > it failed as well.
> >
> > I heard that one solution would be to use CBT_HOOK but for that I will need
> > a separate DLL module (for global hook), which I'd really like to avoid.
> >
> > Does anyone know how to get a handle to this message box during Winlogon?
> >
> >
> > FYI. The currently active Terminal Session is still the same as when the
> > message is shown during Winlogon.
>
>
From: dc2000 on
Hey, it just dawned on me. Is there any way to display my own dialog window
during Winlogon?


"anton bassov" wrote:

> Hi mate
>
> > Everything works fine when user's desktop is shown. If I go into Winlogon by
> > clicking Start -> Log Off -> Switch User (see picture here:
> > http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1), the
> > message is displayed but FindWindow() returns NULL. I tried EnumWindows() and
> > it failed as well.
>
> When you specify MB_SERVICE_NOTIFICATION flag, message box is displayed
> as ZwRaiseHardError() call, so that it is owned by csrss.exe, rather
> than by caller, and,as a result, it gets displayed on currently active
> desktop. However, it does not mean that the caller has an access to
> this destop. In general, under Windows, desktop is a security boundary.
> Therefore, FindWindow() and EnumWindows() are able to find and
> enumerate
> only those windows that belong to the desktop the caller is associated
> with
>
>
>
> > I heard that one solution would be to use CBT_HOOK but for that I will need
> > a separate DLL module (for global hook),
>
> It is not going to work either - Windows hooks are of desktop-level
> scope
>
>
> > Does anyone know how to get a handle to this message box during Winlogon?
>
> You cannot do it in your application's context - no one, apart from
> Winlogon.exe, has an access to "Winlogon" desktop. If you are Admin,
> you may assign yourself privileges of LocalSystem account, so that you
> are able to open a handle to Winlogon.exe and inject a DLL into it
>
> Anton Bassov
>
> dc2000 wrote:
> > Hi everyone:
> >
> >
> > I have a tricky situation. My app displays a message box using
> > MB_SERVICE_NOTIFICATION flag like this:
> >
> > ::MessageBox(NULL, message, title, MB_OK | MB_ICONINFORMATION |
> > MB_SERVICE_NOTIFICATION);
> >
> > I'm using MB_SERVICE_NOTIFICATION since I need this message to be displayed
> > over screen-saver, or Winlogon as well.
> >
> >
> > When the window is shown on the screen I use WM_TIMER message and
> > FindWindow() to get the handle of the Message Box and later update text
> > displayed in it.
> >
> > HWND hMsgBxWnd = ::FindWindow("#32770", title);
> >
> > //Get handle to the static window in the Message Box
> > if(::GetDlgItem(hMsgBxWnd, 0xffff))
> > {
> > //Got it, now can update it
> > ::SetDlgItemText(hMsgBxWnd, 0xffff, message_str);
> > }
> >
> > Everything works fine when user's desktop is shown. If I go into Winlogon by
> > clicking Start -> Log Off -> Switch User (see picture here:
> > http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1), the
> > message is displayed but FindWindow() returns NULL. I tried EnumWindows() and
> > it failed as well.
> >
> > I heard that one solution would be to use CBT_HOOK but for that I will need
> > a separate DLL module (for global hook), which I'd really like to avoid.
> >
> > Does anyone know how to get a handle to this message box during Winlogon?
> >
> >
> > FYI. The currently active Terminal Session is still the same as when the
> > message is shown during Winlogon.
>
>
From: Skywing [MVP] on
WlxDialogBox* from a GINA DLL. Note that GINA DLLs are obsolete and
unusable in Windows Vista and future OS releases.

--
Ken Johnson (Skywing)
Windows SDK MVP
http://www.nynaeve.net

"dc2000" <dc2000(a)discussions.microsoft.com> wrote in message
news:B5021860-82E2-4EB8-BD9B-48B2C7AA6B1F(a)microsoft.com...
> Hey, it just dawned on me. Is there any way to display my own dialog
> window
> during Winlogon?
>
>
> "anton bassov" wrote:
>
>> Hi mate
>>
>> > Everything works fine when user's desktop is shown. If I go into
>> > Winlogon by
>> > clicking Start -> Log Off -> Switch User (see picture here:
>> > http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1),
>> > the
>> > message is displayed but FindWindow() returns NULL. I tried
>> > EnumWindows() and
>> > it failed as well.
>>
>> When you specify MB_SERVICE_NOTIFICATION flag, message box is displayed
>> as ZwRaiseHardError() call, so that it is owned by csrss.exe, rather
>> than by caller, and,as a result, it gets displayed on currently active
>> desktop. However, it does not mean that the caller has an access to
>> this destop. In general, under Windows, desktop is a security boundary.
>> Therefore, FindWindow() and EnumWindows() are able to find and
>> enumerate
>> only those windows that belong to the desktop the caller is associated
>> with
>>
>>
>>
>> > I heard that one solution would be to use CBT_HOOK but for that I will
>> > need
>> > a separate DLL module (for global hook),
>>
>> It is not going to work either - Windows hooks are of desktop-level
>> scope
>>
>>
>> > Does anyone know how to get a handle to this message box during
>> > Winlogon?
>>
>> You cannot do it in your application's context - no one, apart from
>> Winlogon.exe, has an access to "Winlogon" desktop. If you are Admin,
>> you may assign yourself privileges of LocalSystem account, so that you
>> are able to open a handle to Winlogon.exe and inject a DLL into it
>>
>> Anton Bassov
>>
>> dc2000 wrote:
>> > Hi everyone:
>> >
>> >
>> > I have a tricky situation. My app displays a message box using
>> > MB_SERVICE_NOTIFICATION flag like this:
>> >
>> > ::MessageBox(NULL, message, title, MB_OK | MB_ICONINFORMATION |
>> > MB_SERVICE_NOTIFICATION);
>> >
>> > I'm using MB_SERVICE_NOTIFICATION since I need this message to be
>> > displayed
>> > over screen-saver, or Winlogon as well.
>> >
>> >
>> > When the window is shown on the screen I use WM_TIMER message and
>> > FindWindow() to get the handle of the Message Box and later update text
>> > displayed in it.
>> >
>> > HWND hMsgBxWnd = ::FindWindow("#32770", title);
>> >
>> > //Get handle to the static window in the Message Box
>> > if(::GetDlgItem(hMsgBxWnd, 0xffff))
>> > {
>> > //Got it, now can update it
>> > ::SetDlgItemText(hMsgBxWnd, 0xffff, message_str);
>> > }
>> >
>> > Everything works fine when user's desktop is shown. If I go into
>> > Winlogon by
>> > clicking Start -> Log Off -> Switch User (see picture here:
>> > http://www.codeguru.com/forum/attachment.php?attachmentid=17852&stc=1),
>> > the
>> > message is displayed but FindWindow() returns NULL. I tried
>> > EnumWindows() and
>> > it failed as well.
>> >
>> > I heard that one solution would be to use CBT_HOOK but for that I will
>> > need
>> > a separate DLL module (for global hook), which I'd really like to
>> > avoid.
>> >
>> > Does anyone know how to get a handle to this message box during
>> > Winlogon?
>> >
>> >
>> > FYI. The currently active Terminal Session is still the same as when
>> > the
>> > message is shown during Winlogon.
>>
>>