简体   繁体   English

加载ntuser.dat之前的Winlogon通知服务

[英]Winlogon Notification Service before ntuser.dat is loaded

I'm trying to make a Winlogon notification service that receive the logon message and then copies ntuser.dat (registry) from a central location (like roaming profile do) and when logoffs, reverts this (copy ntuser.dat to central location). 我正在尝试制作一个Winlogon通知服务,该服务接收登录消息,然后从中央位置复制ntuser.dat(注册表)(如漫游配置文件一样),并在注销时将其还原(将ntuser.dat复制到中央位置)。 I already made the service and it receives the SENS message, but I think SENS messages are received AFTER ntuser.dat is loaded; 我已经完成了该服务,并且它接收到SENS消息,但是我认为在加载ntuser.dat之后会收到SENS消息。 so I receive a "file in use message" trying to interact with ntuser.dat. 因此我收到试图与ntuser.dat交互的“正在使用文件消息”。 I think SENS is not the way to do this, but the old hklm\\xxx\\x\\x\\winlogon\\notify way is not working on windows vista and UP. 我认为SENS并非实现此目的的方法,但是旧的hklm \\ xxx \\ x \\ x \\ winlogon \\ notify方法无法在Windows Vista和UP上运行。 So I'm lost here. 所以我在这里迷路了。

How can I do a service or DLL to stop logon process until I move the ntuser.dat to the user profile? 在将ntuser.dat移至用户配置文件之前,如何执行服务或DLL来停止登录过程?

Thanks in advance. 提前致谢。


After a lot of research (The documentation is very old and outdated) I understood why the SENS (System Event Notification Service) does not work for this task. 经过大量研究(文档非常陈旧且过时),我理解了为什么SENS(系统事件通知服务)无法用于此任务。

The SENS service is one layer below the notification services of Winlogon, in fact, the SENS itself is a service registered to Winlogon to receive notifications, and then, the SENS informs all the services that implement this second layer COM interfaces about changes in the states of the sessions such as Logon, Logoff, etc. SENS服务位于Winlogon的通知服务之下的一层,实际上,SENS本身是向Winlogon注册的用于接收通知的服务,然后,SENS会将状态变化通知实施第二层COM接口的所有服务。会话,例如登录,注销等。

The user profile service (ProfSvc) is also a service that, like SENS, receives notifications from Winlogon and is responsible for executing the policies and movements of the NTUSER.DAT and other issues related to the registry and the user profile. 用户配置文件服务(ProfSvc)也是一种服务,与SENS一样,从Winlogon接收通知,并负责执行NTUSER.DAT的策略和移动以及与注册表和用户配置文件有关的其他问题。

Investigating a little more, I found that there is a registry key that controls the behavior of these services: 经过进一步调查,我发现有一个注册表项可以控制这些服务的行为:

HKLM \ System \ CurrectControlSet \ Control \ Winlogon \ Notifications \ Configurations

And the order about how to load or call this services its on: 以及有关如何加载或调用此服务的顺序:

HKLM \ System \ CurrectControlSet \ Control \ Winlogon \ Notifications \ Configurations \ Default 

Under this Key are some REG_SZ with the possible events, like: Logon, Logoff, EndShell, Unlock, etc and the content its a comma separated string with the name of the service to load in order to notify. 在此注册表项下是一些REG_SZ,其中包含可能的事件,例如:登录,注销,EndShell,解锁等,其内容以逗号分隔的字符串以及要通知的要加载的服务名称。

I make a service and add the registry keys, and can get winlogon to try to call my service, but the Logon process was stopped with an error like this: 我提供了一项服务并添加了注册表项,并且可以获取winlogon来尝试调用我的服务,但是登录过程已停止,并显示如下错误:

Event ID: 6001 Description: The winlogon notification subscriber failed a notification event. 事件ID:6001说明:Winlogon通知订阅者未能通知事件。

Event ID: 6004 Description: The winlogon notification subscriber failed a critical notification event. 事件ID:6004说明:Winlogon通知订阅者未能通过关键通知事件。

I dont know what to answer or what COM objects to implement to receive the event and answer... 我不知道要回答什么或要实现什么COM对象来接收事件和答案...

My service its already executing before profile service, so if i can answer to Winlogon, i managed to solve a Custom Roaming Profile Service for Windows. 我的服务在配置文件服务之前已经执行完毕,因此,如果我可以回答Winlogon,就可以解决Windows的自定义漫游配置文件服务。

Anybody? 有人吗

Have a look at HandlerEx function of the services. 看一下服务的HandlerEx功能。

One of control events is SERVICE_CONTROL_SESSIONCHANGE . 控制事件之一是SERVICE_CONTROL_SESSIONCHANGE

If dwControl is SERVICE_CONTROL_SESSIONCHANGE, this parameter can be one of the values specified in the wParam parameter of the WM_WTSSESSION_CHANGE message. 如果dwControl为SERVICE_CONTROL_SESSIONCHANGE,则此参数可以是WM_WTSSESSION_CHANGE消息的wParam参数中指定的值之一。

its parameter dwEventType wil be one of WTS_SESSION_LOGON and WTS_SESSION_LOGOFF (as described here and here ) 其参数dwEventType将是WTS_SESSION_LOGONWTS_SESSION_LOGOFF (如此此处所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM