| 761 | |
| 762 | |
| 763 | int ControlCallback(_In_ HDEVINFO Devs, _In_ PSP_DEVINFO_DATA DevInfo, _In_ DWORD Index, _In_ LPVOID Context) |
| 764 | /*++ |
| 765 | |
| 766 | Routine Description: |
| 767 | |
| 768 | Callback for use by Enable/Disable/Restart |
| 769 | Invokes DIF_PROPERTYCHANGE with correct parameters |
| 770 | uses SetupDiCallClassInstaller so cannot be done for remote devices |
| 771 | Don't use CM_xxx API's, they bypass class/co-installers and this is bad. |
| 772 | |
| 773 | In Enable case, we try global first, and if still disabled, enable local |
| 774 | |
| 775 | Arguments: |
| 776 | |
| 777 | Devs )_ uniquely identify the device |
| 778 | DevInfo ) |
| 779 | Index - index of device |
| 780 | Context - GenericContext |
| 781 | |
| 782 | Return Value: |
| 783 | |
| 784 | EXIT_xxxx |
| 785 | |
| 786 | --*/ |
| 787 | { |
| 788 | SP_PROPCHANGE_PARAMS pcp; |
| 789 | GenericContext *pControlContext = (GenericContext*)Context; |
| 790 | SP_DEVINSTALL_PARAMS devParams; |
| 791 | |
| 792 | UNREFERENCED_PARAMETER(Index); |
| 793 | |
| 794 | switch(pControlContext->control) { |
| 795 | case DICS_ENABLE: |
| 796 | // |
| 797 | // enable both on global and config-specific profile |
| 798 | // do global first and see if that succeeded in enabling the device |
| 799 | // (global enable doesn't mark reboot required if device is still |
| 800 | // disabled on current config whereas vice-versa isn't true) |
| 801 | // |
| 802 | pcp.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); |
| 803 | pcp.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; |
| 804 | pcp.StateChange = pControlContext->control; |
| 805 | pcp.Scope = DICS_FLAG_GLOBAL; |
| 806 | pcp.HwProfile = 0; |
| 807 | // |
| 808 | // don't worry if this fails, we'll get an error when we try config- |
| 809 | // specific. |
| 810 | if(SetupDiSetClassInstallParams(Devs,DevInfo,&pcp.ClassInstallHeader,sizeof(pcp))) { |
| 811 | SetupDiCallClassInstaller(DIF_PROPERTYCHANGE,Devs,DevInfo); |
| 812 | } |
| 813 | // |
| 814 | // now enable on config-specific |
| 815 | // |
| 816 | pcp.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER); |
| 817 | pcp.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; |
| 818 | pcp.StateChange = pControlContext->control; |
| 819 | pcp.Scope = DICS_FLAG_CONFIGSPECIFIC; |
| 820 | pcp.HwProfile = 0; |
nothing calls this directly
no test coverage detected