summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-01 10:29:42 +0100
committerSimon Rettberg2019-03-01 10:29:42 +0100
commitbc08232b2b0a3ca62ada8a175b9b6eda0dfdbc50 (patch)
tree42c6e8adc85a03ff0e59b7a6a84f1bd026e22a04
parent[run-virt] Add printer to UI (diff)
downloadmltk-bc08232b2b0a3ca62ada8a175b9b6eda0dfdbc50.tar.gz
mltk-bc08232b2b0a3ca62ada8a175b9b6eda0dfdbc50.tar.xz
mltk-bc08232b2b0a3ca62ada8a175b9b6eda0dfdbc50.zip
[run-virt] Support setting printer as default by naming it @*
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exebin57344 -> 58368 bytes
-rw-r--r--core/modules/run-virt/winres/src/winres.c19
2 files changed, 16 insertions, 3 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe b/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
index 2e0aff80..af1d0bd1 100755
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
Binary files differ
diff --git a/core/modules/run-virt/winres/src/winres.c b/core/modules/run-virt/winres/src/winres.c
index ca968cda..939739fb 100644
--- a/core/modules/run-virt/winres/src/winres.c
+++ b/core/modules/run-virt/winres/src/winres.c
@@ -993,9 +993,22 @@ static void postSuccessfulMount(const netdrive_t *d, wchar_t *letter)
//int offs = (def ? 1 : 0); TODO
}
StringCchPrintfW(cmdline, MAX_PATH, L"printui.dll PrintUIEntry /q /in /n \"%s\"", wUncPath);
- // TODO: Make sure COM is initialized
- ShellExecuteW(NULL, L"open", L"rundll32", cmdline, NULL, SW_HIDE);
- // TODO: Set default; need to wait for install to finish
+ SHELLEXECUTEINFOW e = {0}, f = {0};
+ e.cbSize = sizeof(e);
+ e.lpFile = L"rundll32";
+ e.lpParameters = cmdline;
+ e.nShow = SW_HIDE;
+ f = e; // Copy struct before we set the following flag for the first one
+ e.fMask = SEE_MASK_NOCLOSEPROCESS; // So we can wait for the first one
+ ShellExecuteExW(&e);
+ if (def) { // Only actually do so if we want to set it as default
+ WaitForSingleObject(e.hProcess, INFINITE);
+ }
+ CloseHandle(e.hProcess);
+ if (def) {
+ StringCchPrintfW(cmdline, MAX_PATH, L"printui.dll PrintUIEntry /q /y /n \"%s\"", wUncPath);
+ ShellExecuteExW(&f);
+ }
}
}