Category Archives: software development

AppForge: a product activation nightmare

Nobody likes product activation, but it is used increasingly by software vendors in search of more effective anti-piracy measures. Microsoft is the most prominent example, but many smaller vendors do the same. Codegear, for instance, use activation for Delphi. Even if you have a valid registration key, you cannot use the product until it has checked in with Codegear’s license server.

Last month Appforge went bust. The company made a development tool called CrossFire, which lets you code in Visual Basic or C# but cross-compile for numerous platforms including Palm, Nokia’s Series 60 and Series 80, Blackberry and Windows Mobile. A useful tool, but AppForge has an activation system that applies both to the development tool and in many cases to the client runtimes.

The AppForge license server is now offline. Result: developers with CrossFire applications and fully paid-up licenses can no longer deploy their products.

AppForge has been acquired by Oracle, but apparently Oracle has no interest in continuing the CrossFire product. Here’s what Oracle says:

Please note that Oracle’s acquisition of AppForge’s intellectual property did not include the purchase of the company as a whole, or the purchase of other AppForge assets including its customer contracts. Accordingly, Oracle does not plan to sell or provide support for former AppForge products going forward.

Former customers are fighting back. There is talk of a competition to crack AppForge activation: money for the prize is being put on the table.

What about Oracle? Is it really so difficult to resurrect the AppForge license server? Ending all support and development for a product is bad enough; robbing existing users of the right to use it seems extreme.

There may yet be a happy ending. But for now, this really is the nightmare scenario that opponents of the product activation concept feared. No, I don’t think something similar could happen to Windows and Office; but clearly there are real risks when using products from smaller vendors.

A solution is to use some form of escrow where unlocked versions of the software are guaranteed to be made available in the event that the original company can no longer offer activation services. The AppForge saga suggests that customers should insist on this or some alternative protection before committing to activation-protected software.

 

How not to get support

I’ve had four successive emails of increasing urgency from someone using my simple sqlite wrapper.

It’s sometimes difficult to handle such requests – the code is free and there is a limit to how much time you can give away – but in this case I’m unable to reply. The sender is using an email address that is not valid on the internet; the domain ends .local and it is not obvious what the real email address is.

If that’s you – please reconfigure your email client and try again.

 

Technorati tags: ,

C# code to detect UAC elevation on Vista

A couple of days ago I posted about programmatically detecting whether UAC is enabled. I was proposing to read a registry entry. Thanks to the power of blogs, my post drew a comment from Andrei Belogortseff, who has posted C++ code that does this properly. His library has functions for detecting whether the current process is elevated, detecting whether UAC is enabled, and running new processes both elevated and non-elevated (the last of these is the hardest to do).

I liked the libary but wanted to use it from .NET. I compiled his code to a DLL and did a C# wrapper; then I considered the hassles of adding a dependency on the Visual C++ runtime libraries. I therefore did a quick C# implementation of the functions I cared about; I haven’t included the code for running new processes. Please go ahead and download the code, and let me know if you have any suggestions, or even if there is a much easier way to do this that I have missed. There is an app called UACElevationCheck, which calls functions in VistaTools.cs.

The code is only intended to be called from Vista and will throw an exception otherwise; of course you can modify it as you like.

I’ve included a function IsReallyVista that looks for a Vista-only API call, rather than relying on the reported version information. This is because the version information is unreliable if the app runs in a compatibility mode. On the other hand, IsReallyVista is a hack; if you don’t like it, use IsVista which uses the version information instead.

You may be able to do this using the System.Security namespace rather than PInvoke. I had a quick look but the PInvoke code seemed easier to me, especially since Belogortseff has already done the real work.

 

Technorati tags: , , , , , ,

More Windows Installer confusion: managed code custom actions a no-no

People who should know say not to use managed code custom actions in your Windows Installer setups. Like Rob Mensching of Wix fame who says:

…today the Windows Installer does not support managed code CustomActions and the general direction appears to be to try to reduce the need for CustomActions overall.

Read the blog entry for the reasons. The strange thing is, Visual Studio 2005 has specific support for managed code custom actions; there is an Installer class and an MSDN walkthrough on how to use it

Now, I have always avoided managed code custom actions anyway, but only from instinct. Windows Installer setups are problematic enough as it is; adding .NET Framework dependency seems unnecessary. Mensching’s post above explains why it is also error-prone. See also Aaron Stebner’s post from March 2005.

… in summary, I strongly encourage you to not use managed code in your product setup.  I realize that some teams do this here at Microsoft, but please don’t use our bad (in my opinion) examples to justify doing so in your own setup….

Presuming these guys are right, might it not be wise for the Visual Studio folk to remove support for managed code custom actions from the product? A point of confusion is that the managed installer class works with a utility called InstallUtil which is distinct from the Windows Installer; in fact, I believe that Visual Studio setup projects which include managed code custom actions actually call InstallUtil.

I suggest Delphi as a handy alternative, if you would rather avoid Visual C++.

Finally, I hear many good things about Wix, the free XML-based authoring too for Windows Installer setups. If you are embarking on a new setup project it is worth a look.

 

Technorati tags: , , ,

Programmatically detecting whether UAC is enabled

An application may sometimes need to know whether or not the current user has administrative rights. This is complicated in Windows Vista by User Account Control (UAC) – the user may be in the Adminstrators group on the local machine, but nevertheless running with limited rights. When I came across this blog entry on COM elevation by Christoph Wille(thanks to Daniel Moth) I was interested to see the function he mentions called IsUACEnabledOS. I downloaded his code, but was disappointed to see this:

// a really simple check that does not account for possible UAC-disabledness via group policy
public static bool IsUACEnabledOS()
{
int majorVersion = Environment.OSVersion.Version.Major;
int minorVersion = Environment.OSVersion.Version.Minor;

return (majorVersion >= 6);
}

This just detects Vista or higher; in fact, it won’t always return the correct result, since Vista will lie about the version number if an application is running under compatibility settings. How then do we discover if UAC is enabled? The best I’ve come across so far is to query this registry entry:

HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA

If the entry does not exist or is 0, UAC is not enabled. Of course there is no guarantee that this always work, but it’s unlikely to change. I also haven’t checked that it is there in the base versions of Vista; again, it is probably the same.

Update: See the comments to this post for a better solution from Andrei Belogortseff, using the GetTokenInformation API call.  

I’ve now posted a C# implementation of Andrei’s code.

Technorati tags: ,

A bug in Vista’s UAC

Vista’s User Account Control (UAC) elevation prompt sometimes appears when it shouldn’t. Here is an example which works every time for me. I have a folder in Documents (within my home directory) called recordings, containing MP3 files. I double-click one of these files and it opens in Windows Media Player. Now let’s say I try to rename the recordings folder. I get a dialog saying I need to confirm this operation, complete with a UAC shield.

I click Continue and get the screen flash and the elvation prompt. It’s not enough though; I now get a dialog that says “Destination Folder Access Denied – You need permission to perform this action.” If I click Try Again, I get the same dialog, for ever.

It’s nonsense of course. I don’t need permission; I need to close the MP3 file. Indeed, if I close the file I can then rename the folder.

Oddly, if I try this with a Word document, Vista correctly reports that the folder in in use by Word. But if I try a second time, I get the inappropriate UAC prompt.

It’s possible that some Windows API call is returning an access denied error, when it should indicate a file or folder in use by another process, or there could be some other explanation. The end result is a poor user experience.

If Microsoft can’t always get this right, it illustrates how hard it is for developers to give users appropriate error messages when working with UAC on Vista.

 

Technorati tags: , ,

Mono’s new GUI library: how is this hype justified?

Mono’s Miguel de Icaza reports on a new GUI library for Mono:

We have been working on a technology that we believe will revolutionize user interfaces. Today we are announcing the response to Microsoft’s WPF/XAML, a response to Flash and WPF/E. A cross-platform GUI toolkit (supports Windows, MacOS and Linux and is easily ported to new platforms) written entirely in managed code and 100% open source.

There is some skeletal documentation for gui.cs.

Maybe this will be fantastic, but for the moment this looks like an early prototype, not a revolution in user interfaces. How is this hype justified?

Personally I reckon Mono will have to implement WPF eventually, if it wants to keep in touch with what is happening with Microsoft .NET.

 

Technorati tags: , ,

WPF/E is now Silverlight

Microsoft’s Flash alternative has a new name: Silverlight. Undoubtedly a radical shift in naming conventions. Back in 2005, Microsoft renamed Avalon to Windows Presentation Foundation, and I noted that:

These new names seem to be deliberately chosen to be forgettable.

Now we have memorable back. Interesting.

The name may be there, but the product is still in preview; the latest release remains the February CTP, with full release promised before July 2007. The emphasis is on video and vector graphics; there’ s no common language runtime implementation yet. You can write Silverlight code in JavaScript. It’s cross-platform, but currently only supports Windows and Mac; no device support yet. See the faq here for more information; and a useful summary from Tim Sneath who says there is big Silverlight news to come at Mix07.

 

Technorati tags: , , ,

Microsoft’s Jean Paoli on Office Open XML

I spoke to Jean Paoli about Office Open XML and its standardisation. I respect Paoli, one of the originators of the XML specification. His major point, apart from complaining about what he calls IBM’s orchestrated campaign against the ISO standardisation of OOXML, is that only Microsoft’s XML format can maintain fidelity with legacy Office documents. Unfortunately the example he gives – borders around a table – is not often a critical feature; but in general I take the point. He seemed not to understand my question about whether there will be a non-MS Office reference implementation.

Leaving aside OOXML vs ODF for a moment, Paoli observes that “The responsibility of migrating 450 million users is huge.” He is talking about the decision to make XML the default format in Office 2007. Undoubtedly a brave move, and painful for users in some cases, but for developers the ability to work with XML (whether it is OOXML or ODF) is a joy compared to the old binary formats, or Word’s Rich Text Format.

Technorati tags: , , , ,

Infinitely scalable web services

Amazon’s Jeff Barr links to several posts about buiding scalable web services on S3 (web storage) and EC2 (on-demand server instances).

I have not had time to look into the detail of these new initiatives, but the concept is compelling. This is where Amazon’s programmatic approach pays off in a big way. Let me summarise:

1. You have some web application or service. Anything you like. Football results; online store; share dealing; news service; video streaming; you name it.

2. Demand of course fluctuates. When your server gets busy, the application automatically fires up new server instances and performance does not suffer. When demand tails off, the application automatically shuts down server instances, saving you money and making those resources available to other EC2 users.

3. Storage is not an issue; S3 has unlimited expandibility.

This approach makes huge sense. Smart programming replaces brute force hardware investment. I like it a lot.

 

Technorati tags: , ,