Using native version of SHELL32.DLL (from the Win98 install) and builtin version of SHFOLDER.DLL ends up in Wine failure:
[s2@katleriai wine]$ WINEDLLOVERRIDES="shell32=n" WINEDEBUG=+loaddll wine /home/s2/cc/Program\ Files/mIRC/mirc 2>&1 | grep -i [^a-z]sh trace:loaddll:load_dll Loaded module L"c:\windows\system\shlwapi.dll" : builtin trace:loaddll:load_dll Loaded module L"C:\windows\system\shell32.dll" : native trace:loaddll:MODULE_LoadModule16 Loaded module "shell.dll" : native trace:loaddll:load_dll Loaded module L"c:\windows\system\shfolder.dll" : builtin err:module:find_forwarded_export function not found for forward 'shell32.SHGetFolderPathA' used by L"c:\windows\system\shfolder.dll". If you are using builtin L"shfolder.dll", try using the native one instead. err:commdlg:DllMain Failed to get entry point "SHGetFolderPathA" for hinst = 0x41930000
This situation was already discussed three years ago or so [1], [3]. The most initiative person here was Juergen Schmied, it seems.
Besides another things on Sun, 03 Dec 2000, Juergen Schmied wrote [2]:
Hmm, shlfolder is introduced for systems with a older version of shell32.dll. I think we should use it just like it's done in cdlg32.c and get the function with GetProcAdress. Bye the way: this way is used in several cases of functions within shell32 introduced in later versions. I'm currently having a patch for comdlg32 and shell32 to the imports. Will send it soon.
AFAICS, there was no patches sent against the SHFOLDER.DLL. Dear Wine developers, can I expect this situation to change soon? Please tell me: should I wait even more, or should I try writing a patch on my own? TIA.
[1] http://www.winehq.org/hypermail/wine-devel/2000/12/index.html#41 [2] http://www.winehq.org/hypermail/wine-devel/2000/12/0048.html [3] http://www.winehq.org/hypermail/wine-devel/2001/07/index.html#4
Hi,
--- Saulius Krasuckas saulius2@ar.fi.lt wrote:
should I wait even more, or should I try writing a patch on my own?
Write your own. Everyone else seems to have other stuff they are working on.
Thanks Steven
__________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail
On Sun, 29 Aug 2004, Steven Edwards wrote:
--- Saulius Krasuckas saulius2@ar.fi.lt wrote:
should I wait even more, or should I try writing a patch on my own?
Write your own. Everyone else seems to have other stuff they are working on.
Lets try. I am not sure about many things:
1, whether is better to duplicate code SHGetFolderPathW() or to try finding it by an ordinal its value (the case for the older versions of SHELL32.DLL) as it was stated by Juergen?
2, shouldn't we output the whole string of pszPath instead of printing just a pointer value?
Waiting for the corrections.
Changelog: Initial code for the Dll. Stop forwarding SHGetFolderPath[AW] exports to SHELL32.DLL. Instead try locating SHGetFolderPathW() dynamically.
Index: dlls/shfolder/Makefile.in =================================================================== RCS file: /home/wine/wine/dlls/shfolder/Makefile.in,v retrieving revision 1.7 diff -u -r1.7 Makefile.in --- dlls/shfolder/Makefile.in 11 Oct 2003 01:09:17 -0000 1.7 +++ dlls/shfolder/Makefile.in 29 Aug 2004 19:19:31 -0000 @@ -3,7 +3,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = shfolder.dll -IMPORTS = shell32 +IMPORTS = shell32 kernel32
C_SRCS = shfolder_main.c
Index: dlls/shfolder/shfolder.spec =================================================================== RCS file: /home/wine/wine/dlls/shfolder/shfolder.spec,v retrieving revision 1.7 diff -u -r1.7 shfolder.spec --- dlls/shfolder/shfolder.spec 17 Mar 2003 00:17:01 -0000 1.7 +++ dlls/shfolder/shfolder.spec 29 Aug 2004 19:19:31 -0000 @@ -1,2 +1,2 @@ -@ stdcall SHGetFolderPathA(long long long long ptr) shell32.SHGetFolderPathA -@ stdcall SHGetFolderPathW(long long long long ptr) shell32.SHGetFolderPathW +@ stdcall SHGetFolderPathA(long long long long ptr) +@ stdcall SHGetFolderPathW(long long long long ptr) Index: dlls/shfolder/shfolder_main.c =================================================================== RCS file: /home/wine/wine/dlls/shfolder/shfolder_main.c,v retrieving revision 1.1 diff -u -r1.1 shfolder_main.c --- dlls/shfolder/shfolder_main.c 26 Jul 2000 18:30:38 -0000 1.1 +++ dlls/shfolder/shfolder_main.c 29 Aug 2004 19:19:31 -0000 @@ -1 +1,90 @@ -/* nothing here yet */ +/* + * Shell Folder Service + * + * Copyright 2000 Juergen Schmied + * Copyright 2004 Saulius Krasuckas + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "wine/debug.h" +#include "winbase.h" +#include "winnls.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shfolder); + + +HINSTANCE SHELL32_hInstance = 0; + +BOOL (WINAPI *SHFOLDER_SHGetFolderPathW)(HWND,int,HANDLE,DWORD,LPWSTR); + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(hinstDLL=%p, fdwReason=%lx, lpvReserved=%p)\n", hinstDLL, fdwReason, lpvReserved); + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL"); + if (!SHELL32_hInstance) + { + ERR("failed to retrieve handle for SHELL32.DLL\n"); + return FALSE; + } + + SHFOLDER_SHGetFolderPathW = GetProcAddress(SHELL32_hInstance, "SHGetFolderPathW"); + if (!SHFOLDER_SHGetFolderPathW) + ERR("failed to get entry point for SHGetFolderPathW() in SHELL32.DLL\n"); + break; + } + return TRUE; +} + +HRESULT WINAPI SHGetFolderPathW( + HWND hwndOwner, + int csidl, + HANDLE hToken, + DWORD dwFlags, + LPWSTR pszPath) +{ + if (!SHFOLDER_SHGetFolderPathW) + { + FIXME("is a semi-stub: SHELL32.DLL code is still not duplicated neither imported by an ordinal value"); + return E_FAIL; + } + return SHFOLDER_SHGetFolderPathW(hwndOwner, csidl, hToken, dwFlags, pszPath); +} + +HRESULT WINAPI SHGetFolderPathA( + HWND hwndOwner, + int csidl, + HANDLE hToken, + DWORD dwFlags, + LPSTR pszPath) +{ + WCHAR szTempPath[MAX_PATH]; + HRESULT hr; + + if (!pszPath) return E_INVALIDARG; + + *pszPath = '\0'; + hr = SHGetFolderPathW(hwndOwner, csidl, hToken, dwFlags, szTempPath); + if (SUCCEEDED(hr)) + WideCharToMultiByte(CP_ACP, 0, szTempPath, -1, pszPath, MAX_PATH, NULL, NULL); + + TRACE("%p, %p, csidl=0x%04x\n", hwndOwner, pszPath, csidl); + return hr; +} +
Saulius Krasuckas wrote:
Lets try. I am not sure about many things:
1, whether is better to duplicate code SHGetFolderPathW() or to try finding it by an ordinal its value (the case for the older versions of SHELL32.DLL) as it was stated by Juergen?
ShFolder is redistributable. I believe the best solution would be to move the code from Shell32 to ShFolder and then making the Shell32 exports forwarders to ShFolder.
Regards, Filip
On Sun, 29 Aug 2004, Saulius Krasuckas wrote:
Lets try. I am not sure about many things:
1, whether is better to duplicate code SHGetFolderPathW() or to try finding it by an ordinal its value (the case for the older versions of SHELL32.DLL) as it was stated by Juergen?
2, shouldn't we output the whole string of pszPath instead of printing just a pointer value?
(I mean in the TRACE() call)
3, should I call DisableThreadLibraryCalls() when dll is being loaded? Lots of dll are doing this.
4, MSDN tells that A and W versions of this function fail differently at the same some conditions. Do we need to write additional test case to be sure?