Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Windows 7 WDK can't build Native application

Aram_Havarneanu-2Aram_Havarneanu-2 Member Posts: 161
Hello,

I have written a Native application that runs at boot time (via BootExecute
registry key). The application compiles fine with the Windows Vista WDK
(6001.18002) but the build environment seems to be broken for Windows 7 WDK
(7600.16385.0).

My sources file is:

-----------------------------------------------------------------

TARGETNAME=native
TARGETTYPE=PROGRAM

UMTYPE=nt

BUFFER_OVERFLOW_CHECKS=0

SOURCES= \
native.c

TARGETLIBS= \
$(DDK_LIB_PATH)\ntdll.lib

USE_NTDLL=1

-----------------------------------------------------------------

The error is:

-----------------------------------------------------------------

1>errors in directory c:\users\empathy\desktop\native\pure
1>NMAKE : fatal error U1073: don't know how to make '\nt.lib'
1>nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1
MAKEDIR_RELATIVE_TO_BASEDIR= failed - rc = 2

-----------------------------------------------------------------

And the full build log is:

-----------------------------------------------------------------
BUILD: Computing Include file dependencies:
BUILD: Examining c:\users\empathy\desktop\native\pure directory for files to
compile.
oacr invalidate root:x86chk /autocleanqueue
1>Compiling and Linking c:\users\empathy\desktop\native\pure *************
1>'nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1
MAKEDIR_RELATIVE_TO_BASEDIR='
1>BUILDMSG: _NT_TARGET_VERSION SET TO WINXP
1> C:\WinDDK\7600.16385.0\Bin\x86\oacr\oacrcl
@c:\users\empathy\desktop\native\pure\objchk_wxp_x86\i386\cl.rsp
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.207 for
80x86
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>cl /Fo"c:\users\empathy\desktop\native\pure\objchk_wxp_x86\i386/"
1> /FC
1> /Ii386
1> /I.
1> /Ic:\users\empathy\desktop\native\pure\objchk_wxp_x86\i386
1> /IC:\WinDDK\7600.16385.0\inc\api
1> /IC:\WinDDK\7600.16385.0\inc\api
1> /IC:\WinDDK\7600.16385.0\inc\crt
1> /D_X86_=1
1> /Di386=1
1> /DSTD_CALL
1> /DCONDITION_HANDLING=1
1> /DNT_UP=1
1> /DNT_INST=0
1> /DWIN32=100
1> /D_NT1X_=100
1> /DWINNT=1
1> /D_WIN32_WINNT=0x0501
1> /DWINVER=0x0501
1> /D_WIN32_IE=0x0603
1> /DWIN32_LEAN_AND_MEAN=1
1> /DDEVL=1
1> /DDBG=1
1> /D__BUILDMACHINE__=WinDDK
1> /DFPO=0
1> /D_DLL=1
1> /DNDEBUG
1> /D_UNICODE
1> /DUNICODE
1> /DDEPRECATE_DDK_FUNCTIONS=1
1> /DMSC_NOOPT
1> /DNTDDI_VERSION=0x05010200
1> /DPSAPI_VERSION=1
1> /c
1> /Zc:wchar_t-
1> /Zl
1> /Zp8
1> /Gy
1> /Gm-
1> /W3
1> /Gz
1> /hotpatch
1> /EHs-c-
1> /GR-
1> /GF
1> /GS-
1> /Zi
1> /Od
1> /Oi
1> /Oy-
1> /Zi
1> /Fdc:\users\empathy\desktop\native\pure\objchk_wxp_x86\i386\
1> /DKMDF_MAJOR_VERSION_STRING=01
1> /DKMDF_MINOR_VERSION_STRING=009
1> /wd4603
1> /wd4627
1> /typedil-
1> /FIC:\WinDDK\7600.16385.0\inc\api\warning.h
1> .\native.c
1>native.c
1>NMAKE : fatal error U1073: don't know how to make '\nt.lib'
1>errors in directory c:\users\empathy\desktop\native\pure
1>NMAKE : fatal error U1073: don't know how to make '\nt.lib'
1>Stop.
1>nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1
MAKEDIR_RELATIVE_TO_BASEDIR= failed - rc = 2


-----------------------------------------------------------------

Why does the build fail with the latest WDK but works with the previous
version of the WDK? What can I do to solve the error? Is it my fault or is
this a WDK bug?

Thanks,

--
Aram Hăvărneanu

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    This is new (win7 makefile.new:3255):

    #
    # Setup the program entry and libs if its native
    #

    !if !defined(NO_NATIVE_LIBS)

    I don't know where it's defined.


    mm
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    I should have said that I don't where it's defined or IF it's even defined; it's just different and seems like it might be relevant.


    Good luck,

    mm
  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,022
    Aram Hăvărneanu wrote:
    >
    > I have written a Native application that runs at boot time (via
    > BootExecute registry key). The application compiles fine with the
    > Windows Vista WDK (6001.18002) but the build environment seems to be
    > broken for Windows 7 WDK (7600.16385.0).
    > ...
    > The error is:
    >
    > -----------------------------------------------------------------
    >
    > 1>errors in directory c:\users\empathy\desktop\native\pure
    > 1>NMAKE : fatal error U1073: don't know how to make '\nt.lib'
    > 1>nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS2 LINKONLY=1
    > NOPASS0=1 MAKEDIR_RELATIVE_TO_BASEDIR= failed - rc = 2
    >
    > -----------------------------------------------------------------

    Well, this certainly has changed. In 6001, we see
    NT_LIBS=$(NTDLL_CRT) $(SDK_LIB_PATH)\nt.lib
    In 7600, we see
    NT_LIBS=$(NTDLL_CRT) $(MINWIN_SDK_LIB_PATH)\nt.lib

    I can't say I quite know what that means, but a short-term workaround
    would be to type this in your command line:
    set MINWIN_SDK_LIB_PATH=%SDK_LIB_PATH%

    --
    Tim Roberts, xxxxx@probo.com
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Aram_Havarneanu-2Aram_Havarneanu-2 Member Posts: 161
    "Tim Roberts" <xxxxx@probo.com> wrote in message news:xxxxx@ntdev...
    >
    > Well, this certainly has changed. In 6001, we see
    > NT_LIBS=$(NTDLL_CRT) $(SDK_LIB_PATH)\nt.lib
    > In 7600, we see
    > NT_LIBS=$(NTDLL_CRT) $(MINWIN_SDK_LIB_PATH)\nt.lib
    >
    > I can't say I quite know what that means, but a short-term workaround
    > would be to type this in your command line:
    > set MINWIN_SDK_LIB_PATH=%SDK_LIB_PATH%
    >

    Well, this is purely speculation but I believe that this has to do with the
    refactoring effort Microsoft invested into Windows 7 for implementing a
    clear separation between architectural layers and for easier testing. From
    what I have heard, Microsoft designed MinWin to be the minimal self-hosting
    environment that can be tested. It is obvious MinWin needs to run some kind
    of applications, and it makes sense that this applications are what in
    Windows realm are Native application, since they only depend on what
    functionality the kernel is offering through its syscalls and does not
    depend on any user space runtime subsystem.

    Razzle, the internal version (and I think superset) of the WDK that I
    believe is used for building Windows, obviously has to have some
    configurable parameters that relate to MinWin, since MinWin is supposed to
    be some testable thing and you (Microsoft employee) are supposed to build
    stuff for it. It seems like the WDK, being a subset of razzle does not
    include stuff related to MinWin. This breaks Native applications but this is
    of course perfectly acceptable as Native applications are not officially
    supported by Microsoft.

    --
    Aram Hăvărneanu
  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 7,345
    So.... does Tim's proposed fix (setting MINWIN_SDK_LIB_PATH) make it work, or has it now become impossible to build native apps using the WDK?

    Peter
    OSR

    Peter Viscarola
    OSR
    @OSRDrivers

  • Aram_Havarneanu-2Aram_Havarneanu-2 Member Posts: 161
    It does work, yes. Of course, you can set it in directly in sources so
    that you don't have to type that every time. Thanks Tim!

    For completeness, the sources file is now:

    --------------------------------------------------------------------------------------------------------------------------------------

    TARGETNAME=native
    TARGETTYPE=PROGRAM

    UMTYPE=nt

    BUFFER_OVERFLOW_CHECKS=0

    MINWIN_SDK_LIB_PATH=$(SDK_LIB_PATH)

    SOURCES= \
    native.c

    TARGETLIBS= \
    $(DDK_LIB_PATH)\ntdll.lib \
    $(DDK_LIB_PATH)\nt.lib

    USE_NTDLL=1

    --------------------------------------------------------------------------------------------------------------------------------------

    BUFFER_OVERFLOW_CHECKS=0 seems to be required for some Windows 2000
    stuff as nt.lib for that platform misses the stack protection
    startups, if you don't need Windows 2000 you can probably remove it
    (of course, you can implement the process startup functions for
    Windows 2000 yourself...).

    Thanks again.

    --
    Aram Hăvărneanu
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
Developing Minifilters 29 July 2019 OSR Seminar Space
Writing WDF Drivers 23 Sept 2019 OSR Seminar Space
Kernel Debugging 21 Oct 2019 OSR Seminar Space
Internals & Software Drivers 18 Nov 2019 Dulles, VA