mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 23:21:21 +00:00
[NTDLL/LDR]
- Don't use -1 for USHORT LDR_DATA_TABLE_ENTRY::LoadCount. When comparing ((USHORT)-1) == 0xFFFF vs (int)-1 it ends in comparison 0xFFFF vs 0xFFFFFFFF with is wrong. Fixes shutdown from shell See issue #6345 for more details. svn path=/trunk/; revision=52601
This commit is contained in:
parent
38990db5fd
commit
cc5bf5ecd5
1 changed files with 11 additions and 11 deletions
|
@ -105,7 +105,7 @@ LdrpUpdateLoadCount3(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||||
FALSE,
|
FALSE,
|
||||||
&Entry))
|
&Entry))
|
||||||
{
|
{
|
||||||
if (Entry->LoadCount != -1)
|
if (Entry->LoadCount != 0xFFFF)
|
||||||
{
|
{
|
||||||
/* Perform the required action */
|
/* Perform the required action */
|
||||||
switch (Flags)
|
switch (Flags)
|
||||||
|
@ -117,7 +117,7 @@ LdrpUpdateLoadCount3(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||||
Entry->LoadCount--;
|
Entry->LoadCount--;
|
||||||
break;
|
break;
|
||||||
case LDRP_UPDATE_PIN:
|
case LDRP_UPDATE_PIN:
|
||||||
Entry->LoadCount = -1;
|
Entry->LoadCount = 0xFFFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ LdrpUpdateLoadCount3(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||||
FALSE,
|
FALSE,
|
||||||
&Entry))
|
&Entry))
|
||||||
{
|
{
|
||||||
if (Entry->LoadCount != -1)
|
if (Entry->LoadCount != 0xFFFF)
|
||||||
{
|
{
|
||||||
/* Perform the required action */
|
/* Perform the required action */
|
||||||
switch (Flags)
|
switch (Flags)
|
||||||
|
@ -161,7 +161,7 @@ LdrpUpdateLoadCount3(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||||
Entry->LoadCount--;
|
Entry->LoadCount--;
|
||||||
break;
|
break;
|
||||||
case LDRP_UPDATE_PIN:
|
case LDRP_UPDATE_PIN:
|
||||||
Entry->LoadCount = -1;
|
Entry->LoadCount = 0xFFFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ LdrpUpdateLoadCount3(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||||
FALSE,
|
FALSE,
|
||||||
&Entry))
|
&Entry))
|
||||||
{
|
{
|
||||||
if (Entry->LoadCount != -1)
|
if (Entry->LoadCount != 0xFFFF)
|
||||||
{
|
{
|
||||||
/* Perform the required action */
|
/* Perform the required action */
|
||||||
switch (Flags)
|
switch (Flags)
|
||||||
|
@ -230,7 +230,7 @@ LdrpUpdateLoadCount3(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||||
Entry->LoadCount--;
|
Entry->LoadCount--;
|
||||||
break;
|
break;
|
||||||
case LDRP_UPDATE_PIN:
|
case LDRP_UPDATE_PIN:
|
||||||
Entry->LoadCount = -1;
|
Entry->LoadCount = 0xFFFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1963,7 +1963,7 @@ StartLoop:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update load count, unless it's locked */
|
/* Update load count, unless it's locked */
|
||||||
if (LdrEntry->LoadCount != -1) LdrEntry->LoadCount++;
|
if (LdrEntry->LoadCount != 0xFFFF) LdrEntry->LoadCount++;
|
||||||
LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_REFCOUNT);
|
LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_REFCOUNT);
|
||||||
|
|
||||||
/* Check if we failed */
|
/* Check if we failed */
|
||||||
|
@ -1982,7 +1982,7 @@ StartLoop:
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (LdrEntry->LoadCount != -1)
|
else if (LdrEntry->LoadCount != 0xFFFF)
|
||||||
{
|
{
|
||||||
/* Increase load count */
|
/* Increase load count */
|
||||||
LdrEntry->LoadCount++;
|
LdrEntry->LoadCount++;
|
||||||
|
@ -2014,7 +2014,7 @@ StartLoop:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We were already loaded. Are we a DLL? */
|
/* We were already loaded. Are we a DLL? */
|
||||||
if ((LdrEntry->Flags & LDRP_IMAGE_DLL) && (LdrEntry->LoadCount != -1))
|
if ((LdrEntry->Flags & LDRP_IMAGE_DLL) && (LdrEntry->LoadCount != 0xFFFF))
|
||||||
{
|
{
|
||||||
/* Increase load count */
|
/* Increase load count */
|
||||||
LdrEntry->LoadCount++;
|
LdrEntry->LoadCount++;
|
||||||
|
@ -2026,7 +2026,7 @@ StartLoop:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Not a DLL, just increase the load count */
|
/* Not a DLL, just increase the load count */
|
||||||
if (LdrEntry->LoadCount != -1) LdrEntry->LoadCount++;
|
if (LdrEntry->LoadCount != 0xFFFF) LdrEntry->LoadCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2084,7 +2084,7 @@ LdrUnloadDll(IN PVOID BaseAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the current Load Count */
|
/* Check the current Load Count */
|
||||||
if (LdrEntry->LoadCount != -1)
|
if (LdrEntry->LoadCount != 0xFFFF)
|
||||||
{
|
{
|
||||||
/* Decrease it */
|
/* Decrease it */
|
||||||
LdrEntry->LoadCount--;
|
LdrEntry->LoadCount--;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue