mirror of
				https://github.com/sheumann/AFPBridge.git
				synced 2025-10-24 11:20:49 -07:00 
			
		
		
		
	
		
			
				
	
	
		
			497 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			497 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #include "types.rez"
 | |
| 
 | |
| resource rVersion (1) {
 | |
|     { 1,0,0,beta,1 },
 | |
|     verUS,
 | |
|     "AFP Mounter",
 | |
|     "By Stephen Heumann"
 | |
| };
 | |
| 
 | |
| resource rComment (1) {
 | |
|     "The AFP Mounter control panel allows you to connect to "
 | |
|     "file servers using the Apple Filing Protocol (AFP) "
 | |
|     "over either AppleTalk or TCP/IP.\n"
 | |
|     "\n"
 | |
|     "Copyright 2017 Stephen Heumann\n"
 | |
|     "\n"
 | |
|     "This program contains material from the ORCA/C Run-Time Libraries, "
 | |
|     "copyright 1987-1996 by Byte Works, Inc. Used with permission."
 | |
| };
 | |
| 
 | |
| resource rCDEVFlags (1) {
 | |
|     wantMachine+wantHit+wantClose+wantEvents+wantEdit+wantCreate,
 | |
|     1,                          /* enabled */
 | |
|     1,                          /* version */
 | |
|     1,                          /* min ROM version */
 | |
|     0,                          /* reserved */
 | |
|     {0, 0, 55, 320},            /* rectangle */
 | |
|     "AFP Mounter",              /* name */
 | |
|     "Stephen Heumann",          /* author */
 | |
|     "v1.0b1"                    /* version string */
 | |
| };
 | |
| 
 | |
| read rCDevCode (0x1,convert,locked) "AFPMounter.obj";
 | |
| 
 | |
| resource rIcon (1) {
 | |
|     0x8000,                     /* color icon */
 | |
|     20,                         /* dimensions */
 | |
|     28,
 | |
|     $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | |
|     $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | |
|     $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | |
|     $"F00000000FFFFFFFFFFFFFFFFFFF"
 | |
|     $"F0DDDDDD0FFFFFFFFFFFFFFFFFFF"
 | |
|     $"F0DDDDDD04FFFFFFFF4FFFFFFFFF"
 | |
|     $"F0DDDDDD04FFFFFFFF4F0FF000FF"
 | |
|     $"F0DDDDDD444FFFFF0444A0F0DD0F"
 | |
|     $"F0000000444FFFF0E4440A00DD0F"
 | |
|     $"FF0FFFF4F4F4FFF04E404AA0DD0F"
 | |
|     $"F000000404F4FFF04E404A00DD0F"
 | |
|     $"F0F4FF4F04FF4F04004004000000"
 | |
|     $"F000040004FFF44303433343330F"
 | |
|     $"4444444444444444444444444444"
 | |
|     $"3333333334333333334333333333"
 | |
|     $"4444444444444444444444444444"
 | |
|     $"FFFFFFFFF4FFFFFFFF4FFFFFFFFF"
 | |
|     $"FFFFFFFFF4FFFFFFFF4FFFFFFFFF"
 | |
|     $"FFFFFFFFF4FFFFFFFF4FFFFFFFFF"
 | |
|     $"FFFFFFFFF4FFFFFFFF4FFFFFFFFF",
 | |
| 
 | |
|     $"0000000000000000000000000000"
 | |
|     $"0000000000000000000000000000"
 | |
|     $"0000000000000000000000000000"
 | |
|     $"0FFFFFFFF0000000000000000000"
 | |
|     $"0FFFFFFFF0000000000000000000"
 | |
|     $"0FFFFFFFFF00000000F000000000"
 | |
|     $"0FFFFFFFFF00000000F0F00FFF00"
 | |
|     $"0FFFFFFFFFF00000FFFFFF0FFFF0"
 | |
|     $"0FFFFFFFFFF0000FFFFFFFFFFFF0"
 | |
|     $"00FFFFFF0F0F000FFFFFFFFFFFF0"
 | |
|     $"0FFFFFFFFF0F000FFFFFFFFFFFF0"
 | |
|     $"0FFFFFFFFF00F0FFFFFFFFFFFFFF"
 | |
|     $"0FFFFFFFFF000FFFFFFFFFFFFFF0"
 | |
|     $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | |
|     $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | |
|     $"FFFFFFFFFFFFFFFFFFFFFFFFFFFF"
 | |
|     $"000000000F00000000F000000000"
 | |
|     $"000000000F00000000F000000000"
 | |
|     $"000000000F00000000F000000000"
 | |
|     $"000000000F00000000F000000000"
 | |
| };
 | |
| 
 | |
| #define cdevWindow          1000
 | |
| #define helpWindow          2000
 | |
| 
 | |
| #define serverAddressTxt    2
 | |
| #define urlLine             3
 | |
| #define saveAliasBtn        4
 | |
| #define connectBtn          1
 | |
| #define optionsPopUp        6
 | |
| #define trianglePic         7
 | |
| 
 | |
| #define helpTxt             5
 | |
| 
 | |
| #define saveFilePrompt      100
 | |
| 
 | |
| #define optionsMenu                         300
 | |
| #define afpOverTCPOptionsItem               301
 | |
| #define useLargeReadsItem                   302
 | |
| #define forceAFP22Item                      303
 | |
| #define fakeSleepItem                       304
 | |
| #define useLargeWritesItem                  305
 | |
| #define ignoreErrorsSettingFileTypesItem    306
 | |
| 
 | |
| /*
 | |
|  * Controls in the control panel window (for 640 mode or 320 mode)
 | |
|  */
 | |
| resource rControlList (640) {
 | |
|     {
 | |
|         cdevWindow+serverAddressTxt,
 | |
|         cdevWindow+urlLine,
 | |
|         cdevWindow+saveAliasBtn,
 | |
|         cdevWindow+connectBtn,
 | |
|         cdevWindow+trianglePic,
 | |
|         cdevWindow+optionsPopUp
 | |
|     };
 | |
| };
 | |
| 
 | |
| resource rControlList (320) {
 | |
|     {
 | |
|         cdevWindow+serverAddressTxt,
 | |
|         cdevWindow+urlLine,
 | |
|         cdevWindow+saveAliasBtn,
 | |
|         cdevWindow+connectBtn,
 | |
|         cdevWindow+trianglePic+320,
 | |
|         cdevWindow+optionsPopUp+320
 | |
|     };
 | |
| };
 | |
| 
 | |
| resource rControlTemplate (cdevWindow+serverAddressTxt) {
 | |
|     serverAddressTxt,                       /* control ID */
 | |
|     {4, 10, 15, 270},                       /* control rect */
 | |
|     statTextControl {{
 | |
|         fBlastText,                         /* flags */
 | |
|         $1000+RefIsResource,                /* moreFlags */
 | |
|         0,                                  /* refCon */
 | |
|         cdevWindow+serverAddressTxt         /* title ref */
 | |
|     }};
 | |
| };
 | |
| 
 | |
| resource rTextForLETextBox2 (cdevWindow+serverAddressTxt) {
 | |
|     "AFP Server Address:"
 | |
| };
 | |
| 
 | |
| resource rControlTemplate (cdevWindow+urlLine) {
 | |
|     urlLine,
 | |
|     {15, 10, 28, 310},
 | |
|     editLineControl {{
 | |
|         0,
 | |
|         $7000+RefIsResource,
 | |
|         0,
 | |
|         255,                                /* max size */
 | |
|         cdevWindow+urlLine                  /* text ref */
 | |
|     }};
 | |
| };
 | |
| 
 | |
| resource rPString (cdevWindow+urlLine) { "afp://" };
 | |
| 
 | |
| resource rControlTemplate (cdevWindow+saveAliasBtn) {
 | |
|     saveAliasBtn,
 | |
|     {35, 10, 0, 0},
 | |
|     SimpleButtonControl {{
 | |
|         NormalButton,
 | |
|         $1000+RefIsResource,
 | |
|         0,
 | |
|         cdevWindow+saveAliasBtn
 | |
|     }};
 | |
| };
 | |
| 
 | |
| resource rPString(cdevWindow+saveAliasBtn) { "Save Alias..." };
 | |
| 
 | |
| resource rControlTemplate (cdevWindow+connectBtn) {
 | |
|     connectBtn,
 | |
|     {35, 220, 0, 0},
 | |
|     SimpleButtonControl {{
 | |
|         DefaultButton,
 | |
|         $3000+RefIsResource,
 | |
|         0,
 | |
|         cdevWindow+connectBtn,
 | |
|         0,                                  /* color table ref */
 | |
|         {"\$0D","\$0D",0,0}                 /* key equivalent = Return */
 | |
|     }};
 | |
| };
 | |
| 
 | |
| resource rPString(cdevWindow+connectBtn) { "Connect" };
 | |
| 
 | |
| /* Options menu pop-up -- separate versions for 640 mode and 320 mode */
 | |
| resource rControlTemplate (cdevWindow+optionsPopUp) {
 | |
|     optionsPopUp,
 | |
|     {5, 282, 13, 310 },
 | |
|     PopUpControl {{
 | |
|         fDontDrawTitle+fDontDrawResult,
 | |
|         fCtlProcNotPtr+RefIsResource/*+fDrawPopDownIcon*/,
 | |
|         0,
 | |
|         0,
 | |
|         optionsMenu,                        /* menu ref */
 | |
|         afpOverTCPOptionsItem,              /* initial value */
 | |
|         0
 | |
|     }};
 | |
| };
 | |
| 
 | |
| resource rControlTemplate (cdevWindow+optionsPopUp+ 320) {
 | |
|     optionsPopUp,
 | |
|     {5, 296, 13, 310 },
 | |
|     PopUpControl {{
 | |
|         fDontDrawTitle+fDontDrawResult,
 | |
|         fCtlProcNotPtr+RefIsResource/*+fDrawPopDownIcon*/,
 | |
|         0,
 | |
|         0,
 | |
|         optionsMenu,                        /* menu ref */
 | |
|         afpOverTCPOptionsItem,              /* initial value */
 | |
|         0
 | |
|     }};
 | |
| };
 | |
| 
 | |
| /* Triangle to draw on options pop-up */
 | |
| resource rControlTemplate (cdevWindow+trianglePic) {
 | |
|     trianglePic,
 | |
|     {7, 286, 11, 302},
 | |
|     PictureControl {{
 | |
|         CtlInactive,
 | |
|         fCtlProcNotPtr+RefIsResource,
 | |
|         0,
 | |
|         trianglePic                         /* picture reference */
 | |
|     }};
 | |
| };
 | |
| 
 | |
| resource rControlTemplate (cdevWindow+trianglePic+320) {
 | |
|     trianglePic,
 | |
|     {7, 298, 0, 0},
 | |
|     PictureControl {{
 | |
|         CtlInactive,
 | |
|         fCtlProcNotPtr+RefIsResource,
 | |
|         0,
 | |
|         trianglePic                         /* picture reference */
 | |
|     }};
 | |
| };
 | |
| 
 | |
| data rPicture (trianglePic) {
 | |
|     $"8000 0000 0000 0400 1000 1182 0100 0A00"
 | |
|     $"01C0 01C0 FF3F FF3F 9000 8000 0000 0400"
 | |
|     $"0000 0000 0400 1000 0000 0000 0400 1000"
 | |
|     $"0000 0000 0400 1000 0000 0000 0000 F000"
 | |
|     $"000F FF00 00FF FFF0 0FFF"
 | |
| };
 | |
| 
 | |
| resource rMenu (optionsMenu) {
 | |
|     optionsMenu,                            /* menu ID */
 | |
|     refIsResource*menuTitleRefShift + refIsResource*itemRefShift,
 | |
|     optionsMenu,                            /* menu title ref (not drawn) */
 | |
|     {
 | |
|         afpOverTCPOptionsItem,
 | |
|         useLargeReadsItem,
 | |
|         useLargeWritesItem,
 | |
|         forceAFP22Item,
 | |
|         fakeSleepItem,
 | |
|         ignoreErrorsSettingFileTypesItem
 | |
|     };
 | |
| };
 | |
| resource rPString(optionsMenu,noCrossBank) { "" };
 | |
| 
 | |
| resource rMenuItem (afpOverTCPOptionsItem) {
 | |
|     afpOverTCPOptionsItem,                  /* menu item ID */
 | |
|     "","",
 | |
|     0,
 | |
|     fDisabled+refIsResource*itemTitleRefShift,
 | |
|     afpOverTCPOptionsItem                   /* menu item title ref */
 | |
| };
 | |
| resource rPString(afpOverTCPOptionsItem,noCrossBank) { "AFP Over TCP Options:" };
 | |
| 
 | |
| resource rMenuItem (useLargeReadsItem) {
 | |
|     useLargeReadsItem,                      /* menu item ID */
 | |
|     "","",
 | |
|     $12,
 | |
|     refIsResource*itemTitleRefShift,
 | |
|     useLargeReadsItem                       /* menu item title ref */
 | |
| };
 | |
| resource rPString(useLargeReadsItem,noCrossBank) { "Use Large Reads" };
 | |
| 
 | |
| resource rMenuItem (useLargeWritesItem) {
 | |
|     useLargeWritesItem,                     /* menu item ID */
 | |
|     "","",
 | |
|     0,
 | |
|     refIsResource*itemTitleRefShift,
 | |
|     useLargeWritesItem                      /* menu item title ref */
 | |
| };
 | |
| resource rPString(useLargeWritesItem,noCrossBank) { "Use Large Writes" };
 | |
| 
 | |
| resource rMenuItem (forceAFP22Item) {
 | |
|     forceAFP22Item,                         /* menu item ID */
 | |
|     "","",
 | |
|     0,
 | |
|     refIsResource*itemTitleRefShift,
 | |
|     forceAFP22Item                          /* menu item title ref */
 | |
| };
 | |
| resource rPString(forceAFP22Item,noCrossBank) { "Force AFP Version 2.2" };
 | |
| 
 | |
| resource rMenuItem (fakeSleepItem) {
 | |
|     fakeSleepItem,                          /* menu item ID */
 | |
|     "","",
 | |
|     0,
 | |
|     refIsResource*itemTitleRefShift,
 | |
|     fakeSleepItem                           /* menu item title ref */
 | |
| };
 | |
| resource rPString(fakeSleepItem,noCrossBank) { "Fake Sleep to Keep Alive" };
 | |
| 
 | |
| resource rMenuItem (ignoreErrorsSettingFileTypesItem) {
 | |
|     ignoreErrorsSettingFileTypesItem,       /* menu item ID */
 | |
|     "","",
 | |
|     0,
 | |
|     refIsResource*itemTitleRefShift,
 | |
|     ignoreErrorsSettingFileTypesItem        /* menu item title ref */
 | |
| };
 | |
| resource rPString(ignoreErrorsSettingFileTypesItem,noCrossBank) {
 | |
|     "Ignore Errors Setting File Types"
 | |
| };
 | |
| 
 | |
| /*
 | |
|  * Controls in the help window
 | |
|  */
 | |
| resource rControlList (2) {
 | |
|     {
 | |
|         helpWindow+helpTxt
 | |
|     };
 | |
| };
 | |
| 
 | |
| resource rControlTemplate (helpWindow+helpTxt) {
 | |
|     helpTxt,
 | |
|     {38, 5, 138, 280},
 | |
|     statTextControl {{
 | |
|         0,                                  /* flags */
 | |
|         $1000+RefIsResource,                /* moreFlags */
 | |
|         0,                                  /* refCon */
 | |
|         helpWindow+helpTxt                  /* title ref */
 | |
|     }};
 | |
| };
 | |
| 
 | |
| resource rTextForLETextBox2 (helpWindow+helpTxt) {
 | |
|     "The AFP Mounter control panel allows you to connect to "
 | |
|     "file servers using the Apple Filing Protocol (AFP) "
 | |
|     "over either AppleTalk or TCP/IP networks. "
 | |
|     "The server address can be specified by URLs "
 | |
|     "of the following forms:\n\$01X\$03\$00"
 | |
|     "afp://[user:password@]server[:port]/\n\$01X\$00\$00"
 | |
|     "volume          (to connect using TCP/IP)\n\$01X\$03\$00"
 | |
|     "afp:/at/[user:password@]server:zone/\n\$01X\$00\$00"
 | |
|     "volume    (to connect using AppleTalk)\n"
 | |
| };
 | |
| 
 | |
| resource rPString(saveFilePrompt) { "Save server alias as:" };
 | |
| 
 | |
| /*
 | |
|  * Error messages
 | |
|  */
 | |
| 
 | |
| #define fstMissingError             3000
 | |
| #define noEasyMountError            3001
 | |
| #define tempFileError               3002
 | |
| #define aliasFileError              3003
 | |
| #define tempFileNameError           3004
 | |
| #define saveAliasError              3005
 | |
| #define noAFPBridgeError            3006
 | |
| #define noAFPBridgeWarning          3007
 | |
| 
 | |
| #define protoInvalidError           4000
 | |
| #define noServerOrVolumeNameError   4001
 | |
| #define serverNameTooLongError      4002
 | |
| #define volumeNameTooLongError      4003
 | |
| #define zoneTooLongError            4004
 | |
| #define usernameTooLongError        4005
 | |
| #define passwordTooLongError        4006
 | |
| #define volpassTooLongError         4007
 | |
| #define passwordWithoutUserError    4008
 | |
| #define badUAMError                 4009
 | |
| 
 | |
| resource rAlertString (fstMissingError) {
 | |
|     "72:"
 | |
|     "To use the AFP Mounter control panel, the AppleShare FST "
 | |
|     "and the AppleTalk-related system components it requires "
 | |
|     "must be installed and enabled."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (noEasyMountError) {
 | |
|     "72:"
 | |
|     "Communication with EasyMount failed.\n"
 | |
|     "\n"
 | |
|     "To use the AFP Mounter control panel, EasyMount must be "
 | |
|     "installed and enabled."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (protoInvalidError) {
 | |
|     "32:"
 | |
|     "The specified address is not a valid AFP URL."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (noServerOrVolumeNameError) {
 | |
|     "32:"
 | |
|     "Please specify at least a server and volume name in the AFP URL."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (serverNameTooLongError) {
 | |
|     "32:"
 | |
|     "The server name is too long (maximum 32 characters)."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (volumeNameTooLongError) {
 | |
|     "32:"
 | |
|     "The volume name is too long (maximum 27 characters)."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (zoneTooLongError) {
 | |
|     "32:"
 | |
|     "The zone name is too long (maximum 32 characters)."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (usernameTooLongError) {
 | |
|     "32:"
 | |
|     "The username is too long (maximum 31 characters)."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (passwordTooLongError) {
 | |
|     "32:"
 | |
|     "The password is too long (maximum 8 characters)."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (volpassTooLongError) {
 | |
|     "32:"
 | |
|     "The volume password is too long (maximum 8 characters)."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (passwordWithoutUserError) {
 | |
|     "42:"
 | |
|     "When a password is specified, a user name must also be given."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (badUAMError) {
 | |
|     "62:"
 | |
|     "The requested user authentication method is not supported "
 | |
|     "or cannot be used with the specified URL."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (tempFileError) {
 | |
|     "82:"
 | |
|     "There was an error writing the temporary file used by the "
 | |
|     "AFPMounter control panel.  Please make sure the directory "
 | |
|     "containing the AFPMounter control panel is writable and "
 | |
|     "remove the AFPMounter.Temp file if it is present."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (aliasFileError) {
 | |
|     "32:"
 | |
|     "There was an error writing the alias file."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (tempFileNameError) {
 | |
|     "72:"
 | |
|     "There was an error while constructing the name for the "
 | |
|     "temporary file used by the AFPMounter control panel."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (saveAliasError) {
 | |
|     "42:"
 | |
|     "There was an error while attempting to save the alias file."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (noAFPBridgeError) {
 | |
|     "62:"
 | |
|     "To connect to AFP servers over TCP, AFPBridge and Marinetti "
 | |
|     "must be installed and enabled.  Please install them and then "
 | |
|     "restart your system."
 | |
|     ":^#0\$00"
 | |
| };
 | |
| 
 | |
| resource rAlertString (noAFPBridgeWarning) {
 | |
|     "74:"
 | |
|     "To connect to AFP servers over TCP, AFPBridge and Marinetti "
 | |
|     "must be installed and enabled.  You can continue to save an "
 | |
|     "alias now, but to connect to the server you will need to "
 | |
|     "install them and then restart your system."
 | |
|     ":#1:^#6\$00"
 | |
| };
 |