Sync to Wine-0_9: Lionel Ulmer lionel.ulmer@free.fr - fix first two arguments to 'FindExecutableA' (input strings instead of pointers) - fix last argument to 'FindExecutableW' (it's an output string) Francois Gouget fgouget@free.fr - Use "static const" rather than "const static" as gcc -W complains about the former. Jonathan Ernst Jonathan@ErnstFamily.ch - First creation of registry entries missed AppData. Aric Stewart aric@codeweavers.com - MSDN states that the pszDisplayName member of BROWSEINFO is assumed to be MAX_PATH in length. So when doing the A->W conversion in BrowseForFolderA do not set that member to be the size of the incoming string, instead make it MAX_PATH. Dmitry Timoshkov dmitry@codeweavers.com - Use appropriate DDE APIs (ANSI or unicode) for ShellExecuteA/W, Excel 2000 depends on that. Martin Fuchs martin-fuchs@gmx.net - Simplify 'sei' structure initialization in ShellExecuteA/W. Mike McCormack mike@codeweavers.com - Use ShellLink_QueryInterface to return the right interface in IShellLink_Constructor. Richard Cohen richard@daijobu.co.uk - Don't hardcode "windows" directory. Modified: trunk/reactos/lib/shell32/brsfolder.c Modified: trunk/reactos/lib/shell32/enumidlist.c Modified: trunk/reactos/lib/shell32/shell.c Modified: trunk/reactos/lib/shell32/shell32.spec Modified: trunk/reactos/lib/shell32/shell32_main.h Modified: trunk/reactos/lib/shell32/shelllink.c Modified: trunk/reactos/lib/shell32/shellpath.c Modified: trunk/reactos/lib/shell32/shfldr_desktop.c Modified: trunk/reactos/lib/shell32/shlexec.c _____
Modified: trunk/reactos/lib/shell32/brsfolder.c --- trunk/reactos/lib/shell32/brsfolder.c 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/brsfolder.c 2005-11-02 20:50:50 UTC (rev 18956) @@ -627,9 +627,8 @@
bi.pidlRoot = lpbi->pidlRoot; if (lpbi->pszDisplayName) { - len = MultiByteToWideChar( CP_ACP, 0, lpbi->pszDisplayName, -1, NULL, 0 ); - bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - MultiByteToWideChar( CP_ACP, 0, lpbi->pszDisplayName, -1, bi.pszDisplayName, len ); + bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, lpbi->pszDisplayName, -1, bi.pszDisplayName, MAX_PATH ); } else bi.pszDisplayName = NULL; _____
Modified: trunk/reactos/lib/shell32/enumidlist.c --- trunk/reactos/lib/shell32/enumidlist.c 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/enumidlist.c 2005-11-02 20:50:50 UTC (rev 18956) @@ -112,9 +112,9 @@
HANDLE hFile; WCHAR szPath[MAX_PATH]; BOOL succeeded = TRUE; - const static WCHAR stars[] = { '*','.','*',0 }; - const static WCHAR dot[] = { '.',0 }; - const static WCHAR dotdot[] = { '.','.',0 }; + static const WCHAR stars[] = { '*','.','*',0 }; + static const WCHAR dot[] = { '.',0 }; + static const WCHAR dotdot[] = { '.','.',0 };
TRACE("(%p)->(path=%s flags=0x%08lx) \n",list,debugstr_w(lpszPath),dwFlags);
_____
Modified: trunk/reactos/lib/shell32/shell.c --- trunk/reactos/lib/shell32/shell.c 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/shell.c 2005-11-02 20:50:50 UTC (rev 18956) @@ -625,7 +625,7 @@
seiW.dwHotKey = 0; seiW.hProcess = hProcess;
- ShellExecuteExW32 (&seiW, SHELL_Execute16); + SHELL_execute( &seiW, SHELL_Execute16, FALSE );
if (wVerb) SHFree(wVerb); if (wFile) SHFree(wFile); _____
Modified: trunk/reactos/lib/shell32/shell32.spec --- trunk/reactos/lib/shell32/shell32.spec 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/shell32.spec 2005-11-02 20:50:50 UTC (rev 18956) @@ -290,8 +290,8 @@
@ stdcall ExtractIconW(long wstr long) @ stub ExtractVersionResource16W @ stub FindExeDlgProc -@ stdcall FindExecutableA(ptr ptr ptr) -@ stdcall FindExecutableW(wstr wstr wstr) +@ stdcall FindExecutableA(str str ptr) +@ stdcall FindExecutableW(wstr wstr ptr) @ stub FixupOptionalComponents @ stdcall FreeIconList(long) @ stub InternalExtractIconListA _____
Modified: trunk/reactos/lib/shell32/shell32_main.h --- trunk/reactos/lib/shell32/shell32_main.h 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/shell32_main.h 2005-11-02 20:50:50 UTC (rev 18956) @@ -213,7 +213,7 @@
typedef UINT_PTR (*SHELL_ExecuteW32)(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, LPSHELLEXECUTEINFOW sei, LPSHELLEXECUTEINFOW sei_out);
-BOOL WINAPI ShellExecuteExW32(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc); +BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc, BOOL unicode);
UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpOperation, LPWSTR lpResult, int resultLen, LPWSTR key, WCHAR **env, LPITEMIDLIST pidl, LPCWSTR args); _____
Modified: trunk/reactos/lib/shell32/shelllink.c --- trunk/reactos/lib/shell32/shelllink.c 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/shelllink.c 2005-11-02 20:50:50 UTC (rev 18956) @@ -1152,6 +1152,7 @@
REFIID riid, LPVOID *ppv ) { IShellLinkImpl * sl; + HRESULT r;
TRACE("unkOut=%p riid=%s\n",pUnkOuter, debugstr_guid(riid));
@@ -1176,18 +1177,9 @@
TRACE("(%p)->()\n",sl);
- if (IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IShellLinkA)) - *ppv = sl; - else if (IsEqualIID(riid, &IID_IShellLinkW)) - *ppv = &(sl->lpvtblw); - else { - LocalFree((HLOCAL)sl); - ERR("E_NOINTERFACE\n"); - return E_NOINTERFACE; - } - - return S_OK; + r = ShellLink_QueryInterface( sl, riid, ppv ); + ShellLink_Release( sl ); + return r; }
_____
Modified: trunk/reactos/lib/shell32/shellpath.c --- trunk/reactos/lib/shell32/shellpath.c 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/shellpath.c 2005-11-02 20:50:50 UTC (rev 18956) @@ -805,7 +805,7 @@
/* This defaults to L"Documents and Settings" on Windows 2000/XP, but we're * acting more Windows 9x-like for now. */ -static const WCHAR szDefaultProfileDirW[] = {'w','i','n','d','o','w','s','\','p','r','o','f','i','l','e','s','\0'}; +static const WCHAR szDefaultProfileDirW[] = {'p','r','o','f','i','l','e','s','\0'}; static const WCHAR AllUsersW[] = {'A','l','l',' ','U','s','e','r','s','\0'};
typedef enum _CSIDL_Type { @@ -1259,6 +1259,9 @@ switch (folder) { case CSIDL_PERSONAL: + case CSIDL_MYMUSIC: + case CSIDL_MYPICTURES: + case CSIDL_MYVIDEO: { const char *home = getenv("HOME");
@@ -1792,6 +1795,7 @@ CSIDL_PROGRAMS, CSIDL_PERSONAL, CSIDL_FAVORITES, + CSIDL_APPDATA, CSIDL_STARTUP, CSIDL_RECENT, CSIDL_SENDTO, _____
Modified: trunk/reactos/lib/shell32/shfldr_desktop.c --- trunk/reactos/lib/shell32/shfldr_desktop.c 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/shfldr_desktop.c 2005-11-02 20:50:50 UTC (rev 18956) @@ -427,7 +427,7 @@
{ IGenericSFImpl *This = (IGenericSFImpl *)iface; HRESULT hr = S_OK; - const static DWORD dwDesktopAttributes = + static const DWORD dwDesktopAttributes = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER;
_____
Modified: trunk/reactos/lib/shell32/shlexec.c --- trunk/reactos/lib/shell32/shlexec.c 2005-11-02 20:03:07 UTC (rev 18955) +++ trunk/reactos/lib/shell32/shlexec.c 2005-11-02 20:50:50 UTC (rev 18956) @@ -772,7 +772,8 @@
static unsigned dde_connect(WCHAR* key, WCHAR* start, WCHAR* ddeexec, const WCHAR* lpFile, WCHAR *env, LPCWSTR szCommandline, LPITEMIDLIST pidl, SHELL_ExecuteW32 execfunc, - LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out) + LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out, + BOOL unicode) { static const WCHAR wApplication[] = {'\','a','p','p','l','i','c','a','t','i','o','n',0}; static const WCHAR wTopic[] = {'\','t','o','p','i','c',0}; @@ -803,10 +804,16 @@ strcpyW(topic, wSystem); }
- if (DdeInitializeW(&ddeInst, dde_cb, APPCMD_CLIENTONLY, 0L) != DMLERR_NO_ERROR) + if (unicode) { - return 2; + if (DdeInitializeW(&ddeInst, dde_cb, APPCMD_CLIENTONLY, 0L) != DMLERR_NO_ERROR) + return 2; } + else + { + if (DdeInitializeA(&ddeInst, dde_cb, APPCMD_CLIENTONLY, 0L) != DMLERR_NO_ERROR) + return 2; + }
hszApp = DdeCreateStringHandleW(ddeInst, app, CP_WINUNICODE); hszTopic = DdeCreateStringHandleW(ddeInst, topic, CP_WINUNICODE); @@ -845,8 +852,18 @@ /* It's documented in the KB 330337 that IE has a bug and returns * error DMLERR_NOTPROCESSED on XTYP_EXECUTE request. */ - hDdeData = DdeClientTransaction((LPBYTE)res, (strlenW(res) + 1) * sizeof(WCHAR), hConv, 0L, 0, - XTYP_EXECUTE, 10000, &tid); + if (unicode) + hDdeData = DdeClientTransaction((LPBYTE)res, (strlenW(res) + 1) * sizeof(WCHAR), hConv, 0L, 0, + XTYP_EXECUTE, 10000, &tid); + else + { + DWORD lenA = WideCharToMultiByte(CP_ACP, 0, res, -1, NULL, 0, NULL, NULL); + char *resA = HeapAlloc(GetProcessHeap(), 0, lenA); + WideCharToMultiByte(CP_ACP, 0, res, -1, resA, lenA, NULL, NULL); + hDdeData = DdeClientTransaction( (LPBYTE)resA, lenA, hConv, 0L, 0, + XTYP_EXECUTE, 10000, &tid ); + HeapFree(GetProcessHeap(), 0, resA); + } if (hDdeData) DdeFreeDataHandle(hDdeData); else @@ -866,7 +883,8 @@ */ static UINT_PTR execute_from_key(LPWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWSTR szCommandline, SHELL_ExecuteW32 execfunc, - LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out) + LPSHELLEXECUTEINFOW psei, LPSHELLEXECUTEINFOW psei_out, + BOOL unicode) { WCHAR cmd[1024]; LONG cmdlen = sizeof(cmd); @@ -894,7 +912,7 @@ if (RegQueryValueW(HKEY_CLASSES_ROOT, key, param, ¶mlen) == ERROR_SUCCESS) { TRACE("Got ddeexec %s => %s\n", debugstr_w(key), debugstr_w(param)); - retval = dde_connect(key, cmd, param, lpFile, env, szCommandline, psei->lpIDList, execfunc, psei, psei_out); + retval = dde_connect(key, cmd, param, lpFile, env, szCommandline, psei->lpIDList, execfunc, psei, psei_out, unicode); } else { @@ -966,9 +984,9 @@ }
/*********************************************************************** ** - * ShellExecuteExW32 [Internal] + * SHELL_execute [Internal] */ -BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc) +BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc, BOOL unicode ) { static const WCHAR wQuote[] = {'"',0}; static const WCHAR wSpace[] = {' ',0}; @@ -1296,7 +1314,7 @@ } TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName), debugstr_w(sei_tmp.lpVerb), debugstr_w(wszQuotedCmd), debugstr_w(lpstrProtocol)); if (*lpstrProtocol) - retval = execute_from_key(lpstrProtocol, wszApplicationName, env, sei_tmp.lpParameters, execfunc, &sei_tmp, sei); + retval = execute_from_key(lpstrProtocol, wszApplicationName, env, sei_tmp.lpParameters, execfunc, &sei_tmp, sei, unicode); else retval = execfunc(wszQuotedCmd, env, FALSE, &sei_tmp, sei); HeapFree( GetProcessHeap(), 0, env ); @@ -1329,7 +1347,7 @@ lpFile += iSize; while (*lpFile == ':') lpFile++; } - retval = execute_from_key(lpstrProtocol, lpFile, NULL, sei_tmp.lpParameters, execfunc, &sei_tmp, sei); + retval = execute_from_key(lpstrProtocol, lpFile, NULL, sei_tmp.lpParameters, execfunc, &sei_tmp, sei, unicode); } /* Check if file specified is in the form www.??????.*** */ else if (!strncmpiW(lpFile, wWww, 3)) @@ -1414,7 +1432,7 @@ else seiW.lpClass = NULL;
- ret = ShellExecuteExW32 (&seiW, SHELL_ExecuteW); + ret = SHELL_execute( &seiW, SHELL_ExecuteW, FALSE );
sei->hInstApp = seiW.hInstApp;
@@ -1436,7 +1454,7 @@ */ BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei) { - return ShellExecuteExW32 (sei, SHELL_ExecuteW); + return SHELL_execute( sei, SHELL_ExecuteW, TRUE ); }
/*********************************************************************** ** @@ -1465,6 +1483,6 @@ sei.dwHotKey = 0; sei.hProcess = 0;
- ShellExecuteExW32 (&sei, SHELL_ExecuteW); + SHELL_execute( &sei, SHELL_ExecuteW, TRUE ); return sei.hInstApp; }