Archive: NSIS Com and interfaces


NSIS Com and interfaces
Hi. I'am write a script for adding component category


!define CLSCTX_INPROC_SERVER 1
!define ICatRegister_ID "{0002E012-0000-0000-C000-000000000046}"
!define CLSID_StdComponentCategoryMgr "{0002E005-0000-0000-C000-000000000046}"

!define CATID_OPCDAServer20 "{63D5F432-CFE4-11d1-B2C8-0060083BA1FB}"
!define CategoryDescription "OPC Data Access Server Version 2.05"

!define CLASSID "{20690CDC-4490-4F8A-87ED-87F1DE2D9404}"

var CatRegister
var CatInfo

!Macro CreateComponentCategory
System::Call "ole32::CoCreateInstance(g '${CLSID_StdComponentCategoryMgr}', i 0, i ${CLSCTX_INPROC_SERVER}, g '${ICatRegister_ID}', *i $CatRegister)i .R0"
${If} $R0 != 0 #S_OK
Abort "some text ICatRegister"
${EndIf}

#PCatInfo
System::Alloc 276
pop $CatInfo
System::Call '*$CatInfo(g "${CATID_OPCDAServer20}", i 1033, *&w256 "${CategoryDescription}")'

System::Call "$CatRegister->3(i 1, i $CatInfo)i .R0"
${If} $R0 != 0 #S_OK
Abort "some text ${CategoryDescription}"
${EndIf}
!MacroEnd


CoCreateInstance work fine.
But CatRegister->RegisterCategories always return error.
Why is happen?
PS: sorry for bad english

System::Call '*$CatInfo(&g16 "${CATID_OPCDAServer20}", i 1033, &w128 "${CategoryDescription}")' is probably more correct


No its don't help

There is one piece
if i write

MessageBox MB_ICONINFORMATION|MB_OK $CatRegister

Message show with empty string
And if i write
MessageBox MB_ICONINFORMATION|MB_OK $CatInfo

Message show integer value(i think this is pointer of struct)
This is normal?
And how i can see interface pointer?

System::Call "ole32::CoCreateInstance(g '${CLSID_StdComponentCategoryMgr}', i 0, i ${CLSCTX_INPROC_SERVER}, g '${ICatRegister_ID}', *i $CatRegister)i .R0" should be System::Call "ole32::CoCreateInstance(g '${CLSID_StdComponentCategoryMgr}', i 0, i ${CLSCTX_INPROC_SERVER}, g '${ICatRegister_ID}', *i.r1)i .R0" + StrCpy $CatRegister $1


Now it's work
Thank you very much