Two geeks coding

It's Monday night. You come home from work. What do you do?
Sit in the lounge and code, of course!

Rob is
working on "fixing" (ha) WordBlogX
and actually writing a "real" setup program for it (he can't help
himself, you see. It's a sickness).

I'm playing around with CryptoAPI
on PocketPC
which is really messy because there's no managed library for it
(System.Security.Cryptography
was one of the things cut from Compact Framework) and the C++ header files
declare everything as DWORD when
some are really ints and some are uints... I had to get a mapping file
from someone else here at Microsoft that had the correct DllImport declarations.

Rob keeps making these horrible groaning sounds and then
asking me "Where did <insert random variable name> come from?"
and I have to explain about UI in Office docs, or what the codespit for VSTO
does (which is quite complicated and maybe I'll get around to talking about
that a bit one day...).

And I keep swearing at CryptoAPI or VS (which pegged the CPU
at 100% with a "Property Window" modal dialog, so I had to kill the
process). And now it's late again... hopefully I'll have write an entry soon
that will describe why I'm futzing around with crypto on the PocketPC. Stay
tuned.

C89.5 played two Pet Shop Boys (requires Flash) songs this
evening - wow, I'm impressed. One was a recent track from Disco 3 named Try
it (I'm in love with a married man)
(no, not personally; that's the name of
the track) and the other one was an (IMHO) less-than-optimal remix of an
otherwise really good early 80s track, Opportunities
(Let's make lots of money)
from their debut Please
(also on Discography:
The Complete Singles Collection
). The remix was the one from Disco,
which is a pretty cool album if you remember it came out in the mid-80s, but I
just don't like the remix
of Opportunities
.

BTW, did you know that PSB (which many people consider
"one hit wonders") have actually had 33 top-20 hits in the UK?

Anyway, I was just happy they played one tune... but two?!? And
browsing to the PSB site, I just found out a new compilation album is due out
in a few weeks. Where would I be without blog writing?!?

Anyway, one thing I have to do is answer my own little
question from a few days ago about why we don't install the OfficeDocumentMembershipCondition in
the GAC by default. It was only meant as a joke question (since there's really
no way anyone could have known the answer), but seems at least one person (you
know who you are <g>) actually tried to find the answer, and they'll go
batty if I don't spill the beans.

Soooo... the reason we don't install it into the GAC is
because we would not be able to reliably uninstall it. The reason we can't
reliably uninstall it is because if it is used in policy, then removing it
would break all managed code on the machine.

Yup. All managed code.

The reason for this is that the CLR needs to instantiate all
the objects used by policy (such as ZoneMembershipCondition
or UrlMembershipCondition
objects) in order to resolve the permissions for assemblies. If it can't create
any one of these objects, it has to fail to load any assemblies because (in
theory) the object that is failing to load could be denying permissions to an assembly. So it fails to load anything...
including the code that is supposed to manages policy itself! You can't even
display the policy hierarchy using caspol
-lg
if you have references to objects in policy that don't exist in the
GAC.
Luckily you can still reset policy with caspol
-all -rs
, but that's a bit drastic.

So we don't install because we can't uninstall. Maybe we
could have been tricky in our uninstall and checked if you used the condition
in any policies, but then we'd have to check across all users, and what if you
were using the object at runtime (ie, not in persistent policy, but at the AppDomain
level
)? Who knows.

I think that's it for now.

Sorry for all the PSB gushing; I
Get Excited
(grrr no sound sample).