Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / ASM

Driver Development Part 6: Introduction to Display Drivers

Rate me:
Please Sign up or sign in to vote.
4.94/5 (82 votes)
29 Jan 200620 min read 617.9K   8.3K   363  
Introduction to the Windows display driver model.
/**********************************************************************
 * 
 *  Toby Opferman
 *
 *  Example Video Miniport Driver Entry Point
 *
 *  This example is for educational purposes only.  I license this source
 *  out for use in learning how to write a device driver.
 *
 *  Copyright (c) 2005, All Rights Reserved  
 **********************************************************************/
 
#define _X86_

#include <dderror.h>
#include <devioctl.h>
#include <miniport.h>
#include <ntddvdeo.h>
#include <video.h>

#include "fakegfxcard.h"
      
ULONG DriverEntry(PVOID pContext1, PVOID pContext2);

#pragma alloc_text(INIT, DriverEntry)


/**********************************************************************
 * 
 *  DriverEntry
 *
 *    This is the entry point for this video miniport driver
 *
 **********************************************************************/
ULONG DriverEntry(PVOID pContext1, PVOID pContext2)
{
    VIDEO_HW_INITIALIZATION_DATA hwInitData;
    VP_STATUS vpStatus;

    /*
     * The Video Miniport is "technically" restricted to calling "Video*" APIs.  There is
     * a driver that encapsulates this driver by setting your driver's entry points to
     * locations in itself.  It will then handle your IRP's for you and determine which
     * of the entry points (provided below) into your driver that should be called.
     *
     * This driver however does run in the context of system memory unlike the GDI component.
     *
     */

    VideoPortZeroMemory(&hwInitData, sizeof(VIDEO_HW_INITIALIZATION_DATA));

    hwInitData.HwInitDataSize            = sizeof(VIDEO_HW_INITIALIZATION_DATA);

    hwInitData.HwFindAdapter             = FakeGfxCard_FindAdapter;
    hwInitData.HwInitialize              = FakeGfxCard_Initialize;
    hwInitData.HwStartIO                 = FakeGfxCard_StartIO;
    hwInitData.HwResetHw                 = FakeGfxCard_ResetHW;
    hwInitData.HwInterrupt               = FakeGfxCard_VidInterrupt;
    hwInitData.HwGetPowerState           = FakeGfxCard_GetPowerState;
    hwInitData.HwSetPowerState           = FakeGfxCard_SetPowerState;
    hwInitData.HwGetVideoChildDescriptor = FakeGfxCard_GetChildDescriptor;

    vpStatus = VideoPortInitialize(pContext1, pContext2, &hwInitData, NULL);

    return vpStatus;
}


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Engineer Intel
United States United States
Toby Opferman has worked in just about all aspects of Windows development including applications, services and drivers.

He has also played a variety of roles professionally on a wide range of projects. This has included pure researching roles, architect roles and developer roles. He also was also solely responsible for debugging traps and blue screens for a number of years.

Previously of Citrix Systems he is very experienced in the area of Terminal Services. He currently works on Operating Systems and low level architecture at Intel.

He has started a youtube channel called "Checksum Error" that focuses on software.
https://www.youtube.com/channel/UCMN9q8DbU0dnllWpVRvn7Cw

Comments and Discussions