Article View: borland.public.cppbuilder.nativeapi
Article #1430How to deal with DDK header files not included in Builder 2007 ?
From: Kris
Date: Sat, 25 Aug 2007 16:15
Date: Sat, 25 Aug 2007 16:15
69 lines
3711 bytes
3711 bytes
Hi,
I'm writing some code to deal with HID devices. This functionality is
defined in header files such as hidpddi.h, hidpi.h, hidsdi.h and hidusage.h.
Unfortunately, these files are apparently not included in Builder 2007.
So I copied them from Microsoft's DDK and included them in my project.
However, I'm running into several problems and was wondering what is the
best way to deal when using these header files in Builder (which are
actually intended for use in Visual C++).
(1) hidpddi.h does not compile (This time it's not too bad. Only one
line does not compile).
NTSTATUS
HidP_GetCollectionDescription (
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
IN ULONG DescLength,
IN POOL_TYPE PoolType,
OUT PHIDP_DEVICE_DESC DeviceDescription
);
fails with [BCC32 Error] hidpddi.h(72): E2303 Type name expected
Line 72 refers to IN POOL_TYPE PoolType
A search in the DDK header files revealed that POOL_TYPE is defined in
ndis.h. However, including that one results in many other compile errors
and also in turn it attempts to include several other header files
such as ntddk.h. This seems like a never ending story of adding new
header files (and having those newly included header files cause other
errors). For now I've commented out GetCollectionDescription in order to
get things compiled (but the possibility exists that I'm going to still
need it later on).
(2) Hid API calls do not link
E.g. HidD_GetAttributes(DeviceHandle,&Attributes); compiles fine but
fails to link with following error:
[ILINK32 Error] Error: Unresolved external '__stdcall
HidD_GetAttributes(void *, _HIDD_ATTRIBUTES *)' referenced from
C:\DOCUMENTS AND SETTINGS\KRIS\MY DOCUMENTS\RAD
STUDIO\PROJECTS\USB_HID\DEBUG_BUILD\USB_IO_UNIT.OBJ
For now I've worked around the problem by using GetProcAddress() to
extract the location of the function I need from HID.DLL. This works
fine, but it sure would be nice if I wouldn't have to do this for every
HID function call I want to use.
(3) int sized enums
Even though I think it doesn't apply just yet here, experience from the
past has taught me that Visual Studio header files expect enums to be
int sized. However, with Builder 2007 this is not the default behaviour.
Especially when including lots of big header files I am wondering how on
earth I know these are suitable for use in Builder (it doesn't mean they
are OK when they compile). Sure, you can set the compiler option for int
sizes enums, but I wonder what other issues are there besides int sized
enums ?
Probably there are other issues too when handling DDK files in Builder,
issues that I am not aware of.
Basically I'm wondering how one is able to efficiently and correctly use
the DDK header files from Visual studio in Builder 2007 ?
Thanks,
Kris
Technical Details
Message-ID:
<46d05592@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e9c910c4ee30f0b3,start X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Sat, 25 Aug 2007 18:15:17 +0200 From: Kris <ks@ks.com> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: How to deal with DDK header files not included in Builder 2007 ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.134.74.225 Message-ID: <46d05592@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1188058514 83.134.74.225 (25 Aug 2007 09:15:14 -0700) Lines: 70 Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail