Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/windows/build/build-installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ namespace PayloadInstaller
if (File.Exists(QdinstallExe))
{
Console.WriteLine("\nRunning uninstaller: " + QdinstallExe);
result = RunCommand(QdinstallExe, "-x");
result = RunCommand(QdinstallExe, "-u");
}

if (Directory.Exists(InstallPath))
Expand Down
22 changes: 16 additions & 6 deletions src/windows/build/qdinstall/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ DWORD install_drivers(const std::wstring &path)

DWORD uninstall_drivers()
{
printf("Removing drivers ...\n");
DWORD ret = execute_command(COMMAND_QDCLR);

if (ret == ERROR_FILE_NOT_FOUND)
Expand Down Expand Up @@ -155,7 +154,8 @@ static void inline print_usage()
" qdinstall.exe [options]\n\n"
"Options:\n"
" -i -p <path> Install drivers from path\n"
" -x Uninstall drivers\n"
" -u Uninstall drivers\n"
" -x Uninstall drivers and remove installation files\n"
" -v Display version information\n"
);
}
Expand All @@ -170,10 +170,18 @@ static DWORD parse_args(int argc, wchar_t *argv[], Options &opts)
{
opts.install = true;
opts.uninstall = false;
opts.remove = false;
}
else if (arg == L"-x")
else if (arg == L"-u")
{
opts.uninstall = true;
opts.remove = false;
opts.install = false;
}
else if (arg == L"-x")
{
opts.remove = true;
opts.uninstall = false;
opts.install = false;
}
else if (arg == L"-v")
Expand Down Expand Up @@ -320,7 +328,7 @@ int wmain(int argc, wchar_t *argv[])
}
}
}
else if (opts.uninstall)
else if (opts.uninstall || opts.remove)
{
// Read install location from registry before unregistering
std::wstring install_location = get_registered_install_location();
Expand All @@ -334,21 +342,23 @@ int wmain(int argc, wchar_t *argv[])
execute_command(std::wstring(COMMAND_WWANSVC) + L" uninstall");
}

printf("\nRemoving drivers ...\n");
ret = uninstall_drivers();
if (ret != ERROR_SUCCESS && ret != ERROR_FILE_NOT_FOUND)
{
printf("ERROR: failed to uninstall driver (0x%lX)\n", ret);
return ret;
}

printf("\nCleaning up registry entries ...\n");
ret = unregister_installation();
if (ret != ERROR_SUCCESS)
{
printf("WARNING: failed to clean up registry (0x%lX), continuing...\n", ret);
}

// Schedule deletion of install directory (cannot delete self while running)
if (!install_location.empty())
// Schedule deletion of install directory (-x only, cannot delete self while running)
if (opts.remove && !install_location.empty())
{
DWORD attr = GetFileAttributesW(install_location.c_str());
if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
Expand Down
3 changes: 2 additions & 1 deletion src/windows/build/qdinstall/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
struct Options
{
bool install = true; // default action
bool uninstall = false;
bool uninstall = false; // -u: uninstall drivers only (no directory deletion)
bool remove = false; // -x: uninstall drivers and remove installation files
bool version = false;
bool getInstallPath = false;
std::wstring installationPath;
Expand Down
Loading