From 5e3641128fe0b931cf764db65ad27f234eff64cf Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Fri, 5 Oct 2007 15:12:25 +0000 Subject: [PATCH] - fix english SHELL_EXTENDED_SHORTCUT_DLG resource dialog - add runas dialog resource definition (not yet used) - store runas settings in shortcut properties svn path=/trunk/; revision=29397 --- reactos/dll/win32/shell32/shell32_En.rc | 33 ++++++++++++++++++----- reactos/dll/win32/shell32/shelllink.c | 36 ++++++++++++++++++++----- reactos/dll/win32/shell32/shres.rc | 2 ++ reactos/dll/win32/shell32/shresdef.h | 1 + 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/reactos/dll/win32/shell32/shell32_En.rc b/reactos/dll/win32/shell32/shell32_En.rc index 293960c0de5..d664107ae87 100644 --- a/reactos/dll/win32/shell32/shell32_En.rc +++ b/reactos/dll/win32/shell32/shell32_En.rc @@ -157,16 +157,17 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 PUSHBUTTON "A&dvanced...", 14022, 150, 115, 60, 14, ES_LEFT } -SHELL_EXTENDED_SHORTCUT_DLG DIALOGEX 0, 0, 150, 130 +SHELL_EXTENDED_SHORTCUT_DLG DIALOGEX 0, 0, 260, 150 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION CAPTION "Extended Properties" FONT 8, "MS Shell Dlg", 0, 0, 0x0 { - LTEXT "Select extended properties for this Shortcut", -1, 5, 30, 150, 10 - CHECKBOX "Execute as a different user", 14000, 30, 50, 150, 10 - LTEXT "FIXME Desc", -1, 50, 70, 200, 40 - PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE - PUSHBUTTON "Abort", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE + LTEXT "Choose the advanced properties you want for this shortcut.", -1, 5, 30, 190, 10 + CHECKBOX "Run with different credentials", 14000, 30, 50, 150, 10 + LTEXT "This option can allow you to run the this shortcut as another\nuser, or continue as yourself while protecting your computer\nand data from unauthorized program activity.", -1, 50, 60, 200, 40 + CHECKBOX "Run in seperate memory space", 14001, 30, 100, 90, 10, WS_DISABLED + PUSHBUTTON "OK", IDOK, 25, 120, 40, 15, WS_VISIBLE + PUSHBUTTON "Abort", IDCANCEL, 120, 120, 50, 15, WS_VISIBLE } SHELL_FILE_GENERAL_DLG DIALOGEX 0, 0, 240, 130 @@ -275,6 +276,26 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 { } +RUN_AS_DIALOG DIALOGEX 0, 0, 240, 190 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Run As" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +{ + LTEXT "Which user account do you want to use to run this program?", -1, 30, 30, 170, 10 + CHECKBOX "Current User %s", 14000, 5, 45, 150, 10 + LTEXT "Protect my computer and data from unauthorized program activity", -1, 40, 65, 150, 10, WS_DISABLED + CHECKBOX "This option can prevent computer viruses from harming your\ncomputer or personal data, but selecting it might cause the\nprogram to function improperly.", 14001, 40, 80, 150, 10, WS_DISABLED + CHECKBOX "The following user:", 14002, 5, 100, 90, 10 + LTEXT "User name:", -1, 15, 115, 60, 10 + COMBOBOX 14003, 70, 115, 100, 15, CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP + + PUSHBUTTON "...", 14004, 180, 115, 30, 10, WS_TABSTOP + LTEXT "Password:", -1, 15, 140, 60, 10 + EDITTEXT 14005, 70, 140, 100, 10, ES_LEFT | WS_BORDER | WS_GROUP + PUSHBUTTON "...", 14006, 180, 140, 30, 10, WS_TABSTOP + PUSHBUTTON "OK", 14007, 70, 170, 60, 15, WS_TABSTOP + PUSHBUTTON "Cancel", 14008, 140, 170, 60, 15, WS_TABSTOP +} STRINGTABLE DISCARDABLE { diff --git a/reactos/dll/win32/shell32/shelllink.c b/reactos/dll/win32/shell32/shelllink.c index 533fd42a1d1..2173ed544a4 100644 --- a/reactos/dll/win32/shell32/shelllink.c +++ b/reactos/dll/win32/shell32/shelllink.c @@ -158,6 +158,7 @@ typedef struct LPWSTR sProduct; LPWSTR sComponent; LPWSTR sLinkPath; + BOOL bRunAs; volume_info volume; BOOL bDirty; @@ -919,6 +920,15 @@ static HRESULT WINAPI IPersistStream_fnLoad( r = Stream_LoadAdvertiseInfo( stm, &This->sComponent ); TRACE("Component -> %s\n",debugstr_w(This->sComponent)); } + if( hdr.dwFlags & SLDF_RUNAS_USER ) + { + This->bRunAs = TRUE; + } + else + { + This->bRunAs = FALSE; + } + if( FAILED( r ) ) goto end; @@ -1106,6 +1116,8 @@ static HRESULT WINAPI IPersistStream_fnSave( header.dwFlags |= SLDF_HAS_LOGO3ID; if( This->sComponent ) header.dwFlags |= SLDF_HAS_DARWINID; + if( This->bRunAs ) + header.dwFlags |= SLDF_RUNAS_USER; SystemTimeToFileTime ( &This->time1, &header.Time1 ); SystemTimeToFileTime ( &This->time2, &header.Time2 ); @@ -1219,6 +1231,7 @@ HRESULT WINAPI IShellLink_Constructor( IUnknown *pUnkOuter, sl->lpvtblObjectWithSite = &owsvt; sl->iShowCmd = SW_SHOWNORMAL; sl->bDirty = FALSE; + sl->bRunAs = FALSE; sl->iIdOpen = -1; sl->site = NULL; @@ -2559,9 +2572,15 @@ INT_PTR CALLBACK ExtendedShortcutProc( ) { HWND hDlgCtrl; + switch(uMsg) { case WM_INITDIALOG: + if (lParam) + { + hDlgCtrl = GetDlgItem(hwndDlg, 14000); + SendMessage(hDlgCtrl, BM_SETCHECK, BST_CHECKED, 0); + } return TRUE; case WM_COMMAND: hDlgCtrl = GetDlgItem(hwndDlg, 14000); @@ -2574,7 +2593,7 @@ INT_PTR CALLBACK ExtendedShortcutProc( } else if (LOWORD(wParam) == IDCANCEL) { - EndDialog(hwndDlg, 0); + EndDialog(hwndDlg, -1); } else if (LOWORD(wParam) == 14000) { @@ -2609,6 +2628,7 @@ SH_ShellLinkDlgProc( HWND hDlgCtrl; WCHAR szBuffer[MAX_PATH]; int IconIndex; + INT_PTR result; This = (IShellLinkImpl *)GetWindowLongPtr(hwndDlg, DWLP_USER); @@ -2685,13 +2705,15 @@ SH_ShellLinkDlgProc( } return TRUE; case 14022: - if (DialogBox(shell32_hInstance, MAKEINTRESOURCEW(SHELL_EXTENDED_SHORTCUT_DLG), hwndDlg, ExtendedShortcutProc) > 0) + result = DialogBoxParamW(shell32_hInstance, MAKEINTRESOURCEW(SHELL_EXTENDED_SHORTCUT_DLG), hwndDlg, ExtendedShortcutProc, (LPARAM)This->bRunAs); + if (result == 1 || result == 0) { - /// - /// FIXME - /// store properties - /// http://blogs.msdn.com/vistacompatteam/archive/2006/09/25/771232.aspx - /// + if ( This->bRunAs != result ) + { + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + + This->bRunAs = result; } return TRUE; } diff --git a/reactos/dll/win32/shell32/shres.rc b/reactos/dll/win32/shell32/shres.rc index 8dbe635f790..cc1cbbf8160 100644 --- a/reactos/dll/win32/shell32/shres.rc +++ b/reactos/dll/win32/shell32/shres.rc @@ -46,6 +46,8 @@ END #include "shell32_xx.rc" + + /* * This include a set of Shell32 icons, * bitmaps and avi files. Licence's can be diff --git a/reactos/dll/win32/shell32/shresdef.h b/reactos/dll/win32/shell32/shresdef.h index d63ec935cb8..16351c01a5d 100644 --- a/reactos/dll/win32/shell32/shresdef.h +++ b/reactos/dll/win32/shell32/shresdef.h @@ -95,6 +95,7 @@ #define IDD_TITLE 0x3742 #define IDD_TREEVIEW 0x3741 #define SHELL_EXTENDED_SHORTCUT_DLG 0x4000 +#define RUN_AS_DIALOG 0x4001 /* * Do not alter the icon, bitmap + avi resource