mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-05-28 09:42:33 -04:00
Allow setting APP_UID in file dialog helper process
This commit is contained in:
@@ -259,7 +259,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
||||
HWND parent = NULL;
|
||||
bool save_dialog = false, multiselect = false, confirm_overwrite = false, only_dirs = false, no_symlinks = false;
|
||||
unsigned short len = 0;
|
||||
LPWSTR title = NULL, folder = NULL, filename = NULL, save_path = NULL, echo = NULL, pipename = NULL, default_extension = NULL;
|
||||
LPWSTR title = NULL, folder = NULL, filename = NULL, save_path = NULL, echo = NULL, pipename = NULL, default_extension = NULL, app_uid = NULL;
|
||||
COMDLG_FILTERSPEC *file_types = NULL;
|
||||
UINT num_file_types = 0;
|
||||
HANDLE pipe = INVALID_HANDLE_VALUE;
|
||||
@@ -290,6 +290,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
||||
|
||||
else if CHECK_KEY("SECRET") { if(!read_bytes(SECRET_SIZE, secret)) return 1; }
|
||||
|
||||
else if CHECK_KEY("APP_UID") { READSTR(app_uid) }
|
||||
|
||||
else if CHECK_KEY("TITLE") { READSTR(title) }
|
||||
|
||||
else if CHECK_KEY("FOLDER") { READSTR(folder) }
|
||||
@@ -329,6 +331,11 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
||||
if (!write_bytes(pipe, SECRET_SIZE+1, secret)) return 1;
|
||||
return write_bytes(pipe, echo_sz, echo_buf) ? 0 : 1;
|
||||
}
|
||||
if (app_uid != NULL) {
|
||||
if (SetCurrentProcessExplicitAppUserModelID(app_uid) != S_OK) {
|
||||
// do nothing since this is not critical
|
||||
}
|
||||
}
|
||||
set_dpi_aware();
|
||||
return show_dialog(pipe, secret, parent, save_dialog, title, folder, filename, save_path, multiselect, confirm_overwrite, only_dirs, no_symlinks, file_types, num_file_types, default_extension);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user