Re: pnp

From
Alex Fedotov ()
To
Sergey Andyk
Date
2001-05-24T19:01:50Z
Area
SU.WINDOWS.NT.PROG
From: "Alex Fedotov" <alexf@3cube.com>

Sergey Andyk wrote:

> Надо заставить win2k сделать "Scan for hardware changes"
> Кто-нить знает как ?

Смотри MSDN KB article Q259697:
HOWTO: Force Reenumeration of a Device Tree From an Application
http://support.microsoft.com/support/kb/articles/q259/6/97.asp

- --- cut ---
The following code snippet shows you how to reenumerate the entire
device tree. This is the programmatic equivalent of clicking the Scan
For Hardware Changes menu item in the Device Manager.

BOOL ScanForHardwareChanges()
{
    DEVINST     devInst;
    CONFIGRET   status;

    //
    // Get the root devnode.
    //

    status = CM_Locate_DevNode(&devInst, NULL,
                                  CM_LOCATE_DEVNODE_NORMAL);

    if (status != CR_SUCCESS) {
        printf("CM_Locate_DevNode failed: %x\n", status);
        return FALSE;

    }

    status = CM_Reenumerate_DevNode(devInst, 0);

    if (status != CR_SUCCESS) {
        printf("CM_Reenumerate_DevNode failed: %x\n", status));
        return FALSE;
    }

    return TRUE;
}
- --- cut ---

--
Alex Fedotov


--- ifmail v.2.15dev5
 * Origin: 3Cube, Inc. (www.3cube.com) (2:5020/400)