[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
This commit is contained in:
Mark Jansen 2016-05-05 14:13:29 +00:00
parent 7d65f2a648
commit 6137e4a401

View file

@ -546,14 +546,14 @@ ApphelpCacheLookupEntry(
Entry = RtlLookupElementGenericTableAvl(&ApphelpShimCache, &Lookup); Entry = RtlLookupElementGenericTableAvl(&ApphelpShimCache, &Lookup);
if (Entry == NULL) if (Entry == NULL)
{ {
DPRINT1("SHIMS: ApphelpCacheLookupEntry: could not find %wZ\n", ImageName); DPRINT("SHIMS: ApphelpCacheLookupEntry: could not find %wZ\n", ImageName);
goto Cleanup; goto Cleanup;
} }
DPRINT1("SHIMS: ApphelpCacheLookupEntry: found %wZ\n", ImageName); DPRINT("SHIMS: ApphelpCacheLookupEntry: found %wZ\n", ImageName);
if (ImageHandle == INVALID_HANDLE_VALUE) 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 */ /* just return if we know it, do not query file info */
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
} }
@ -564,7 +564,7 @@ ApphelpCacheLookupEntry(
Lookup.Persistent.DateTime.QuadPart == Entry->Persistent.DateTime.QuadPart && Lookup.Persistent.DateTime.QuadPart == Entry->Persistent.DateTime.QuadPart &&
Lookup.Persistent.FileSize.QuadPart == Entry->Persistent.FileSize.QuadPart) Lookup.Persistent.FileSize.QuadPart == Entry->Persistent.FileSize.QuadPart)
{ {
DPRINT1("SHIMS: ApphelpCacheLookupEntry: found & validated\n"); DPRINT("SHIMS: ApphelpCacheLookupEntry: found & validated\n");
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
/* move it to the front to keep it alive */ /* move it to the front to keep it alive */
RemoveEntryList(&Entry->List); RemoveEntryList(&Entry->List);
@ -572,7 +572,8 @@ ApphelpCacheLookupEntry(
} }
else 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 */ /* Could not read file info, or it did not match, drop it from the cache */
ApphelpCacheRemoveEntryNolock(Entry); ApphelpCacheRemoveEntryNolock(Entry);
} }
@ -642,7 +643,7 @@ ApphelpCacheUpdateEntry(
&NodeOrParent, &SearchResult); &NodeOrParent, &SearchResult);
if (Lookup) 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, /* Unlink the found item, so we can put it back at the front,
and copy the earlier obtained file info*/ and copy the earlier obtained file info*/
RemoveEntryList(&Lookup->List); RemoveEntryList(&Lookup->List);
@ -651,7 +652,7 @@ ApphelpCacheUpdateEntry(
} }
else 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 */ /* Insert a new entry, with its own copy of the ImageName */
ApphelpDuplicateUnicodeString(&Entry.Persistent.ImageName, ImageName); ApphelpDuplicateUnicodeString(&Entry.Persistent.ImageName, ImageName);
Lookup = RtlInsertElementGenericTableFullAvl(&ApphelpShimCache, Lookup = RtlInsertElementGenericTableFullAvl(&ApphelpShimCache,
@ -705,7 +706,7 @@ ApphelpCacheDump(VOID)
PLIST_ENTRY ListEntry; PLIST_ENTRY ListEntry;
PSHIM_CACHE_ENTRY Entry; PSHIM_CACHE_ENTRY Entry;
DPRINT1("SHIMS: NtApphelpCacheControl( Dumping entries, newset to oldest )\n"); DPRINT1("SHIMS: NtApphelpCacheControl( Dumping entries, newest to oldest )\n");
ApphelpCacheAcquireLock(); ApphelpCacheAcquireLock();
ListEntry = ApphelpShimCacheAge.Flink; ListEntry = ApphelpShimCacheAge.Flink;
while (ListEntry != &ApphelpShimCacheAge) while (ListEntry != &ApphelpShimCacheAge)
@ -741,19 +742,19 @@ NtApphelpCacheControl(
switch (Service) switch (Service)
{ {
case ApphelpCacheServiceLookup: case ApphelpCacheServiceLookup:
DPRINT1("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceLookup )\n"); DPRINT("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceLookup )\n");
Status = ApphelpValidateData(ServiceData, &ImageName, &Handle); Status = ApphelpValidateData(ServiceData, &ImageName, &Handle);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
Status = ApphelpCacheLookupEntry(&ImageName, Handle); Status = ApphelpCacheLookupEntry(&ImageName, Handle);
break; break;
case ApphelpCacheServiceRemove: case ApphelpCacheServiceRemove:
DPRINT1("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceRemove )\n"); DPRINT("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceRemove )\n");
Status = ApphelpValidateData(ServiceData, &ImageName, &Handle); Status = ApphelpValidateData(ServiceData, &ImageName, &Handle);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
Status = ApphelpCacheRemoveEntry(&ImageName); Status = ApphelpCacheRemoveEntry(&ImageName);
break; break;
case ApphelpCacheServiceUpdate: case ApphelpCacheServiceUpdate:
DPRINT1("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceUpdate )\n"); DPRINT("SHIMS: NtApphelpCacheControl( ApphelpCacheServiceUpdate )\n");
Status = ApphelpCacheAccessCheck(); Status = ApphelpCacheAccessCheck();
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {