[Wine] GetModuleFileName in winelib DLLs

Jan Jezabek jezabek at poczta.onet.pl
Sat Jul 19 19:17:01 CDT 2008


[Sorry if you receive this mail twice - I sent a message earlier, but it 
seems to be stuck]

I have the following problem - when I compile a DLL using winegcc and 
call GetModuleFileName on it I get a name in "c:\windows\system", 
regardless of the DLLs actual location. I have googled for it, and found 
this thread


which says that this behavior is needed for built-in DLLs. My problem is 
that I'm trying to compile COM DLLs which need to be able to register 
themselves with DllRegisterServer, and also need to call LoadTypeLib on 
themselves (to use with DispInvoke etc.). This seems to work well in 
Wine if I hardcode the actual path to the .dll.so - I can access my 
components using CoCreateInstance and LoadTypeLib can get the typelib 
from a .dll.so file - but unfortunately I am unable to get the real 
module name. As stated in the above ML thread there is no problem if the 
module is compiled to a 'native' (i.e. PE) DLL. My question is: can I 
work around GetModuleFileName's (intended) behavior and get the real 
path of the .dll.so if I am aware that I'm running as a winelib DLL? Or 
in other words - is there a way to register and use COM InprocServer 
DLLs which do not necessarily reside at a fixed path?

Thanks in advance,
Jan Jezabek

My GSoC 2008 development blog: http://jezabekgsoc.wordpress.com/

More information about the wine-users mailing list