Category Archives: Citrix Tools

XenApp Mobility Pack (XAMP)

Ramping up with XAMP

Over the last couple of years, Citrix Labs has been working on a project to make standard Windows applications more usable on mobile devices (phones and tablets).  This started with the development of Project GoldenGate and the production of an email client that runs on XenApp but acts like a native mobile device application when run remotely.  In the early demonstrations, it was clear that customers were interested for a few different reasons:

  • The email would be kept in the data center and therefore would be more secure.  If the device was lost or stolen, the information would not be there.
  • The email application could be maintained inside the organization instead of on different devices at remote locations.
  • Deploying standard Windows email programs via XenApp is not easy due to user expectations for usability.

You can learn more about the latest release of GoldenGate here.

Producing this kind of application is important but not the whole story.  There is also a need to make it easy for other software companies to produce software for XenApp and mobile devices.  The intent is to publish a SDK for developers to use to get all the same benefits along with a few new ideas along the way.

To get a first impression of this SDK, please example the doxygen-generated documenation for XenApp 6.5 Mobile Application SDK.  This documentation was released during Synergy Barcelona in late October 2011.

The online documentation focuses on the C/C++ interfaces for the SDK.  The internal name for the SDK was Citrix Mobility Pack SDK (CMPSDK).  That is why there are so many references to CMP in the documentation.

The announcement for the XA MA SDK includes a video that share the vision for producing these kind of mobile applications.

It is important to keep these kind of things in mind:

  • It is a fairly steep learning curve to pick up knowledge in mobile device platform development.  It is far easier to leverage existing Windows development experience.
  • The XA Mobility Pack enables several new features from the mobile device including GPS, display metrics, onscreen keyboard, SMS, camera, orientation, mobile device properties,  button redirection, user notification, picker control support.
  • The SDK works with C/C++/COM/C#
  • The SDK is used by GoldenGate

Blocks Versus Files

This topic presents an interesting problem.  A disk is made up of sectors which are arranged as clusters by the file system.  Both NTFS and FAT use a cluster model to clump together sectors into bigger chunks.  The cluster model has been around since the original DOS and still runs strong today.  The boot sector of the volume contains how many sectors of a certain size belong to one cluster.  On my Vista system the clusters are 4K (8 sectors of 512 bytes each).  This can vary for USB Flash Drives and smaller hard drives.  My flash drive reports a cluster size of 32K (64 sectors/cluster).  All of this is fine but then the question becomes why should I care?

The answer becomes more relevant when virtualization comes into the picture.  For a VM, the disk is virtual and is actually a file within another file system (most of the time).  Microsoft and Citrix use the VHD format for the VM files.  The VHD specification is public knowledge since Microsoft has documented as of a couple of years ago.  Given that there is a VHD file, everything needed by the operating system is there.  However, it becomes very difficult to manage this information from the outside.  Yes, there are ways to mount VHD drives within a native operating system, but this process is not necessarily easy to automate.  Well, at least not for everyone.

Then a new factor enters the equation.  Since the outside tools cannot see inside the VHD to understand what Windows is actually using, it becomes very difficult to do any kind of analysis or consolidation.  Microsoft does have a solution for compressing a VHD with Virtual PC 2007.  Unfortunately, there are many steps and it involves executing code both inside and outside the VM.  Wouldn’t it be nice if this could be managed completely from the outside?  Wouldn’t it be nice if every cluster (block) was paired with a file?

This sounds difficult and overall the problem is very tough.  The benefits however would be huge.  Basically any file operation performed on the inside could potentially be performed on the outside.  This would include things like defragmentation and shrinking the VHD to get rid of the blank chunks.  It could also include peering into the VHD to see what is there and even the hope of doing updates.

Other possible ventures would include merging virtual disks and even creating virtual disks out of multiple virtual disks.  It is possible to focus on the files instead of the blocks, it would much more possible to have base and delta disks which would both be allowed to change but yet form a cohesive volume to the user.  It is good to dream.

The sources of information look promising.  Microsoft has published APIs related to defragmenting disks which can locate a file on disk.  The API also allow for cluster relocation.  Beyond this, there are projects for Linux to understand NTFS.  Those teams have done much to discover the structure of NTFS and have included this knowledge in their programs and their documentation.  With these kind of guidelines, with patience, NTFS starts to open up and new things become possible.

There is a bit of vagueness about going on here.  It is still too early to talk about in detail.  However, it does seem that specific tasks are within reach which did not look so possible before.  Combining the knowledge of VHD with NTFS to form new tools looks incredibly attractive.

QVT – Query Intel VT Feature Program

Things are rolling along today.  After determining that the Intel program was a bit heavy for just figuring out whether or not Intel VT is there, it was discovered that the CPUID instruction could be used.  Intel has documentation about CPUID that makes it fairly easy to use.

Hidden inside the documentation is a flag that shows that the processor can handle Intel VT.

In this document are several other features.  It is a good map between the internal technical names and the eventual product feature names.  The summary is that if you can examine this flag, the program will know which way the VT support goes.

So, here is a program that does just that:

QVT source

The program was tested against older and newer machines and it appears to work fine.  The only catch is that it will not work against AMD or other processors.  This program could be used as a framework to build other programs to determine Intel feature set.  For example, it could be determined if the system supports TXT or 64-bit support.  There is a commented out wprintf that could be used to show the flags and with this information it would be possible to map against the CPUID documentation.

Eventually it will be possible to store the executables somewhere to allow for download.  So far that kind of solution has not been obvious yet.

If you are interested in learning more, please read the CPUID page at Wikipedia.

Determining Volume Cluster Size

On Monday there was a need to determine the cluster size of a NTFS volume.  Searching the web led to the discovery of a few different techniques but nothing that could be absorbed easily into a program.  One technique called for creating a very small file and then looking at the file properties for the space used on disk.  The second technique used the FSUTIL tool (built into Windows).  There was even a third technique which allowed for capturing the output of FSUTIL into Visual Basic to use the cluster size.

Why worry about cluster size in the first place?  Well, normally, you wouldn’t.  It is something that is for those of you that like to fine tune your performance and storage space.  The quick analysis is that having bigger clusters is more efficient for larger files (less fragmentation and faster load with less overhead) but small files can waste heaps of space.  Basically files that do not use the full cluster are going to take up space that other files could have used.  It’s a delicate balance of wants.  Most likely it would be difficult to prove what the optimal cluster size is.  But, before we go to far, it is currently difficult to determine cluster size from a program.

After learning of this problem, the search began for a magic FSCTL Ioctl to the file system to figure this out.  It did not look very promising until my co-worker Anil pointed out that maybe the Win32 GetDiskFreeSpace function might do the trick.

To my surprise, GetDiskFreeSpace did exactly what was needed.  It does not return explicitly the cluster size but it does return (sectors per cluster) and (bytes per sector).  A simple multiplication and the answer is there.  The funny thing is that this function is considered deprecated since it cannot support greater than 2GB volumes.  However, in this case it was extremely useful and not affected by the limit.

The next step was to build a simple command line tool that would exploit GetDiskFreeSpace.  The new tools is called ClusterSize (how creative is that?) and can be run against any volume in the system.  The default (no parameters) is to figure out the C: drive cluster size.  You can specify any other drive on the command line.

For example:

clustersize

clustersize d:\ 

Because it is not possible to post executables from WordPress, here is the source instead.  It is fairly easy and should build under Visual Studio without too much trouble.

ClusterSize source 

Here’s an example of the output from trying it against a USB Flash Drive on my system:

Determining cluster size for volume f:
Volume(f:) ClusterSize(32768) SectorsPerCluster(64) BytesPerSector(512)

At first it did not include the ability to report on the sectors and sector size.  It seemed kind of dull not to report them after the initial runs.

This certainly is not the most exciting topic but it is fun to share new minor discoveries.  This is the first time that Citrixblogger has source using PDF straight from VisualStudio using PDFCreator.  It is much more accurate than trying to post straight into the blog directly.  It even keeps all the pretty colours as well.

Ctrl-Alt-Del Tools

Ctrl-Alt-Del

Within the Terminal Server and Citrix communities, there are actually people that write tools for these multi-user environments. There are certain tools which make life much easier for the average integrator and administrator. In general, people are just looking for more tools to do things they want.

The title refers one group that has made its tools available for free. Ctrl-Alt-Del IT Consultancy has a web site that offers several interesting TS/Citrix tools in a style similar to the old Sysinternals site. If you select the CAD Util Pack, you get:

The CAD Util Pack is a collection of freeware utilities
designed by Ctrl-Alt-Del IT Consultancy, Australia.

The collection includes:
 - Bombprof
 - Envtscip
 - Getpubapp
 - Gettscip
 - ICSweep
 - Qryclientip
 - Qrydeptapp
 - Qrypubapp
 - Qrytscip
 - TSLoadStats
 - TSLogoff
 - TSPasschg
 - TSReboot
 - TSWhereis
 - TSBackdrop
 - TSMsg
 - DEFSET
 - DEFSET_FLEX
 - REMProf

All included utilities ares FREEWARE and were written by
Warren Simondson of Ctrl-Alt-Del IT Consultancy, Australia.
www.ctrl-alt-del.com.au

I’ll just pick one of them so you get the idea:

GETPUBAPPInfoDownload
- a command-line tool for Citrix Servers to query what specific Published Application is running in the current session.

This utility was written for Citrix Servers to query the name of the current session’s Published Application (if any) and display it in the command line.

Please go to the tools page to get a full description of each tool. Certain tools could be used everyday in automated logon scripts whereas others would be used to clean up or diagnose problems.

It’s quite a list of programs to make available for free. I would recommend looking around and seeing what might help you. It might be easiest to just download the Util Pack to try them out.

I had heard of Ctrl-Alt-Del before from the other web sites for TS/Citrix and was impressed with the concept. Recently Warren Simondson contacted me in relation to this blog. We started exchanging emails and it did not take long to conclude how small world can be. It turns out that Warren works in Brisbane. He told me that he was hired at SiliconData to replace me leaving in 1999 (when I went to Citrix in Sydney). I had written some simple tools for Rick Mack and myself to help get certain tasks done. When I left, Rick insisted that Warren continue this. Warren wrote lots of tools and the end result is this large amount of free programs. This is my interpretation of the story that Warren told me. I do not know when Warren decided to make these tools available on the Internet. He certainly has done a great job.

If you happen to be in the Brisbane area and are interested in running a Citrix environment, I’m sure that Ctrl-Alt-Del would be a great candidate to talk with.