Supporting RGB 332 in 8bit mode

I am writing a Video Display Driver and trying to support RGB 332 mode in
8bit color depth. I am using my device as an additional display card on a
system. So there are two cards on the system. One is the default device and
the other is mine. My device works fine on RGB 332 when it is attached as a
secondary device. Whenever I make my device primary on 8bit color depth then
system crashes and after doing !analyze -v the following trace is generated:

****************************************************************************
***
*
*
* Bugcheck Analysis
*
*
*
****************************************************************************
***

Unknown bugcheck code (0)
Unknown bugcheck description
Arguments:
Arg1: 00000000
Arg2: 00000000
Arg3: 00000000
Arg4: 00000000

Debugging Details:

FAULTING_IP:
win32k!vSrcCopyS8D24+69
a0144939 8b1c87 mov ebx,[edi+eax*4]

EXCEPTION_RECORD: ffffffff -- (.exr ffffffffffffffff)
ExceptionAddress: a0144939 (win32k!vSrcCopyS8D24+0x00000069)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 00000000
Attempt to read from address 00000000

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx" referenced
memory at "0x%08lx". The memory could not be "%s".

READ_ADDRESS: 00000000

BUGCHECK_STR: ACCESS_VIOLATION

DEFAULT_BUCKET_ID: DRIVER_FAULT

LAST_CONTROL_TRANSFER: from a002f5d7 to a0144939

STACK_TEXT:
f2c7dbb0 a002f5d7 00000001 e2dedbd8 e2dedbd8 win32k!vSrcCopyS8D24+0x69
f2c7ddcc f30c402c e2dedbd8 00000000 e2d94b68 win32k!EngCopyBits+0x552
f2c7de58 a013adbc f30c3e50 e2d05958 e2dedbd8 i81xdnt5!HwEnable+0x14c
f2c7df18 a013af17 00000001 e1ddf010 00000000 win32k!MulBitBlt+0x315
f2c7df4c a0029e87 e2e00bd8 e1ddf010 f2c7dfec win32k!MulCopyBits+0x25
f2c7dfb0 a002a0d7 00000001 f2c7dfec e2e14d08 win32k!EngGradientFill+0x19e
f2c7e0c0 a002a1c4 e2e14d08 f2c7e0e0 00000002 win32k!GreGradientFill+0x43f
f2c7e120 a002a1f7 0101006b f2c7e42c 00808080 win32k!FillGradient+0x7b
f2c7e138 a0010a82 0101006b f2c7e42c 00000000 win32k!FillCaptionGradient+0x5b
f2c7e3d4 a00104e8 a032ca18 0101006b 01100073 win32k!xxxDrawCaptionTemp+0x2bb
f2c7e454 a00125b8 a032ca18 0101006b 0000980c win32k!xxxDrawCaptionBar+0x739
f2c7e498 a00894ea a032ca18 0101006b 00000000 win32k!xxxDrawWindowFrame+0x135
f2c7e4fc a00045fa a032ca18 00000085 00000001 win32k!xxxDefWindowProc+0x8c1
f2c7e510 a00045e1 a032ca18 00000085 00000001
win32k!xxxWrapDefWindowProc+0x15
f2c7e52c a0004588 a032ca18 00000085 00000001 win32k!NtUserfnDWORD+0x25
f2c7e560 80465691 000300b2 00000085 00000001 win32k!NtUserMessageCall+0x89
f2c7e560 77e137e7 000300b2 00000085 00000001 nt!KiSystemService+0xc4
0006d884 77e18da9 000300b2 00000085 00000001 USER32!NtUserMessageCall+0xb
0006d8c0 77e14720 000300b2 00000085 00000001 USER32!DefDlgProcWorker+0x7ac
0006d8e8 77fa15ef 0006d8f8 00000018 0037ca18 USER32!__fnDWORD+0x22
0006d90c 77e5003c 00000000 00000000 00000000
ntdll!KiUserCallbackDispatcher+0x13
f2c7e838 8043102e f2c7e8f8 f2c7e8f0 00000000 nt!KiCallUserMode+0x4
f2c7e89c a008a681 00000002 f2c7e8cc 00000018 nt!KeUserModeCallback+0xa6
f2c7eb2c a008a37b a032ca18 00000085 00000001 win32k!SfnDWORD+0xc2
f2c7eb84 a0004617 a032ca18 00000085 00000001
win32k!xxxSendMessageTimeout+0x2c7
f2c7eba4 a000f5c0 a032ca18 00000085 00000001 win32k!xxxSendMessage+0x1a
f2c7ebbc a001222a a032ca18 00000001 e2f10448 win32k!xxxSendNCPaint+0x5a
f2c7ebd4 a00123b7 a032ca18 e2f10448 e2d97650
win32k!xxxSimpleDoSyncPaint+0x7f
f2c7ebf8 a001242e a032ca18 00000004 e2f10448
win32k!xxxInternalDoSyncPaint+0x12
f2c7ec20 a00123a1 a03106e0 00000004 f2c7ec90
win32k!xxxInternalDoSyncPaint+0x7b
f2c7ec30 a000b289 a03106e0 00000004 a0310c74 win32k!xxxDoSyncPaint+0x2b
f2c7ec90 a00f0d49 00000001 00000000 e128cba8
win32k!xxxEndDeferWindowPosEx+0x239
f2c7eccc a00f232b e128cba8 821c78d8 00000001 win32k!xxxDesktopRecalc+0x15a
f2c7ed00 a00f25a5 821c78d8 a02c14b8 00000000
win32k!xxxResetDisplayDevice+0xa2
f2c7ed20 a00ddb9e 00000000 00000000 00000000
win32k!xxxUserChangeDisplaySettings+0x197
f2c7ed48 80465691 00000000 00000000 00000000
win32k!NtUserChangeDisplaySettings+0x48
f2c7ed48 77e5f150 00000000 00000000 00000000 nt!KiSystemService+0xc4
0006d930 77e5000b 00000000 00000000 00000000
USER32!NtUserChangeDisplaySettings+0xb
0006d948 65278ed8 00000000 00000040 77e133cc
USER32!ChangeDisplaySettingsW+0x1b
0006dd74 65278fda 0006dd8c 00000002 00030122
desk!CMultiMon::_DisplaySaveSettings+0x16f
0006ddb4 65279317 77e133cc 000a9bb8 00030122
desk!CMultiMon::_HandleApply+0x36
0006e02c 65278a3b 000a9bb8 0000004e 00000000 desk!CMultiMon::WndProc+0x25b
0006e050 77e12ca8 00030122 0000004e 00000000 desk!MultiMonitorDlgProc+0x3f
0006e070 77e189b9 652789fc 00030122 0000004e USER32!UserCallWinProc+0x18
0006e0ac 77e1451e 00030122 0000004e 00000000 USER32!DefDlgProcWorker+0xbf
0006e0dc 77e14925 0037d820 0000004e 00000000 USER32!SendMessageWorker+0x1cb
0006e0fc 77b56815 00030122 0000004e 00000000 USER32!SendMessageW+0x8c
0006e18c 77b53b0b 0006e1a8 ffffff36 0006e1e8 COMCTL32!CCSendNotify+0x766
0006e1cc 77b6f87e 00030122 000300b2 ffffff36 COMCTL32!SendNotifyEx+0x5c
0006e1f8 77b7043f 0008f148 00000005 ffffff36 COMCTL32!_Ppd_SendNotify+0x29

FOLLOWUP_IP:
i81xdnt5!HwEnable+14c
f30c402c 5f pop edi

SYMBOL_STACK_INDEX: 2

FOLLOWUP_NAME: MachineOwner

SYMBOL_NAME: i81xdnt5!HwEnable+14c

MODULE_NAME: i81xdnt5

IMAGE_NAME: i81xdnt5.dll

DEBUG_FLR_IMAGE_TIMESTAMP: 3b4c3282

STACK_COMMAND: kb

BUCKET_ID: ACCESS_VIOLATION_i81xdnt5!HwEnable+14c

Followup: MachineOwner

The problem is that this error is occuring in the system, and I have nothing
to do. Could any one please tell me about this bug or suggest some way so
that I can trace this error.

Thanks in Advance.