Re: What is the driver API call to register a device

From: Dale Ziebarth (dziebarth_at_hotmail.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 12:48:02 -0500

Do you have an example of how to use the ActivateDeviceEx() ? Paul Tobey
was helping me through it (my hardware crashed yesterday afternoon) but he
did not have any example code. This is what I am doing. What is wrong with
it ? I think this is what is being asked - how to call the function.

#include <devload.h>
REGINI registrySettings[4];
HANDLE spiDriverHandle;
DWORD theProblem;

    registrySettings[0].lpszVal = DEVLOAD_DLLNAME_VALNAME; //
TEXT("Dll")
    registrySettings[0].pData = (unsigned char *)TEXT("SPI_Line.dll");
    registrySettings[0].dwLen = 12;
    registrySettings[0].dwType = DEVLOAD_DLLNAME_VALTYPE; // REG_SZ

    registrySettings[1].lpszVal = DEVLOAD_PREFIX_VALNAME; //
TEXT("Prefix")
    registrySettings[1].pData = (unsigned char *)TEXT("SPI_ME");
    registrySettings[1].dwLen = 3;
    registrySettings[1].dwType = DEVLOAD_PREFIX_VALTYPE; // REG_SZ

// // Attempt to load it.
// spiDriverHandle = ActivateDeviceEx(
// (unsigned short
*)TEXT("\\Drivers\\BuiltIn\\SPI_ME"),
// registrySettings,
// 4,
// (LPVOID)NULL
// );
//
    spiDriverHandle = ActivateDevice (
                        (LPCWSTR)(TEXT("Drivers\\BuiltIn\\SPI_ME")),
                        (DWORD)NULL
                        );

    theProblem = GetLastError();

"theProblem" always shows 0 and the pointer always returns as NULL.

Thanks for your help.

"Steve Maillet (eMVP)" <nospam1@EntelechyConsulting.com> wrote in message
news:uNygN$gLEHA.620@TK2MSFTNGP10.phx.gbl...
> USB class/device drivers can expose a stream interface and load that with
> ActivateDeviceEx() and unload it with DeactiveateDevice().
>
> --
> Steve Maillet (eMVP)
> EmbeddedFusion
> smaillet_AT_EmbeddedFusion_DOT_com
>
>