Enable Windows DDK Header

I am writing a Win32 application for user space. However, as part of this application, I need to make several calls DeviceIoto the Windows 1394 stack. A header file that contains the prototypes for these calls DeviceIois included as part of the Windows DDK:

C:\WinDDK\7600.16385.1\inc\api\ntdd1394.h

(Although the title claims to be "kernel mode only," the prototypes for IOCTL are for user space.) I am wondering what is the best way to include this file in my application.

It would be bad practice to use #includeit directly (the path depends, among other things, on the DDK version), and besides, there is no real need to install DDK --- the only dependency of my application is on this particular header file.

So I wonder what is the best course of action? I considered including a stripped-down version of this file directly in the source of my applications, but I'm not really sure.

0
source share
3 answers

I would say that this is either a stripped-down version, or that your use is really small, import it directly into the main header for your project.

no matter which path you take, I would say to wrap both #defineguards, release someone else who is messing around with this input of the correct heading and causing problems. It would be even better to let the user either determine the path to the DDK or use your stripped-down version:

#define EXP(x) #x
#define STR(x) EXP(x)

#if defined(__WIN32_DDK_PATH)
    #include STR(__WIN32_DDK_PATH)
#else
//Stripped DDK stuff...
#endif

, gcc 3.4.5 ( , dev-cpp - , , ),

0

? , , , #.

, , ? , DDK, #include .

, , ( , , !), , .

0

( DDK):

#define _WIN1394_C
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <ntdd1394.h>
#undef _WIN1394_C
0

Source: https://habr.com/ru/post/1788197/


All Articles