68 CHAR szFuncBuffer[128];
70 dwSize =
sizeof(szFuncBuffer);
98 HKEY hNotifyKey, hDllKey;
103 if (NotificationDll->bSfcNotification)
107 L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify",
113 ERR(
"RegOpenKeyExW(Winlogon\\Notify) failed, Error %lu\n", lError);
118 NotificationDll->pszKeyName,
126 ERR(
"RegOpenKeyExW(%S) failed, Error %lu\n", NotificationDll->pszKeyName, lError);
133 ERR(
"LoadLibraryW(%S) failed, Error %lu\n", NotificationDll->pszDllName,
GetLastError());
137 NotificationDll->hModule =
hModule;
189 sizeof(*NotificationDll));
190 if (!NotificationDll)
209 ERR(
"LoadLibraryW(%S) failed, Error %lu\n", szSfcPath, dwError);
219 ERR(
"Couldn't snap SfcWLEventLogon/SfcWLEventLogoff\n");
245 TRACE(
"AddNotificationDll(0x%p, %S)\n", hNotifyKey, pszKeyName);
268 bSafeMode = !!dwValue;
283 sizeof(*NotificationDll));
284 if (!NotificationDll)
385 L"SmartCardLogonNotify",
428 TRACE(
"InitNotifications()\n");
435 L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify",
441 TRACE(
"RegOpenKeyExW()\n");
445 for (dwIndex = 0; ; ++dwIndex)
459 TRACE(
"Notification DLL: %S\n", szKeyName);
465 TRACE(
"InitNotifications() done\n");
483 if (!NotificationDll->hModule)
488 NotificationDll->bEnabled =
FALSE;
491 ASSERT(NotificationDll->hModule);
495 pNotifyHandler = NotificationDll->Handler[
Type];
504 UserToken = (NotificationDll->bImpersonate ?
Info.hToken :
NULL);
507 ERR(
"WL: ImpersonateLoggedOnUser() failed with error %lu\n",
GetLastError());
514 pNotifyHandler(&
Info);
518 ERR(
"WL: Exception 0x%08lx hit by notification DLL %ws while executing %s notify function\n",
582 ListEntry = ListEntry->
Flink)
static LIST_ENTRY NotificationDllListHead
static VOID CallNotificationDll(_In_ PNOTIFICATION_ITEM NotificationDll, _In_ NOTIFICATION_TYPE Type, _In_ PWLX_NOTIFICATION_INFO pInfo)
static VOID AddNotificationDll(_In_ HKEY hNotifyKey, _In_ PCWSTR pszKeyName)
static VOID DeleteNotification(_In_ PNOTIFICATION_ITEM Notification)
Frees the resources associated to a notification.
static PSTR FuncNames[LastHandler]
struct _NOTIFICATION_ITEM NOTIFICATION_ITEM
VOID(WINAPI * PWLX_NOTIFY_HANDLER)(PWLX_NOTIFICATION_INFO pInfo)
BOOL InitNotifications(VOID)
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
struct _NOTIFICATION_ITEM * PNOTIFICATION_ITEM
static BOOL LoadNotifyDll(_Inout_ PNOTIFICATION_ITEM NotificationDll)
Loads the notification DLL and retrieves its exported notification handlers.
static PWLX_NOTIFY_HANDLER GetNotificationHandler(_In_ HKEY hDllKey, _In_ HMODULE hModule, _In_ PCSTR pNotification)
Retrieves the address of the exported notification handler, specified in the registry entry for the n...
VOID CleanupNotifications(VOID)
static VOID AddSfcNotification(VOID)
Initializes the internal SFC notifications.
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
#define GetProcAddress(x, y)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
BOOL WINAPI RevertToSelf(void)
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define EXCEPTION_EXECUTE_HANDLER
#define ERROR_FILE_NOT_FOUND
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
struct _LIST_ENTRY * Flink
PWLX_NOTIFY_HANDLER Handler[LastHandler]
PWSTR InteractiveWindowStationName
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ PWDFDEVICE_INIT _In_ PFN_WDF_DEVICE_SHUTDOWN_NOTIFICATION Notification
DWORD WINAPI GetLastError(void)
#define ERROR_PROC_NOT_FOUND
PWSTR WlStrDup(_In_opt_ PCWSTR String)
Duplicates the given string, allocating a buffer on the heap.
@ StartScreenSaverHandler
#define HKEY_LOCAL_MACHINE
int WINAPI GetSystemMetrics(_In_ int)