Bitdefender Hypervisor Memory Introspection
bitmask.h File Reference
#include "introtypes.h"

Go to the source code of this file.

Data Structures

struct  _BITMASK
 Represents a bit mask. More...
 

Typedefs

typedef struct _BITMASK BITMASK
 Represents a bit mask. More...
 

Functions

BITMASKBitMaskAlloc (size_t Size)
 Creates a new BITMASK. More...
 
void BitMaskFree (BITMASK **BitMask)
 Frees a BITMASK allocated by BitMaskAlloc. More...
 
void BitMaskSet (BITMASK *BitMask, DWORD BitPos)
 Sets a bit in a BITMASK. More...
 
void BitMaskClear (BITMASK *BitMask, DWORD BitPos)
 Clears a bit in a BITMASK. More...
 
BYTE BitMaskTest (BITMASK *BitMask, DWORD BitPos)
 Tests a bit in a BITMASK. More...
 
BYTE BitMaskTestAndSet (BITMASK *BitMask, DWORD BitPos)
 Tests and sets a bit in a BITMASK. More...
 
BYTE BitMaskTestAndReset (BITMASK *BitMask, DWORD BitPos)
 Tests and clears a bit in a BITMASK. More...
 
DWORD BitMaskScanForward (BITMASK *BitMask)
 Search for a set bit starting from the least significant bit. More...
 

Typedef Documentation

◆ BITMASK

typedef struct _BITMASK BITMASK

Represents a bit mask.

Note that this structure has a variable size.

Function Documentation

◆ BitMaskAlloc()

BITMASK* BitMaskAlloc ( size_t  Size)

Creates a new BITMASK.

The actual size of the BITMASK.Bits array will be (Size / 8) is Size is divisible by 8, otherwise (Size / 8) + 1.

Parameters
[in]SizeThe number of bits in the bit mask.
Returns
On success, a pointer to the newly created BITMASK. The caller must free this using BitMaskFree. On failure, NULL. All bits will be set to 0.

Definition at line 56 of file bitmask.c.

Referenced by IntWinNetParseTcpBitmap().

◆ BitMaskClear()

void BitMaskClear ( BITMASK BitMask,
DWORD  BitPos 
)

Clears a bit in a BITMASK.

If the given bit is not a member of the BITMASK this function does nothing.

Parameters
[in,out]BitMaskThe bit mask in which to clear the bit.
[in]BitPosThe position of the bit.

Definition at line 124 of file bitmask.c.

◆ BitMaskFree()

void BitMaskFree ( BITMASK **  BitMask)

Frees a BITMASK allocated by BitMaskAlloc.

Parameters
[in,out]BitMaskPointer to the BITMASK pointer to be freed. Upon return will point to NULL.

Definition at line 83 of file bitmask.c.

Referenced by IntWinNetParseTcpBitmap().

◆ BitMaskScanForward()

DWORD BitMaskScanForward ( BITMASK BitMask)

Search for a set bit starting from the least significant bit.

Parameters
[in]BitMaskThe bit mask in which to search the bit.
Returns
The position of the first set (1) bit found. If no bit is found, the returned value is -1.

Definition at line 249 of file bitmask.c.

◆ BitMaskSet()

void BitMaskSet ( BITMASK BitMask,
DWORD  BitPos 
)

Sets a bit in a BITMASK.

If the given bit is not a member of the BITMASK this function does nothing.

Parameters
[in,out]BitMaskThe bit mask in which to set the bit.
[in]BitPosThe position of the bit.

Definition at line 97 of file bitmask.c.

◆ BitMaskTest()

BYTE BitMaskTest ( BITMASK BitMask,
DWORD  BitPos 
)

Tests a bit in a BITMASK.

If the given bit is not a member of the BITMASK this function does nothing.

Parameters
[in,out]BitMaskThe bit mask in which to test the bit.
[in]BitPosThe position of the bit.
Returns
1 if the bit is set, 0 if the bit is not set.

Definition at line 151 of file bitmask.c.

Referenced by IntWinNetParseTcpBitmap().

◆ BitMaskTestAndReset()

BYTE BitMaskTestAndReset ( BITMASK BitMask,
DWORD  BitPos 
)

Tests and clears a bit in a BITMASK.

If the given bit is not a member of the BITMASK this function does nothing.

Parameters
[in,out]BitMaskThe bit mask in which to test and clear the bit. After this function returns, the bit at BitPos will be cleared.
[in]BitPosThe position of the bit.
Returns
THe old value of the bit at BitPos (1 if it was set, 0 if it was not set).

Definition at line 214 of file bitmask.c.

◆ BitMaskTestAndSet()

BYTE BitMaskTestAndSet ( BITMASK BitMask,
DWORD  BitPos 
)

Tests and sets a bit in a BITMASK.

If the given bit is not a member of the BITMASK this function does nothing.

Parameters
[in,out]BitMaskThe bit mask in which to test and set the bit. After this function returns, the bit at BitPos will be set.
[in]BitPosThe position of the bit.
Returns
THe old value of the bit at BitPos (1 if it was set, 0 if it was not set).

Definition at line 180 of file bitmask.c.