Prompt please as on ASM the following code will look:

int controlsInit = FALSE;

BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
{

hInstance = hinstDLL;

if (! controlsInit) {

controlsInit = TRUE;

InitCustomControls(hInstance);

InitCommonControls();

}

return(TRUE);

}


__declspec(dllexport) ClassDesc *LibClassDesc(int i) {

switch(i) {

case 0: return &MeltCD;

default: return 0;

}

}


class MeltClassDesc : public ClassDesc {

public:

int IsPublic() { return TRUE; }

void * Create(BOOL loading=FALSE) { return new MeltMod(); }

const TCHAR * ClassName() { return _T("Melt"); }

SClass_ID SuperClassID() { return OSM_CLASS_ID; }

Class_ID ClassID() { return Class_ID(0xA1C8E1D1, 0xE7AA2BE5); }

const TCHAR* Category() { return _T(""); }

};

static MeltClassDesc MeltCD;
Posted on 2004-08-07 07:56:55 by Alex BP
You must give us the ClassDesc, MeltMod and Class_ID definitions. There are two ways to make a C++ -compatible code in asm - hardcoding or using existing macros that increase readability and stability dramatically for no speed cost. I always prefer the easy way :grin: :
http://www.asmcommunity.net/board/index.php?topic=17987
Posted on 2004-08-07 08:54:38 by Ultrano
class ClassDesc {
private:
Tab<FPInterface*> interfaces;
public:
virtual ~ClassDesc() {}
virtual int IsPublic()=0;
virtual void * Create(BOOL loading=FALSE)=0;
virtual int BeginCreate(Interface *i) {return 0;}
virtual int EndCreate(Interface *i) {return 0;};
virtual const TCHAR* ClassName()=0;
virtual SClass_ID SuperClassID()=0;
virtual Class_ID ClassID()=0;
virtual const TCHAR* Category()=0;
virtual BOOL OkToCreate(Interface *i) { return TRUE; }
virtual BOOL HasClassParams() {return FALSE;}
virtual void EditClassParams(HWND hParent) {}
virtual void ResetClassParams(BOOL fileReset=FALSE) {}

virtual int NumActionTables() { return 0; }
virtual ActionTable* GetActionTable(int i) { return NULL; }

virtual BOOL IsManipulator() { return FALSE; }

virtual BOOL CanManipulate(ReferenceTarget* hTarget) { return FALSE; }
virtual BOOL CanManipulateNode(INode* pNode) { return FALSE; }

virtual Manipulator* CreateManipulator(ReferenceTarget* hTarget,
INode* pNode) {return NULL;}
virtual Manipulator* CreateManipulator(INode* pNode) {return NULL;}

virtual BOOL NeedsToSave() { return FALSE; }
virtual IOResult Save(ISave *isave) { return IO_OK; }
virtual IOResult Load(ILoad *iload) { return IO_OK; }

virtual DWORD InitialRollupPageState() { return 0x7fffffff; }

virtual const TCHAR* InternalName() { return NULL; }
virtual HINSTANCE HInstance() { return NULL; }
virtual int NumParamBlockDescs() { return 0; }
virtual ParamBlockDesc2* GetParamBlockDesc(int i) { return NULL; }
virtual ParamBlockDesc2* GetParamBlockDescByID(BlockID id) { return NULL; }
virtual void AddParamBlockDesc(ParamBlockDesc2* pbd) { }
virtual void BeginEditParams(IObjParam *ip, ReferenceMaker* obj, ULONG flags, Animatable *prev) { }
virtual void EndEditParams(IObjParam *ip, ReferenceMaker* obj, ULONG flags, Animatable *prev) { }
virtual void InvalidateUI(ParamBlockDesc2* pbd) { }
CoreExport virtual TCHAR* GetRsrcString(INT_PTR id);
virtual void MakeAutoParamBlocks(ReferenceMaker* owner) { }
virtual int NumParamMaps() { return 0; }
virtual IParamMap2* GetParamMap(int i) { return NULL; }
virtual IParamMap2* GetParamMap(ParamBlockDesc2* pbd) { return NULL; }
virtual void SetUserDlgProc(ParamBlockDesc2* pbd, ParamMap2UserDlgProc* proc=NULL) { }
virtual ParamMap2UserDlgProc* GetUserDlgProc(ParamBlockDesc2* pbd) { return NULL; }

virtual bool DrawRepresentation(COLORREF bkColor, HDC hDC, Rect &rect) { return FALSE; }

virtual int NumInterfaces() { return interfaces.Count(); }
virtual FPInterface* GetInterfaceAt(int i) { return interfaces; }
CoreExport virtual FPInterface* GetInterface(Interface_ID id);
CoreExport virtual FPInterface* GetInterface(TCHAR* name);
CoreExport virtual void AddInterface(FPInterface* fpi);
virtual void ClearInterfaces() { interfaces.ZeroCount(); }

virtual Class_ID SubClassID() { return Class_ID(); }

virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; }
};



class Class_ID {
ULONG a,b;
public:
Class_ID() { a = b = 0xffffffff; }
Class_ID(const Class_ID& cid) { a = cid.a; b = cid.b; }
Class_ID(ulong aa, ulong bb) { a = aa; b = bb; }
ULONG PartA() { return a; }
ULONG PartB() { return b; }
void SetPartA( ulong aa ) { a = aa; } //-- Added 11/21/96 GG
void SetPartB( ulong bb ) { b = bb; }
int operator==(const Class_ID& cid) const { return (a==cid.a&&b==cid.b); }
int operator!=(const Class_ID& cid) const { return (a!=cid.a||b!=cid.b); }
Class_ID& operator=(const Class_ID& cid) { a=cid.a; b = cid.b; return (*this); }
bool operator<(const Class_ID& rhs) const
{
if ( a < rhs.a || ( a == rhs.a && b < rhs.b ) )
return true;

return false;
}
};

typedef ULONG_PTR SClass_ID;
Posted on 2004-08-07 09:53:33 by Alex BP
Looks something like this. Got bored in the end



[size=9]
include masm32ultranoankase.inc



class ClassDesc,,C++ compatible

des interfaces ObjVector

virtual IsPublic:
virtual Create: loading
virtual BeginCreate: i
virtual EndCreate: i
virtual ClassName:
virtual SuperClassID:
virtual ClassID:
virtual Category:
virtual OkToCreate: i
virtual HasClassParams:
virtual EditClassParams: hParent
virtual ResetClassParams: fileReset

virtual NumActionTables:
virtual GetActionTable: i

virtual IsManipulator:

virtual CanManipulate: hTarget
virtual CanManipulateNode: pNode

virtual CreateManipulator: hTarget,pNode

virtual NeedsToSave:
virtual Save: isave
virtual Load: iload

virtual InitialRollupPageState:

virtual InternalName:
virtual HInstance:
virtual NumParamBlockDescs:
virtual GetParamBlockDesc: i
virtual GetParamBlockDescByID: id
virtual AddParamBlockDesc: pbd
virtual BeginEditParams: ip,obj,flags,prev
virtual EndEditParams: ip,obj,flags,prev
virtual InvalidateUI: pbd
virtual GetRsrcString: id
virtual MakeAutoParamBlocks: owner
virtual NumParamMaps:
virtual GetParamMap: i
virtual SetUserDlgProc: pbd,proc
virtual GetUserDlgProc pbd

virtual DrawRepresentation: bkColor,hDC,rect

virtual NumInterfaces:
virtual GetInterfaceAt: i
virtual GetInterface: id
virtual AddInterface: fpi
virtual ClearInterfaces:

virtual SubClassID:

virtual Execute: cmd,arg1,arg2,arg3
endclass


ClassDesc_ClassDesc proc
lea ecx,[ecx].ClassDesc.interfaces
$new ecx,ObjVector
ret
ClassDesc_ClassDesc endp

ClassDesc_$ClassDesc proc
lea ecx,[ecx].ClassDesc.interfaces
delete ecx
ret
ClassDesc_$ClassDesc endp

ClassDesc_IsPublic proc
xor eax,eax
ret
ClassDesc_IsPublic endp

ClassDesc_Create proc loading
xor eax,eax
ret
ClassDesc_Create endp

ClassDesc_BeginCreate proc i
xor eax,eax
ret
ClassDesc_BeginCreate endp

ClassDesc_EndCreate proc i
xor eax,eax
ret
ClassDesc_EndCreate endp

ClassDesc_ClassName proc
xor eax,eax
ret
ClassDesc_ClassName endp

ClassDesc_SuperClassID proc
xor eax,eax
ret
ClassDesc_SuperClassID endp

ClassDesc_ClassID proc
xor eax,eax
ret
ClassDesc_ClassID endp

ClassDesc_Category proc
xor eax,eax
ret
ClassDesc_Category endp

ClassDesc_OkToCreate proc i
mov eax,1
ret
ClassDesc_OkToCreate endp

ClassDesc_HasClassParams proc
xor eax,eax
ret
ClassDesc_HasClassParams endp

ClassDesc_EditClassParams proc hParent
ret
ClassDesc_EditClassParams endp

ClassDesc_ResetClassParams proc fileReset
ret
ClassDesc_ResetClassParams endp

ClassDesc_NumActionTables proc
xor eax,eax
ret
ClassDesc_NumActionTables endp

ClassDesc_GetActionTable proc i
xor eax,eax
ret
ClassDesc_GetActionTable endp

ClassDesc_IsManipulator proc
xor eax,eax
ret
ClassDesc_IsManipulator endp

ClassDesc_CanManipulate proc hTarget
xor eax,eax
ret
ClassDesc_CanManipulate endp

ClassDesc_CanManipulateNode proc pNode
xor eax,eax
ret
ClassDesc_CanManipulateNode endp

ClassDesc_CreateManipulator proc pNode
xor eax,eax
ret
ClassDesc_CreateManipulator endp

ClassDesc_NeedsToSave proc
xor eax,eax
ret
ClassDesc_NeedsToSave endp

ClassDesc_Save proc isave
mov eax,IO_OK
ret
ClassDesc_Save endp

ClassDesc_Load proc iload
mov eax,IO_OK
ret
ClassDesc_Load endp

ClassDesc_InitialRollupPageState proc
mov eax,7FFFFFFFh
ret
ClassDesc_InitialRollupPageState endp

ClassDesc_InternalName proc
xor eax,eax
ret
ClassDesc_InternalName endp

ClassDesc_HInstance proc
xor eax,eax
ret
ClassDesc_HInstance endp

ClassDesc_NumParamBlockDescs proc
xor eax,eax
ret
ClassDesc_NumParamBlockDescs endp

ClassDesc_GetParamBlockDesc proc i
xor eax,eax
ret
ClassDesc_GetParamBlockDesc endp

ClassDesc_GetParamBlockDescByID proc id
xor eax,eax
ret
ClassDesc_GetParamBlockDescByID endp

ClassDesc_AddParamBlockDesc proc pbd
ret
ClassDesc_AddParamBlockDesc endp

ClassDesc_BeginEditParams proc ip,obj,flags,prev
ret
ClassDesc_BeginEditParams endp

ClassDesc_EndEditParams proc ip,obj,flags,prev
ret
ClassDesc_EndEditParams endp

ClassDesc_InvalidateUI proc pbd
ret
ClassDesc_InvalidateUI endp

ClassDesc_GetRsrcString proc id
xor eax,eax
ret
ClassDesc_GetRsrcString endp

ClassDesc_MakeAutoParamBlocks proc owner
ret
ClassDesc_MakeAutoParamBlocks endp

ClassDesc_NumParamMaps proc
xor eax,eax
ret
ClassDesc_NumParamMaps endp

ClassDesc_GetParamMap proc pbd
xor eax,eax
ret
ClassDesc_GetParamMap endp

ClassDesc_SetUserDlgProc proc pbd,procc
ret
ClassDesc_SetUserDlgProc endp

ClassDesc_GetUserDlgProcpbd proc
xor eax,eax
ret
ClassDesc_GetUserDlgProcpbd endp

ClassDesc_DrawRepresentation proc bkColor,hDC,rect
xor eax,eax
ret
ClassDesc_DrawRepresentation endp

ClassDesc_NumInterfaces proc
mov eax,[ecx].ClassDesc.interfaces.BytesTaken
shr eax,2
ret
ClassDesc_NumInterfaces endp

ClassDesc_GetInterfaceAt proc i
ret
ClassDesc_GetInterfaceAt endp

ClassDesc_GetInterface proc name1
ret
ClassDesc_GetInterface endp

ClassDesc_AddInterface proc fpi
ret
ClassDesc_AddInterface endp

ClassDesc_ClearInterfaces proc
lea ecx,[ecx].ClassDesc.interfaces
push ecx
delete ecx
pop ecx
$new ecx,ObjVector
ret
ClassDesc_ClearInterfaces endp

ClassDesc_SubClassID proc
icall ecx,ClassDesc,ClassID
ret
ClassDesc_SubClassID endp

ClassDesc_Execute proc cmd,arg1,arg2,arg3
xor eax,eax
ret
ClassDesc_Execute endp



; ============================================================


class MeltClassDesc,ClassDesc,C++ compatible
virtual IsPublic:
virtual Create: loading
virtual ClassName:

virtual SuperClassID:

virtual ClassID:

virtual Category:
endclass





.data
controlsInit dd 0
MeltCD MeltClassDesc <>
.code


DllMain proc PUBLIC hinstDLL,fdwReason,lpvReserved
m2m hInstance,hinstDLL
cmp controlsInit,0
jnz _ret
mov controlsInit,1

invoke InitCustomControls,hInstance
invoke InitCommonControls

_ret: mov eax,1
ret
DllMain endp


LibClassDesc proc PUBLIC i
xor eax,eax
.if !i
$new offset MeltCD,MeltClassDesc
lea eax,MeltCD
.endif
ret
LibClassDesc endp




MeltClassDesc_MeltClassDesc proc
ret
MeltClassDesc_MeltClassDesc endp

MeltClassDesc_$MeltClassDesc proc
ret
MeltClassDesc_$MeltClassDesc endp

MeltClassDesc_IsPublic proc
mov eax,1
ret
MeltClassDesc_IsPublic endp

MeltClassDesc_Create proc loading
ret
MeltClassDesc_Create endp





end


[/SIZE]


You should have some experience in C++/asm interfacing before coping with such a huge class. There are several procs I missed - you'll notice them when you have enough experience to convert the code.
Posted on 2004-08-07 11:23:24 by Ultrano