Re: Stream Device Driver

From: Yannick Chamming's [eMVP] (ychammings_nospam_at_adeset.com)
Date: 05/04/04


Date: Tue, 4 May 2004 15:44:36 +0200

If you call the ActivateDeviceEx, you should not put your reg entry in
builtin subkey, so that the driver would not be mounted at startup.

Furthermore, the first prm of ActivateDeviceEx is not the path of your
driver, but the registry base key that contain your driver's settings.

Finally, when you use the ActivateDeviceEx function, don't use the
registerdevice function in addition, and to connect to your driver once
mounted, you should use CreateFile API instead of loadlibrary.

In fact, you should have the following reg settings and code :

registry :

[HKEY_LOCAL_MACHINE\Drivers\Sample]
    "Dll" = "mydriver.Dll"
    "Prefix" = "DEM"
    "Index" = dword:1
    "Order" = dword:0
    "FriendlyName" = "Demo Driver"
    "Ioctl" = dword:0

App code :

 OutputDebugString(L"===> 1 \n");
 HANDLE TSP = ActivateDeviceEx(_T("Drivers\\Sample",NULL,0,NULL);

   OutputDebugString(L"===> 2 \n");

   OutputDebugString(L"===> 3 \n");
 if (h == 0)
    OutputDebugString(L"*** RegisterDevice failed\n");

   OutputDebugString(L"===> 4 \n");
 HANDLE hc = CreateFile(L"DEM1:", ...) ;
 if (hc != INVALID_HANDLE_VALUE)
 {

  ReadFromDriver() ;

 }
 else
    OutputDebugString(L"*** Failed CreateFile\n");

-- 
----------------------------------------------------------------
Yannick Chamming's (eMVP)
ADESET
Windows Embedded Manager
ychammings AT adeset DOT com>
http://www.adeset.com
Tél  : +33 (0)4.72.18.57.77
Fax : +33 (0)4.72.18.57.78
----------------------------------------------------------------
"Helix" <helix-remove@despammed.com> a écrit dans le message de
news:%23XOgN$SMEHA.3380@TK2MSFTNGP11.phx.gbl...
> Thank you everybody for answering :-)
>
> > Did you do the Testing the Functions section?  Did the results match the
> > results in that article?
>
> Yes I did,
> 1. with Dumpbin /exports mydriver.dll I see every entry point.
> 2. with CE Remote Registry Editor I see the entry I placed in
> HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Sample
> 3. with Windows CE Remote System Information I can't see my driver entry !
>
> > Did you look for the debug messages?  What was output?
>
> MY TEST APPLICATION
> --------------------
>    OutputDebugString(L"===> 1 \n");
>  HANDLE TSP = ActivateDeviceEx(_T("\\Windows\\MyDriver"),NULL,0,NULL);
>
>
>    OutputDebugString(L"===> 2 \n");
>  HANDLE h = RegisterDevice(TEXT("DEM"), 1, TEXT("MyDriver.dll"), 0) ;
>
>    OutputDebugString(L"===> 3 \n");
>  if (h == 0)
>     OutputDebugString(L"*** RegisterDevice failed\n");
>
>
>
>    OutputDebugString(L"===> 4 \n");
>  HINSTANCE  hc = LoadLibrary(L"MyDriver.dll") ;
>  if (hc != NULL)
>  {
>
>   ReadFromDriver() ;
>
>  }
>  else
>     OutputDebugString(L"*** Failed LoadLibrary\n");
>
>
> CEPB OUTPUT
> ------------
> 4294885534 PID:3d6c3aa TID:3d65252 ===> 1
> 4294885535 PID:43f982c2 TID:3d65252 0x83d65000:
> DEVICE!ActivateDeviceEx(\Windows\MyDriver) entered
> 4294885536 PID:43f982c2 TID:3d65252 0x83d65000: DEVICE!StartOneDriver
> RegOpenKeyEx(\Windows\MyDriver) returned 2.
> 4294885537 PID:3d6c3aa TID:3d65252 ===> 2
> 4294885644 PID:43f982c2 TID:3d65252 0x83d65000: >>> Loading module
> MyDriver.dll at address 0x01F00000-0x01F07000
> Loaded symbols for 'D:\WINCE420\PUBLIC\MYPROJECT\MYFILES\MyDriver.DLL'
> 4294885647 PID:43f982c2 TID:3d65252 MyDriver - DLL_PROCESS_ATTACH
> 4294885648 PID:43f982c2 TID:3d65252 MyDriver - DLL_PROCESS_DETACH
> 4294885650 PID:43f982c2 TID:3d65252 0x83d65000: <<< Unloading module
> MyDriver.dll at address 0x01F00000-0x01F07000
> Unloaded symbols for 'D:\WINCE420\PUBLIC\MYPROJECT\MYFILES\MyDriver.DLL'
> 4294885653 PID:3d6c3aa TID:3d65252 ===> 3
> 4294885654 PID:3d6c3aa TID:3d65252 *** RegisterDevice failed
> 4294885655 PID:3d6c3aa TID:3d65252 ===> 4
> 4294885679 PID:3d6c3aa TID:3d65252 0x83d65000: >>> Loading module
> MyDriver.dll at address 0x01F00000-0x01F07000
> Loaded symbols for 'D:\WINCE420\PUBLIC\MYPROJECT\MYFILES\MyDriver.DLL'
> 4294885732 PID:3d6c3aa TID:3d65252 MyDriver - DLL_PROCESS_ATTACH
> 4294885733 PID:3d6c3aa TID:3d65252 Failed to open Driver...
>
>


Relevant Pages

  • Re: CTA - truck crash
    ... The driver in this accident has most certainly been cut loose and is now ... every entry you make in a logbook, when verifed, in order for that entry ... It's a game you can lose without even moving your ...
    (misc.transport.trucking)
  • Re: Loomis or Gordan?
    ... >> way to measure a driver, ... >> Main Entry: prog7nos7ti7ca7tion ... >> I know you want your prognostication to be fact. ... >> Perhaps I should also include OPINION: ...
    (rec.autos.sport.nascar)
  • RE: DBD::Solid or DBD::ODBC with Solid
    ... used by unixODBC and the shared object for your ... driver can be loaded then it should work. ... Entry: ... SQLState = ffbef4f0 ...
    (perl.dbi.users)
  • Re: Mainstone II BSP PC Card Driver
    ... The reason I was looking into that was the Order registry ... ActivateDeviceEx returning NULL). ... Dummy is a driver I added just to be sure the process does indeed ... DeviceFolder::LoadDevice!Loading driver from device key ...
    (microsoft.public.windowsce.embedded)
  • Re: What is the driver API call to register a device
    ... What I thought was that ActivateDeviceEx creates the Active key then calls ... ActivateDevice loads the driver into the Device Manager ... ActivateDeviceEx to work as expected (i.e. to load the driver and add the ...
    (microsoft.public.windowsce.platbuilder)