From 6137e4a401e7fecee8935712de27ac132e41615b Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Thu, 5 May 2016 14:13:29 +0000 Subject: [PATCH] [NTOSKRNL] Fix NtApphelpCacheControl image lookup failure return codes when validating file times. Also silence some debug outputs in the normal usage flow. svn path=/trunk/; revision=71263 --- reactos/ntoskrnl/ps/apphelp.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/reactos/ntoskrnl/ps/apphelp.c b/reactos/ntoskrnl/ps/apphelp.c index bc2a3077ba7..11ae406bc21 100644 --- a/reactos/ntoskrnl/ps/apphelp.c +++ b/reactos/ntoskrnl/ps/apphelp.c @@ -546,14 +546,14 @@ ApphelpCacheLookupEntry( Entry = RtlLookupElementGenericTableAvl(&ApphelpShimCache, &Lookup); if (Entry == NULL) { - DPRINT1("SHIMS: ApphelpCacheLookupEntry: could not find %wZ\n", ImageName); + DPRINT("SHIMS: ApphelpCacheLookupEntry: could not find %wZ\n", ImageName); goto Cleanup; } - DPRINT1("SHIMS: ApphelpCacheLookupEntry: found %wZ\n", ImageName); + DPRINT("SHIMS: ApphelpCacheLookupEntry: found %wZ\n", ImageName); if (ImageHandle == INVALID_HANDLE_VALUE) { - DPRINT1("SHIMS: ApphelpCacheLookupEntry: ok\n"); + DPRINT("SHIMS: ApphelpCacheLookupEntry: ok\n"); /* just return if we know it, do not query file info */ Status = STATUS_SUCCESS; } @@ -564,7 +564,7 @@ ApphelpCacheLookupEntry( Lookup.Persistent.DateTime.QuadPart == Entry->Persistent.DateTime.QuadPart && Lookup.Persistent.FileSize.QuadPart == Entry->Persistent.FileSize.QuadPart) { - DPRINT1("SHIMS: ApphelpCacheLookupEntry: found & validated\n"); + DPRINT("SHIMS: ApphelpCacheLookupEntry: found & validated\n"); Status = STATUS_SUCCESS; /* move it to the front to keep it alive */ RemoveEntryList(&Entry->List); @@ -572,7 +572,8 @@ ApphelpCacheLookupEntry( } else { - DPRINT1("SHIMS: ApphelpCacheLookupEntry: file info mismatch\n"); + DPRINT1("SHIMS: ApphelpCacheLookupEntry: file info mismatch (%lx)\n", Status); + Status = STATUS_NOT_FOUND; /* Could not read file info, or it did not match, drop it from the cache */ ApphelpCacheRemoveEntryNolock(Entry); } @@ -642,7 +643,7 @@ ApphelpCacheUpdateEntry( &NodeOrParent, &SearchResult); if (Lookup) { - DPRINT1("SHIMS: ApphelpCacheUpdateEntry: Entry already exists, reusing it\n"); + DPRINT("SHIMS: ApphelpCacheUpdateEntry: Entry already exists, reusing it\n"); /* Unlink the found item, so we can put it back at the front, and copy the earlier obtained file info*/ RemoveEntryList(&Lookup->List); @@ -651,7 +652,7 @@ ApphelpCacheUpdateEntry( } else { - DPRINT1("SHIMS: ApphelpCacheUpdateEntry: Inserting new Entry\n"); + DPRINT("SHIMS: ApphelpCacheUpdateEntry: Inserting new Entry\n"); /* Insert a new entry, with its own copy of the ImageName */ ApphelpDuplicateUnicodeString(&Entry.Persistent.ImageName, ImageName); Lookup = RtlInsertElementGenericTableFullAvl(&ApphelpShimCache, @@ -705,7 +706,7 @@ ApphelpCacheDump(VOID) PLIST_ENTRY ListEntry; PSHIM_CACHE_ENTRY Entry; - DPRINT1("SHIMS: NtApphelpCacheControl( Dumping entries, newset to oldest )\n"); + DPRINT1("SHIMS: NtApphelpCacheControl( Dumping entries, newest to oldest )\n"); ApphelpCacheAcquireLock(); ListEntry = ApphelpShimCacheAge.Flink; while (ListEntry != &ApphelpShimCacheAge) @@ -741,19 +742,19 @@ NtApphelpCacheControl( switch (Service) { case ApphelpCacheServiceLookup: - DPRINT1("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceLookup )\n"); + DPRINT("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceLookup )\n"); Status = ApphelpValidateData(ServiceData, &ImageName, &Handle); if (NT_SUCCESS(Status)) Status = ApphelpCacheLookupEntry(&ImageName, Handle); break; case ApphelpCacheServiceRemove: - DPRINT1("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceRemove )\n"); + DPRINT("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceRemove )\n"); Status = ApphelpValidateData(ServiceData, &ImageName, &Handle); if (NT_SUCCESS(Status)) Status = ApphelpCacheRemoveEntry(&ImageName); break; case ApphelpCacheServiceUpdate: - DPRINT1("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceUpdate )\n"); + DPRINT("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceUpdate )\n"); Status = ApphelpCacheAccessCheck(); if (NT_SUCCESS(Status)) {