Problems with GetFileVersionInfo[Size]()

Malte Starostik Malte.Starostik at t-online.de
Mon Jun 11 21:20:40 CDT 2001


Hi,

The Shockwave ActiveX control I'm loading tries to read the VERSIONINFO 
resource from my winelib app. AFAICS it subsequently crashes because that 
fails.
Anyway, there seems to be a problem:

        char path[PATH_MAX];
        GetModuleFileName(inst, path, sizeof(path));
        kdDebug() << "GetModuleFileName: " << path << endl;
 
        DWORD dummy;
        kdDebug() << "GetFileVersionInfoSize: " << 
GetFileVersionInfoSize(path, &dummy) << endl;
        kdDebug() << "GetLastError: " << GetLastError() << endl;

outputs
activexproxy: GetModuleFileName: 
Y:\src\kde\build\kdenonbeta\activexproxy\proxy\activexproxy
activexproxy: GetFileVersionInfoSize: 0
activexproxy: GetLastError: 0

which means it obviously doesn't find the resource. (btw, why is 
GetLastError() 0 here?)
However, this code suceeds (inst is the HINSTANCE passed to WinMain()):

        HRSRC ver = FindResource(inst, MAKEINTRESOURCE(VS_VERSION_INFO),
            MAKEINTRESOURCE(VS_FILE_INFO));
        kdDebug() << "FindResource: " << ver << endl;
        int size = SizeofResource(inst, ver);
        kdDebug() << "SizeofResource:" << size << endl;
 
        HGLOBAL mem = LoadResource(inst, ver);
        void *buf, *block = LockResource(mem);
        UINT len;
        VerQueryValue(block, "StringFileInfo\\040904b0\\FileDescription", 
&buf, &len);
        kdDebug() << "Description: " << reinterpret_cast<WCHAR *>(buf) << 
endl;
        FreeResource(mem);

the output is:

activexproxy: FindResource: 1078760168
activexproxy: SizeofResource:608
activexproxy: Description: ActiveX-Proxy for Konqueror

So basically the code GetFileInfoVersion[Size]() use to load a library fail 
if the given path is the winelib app (the symlink to wine) itself :(
Thanks,
-Malte
-- 
Wars don't determine who's right, only who's left.





More information about the wine-devel mailing list