Pelles C forum

Pelles C => Bug reports => Topic started by: TimoVJL on April 24, 2025, 02:55:21 PM

Title: Bad code
Post by: TimoVJL on April 24, 2025, 02:55:21 PM
This project works with v12 and earlier and also with msvc, but not with v13

Hopefully someone have better skills to hunt down problem in modified Pelle's Worker.c code as WTypeLibWorker.c, that i might ruined, as it won't work in V13.
Also C2RTF1.c was based Pelles's code for Add-In.

In Windows\system32 is small stdole32.tlb for testing
Title: Re: Bad code
Post by: Pelle on April 25, 2025, 12:09:10 PM
I don't get a crash, but apparently need to load "stdole32.tlb" twice to get a result (Windows 10).
This happens both with your code, and the "Load Type Library..." add-in that comes with the Setup.

As far as I can remember: all files with .tlb extension that I have looked at, have been in typelib file format MSFT or SLTG (obsolete for many (20+?) years...).

On my machine "stdole32.tlb" is now in DLL format, with a typelib resource in the "obsolete" SLTG format. WTF?!
Title: Re: Bad code
Post by: TimoVJL on April 25, 2025, 12:21:35 PM
This eliminate bogus pointer, but not needed
        case VT_CARRAY:
        {
            GetTypeName(pszBuf, cchMaxBuf, tdesc.lpadesc->tdescElem, NULL, pITypeInfo);
            StrCat(pszBuf, cchMaxBuf, L" %ls", bstrName); bstrName = NULL;
            for (int i = 0; i < tdesc.lpadesc->cDims; i++)
                if (tdesc.lpadesc->rgbounds)
                    StrCat(pszBuf, cchMaxBuf, L"[%u]", tdesc.lpadesc->rgbounds[i].cElements);
            break;
        }

With vbscript.dll works normally, as it don't have VT_CARRAY
cdosys.dll ok

WTypeLibList4_64_v13ms.zip have modes, msvcrt, msvcrt debug

Title: Re: Bad code
Post by: Pelle on April 25, 2025, 10:24:23 PM
The declaration of ARRAYDESC is wrong.

For example this, from "oaidl.idl" ...
typedef struct tagARRAYDESC {
    TYPEDESC tdescElem;
    USHORT cDims;
    [size_is(cDims)] SAFEARRAYBOUND rgbounds[];
} ARRAYDESC;

... should produce this in "oaidl.h" ...
typedef struct tagARRAYDESC {
    TYPEDESC tdescElem;
    USHORT cDims;
    SAFEARRAYBOUND rgbounds[ 1 ];
} ARRAYDESC;

...NOT this ...
typedef struct tagARRAYDESC {
    TYPEDESC tdescElem;
    USHORT cDims;
    SAFEARRAYBOUND *rgbounds;
} ARRAYDESC;

( I didn't consider the size_is() attribute ).
Title: Re: Bad code
Post by: TimoVJL on April 26, 2025, 01:06:51 AM
An old list of Windows TLBs