1

I've included winioctl.h and there is no #define for IOCTL_STORAGE_QUERY_PROPERTY in that file !! http://www.osronline.com/ddkx/storage/k307_8z3m.htm Says Its in ntddstor.h But I cannot find any ntddstor.h on my Windows XP. HoweverIOCTL_STORAGE_QUERY_PROPERTY mentions its supposed to work with Windows XP (I dont need > Vista Specifc Queries) and It mentions to include winioctl.h only ! (I am not using Visual C++, I an using Qt with MinGW)

Neel Basu
  • 12,638
  • 12
  • 82
  • 146

2 Answers2

1

I see IOCTL_STORAGE_QUERY_PROPERTY definition in WinIoCtl.h, and it compiles without any #ifdef conditions. What is your version of this file, how is it installed? I use WinIoCtl.h from VC++ 2010. Maybe you need to install Windows SDK.

Possibly your WinIoCtl.h comes from old Visual Studio or SDK. Install newest Visual Studio version, if this is impossible - install latest Microsoft Windows SDK and ensure that its include directory is listed first in your compiler.

Alex F
  • 42,307
  • 41
  • 144
  • 212
0

I have used MinGW to compile these kind of programs. It may not be so easy to find, because frankly, the MinGW site is quite a mess, but they provide a lot of DDK header with no pain. Then I simply copy/paste the structs and defines I need and that I cannot find in the SDK headers. The macros, I define them conditionally, to avoid conflicts, just in case.

For example, your IOCTL_STORAGE_QUERY_PROPERTY is in mingw/include/ddk/ntddstor.h

#define IOCTL_STORAGE_QUERY_PROPERTY \
  CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)

So I add in my projects:

#ifndef IOCTL_STORAGE_QUERY_PROPERTY
    #define IOCTL_STORAGE_QUERY_PROPERTY \
      CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
#endif

That's particularly useful if you intend to publish your code, as most people don't have the DDK headers, and they insist on using VisualStudio instead of MinGW.

rodrigo
  • 94,151
  • 12
  • 143
  • 190
  • Yah I just found the Same Solution tonight. in a file [`diskid32.cpp`](http://www.winsim.com/diskid32/diskid32.cpp) – Neel Basu Oct 01 '11 at 18:40
  • However What about putting `mingw/include/ddk` in include Path ? – Neel Basu Oct 01 '11 at 18:41
  • 1
    @NeelBasu I think that they are intended to be included as `#include `. No need to add the include path, assuming the `mingw/include` is already there. – rodrigo Oct 01 '11 at 18:53