From 52b40cdd07613ce996b8d02b076370f918c58dbd Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 9 Jun 2003 13:45:22 +0000 Subject: [PATCH] Verify checksums of preloaded DLLs. svn path=/trunk/; revision=4876 --- reactos/subsys/smss/init.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/reactos/subsys/smss/init.c b/reactos/subsys/smss/init.c index a51c9639c76..303edf0bb32 100644 --- a/reactos/subsys/smss/init.c +++ b/reactos/subsys/smss/init.c @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.47 2003/05/14 21:27:53 ekohl Exp $ +/* $Id: init.c,v 1.48 2003/06/09 13:45:22 ekohl Exp $ * * init.c - Session Manager initialization * @@ -31,6 +31,7 @@ #include #include +#include #include #include "smss.h" @@ -407,9 +408,31 @@ SmKnownDllsQueryRoutine(PWSTR ValueName, PrintString("Opened file %wZ successfully\n", &ImageName); #endif + /* Check for valid image checksum */ + Status = LdrVerifyImageMatchesChecksum (FileHandle, + 0, + 0, + 0); + if (Status == STATUS_IMAGE_CHECKSUM_MISMATCH) + { + /* Raise a hard error (crash the system/BSOD) */ + NtRaiseHardError (Status, + 0, + 0, + 0, + 0, + 0); + } + else if (!NT_SUCCESS(Status)) + { +#ifndef NDEBUG + PrintString("Failed to check the image checksum\n"); +#endif + NtClose(SectionHandle); + NtClose(FileHandle); - /* FIXME: Check dll image file */ - + return STATUS_SUCCESS; + } InitializeObjectAttributes(&ObjectAttributes, &ImageName,