Re: Using GET_CONFIGURATION_IOCTL_INPUT in a CD application.

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.


.



Relevant Pages

  • Re: Using GET_CONFIGURATION_IOCTL_INPUT in an application.
    ... It is recommended to use the compiler that is shipped with the DDK to build ... Even if you would successful in building your driver with the VC++ ... We want this application not to execute from any media other than ... "Compiler version not supported by Windows DDK" error. ...
    (microsoft.public.development.device.drivers)
  • Re: SBS 2003 installation
    ... Didn't know support for SP0 isntall media was stopped. ... First I want to know what is the "open license version of SBS 2003"? ... may add some driver in the media to make it work fine with its hardware. ...
    (microsoft.public.windows.server.sbs)
  • Re: drive present detection?
    ... the free space of all online drives. ... If the underlying device driver determines that the media has not ... changed, the driver should complete the IRP, returning the IoStatus ...
    (microsoft.public.win32.programmer.kernel)
  • Re: ARPC Devices
    ... I just bought the HP Pavilion a1340n, it came with Windows XP Media ... I reformatted the hard drive and install Windows XP ... MS ArPolicy Driver ...
    (alt.os.windows-xp)
  • Re: Clicking LIVE TV in Media Centre CAUSES LAPTOP to FREEZE
    ... The Windows Media Centre frezing problem was due to the tv tuner driver I ... Suggest that you get the latest version from the HP Webb site and install it ...
    (microsoft.public.windows.mediacenter)