MCPcopy Create free account
hub / github.com/NullArray/WinKernel-Resources / cmdDPDelete

Function cmdDPDelete

Drivers/Driver-SRC/setup/devcon/cmds.cpp:2305–2382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2303}
2304
2305int cmdDPDelete(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[])
2306/*++
2307
2308Routine Description:
2309 dp_delete
2310 Deletes a driver package to the machine.
2311
2312Arguments:
2313
2314 BaseName - name of executable
2315 Machine - machine name, must be NULL
2316 argc/argv - remaining parameters
2317
2318Return Value:
2319
2320 EXIT_xxxx
2321
2322--*/
2323{
2324 int failcode = EXIT_FAIL;
2325 DWORD res;
2326 TCHAR InfFileName[MAX_PATH];
2327 PTSTR FilePart = NULL;
2328 HMODULE setupapiMod = NULL;
2329 SetupUninstallOEMInfProto SUOIFn;
2330
2331 UNREFERENCED_PARAMETER(BaseName);
2332 UNREFERENCED_PARAMETER(Machine);
2333
2334 if(!argc) {
2335 return EXIT_USAGE;
2336 }
2337
2338 res = GetFullPathName(argv[0],
2339 ARRAYSIZE(InfFileName),
2340 InfFileName,
2341 &FilePart);
2342 if ((!res) || (!FilePart)) {
2343 FormatToStream(stdout,MSG_DPADD_INVALID_INF);
2344 goto final;
2345 }
2346
2347 setupapiMod = LoadLibrary(TEXT("setupapi.dll"));
2348 if(!setupapiMod) {
2349 goto final;
2350 }
2351 SUOIFn = (SetupUninstallOEMInfProto)GetProcAddress(setupapiMod,SETUPUNINSTALLOEMINF);
2352 if(!SUOIFn)
2353 {
2354 goto final;
2355 }
2356
2357 if (!SUOIFn(FilePart,
2358 ((Flags & DEVCON_FLAG_FORCE) ? 1 : 0),
2359 NULL)) {
2360 if (GetLastError() == ERROR_INF_IN_USE_BY_DEVICES) {
2361 FormatToStream(stdout,MSG_DPDELETE_FAILED_IN_USE);
2362 } else if (GetLastError() == ERROR_NOT_AN_INSTALLED_OEM_INF) {

Callers

nothing calls this directly

Calls 1

FormatToStreamFunction · 0.85

Tested by

no test coverage detected