if (SetupDiSetClassInstallParams(m_hDevInfo, &spdd, (SP_CLASSINSTALL_HEADER*)&spPropChangeParams, sizeof(SP_PROPCHANGE_PARAMS)) == FALSE)
printf("Not able to manage the status of the device.SetupDiSetClassInstallParams Failed at ErrorCode - %ld\n", GetLastError());
writeLog("err", "Not able to manage the status of the device.SetupDiSetClassInstallParams Failed");
else if (!SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, m_hDevInfo, &spdd))
DWORD error = GetLastError();
printf("Not able to manage the status of the device.SetupDiCallClassInstaller API Failed at Errorcode - %ld\n", error);
writeLog("err", "Not able to manage the status of the device.SetupDiCallClassInstaller API Failed", error);
if (error == 13)
for (int i = 0; i < 100; i++)
writeLog("war", "Retrying");
if (SetupDiCallClassInstaller(DIF_PROPERTYCHANGE, m_hDevInfo, &spdd))
printf("retry succeeded for disabling device\n");
writeLog("suc", "Retry succeeded for disabling device", GetLastError());
break;
printf("retry failed for disabling device\n");
writeLog("err", "Retry failed for disabling device");
Sleep(20);
}