Folks,
I am trying to run some Winelib apps built with winegcc, and
they don't work. winegcc/winewrap do the wrapper idea to avoid
initialization problems: basically the main app is built as a
.dll which is loaded with LoadLibrary by a small loader. Well,
this DLL is not found, and the app doesn't load.
I think the problem is in load_dll(), in dlls/ntdll/loader.c
line 887:
if (!libdir || allocated_libdir)
found = SearchPathA(NULL, libname, ".dll", MAX_PATH, filename, NULL);
else
found = DIR_SearchAlternatePath(libdir, libname, ".dll", MAX_PATH, filename, NULL);
As SearchPathA doesn't seem to know that it also needs to
look for the .so version of the DLL.
Here is what happens:
1. Directory contents (simplified)
[dimi@dimi dialogs]$ ls
CVS dialogs.def dialogs.h dialogs.pro
descrip.mms dialogs.dll.so dialogs.ico dialogs.rc
dialogs dialogs.dsp dialogsM5.xml dialogs.rcO
dialogs.cpp dialogs.exe.so dialogs.o dialogs_resources.o
'dialogs' is a small bash script which loads 'dialogs.exe.so' which
does a simple LoadLibrary('dialogs.dll') to load 'dialogs.dll.so'
which is the actual application.
2. Here is the relevant part of:
./dialogs --debugmsg +dosfs,+file,+module,+loaddll
with a 'grep -v trace:dosfs:DOSFS_ReadDir' for brevity.
trace:module:LdrGetDllHandle 0 0 L"user32.dll" -> 0x40980000
trace:module:LdrGetDllHandle 0 0 L"user32.dll" -> 0x40980000
trace:module:LdrGetDllHandle 0 0 L"user32.dll" -> 0x40980000
trace:module:LdrGetDllHandle 0 0 L"user32.dll" -> 0x40980000
trace:module:GetModuleFileNameW L"F:\\dev\\wine\\wxWindows\\samples\\dialogs\\dialogs.exe"
trace:dosfs:DOSFS_GetFullName L"F:\\dev\\wine\\wxWindows\\samples\\dialogs\\dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /home/dimi,L"dev\\wine\\wxWindows\\samples\\dialogs\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dev\\wine\\wxWindows\\samples\\dialogs\\dialogs.dll", 0x408a1af0)
trace:dosfs:DOSFS_OpenDir "/home/dimi"
trace:dosfs:DOSFS_FindUnixName (/home/dimi,L"dev\\wine\\wxWindows\\samples\\dialogs\\dialogs.dll") -> L"dev" (L"DEV")
trace:dosfs:DOSFS_FindUnixName /home/dimi/dev,L"wine\\wxWindows\\samples\\dialogs\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"wine\\wxWindows\\samples\\dialogs\\dialogs.dll", 0x408a1af0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/dev"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/dev,L"wine\\wxWindows\\samples\\dialogs\\dialogs.dll") -> L"wine" (L"WINE")
trace:dosfs:DOSFS_FindUnixName /home/dimi/dev/wine,L"wxWindows\\samples\\dialogs\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"wxWindows\\samples\\dialogs\\dialogs.dll", 0x408a1af0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/dev/wine"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/dev/wine,L"wxWindows\\samples\\dialogs\\dialogs.dll") -> L"wxWindows" (L"WXWI~MP0")
trace:dosfs:DOSFS_FindUnixName /home/dimi/dev/wine/wxWindows,L"samples\\dialogs\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"samples\\dialogs\\dialogs.dll", 0x408a1af0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/dev/wine/wxWindows"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/dev/wine/wxWindows,L"samples\\dialogs\\dialogs.dll") -> L"samples" (L"SAMPLES")
trace:dosfs:DOSFS_FindUnixName /home/dimi/dev/wine/wxWindows/samples,L"dialogs\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs\\dialogs.dll", 0x408a1af0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/dev/wine/wxWindows/samples"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/dev/wine/wxWindows/samples,L"dialogs\\dialogs.dll") -> L"dialogs" (L"DIALOGS")
trace:dosfs:DOSFS_FindUnixName /home/dimi/dev/wine/wxWindows/samples/dialogs,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1af0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/dev/wine/wxWindows/samples/dialogs"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi/dev/wine/wxWindows/samples/dialogs'
trace:dosfs:DOSFS_GetFullName L"dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /home/dimi/dev/wine/wxWindows/samples/dialogs,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1da8)
trace:dosfs:DOSFS_OpenDir "/home/dimi/dev/wine/wxWindows/samples/dialogs"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi/dev/wine/wxWindows/samples/dialogs'
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1dd0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System'
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows/Windows,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1dd0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows/Windows"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi/cxoffice/support/dotwine/fake_windows/Windows'
trace:module:GetModuleFileNameW L"F:\\dev\\wine\\wxWindows\\samples\\dialogs\\dialogs.exe"
trace:dosfs:DOSFS_GetFullName L"c:\\windows\\dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows,L"windows\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"windows\\dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/cxoffice/support/dotwine/fake_windows,L"windows\\dialogs.dll") -> L"Windows" (L"WINDOWS")
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows/Windows,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows/Windows"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi/cxoffice/support/dotwine/fake_windows/Windows'
trace:dosfs:DOSFS_GetFullName L"c:\\windows\\system\\dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows,L"windows\\system\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"windows\\system\\dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/cxoffice/support/dotwine/fake_windows,L"windows\\system\\dialogs.dll") -> L"Windows" (L"WINDOWS")
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows/Windows,L"system\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"system\\dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows/Windows"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/cxoffice/support/dotwine/fake_windows/Windows,L"system\\dialogs.dll") -> L"System" (L"SYSTEM")
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System'
trace:dosfs:DOSFS_GetFullName L"e:\\\\dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /tmp,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/tmp"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/tmp'
trace:dosfs:DOSFS_GetFullName L"e:\\test\\dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /tmp,L"test\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"test\\dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/tmp"
warn:dosfs:DOSFS_FindUnixName L"test\\dialogs.dll" not found in '/tmp'
trace:dosfs:DOSFS_GetFullName L"f:\\\\dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /home/dimi,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1d44)
trace:dosfs:DOSFS_OpenDir "/home/dimi"
trace:dosfs:DOSFS_OpenDir "/home/dimi"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi'
trace:module:MODULE_GetLoadOrder looking for C:\WINDOWS\SYSTEM\dialogs.dll
trace:module:GetModuleFileNameW L"F:\\dev\\wine\\wxWindows\\samples\\dialogs\\dialogs.exe"
trace:module:open_app_key searching 'dialogs' in AppDefaults\dialogs.exe\DllOverrides
trace:module:MODULE_GetLoadOrder got standard wildcard "b,n" for "dialogs.dll"
trace:module:load_dll Trying built-in 'C:\WINDOWS\SYSTEM\dialogs.dll'
warn:module:BUILTIN32_dlopen cannot open .so lib for builtin dialogs.dll: /usr/local/lib/wine/dialogs.dll.so: cannot open shared object file: No such file or directory
trace:module:load_dll Trying native dll 'C:\WINDOWS\SYSTEM\dialogs.dll'
trace:file:CreateFileW L"C:\\WINDOWS\\SYSTEM\\dialogs.dll" GENERIC_READ FILE_SHARE_READ OPEN_EXISTING attributes 0x0
trace:dosfs:DOSFS_GetFullName L"C:\\WINDOWS\\SYSTEM\\dialogs.dll" (last=1)
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows,L"WINDOWS\\SYSTEM\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"WINDOWS\\SYSTEM\\dialogs.dll", 0x408a1fe0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/cxoffice/support/dotwine/fake_windows,L"WINDOWS\\SYSTEM\\dialogs.dll") -> L"Windows" (L"WINDOWS")
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows/Windows,L"SYSTEM\\dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"SYSTEM\\dialogs.dll", 0x408a1fe0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows/Windows"
trace:dosfs:DOSFS_FindUnixName (/home/dimi/cxoffice/support/dotwine/fake_windows/Windows,L"SYSTEM\\dialogs.dll") -> L"System" (L"SYSTEM")
trace:dosfs:DOSFS_FindUnixName /home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System,L"dialogs.dll"
trace:dosfs:DOSFS_ToDosFCBFormat (L"dialogs.dll", 0x408a1fe0)
trace:dosfs:DOSFS_OpenDir "/home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System"
warn:dosfs:DOSFS_FindUnixName L"dialogs.dll" not found in '/home/dimi/cxoffice/support/dotwine/fake_windows/Windows/System'
warn:file:CreateFileW Unable to get full filename from L"C:\\WINDOWS\\SYSTEM\\dialogs.dll" (GLE 2)
warn:module:load_dll Failed to load module 'C:\WINDOWS\SYSTEM\dialogs.dll'; status=-1073741809
trace:module:LdrGetDllHandle 0 0 L"user32.dll" -> 0x40980000
--
Dimi.