Archive for February, 2009

When did I create you?

Posted: February 17, 2009 in Uncategorized

I thought I would add some file aging capabilities to a logger class as an lower bound guarantee. I thought it would be nice to use the creation time of a file to keep track, bad idea, this is why.

It had to be platform agnostic so I set about trying to implement it in Windows first. I wrote all the code and ran the unit test. To my amazement sometimes the unit test failed some times it worked. Actually most of the time it failed. I started debugging it and found to my surprise that the creation date of the file somehow carried forward when a fast delete/create of a file at the same location with the same name was done. I swiftly turned to the MSDN doc and read it more closely for CreateFile and what would you know, it is a documented feature. A small line among a few hundred, not very precise either.

“If you rename or delete a file and then restore it shortly afterward, the system searches the cache for file information to restore. Cached information includes its short/long name pair and creation time.”

How odd? Who came up with that idea. Well that someone even came up with a name is called File System Tunneling

Once again the reason is backward compatibility, to MS-DOS!

“The idea is to mimic the behavior MS-DOS programs expect when they use the safe save method. They copy the modified data to a temporary file, delete the original and rename the temporary to the original. This should seem to be the original file when complete. Windows performs tunneling on both FAT and NTFS file systems to ensure long/short file names are retained when 16-bit applications perform this safe save operation”

All you people complaining that Vista breaks things, you should instead rejoice and be happy that we are finally getting rid of more and more legacy idiocies such as this (although this is still in Vista and Windows 7).

Either way, I ended up setting the creation time upon creation of a file. Finally done I thought.

Well things get even worse in unix. Unix file systems generally don’t track creation times. You could fake it through the i-node time stamp (through fsdb) however if a new i-node is created for whatever reason the time stamp will be updated. Not very reliable. FreeBSD apparently tracks it as birth time, all in all, as so very often in the unix land, it is a mess and no real set standard.

I played around in a few different distros to try to figure out a solution, but found none. So.. if anyone happen to read this and know what to do feel free to share.

For now I will have to resort to the very tacky thing of reading the date from the first log row in the file and cache that… Not really a performance problem as this is part of a syslog service that is running all the time, so generally it will only be needed upon restart.

Since I mentioned tine Windows 7 engineering blog in my last post I want to continue on that topic just a little bit longer. For those really interested in what happens inside many of the Microsoft’s products have a look at Channel 9

Especially hot right now for developer is this

Also the entire PDC can be viewed here:

A Microsoft not many have seen

Posted: February 6, 2009 in Uncategorized

The other day spotify blessed this world and today I witnessed a “new” Microsoft. A Microsoft that finally gets into the fray and combats the blogosphere, handling feedback and giving facts.

It all started a few months ago when the Windows 7 engineering blog was started. I was very excited about that announcement and what it promised to deliver. An inside view (at least as close as you can get) on the engineering process and thoughts behind the design decisions in Windows 7. It has been a very good read so far and I wish a lot more people would read it. Especially many out there in the blogosphere in the hopes that it would get many debates back to talking about facts and being constructive instead of religious bickering.

In the last few days a heated discussion started to form about, a weakness if you will, in the UAC system in windows 7. People realized that it was possible to change the UAC level without being elevated. A lot of people pointed this out and Microsoft response was somewhat peculiar as it took a defensive position, a high horse approach, this is not a bug. That was what it felt like and everyone was thinking, they are missing the point (again). Today all of us were proven wrong

I know not one man changes the face of a company, but Steven Sinofsky is doing an excellent job in the communication department I hope this is what we can expect from Microsoft for all products in the future. We technical people need all the help we can get to communicate clearly, I know for sure I do =)

Let’s hope they don’t get hubris (like a few years ago) and instead stays true to this new open path.