Yannick
Tue May 04 08:44:36 CDT 2004
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...
>
>