| 2237 | } |
| 2238 | |
| 2239 | int cmdDPAdd(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) |
| 2240 | /*++ |
| 2241 | |
| 2242 | Routine Description: |
| 2243 | dp_add |
| 2244 | Add a driver package to the machine. |
| 2245 | |
| 2246 | Arguments: |
| 2247 | |
| 2248 | BaseName - name of executable |
| 2249 | Machine - machine name, must be NULL |
| 2250 | argc/argv - remaining parameters |
| 2251 | |
| 2252 | Return Value: |
| 2253 | |
| 2254 | EXIT_xxxx |
| 2255 | |
| 2256 | --*/ |
| 2257 | { |
| 2258 | int failcode = EXIT_FAIL; |
| 2259 | DWORD res; |
| 2260 | TCHAR SourceInfFileName[MAX_PATH]; |
| 2261 | TCHAR DestinationInfFileName[MAX_PATH]; |
| 2262 | PTSTR DestinationInfFileNameComponent = NULL; |
| 2263 | PTSTR FilePart = NULL; |
| 2264 | |
| 2265 | UNREFERENCED_PARAMETER(BaseName); |
| 2266 | UNREFERENCED_PARAMETER(Machine); |
| 2267 | UNREFERENCED_PARAMETER(Flags); |
| 2268 | |
| 2269 | if(!argc) { |
| 2270 | return EXIT_USAGE; |
| 2271 | } |
| 2272 | |
| 2273 | res = GetFullPathName(argv[0], |
| 2274 | ARRAYSIZE(SourceInfFileName), |
| 2275 | SourceInfFileName, |
| 2276 | &FilePart); |
| 2277 | if ((!res) || (res >= ARRAYSIZE(SourceInfFileName))) { |
| 2278 | FormatToStream(stdout,MSG_DPADD_INVALID_INF); |
| 2279 | goto final; |
| 2280 | } |
| 2281 | |
| 2282 | if (!SetupCopyOEMInf(SourceInfFileName, |
| 2283 | NULL, |
| 2284 | SPOST_PATH, |
| 2285 | 0, |
| 2286 | DestinationInfFileName, |
| 2287 | ARRAYSIZE(DestinationInfFileName), |
| 2288 | NULL, |
| 2289 | &DestinationInfFileNameComponent)) { |
| 2290 | FormatToStream(stdout,MSG_DPADD_FAILED); |
| 2291 | goto final; |
| 2292 | } |
| 2293 | |
| 2294 | // |
| 2295 | // Successfully added the driver package to the machine. |
| 2296 | // |
nothing calls this directly
no test coverage detected