0% found this document useful (0 votes)
11 views

ThinAppAPI

The ThinApp SDK API Reference Guide provides comprehensive documentation for developers using the VMware ThinApp SDK to create applications that interact with ThinApp virtual packages. It includes detailed descriptions of SDK objects, properties, methods, and API functions, along with technical support resources and feedback options. The guide is intended for software developers familiar with programming and scripting languages such as C++ and VBScript.

Uploaded by

MSMG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

ThinAppAPI

The ThinApp SDK API Reference Guide provides comprehensive documentation for developers using the VMware ThinApp SDK to create applications that interact with ThinApp virtual packages. It includes detailed descriptions of SDK objects, properties, methods, and API functions, along with technical support resources and feedback options. The guide is intended for software developers familiar with programming and scripting languages such as C++ and VBScript.

Uploaded by

MSMG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

ThinApp SDK API Reference Guide

VMware ThinApp SDK 4.0.2

EN-000191-00
ThinApp SDK API Reference Guide

You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
docfeedback@vmware.com

© 2009 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property
laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents.
VMware, the VMware “boxes” logo and design, Virtual SMP, and VMotion are registered trademarks or trademarks of
VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks
of their respective companies.

VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com

2 VMware, Inc.
Contents

About This Book 5

1 ThinApp SDK Objects 7


ThinApp.Management 7
Properties 7
Methods 7
ThinApp.Package 8
Properties 8
Methods 9
ThinApp.VFileSystem 12
Properties 12
Methods 12
ThinApp.VFile 15
Properties 15
Methods 16
ThinApp.VFolder 17
Properties 17
Methods 17
ThinApp.VRegistry 18
Properties 18
Methods 18
ThinApp.VRegKey 18
Properties 18
Methods 18
ThinApp.VRegValue 19
Properties 19
Methods 19
ThinApp.Option 19
Properties 19
Methods 19

2 ThinApp API SDK Functions and Notifications 21


VMware ThinApp Notifications 21
OnFirstSandboxOwner 21
OnFirstParentStart 21
OnGetOption 22
OnFirstParentExit 22
OnLastProcessExit 22
VMware ThinApp SDK API Functions 22
AddForcedVirtualLoadPath 22
ExitProcess 23
ExpandPath 23
ExecuteExternalProcess 23
ExecuteVirtualProcess 24
GetBuildOption 24
GetFileVersionValue 24
GetCommandLine 25
GetCurrentProcessName 25

VMware, Inc. 3
ThinApp SDK API Reference Guide

GetOSVersion 26
GetEnvironmentVariable 26
RemoveSandboxOnExit 27
SetEnvironmentVariable 27
SetfileSystemIsolation 27
SetRegistryIsolation 28
WaitForProcess 28

3 Legacy Thinstall Management API 29


ThinstallManagementAPI Object 29
Properties 29
Methods 29

4 VMware, Inc.
About This Book

The ThinApp SDK API Reference Guide provides information about developing applications using theVMware®
ThinApp™ SDK. VMware provides many different APIs and SDKs for various applications and goals. This
book provides information about the ThinApp SDK for developers that are interested in building applications
that interact with VMware ThinApp virtual packages.

Revision History
This book is revised with each release of the product or when necessary. A revised version can contain minor
or major changes. Table 1 summarizes the significant changes in each version of this book.

Table 1. Revision History


Revision Date Description

15APR2008 First version of the ThinApp SDK 4.0.2 documentation.

Intended Audience
ThinApp SDK users typically include software developers who use programming languages such as C++ and
script languages such as VBScript to create applications that work with ThinApp packages.

Document Feedback
VMware welcomes your suggestions for improving our documentation. Send your feedback to
docfeedback@vmware.com.

Technical Support and Education Resources


The following sections describe the technical support resources available to you. To access the current versions
of other VMware books, go to http://www.vmware.com/support/pubs.

Online and Telephone Support


To use online support to submit technical support requests, view your product and contract information, and
register your products, go to http://www.vmware.com/support.

Support Offerings
To find out how VMware support offerings can help meet your business needs, go to
http://www.vmware.com/support/services.

VMware, Inc. 5
ThinApp SDK API Reference Guide

VMware Professional Services


VMware Education Services courses offer extensive hands-on labs, case study examples, and course materials
designed to be used as on-the-job reference tools. Courses are available onsite, in the classroom, and live
online. For onsite pilot programs and implementation best practices, VMware Consulting Services provides
offerings to help you assess, plan, build, and manage your virtual environment. To access information about
education classes, certification programs, and consulting services, go to http://www.vmware.com/services.

6 VMware, Inc.
1

ThinApp SDK Objects 1


The ThinApp SDK includes a set of COM object types for obtaining information about ThinApp packages.
Developers can use programming languages such as C++ and script languages such as VBScript to interact
with the the ThinApp SDK objects.

This chapter includes the following sections:

„ “ThinApp.Management” on page 7

„ “ThinApp.Package” on page 8

„ “ThinApp.VFileSystem” on page 12

„ “ThinApp.VFile” on page 15

„ “ThinApp.VFolder” on page 17

„ “ThinApp.VRegistry” on page 18

„ “ThinApp.VRegKey” on page 18

„ “ThinApp.VRegValue” on page 19

„ “ThinApp.Option” on page 19

ThinApp.Management
To allow your application or script to use the ThinApp SDK, you must create a ThinApp.Management object.
This object provides generic services like determining whether a specific file is a ThinApp virtual package or
not.

Properties
This object has no properties.

Methods
Invoke a method on a ThinApp.Management object by calling the method with the specified parameters. For
example, the following command invokes the AppSyncUpdateAvailable method of an object named
myPackage.
myPackage.AppSyncUpdateAvailable([appsyncurl])

Optional arguments are shown inside of [].

VMware, Inc. 7
ThinApp SDK API Reference Guide

GetThinAppType
object.GetThinAppType(filespec)

Returns the ThinApp type of a file. The following file types are valid:

„ 0 — THINAPP_TYPE_UNKNOWN

„ 1 — THINAPP_TYPE_MAIN_DATA_CONTAINER

„ 2 — THINAPP_TYPE_SHORTCUT_EXE

„ 3 — THINAPP_TYPE_THICK_MSI

„ 4 — THINAPP_TYPE_THIN_MSI

„ 5 — THINAPP_TYPE_OLD_MSI

The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Management object.

filespec Required The name of the file to be tested.

OpenPackage
object.OpenPackage(filespec)

Returns a ThinApp.Package object for the file.

The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Management object.

filespec Required The name of the file to open.

ThinApp.Package
The ThinApp.Package object provides properties and methods that deal with the package as a whole. For
example, you can use the properties and methods to determine the ThinApp version that produced the
package or obtain a bill of materials that contains a list of all files and registry keys contained in the package.

Properties
Retrieve properties by accessing a property name of a ThinApp.Package object. For example, the following
command retrieves the InventoryName property of an object named myPackage.
myPackage.InventoryName

The following table lists the properties of the ThinApp.Package object.

Property Name Type Description

InventoryName string Returns the inventory name of this package.


MainDataContainer string Returns the name of the main data container for this package.

MSIVersion string Returns the MSI version number of the package. This property
is read-only and is available for MSI-type packages.

8 VMware, Inc.
ThinApp SDK Objects

Property Name Type Description

ThinAppType integer Returns the ThinApp type of a file. This property is read-only.
The following are valid ThinApp types:
„ 1 — THINAPP_TYPE_MAIN_DATA_CONTAINER
„ 2 — THINAPP_TYPE_SHORCUT_EXE
„ 3— THINAPP_TYPE_THICK_MSI
„ 4 — THINAPP_TYPE_THIN_MSI
„ 5 — THINAPP_TYPE_OLD_MSI

ThinAppVersion string Returns the ThinApp version used to create the package. This
property is read-only.

Methods
Invoke a method of a ThinApp.Package object by calling the method with the specified parameters. For
example, the following command invokes the AppSync method of an object named myPackage.
myPackage.AppSync(flags, [appsyncurl])

Optional arguments are shown inside of [].

AppSync
object.AppSync(flags, [appsyncurl])

Updates the package if an update is available. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.


flags Required Currently, a single flag is defined:
1 - THINAPP_APPSYNC_SHOW_PROGRESS

appsyncurl Optional The URL address to check for an update. If not present,
the Package.ini AppSyncURL setting is used.

AppSyncUpdateAvailable
object.AppSyncUpdateAvailable([appsyncurl])

Indicates whether an AppSync update is available. The following table lists the arguments for this method.

Argument Required/Optional Description


object Required The name of a ThinApp.Package object.

appsyncurl Optional The URL address to check for an update.f not present,
the Package.ini AppSyncURL setting is used.

GetOptions
object.GetOptions()

Returns a collection of ThinApp.Option objects. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

VMware, Inc. 9
ThinApp SDK API Reference Guide

GetOptionalAppLinks
object.GetOptionalAppLinks(searchpath)

Returns a collection of ThinApp.Package objects for all optional AppLinks. The following table lists the
arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

searchpath Required The path to search for AppLinks.

GetRequiredAppLinks
object.GetRequiredAppLinks(searchpath)

Returns a collection of ThinApp.Package objects for all required AppLinks. The following table lists the
arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.


searchpath Required The path to search for AppLinks.

GetShortcutList
object.GetShortcutList( )

Returns a semicolon-separated list of shortcuts for this package. The following table lists the arguments for
this method.

Argument Required/Optional Description


object Required The name of a ThinApp.Package object.

GetVFileSystemObject
object.GetVFileSystemObject(reserved)

Returns a ThinApp.VFileSystemObject object. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

reserved Required Reserved for future use. Must be 0.

GetVRegistryObject
object.GetVRegistryObject(reserved)

Returns a ThinApp.VRegistryObject object. The following table lists the arguments for this method.

Argument Required/Optional Description


object Required The name of a ThinApp.Package object.

reserved Required Reserved for future use. Must be 0.

10 VMware, Inc.
ThinApp SDK Objects

MacroToPath
object.MacroToPath(macrofilespec)

Expands a macro and returns the full path. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

macrofilespec Required The file path in macro form.

PathToMacro
object.PathToMacro(filespec)

Converts a path to its macro form. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.


filespec Required The filename in its standard form.

RetrieveIcon
object.RetrieveIcon(iconfilename, filename)

Retrieves the icon for the main data container, a shortcut executable, or the package as a whole and stores it in
a .ico file. The following table lists the arguments for this method.

Argument Required/Optional Description


object Required The name of a ThinApp.Package object.

iconfilename Required The output filename where the icon is stored in .ico
format.
filename Optional If specified, the name of the main data container or
shortcut executable. If not specified, obtain the icon for
the package as a whole.

Install
object.Install([installdir], flags)

Installs the package on a workstation and creates shortcuts, file type associations, and so on. The following
table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

iinstalldir Optional Directory where package files are to be installed. If not


present, use the directory specified by .msi.
flags Required 1 - THINAPP_REGISTER_PERUSER - Indicates whether
the shortcuts, file type associations, and the rest should
be installed for the current user or for all users.
Administrative access is required when installing for all
users.
2 - THINAPP_REGISTER_NOARP - Do not register the
package in the Add/Remove Programs control panel
applet.
4 - THINAPP_REGISTER_KEEPUNAUTORIZED - Do not
unregister apps for which the user is no longer
authorized.
8 - THINAPP_REGISTER_REREGISTER - Recreate all
shortcuts and registry keys.

VMware, Inc. 11
ThinApp SDK API Reference Guide

Register
object.Register(flags)

Installs the shortcuts, file type associations, and so on. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

flags Required 1 - THINAPP_REGISTER_PERUSER - Indicates whether


the shortcuts, file type associations, and the rest should
be installed for the current user or for all users.
Administrative access is required when installing for all
users.
2 - THINAPP_REGISTER_NOARP - Do not register the
package in the Add/Remove Programs control panel
applet.
4 - THINAPP_REGISTER_KEEPUNAUTORIZED - Do not
unregister applications for which the user is no longer
authorized.
8 - THINAPP_REGISTER_REREGISTER - Recreate all
shortcuts and registry keys.

UnRegister
object.Unregister( )

Unregister shortcuts, file type association, and so on. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

Uninstall
object.Uninstall( )

Uninstalls a package from a workstation. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.Package object.

ThinApp.VFileSystem
Use the ThinApp.VFileSystem object to obtain information about the Virtual File System contained in a
package. This object can be obtained from a ThinApp.Package object and is modeled after the scripting
FileSystem object. The ThinApp.VFolder object provides information about folders and the
ThinApp.VFile object provides information about individual files.

Properties
This object has no properties.

Methods
Invoke a method of a ThinApp.VFileSystem object by calling the method with the specified parameters. For
example, the following command invokes the DriveExists method of an object named myPackage.
myPackage.DriveExists(drivespec)

12 VMware, Inc.
ThinApp SDK Objects

BuildPath
object.BuildPath(oldpath, name)

Constructs a new path name by appending a name to a path. The following table lists the arguments for this
method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

oldpath Required The path name does not have to exist in the virtual file
system.
name Required The name to add to the path. The resulting path does not
have to exist in the virtual file system.

DriveExists
object.DriveExists(drivespec)

Returns True if the drive exists as a %drive_X% path in the virtual file system, False otherwise. The following
table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

drivespec Required The drive letter or full path. If a full path is used, the
drive letter is taken from the path.

FileExists
object.FileExists(macrofilespec)

Returns True if the file exists in the virtual file system, False if it does not exist. The following table lists the
arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

macrofilespec Required The full path name in a macro notation of the file to be
checked.

FolderExists
object.FolderExists(filespec)

Returns True if the folder exists in the virtual file system, False if it does not exist. The following table lists
the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

filespec Required The full path name in a macro notation of the folder to
be checked.

VMware, Inc. 13
ThinApp SDK API Reference Guide

GetBaseName
object.GetBaseName(filespec)

Returns the base part (the name without extension or path) of a filename. The following table lists the
arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

filespec Required The filename for which the base part is to be determined.

GetExtensionName
object.GetExtensionName(filespec)

Returns the extension part of a filename. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.


filespec Required The filename for which the extension part is to be
determined.

GetFile
object.GetFile(macrofilespec)

Returns a ThinApp.VFile object for the file specified. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

macrofilespec Required The full path in macro format to the file in the virtual file
system.

GetFileName
object.GetFileName(filespec)

Returns the filename part (consisting of base part and extension part) from a full path specification. The
following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

filespec Required The path for which the filename part is to be determined.

GetFileVersion
object.GetFileVersion(macrofilespec)

Returns the version of the file specified. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

macrofilespec Required The full path in macro format to the file in the virtual file
system.

14 VMware, Inc.
ThinApp SDK Objects

GetFolder
object.GetFolder(macrofilespec)

Returns a ThinApp.VFolder object for the folder specified. The following table lists the arguments for this
method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

macrofilespec Required The full path in macro format to the folder in the virtual
file system.

GetParentFolderName
object.GetParentFolderName(filespec)

Returns the name of the parent folder for the file/folder specified. The following table lists the arguments for
this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFileSystemObject object.

filespec Required The name of the file/folder for which the parent folder is
to be determined.

ThinApp.VFile
The ThinApp.VFile object is modeled after the scripting File object and provides information about
individual files contained in the ThinApp package.

Properties
Retrieve properties by accessing a property name of a ThinApp.vFile object. For example, the following
command retrieves the DateCreated property of an object named myPackage.
myPackage.DateCreated

The following table lists the properties of the ThinApp.VFile object.

Property Name Type Description

Attributes string Returns the attributes of the file. This property is read-only.

DateCreated date Returns the date the file was created. This property is
read-only.

DateLastAccessed date Returns the date the file was last accessed. This property is
read-only.

DateLastModified date Returns the date the file was last modified. This property is
read-only.

FileVersion string Returns the version of the file in the format x.x.x.x. This
property is read-only.

InternalName string Returns the internal name from the version information. This
property is read-only.

Language string Returns the language from the version information. This
property is read-only.

Manufacturer string Returns the manufacturer from the version information. This
property is read-only.

Name string Returns the name of the file. This property is read-only.

ParentFolder Returns a ThinApp.VFolder object representing the parent of


the file. This property is read-only.

VMware, Inc. 15
ThinApp SDK API Reference Guide

Property Name Type Description

Path Returns the full name in macro format of the file. This property
is read-only.

ProductName string Returns the product name from the version information. This
property is read-only.

ProductVersion string Returns the product version from the version information.
This property is read-only.

ShortName string Returns the ThinApp-style short name of the file. This
property is read-only.

ShortPath Returns the ThinApp-style short path of the file. This property
is read-only.

Size integer Returns the size of the file in bytes. This property is read-only.

TranslationKey Returns the translation key from the version information. This
property is read-only.
Type Returns a description of the file, based on its extension. For
example, “MS-DOS Batch File” might be returned for a .bat
file. This property is read-only.

Methods
Invoke a method of a ThinApp.VFile object by calling the method with the specified parameters. For
example, the followingcommand invokes the GetHash method of an object named myPackage.
myPackage.GetHash(hashtype)

GetHash
object.GetHash(hashtype)

Returns a hash of the file contents. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.File object.


hashtype Required 0 to obtain the MD5 hash, 1 to obtain the SHA-1 hash.

VerifyContents
object.VerifyContents(offset, expected, matchtype)

Verifies if the contents of the file at a certain offset matches some expected value. The following table lists the
arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.File object.

offset Required Start offset of the bytes you want to verify. If the value is
-1, the method verifies if the bytes appear anywhere in
the file.

expected Required An array of bytes (min. size 4 bytes) that must be


compared to the contents of the file.

matchtype Required Must be set to one of the following values:


„ THINAPP VERIFYCONTENTS EXACT (1) - if the
expected argument must be matched literally.
„ THINAPP VERIFYCONTENTS REGEXP - if the
expected argument is a regular expression.

16 VMware, Inc.
ThinApp SDK Objects

ThinApp.VFolder
The ThinApp.VFolder object is modeled after the scripting Folder object and provides information about
folders in a ThinApp package.

Properties
Retrieve properties by accessing a property name of a ThinApp.vFolder object. For example, the following
command retrieves the Attributes property of an object named myPackage.
myPackage.Attributes

The following table lists the properties of the ThinApp.VFolder object.

Property Name Type Description

Attributes string Returns the attributes of the folder. This property is read-only.

DateCreated date Returns the date the folder was created. This property is
read-only.

DateLastAccessed date Returns the date the folder was last accessed. This property is
read-only.

DateLastModified date Returns the date the folder was last modified. This property is
read-only.

Files string Returns a collection of ThinApp.VFile objects for all the files
stored in the folder.

IsRootFolder string Returns True if the folder is the root folder of the virtual file
system, False if it is not.
Name string Returns the name of the folder. This property is read-only.

ParentFolder Returns a ThinApp.VFolder object representing the parent of


the folder. This property is read-only.
Path Returns the full path name in macro format of the folder. This
property is read-only.

ShortName string Returns the ThinApp-style short name of the folder. This
property is read-only.

ShortPath Returns the ThinApp-style short path of the folder. This


property is read-only.
Size integer Returns the size of all files in the folder and subfolders, in
bytes. This property is read-only.

SubFolders Returns a collection of ThinApp.VFolder objects for all


subfolders of the folder.

Methods
Invoke a method of a ThinApp.VFolder object by calling the method with the specified parameters. For
example, the following command invokes the GetFilesByExtension method of an object named
myPackage.
myPackage.GetFilesByExtension(extension)

GetFilesByExtension
object.GetFilesByExtension(extension)

Returns a collection of ThinApp.VFile objects for all the files in a folder with a given extension. The following
table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinApp.VFolder object.

extension Required The extension of files to include in the collection.

VMware, Inc. 17
ThinApp SDK API Reference Guide

ThinApp.VRegistry
You can use the ThinApp.VRegistry object to obtain information about the Virtual Registry contained within
the package. The ThinApp.VRegistry object provides information about registry keys and the
ThinApp.VRegistryValue object provides information about individual registry values.

Properties
This object has no properties.

Methods
Invoke a method of a ThinApp.VRegistry object by calling the method with the specified parameters. For
example, the following command invokes the OpenKey method of an object named myPackage.
myPackage.OpenKey(base)

OpenKey
object.OpenKey(base, keypath)

Returns a ThinApp.VRegKey object for the specified key. The following table lists the arguments for this
method.

Argument Required/Optional Description

object Required The name of a ThinApp.VRegistryObject object.

base Required Base key. The following are valid base key values:
„ HKLM - HKEY_LOCAL_MACHINE
„ HKCU - HKEY_CURRENT_USER
„ HKCR - HKEY_CLASSES_ROOT

keypath Required The path to the key. Might have no value.

ThinApp.VRegKey
The ThinApp.VRegKey object contains information about the registry keys within a ThinApp package.

Properties
Retrieve properties by accessing a property name of a ThinApp.vRegKey object. For example, the following
command retrieves the GetValues property of an object named myPackage.
myPackage.GetValues

The following table lists the properties of the ThinApp.VRegKey object.

Property Name Type Description

GetSubKeys Returns subkeys of this key as a collection of


ThinApp.VRegKey object.

GetValues string Returns values of this key as a collection of


ThinApp.VRegValue objects.

Methods
This object has no methods.

18 VMware, Inc.
ThinApp SDK Objects

ThinApp.VRegValue
The ThinApp.VRegistryValue object provides information about individual registry values within a
ThinApp package.

Properties
Retrieve properties by accessing a property name of a ThinApp.vRegValue object. For example, the following
command retrieves the Name property of an object named myPackage.
myPackage.Name

The following table lists the properties of the ThinApp.VRegValue object.

Property Name Type Description

Name string The name of the value. This property is read-only.

Type Returns the type of the value. The following are valid types:
„ 1 - REG_SZ
„ 2 - REG_EXPAND_SZ
„ 3 - REG_BINARY
„ 4 - REG_DWORD
„ 7 - REG_MULTI_SZ

Data Returns the data associated with the value.

Methods
This object has no methods.

ThinApp.Option
The ThinApp.Option object provides information about Package.ini settings.

Properties
Retrieve properties by accessing a property name of a ThinApp.Option object. For example, the following
retrieves the Name property of an object named myPackage.
myPackage.Name

The following table lists the properties of the ThinApp.Option object.

Property Name Type Description

Name string Returns the name of the Package.ini option. This property is
read-only.

Value Returns the value of the Package.ini option. This property is


read-only.

Methods
This object has no methods.

VMware, Inc. 19
ThinApp SDK API Reference Guide

20 VMware, Inc.
2

ThinApp API SDK Functions and


Notifications 2
At runtime, ThinApp packages can make calls to third party DLL functions to provide notifications of events,
such as an application startup or shutdown. The ThinApp runtime can make calls to the DLL to override
certain Package.ini settings for example AppSyncURL. The third party DLL can be located on either the
physical system or in the virtual package and must be listed in the Package.ini NotificationDLLs setting.
If a DLL is listed in the NotificationDLLs setting, but can not be loaded, the package fails to run and an error
message is displayed.

A NotificationDLLSignature option might be present in the Package.ini. If this option is set to “*", the
DLL must be properly authenticode-signed. If the option is set to something else than "*", the DLL must be
signed by that entity, for example "VMware, Inc.". If the DLL is not signed correctly, an error message is shown
and the DLL is not loaded.

NOTE The DLL functions are called synchronously, so to preserve the user experience, they should return as
quickly as possible. For example, avoid making calls that require making a network connection.

This chapter includes the following topics:

„ “VMware ThinApp Notifications” on page 21 and

„ “VMware ThinApp SDK API Functions” on page 22

VMware ThinApp Notifications


Notifications are callback functions with specific names that are called only under certain conditions.

OnFirstSandboxOwner
Called only when an application first locks the sandbox. This notification is not called if a second copy of the
same application is launched using the same sandbox while the first copy is still running. If a first application
spawns sub-process and then quits, the sandbox remains locked by the second sub-process so this callback
does not start again until all sub processes have quit and the application is run again.
void_stdcall OnFirstSandboxOwner()

OnFirstParentStart
Called prior to starting a ThinApp executable file regardless of whether the sandbox is simultaneously owned
by another captured executable.
void_stdcall OnFirstParentStart()

VMware, Inc. 21
ThinApp SDK API Reference Guide

OnGetOption
Called when the ThinApp runtime must obtain the Package.ini setting of selected options.
void_stdcall OnGetOption(BSTR OptionName, BSTR *OptionValue)

The following table lists the arguments for this function.

Argument Required/Optional Description

OptionName Required Input The name of the option.

OptionValue Required Before calling the OnGetOption function, the ThinApp


runtime determines the value based on Package.ini
setting (or default). The function can override this value.

OnFirstParentExit
Called when the first parent process exits. If a parent process starts a child process and quits, this callback is
called even if the child process continues to run.
void_stdcall OnFirstParentExit()

OnLastProcessExit
Called when the last process owning the sandbox exits. If a parent process starts a child process and quits, this
callback is called when the last child process exits.
void_stdcall OnLastProcessExit()

VMware ThinApp SDK API Functions


API functions allow you to execute ThinApp-specific functions and interact with the ThinApp runtime.

AddForcedVirtualLoadPath
Instructs the ThinApp application to load all DLLs from the specified path as virtual DLLs, even if they are not
located in the package. Use this function if the application must load external DLLs that have dependencies
on DLLs located inside the package.

The following table lists the arguments for this function.

Argument Required/Optional Description


Path Required Input The filename or path for DLLs to load as virtual.

Example 2-1. Loading a DLL Located in the Same Directory as the Executable as a Virtual DLL.

TS_ORIGIN is the path from which the executable is running.


Origin = GetEnvironmentVariable("TS_ORIGIN")

To delete the filename from TS_ORIGIN, find the last back slash and remove everything after it.
LastSlash = InStrRev(Origin, "\")
SourcePath = Left(Origin, LastSlash)

Set ThinApp to load all DLLs in the same directory (or deeper) from where the source executable is located.
This setup allows you to drop additional files in the SourcePath tree and have them resolve imports against
virtual DLLs.
AddForcedVirtualLoadPath(SourcePath)

22 VMware, Inc.
ThinApp API SDK Functions and Notifications

ExitProcess
Quits the current process and sets the specified error code.

The following table lists the arguments for this function.

Argument Required/Optional Description

ExitCode Required Input The error code to set. This information might be
available to a parent process. Typically, a value of 0 is
used to indicate no error.

Example 2-2. Exiting a Process and Indicating Success


ExitProcess 0

NOTE As the process exits, the scripting system receives its Function OnEndProcess callback. Also, any
DLLs that are loaded run their termination code so that they can properly clean up.

ExpandPath
Converts a path from macro format to system format and returns the expanded macro path in system format.

The following table lists the arguments for this function.

Argument Required/Optional Description

InPutPath Required Input The path in macro format.

Example 2-3. Converting a Path From Macro to System Format


Path = ExpandPath("%ProgramFilesDir%\Myapp.exe")
Path = c:\Program Files\myapp.exe

NOTE All macro paths must escape the % and # characters by replacing these characters with #25 and #23.

ExecuteExternalProcess
Runs a command outside of the virtual environment and returns the process ID. The process ID can be used if
you need to make real system changes.

The following table lists the arguments for this function.

Argument Required/Optional Description

CommandLine Required Input The application and command line parameters to run
outside of the virtual environment.

Example 2-4. Starting an Internal Process.


ExecuteExternalProcess("cmd.exe /c copy c:\systemfile.txt
c:\newsystemfile.txt")

To run a command that requires quotes in the command-line, use the following syntax:
ExecuteExternalProcess("regsvr32 /s " and chr(34) and "c:\Program
Files\my.ocx" and chr(34))

VMware, Inc. 23
ThinApp SDK API Reference Guide

ExecuteVirtualProcess
Runs a command inside of the virtual environment and returns the process ID. The process ID can be used if
you need to make changes to the virtual environment.

The following table lists the arguments for this function.

Argument Required/Optional Description

CommandLine Required Input The application and command line parameters to run outside
of the virtual environment.

Example 2-5. Starting a Virtual Process.


ExecuteVirtualProcess("cmd.exe /c copy c:\systemfile.txt c:\virtualfile.txt")

To run a command that requires quotes in the command-line, use the following syntax:
ExecuteVirtualProcess("regsvr32 /s " and chr(34) and "c:\Program Files\my.ocx" and chr(34))

GetBuildOption
Returns the value of a setting specified in the BuildOptions option of the Package.ini file. If the requested
OptionName value does not exist, an empty string is returned.

The following table lists the arguments for this function.

Argument Required/Optional Description


OptionName Required Input Name of the setting.

Example 2-6. Retrieving the Value of a Setting in the Package.ini File.

Package.ini contains:
[BuildOptions]
DemoOption=DemoValue

The following line would appear in a VBS file:


Value = GetBuildOption("DemoOption")
Value = DemoValue

GetFileVersionValue
Returns a version information value from a specific DLL, executable, OCX, and so on. This function can be
used to determine the internal version number of a DLL or to retrieve information about the copyright owner
of a DLL, or product name associated with the DLL. If the requested Filename does not exist or the specified
Value arguments cannot be located in the file, the value of “” is returned.

24 VMware, Inc.
ThinApp API SDK Functions and Notifications

The following table lists the arguments for this function.

Argument Required/Optional Description

FileName Required Input The name of the filename whose version information is
being retrieved.

Value Required Input The name of the Value to retrieve from the version
information section of the specified file. The following
values can be retrieved from most DLLs:
„ Comments
„ InternalName
„ ProductName
„ CompanyName
„ VMware, Inc. 151
„ Appendix E Using Scripts
„ LegalCopyright
„ ProductVersion
„ FileDescription
„ LegalTrademarks
„ PrivateBuild
„ FileVersion
„ OriginalFilename
„ SpecialBuild

Example 2-7. Determining the Version Number of a DLL.


FileVersion = GetFileVersionValue("c:\windows\system32\kernel32.dll”, "FileVersion")
if FileVersion = "1.0.0.0" then
MsgBox "This is Version 1.0!"
End if

GetCommandLine
Allows you to access the command-line parameters that are passed to the program that is currently running.
Returns a string that represents the command line arguments passed to the current running program,
including the original executable.

Example 2-8. Retrieving the Command Line Arguments of a Program.


MsgBox "The command line for this EXE was " + GetCommandLine

GetCurrentProcessName
Allows you to access the full virtual path name of the current process. Returns a string that represents the full
executable path name inside of the virtual environment. Typically this is c:\Program Files\... even
though the package source might be running from a network share.

Example 2-9. Retrieving the Virtual Path Name of the Current Process.
MsgBox "Running EXE path is " + GetCurrentProcessName

VMware, Inc. 25
ThinApp SDK API Reference Guide

GetOSVersion
Returns information about the current version of Windows in the following format:
MAJOR.MINOR.BUILD_NUMBER.PLATFORM_ID OS_STRING

MAJOR is one the following values:

„ 6 - Windows Vista

„ 6 - Windows Server 2008

„ 5 - Windows Server 2003

„ 5 - Windows XP

„ 5 - Windows 2000

„ 4 - Windows NT 4.0

MINOR is one of the following values:

„ 0 - Windows Vista

„ 0 - Windows Server 2008

„ 2 - Windows Server 2003

„ 1 - Windows XP

„ 0 - Windows 2000

„ 0 - Windows NT 4.0

„ 51 - Windows NT 3.51

BUILD_NUMBER is the build number of the operating system.

PLATFORM_ID is one of the following values.

„ 1 - Windows Me, Windows 98, or Windows 95 (Windows 95 based OS)

„ 2 - Windows Server 2003, Windows XP, Windows 2000, or Windows NT (Windows NT based OS)

OS_STRING represents additional information about the OS such as “Service Pack 2”.

Example 2-10. Retrieving the Current Version of Windows.


if GetOSVersion() = "5.1.0.2 Service Pack 2"
then MsgBox "You are running on Windows XP Service Pack 2!"
endif

GetEnvironmentVariable
Returns the environment variable associated with the Name environment variable.

The following table lists the arguments for this function.

Argument Required/Optional Description


Name Required Input The name of the environment variable for which the
value is to be retrieved.

Example 2-11. Retrieving the Environment Variable Associated with the TS_ORIGIN Value.
MsgBbox "The package source EXE is " + GetEnvironmentVariable("TS_ORIGIN")

26 VMware, Inc.
ThinApp API SDK Functions and Notifications

RemoveSandboxOnExit
Toggles whether to delete the sandbox when the last child process exits.

The following table lists the arguments for this function.

Argument Required/Optional Description

YesNo Required Input Specifies whether to clean up when the last process
shuts down. The valid values are
„ 1 - Yes
„ 0 - No

Example 2-12. Turning On/Off Cleanup.

To turn on cleanup, type:


RemoveSandboxOnExit 1

To turn off cleanup, type:


RemoveSandboxOnExit 0

SetEnvironmentVariable
Sets the value of an environment variable.

The following table lists the arguments for this function.

Argument Required/Optional Description


Name Required Input The name of environment variable where the value is to
be stored.

Example 2-13. Setting an Environment Variable.


SetEnvironmentVariable "PATH", "C:\Windows\system32"

SetfileSystemIsolation
Sets the isolation mode of a directory.

The following table lists the arguments for this function.

Argument Required/Optional Description

Directory Required Input The full path of the directory whose isolation mode is to
be set.

IsolationMode Required Input The isolation mode to be set. The valid values are:
„ 1 - WriteCopy
„ 2 - Merged
„ 3 - Full

Example 2-14. Setting the Isolation Mode of the Temp Directory to Merged.
Setfile systemIsolation GetEnvironmentVariable("TEMP"), 2

VMware, Inc. 27
ThinApp SDK API Reference Guide

SetRegistryIsolation
Sets the isolation mode of a registry key.

The following table lists the arguments for this function.

Argument Required/Optional Description

RegistryKey Required Input The registry key whose isolation mode is to be set. Start
with:
„ “HKLM” for HKEY_LOCAL_MACHINE
„ “HKCU” for HKEY_CURRENT_USER
„ “HKCR” for HKEY_CLASSES_ROOT

IsolationMode Required Input The isolation mode to be set. The valid values are:
„ 1 - WriteCopy
„ 2 - Merged
„ 3 - Full

Example 2-15. Setting isolation of HKEY_CURRENT_USER\Software\Thinapp\Test to Full.


SetRegistryIsolation "HKCU\Software\Thinapp\Test," 3

WaitForProcess
Waits until the process specified by ProcessID has completed execution and returns an integer:

„ 0 - Timeout failed.

„ 1 - Process exited.

„ 2 - The process does not exist or security is denied.

The following table lists the arguments for this function.

Argument Required/Optional Description


ProcessID Required Input The ID of the process to wait for completion. The process
ID can come from ExecuteExternalProcess or
ExecuteVirtualProcess.

TimeOutInMilliSeconds Required Input The maximum amount of time to wait for the process to
end before continuing. If 0 is specified, INFINITE is
used.

Example 2-16. Waiting for the cmd.exe process.


id = ExecuteExternalProcess("cmd.exe")
WaitForProcess(id, 0)

28 VMware, Inc.
3

Legacy Thinstall Management API 3


Although the Thinstall® Management API is deprecated, it is documented here for completeness. This
management interface consists of a single COM object named ThinstallManagementAPI.

ThinstallManagementAPI Object
This object is not automation compatible and can not be called from script engines like VBScript.

Properties
This object has no properties.

Methods
Invoke a method of the ThinstallManagementAPI object by calling the method with the specified
parameters. For example, the following command invokes the CreateTextRegistryFile method of an
object named myPackage.
myPackage.CreateTextRegistryFile(ProjectLocation, Base, UnicodeTextFile)

CreateTextRegistryFile
Creates a text-format registry file. The following table lists the arguments for this method.

Argument Required/Optional Description


object Required The name of a ThinstallManagementAPI object.

ProjectLocation Required The location of the project. LPCWSTR

Base Required Specifies which text registry file to create. The valid
values are:
„ HKEY_LOCAL_MACHINE
„ HKEY_CURRENT_USER

UnicodeTextFile Required File handle that receives the file created. HAHDLE*.

WriteRegistrySubkeyFromMacrovisionsprintf
Writes a registry subkey to a text-format registry file. The following table lists the arguments for this method.

Argument Required/Optional Description


object Required The name of a ThinstallManagementAPI object.

UnicodeTextFile Required The file handle created by


CreateTextRegistryFile(). HAHDLE*.

VMware, Inc. 29
ThinApp SDK API Reference Guide

Argument Required/Optional Description

SubKey Required The registry subkey. LPCWSTR.

Isolation Required The isolation mode for the subkey.


IsolationModeType.

WriteRegistryValueFromMacrovisionsprintf
Writes a registry value to the most recently created (using
WriteRegistrySubkeyFromMacrovisionsprintf) registry subkey. The following table lists the arguments
for this method.

Argument Required/Optional Description

object Required The name of a ThinstallManagementAPI object.

UnicodeTextFile Required The file handle created by


CreateTextRegistryFile(). HAHDLE*.

ValueName Required The name of the registry value to write. LPCWSTR.

ValueType Required One of the REG _* registry type values. DWORD.

ValueData Required Data to write to the registry value. LPCWSTR.

CloseTextRegistryFile
Closes a text-format registry file. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinstallManagementAPI object.

UnicodeTextFile Required The handle to the file to close, returned by


CreateTextRegistryFile(). HAHDLE*.

GetPackageInfo
Gets information about a package.

Argument Required/Optional Description


object Required The name of a ThinstallManagementAPI object.

ExePackage Required The name of a main data container. LPCWSTR.

Info Required output A pointer to a structure that receives the info.


ThinstallPackageInfo*.

InfoSizeInBytes Required The size of the area that info points to on entry, the actual
size of Info on exit. DWORD*.

LocateSandboxPath
Locates the sandbox path for a package. Note that if the user changes the THINSTALL_SANDBOX_PATH
environment variable the sandbox moves. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinstallManagementAPI object.

ExePackage Required The required name of a ThinApp-generated executable.


LPCWSTR.

ReturnedPath Required output The sandbox path. LPCWSTR *

30 VMware, Inc.
Legacy Thinstall Management API

Argument Required/Optional Description

ReturnedPathSizeInChar Required The size of the area that info points to on entry, the actual
s size of Info on exit. DWORD *.

StatusFlags Required output Flags for where a sandbox was found. DWORD *.

„ MachineAppLocalSandboxFound = 1
„ AppLocalSandboxFound = 2

„ GlobalMachineLocalSandboxFound = 4

„ GlobalLocalSandboxFound = 8

„ MachineSandboxFound = 16

„ UserSandboxFound = 32

„ ActiveSandboxIsLocked = 64

GetProcessInfo
Returns information about a running virtual process. The following table lists the arguments for this method.

Argument Required/Optional Description

object Required The name of a ThinstallManagementAPI object.

ProcessID Required The ID of the process about which to return info.


DWORD.

Module0FileName Required, output The name of the main data container. LPWSTR.

Module0FilenameSizeInC Required The size in characters of the Module0Filename buffer.


hars DWORD.

PackageFilename Required, output The name of the main data container. LPWSTR.

PackageFilenameSizeInC Required The size in characters of the PackageFilename buffer.


hars DWORD

StartEXEFilename Required, output The name of the system-readable executable that was
used to start the process. LPWSTR.

StartEXEFilenameSizeIn Required The size in characters of the StartEXEFilename buffer.


Chars DWORD.

StartWorkingDirectory Required, output The (possibly virtual) initial working directory of the
process. LPWSTR.

StartWorkingDirectoryS Required The size in characters of the StartWorkingDirectory


izeInChars buffer. DWORD.

VMware, Inc. 31
ThinApp SDK API Reference Guide

32 VMware, Inc.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy