AuthorizationRef myAuthorizationRef;
OSStatus myStatus;
myStatus = AuthorizationCreate (NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults,
&myAuthorizationRef);
//set up rights and request authorization
AuthorizationItem myItems[1];
myItems[0].name = "com.mycompany.myapp";
myItems[0].valueLength = 0;
myItems[0].value = NULL;
myItems[0].flags = 0;
AuthorizationRights myRights;
myRights.count = sizeof (myItems) / sizeof (myItems[0]);
myRights.items = myItems;
AuthorizationFlags myFlags;
myFlags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed |
kAuthorizationFlagExtendRights;
myStatus = AuthorizationCreate (&myRights, kAuthorizationEmptyEnvironment,
myFlags, &myAuthorizationRef);
//// [B]What else to do now so as to run this .app as root user.[/B]
}