Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Compilation errors with including <windows.h> in a windows driver application.

Posted on 2014-04-24
6
Medium Priority
?
257 Views
Last Modified: 2016-06-02
I need to include the file <windows.h> in a windows driver application built using DDK winddk\6001.18001. But this includes file <winbase.h> and during compilation I get hundreds of errors, which I must resolve:

c:\winddk\6001.18001\inc\api\winbase.h(316) : error C2061: syntax error : identi
fier 'CRITICAL_SECTION'
c:\winddk\6001.18001\inc\api\winbase.h(316) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(317) : error C2061: syntax error : identi
fier 'PCRITICAL_SECTION'
c:\winddk\6001.18001\inc\api\winbase.h(317) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(318) : error C2061: syntax error : identi
fier 'LPCRITICAL_SECTION'
c:\winddk\6001.18001\inc\api\winbase.h(318) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(320) : error C2061: syntax error : identi
fier 'CRITICAL_SECTION_DEBUG'
c:\winddk\6001.18001\inc\api\winbase.h(320) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(321) : error C2061: syntax error : identi
fier 'PCRITICAL_SECTION_DEBUG'
c:\winddk\6001.18001\inc\api\winbase.h(321) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(322) : error C2061: syntax error : identi
fier 'LPCRITICAL_SECTION_DEBUG'
c:\winddk\6001.18001\inc\api\winbase.h(322) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(401) : error C2061: syntax error : identi
fier 'SRWLOCK'
c:\winddk\6001.18001\inc\api\winbase.h(401) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(401) : error C2059: syntax error : ','
c:\winddk\6001.18001\inc\api\winbase.h(409) : error C2146: syntax error : missin
g ')' before identifier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(409) : error C2061: syntax error : identi
fier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(409) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(410) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(416) : error C2146: syntax error : missin
g ')' before identifier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(416) : error C2061: syntax error : identi
fier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(416) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(417) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(423) : error C2146: syntax error : missin
g ')' before identifier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(423) : error C2061: syntax error : identi
fier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(423) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(424) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(430) : error C2146: syntax error : missin
g ')' before identifier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(430) : error C2061: syntax error : identi
fier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(430) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(431) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(437) : error C2146: syntax error : missin
g ')' before identifier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(437) : error C2061: syntax error : identi
fier 'SRWLock'
c:\winddk\6001.18001\inc\api\winbase.h(437) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(438) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(444) : error C2061: syntax error : identi
fier 'CONDITION_VARIABLE'
c:\winddk\6001.18001\inc\api\winbase.h(444) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(444) : error C2059: syntax error : ','
c:\winddk\6001.18001\inc\api\winbase.h(450) : error C2146: syntax error : missin
g ')' before identifier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(450) : error C2061: syntax error : identi
fier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(450) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(451) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(457) : error C2146: syntax error : missin
g ')' before identifier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(457) : error C2061: syntax error : identi
fier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(457) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(458) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(464) : error C2146: syntax error : missin
g ')' before identifier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(464) : error C2061: syntax error : identi
fier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(464) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(465) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(471) : error C2146: syntax error : missin
g ')' before identifier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(471) : error C2061: syntax error : identi
fier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(471) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(471) : error C2059: syntax error : ','
c:\winddk\6001.18001\inc\api\winbase.h(474) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(480) : error C2146: syntax error : missin
g ')' before identifier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(480) : error C2061: syntax error : identi
fier 'ConditionVariable'
c:\winddk\6001.18001\inc\api\winbase.h(480) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(480) : error C2059: syntax error : ','
c:\winddk\6001.18001\inc\api\winbase.h(484) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(531) : error C2061: syntax error : identi
fier 'LPLDT_ENTRY'
c:\winddk\6001.18001\inc\api\winbase.h(531) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(2279) : warning C4005: 'InterlockedExchan
gePointer' : macro redefinition
        c:\winddk\6001.18001\inc\ddk\wdm.h(11164) : see previous definition of '
InterlockedExchangePointer'
c:\winddk\6001.18001\inc\api\winbase.h(2292) : error C2059: syntax error : '('
c:\winddk\6001.18001\inc\api\winbase.h(2321) : error C2084: function 'LONGLONG _
InterlockedAnd64(volatile LONGLONG *,LONGLONG)' already has a body
        c:\winddk\6001.18001\inc\ddk\ntddk.h(4449) : see previous definition of
'_InterlockedAnd64'
c:\winddk\6001.18001\inc\api\winbase.h(2339) : error C2084: function 'LONGLONG _
InterlockedOr64(volatile LONGLONG *,LONGLONG)' already has a body
        c:\winddk\6001.18001\inc\ddk\ntddk.h(4469) : see previous definition of
'_InterlockedOr64'
c:\winddk\6001.18001\inc\api\winbase.h(2357) : error C2084: function 'LONGLONG _
InterlockedXor64(volatile LONGLONG *,LONGLONG)' already has a body
        c:\winddk\6001.18001\inc\ddk\ntddk.h(4489) : see previous definition of
'_InterlockedXor64'
c:\winddk\6001.18001\inc\api\winbase.h(2374) : error C2084: function 'LONGLONG _
InterlockedIncrement64(volatile LONGLONG *)' already has a body
        c:\winddk\6001.18001\inc\ddk\ntddk.h(4509) : see previous definition of
'_InterlockedIncrement64'
c:\winddk\6001.18001\inc\api\winbase.h(2391) : error C2084: function 'LONGLONG _
InterlockedDecrement64(volatile LONGLONG *)' already has a body
        c:\winddk\6001.18001\inc\ddk\ntddk.h(4528) : see previous definition of
'_InterlockedDecrement64'
c:\winddk\6001.18001\inc\api\winbase.h(2409) : error C2084: function 'LONGLONG _
InterlockedExchange64(volatile LONGLONG *,LONGLONG)' already has a body
        c:\winddk\6001.18001\inc\ddk\ntddk.h(4547) : see previous definition of
'_InterlockedExchange64'
c:\winddk\6001.18001\inc\api\winbase.h(2427) : error C2084: function 'LONGLONG _
InterlockedExchangeAdd64(volatile LONGLONG *,LONGLONG)' already has a body
        c:\winddk\6001.18001\inc\ddk\ntddk.h(4567) : see previous definition of
'_InterlockedExchangeAdd64'
c:\winddk\6001.18001\inc\api\winbase.h(2469) : warning C4005: 'InterlockedCompar
eExchangePointer' : macro redefinition
        c:\winddk\6001.18001\inc\ddk\wdm.h(11120) : see previous definition of '
InterlockedCompareExchangePointer'
c:\winddk\6001.18001\inc\api\winbase.h(2495) : error C2375: 'InitializeSListHead
' : redefinition; different linkage
        c:\winddk\6001.18001\inc\ddk\wdm.h(14639) : see declaration of 'Initiali
zeSListHead'
c:\winddk\6001.18001\inc\api\winbase.h(2502) : error C2373: 'InterlockedPopEntry
SList' : redefinition; different type modifiers
        c:\winddk\6001.18001\inc\ddk\wdm.h(14858) : see declaration of 'Interloc
kedPopEntrySList'
c:\winddk\6001.18001\inc\api\winbase.h(2510) : error C2373: 'InterlockedPushEntr
ySList' : redefinition; different type modifiers
        c:\winddk\6001.18001\inc\ddk\wdm.h(14865) : see declaration of 'Interloc
kedPushEntrySList'
c:\winddk\6001.18001\inc\api\winbase.h(2517) : error C2373: 'ExInterlockedFlushS
List' : redefinition; different type modifiers
        c:\winddk\6001.18001\inc\ddk\wdm.h(14849) : see declaration of 'ExInterl
ockedFlushSList'
c:\winddk\6001.18001\inc\api\winbase.h(2524) : error C2059: syntax error : '('
c:\winddk\6001.18001\inc\api\winbase.h(2903) : error C2146: syntax error : missi
ng ')' before identifier 'lpBuffer'
c:\winddk\6001.18001\inc\api\winbase.h(2903) : error C2081: 'PMEMORY_BASIC_INFOR
MATION' : name in formal parameter list illegal
c:\winddk\6001.18001\inc\api\winbase.h(2903) : error C2061: syntax error : ident
ifier 'lpBuffer'
c:\winddk\6001.18001\inc\api\winbase.h(2903) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(2903) : error C2059: syntax error : ','
c:\winddk\6001.18001\inc\api\winbase.h(2905) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(3016) : error C2146: syntax error : missi
ng ')' before identifier 'lpBuffer'
c:\winddk\6001.18001\inc\api\winbase.h(3016) : error C2081: 'PMEMORY_BASIC_INFOR
MATION' : name in formal parameter list illegal
c:\winddk\6001.18001\inc\api\winbase.h(3016) : error C2061: syntax error : ident
ifier 'lpBuffer'
c:\winddk\6001.18001\inc\api\winbase.h(3016) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(3016) : error C2059: syntax error : ','
c:\winddk\6001.18001\inc\api\winbase.h(3018) : error C2059: syntax error : ')'
c:\winddk\6001.18001\inc\api\winbase.h(3161) : error C2146: syntax error : missi
ng ')' before identifier 'HeapInformationClass'
c:\winddk\6001.18001\inc\api\winbase.h(3161) : error C2081: 'HEAP_INFORMATION_CL
ifier 'HeapInformationClass'
c:\winddk\6001.18001\inc\api\winbase.h(3171) : error C2059: syntax error : ';'
c:\winddk\6001.18001\inc\api\winbase.h(3171) : fatal error C1003: error count exceeded
0
Comment
Question by:supriyaksen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 47

Expert Comment

by:David
ID: 40021809
There are a dozen things this could be, from not using the proper compiler environment variables to wrong compiler, to wrong  target (32bit vs 64bit vs WOW), ...  to settings in files included BEFORE the <windows.h>

Best way to get this resolved is to use the DDK and compile one of the simple sample applications and get that to work.  Then you'll know  your runtime./compile environment is correct.

You could publish source code of the entire operation, and people running different system configurations will get different results.
0
 
LVL 35

Accepted Solution

by:
Seth Simmons earned 2000 total points
ID: 40021810
that DDK version is for windows 2008 sp1
what version of windows are you running this on?
0
 

Author Comment

by:supriyaksen
ID: 40023205
Yes, I am running this on a windows  8 system. What typical compiler environment variables are used to resolve these issues, and what particular header files need to be included before the windows.h header during compilation? A sample posting of these would be really helpful.

 I am currently using the following complier flags:

cygdrive/c/winddk/6001.18001/bin/x86/x86/cl -nologo -Gz -Zp8 -Ob1 -EHsc -Oi -Zl -Zi -Ox -W4

and the following compiler defines:
-D_X86_ -D_WDM_INCLUDED_ -D_i386_ -D_WIN32 -DWINNT=1 -D_WIN32_WINNT=0x0502 -DWINVER=0x0502 -D_WIN32_IE=0x0603 -D_NTDRIVER_ -D__BUILDMACHINE__=WinDDK  -DCPU=X86 -DQCPU=QX86

Not sure which header file to include before the windows.h file.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 41626702
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 47

Expert Comment

by:David
ID: 41626703
https:#a40021810 is correct answer.  The DDK is specifically designed to work for Win2008, not "Windows 8".
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
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…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

721 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