Author: gadamopoulos
Date: Fri Feb 18 20:16:43 2011
New Revision: 50813
URL:
http://svn.reactos.org/svn/reactos?rev=50813&view=rev
Log:
[user32/win32k]
- Implement MessageBeep and SetLogonNotifyWindow
[winlogon]
- Implement receiving notifications from win32k to play sounds of MessageBeep
Modified:
trunk/reactos/base/system/winlogon/sas.c
trunk/reactos/base/system/winlogon/winlogon.c
trunk/reactos/base/system/winlogon/winlogon.h
trunk/reactos/dll/win32/user32/misc/misc.c
trunk/reactos/dll/win32/user32/windows/messagebox.c
trunk/reactos/include/reactos/undocuser.h
trunk/reactos/include/reactos/winlogon.h
trunk/reactos/subsystems/win32/win32k/include/winsta.h
trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
Modified: trunk/reactos/base/system/winlogon/sas.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/sas.c…
==============================================================================
--- trunk/reactos/base/system/winlogon/sas.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/sas.c [iso-8859-1] Fri Feb 18 20:16:43 2011
@@ -24,8 +24,6 @@
#define HK_CTRL_ALT_DEL 0
#define HK_CTRL_SHIFT_ESC 1
-
-extern BOOL WINAPI SetLogonNotifyWindow(HWND Wnd, HWINSTA WinSta);
/* FUNCTIONS ****************************************************************/
@@ -843,6 +841,40 @@
return STATUS_SUCCESS;
}
+BOOL
+WINAPI
+HandleMessageBeep(UINT uType)
+{
+ LPWSTR EventName;
+
+ switch(uType)
+ {
+ case 0xFFFFFFFF:
+ EventName = NULL;
+ break;
+ case MB_OK:
+ EventName = L"SystemDefault";
+ break;
+ case MB_ICONASTERISK:
+ EventName = L"SystemAsterisk";
+ break;
+ case MB_ICONEXCLAMATION:
+ EventName = L"SystemExclamation";
+ break;
+ case MB_ICONHAND:
+ EventName = L"SystemHand";
+ break;
+ case MB_ICONQUESTION:
+ EventName = L"SystemQuestion";
+ break;
+ default:
+ WARN("Unhandled type %d\n", uType);
+ EventName = L"SystemDefault";
+ }
+
+ return PlaySoundRoutine(EventName, FALSE, SND_ALIAS | SND_NOWAIT | SND_NOSTOP |
SND_ASYNC);
+}
+
static LRESULT CALLBACK
SASWindowProc(
IN HWND hwndDlg,
@@ -902,6 +934,21 @@
}
return TRUE;
}
+ case WM_LOGONNOTIFY:
+ {
+ switch(wParam)
+ {
+ case LN_MESSAGE_BEEP:
+ {
+ return HandleMessageBeep(lParam);
+ }
+ default:
+ {
+ ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
+ }
+ }
+ return 0;
+ }
case WLX_WM_SAS:
{
DispatchSAS(Session, (DWORD)wParam);
Modified: trunk/reactos/base/system/winlogon/winlogon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/winlogon.c [iso-8859-1] Fri Feb 18 20:16:43 2011
@@ -23,6 +23,49 @@
/* FUNCTIONS *****************************************************************/
+BOOL
+PlaySoundRoutine(
+ IN LPCWSTR FileName,
+ IN UINT bLogon,
+ IN UINT Flags)
+{
+ typedef BOOL (WINAPI *PLAYSOUNDW)(LPCWSTR,HMODULE,DWORD);
+ typedef UINT (WINAPI *WAVEOUTGETNUMDEVS)(VOID);
+ PLAYSOUNDW Play;
+ WAVEOUTGETNUMDEVS waveOutGetNumDevs;
+ UINT NumDevs;
+ HMODULE hLibrary;
+ BOOL Ret = FALSE;
+
+ hLibrary = LoadLibraryW(L"winmm.dll");
+ if (hLibrary)
+ {
+ waveOutGetNumDevs = (WAVEOUTGETNUMDEVS)GetProcAddress(hLibrary,
"waveOutGetNumDevs");
+ if (waveOutGetNumDevs)
+ {
+ NumDevs = waveOutGetNumDevs();
+ if (!NumDevs)
+ {
+ if (!bLogon)
+ {
+ Beep(500, 500);
+ }
+ FreeLibrary(hLibrary);
+ return FALSE;
+ }
+ }
+
+ Play = (PLAYSOUNDW)GetProcAddress(hLibrary, "PlaySoundW");
+ if (Play)
+ {
+ Ret = Play(FileName, NULL, Flags);
+ }
+ FreeLibrary(hLibrary);
+ }
+
+ return Ret;
+}
+
DWORD
WINAPI
PlayLogonSoundThread(
@@ -32,10 +75,8 @@
WCHAR szBuffer[MAX_PATH] = {0};
WCHAR szDest[MAX_PATH];
DWORD dwSize = sizeof(szBuffer);
- HMODULE hLibrary;
SERVICE_STATUS_PROCESS Info;
- typedef BOOL (WINAPI *PLAYSOUNDW)(LPCWSTR,HMODULE,DWORD);
- PLAYSOUNDW Play;
+
ULONG Index = 0;
if (RegOpenKeyExW(HKEY_CURRENT_USER,
L"AppEvents\\Schemes\\Apps\\.Default\\WindowsLogon\\.Current", 0, KEY_READ,
&hKey) != ERROR_SUCCESS)
@@ -94,17 +135,7 @@
if (Info.dwCurrentState != SERVICE_RUNNING)
ExitThread(0);
-
- hLibrary = LoadLibraryW(L"winmm.dll");
- if (hLibrary)
- {
- Play = (PLAYSOUNDW)GetProcAddress(hLibrary, "PlaySoundW");
- if (Play)
- {
- Play(szDest, NULL, SND_FILENAME);
- }
- FreeLibrary(hLibrary);
- }
+ PlaySoundRoutine(szDest, TRUE, SND_FILENAME);
}
ExitThread(0);
}
Modified: trunk/reactos/base/system/winlogon/winlogon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.h [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/winlogon.h [iso-8859-1] Fri Feb 18 20:16:43 2011
@@ -40,6 +40,7 @@
#include <accctrl.h>
#include <aclapi.h>
+#include <reactos/undocuser.h>
#include <reactos/winlogon.h>
#include "setup.h"
@@ -203,6 +204,13 @@
IN PWLSESSION Session);
/* winlogon.c */
+
+BOOL
+PlaySoundRoutine(
+ IN LPCWSTR FileName,
+ IN UINT Logon,
+ IN UINT Flags);
+
BOOL
DisplayStatusMessage(
IN PWLSESSION Session,
Modified: trunk/reactos/dll/win32/user32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/misc…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] Fri Feb 18 20:16:43 2011
@@ -72,7 +72,7 @@
return(FALSE);
}
- return(TRUE);
+ return NtUserSetLogonNotifyWindow(Wnd);
}
/*
Modified: trunk/reactos/dll/win32/user32/windows/messagebox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/messagebox.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/messagebox.c [iso-8859-1] Fri Feb 18 20:16:43
2011
@@ -890,36 +890,7 @@
WINAPI
MessageBeep(UINT uType)
{
-#if 0
- LPWSTR EventName;
-
- switch(uType)
- {
- case 0xFFFFFFFF:
- if(waveOutGetNumDevs() == 0)
- return Beep(500, 100); // Beep through speaker
- /* fall through */
- case MB_OK:
- EventName = L"SystemDefault";
- break;
- case MB_ICONASTERISK:
- EventName = L"SystemAsterisk";
- break;
- case MB_ICONEXCLAMATION:
- EventName = L"SystemExclamation";
- break;
- case MB_ICONHAND:
- EventName = L"SystemHand";
- break;
- case MB_ICONQUESTION:
- EventName = L"SystemQuestion";
- break;
- }
-
- return PlaySoundW((LPCWSTR)EventName, NULL, SND_ALIAS | SND_NOWAIT | SND_NOSTOP |
SND_ASYNC);
-#else
- return Beep(500, 100); // Beep through speaker
-#endif
+ return (BOOL)NtUserCallOneParam(ONEPARAM_ROUTINE_MESSAGEBEEP, uType);
}
Modified: trunk/reactos/include/reactos/undocuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/undocuser.…
==============================================================================
--- trunk/reactos/include/reactos/undocuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/undocuser.h [iso-8859-1] Fri Feb 18 20:16:43 2011
@@ -92,7 +92,7 @@
#define SBRG_PAGEDOWNLEFT 4 /* the page down or page left region */
#define SBRG_BOTTOMLEFTBTN 5 /* the bottom or left button */
-
+BOOL WINAPI SetLogonNotifyWindow(HWND Wnd, HWINSTA WinSta);
BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);
UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
DWORD_PTR WINAPI SetSysColorsTemp(const COLORREF *, const HBRUSH *, DWORD_PTR);
Modified: trunk/reactos/include/reactos/winlogon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/winlogon.h…
==============================================================================
--- trunk/reactos/include/reactos/winlogon.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/winlogon.h [iso-8859-1] Fri Feb 18 20:16:43 2011
@@ -17,14 +17,6 @@
#define EWX_INTERNAL_KILL_ALL_APPS (EWX_INTERNAL_FLAG | 0x200)
#define EWX_INTERNAL_FLAG_LOGOFF 0x1000
-#define WM_LOGONNOTIFY 0x0000004c
-
-/* WPARAM values for WM_LOGONNOTIFY */
-#define LN_START_TASK_MANAGER 0x4
-#define LN_LOCK_WORKSTATION 0x5
-#define LN_UNLOCK_WORKSTATION 0x6
-#define LN_MESSAGE_BEEP 0x9
-
#endif /* REACTOS_WINLOGON_H_INCLUDED */
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/include/winsta.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] Fri Feb 18
20:16:43 2011
@@ -61,6 +61,7 @@
extern WINSTATION_OBJECT *InputWindowStation;
extern PPROCESSINFO LogonProcess;
+extern HWND hwndSAS;
INIT_FUNCTION
NTSTATUS
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] Fri Feb 18
20:16:43 2011
@@ -1275,17 +1275,6 @@
/*
* @unimplemented
*/
-BOOL APIENTRY
-NtUserSetLogonNotifyWindow(HWND hWnd)
-{
- UNIMPLEMENTED
-
- return 0;
-}
-
-/*
- * @unimplemented
- */
BOOL
APIENTRY
NtUserUpdateLayeredWindow(
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Fri Feb 18
20:16:43 2011
@@ -341,6 +341,9 @@
}
case ONEPARAM_ROUTINE_REPLYMESSAGE:
RETURN (co_MsqReplyMessage((LRESULT) Param));
+ case ONEPARAM_ROUTINE_MESSAGEBEEP:
+ RETURN ( UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, Param) );
+ /* TODO: Implement sound sentry */
}
DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam(),
Param=0x%x\n",
Routine, Param);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Fri Feb 18 20:16:43
2011
@@ -42,6 +42,9 @@
/* Currently active window station */
PWINSTATION_OBJECT InputWindowStation = NULL;
+
+/* Winlogon sas window*/
+HWND hwndSAS = NULL;
/* INITALIZATION FUNCTIONS ****************************************************/
@@ -1455,4 +1458,25 @@
BuildDesktopNameList(hWindowStation, dwSize, lpBuffer, pRequiredSize);
}
+/*
+ * @implemented
+ */
+BOOL APIENTRY
+NtUserSetLogonNotifyWindow(HWND hWnd)
+{
+ if(LogonProcess != PsGetCurrentProcessWin32Process())
+ {
+ return FALSE;
+ }
+
+ if(!IntIsWindow(hWnd))
+ {
+ return FALSE;
+ }
+
+ hwndSAS = hWnd;
+
+ return TRUE;
+}
+
/* EOF */