/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include <ctype.h>
int
main ()
{
char *DriverFullPath = "\\SystemRoot\\system32\\ntoskrnl.exe";
char upper;
long IndexHash = 0x4CB2F;
while (*DriverFullPath)
{
upper = toupper (*DriverFullPath);
IndexHash = 0x25 * (upper + 0x25 * IndexHash);
DriverFullPath++;
}
printf ("%lx\n", IndexHash);
int size = (0x800 >> 5) - 1;
long tmp = IndexHash & (-1 << (0x800 & 0x1F));
char *byte = (char *) &tmp;
long index =
(0x25 * (*(byte + 6) +
0x25 * (*(byte + 5) +
0x25 * (*(byte + 4) +
0x25 * (*(byte + 3) +
0x25 * (*(byte + 2) +
0x25 * (*(byte + 1) +
0x25 * (*byte +
0xB15DCB))))))) +
*(byte + 7)) & size;
printf ("%lx\n", index);
}