# Sunday, 21 June 2009

Some simple truths about elevation (as in UAC):

  • A process, once running, cannot elevate itself. You are launched elevated or not.
  • A non elevated process can launch an elevated one. The easiest way is to make a separate exe and embed a manifest, then launch it with ShellExecute.
  • An elevated process, once running, cannot "drop back down" to being elevated. As in the first bullet, you are launched elevated or not.

There are some incredibly complicated ways to launch an elevated process but I don't use them because they are incredibly complicated. But you might have noticed there's a symmetry problem there. Can an elevated process launch a non elevated one? My first answer would be "it doesn't matter, because you shouldn't." My paradigm is that your core app should be non elevated, if at all possible, and if it has one or two admin-ish features, those should be refactored into a separate manifested exe that is launched (from a UI component decorated with the shield), does its stuff and gets out.

However, a case can be made for having some sort of admin app that wants to leverage some other installed application, like Internet Explorer, that could possibly be using a malicious plugin or the like. This admin app would be smart to do its leveraging with a non elevated instance of that application. So how can you do it? Well, according to Aaron Margosis, it's a seven step process in native code. Managed code is left as an exercise for the reader.

If you care, now you know how to do it. And even if you don't care, the symmetry is restored.

Kate

 

Sunday, 21 June 2009 17:30:28 (Eastern Daylight Time, UTC-04:00)  #    
# Friday, 19 June 2009

If you already know what NDepend is, all you really need to know is that you can now point CppDepend at some big legacy C++ codebase and start to get your arms around all that code a bit better. If you have vaguely heard about NDepend but weren't really listening because you're a C++ programmer, it's time to change that. You can start by reading an analysis of MFC that uses CppDepend to answer questions like what fraction of member variables have names that start m_ (answer: about half) or what kind of coupling the key classes tend to live with.

Beatiful visualizations and genuine insight. Sure, you're not going to refactor MFC yourself, but imagine pointing all this at your own library!

Kate

Friday, 19 June 2009 14:47:30 (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, 17 June 2009

An interesting article about the "hockey handshake" tradition. One of the first things I needed to understand when I started watching baseball was the handshake thing. 

At the end of a big hockey game, the teams shake hands with each other, that is each player shakes hands with each and every one of the opponents, and generally not with their own teammates at all. I was used to that and I see that as a "ok we were hitting each other, but no hard feelings."

 (from happymooses)

But at the end of a big baseball game, the winning team shakes hands amongst themselves, that is each player shakes hands with roughly half of their team-mates (the ones on the field shake with the ones who were off the field) while the losing team disappears as fast as they can.

 (from smailtronic)

It's tempting to see this as a fundamental Canada/US dichotomy, but it's more a baseball/hockey thing and I suspect it's because hockey is a contact sport and baseball (at least on paper) is not. Forgiving the person who has bruised you and saying "good game" is probably a lot more important in contact sports. And indeed, it seems that football goes for the "shake the opponents hands" tradition.

I have to say I'm more the hockey handshake than the baseball handshake type, even though I'd rather watch baseball than hockey most of the time. I really like the idea of taking the time to reconnect with the opponent and affirm that you're really all part of a large thing (the league and the sport) and are colleagues in that effort. In the same way, everyone in this business is a colleague, even if we compete from time to time.

Kate

 

Wednesday, 17 June 2009 22:25:19 (Eastern Daylight Time, UTC-04:00)  #    
# Monday, 15 June 2009

Version 0.9 of the Windows API Code Pack for the Microsoft .NET Framework was released June 11th. This version works with the RC, adds a number of exciting new Windows 7 features, and also incorporates many of the Vista Bridge features as well. (I posted earlier about the different versions of Vista Bridge and Code Pack.) Not only that, but it features VB samples as well as C# ones! You can also see some videos of the functionality in action.

 

You just won't believe how easy Windows 7 development is from managed code using the Code Pack until you give it a try. Expect to see more releases as the year goes on, and keep talking to the team on Code Gallery.

Kate

Monday, 15 June 2009 21:28:09 (Eastern Daylight Time, UTC-04:00)  #    
# Saturday, 13 June 2009

Early this spring I delivered several sessions of training for Microsoft. It was for ISVs who wanted to get rolling on Windows 7 as quickly as possible. It's good material that covers a mix of managed and native development to take full advantage of new APIs, new features, and new power in Windows 7. It relies on the Windows API Code Pack and some custom-written wrappers for Windows 7 functionality that isn't in Code Pack at the moment. And now it's available to anyone who wants it.

If you couldn't come to one of the courses I taught, consider this the next-best thing.

Kate

Saturday, 13 June 2009 21:18:13 (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, 11 June 2009

Seems like a can't-lose offer, doesn't it? Free developer licenses of WPF controls (Calendar, Carousel, Chart, ColorPicker, DatePicker, Expander, Gauge, GridView, MaskedTextBox, NumericUpDown, PanelBar, ProgressBar, Scheduler, Slider, TabControl, TimePicker, TreeView) from Telerik. And don't be scared off by "developer license": they say "The Developer License is perpetual and has no deployment limitations – it allows the use of the controls for an unlimited number of applications spanning various servers and domains. The applications you develop with the Telerik WPF controls can be distributed royalty free." That sounds pretty no-strings and truly free to me.

What are you waiting for? Go get your controls!

Kate

Thursday, 11 June 2009 21:12:18 (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, 09 June 2009

I finally got around to listening to the last recorded webcast in this spring's Ignite Your Career webcast series from Microsoft Canada. Joey has a handy set of links to all the episodes on the Canadian Developers Blog. This series is very different from most Microsoft webcasts - it's not really about technology. It's about the things you need to learn to advance your career that are not straight technology like picking up a new language or a new development paradigm.

  • Industry Insights and Trends (featuring Joel Semeniuk)
  • Discovering Your Trusted Resources (featuring Richard Campbell)
  • How to Establish and Maintain a Healthy Work/Life Balance
  • How to Become a Great Leader (featuring Barry Gervin)
  • Building, Managing and Strengthening Your Team
  • Women in IT Panel Discussion

All the webcasts have been recorded and are well worth a download and a listen.

Kate

Tuesday, 09 June 2009 21:04:12 (Eastern Daylight Time, UTC-04:00)  #    
# Sunday, 07 June 2009

I grew up in Southern Ontario (Kitchener Waterloo area) before moving to Toronto and now to my current home between Toronto and Peterborough, which possibly isn't Southern Ontario any more. Imagine my surprise, reading an article in The Economist, to come across this:

Ms Munro comes from southern Ontario, an area of considerable psychic murkiness and oddity. Her stories dwell on her own people and their peculiarities: their repressed emotions, respectable fronts, hidden sexual excesses, outbreaks of violence, lurid crimes and long-held grudges.

Psychic murkiness, eh? If you say so.

Kate

 

Sunday, 07 June 2009 19:03:30 (Eastern Daylight Time, UTC-04:00)  #