Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
14 KiB

  1. // =========================================================================== // UAMDialogs.c � 1997 Microsoft Corp. All rights reserved. // =========================================================================== // General dialog utilities used by the Microsoft User Authentication Method. // // =========================================================================== #include <macstrsafe.h> #include "UAMDebug.h" #include "UAMDialogs.h" #include "UAMUtils.h" #include "UAMNetwork.h" #include "UAMDLOGUtils.h" #include "UAMKeychain.h" #include "UAMPswdField.h" #include "UAMPrefs.h" #ifndef UAM_TARGET_CARBON extern ModalFilterUPP gDialogFilter; #endif extern Str32 gServerName; extern UserItemUPP gLineItem; extern long gSupportedUAMs; extern UAM_PREFERENCES gUAMPreferences; SInt16 gNumPasswordEntryErrors = 0; // --------------------------------------------------------------------------- // � UAM_ReportError() // --------------------------------------------------------------------------- // Reports an error to the user by displaying an alert box. // void UAM_ReportError(OSStatus inError) { UAM_StandardAlert(uamErr_ErrorMessageString, inError, NULL); } // --------------------------------------------------------------------------- // � UAM_StandardAlert() // --------------------------------------------------------------------------- // Puts up a standard alert box for reporting errors and other items to the // user. // // The routine looks for resources of type 'STR ' to get the strings // associated with the message and explanations. // void UAM_StandardAlert(SInt16 inMessageID, SInt32 inExplanation, SInt16* outSelectedItem) { StringHandle theMessage = NULL; StringHandle theExplanation = NULL; SInt16 theSelectedItem; #ifdef UAM_TARGET_CARBON AlertStdAlertParamRec theAlertRec; SysBeep(1); theAlertRec.movable = TRUE; theAlertRec.helpButton = FALSE; theAlertRec.filterProc = NULL; theAlertRec.defaultText = (UInt8*)kAlertDefaultOKText; theAlertRec.cancelText = NULL; theAlertRec.otherText = NULL; theAlertRec.defaultButton = kAlertStdAlertOKButton; theAlertRec.position = kWindowAlertPositionMainScreen; // //If the caller is looking for the button the user selected, then we //assume that the user wants a cancel button. // if (outSelectedItem != NULL) { theAlertRec.cancelButton = kAlertStdAlertCancelButton; } else { theAlertRec.cancelButton = 0; } #endif //UAM_TARGET_CARBON InitCursor(); if (outSelectedItem != NULL) { *outSelectedItem = 0; } theMessage = GetString(inMessageID); if (theMessage != NULL) { HLock((Handle)theMessage); theExplanation = GetString(inExplanation); if (theExplanation == NULL) { // //We didn't find an error string corresponding to this error, so //put up a general error message. // theExplanation = GetString(uamErr_DefaultExplanation); } if (theExplanation != NULL) { HLock((Handle)theExplanation); #ifdef UAM_TARGET_CARBON StandardAlert( kAlertStopAlert, *theMessage, *theExplanation, &theAlertRec, &theSelectedItem ); #else ParamText(NULL, NULL, *theMessage, *theExplanation); theSelectedItem = StopAlert((outSelectedItem == NULL) ? ALRT_Error : ALRT_Error2, NULL); #endif if (outSelectedItem != NULL) { *outSelectedItem = theSelectedItem; } HUnlock((Handle)theExplanation); ReleaseResource((Handle)theExplanation); } HUnlock((Handle)theMessage); ReleaseResource((Handle)th