mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 00:41:36 +00:00
[SHELL32]
- Fix exception in shortcut properties dialog svn path=/trunk/; revision=54957
This commit is contained in:
parent
d55ddcd563
commit
35da3cbf00
|
@ -2000,22 +2000,13 @@ INT_PTR CALLBACK ExtendedShortcutProc(HWND hwndDlg, UINT uMsg,
|
||||||
|
|
||||||
INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
LPPROPSHEETPAGEW ppsp;
|
CShellLink *pThis = (CShellLink *)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
||||||
LPPSHNOTIFY lppsn;
|
|
||||||
CShellLink *pThis;
|
|
||||||
HWND hDlgCtrl;
|
|
||||||
WCHAR szBuffer[MAX_PATH];
|
|
||||||
WCHAR * ptr;
|
|
||||||
int IconIndex;
|
|
||||||
INT_PTR result;
|
|
||||||
|
|
||||||
pThis = (CShellLink *)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
||||||
|
|
||||||
switch(uMsg)
|
switch(uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
ppsp = (LPPROPSHEETPAGEW)lParam;
|
LPPROPSHEETPAGEW ppsp = (LPPROPSHEETPAGEW)lParam;
|
||||||
if (ppsp == NULL)
|
if (ppsp == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2028,61 +2019,61 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
pThis->sIcoPath, pThis->sPath, pThis->sPathRel, pThis->sProduct, pThis->sWorkDir);
|
pThis->sIcoPath, pThis->sPath, pThis->sPathRel, pThis->sProduct, pThis->sWorkDir);
|
||||||
|
|
||||||
/* target location */
|
/* target location */
|
||||||
wchar_t * wTrgtLocat;
|
if (pThis->sWorkDir)
|
||||||
const int ch = '\\';
|
SetDlgItemTextW(hwndDlg, 14007, PathFindFileName(pThis->sWorkDir));
|
||||||
wTrgtLocat = wcsrchr(pThis->sWorkDir, ch)+1;
|
|
||||||
SetDlgItemTextW(hwndDlg, 14007, wTrgtLocat);
|
|
||||||
|
|
||||||
/* target path */
|
/* target path */
|
||||||
hDlgCtrl = GetDlgItem( hwndDlg, 14009 );
|
if (pThis->sPath)
|
||||||
if ( hDlgCtrl != NULL )
|
SetDlgItemTextW(hwndDlg, 14009, pThis->sPath);
|
||||||
SendMessageW( hDlgCtrl, WM_SETTEXT, (WPARAM)NULL, (LPARAM)pThis->sPath );
|
|
||||||
|
|
||||||
/* working dir */
|
/* working dir */
|
||||||
hDlgCtrl = GetDlgItem( hwndDlg, 14011 );
|
if (pThis->sWorkDir)
|
||||||
if ( hDlgCtrl != NULL )
|
SetDlgItemTextW(hwndDlg, 14011, pThis->sWorkDir);
|
||||||
SendMessageW( hDlgCtrl, WM_SETTEXT, (WPARAM)NULL, (LPARAM)pThis->sWorkDir );
|
|
||||||
|
|
||||||
/* description */
|
/* description */
|
||||||
hDlgCtrl = GetDlgItem( hwndDlg, 14019 );
|
if (pThis->sDescription)
|
||||||
if ( hDlgCtrl != NULL )
|
SetDlgItemTextW(hwndDlg, 14019, pThis->sDescription);
|
||||||
SendMessageW( hDlgCtrl, WM_SETTEXT, (WPARAM)NULL, (LPARAM)pThis->sDescription );
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
lppsn = (LPPSHNOTIFY) lParam;
|
{
|
||||||
if ( lppsn->hdr.code == PSN_APPLY )
|
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
|
||||||
|
if (lppsn->hdr.code == PSN_APPLY)
|
||||||
{
|
{
|
||||||
|
WCHAR wszBuf[MAX_PATH];
|
||||||
|
|
||||||
/* set working directory */
|
/* set working directory */
|
||||||
GetDlgItemTextW(hwndDlg, 14011, szBuffer, MAX_PATH);
|
GetDlgItemTextW(hwndDlg, 14011, wszBuf, MAX_PATH);
|
||||||
pThis->SetWorkingDirectory(szBuffer);
|
pThis->SetWorkingDirectory(wszBuf);
|
||||||
/* set link destination */
|
/* set link destination */
|
||||||
GetDlgItemTextW(hwndDlg, 14009, szBuffer, MAX_PATH);
|
GetDlgItemTextW(hwndDlg, 14009, wszBuf, MAX_PATH);
|
||||||
if ( !SHELL_ExistsFileW(szBuffer) )
|
if (!PathFileExistsW(wszBuf))
|
||||||
{
|
{
|
||||||
//FIXME load localized error msg
|
//FIXME load localized error msg
|
||||||
MessageBoxW( hwndDlg, L"file not existing", szBuffer, MB_OK );
|
MessageBoxW(hwndDlg, L"file not existing", wszBuf, MB_OK);
|
||||||
SetWindowLongPtr( hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
|
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
ptr = wcsrchr(szBuffer, L'.');
|
|
||||||
if (ptr && !_wcsnicmp(ptr, L".lnk", 4))
|
WCHAR *pwszExt = PathFindExtensionW(wszBuf);
|
||||||
|
if (!wcsicmp(pwszExt, L".lnk"))
|
||||||
{
|
{
|
||||||
// FIXME load localized error msg
|
// FIXME load localized error msg
|
||||||
MessageBoxW( hwndDlg, L"You cannot create a link to a shortcut", L"Error", MB_ICONERROR );
|
MessageBoxW(hwndDlg, L"You cannot create a link to a shortcut", L"Error", MB_ICONERROR);
|
||||||
SetWindowLongPtr( hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE );
|
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pThis->SetPath(szBuffer);
|
pThis->SetPath(wszBuf);
|
||||||
|
|
||||||
TRACE("This %p sLinkPath %S\n", pThis, pThis->sLinkPath);
|
TRACE("This %p sLinkPath %S\n", pThis, pThis->sLinkPath);
|
||||||
pThis->Save(pThis->sLinkPath, TRUE );
|
pThis->Save(pThis->sLinkPath, TRUE);
|
||||||
SetWindowLongPtr( hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR );
|
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
{
|
{
|
||||||
|
@ -2093,21 +2084,27 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
///
|
///
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case 14021:
|
case 14021:
|
||||||
|
{
|
||||||
|
WCHAR wszPath[MAX_PATH] = L"";
|
||||||
|
|
||||||
if (pThis->sIcoPath)
|
if (pThis->sIcoPath)
|
||||||
wcscpy(szBuffer, pThis->sIcoPath);
|
wcscpy(wszPath, pThis->sIcoPath);
|
||||||
IconIndex = pThis->iIcoNdx;
|
INT IconIndex = pThis->iIcoNdx;
|
||||||
if (PickIconDlg(hwndDlg, szBuffer, MAX_PATH, &IconIndex))
|
if (PickIconDlg(hwndDlg, wszPath, MAX_PATH, &IconIndex))
|
||||||
{
|
{
|
||||||
pThis->SetIconLocation(szBuffer, IconIndex);
|
pThis->SetIconLocation(wszPath, IconIndex);
|
||||||
///
|
///
|
||||||
/// FIXME redraw icon
|
/// FIXME redraw icon
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
case 14022:
|
case 14022:
|
||||||
result = DialogBoxParamW(shell32_hInstance, MAKEINTRESOURCEW(SHELL_EXTENDED_SHORTCUT_DLG), hwndDlg, ExtendedShortcutProc, (LPARAM)pThis->bRunAs);
|
{
|
||||||
|
INT_PTR result = DialogBoxParamW(shell32_hInstance, MAKEINTRESOURCEW(SHELL_EXTENDED_SHORTCUT_DLG), hwndDlg, ExtendedShortcutProc, (LPARAM)pThis->bRunAs);
|
||||||
if (result == 1 || result == 0)
|
if (result == 1 || result == 0)
|
||||||
{
|
{
|
||||||
if (pThis->bRunAs != result )
|
if (pThis->bRunAs != result)
|
||||||
{
|
{
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
}
|
}
|
||||||
|
@ -2115,6 +2112,7 @@ INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM
|
||||||
pThis->bRunAs = result;
|
pThis->bRunAs = result;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
switch(HIWORD(wParam))
|
switch(HIWORD(wParam))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue