Dumb dmbasic

Today I had faced with following “challenge”:

When dealing with composer I prefer to put all object types into one project and all TBOs into another, due to following reasons:

  • both content server and composer are extremely slow in installing object types – I have seen some situations when installing object types takes about two hours because content server performs millions database selects
  • TBO implementation changes more often than object type definition

but today I was need to attach default aspects to certain object types, in order to do that I had written a post-install procedure (and, yeap, my eyes had came out):

Const glabel As String          = "Label"
Const ginfo As String           = "Info"
Const gerror As String          = "Error"

Private Sub PrintMessage(mssg As String, mssgtype As String)
  If(mssgtype=glabel) Then
            Print "<BR><B><FONT size=3>"
            Print mssg
            print "</FONT></B>"
  ElseIf(mssgtype=ginfo) Then
            Print "<BR><FONT color=blue>"
            Print mssg
            print "</FONT>"
  ElseIf(mssgtype=gerror) Then
            Print "<BR><FONT color=red size=3>"
            Print mssg
            print "</FONT>"
            Print "<BR>" & mssg
  End If
End Sub

Private Sub AddAspect(TypeName2 As String, AspectName As String)
    Dim AddQryAPI As String
    Dim APIStatus As String
    Dim Status As Integer
    Dim QueryID As String
    Dim AttributeID As String

    AddQryAPI = "query,c,ALTER TYPE " & TypeName2 & " ADD DEFAULT ASPECTS " & AspectName
    Call PrintMessage("Adding the aspect " & AspectName & " to " & TypeName2, ginfo)
    QueryID = dmAPIGet(AddQryAPI)
    If QueryID <> "" Then
         Call PrintMessage("Adding success", ginfo)
         Status = dmAPIExec("close,c," & QueryID)
         msgStr$ = dmAPIGet("getmessage,c")
         Call PrintMessage(msgStr$, gerror)
         msgStr$ = "Failed to add default aspect " & AspectName
         Call PrintMessage(msgStr$, gerror)
    End If
End Sub

Sub PostInstall(DocbaseName As String, UserName As String, Password As String)
  Dim SessionID As String

  SessionID= dmAPIGet("connect," & DocbaseName & "," & UserName & "," & Password)
  If SessionID ="" Then
    Print "Fail to connect to docbase " & DocbaseName &" as user " & UserName
    Print "Connect to docbase " & DocbaseName &" as user " & UserName
  End If

  Call AddAspect("type1", "aspect1")

End Sub

but when installing composer project I got weird error:

[FATAL]  An unexpected error has occurred during installation.

For more details, check the most recent error log located by default in 'C:\Temp\documentum\'.
com.emc.ide.installer.PostInstallException: Error running post-install procedure "postinstall"
        at internal.com.emc.ide.installer.DarInstaller.postInstall(DarInstaller.java:1574)
        at internal.com.emc.ide.installer.DarInstaller.doInstall(DarInstaller.java:669)
        at internal.com.emc.ide.installer.DarInstaller.doInstall(DarInstaller.java:334)
        at internal.com.emc.ide.installer.DarInstaller.doInstall(DarInstaller.java:303)
        at com.emc.ide.installer.popup.actions.InstallOperation.installDar(InstallOperation.ja
        at com.emc.ide.installer.popup.actions.InstallOperation.run(InstallOperation.java:80)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:1
Caused by: com.emc.ide.external.dfc.procedurerunner.ProcedureRunnerException: Failed to run dm
mbasic\dmbasic.exe -f G:\Users\andrey\work\vk\ord_int\dev\ContentServer\ComposerProject\esed_d
        at com.emc.ide.external.dfc.procedurerunner.ProcedureRunnerUtils.executeCommand(Proced
        at com.emc.ide.external.dfc.procedurerunner.ProcedureRunnerUtils.executeDmBasic(Proced
        at com.emc.ide.external.dfc.procedurerunner.ProcedureRunner.execute(ProcedureRunner.ja
        at internal.com.emc.ide.installer.DarInstaller.postInstall(DarInstaller.java:1570)
        ... 6 more
Caused by: java.io.IOException: Cannot run program "G:\app\emc\composer\7.2\plugins\com.emc.id
rror=740, The requested operation requires elevation
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
        at com.emc.ide.external.dfc.procedurerunner.ProcedureRunnerUtils.executeCommand(Proced
        ... 9 more
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elev
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:385)
        at java.lang.ProcessImpl.start(ProcessImpl.java:136)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
        ... 10 more

What the fuck did just happened here?

For some weird reason EMC coders decided that dmbasic executable requires administrative privileges (note shield icon – I bet dmbasic sends some information directly to EMC, otherwise I can’t find any reason why it requires administrative privileges):

How to fix that? Initially I was trying to find manifest editor in google, but after a couple of futile attempts I just edited dmbasic binary in HEX editor and got following (note extra spaces intended to preserve file size):