Skip to main content

Mi Vista es su Vista

Today I attended a code clinic about programming Windows Vista. I like attending the Microsoft learning events because they are free and the cross-section of talents are comfortable. There are some real old-timers that do Windows platform programming. They're fun people.

Anyway, one thing that I took from that talk was about how Vista handles registry access. In the past, if your application did not have permission to make registry changes, it would get an error. Now, Vista creates an isolated, virtual, registry for your application. This gives your application the impression of it working properly, and for the most part, it's correct. In my case, though, it's not.

I program middleware Windows Services that make use of .NET Remoting. To manage the services, I create a manager application that is available from the task tray. You've seen something like this with SQL Server Manager, if you do SQL Server programming.

So I figured out how to make my service run with elevated privileges, so now it runs with full-control as Local System. That was a great triumph. Alas, though, the service manager runs as the local user account. This has some unfortunate side effects.

From my service manager, I have a UI to make runtime configuration changes to the service it controls. The manager does this by writing to the registry. Because it is using LUA (local user access), it can't write to the real registry, so Vista lets it write to the "virtual" registry. So there I am thinking that I am fixing my configuration problem with the service, but darn if it just doesn't seem to work when I restart the service. That's because my service is reading its config from the real registry while my service manager reads it from the virtual registry.

The next time you develop a service manager that controls a service, remember to isolate all configuration changes in the service and not the service manager. The manager should just request changes in the process space of the service and not the manager.

I am yet to figure out how to make my service manager run as the administrator. I think it needs to be signed with my PFX file. Hopefully that solves the problem...

Popular posts from this blog

THE RISE OF FASCIST SOCIAL MEDIA

The Merriam-Webster dictionary defines fascism as: a tendency toward or actual exercise of strong autocratic or dictatorial control .  The phrase "dictatorial control" is important for the case that I am going to make about fascism in social media. The word "dictatorial" means "of or relating to a dictator," and a dictator is "one ruling in an absolute and often oppressive way." In 2020, social media has seen a rise in the number of autocratic events of censorship. The two social media outlets that I am going to focus on are Facebook and Twitter.  Background Facebook is a semi-private curated blogging platform where you, the user, share information at your leisure. The public part of Facebook is in Facebook Groups. With a group, outside people who are not privy to your "Facebook Wall" will join your group and establish a communal discourse. This can be private, by invitation only, or public. The Facebook is auth-walled so that you must

Clustered Foolishness

I had morning coffee with a well respected friend of mine recently. Aside from chatting about the usual wifery and family, we touched on the subject of clustered indices and SQL Server performance. A common misconception in the software industry is that a clustered index will make your database queries faster. In fact, most cases will demonstrate the polar opposite of this assumption. The reason for this misconception is a misunderstanding of how the clustered index works in any database server. A clustered index is a node clustering of records that share a common index value. When you decide on an index strategy for your data, you must consider the range of data to be indexed. Remember back to your data structures classes and what you were taught about hashtable optimizations. A hashtable, which is another way of saying a database index, is just a table of N values that organizes a set of M records in quickly accessible lists that are of order L, where L is significantly less than M.

Number of Primes

Anderson's Theorem (a) The number of primes in [1,n] is no more than 2+floor(n/2). The probability of n being prime when n is not prime is 1/2 - see Dasgupta,Papadimitriou,Vazirani "Algorithms" page 26. Therefore, the E(pi(n)) is n/2. (b) There does not exist another set of adjacent primes other than {1,2,3} 5: 2 + floor(5/2) = 2 + 2 = 4:=> {1,2,3,5} : 4 <= 4 7: 2 + floor(7/2) = 2 + 3 = 5 => {1,2,3,5,7} : 5 <= 5 11: 2 + floor(11/2) = 2 + 5 = 7 => {1,2,3,5,7,11} 6 <= 7 26: 2 + floor(26/2) = 15 => {1,2,3,5,7,11,13,17,19,23} : 10 <= 15 Lagrange's Theorem is Inaccurate Lagrange's theorem about primes states that pi(x) is the number of primes <= x. The pi(x) is approximately x/ln(x). He postulated that the lim of pi(x)/(x/lnx) as x-> infinity was 1. This is incorrect. if the number of primes is bounded by n/2 then refactoring and reducing Lagrange's Theorem results in the lim of ln(x) as x approaches infinity. This is alwa