| 2181 | } |
| 2182 | |
| 2183 | int cmdSetHwid(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) |
| 2184 | /*++ |
| 2185 | |
| 2186 | Routine Description: |
| 2187 | |
| 2188 | SETHWID |
| 2189 | changes the hardware ID's of the listed root-enumerated devices |
| 2190 | This demonstrates how to differentiate between root-enumerated and |
| 2191 | non root-enumerated devices. |
| 2192 | It also demonstrates how to get/set hardware ID's of root-enumerated |
| 2193 | devices. |
| 2194 | |
| 2195 | Arguments: |
| 2196 | |
| 2197 | BaseName - name of executable |
| 2198 | Machine - machine name, must be NULL |
| 2199 | argc/argv - remaining parameters |
| 2200 | |
| 2201 | Return Value: |
| 2202 | |
| 2203 | EXIT_xxxx |
| 2204 | |
| 2205 | --*/ |
| 2206 | { |
| 2207 | SetHwidContext context; |
| 2208 | int failcode = EXIT_FAIL; |
| 2209 | |
| 2210 | UNREFERENCED_PARAMETER(Flags); |
| 2211 | |
| 2212 | if(!SplitCommandLine(argc,argv,context.argc_right,context.argv_right) |
| 2213 | || (argc == 0) |
| 2214 | || (context.argc_right == 0)) { |
| 2215 | // |
| 2216 | // arguments required both left and right of ':=' |
| 2217 | // |
| 2218 | return EXIT_USAGE; |
| 2219 | } |
| 2220 | context.skipped = 0; |
| 2221 | context.modified = 0; |
| 2222 | context.prop = SPDRP_HARDWAREID; |
| 2223 | |
| 2224 | failcode = EnumerateDevices(BaseName,Machine,DIGCF_PRESENT,argc,argv,SetHwidCallback,&context); |
| 2225 | |
| 2226 | if(failcode == EXIT_OK) { |
| 2227 | |
| 2228 | if(context.skipped) { |
| 2229 | FormatToStream(stdout,MSG_SETHWID_TAIL_SKIPPED,context.skipped,context.modified); |
| 2230 | } else if(context.modified) { |
| 2231 | FormatToStream(stdout,MSG_SETHWID_TAIL_MODIFIED,context.modified); |
| 2232 | } else { |
| 2233 | FormatToStream(stdout,MSG_SETHWID_TAIL_NONE); |
| 2234 | } |
| 2235 | } |
| 2236 | return failcode; |
| 2237 | } |
| 2238 | |
| 2239 | int cmdDPAdd(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) |
| 2240 | /*++ |
nothing calls this directly
no test coverage detected