MCPcopy Create free account
hub / github.com/NullArray/WinKernel-Resources / cmdRescan

Function cmdRescan

Drivers/Driver-SRC/setup/devcon/cmds.cpp:1626–1686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1624}
1625
1626int cmdRescan(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[])
1627/*++
1628
1629Routine Description:
1630
1631 RESCAN
1632 rescan for new devices
1633
1634Arguments:
1635
1636 BaseName - name of executable
1637 Machine - machine name, must be NULL
1638 argc/argv - remaining parameters
1639
1640Return Value:
1641
1642 EXIT_xxxx
1643
1644--*/
1645{
1646
1647 //
1648 // reenumerate from the root of the devnode tree
1649 // totally CM based
1650 //
1651 int failcode = EXIT_FAIL;
1652 HMACHINE machineHandle = NULL;
1653 DEVINST devRoot;
1654
1655 UNREFERENCED_PARAMETER(BaseName);
1656 UNREFERENCED_PARAMETER(Flags);
1657 UNREFERENCED_PARAMETER(argc);
1658 UNREFERENCED_PARAMETER(argv);
1659
1660 if(Machine) {
1661 if(CM_Connect_Machine(Machine,&machineHandle) != CR_SUCCESS) {
1662 return failcode;
1663 }
1664 }
1665
1666 if(CM_Locate_DevNode_Ex(&devRoot,NULL,CM_LOCATE_DEVNODE_NORMAL,machineHandle) != CR_SUCCESS) {
1667 goto final;
1668 }
1669
1670 FormatToStream(stdout,Machine ? MSG_RESCAN : MSG_RESCAN_LOCAL);
1671
1672 if(CM_Reenumerate_DevNode_Ex(devRoot, 0, machineHandle) != CR_SUCCESS) {
1673 goto final;
1674 }
1675
1676 FormatToStream(stdout,MSG_RESCAN_OK);
1677
1678 failcode = EXIT_OK;
1679
1680final:
1681 if(machineHandle) {
1682 CM_Disconnect_Machine(machineHandle);
1683 }

Callers

nothing calls this directly

Calls 1

FormatToStreamFunction · 0.85

Tested by

no test coverage detected