Esempio n. 1
0
static BOOL UninstallInf(const char *pPath)
{
  int res;

  do {
    res = IDCONTINUE;

    char infPathDest[MAX_PATH];

    if (SNPRINTF(infPathDest, sizeof(infPathDest)/sizeof(infPathDest[0]), "%s", pPath) > 0) {
#ifdef HAVE_SetupUninstallOEMInf
      char *pInfNameDest, *p;

      for (pInfNameDest = p = infPathDest ; *p ; p++)
        if (*p == '\\')
          pInfNameDest = p + 1;

      if (SetupUninstallOEMInf(pInfNameDest, 0, NULL)) {
        Trace("Deleted %s\n", pInfNameDest);
      } else {
        res = ShowLastError(MB_CANCELTRYCONTINUE, "SetupUninstallOEMInf(%s)", pInfNameDest);
      }
#else /* HAVE_SetupUninstallOEMInf */
      if (UninstallFile(infPathDest)) {
        int infPathDestLen = lstrlen(infPathDest);

        if (infPathDestLen > 4) {
          char *pInfPathDestExt = infPathDest + infPathDestLen - 4;

          if (!lstrcmpi(pInfPathDestExt, ".inf")) {
            pInfPathDestExt[1] = 'p';     // pInfPathDestExt = ".pnf"

            if (!UninstallFile(infPathDest))
              res = IDCANCEL;
          }
        }
      } else {
        res = IDCANCEL;
      }
#endif /* HAVE_SetupUninstallOEMInf */
    } else {
      Trace("Can't uninstall %s\n", pPath);
      res = IDCANCEL;
    }
  } while (res == IDTRYAGAIN);

  if (res != IDCONTINUE)
    return FALSE;

  return res;
}
Esempio n. 2
0
	} else {
		_ftprintf(stderr, _T("%s"), USAGE);
		return 254;
	}

	XDbgDetach(&co);
	XDbgCleanup();

	return iRet;
}

#if 0
#if (WINVER >= 0x0501)
DWORD Flags = 0; // SUOI_FORCEDELETE;
fSuccess = SetupUninstallOEMInf(
								argv[2],
								Flags,
								NULL);

if (!fSuccess) {
	_ftprintf(stderr, _T("Error %d (%08X)\n"), 
		GetLastError(),
		GetLastError());
} else {
	_ftprintf(stdout, _T("OEM Inf %d is deleted successfully.\n"), argv[2]);
}
#else
_ftprintf(stderr, _T("This feature is only available on Windows XP"));
#endif
#endif