Thursday, January 31, 2008

You don't know... Jack.

I remember this game from back in the first days of the PC (IBM and compatibles)... I didn't know Jack back then either...

Do you know Jack?

TSA Blog - no lines to enter comment?

Well- not everyone might catch my double-meaning in the subject title, but I tried to be spiffy enough to suggest that the Transportation Security Administration (better known as TSA) - responsible for more than a gazillion hours in flight delays in the USA - has now started a blog where people can post comments, "since there is no time for agency personnel to answer passenger questions during the airport screening process".

The real question becomes: Do I have to wait long hours in line to enter my questions? :-)

Are you LinkedIn?

I don't know how late I am to the ball, but LinkedIn is the newest "cool thing" among my professional peers.

Check it out - and don't forget to add me as your "connection" once you are satisfied!

Monday, January 21, 2008

How to set folder permissions in C++ for Vista

Burhan, one of our customers requested this and here it is:

const char* g_
strFSXPath = "g:\fsx";

void SetPathPermissions(const char* path)
// Set permissions for the folder
PACL pDacl,pNewDACL;
PSECURITY_DESCRIPTOR ppSecurityDescriptor;
PSID psid;

// Get the current Security Info for the path
char szFileName[MAX_PATH];
sprintf(szFileName, "%s%s", g_strFSXPath, path);
GetNamedSecurityInfo(szFileName, SE_FILE_OBJECT,DACL_SECURITY_INFORMATION, NULL, NULL, &pDacl, NULL, &ppSecurityDescriptor);


ConvertStringSidToSid("S-1-5-32-545", &psid);

ExplicitAccess.grfAccessMode = SET_ACCESS;
ExplicitAccess.grfAccessPermissions = GENERIC_WRITE;
ExplicitAccess.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE;
ExplicitAccess.Trustee.pMultipleTrustee = NULL;
ExplicitAccess.Trustee.ptstrName = (LPTSTR) psid;
ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_SID;
ExplicitAccess.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;

SetEntriesInAcl(1, &ExplicitAccess, pDacl, &pNewDACL);


fileOut << endl;
fileOut << "User reset folder and Subfolders permissions." << endl;