1.3.1 Cursor Directory

Each cursor-resource file starts with a cursor directory. The cursor directory, defined as a CURSORDIR structure, specifies the number of cursors in the file and the dimensions and color format of each cursor image. The CURSORDIR structure has the following form:

typedef struct _CURSORDIR {
    WORD           cdReserved;
    WORD           cdType;
    WORD           cdCount;
    CURSORDIRENTRY cdEntries[];
} CURSORDIR;

Following are the members in the CURSORDIR structure:

cdReserved

Reserved; must be zero.

cdType

Specifies the resource type. This member must be set to 2.

cdCount

Specifies the number of cursors in the file.

cdEntries

Specifies an array of CURSORDIRENTRY structures containing information about individual cursors. The cdCount member specifies the number of structures in the array.

A CURSORDIRENTRY structure specifies the dimensions and color format of a cursor image. The structure has the following form:

typedef struct _CURSORDIRENTRY {
    BYTE  bWidth;
    BYTE  bHeight;
    BYTE  bColorCount;
    BYTE  bReserved;
    WORD  wXHotspot;
    WORD  wYHotspot;
    DWORD lBytesInRes;
    DWORD dwImageOffset;
} CURSORDIRENTRY;

Following are the members in the CURSORDIRENTRY structure:

bWidth

Specifies the width of the cursor, in pixels.

bHeight

Specifies the height of the cursor, in pixels.

bColorCount

Reserved; must be zero.

bReserved

Reserved; must be zero.

wXHotspot

Specifies the x-coordinate, in pixels, of the hot spot.

wYHotspot

Specifies the y-coordinate, in pixels, of the hot spot.

lBytesInRes

Specifies the size of the resource, in bytes.

dwImageOffset

Specifies the offset, in bytes, from the start of the file to the cursor image.