Migrating VC6 driver project to VC8 with DDK 2003

    From: xuyibo.org  Date: 2021-03-18 05:27 PM

    We have VC6 driver project configured as described in Creating Driver project for Visual Studio 6.0 article. Our task is to build it with minimal efforts under Visual Studio 8 using DDK 2003. Also we want to keep compatibility with previous versions of Visual Studio and DDK. At least .MAK file generated from VC6 .DSP project shall work with nmake utility under all environments.

    Note: Sometimes DDK 2003 comes under name DDK XP, but DDK 2003 has very specific inc and lib directory structure:

    XP DDK DDK 2003
      atl21, atl30, crt, ddk, ifs,
      inc16, mfc42, w2k, wnet, wxp
        amd64, i386, ia64
        i386, ia64


    Solution N1 (by Alter)

    Note: All these steps must be performed for each build configuration (Debug/Release).

    Solution N2 (by DeathSoft)

    In order to get ___security_cookie, you have to add BufferOverflowK.lib to your project. You can get it from newer DDK. Set /entry:”GsDriverEntry@8″ option, this information can also be found in MSDN. To have no problems with /safeseh:yes (it is the default in new Visual Studio) add the following file to project:

    extern ULONG_PTR __security_cookie;  /* /GS security cookie */
     * The following two names are automatically created by the linker for any
     * image that has the safe exception table present.
    * /
    extern  PVOID __safe_se_handler_table[]; /* base of safe handler entry table * /
    extern  UCHAR  __safe_se_handler_count;  /* absolute symbol whose address is
                                               the count of table entries * /
    typedef struct {
        ULONG       Size;
        ULONG       TimeDateStamp;
        USHORT      MajorVersion;
        USHORT      MinorVersion;
        ULONG       GlobalFlagsClear;
        ULONG       GlobalFlagsSet;
        ULONG       CriticalSectionDefaultTimeout;
        ULONG       DeCommitFreeBlockThreshold;
        ULONG       DeCommitTotalFreeThreshold;
        ULONG       LockPrefixTable;            // VA
        ULONG       MaximumAllocationSize;
        ULONG       VirtualMemoryThreshold;
        ULONG       ProcessHeapFlags;
        ULONG       ProcessAffinityMask;
        USHORT      CSDVersion;
        USHORT      Reserved1;
        ULONG       EditList;                   // VA
        ULONG_PTR   *SecurityCookie;
        PVOID       *SEHandlerTable;
        ULONG       SEHandlerCount;
    const IMAGE_LOAD_CONFIG_DIRECTORY32_2 _load_config_used = {
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        (ULONG)(ULONG_PTR) &__safe_se_handler_count

    Solution N3

    Take pre-configured empty driver project for VS 2005 and add there your sources. You can find it together with VC6 project for kernel mode driver. Look in archive in pch_cpp subfolder. Also you can create VS8 project yourself with help of this manual: VC8 project for kernel mode driver.

    Practically, you will completley convert your project from VS6 to VS8.


Built on: 2021-5-14 0:13:03
Copyright © 2006-2008 xuyibo.org All rights reserved.