QUOTE
ActiveX Dll 组件注册(原始创作 KiCHiK):
;在 -Post 块里
Exec 'regsvr32.exe /s "$INSTDIR\${NAME_OF_MY_DLL}"'
;在 Uninstall 块里
Exec 'regsvr32.exe /s /u "$INSTDIR\${NAME_OF_MY_DLL}"'
QUOTE
添加一个共享的 DLL(原始创作 sunjammer):
; Increments a shared DLLs reference count.
; Use by passing one item on the stack (the full path of the DLL).
;
; 用法:
; Push $SYSDIR\myDll.dll
; Call AddSharedDLL
;
Function AddSharedDLL
Exch $R1
Push $R0
ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs
$R1
IntOp $R0 $R0 + 1
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
$R0
Pop $R0
Pop $R1
FunctionEnd
QUOTE
Remove a shared DLL
; Usage:
; Push $SYSDIR\myDll.dll
; Call un.RemoveSharedDLL
;
Function un.RemoveSharedDLL
Exch $R1
Push $R0
ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs
$R1
StrCmp $R0 "" remove
IntOp $R0 $R0 - 1
IntCmp $R0 0 rk rk uk
rk:
DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs
$R1
goto remove
uk:
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs
$R1 $R0
Goto noremove
remove:
Delete /REBOOTOK $R1
noremove:
Pop $R0
Pop $R1
FunctionEnd
QUOTE
RegisterTLB - register Typelib:
Function RegisterTlb
Exch $R0 ; save old R0 and get filename as R0
Push $R1 ; save R1
Push $R2 ; save R2
; now register TLB file R0
StrCpy $R1 0 ; init R1 with 0 (maybe not neccessary)
System::Call "Oleaut32::LoadTypeLib(w, *i) i (R0, R1R1) .R2"
; R2 contains result, 0 if ok
IntCmp $R2 0 cont
LogText "LoadTypeLib returned $R2 with $R0"
; debug MessageBox MB_OK "LoadTypeLib returned $R2 with $R0"
Goto exit
cont:
; now R1 contains pointer to typelib
System::Call "Oleaut32::RegisterTypeLib(i, w, i) i (R1, R0, 0) .R2"
; R2 contains result, 0 if ok
IntCmp $R2 0 exit
LogText "RegisterTypeLib returned $R2 with $R1, $R0"
; debug MessageBox MB_OK "RegisterTypeLib returned $R2 with $R1, $R0"
exit:
;; debug MessageBox MB_OK "RegisterTlb: all ok"
Pop $R2 ; R2 restore
Pop $R1 ; R1 restore
Pop $R0 ; R0 restore
FunctionEnd