Re: Using GET_CONFIGURATION_IOCTL_INPUT in a CD application.
- From: Ian Blake <NoNotMe@NotAnywhere>
- Date: Fri, 17 Feb 2006 12:51:21 +0000
On 16 Feb 2006 23:59:11 -0800, "Acky"
<achilles_pereira@xxxxxxxxxxxxxx> wrote:
Hi,
I am part of a team, developing an application which will reside on a
CD. We want this application not to execute from any media other than
CD-ROM.
Hence, we intend to use GET_CONFIGURATION_IOCTL_INPUT to determine
media type.
The developed application is built using VC++ 6.0.
Now, I have with me Windows DDK XP SP1 and am able to compile the
application (on VC++) using the header files required for
GET_CONFIGURATION_IOCTL_INPUT.
I have beentrying this:
code starts >>>
code ends >>>
There are two issues that I would like to get clarified:
1. The DDK documentation mentions that the input parameters are:
Parameters.DeviceIoControl.InputBufferLength =
sizeof(GET_CONFIGURATION_IOCTL_INPUT);
Parameters.DeviceIoControl.OutputBufferLength =
sizeof(GET_CONFIGURATION_HEADER). How do I get handle to this
IO_STACK_LOCATION structure.
2. In the above code snippet, if I use IoGetCurrentIrpStackLocation
call (currently commented)to get the IO_STACK_LOCATION, I get the
"Compiler version not supported by Windows DDK" error. But, I do not
want to use the compiler given by DDK as the rest of the app requires
VC++.
Being new to Device level programming, I would like some help, in the
form of code snippet or anything that could be of help.
Our only requirement is that "We want this application not to execute
from any media other than CD-ROM."
Best Regards,
Achilles Pereira.
You seem to be very confused. The documentation you are reading is
explaining the IOCTL as it as seen by a device driver. Afterall the
DDK is for drivers not for applications. You have a simpler call to
make. You do not need to worry about the IRP stack location. You are
at the top.
BYTE Buffer[BUFFER_SIZE]; // or allocate with new or malloc etc
GET_CONFIGURATION_HEADER *pcfg_header =
(GET_CONFIGURATION_HEADER *)Buffer;
GET_CONFIGURATION_IOCTL_INPUT cfg_ip;
BOOL bResult;
ULONG BytesReturned;
// fill in cfg_ip
bResult = DeviceIoControl(
YourHandle, // from CreateFile with drive letter or interface
&cfg_ip,
sizeof(GET_CONFIGURATION_IOCTL_INPUT),
pcfg_header,
BUFFER_SIZE,
&BytesReturned,
NULL);
// interpret results.
----------------------------------------------------------
In the event you are trying to do this from a driver get a good book.
Try Walter Oney "Programming Microsofts Windows Driver Model 2nd Ed"
Alternately take a driver writing course from someone like www.osr.com
This will show you how to make device io calls.
-----------------------------------------------------------
Be aware that older cd rom drives do not support this function.
Secondly a cd rom drive will treat cd-r media as cd-rom. So the
profile will be the same. Only newer multifuntion devices will
distinguish between cd-r and cd-rom. You may get better results by
using Read TOC. cd-r will have entries in the full TOC which an
ordinary cd-rom will not have.
.
- Follow-Ups:
- Re: Using GET_CONFIGURATION_IOCTL_INPUT in a CD application.
- From: Ian Blake
- Re: Using GET_CONFIGURATION_IOCTL_INPUT in a CD application.
- References:
- Prev by Date: Re: Import exeutable icon
- Next by Date: Re: Run An Exe as thread
- Previous by thread: Using GET_CONFIGURATION_IOCTL_INPUT in a CD application.
- Next by thread: Re: Using GET_CONFIGURATION_IOCTL_INPUT in a CD application.
- Index(es):
Relevant Pages
|