replace ad hoc driver loading with a proper driver manager, new DDK, new PnP manager with device matching, asynchronous startup, resource ownership and removal, add shared PCI capability helpers, replace typed, rigid services with a proper service manager, implement proper system shutdown and restart, shutting down unloads drivers and shuts down services, add simple power button, remove heavyweight boot self-tests and SMP stress runs, add monotonic timestamps to kernel debug output, fruitless USB and PS/2 fixes, make test builds opt in.
This commit is contained in:
1 parent
c0ad63c27f
commit
d36f19509c
160 files changed
+6563
-7366
No files matched your search
@@ -1,10 +1,12 @@
|
||||
// Native Session 0 desktop/window manager. DWM owns window policy, composition, and visible cursor presentation.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ntlite/bootstrap_capabilities.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ntlite/desktop.h>
|
||||
#include <ntlite/resource.h>
|
||||
#include <ntlite/exception.h>
|
||||
#include <ntlite/internal/session_control.h>
|
||||
#include <ntlite/port.h>
|
||||
@@ -1156,10 +1158,11 @@ static KSTATUS DwmSendReady(SYS_HANDLE endpoint, SYS_HANDLE desktopListener) {
|
||||
message.Operation = NTL_SERVICE_CONTROL_READY;
|
||||
message.ExportCount = 1u;
|
||||
message.Status = NTLSTATUS_SUCCESS;
|
||||
if (!NtlServiceControlNameExport(&message, 0u, "desktop")) return NTLSTATUS_FAILURE;
|
||||
|
||||
SYS_PORT_HANDLE_TRANSFER transfer;
|
||||
transfer.Handle = desktopListener;
|
||||
transfer.DesiredRights = SYS_RIGHT_TRANSFER | SYS_RIGHT_QUERY | SYS_PORT_RIGHT_CONNECT;
|
||||
transfer.DesiredRights = SYS_RIGHT_DUPLICATE | SYS_RIGHT_TRANSFER | SYS_RIGHT_QUERY | SYS_PORT_RIGHT_CONNECT;
|
||||
transfer.Flags = SYS_PORT_TRANSFER_FLAG_NONE;
|
||||
|
||||
SYS_SEND_PORT_REQUEST send;
|
||||
@@ -1196,8 +1199,7 @@ static void DwmControlLoop(SYS_HANDLE endpoint) {
|
||||
if (status == NTLSTATUS_PORT_DISCONNECTED || !KSUCCESS(status)) return;
|
||||
if (info.Type != SYS_PORT_MESSAGE_NOTIFICATION || info.HandleCount != 0 ||
|
||||
info.PayloadLength != sizeof(message) || message.Size != sizeof(message) ||
|
||||
message.Version != NTL_SERVICE_CONTROL_VERSION || message.ExportCount != 0 ||
|
||||
message.Reserved[0] != 0 || message.Reserved[1] != 0 || message.Reserved[2] != 0)
|
||||
!NtlServiceControlValid(&message, NTL_SERVICE_CONTROL_STOP, 0u))
|
||||
continue;
|
||||
if (message.Operation == NTL_SERVICE_CONTROL_STOP) return;
|
||||
}
|
||||
@@ -1255,15 +1257,15 @@ void _start(void) {
|
||||
memset(&security, 0, sizeof(security));
|
||||
security.Size = sizeof(security);
|
||||
status = SysQuerySecurityContext(SYS_SECURITY_CONTEXT_CURRENT, &security);
|
||||
if (!KSUCCESS(status) || security.EffectivePrivileges != 0 || security.DelegablePrivileges != 0 ||
|
||||
security.ServiceClaims != 0 || security.DelegableServiceClaims != 0)
|
||||
if (!KSUCCESS(status) || security.EffectivePrivileges != 0 || security.DelegablePrivileges != 0)
|
||||
DwmExit(2);
|
||||
|
||||
SYS_HANDLE controlListener = SysGetStartupCapability(SYS_STARTUP_CAP_SERVICE_CONTROL);
|
||||
SYS_HANDLE displayManager = SysGetStartupCapability(SYS_STARTUP_CAP_DISPLAY_MANAGER);
|
||||
SYS_HANDLE sessionListener = SysGetStartupCapability(SYS_STARTUP_CAP_SESSION_CONTROL);
|
||||
SYS_HANDLE controlListener = SysGetStartupCapability("service.control");
|
||||
SYS_HANDLE displayManager = SysGetStartupCapability(NTL_BOOT_CAP_DISPLAY_PRESENT);
|
||||
SYS_HANDLE sessionListener = SysGetStartupCapability("rssrv.session-control");
|
||||
SYS_HANDLE publicationListener = SysGetStartupCapability("rssrv.desktop-publisher");
|
||||
if (controlListener == SYS_HANDLE_INVALID || displayManager == SYS_HANDLE_INVALID ||
|
||||
sessionListener == SYS_HANDLE_INVALID)
|
||||
sessionListener == SYS_HANDLE_INVALID || publicationListener == SYS_HANDLE_INVALID)
|
||||
DwmExit(3);
|
||||
|
||||
memset(&gDwm, 0, sizeof(gDwm));
|
||||
@@ -1322,10 +1324,21 @@ void _start(void) {
|
||||
DwmUnlock();
|
||||
}
|
||||
|
||||
SYS_HANDLE publication = SYS_HANDLE_INVALID;
|
||||
status = NtlResourceConnectListener(publicationListener, &publication);
|
||||
(void)SysCloseHandle(publicationListener);
|
||||
if (!KSUCCESS(status)) DwmExit(8);
|
||||
status = NtlResourceBind(publication, SYS_SV_LITERAL(NTL_DESKTOP_SERVICE_PATH),
|
||||
NTL_RESOURCE_KIND_CAPABILITY, gDwm.DesktopListener,
|
||||
SYS_RIGHT_TRANSFER | SYS_RIGHT_QUERY | SYS_PORT_RIGHT_CONNECT,
|
||||
SYS_RIGHT_QUERY | SYS_PORT_RIGHT_CONNECT);
|
||||
if (!KSUCCESS(status)) DwmExit(8);
|
||||
status = DwmSendReady(controlEndpoint, gDwm.DesktopListener);
|
||||
if (!KSUCCESS(status)) DwmExit(8);
|
||||
|
||||
DwmControlLoop(controlEndpoint);
|
||||
(void)NtlResourceUnbind(publication, SYS_SV_LITERAL(NTL_DESKTOP_SERVICE_PATH));
|
||||
(void)NtlResourceClose(publication);
|
||||
gDwm.Running = 0u;
|
||||
(void)SysSignalEvent(gDwm.DirtyEvent);
|
||||
(void)SysDisconnectPort(gDwm.SessionEndpoint);
|
||||
|
||||
Reference in new issue
Block a user