Maybe you can approach this from a strictly reversing point of view. I'm with disavowed, I think his instinct is correct.
I know nothing about this either so I may be on the wrong track. You mentioned the properties 'hidden' and 'non-creatable' and you want to be able to switch those so you might be able to use them. Maybe you can give a specific example.
Making use of the tools at hand...
Taking a look at the .NET file mscorlib.tlb in COMView, I see many TypeLibs classified as 'hidden'. For example
Code:
Name GUID TypeKind Flags Functions Variables Interfaces Idx
_Debugger {A9B4786C-08E3-344F-A651-2F9926DEAC5E} DISPATCH (4) Hidden, Dual, Dispatchable 7 0 1 957
_DebuggerStepThroughAttribute {3344E8B4-A5C3-3882-8D30-63792485ECCF} DISPATCH (4) Hidden, Dual, Dispatchable 7 0 1 958
Now taking a look at the COMView Oaidl.inc source file and digging a bit I see TYPEFLAG definitions attributed to a TYPEATTR structure and accessed by a GetTypeAttr method. MSDN gives us the relevant details:
Code:
ITypeInfo::GetTypeAttr
This method retrieves a TYPEATTR structure that
contains the type description attributes.
HRESULT GetTypeAttr(
TYPEATTR FAR* FAR* ppTypeAttr
);
oleaut32.lib, uuid.lib
typedef struct FARSTRUCT tagTYPEATTR {
GUID guid;
LCID lcid;
unsigned long dwReserved;
MEMBERID memidConstructor;
MEMBERID memidDestructor;
OLECHAR FAR* lpstrSchema;
unsigned long cbSizeInstance;
TYPEKIND typekind;
unsigned short cFuncs;
unsigned short cVars;
unsigned short cImplTypes;
unsigned short cbAlignment;
unsigned short wTypeFlags;
unsigned short wMajorVerNum;
unsigned short wMinorVerNum;
TYPEDESC tdescAlias;
IDLDESC idldescType;
} TYPEATTR, FAR *LPTYPEATTR;
Members:
wTypeFlags - TYPEFLAGS value describing this information.
typedef enum tagTYPEFLAGS {
TYPEFLAG_FAPPOBJECT = 0x01,
TYPEFLAG_FCANCREATE = 0x02,
TYPEFLAG_FLICENSED = 0x04,
TYPEFLAG_FPREDECLID = 0x08,
TYPEFLAG_FHIDDEN = 0x10, // The type should not be displayed to browsers
TYPEFLAG_FCONTROL = 0x20,
TYPEFLAG_FDUAL = 0x40,
TYPEFLAG_FNONEXTENSIBLE = 0x80,
TYPEFLAG_FOLEAUTOMATION = 0x100,
TYPEFLAG_FRESTRICTED = 0x200,
TYPEFLAG_FAGGREGATABLE = 0x400,
TYPEFLAG_FREPLACEABLE = 0x800,
TYPEFLAG_FDISPATCHABLE = 0x1000,
TYPEFLAG_FREVERSEBIND = 0x2000,
} TYPEFLAGS;
Continuing with the logical train of thought..
TYPEFLAG_FHIDDEN | TYPEFLAG_FDUAL | TYPEFLAG_FDISPATCHABLE = 0x1050
Which are the TypeFlag settings for the example _Debugger TypeLib. In fact, Comview tells you the same thing in the status bar if you double click on the TypeLib entry.
So, what good is this? There is a ITypeInfo::GetTypeAttr function in oleaut32.dll, but as far as I can tell there is no SetTypeAttr function. However it is a first step in being able to access the TYPEATTR structure where you may be able to modify the wTypeFlags setting.
If you disassemble COMView and search for an error string containing the text "ITypeInfo::GetTypeAttr failed[%X]", you can find where COMView apparently makes use of the oleaut32.dll GetTypeAttr function (by ordinal).
.text:00422719 call dword ptr [edx+0Ch] // GetTypeAttr call ???
.text:0042271C or eax, eax
.text:0042271E jnz errormsg
It is was me, I'd put a breakpoint on that call and trace it to check how the TYPEATTR structure pointer is handled and where the information comes from. Depending on the source you might be able to runtime or raw file change the flags to what you want.
Let us know of any progress (or if this was even remotely what you were looking for).
Kayaker