| 158 | } |
| 159 | |
| 160 | BOOL DumpDeviceStatus(_In_ HDEVINFO Devs, _In_ PSP_DEVINFO_DATA DevInfo) |
| 161 | /*++ |
| 162 | |
| 163 | Routine Description: |
| 164 | |
| 165 | Write device status to stdout |
| 166 | |
| 167 | Arguments: |
| 168 | |
| 169 | Devs )_ uniquely identify device |
| 170 | DevInfo ) |
| 171 | |
| 172 | Return Value: |
| 173 | |
| 174 | none |
| 175 | |
| 176 | --*/ |
| 177 | { |
| 178 | SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail; |
| 179 | ULONG status = 0; |
| 180 | ULONG problem = 0; |
| 181 | BOOL hasInfo = FALSE; |
| 182 | BOOL isPhantom = FALSE; |
| 183 | CONFIGRET cr = CR_SUCCESS; |
| 184 | |
| 185 | devInfoListDetail.cbSize = sizeof(devInfoListDetail); |
| 186 | if((!SetupDiGetDeviceInfoListDetail(Devs,&devInfoListDetail)) || |
| 187 | ((cr = CM_Get_DevNode_Status_Ex(&status,&problem,DevInfo->DevInst,0,devInfoListDetail.RemoteMachineHandle))!=CR_SUCCESS)) { |
| 188 | if ((cr == CR_NO_SUCH_DEVINST) || (cr == CR_NO_SUCH_VALUE)) { |
| 189 | isPhantom = TRUE; |
| 190 | } else { |
| 191 | Padding(1); |
| 192 | FormatToStream(stdout,MSG_DUMP_STATUS_ERROR); |
| 193 | return FALSE; |
| 194 | } |
| 195 | } |
| 196 | // |
| 197 | // handle off the status/problem codes |
| 198 | // |
| 199 | if (isPhantom) { |
| 200 | Padding(1); |
| 201 | FormatToStream(stdout,MSG_DUMP_PHANTOM); |
| 202 | return TRUE; |
| 203 | } |
| 204 | if((status & DN_HAS_PROBLEM) && problem == CM_PROB_DISABLED) { |
| 205 | hasInfo = TRUE; |
| 206 | Padding(1); |
| 207 | FormatToStream(stdout,MSG_DUMP_DISABLED); |
| 208 | return TRUE; |
| 209 | } |
| 210 | if(status & DN_HAS_PROBLEM) { |
| 211 | hasInfo = TRUE; |
| 212 | Padding(1); |
| 213 | FormatToStream(stdout,MSG_DUMP_PROBLEM,problem); |
| 214 | } |
| 215 | if(status & DN_PRIVATE_PROBLEM) { |
| 216 | hasInfo = TRUE; |
| 217 | Padding(1); |
no test coverage detected