Tech Support > Microsoft Windows > Drivers > Custom DeviceIoControl Handling in Stream Minidrive ? (shared memory user - kernel)
Custom DeviceIoControl Handling in Stream Minidrive ? (shared memory user - kernel)
Posted by Laksa on July 19th, 2004



Hi, I have the screnario as below :

I need to have custom IoControl code to communicated with user-mode
application, I know how to to
it in non-minidriver kernel mode, but how about in stream minidriver ?

On kernel streaming driver code:

DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE RegisteryPath)
{
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
<ouriocontrolhandler>
...
...
}

Then we have a function:
NTSTATUS OurIOControlHandler(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{

irp = IoGetCurrentIrpStackLocation(Irp);
controlCode = irpStack->Parameters.DeviceIoControl.UoControlCode;

switch (controlCode)
{
.... <do our work here>
}
}

However, on stream minidrive,

DriverEntry( IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath )
{

HW_INITIALIZATION_DATA HwInitData;

HwInitData.HwReceivePacket = MyReceivePacket;
HwInitData.HwCancelPacket = MyCancelPacket;
HwInitData.HwRequestTimeoutHandler = MyTimeoutPacket;
<continue>

ReturnValue = StreamClassRegisterAdapter(DriverObject, RegistryPath,
&HwInitData);

}

So can I l put in the line (or is it safe to do so ?, will it be
overwritted) :
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] =
<ouriocontrolhandler>
in stream minidriver ?
what <StreamClassRegisterAdapter()> put in for this parameter
(IRP_MJ_DEVICE_CONTROL) ?
will it overwrite my parameters ?

If I want to have my custom IoControl In minidriver, what is the proper way
?

Note:
Ref: TestCap DDK sample


Thank in advance

WP



Posted by Max Paklin on July 19th, 2004


See http://www.wd-3.com/archive/KsProxyPlugin.htm

-- Max.



"Laksa" <doremonsaynospam-pls@thankyou.tv.org.com> wrote in message
news:eHB0NSWbEHA.3944@tk2msftngp13.phx.gbl...


Posted by paullee on August 11th, 2004


Sorry, I have try to download the sample code
it seem look like the wd3iface.h is lose ,is it??

I saw many people ask same question about this topic,
but I still cann't understand how to do it><

Thanks

Posted by paullee on August 11th, 2004


Sorry,Does the wd3iface.IDL file is use for replace wd3iface.h ??
I have use vc 6.0,my friend tell me ,he can complier very well in .NET
So can you tell me how to create wd3iface.h or how to change to Vc
6.0??
I have try to write wd3iface.h like this
but I got error massage --->
error C2787: 'IWd3KsproxySampleConfig' : no GUID has been associated
with this object when complier __uuidof( IWd3KsproxySampleConfig )
is anything wrong ?? how to convert wd3iface.IDL to wd3iface.h ??

Thanks a lot

#ifdef __cplusplus
extern "C" {
#endif


// {AD9CD7E6-2378-498f-8682-6FD60221B008}
DEFINE_GUID(IID_IWd3KsproxySampleConfig,
0xad9cd7e6, 0x2378, 0x498f, 0x86, 0x82, 0x6f, 0xd6, 0x2, 0x21, 0xb0,
0x8);

DECLARE_INTERFACE_ (IWd3KsproxySampleConfig, IUnknown) {

STDMETHOD(GetRate) (THIS_ long* plRate) PURE;
STDMETHOD(SetRate) (THIS_ long lRate) PURE;

};

#ifdef __cplusplus
}
#endif

Posted by Max Paklin on August 11th, 2004


VC6 is not supported.
The paper clearly says that.

..h file is a product of IDL compilation. Have IDL compiler process
wd3iface.idl and you get corresponding header file as one of the outputs.
Alternatively get the header file from your friend if you can't figure out
how to please the IDL compiler.
In either case remember that VC6 is not supported and you are on your own.

-- Max.



"paullee" <paullee@iei.com.tw> wrote in message
news:b308514d.0408110200.1002630f@posting.google.c om...


Posted by paullee on August 12th, 2004


Thanks max

I have complier successed in Vc 6.0,I use MIDL.exe to product wd3iface.h
but I still have same question,my book tell me if I want define a costom
interface ,I must write code like this
I also see it in the DXSDK sample code ,why cann't it work??

Thanks a lot

#ifdef __cplusplus
extern "C" {
#endif


//
// IGargleDMOSample's GUID
//
// {9AE9B11C-4EF8-42bc-9484-65EA0008964F}
DEFINE_GUID(IID_IGargleDMOSample,
0x9ae9b11c, 0x4ef8, 0x42bc, 0x94, 0x84, 0x65, 0xea, 0x0, 0x8, 0x96, 0x4f);

//
// IGargleDMOSample
//
DECLARE_INTERFACE_(IGargleDMOSample, IUnknown) {

// IGargleDMOSample methods
STDMETHOD(SetAllParameters) (THIS_ LPCGargleFX pcGargleFx) PURE;
STDMETHOD(GetAllParameters) (THIS_ LPGargleFX pGargleFx) PURE;

};


#ifdef __cplusplus
}
#endif

Posted by paullee on August 12th, 2004


Sorry, I got two error when I install the driver

fisrt I can see the driver install successed in the device
manager,
also can use Graphic Edit to run,But when I use your TESTAP,
I got this error code

0x80040216

HRESULT: 0x80040216 (2147746326)
Name: VFW_E_NOT_FOUND
Description: An object or name was not found.
Severity code: Failed
Facility Code: FACILITY_ITF (4)
Error Code: 0x0216 (534)

Second, when I type regsvr32
C:\MyWork\Wd3KsProxyPluginSample\bin\Wd3ProxyPlugi n.ax in dos command
line
I got this error code
0x800401f9

HRESULT: 0x800401f9 (2147746297)
Name: CO_E_ERRORINDLL
Description: n/a
Severity code: Failed
Facility Code: FACILITY_ITF (4)
Error Code: 0x01f9 (505)


Third, I try to use your original Wd3ProxyPlugin.ax file to register
I type regsvr32 c:\Wd3ProxyPlugin.ax
I got this error message "LoadLibary("c:\Wd3ProxyPlugin.ax") fail--
cann't find specify module

Thanks a lot

Posted by Max Paklin on August 12th, 2004


If your book says that there is only one correct way to define an interface,
throw away that book.
Most likely the book says that you could do it that way. Emphasis on
"could".

That's not the only way to define an interface.
I use IDL to describe my interfaces and then run IDL by MIDL compiler to
generate a corresponding header file. You could do it that way, you could do
it differently, it's your pick.

-- Max.



"paullee" <paullee@iei.com.tw> wrote in message
news:b308514d.0408111741.29660654@posting.google.c om...


Posted by Max Paklin on August 12th, 2004


What OS?

Once again the sample does not support VC6. Period.
Use it at your own risk.

Why original sample did not register? Most likely because runtime DLLs are
missing. Run depends on it.
This is also clearly stated in the paper. Did you read it at all? Or you
just playing with the sample without doing your homework?

-- Max.



"paullee" <paullee@iei.com.tw> wrote in message
news:b308514d.0408111916.ec3b149@posting.google.co m...


Posted by paullee on August 13th, 2004


The OS is XP Pro SP1 ,I try to install twice time ,the first
and second
problem is disappear。
I have use .NET to complier ,then use regsvr32 to register it
oen PC can install successed ,anohter PC is fail,I got this error
message "LoadLibary("c:\Wd3ProxyPlugin.ax") fail-- cann't find specify
module

sorry,I just roughly go through your paper for two times,
I know it didn't support VC6,I just try to use vc6 to write my own
code

sorry ,Does the automation table is optional ?? How do I add it in
the TESTCAP sample??

I want support a custom property,I saw sample code write like this

#define STATIC_PROPSETID_VIDCAP_CUSTOM \
0xC44A1A10, 0x0A37, 0x11D2,0x83, 0x28, 0x00, 0x60, 0x97, 0xBA,
0x83, 0xAB
DEFINE_GUIDSTRUCT( "C44A1A10-0A37-11D2-8328-006097BA83AB",
PROPSETID_VIDCAP_CUSTOM );
#define PROPSETID_VIDCAP_CUSTOM DEFINE_GUIDNAMED(
PROPSETID_VIDCAP_CUSTOM )

but when I complier TESTCAP sample ,I got a link err like this
"error LNK2001: unresolved external symbol _PROPSETID_VIDCAP_CUSTOM"
so I change to this

GUID PROPSETID_VIDCAP_CUSTOM =
{0xC44A1A10, 0x0A37, 0x11D2, {0x83, 0x28, 0x00, 0x60, 0x97, 0xBA,
0x83, 0xAB}};

I saw PROPSETID_VIDCAP_VIDEOCOMPRESSION is write like the first
method
where is the actual define of PROPSETID_VIDCAP_VIDEOCOMPRESSION ??

sorry for ask so much studip question ^^"""

Thanks a lot

Posted by Max Paklin on August 13th, 2004


Check runtime libraries. Run 'depends' on .ax file.


Testcap is Stream Class based sample, not AVStream.
Stream Class is an older technology, which is more limited in functionality.
It does not have a notion of automation table.


I don't why it gives you unresolved external. From what I remember about
this, it should work fine.
You built the driver with the BUILD, didn't you?


Do you know how to do search?
Why don't you do a bit your own homework? When in doubt do a search on \inc
and \lib in DDK. You'll be surprised how much usefull stuff you can find.

For this particular question of yours the answer is that
PROPSETID_VIDCAP_VIDEOCOMPRESSION is defined in ksguid.lib. It is also
defined in ksuser.lib, but that is the import library for user mode
ksuser.dll.

-- Max.