Log in

No account? Create an account
11 July 2005 @ 04:54 pm

I spent pretty much all of last week trying to figure out windows file security, which was annoying. I got the setting permissions part using DACLs going pretty easily, then i tried to figure out how to turn off the bloody inheritance of permissions from higher up in the directory tree. I spent about two days trying to figure that out. I found sample code on MSDN and other places that claimed to do what i wanted but it seemed to do nothing when i tried it.

So today i figured screw that, i can override the inheritance by setting the right permissions, though that's kind of messy. I'll just do that and then work on something else less frustrating for awhile. So i move the bits of code that i know work to a new function and clean it up a little and test it out. Before i do so i notice that the file i'm testing has exactly the right permissions set, including the inheritance. I figured i must have been testing stuff manually on friday and set it that way, so i put it back to the starting values and test the code. It works. Perfectly. The permissions are set and the inheritance is turned off. I reset the permisions and try it again, it works again. I do this several times marveling in the wonder of code that starts working the way it's supposed to for no apparent reason.

Then i clean up the code a little bit. As far as i can tell, and verified with ctrl-z, all i did was change how the file name was being loaded and removed a function that was returning an error code anyway. (I was trying to set the security two different ways originally just to see which worked best.) And now it doesn't work at all! Not only does it not set the inheritance correctly, it doesn't even add the new permissions anymore! I tried undoing the changes and it still doesn't work! Like i said ctrl-z doesn't show any other changes that i'm unaware of, so what the hell is different now?!

I'm so friggin frustrated! Clearly the code hates me. Or the computer. Something sure does though!


Wow, banging your head against the computer really makes time seem to fly by. I suspect some form of blunt trauma-induced amnesia is responsible.
Current Mood: aggravatedaggravated
Chaos Never Blinkssithjawa on July 12th, 2005 12:05 am (UTC)
Windows. Windows hates you. And everyone else. but you personally.

You missed the bit in the code where it says (probably translated into some C# or something)

if (user == "donaithnen) {
DonAithnendonaithnen on July 12th, 2005 12:20 am (UTC)

No! It doesn't do that! That would be so much easier to deal with!

Instead it does:


dolohov on July 12th, 2005 01:56 am (UTC)
One thing that occasionally happens to me: saving the code after making some change doesn't "take", and what actually gets compiled is a slightly older version.

Also, ctrl-z often doesn't work past the last manual save, so there may be some changes that you made but weren't able to roll back.