Skip to content

Commit

Permalink
Updated the NPF_EqualAdapterName function to not change the strings. …
Browse files Browse the repository at this point in the history
…Not using memcpy function will help the driver install on Win7 x86.
  • Loading branch information
hsluoyz committed Mar 26, 2016
1 parent 43ddc42 commit 125807d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packetWin7/npf/npf/Openclos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ NPF_EqualAdapterName(
)
{
int i;
BOOLEAN bResult;
BOOLEAN bResult = TRUE;
TRACE_ENTER();

if (s1->Length != s2->Length)
Expand All @@ -1084,17 +1084,29 @@ NPF_EqualAdapterName(

for (i = 0; i < s2->Length / 2; i ++)
{
if (s1->Buffer[i] >= L'A' && s1->Buffer[i] <= L'Z')
if (L'A' <= s1->Buffer[i] && s1->Buffer[i] <= L'Z')
{
s1->Buffer[i] += (L'a' - L'A');
if (s2->Buffer[i] - s1->Buffer[i] != 0 && s2->Buffer[i] - s1->Buffer[i] != L'a' - L'A')
{
bResult = FALSE;
break;
}
}
if (s2->Buffer[i] >= L'A' && s2->Buffer[i] <= L'Z')
else if (L'a' <= s1->Buffer[i] && s1->Buffer[i] <= L'z')
{
s2->Buffer[i] += (L'a' - L'A');
if (s2->Buffer[i] - s1->Buffer[i] != 0 && s2->Buffer[i] - s1->Buffer[i] != L'A' - L'a')
{
bResult = FALSE;
break;
}
}
else if (s2->Buffer[i] - s1->Buffer[i] != 0)
{
bResult = FALSE;
break;
}
}

bResult = RtlEqualMemory(s1->Buffer, s2->Buffer, s2->Length);
IF_LOUD(DbgPrint("NPF_EqualAdapterName: bResult = %d, s1 = %ws, s2 = %ws\n", i, bResult, s1->Buffer, s2->Buffer);)
TRACE_EXIT();
return bResult;
Expand Down

0 comments on commit 125807d

Please sign in to comment.