Compile error when build Win DDK printer sample code -- oemuni in MVC6

Posted on 2008-11-08
Last Modified: 2013-12-14
I'm new in printer driver programming and want to learn through debugging through some printer sample codes in Win DDK. I crossed by BeyondWu's solution posted years ago regarding compile oemuni in MVC6, and following the instructions.

 And got following compiler errors:

--------------------Configuration: OEMUNI - Win32 Debug--------------------
c:\winddk\6001.18001\src\print\oemdll\oemuni\ddihook.cpp(56) : fatal error C1083: Cannot open precompiled header file: 'OEMUNI.pch': No such file or directory

My environment is: Win XP, WDK 6001.18001 and MVC6. I named the project "oemuni".
I notice that the sample code of "oemuni" has been changed in WDK 6001.18001,  since there's no "umode" subdirectory exist in this version.

Any idea how to fix it?
Thanks in advance!

I use the "oemuni" sample under ddk folder, please follow me;)

1. Create a New "Win32 Dynamic-Link Library "project.

2. Input a name(any string) into the "Project Name" edit box.

3. Press [OK], then select "a simple dll project", I think you also can select "an empty dll project", but I've tested it.

4. press [finish].

5. delete all files from the left project window.

6. copy all files from the "oemuni" subfolder into current project folder.

7. add all files into current project.(I assume you know how to do it).

8. open file.

9. if there is a line "PRECOMPILED_CXX=1", it means using precompile head.

10. select "xxx files" from the left workspace window.

11. press right button of mouse, in the popup menu, select "settings..." item. "C/C++" tab. "Precompiled Headers" from the "Category" comobox. "Use Precompiled Header file (.pch)". then input "precomp.h" in the "through header:" edit box. [OK].

16.from the, there is a line:



so open the setting dialogbox again(refer item 10), then select "C/C++" tab, and select General from "Category" comobox, in the "Preprocessor definitions:" edit box, input all the symbol copy from the


the USERMODE_DRIVER comes from the file "sources" under the umode subfolder.

17.still in the "C/C++" tab, select the "Preprocessor" from the "Category" comobox, input your ddk's include dir into the "Aditional include directories:" edit box.

for me, it is "F:\WINDDK\inc"

18.there is a line "DLLBASE=0x70000000", so you need to open the setting dialogbox again, select "Link" tab. then select "Output" from the "Category" comobox, input the "0x70000000" into the "Base Address:" editbox.

19.there is also a def in the umode folder. so please add this file into your project.

20.for this sample, the "precomp.h" file is a precompiled header file, but for VC's IDE we need a .cpp to use it.

so please create a new .cpp file and insert the line "#include "precomp.h" into the cpp file, then add this cpp file into your project, then select the cpp file in the left workspce window, press right button, in the popup menu, select "setting..." item, select "Precompiled Headers:" from the "catagory" comobox, then select the "Create precompiled header ...", then input the "precomp.h" into the following "Through header" edit box.

Open in new window

Question by:michelleyi
    LVL 49

    Accepted Solution

    In project / settings / C/C++ / (Catagory:  Precompiled headers)
    choose Automatic use of precompikled headers.

    Author Comment

    Hello DanRollins,
    Thanks for your help. The setting you suggested does help get rid of the error. But now I got other compiling errors:
    c:\winddk\6001.18001\inc\api\bcrypt.h(112) : error C2485: 'align' : unrecognized extended attribute
    c:\winddk\6001.18001\inc\api\bcrypt.h(112) : error C2059: syntax error : '('
    c:\winddk\6001.18001\inc\api\bcrypt.h(118) : error C2485: 'align' : unrecognized extended attribute
    c:\winddk\6001.18001\inc\api\bcrypt.h(118) : error C2059: syntax error : '('

    The following is code snippet from line 111 of bcrypt.h.
    Do you think is the compiler verion of MVC++ 6 is too old to recognize the keyword of "pack" in #pragma?
    It also complains:
    c:\winddk\6001.18001\inc\api\wingdi.h(4341) : warning C4068: unknown pragma
    and its corresponding code is:
    #pragma deprecated (UpdateICMRegKeyA)

    Thanks again for your help, and look forward to hear more advice from you,
    #pragma pack(push, BCRYPT_OBJECT_ALIGNMENT)
        ULONG   cbOID;
        PUCHAR  pbOID;
        ULONG       dwOIDCount;
        BCRYPT_OID  *pOIDs;

    Open in new window


    Author Comment

    I used MVS 2005 instead of MVC6, the above compile errors disappeared.

    Thanks DanRollins for your help,
    LVL 49

    Expert Comment

    Just a little "heads up" for future questions:
       What's the right grade to give?
    In general, if a comment answers the question, then it's worth an A.  No big deal this time, but something to think about for the future.
    -- Dan

    Author Comment

    Hello DanRollins,
    I'm new in this site, so not that familiar the grading system. I have requested to change the grade, hope the grade will get adjust to A.
    Thanks again for your help.

    LVL 1

    Expert Comment

    Grade changed.
    EE Moderator

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
    INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now