The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts
Can you get rotating an array to run faster than O(n²)?
Some follow-up remarks to my old posting on rotating a two-dimensional array: Some people noticed that the article I linked to purporting to rotate the array actually transposes it. I was wondering how many people would pick up on that. I was surprised that people confused rotating an array (or matrix) with creating a rotation matrix. They are unrelated operations; the only thing they have in common are the letters r-o-t-a-t-i. A matrix is a representation of a linear transformation, and a rotation matrix is a linear transformation which rotates vectors. In other words, applying the rotation matrix to a vec...
Thanks for coming together to enjoy the holiday together, now get off my lawn
Due to a confluence of circumstances involving parents on an overseas vacation and other older relatives choosing not to attend (probably related to parents being out of town), I ended up being the oldest person at the extended family holiday dinner table. This was a first for me, and I resisted the urge to shout "Get off my lawn!" to the assembled masses or to bore younger relatives with rambling pointless stories from my youth. I guess this is the converse to a friend of mine who presided over a holiday family gathering at his house some years ago, and who realized that if seating at the dinner table were don...
Microspeak: Engagement
Meetings are so passé. You no longer have a meeting with a customer; you have an engagement: I have a customer engagement tomorrow and they have a question surrounding Feature X. Note that this use of the phrase customer engagement is different from the process known as customer engagement. The process is an ongoing interaction, a long-term activity to build customer loyalty. The author of the above sentence is not using it in the process sense (because you don't have "a" customer engagement; rather, a meeting is one component of the overall process of customer engagement). Nope, the author is jus...
How many sides are there to a snowflake? The answer may surprise your marketing department
Joe McManis runs the Snowflake Fail blog, which chronicles the various places non-hexagonal snowflakes are found in nature marketing. Bonus snowflake failage:
How about not granting debug privileges to users?
Commenter Yuhong Bao suggests, "How about not granting debug privileges on the user? This will make bypassing the protection impossible." This is such a great idea that Windows has worked that way for years. Normal non-administrative users do not have debug privilege. They can only debug processes that they already have to. In other words, non-administrative users can only pwn processes that they already pwn. No protection is being bypassed since you had full access in the first place. The SeDebugPrivilege allows you to debug any process, even those to which you do not have full access. This is clearly dang...
The goggles, they do nothing!: Gemulator advertisement from 1992
Darek Mihocka, proprietor of emulators.com, and whom I linked to a few years ago, released the source code to Atari ST emulator Gemulator 9.0, and in celebration, he also posted his 1992 promotional video to YouTube: Part 1, Part 2, Part 3. Warning: It's a really bad video. The music, the hair, the cheesy video effects, the bad acting, oh did I mention the hair? But it's also a trip in the wayback machine. Pre-emptive snarky comment: "You idiot, you got the quote wrong. It's 'My eyes! The goggles do nothing!'"
Your program assumes that COM output pointers are initialized on failure; you just don't realize it yet
We saw last time that the COM rules for output pointers are that they must be initialized on return from a function, even if the function fails. The COM marshaller relies on this behavior, but then again, so do you; you just don't realize it yet. If you use a smart pointer library (be it ATL or boost or whatever), you are still relying on output pointers being when not valid, regardless of whether or not the call succeeded. Let's look at this line of code from that article about : If the method puts a non- value in on failure, then when is destructed, it's going to call on itself, and something bad ha...
2009 year-end link clearance
Time for the semi-annual link clearance. And, as always, the obligatory plug for my column in TechNet Magazine:
Why does COM require output pointers to be initialized even on failure?
One of the rules of COM is that if a parameter is marked as an output pointer, then you have to initialize the thing it points to, even if your function failed and you have nothing to return. For example, we saw the problems that can occur if you forget to set the output pointer to in the method. Why does COM have this rule? Doesn't it know that a failure is a failure? Because there are failures and there are sort-of failures. A function can return an error code despite having partially succeeded. For example, if a function receives a buffer that is too small to hold all the data that is available, it might ...