Advertisement
Mysoft

Untitled

Nov 11th, 2020
1,006
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void iopm_fillRange(BYTE pIopm[IOPM_SIZE], PORTRANGE* pRange) {
  2.     BOOL  isBlocked = !pRange->isEnabled; //sanitize
  3.     DWORD i=pRange->first, iAmount=(pRange->last-i)+1;
  4.     DWORD *pdwIopm = (dword*)pdwIopm;
  5.    
  6.     if (i&31) { //fill unaligned entries
  7.         int iLen = 32-(i&31);
  8.         if (IsBlocked) pdwIopm[i>>5] |= ((DWORD)-1)<<iLen); else pdwIopm[i>>5] &= ~((DWORD)-1)<<iLen);
  9.         i = (i|31)+1 ; iAmount -= iLen;
  10.     }
  11.    
  12.     i>>=5; //fill bulk entries
  13.     while (iAmount>31) pdwIopm[i++] = (DWORD)(isBlocked?-1:0), iAmount -= 32;
  14.    
  15.     if (iAmount) { //fill remaining entries
  16.         int iLen = 32-(iAmount);
  17.         if (IsBlocked) pdwIopm(i) |= ((DWORD)-1)>>iLen) else pdwIopm(i) &= ~((DWORD)-1)>>iLen);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement