Hangklip throws Win32Exception: File not found

At least one commenter wondered if this still is a developers blog or just a personal whereabouts chitchat. It is both. And although this blog is going to present some code at last I wondered for a moment what would happen if I obfuscated all the logical names in the code to famous tourists attraction like Cape Town, TafelbergCape Alguhas and the majestic Hangklip. Maybe three blogs of chitchat is enough for most readers, pity.

On a small project last week I encountered an issue when I needed to launch an windows application. In my mind the solution was pretty simple, instantiate the Process class, supply it with a ProcessStartInfo, call Start(); and you’re in business.

The first test run however ended in an Win32 Exception: File not Found. I’m still partly human so mistakes come natural. The command prompt was quickly started and the dir “c:Windowssystem32filename.exe” showed immediately….that the file did exist, it even had a size, and when I ran the file it actually showed what I expected.

Puzzled I reverted back to the code, verifying that  I was indeed providing the correct path and that ProcessStartInfo had the correct settings and arguments. Google pointed out that there are issues when you want to run a 64bits exe from a 32bits process. Could that be the case: I was on Vista x64, building a .Net 4.0 commandline app, targeting x86 from within Visual Studio 2010. The executable I wanted to launch was the Backup and Restore app, sdclt.exe. On disk it resided in the Environment.SystemDirectory (“c:windowssystem32”). The reason it refused to start/to be found lay in the Windows on Windows functionality. WOW is a concept that I first encountered in the form of win32s (yes, I’m that old). It automagically let you run apps compiled for an other number of bits on the same box. One of the features of WOW is to redirect file access in system32 to SysWow64, without the user ever knowing it. Great, and now disable that.

You could recompile to x64 and you’re done. If that is not possible you might find this little class help full. It tries to determine as good as it can if the executable you want to launch is a 64bits PE file. I use the GetBinaryType api for that. Once that is determined a call to Wow64DisableWow64FsRedirection (the microsoft employee responsible for coming up with decent short names for API’s was an holiday) disables redirection and therefor a call to Process.Start() will succeed.

For convenience (or over engineered) I extended the Process class and abstracted the disabling and enabling in a helper class that implements IDisposable. Leveraging this class becomes as easy as this:

ProcessStartInfo restoreBackupProcess = new ProcessStartInfo(
                Path.Combine(Environment.SystemDirectory, "sdclt.exe"), 
                @"/RESTOREPAGE");

ProcessEx pe = new ProcessEx();
pe.StartInfo = restoreBackupProcess;
pe.Start();
pe.WaitForExit();

The Start(); method will always succeed either if the windows executable is 64bits or 32bits.

The new Start() method looks like this:

    /// <summary>
    /// ProcessEx extends Process to Start 64bits system exe's from a 32 bits process
    /// </summary>
    public class ProcessEx:Process
    {
        /// <summary>
        /// Overriden Start method
        /// </summary>
        new public void Start()
        {
            // we can only start if we have a StartInfo
            if (this.StartInfo != null)
            {
                // Disable WOW64 redirection if needed
                using (new DisableWOW64(base.StartInfo.FileName))
                {
                    base.Start(); // real start
                }
            }
        }
       ....
     }

Have a look at the full source code for the DisableWOW64 implementation.

South Africa, the conclusion

Now that I’m back in the Netherlands for over a week it is time to make up the final verdict of the wine lands, Western Cape, South Africa. One thing is for sure: Cape Town and it’s surroundings offer great places to stay. You already know Bezweni Lodge from my previous post but if they are fully booked check here for other accommodations. When you stay at Bezweni Lodge I can recommend this appetizer: an 11 km walk on the Knorhoek estate.

knorhoek-map

And the accompanying GPS Track.

Although I didn’t really visit Cape Town (only did a drive through to some of the hikes) I did visit some lovely towns. For culture go to the university museum in Stellenbosch and for some great history on the barbarian Europeans go to the Huguenot Museum in Franschhoek.  In both cities you can have fantastic lunches which combine beautifully with the lovely wines.

And then near Gordons Bay, Strand has the best beaches, accompanied by some very fine seafood restaurants. Don’t forget to ride a horse in one of the high riding stables around Sir Lowry’s Pass. They will  bring you to a wine farm and it will become easy to taste every single wine and get very drunk before you get back on/besides the horse.

Here are the highlights in photo’s:

Paarl, Taalmonument and the top of Paarl mountain

i-was-here

Some impressions of my hikes: Helderberg Nature Reserve and the top of Leopardskloof in Harold Porter Botanical Garden.

Wildlife: Struisvogels and Penquins

Flowers: Paperflower and Sundew (Zonnedauw, breedbladig)

Just tourist: Cape of Good Hope (most south-western point) and Cape Agulhas (most southern point)

Top two: Sunset and the Panorama Trail in Jonkershoek Nature reserve (profile)

pan-trail-profile-sml

And then to remember that this was just the western cape. There is so much more to see, visit, experience. Message to self: plan holiday for the remainder of South Africa…

The BIG 5!

I’ve done the big 5. This is off course important if you are visiting South Africa. I had my big 5 planned with a couple of days between so I would have time to overcome the bewildering experience and recover enough to be up for the next in row.

You can’t safely claim you’ ve completed the big 5 without a guide or you will end up in indentifying 2 scuba divers as seals landing on the beach. Preventing this type of screw ups was Binny. A wonderfull women that stirred me clear of any mishaps. Above all she was keeper of the coffee break and lunch rucksack. Somehow she was able to keep pulling out food, snacks, selfbaked cake, fruit and liquids that you wondered once on display how it fitted in the rucksack in the first place. 

As you all know it is best to synchronize your watches with nature, which basically ment that I had to rise at six, drive at seven and arrive at an rendezvous point at eight. Nature doesn’t wait and don’t like anybody calling in late.

The first planned encounter was a famous and nerve-braking one: Maclear’s beacon on top of Table Mountain ( I guess you get a hint now where this is going to. Wait till you read about the elephant). Although I made some decent walking kilometres in the Netherlands the going-up muscles gets never trained. And you’ll start to feel them when you climb-up Skeleton Gorge. When you arrive at the top an stroll in the park gets you to the eastern table where you find Maclear’s beacon, the highest point of Table Mountain. (To be clear: That is NOT where the cable car ends). The down route followed the Platteklip gorge and the hike ended at the lower cable station.

Here is the prove (and the only “i was here” photo):

Table Mountain is not just an handy hook to attach the cables of the cable car to, it is an enourmous mountain, consisting of several rock formations. Second encounter with Table Mountain had to be with the Twelve Apostels on the west side of the mountain facing the atlantic. Going up this time via Kasteelpoort (One reason I love the country is the dutch words you can put in whenever you want and still everybody understands what you’re saying). After reaching the plateau we hiked to the waterworks museum. Finding a steam train at the top of a mountain is still akward.

As I said earlier you need some time to recover, specially from going up and down over and over again. To break-away from the daunting table mountain massiv the third hike is a river hike. The Palmiet river in the Kogelberg nature reserve. Starting at the Kleinmond side of the river a cozy path lines the river. Everybody can do this hike, even if you more like a beach lover.

On the beach you might detect all kind of wild-life that occupies the nature reserve. Binny pointed out Fish Otter, Small antilope and even a leopard left it footprints in the wet sand on the beach. When you push on you are rewarded with beatifull sights and a real sense of remoteness as even the cell-phones lose connection.

 Fourth in row was the so called Panorama Trail. Layed out in the Jonkershoek Nature Reserve just west of Stellenbosch. The Panorama Trail gets you in a circular route rather gently up hill and then fiercly down at the “kurketrekker”  (corkscrew). On this hike the over-warned snake danger popped up. First on the road a puf-adder was trying to get its body temperature too such level that it could start moving and later at the day early-warning system Binny warned (others on the hike made different comments) everybody for a snake. As this one had laying baking in the sun wholeday it definitely went in attack mode. Animals nor woman where hurt in the accident.

Ending my BIG 5 experience was at Cape of Good Hope. Although full of wild things (baboons, but aboveall homo sapiens) it is still posible to have a good hike there. On the way you can admire the new and old light house, men on wooden shoes, fynbos, and a wide variety of birds. The wind was very, very mild for december at the cape so the experience was awesome.

On the next photo you can clearly spot the blue touched sapiens, hugging the hill.

 And last but not least, as promised, the elephant:

 

Western Cape

As hell is freezing over in western europe I felt it would be appropiate to cheer you up with a small post from Sir Lowry’s Village. If you’re wondering where that might be, it is just around the corner at Cape Town, South Africa. I’m staying at Bezweni Lodge, an absolute stunning place. A few reasons: The dirt road (which only adds to the growing expectations), the wide views, the lovely landlady, the scenery, the fantastic room, the wonderfull breakfast, and last but not least: Dinner!

If you are planning to visit the western cape around cape town, Sir Lowry’s Pass Village is a perfect basecamp. You’ll reach the main attractions easily, whether you’re into hiking, tatsting, riding, diving, shopping or culture and history.

Just to give you an impression:

Sunset:

 

Fresh Seafood (not eaten by me)

 

 

Virtual PC 2007 and Lenny

Lenny is the latest Debian release. I did build a virtual machine on my Vista 64 bits pc starting with the net installer cd. It refused to boot but adding noapic nolapic and noreplace-paravirt to the boot command did the trick. Put the vhd on the usb drive, transported it through the harse winterweather to the office. Picked a PC from the storage. It had a fresh company approved domain joined Windows XP SP2 image on it. Offcourse it was a 32 bits machine.

Installed VPC 2007 SP1, copied the VHD, created a new virtual machine, attached the vhd, booted and….

Kernel Panic – not syncing: Attempted to kill the idle task!

…just after the bootimage started.

Retried… added vga=771…added vesa… wondered if 64 bits virtual hard drives are different….googled…found remarks about faulty memory (in a vpc?).  Changed to my laptop, same issue. Downloaded a fresh iso from Debian, same issue. This is driving a man crazy. It used to work….

I finally googled the address of the instrcution pointer: EIP: [<c01012d0>] and that brought me by the bugs in the P2 processor with regard to the i387 or floating point processor. In the kernel documentation looked up the kernel-parameters and searched for any no…. regarding the fpu.

The first was no387. That did bring the boot further in the process but the Debian kernel didn’t had the math emulation compiled in so that failed there

The next was nofxsr. Hurray, that worked! Debian Lenny is now working in my VPC on both Intel x64 cpu and good old Intel x32 cpu.

Lesson learned:

The cpu is not virtualized in VPC2007 (as opposed to the networkcard and video card)

Always Google for the EIP address in case of kernel panic.

Mike and Thomas

I just returned from the theatre in Gouda where I watched the performance of Mike en Thomas.

These two comedians use music and slapstick in a way that makes it look easy but leaves you flabbergasted after all. How about a very jazzy song about how much Mike hates Jazz. Or the observations in the office. The guy from IT is mentioned twice and is not flattering.

If you’re into comedy a must see. Mike and Thomas are a league on their own.

Travel Light Tip

If you are an expierenced flyer you probably recognize this picture.

You are bound for home. Due to some regulations you have to appear two hours early to go through a routine that only takes 5 minutes. Before you had a chance to enter your flight you’re bored to dead. Just after boarding you find out that your window seat is just beneath a family that takes at least two-and-half seat. Quick learners take an aisle seat. Be surprised how much people think they can squeeze in without having you to stand-up. I just want to go home, not being molested as an inflight entertainment.

After landing (why do people clap?) you’re spit out in an airport hoping for a smooth transfer. Everybody has all the time of the world, we are on holiday remember? Except for me, my connecting flight will leave in 20 minutes and I have to find the gate. Sweat runs down your body as you enter the plane just in time. Now you only have to survive a couple of more hours, survivng new neighbours and inflight meals. You start to feel that the chairs are not comfortable, cramp in several muscles. Landing at your final destination is a blessing.  

The survival run after touchdown is for the baggage reclaim hall. Waiting, peering, switching to different conveyer belts, keeping your eyes on luggage that has the same looks as yours. You jump forward across three lines of people, with an agonizing scream “MINE!” you rip your 20kg suitcase of the conveyer, swing it on a trolley, hitting at least one child and leave for the exit. The suitcase doesn’t fit well in a overcrowded commuter train and on the platforms you drag your suitcase to the last spree which will bring you home, at last.

Got the picture? Now here is the tip for the part after landing on your final destination. Walk calmly to the baggage reclaim area. Proceed immediately to the lost-baggage desk. Report that your suitcase is missing. The ground-crew will fill-in a form with your address, phonenumber etc. They will appologize to you that your luggage got lost but they assure you that they will do their utmost to hunt down your luggage. You leave the airport and head for home. A day later you’re called by a friendly lady  who informs you that your suitcase is found and wants to know when it suits you for delivery at your frontdoor. I bet the two men handing over my suitcase would even be so pollite to bring it upstairs. Great service, no hassle, relaxed homecoming.

Sao Miguel – Architecture

It is mandatory to pay attention to the specific architectural beautiness of your vacation destination. The Bradt guide did describe for every single town the churches/chapels and other historic buildings of interest.

You’ll notice that although Sao Miguel is the green island this doesn’t count for the color scheme used in their architecture significant buildings. I just photographed those churches in its different locations.

If their just down the road…

Or on the top of everything…

In the middle of town…

 Or enormous…

They all served their primary goal, being a church, not a tourist attraction. And that makes them very special.

 

Sao Miguel – The Craters

As you probably know the Azores are formed by volcanic activity. It gives the island its dramatic landscape with gentle slopes, steep cliffs, typical almost symetrical lakes, micro climate and stunning views. The best way to experience the crater landscape form my point of view is to hike in, over and aroind them. On Sao Miguel you can do right that in three different hikes, on three different days, the easy way, the long way and the hard way.

The easy way

The easiest way to endure the beauty of a crater is to walk round its inner base. Most craters on Sao Miquel have a lake (it is the greenest island and that is not because it never rains) and the furnas lake is just the right size. A nice pathway goes around the lake enabeling you to make good progress. As the walls of the creater are steep and high you get dramatic views where the clouds just tip over the ridge. I didn’t test the water for its temperature but the boiling mud indicates that not all heat is coming from the sun.

 The Long Way

The long way is not just a matter of going in the wrong direction or take the route public transport normally does. The long way is following the crater rim all around. On Sao Miguel this can be best done at the Site Cidades crater. Starting at Visto do Rei, with a stunning view inside the crater which is big enough to hold two lakes, some other craters and a small village, you simply follow the edge of the crater. On one side steep cliffs, on the other side the gently slope ending in the fast atlantic ocean.

The Hard Way

The hard way is just pure torture. You start at sea-level (ok, admitting I did start at 75 meter) and then climb up the crater out-side wall, reach it highest point at 581 meter and then descent to the lake inside the crater. The walk to Lagoa do Fogo is just that. I did choose a hot and sunny day so the levada came as a bonus. Dipping in the cap to cool the head was very welcome. Sitting at the lake side inside the crater it is great to see the clouds just tumbling over the top of the rim, start falling down but then evaporate in the process. Very relaxing and guaranteed with an empty mind you retrace your steps. It is worth it.