View difference between Paste ID: Hq0Xs81b and 1bzywf7K
SHOW: | | - or go back to the newest paste.
1-
#include <stdio.h>
1+
2-
2+
    BOOL  isBlocked = !pRange->isEnabled; //sanitize
3-
typedef unsigned char  BYTE;
3+
    DWORD i=pRange->first, iAmount=(pRange->last-i)+1;
4-
typedef unsigned short WORD;
4+
    DWORD *pdwIopm = (dword*)pdwIopm;
5-
typedef unsigned int   DWORD;
5+
6-
typedef int            BOOL;
6+
    if (i&31) { //fill unaligned entries
7-
#define TRUE 1
7+
        int iLen = 32-(i&31);
8-
#define FALSE 0
8+
        if (IsBlocked) pdwIopm[i>>5] |= ((DWORD)-1)<<iLen); else pdwIopm[i>>5] &= ~((DWORD)-1)<<iLen);
9-
9+
        i = (i|31)+1 ; iAmount -= iLen;
10-
#define IOPM_SIZE           0x2000
10+
11-
11+
12-
typedef struct _PORTRANGE {
12+
    i>>=5; //fill bulk entries
13-
    WORD first;
13+
    while (iAmount>31) pdwIopm[i++] = (DWORD)(isBlocked?-1:0), iAmount -= 32;
14-
    WORD last;
14+
15-
    BOOL isEnabled;
15+
    if (iAmount) { //fill remaining entries
16-
} PORTRANGE;
16+
        int iLen = 32-(iAmount);
17-
17+
        if (IsBlocked) pdwIopm(i) |= ((DWORD)-1)>>iLen) else pdwIopm(i) &= ~((DWORD)-1)>>iLen);
18-
18+
19-
19+
}