Jump to content

Zimbra Desktop 7.2.2 (potential Outlook replacement)


Recommended Posts

Due to extremely poor performance with the newer MS servers, I had a look around for a potential replacement for Outlook (2000 and XP versions, both are terrible). The one that seemed most complete, including support for Exchange Server, was Zimbra ...

OK, so I downloaded the file 'zdesktop_7_2_2_ga_b11951_20130318071431_win32.msi' (MD5=9bfac177eba208553ae2940f92befe9f) and proceeded to hack this XP+ package as follows :

1. Open in hex editor and at address 5A85FCC, change 2C 01 to C8 00 (surrounding bytes = 01 03 00 00 00 2C 01 00 00 03).
2. Open in Orca and delete the VersionNT check line in 'LaunchCondition'. Save (don't use Save As).
3. Run the MSI.
4. In "\Program Files\Zimbra\Zimbra Desktop\win32\jre\bin" rename 'plugin2' directory to 'plugin2_inhibit'.
5. Copy 'cscript.exe' from "\WINDOWS\COMMAND\" to "\WINDOWS\SYSTEM\".

OK, now Zimbra Desktop is pretty much installed. It has few dependencies beyond what W98 provides, and KernelEx can probably provide the rest.

However, it is launched by a VBS script called 'zdrun.vbs' and that gives the following error at line 250 (copy the shortcut command and run from a command prompt to see the error) : "Microsoft VBScript runtime error: File name or class name not found during Automation operation:'GetObject'". Trying to run the Zimbra executable directly just produces an error message about a missing configuration file, so presumably, that is supplied by this script.

So, is anyone familiar with VB script ... ?

Joe.

Edits : In step 1, eliminated first byte of the surrounding context (can be used to find equivalent patches for similar MSI files, such as earlier versions of Zimbra). In step 5, changed edit of Zimbra shortcut path to a file copy of 'cscript.exe' instead (solves other instances of the path issue).

Edited by jds
Link to comment
Share on other sites

  • 4 weeks later...

Not sure how much help it will be but, at minimum, Windows Management Instrumentation will need to be running:

http://support.microsoft.com/kb/322363

Note there is a section for 98 and 98 SE.

You *may* also need DSClient:

http://www.imss.caltech.edu/node/414

This page has a link to the setup under the section 'Where Can I Get The DSClient?'

I think there was hotfix for this at some point in time.

Edit:

Should've figured:

http://www.mdgx.com/add.htm#WMI

http://www.mdgx.com/add.htm#ADS

Edited by Steven W
Link to comment
Share on other sites

  • 5 weeks later...

Not sure how much help it will be but, at minimum, Windows Management Instrumentation will need to be running:

http://support.microsoft.com/kb/322363

Note there is a section for 98 and 98 SE.

You *may* also need DSClient:

http://www.imss.caltech.edu/node/414

This page has a link to the setup under the section 'Where Can I Get The DSClient?'

I think there was hotfix for this at some point in time.

Edit:

Should've figured:

http://www.mdgx.com/add.htm#WMI

http://www.mdgx.com/add.htm#ADS

Yes, you are correct. The original error was resolved by installing WMI. I don't know if DSClient is also needed, as I have that installed already for other stuff anyway.

After resolving this first VBS error, I implemented a couple of work-arounds for subsequent script errors, as below :

ASCII differences between ORIGINAL.VBS and MODIFIED.VBSReplace lines 201-208 in ORIGINAL.VBS<     For Each oProc in oProcs<         If Instr(1, oProc.CommandLine, WScript.ScriptName, 1) > 0 Then<             If bFound Then<                 WScript.Quit<             End If<             bFound = true<         End If<     Nextwith lines 201-208 from MODIFIED.VBS> '     For Each oProc in oProcs> '         If Instr(1, oProc.CommandLine, WScript.ScriptName, 1) > 0 Then> '             If bFound Then> '                 WScript.Quit> '             End If> '             bFound = true> '         End If> '     NextReplace line 261 in ORIGINAL.VBS< sLocalAppDir = oFso.getFolder(oShellApp.Namespace(&H1c&).Self.Path).ShortPathwith lines 261-262 from MODIFIED.VBS> ' sLocalAppDir = oFso.getFolder(oShellApp.Namespace(&H1c&).Self.Path).ShortPath> sLocalAppDir = "E:\Progra~1"

Now what seems to happen is that the script produces one or more temporary sub-directories in the Zimbra installation directory in "\Program Files\Zimbra", whose contents are deleted. However, there seems to be a problem with the way it determines the path of these temporary directories, so that it also ends up deleting the contents of the whole Zimbra installation directory.

That's as far as I've managed to progress this thing so far.

Joe.

Edited by jds
Link to comment
Share on other sites

Wish I were more of a VBscript guru, but alas....

My thinking on the DSClient is that it will be necessary if you do get the thing up and running and try to connect to an Exchange Server that requires NTLM authentication. I could be mistaken, I did say *may*.

As for now, could you enlighten us with any particular error messages etc. from both the unmodded and modded vbs files?

Edit:

Those reading this should realize that there are some differences in VB script implementations on NT systems vs 9x systems. I take it that use of the single quote is the equivalent of "commenting out" lines.

Edited by Steven W
Link to comment
Share on other sites

Correct;http://technet.microsoft.com/en-us/library/ee176989.aspx#EBAA

... however, I see in ZDRUN.VBS this line (and occaisionally like elsewhere, on other webpages);

"where Name='cscript.exe'",, 48) ' 48: forward-only enumerator + return-immediately

... so I am unsure if a set of 'single quote's, when nestled within double quotes, is treated as

if it were simply double quotes?

Incidently, if jds is holding back on posting the }modified{ version of zdrun.vbs (all 250+ lines of it)

because it would make a loong post... well my vote is, jds, post away.

(Swing Away, Merrill. Merrill: Swing Away.)

Edited by buyerninety
Link to comment
Share on other sites

I was sent a private message regarding this post and it included the script. I can only assume that it is accurate and unmodified:

' * ***** BEGIN LICENSE BLOCK *****

' * Zimbra Collaboration Suite Server
' * Copyright © 2009, 2010, 2011 VMware, Inc.
' *
' * The contents of this file are subject to the Zimbra Public License
' * Version 1.3 ("License"); you may not use this file except in
' * compliance with the License. You may obtain a copy of the License at
' * http://www.zimbra.com/license.
' *
' * Software distributed under the License is distributed on an "AS IS"
' * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
' * ***** END LICENSE BLOCK *****
' */
'
' ZD runner
'

Dim oFso, oReg, oShellApp, oShell, oWMI, sScriptPath, sScriptDir, oTokens, sAppRoot, sDataRoot, sOverridePath
Dim sLocalAppDir, bIsUpgrade, sTmpDir, sRestoreDir, aUserDirs, aUserFiles, sVersion, sVerFile

const HKEY_CURRENT_USER = &H80000001

Sub LogMsg(sMsg, iLevel)
If (InStr(Wscript.FullName,"cscript") > 0) Then
WScript.StdOut.WriteLine(sMsg)
End If
If iLevel <= iLogLevel Then
oShell.LogEvent iLevel, "Zimbra Desktop: " & sMsg
End If
End Sub


Sub FindAndReplace(sFile, oTokens)
Dim oFso, oInFile, oOutFile, sTmpFile

Set oFso = CreateObject("Scripting.FileSystemObject")
sTmpFile = sFile & ".tmp"

On Error Resume Next
Set oInFile = oFso.OpenTextFile(sFile, 1, false)
If Err.number <> 0 Then
LogMsg "failed to open file: " & sFile, 1
Exit Sub
End If
Set oOutFile = oFso.OpenTextFile(sTmpFile, 2, true)
If Err.number <> 0 Then
LogMsg "failed to open file: " & sTmpFile, 1
Exit Sub
End If

Do Until oInFile.AtEndOfStream
Dim sLine, sKey
sLine = oInFile.ReadLine
For Each sKey In oTokens.Keys
sLine = Replace(sLine, sKey, oTokens.Item(sKey))
Next
oOutFile.WriteLine(sLine)
Loop

oInFile.Close
oOutFile.Close
oFso.DeleteFile sFile, true
oFso.MoveFile sTmpFile, sFile
End Sub

Function GetRandomId
Set oTypeLib = CreateObject("Scriptlet.TypeLib")
GetRandomId = LCase(Mid(oTypeLib.GUID, 2, 36))
End Function

Sub CopyIfExists(sSrc, sDest, bOW)
If oFso.FileExists(sSrc) Then
oFso.CopyFile sSrc, sDest, bOW
End If
End Sub

Sub LaunchPrism()
Dim sCmd, iRet

iRet = oReg.CreateKey(HKEY_CURRENT_USER, "Software\Zimbra\Zimbra Desktop\Prism")
oReg.SetStringValue HKEY_CURRENT_USER, "Software\Zimbra\Zimbra Desktop\Prism", "OverridePath", sOverridePath

sCmd = Chr(34) & sAppRoot & "\win32\prism\zdclient.exe" & Chr(34)
oShell.Run sCmd, 1, false
WScript.Quit
End Sub

Sub StopProcesses()
Dim sCmd, sCScript, sZdCtl

sCScript = Chr(34) & oFso.GetSpecialFolder(1).Path & "\cscript.exe" & Chr(34)
sZdCtl = Chr(34) & sDataRoot & "\bin\zdctl.vbs" & Chr(34)

'Stop backend service and prism
oShell.Run sCScript & " " & sZdCtl & " shutdown", 0, true
End Sub

Sub BackupFailed(sMsg)
If Not IsNull(sMsg) Then
oShell.Popup sMsg, 0, "Zimbra Desktop", 48
End If
oFso.MoveFolder sTmpDir, sRestoreDir
WScript.Quit
End Sub

Sub BackupData()
If oFso.FolderExists(sTmpDir) Then
' Save leftover temp dir, in case it's needed in manual recovery
Dim iEpoch
iEpoch = DateDiff("s", "01/01/1970 00:00:00", Now())
oFso.MoveFolder sTmpDir, sTmpDir & "." & iEpoch
End If
oFso.CreateFolder sTmpDir

On Error Resume Next

Dim sDir
For Each sDir In aUserDirs
If oFso.FolderExists(sDataRoot & "\" & sDir) Then
oFso.MoveFolder sDataRoot & "\" & sDir, sTmpDir & "\" & sDir
If Err.number <> 0 Then
BackupFailed "File operation failed. Please close any open files under " & _
sDataRoot & "\" & sDir
End If
End If
Next

oFso.CreateFolder sTmpDir & "\profile"
oFso.CreateFolder sTmpDir & "\conf"
Dim sFile
For Each sFile In aUserFiles
CopyIfExists sDataRoot & "\" & sFile, sTmpDir & "\" & sFile, true
Next

Dim iButton, sMsg
Do
oFso.DeleteFolder sDataRoot, true
If Err.number = 0 Then
Exit Sub
Else
sMsg = "Unable to delete folder: " & sDataRoot & ". " & _
"Please close any open files in this folder and its sub-folders."
iButton = oShell.Popup(sMsg, 0, "Zimbra Desktop", 5 + 48)
End If
Err.Clear
Loop While iButton = 4 ' Retry

' Cancled
BackupFailed Null
End Sub

Sub RestoreData(sSrcRoot)
Dim sDir
For Each sDir In aUserDirs
If oFso.FolderExists(sSrcRoot & "\" & sDir) Then
If oFso.FolderExists(sDataRoot & "\" & sDir) Then
oFso.DeleteFolder sDataRoot & "\" & sDir, true
End If
oFso.MoveFolder sSrcRoot & "\" & sDir, sDataRoot & "\" & sDir
End If
Next

Dim sFile
For Each sFile In aUserFiles
CopyIfExists sSrcRoot & "\" & sFile, sDataRoot & "\" & sFile, true
Next

oFso.DeleteFolder sSrcRoot, true
End Sub

Sub WriteVersion()
Dim oFout

On Error Resume Next
Set oFout = oFso.OpenTextFile(sVerFile, 2, true)
If Err.number = 0 Then
oFout.WriteLine(sVersion)
End If
oFout.Close
End Sub

Function ReadVersion()
Dim oFin

ReadVersion = ""
On Error Resume Next
Set oFin = oFso.OpenTextFile(sVerFile, 1, false)
If Err.number = 0 Then
ReadVersion= oFin.ReadLine()
End If
oFin.Close
End Function

Sub EnsureSingleInstance()
Dim oProcs, oProc, bFound
Set oProcs = oWMI.ExecQuery("Select * from Win32_Process " & _
"where Name='cscript.exe'",, 48) ' 48: forward-only enumerator + return-immediately

bFound = false
For Each oProc in oProcs
If Instr(1, oProc.CommandLine, WScript.ScriptName, 1) > 0 Then
If bFound Then
WScript.Quit
End If
bFound = true
End If
Next
End Sub

Sub BuildPath(ByVal Path)
If Not oFso.FolderExists(Path) Then
BuildPath oFso.GetParentFolderName(Path)
oFso.CreateFolder Path
End If
End Sub

Function GetDataRoot()
oReg.GetStringValue HKEY_CURRENT_USER, "Software\Zimbra\Zimbra Desktop", "DataRoot", GetDataRoot
If IsNull(GetDataRoot) Then
GetDataRoot = sLocalAppDir & "\Zimbra\Zimbra Desktop"
Else
If Not oFso.FolderExists(GetDataRoot) Then
BuildPath(GetDataRoot)
End If
GetDataRoot = oFso.getFolder(GetDataRoot).ShortPath
End If
End Function

Function IsNonEnUsXp()
Dim nLang, sVer
Set colOSes = oWMI.ExecQuery("Select * from Win32_OperatingSystem")
For Each oOS in colOSes
nLang = oOS.OSLanguage
sVer = oOS.Version
If nLang <> 1033 AND Instr(sVer, "5.") = 1 Then
IsNonEnUsXp = true
Else
IsNonEnUsXp = false
End If
Exit For
Next
End Function

'------------------------------- main ---------------------------------

Set oFso = CreateObject("Scripting.FileSystemObject")
Set oShellApp = CreateObject("Shell.Application")
Set oShell = CreateObject("WScript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

EnsureSingleInstance

sVersion="7.2.2 build 11951"
aUserDirs = Array("index", "store", "sqlite", "log", "zimlets-properties", "zimlets-deployed")
aUserFiles = Array("conf\keystore", "profile\prefs.js", "profile\persdict.dat", "profile\localstore.json")
sScriptPath = WScript.ScriptFullName
sScriptDir = Left(sScriptPath, InStrRev(sScriptPath, WScript.ScriptName) - 2)
sAppRoot = oFso.GetParentFolderName(sScriptDir)
sLocalAppDir = oFso.getFolder(oShellApp.Namespace(&H1c&).Self.Path).ShortPath

sDataRoot = GetDataRoot()
xmlDataRoot = Replace(sDataRoot,"&","&")
sVerFile = sDataRoot & "\conf\version"
sTmpDir = sDataRoot & ".tmp"
sRestoreDir = sDataRoot & ".rst"
sOverridePath = sDataRoot & "\zdesktop.webapp\override.ini"
bIsUpgrade = false

If oFso.FolderExists(sDataRoot) Then
If oFso.FolderExists(sRestoreDir) Then
RestoreData sRestoreDir
End If

Dim sCurVer
sCurVer = ReadVersion
If StrComp(sCurVer, sVersion) = 0 Then
LaunchPrism
Else
bIsUpgrade = true
End If
End If

Dim sMsg
sMsg = "Initializing, please wait..."
If (InStr(Wscript.FullName,"cscript") > 0) Then
WScript.Echo sMsg
End If
oShell.Popup sMsg, 5, "Zimbra Desktop", 64

StopProcesses

If bIsUpgrade Then
BackupData
End If

' copy data files
If Not oFso.FolderExists(sLocalAppDir & "\Zimbra") Then
oFso.CreateFolder sLocalAppDir & "\Zimbra"
End If
If Not oFso.FolderExists(sLocalAppDir & "\Zimbra\Zimbra Desktop") Then
oFso.CreateFolder sLocalAppDir & "\Zimbra\Zimbra Desktop"
End If
oFso.CopyFolder sAppRoot & "\data\*", sDataRoot & "\", true
WriteVersion

Set physMem = GetObject("winmgmts:").InstancesOf("Win32_PhysicalMemory")
For Each mem In physMem
memTmp = mem.capacity / 1024 / 1024
TotalRam = TotalRam + memTmp
Next

If TotalRam > 1000 Then
javaXms = "-Xms128m"
javaXmx = "-Xmx512m"
Else
javaXms = "-Xms32m"
javaXmx = "-Xmx150m"
End If

' fix data files
Set oTokens = CreateObject("Scripting.Dictionary")
oTokens.Add "@install.app.root@", sAppRoot
oTokens.Add "@install.data.root@", sDataRoot
oTokens.Add "@install.key@", GetRandomId()
oTokens.Add "@install.mutex.name@", GetRandomId()
oTokens.Add "@install.locale@", "en-US"
oTokens.Add "@java.xms@", javaXms
oTokens.Add "@java.xmx@", javaXmx

FindAndReplace sDataRoot & "\bin\zdctl.vbs", oTokens
FindAndReplace sDataRoot & "\conf\zdesktop.conf", oTokens
FindAndReplace sDataRoot & "\zdesktop.webapp\webapp.ini", oTokens
FindAndReplace sDataRoot & "\profile\user.js", oTokens
FindAndReplace sOverridePath, oTokens

oTokens.Remove "@install.data.root@"
oTokens.Add "@install.data.root@", xmlDataRoot
FindAndReplace sDataRoot & "\conf\localconfig.xml", oTokens
FindAndReplace sDataRoot & "\jetty\etc\jetty.xml", oTokens

If bIsUpgrade Then
RestoreData sTmpDir
End If

oReg.CreateKey HKEY_CURRENT_USER, "Software\Zimbra\Zimbra Desktop"
oReg.SetStringValue HKEY_CURRENT_USER, "Software\Zimbra\Zimbra Desktop", "DataRoot", sDataRoot

LaunchPrism

Wow! I can see Java is required. I'm getting less impressed by the second.

Edit: The whole thing is a Java app. I didn't realize.

Further Edit:

In case you're wondering what Prism is in this context:

https://wiki.mozilla.org/Prism

Edited by Steven W
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...