Various things to make the Finder like us:

- Change the creator of files we don't want the user to open to 'pTTI' (for
   "PuTTY internal"), and give them application-missing strings.
 - Provide missing-application names for saved sessions.
 - Provide a ResEdit 'TMPL' resource for integers in saved sessions.
 - Provide an icon for saved session stationery pads (maybe "Default Settings"
   should be one of these by default).  No code to handle this yet.

[originally from svn r2640]
This commit is contained in:
Ben Harris 2003-01-18 16:10:21 +00:00
Родитель a8c33d8e12
Коммит 06a48a0c06
3 изменённых файлов: 272 добавлений и 53 удалений

Просмотреть файл

@ -1,4 +1,4 @@
/* $Id: mac_res.r,v 1.17 2003/01/18 12:25:43 ben Exp $ */
/* $Id: mac_res.r,v 1.18 2003/01/18 16:10:21 ben Exp $ */
/*
* Copyright (c) 1999, 2002 Ben Harris
* All rights reserved.
@ -80,40 +80,64 @@ resource 'SIZE' (-1) {
1024 * 1024, /* Preferred size */
};
resource 'FREF' (128, purgeable) {
#define FREF_APPL 128
#define FREF_Sess 129
#define FREF_Sesss 130
#define FREF_HKey 131
#define FREF_Seed 132
resource 'FREF' (FREF_APPL, purgeable) {
/* The application itself */
'APPL', 128, ""
'APPL', FREF_APPL, ""
};
resource 'FREF' (129, purgeable) {
resource 'FREF' (FREF_Sess, purgeable) {
/* Saved session */
'Sess', 129, ""
};
resource 'FREF' (130, purgeable) {
/* SSH host keys database */
'HKey', 130, ""
'Sess', FREF_Sess, ""
};
resource 'FREF' (131, purgeable) {
resource 'FREF' (FREF_Sesss, purgeable) {
/* Saved session stationery pad*/
'sess', FREF_Sesss, ""
};
resource 'FREF' (FREF_HKey, purgeable) {
/* SSH host keys database */
'HKey', FREF_HKey, ""
};
resource 'FREF' (FREF_Seed, purgeable) {
/* Random seed */
'Seed', 131, ""
'Seed', FREF_Seed, ""
};
resource 'BNDL' (128, purgeable) {
'pTTY', 0,
{
'ICN#', {
128, 128,
129, 129,
130, 130,
131, 131
FREF_APPL, FREF_APPL,
FREF_Sess, FREF_Sess,
FREF_Sesss, FREF_Sesss
},
'FREF', {
128, 128,
129, 129,
130, 130,
131, 131
FREF_APPL, FREF_APPL,
FREF_Sess, FREF_Sess,
FREF_Sesss, FREF_Sesss,
};
};
};
/* "Internal" file types, which can't be opened */
resource 'BNDL' (129, purgeable) {
'pTTI', 0,
{
'ICN#', {
FREF_HKey, FREF_HKey,
FREF_Seed, FREF_Seed,
},
'FREF', {
FREF_HKey, FREF_HKey,
FREF_Seed, FREF_Seed,
};
};
};
@ -121,7 +145,7 @@ resource 'BNDL' (128, purgeable) {
/* Icons, courtesy of DeRez */
/* Application icon */
resource 'ICN#' (128, purgeable) {
resource 'ICN#' (FREF_APPL, purgeable) {
{ /* array: 2 elements */
/* [1] */
$"00003FFE 00004001 00004FF9 00005005"
@ -143,8 +167,7 @@ resource 'ICN#' (128, purgeable) {
$"FFFE0000 7FFC0000 7FFC0000 7FFC"
}
};
resource 'icl4' (128, purgeable) {
resource 'icl4' (FREF_APPL, purgeable) {
$"000000000000000000FFFFFFFFFFFFF0"
$"00000000000000000FCCCCCCCCCCCCCF"
$"00000000000000000FCEEEEEEEEEEECF"
@ -178,8 +201,7 @@ resource 'icl4' (128, purgeable) {
$"0FCCCDDDEEEEAF000000000000000000"
$"0FFFFFFFFFFFFF"
};
resource 'icl8' (128, purgeable) {
resource 'icl8' (FREF_APPL, purgeable) {
$"000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFF00"
$"0000000000000000000000000000000000FF2B2B2B2B2B2B2B2B2B2B2B2B2BFF"
$"0000000000000000000000000000000000FF2BFCFCFCFCFCFCFCFCFCFCFC2BFF"
@ -213,8 +235,7 @@ resource 'icl8' (128, purgeable) {
$"00FF2BF7F8F9FAFAFBFBFCFCFDFF000000000000000000000000000000000000"
$"00FFFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource 'ics#' (128, purgeable) {
resource 'ics#' (FREF_APPL, purgeable) {
{ /* array: 2 elements */
/* [1] */
$"00FF 0081 008D 0035 00D5 0325 F441 822D"
@ -224,8 +245,7 @@ resource 'ics#' (128, purgeable) {
$"FFFF FF7E FF00 FF00 FF00 FF00 FF00 7E"
}
};
resource 'ics4' (128) {
resource 'ics4' (FREF_APPL) {
$"00000000FFFFFFFF"
$"00000000FCCCCCCF"
$"00000000FCEEEECF"
@ -243,8 +263,7 @@ resource 'ics4' (128) {
$"FCCCCCCF00000000"
$"0FFFFFF0"
};
resource 'ics8' (128) {
resource 'ics8' (FREF_APPL) {
$"0000000000000000FFFFFFFFFFFFFFFF"
$"0000000000000000FF2B2B2B2B2B2BFF"
$"0000000000000000FF2BFCFCFCFC2BFF"
@ -265,7 +284,7 @@ resource 'ics8' (128) {
/* Saved-session icon */
resource 'ICN#' (129) {
resource 'ICN#' (FREF_Sess) {
{ /* array: 2 elements */
/* [1] */
$"1FFFFC00 10000600 10200500 103FFC80"
@ -287,7 +306,7 @@ resource 'ICN#' (129) {
$"1FFFFFF0 1FFFFFF0 1FFFFFF0 1FFFFFF0"
}
};
resource 'icl4' (129) {
resource 'icl4' (FREF_Sess) {
$"000FFFFFFFFFFFFFFFFFFF0000000000"
$"000F0C0C0C0C0C0C0C0C0FF000000000"
$"000FC0C0C0F0C0C0C0C0CFCF00000000"
@ -321,7 +340,7 @@ resource 'icl4' (129) {
$"000FC0C0C0C0C0C0C0C0C0C0C0CF0000"
$"000FFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource 'icl8' (129, purgeable) {
resource 'icl8' (FREF_Sess, purgeable) {
$"000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000"
$"000000FFF5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5FFFF000000000000000000"
$"000000FFF5F5F5F5F5F5FFF5F5F5F5F5F5F5F5F5F5FF2BFF0000000000000000"
@ -355,7 +374,7 @@ resource 'icl8' (129, purgeable) {
$"000000FFF5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5FF00000000"
$"000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource 'ics#' (129, purgeable) {
resource 'ics#' (FREF_Sess, purgeable) {
{ /* array: 2 elements */
/* [1] */
$"7FE0 4030 4028 403C 5AB4 50D4 5334 5444"
@ -365,7 +384,7 @@ resource 'ics#' (129, purgeable) {
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
}
};
resource 'ics4' (129) {
resource 'ics4' (FREF_Sess) {
$"0FFFFFFFFFF00000"
$"0F0C0C0C0CFF0000"
$"0FC0C0C0C0FCF000"
@ -383,7 +402,7 @@ resource 'ics4' (129) {
$"0FC0C0C0C0C0CF00"
$"0FFFFFFFFFFFFF"
};
resource 'ics8' (129) {
resource 'ics8' (FREF_Sess) {
$"00FFFFFFFFFFFFFFFFFFFF0000000000"
$"00FFF5F5F5F5F5F5F5F5FFFF00000000"
$"00FFF5F5F5F5F5F5F5F5FF2BFF000000"
@ -402,8 +421,146 @@ resource 'ics8' (129) {
$"00FFFFFFFFFFFFFFFFFFFFFFFFFF"
};
/* Saved session stationery pad icon */
resource 'ICN#' (FREF_Sesss, purgeable) {
{ /* array: 2 elements */
/* [1] */
$"3FFFFFE0 20000020 20400238 207FFE28"
$"20400228 20000028 2F555628 24000A28"
$"24403428 24004A28 24409028 24032A28"
$"24444428 2408FFA8 24700528 24401B28"
$"247E2128 24044328 24498128 24120328"
$"24250128 24588328 24A08128 2EEAAFE8"
$"20000848 20800888 20FFF908 20800A08"
$"20000C08 3FFFF808 08000008 0FFFFFF8",
/* [2] */
$"3FFFFFE0 3FFFFFE0 3FFFFFF8 3FFFFFF8"
$"3FFFFFF8 3FFFFFF8 3FFFFFF8 3FFFFFF8"
$"3FFFFFF8 3FFFFFF8 3FFFFFF8 3FFFFFF8"
$"3FFFFFF8 3FFFFFF8 3FFFFFF8 3FFFFFF8"
$"3FFFFFF8 3FFFFFF8 3FFFFFF8 3FFFFFF8"
$"3FFFFFF8 3FFFFFF8 3FFFFFF8 3FFFFFF8"
$"3FFFFFF8 3FFFFFF8 3FFFFFF8 3FFFFFF8"
$"3FFFFFF8 3FFFFFF8 0FFFFFF8 0FFFFFF8"
}
};
resource 'icl4' (FREF_Sesss, purgeable) {
$"00FFFFFFFFFFFFFFFFFFFFFFFFF00000"
$"00FC0C0C0C0C0C0C0C0C0C0C0CF00000"
$"00F0C0C0CFC0C0C0C0C0C0F0C0FFF000"
$"00FC0C0C0FFFFFFFFFFFFFFC0CFDF000"
$"00F0C0C0CFC0C0C0C0C0C0F0C0FDF000"
$"00FC0C0C0D0C0C0C0C0C0CDC0CFDF000"
$"00F0FFFDDDDDDDDDDDDDDFF0C0FDF000"
$"00FC0F0C0D0C0C0C0C0CF1FC0CFDF000"
$"00F0CFC0CDC0C0C0C0FF1FD0C0FDF000"
$"00FC0F0C0D0C0C0C0F11FCDC0CFDF000"
$"00F0CFC0CDC0C0C0F11FC0D0C0FDF000"
$"00FC0F0C0D0C0CFF11FCFCDC0CFDF000"
$"00F0CFC0CDC0CF111FC0CFD0C0FDF000"
$"00FC0F0C0D0CF111FFFFFFFFFCFDF000"
$"00F0CFC0CDFF111111111FDFC0FDF000"
$"00FC0F0C0F111111111FFCDF0CFDF000"
$"00F0CFC0CDFFFFF111F0C0DFC0FDF000"
$"00FC0F0C0D0C0F111F0C0CDF0CFDF000"
$"00F0CFC0C0C0F11FF0C0C0DFC0FDF000"
$"00FC0F0C0C0F11FC0C0C0CDF0CFDF000"
$"00F0CFC0C0F11FCFC0C0C0DFC0FDF000"
$"00FC0F0C0F1FFC0CFC0C0CDF0CFDF000"
$"00F0CFC0F1F0C0C0E0C0C0DFC0FDF000"
$"00FCFFFDFFDDDDDDEDDDFFFFFFFDF000"
$"00F0C0C0D0C0C0C0C0C0FCCCCFDDF000"
$"00FC0C0CFC0C0C0C0C0CFCCCFDDCF000"
$"00F0C0C0FFFFFFFFFFFFFCCFDDCCF000"
$"00FC0C0CFC0C0C0C0C0CFCFDDCCCF000"
$"00F0C0C0C0C0C0C0C0C0FFDDCCCCF000"
$"00FFFFFFFFFFFFFFFFFFFDDCCCCCF000"
$"0000FDDDDDDDDDDDDDDDDDCCCCCCF000"
$"0000FFFFFFFFFFFFFFFFFFFFFFFFF0"
};
resource 'icl8' (FREF_Sesss, purgeable) {
$"0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000"
$"0000FFF5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5FF0000000000"
$"0000FFF5F5F5F5F5F5FFF5F5F5F5F5F5F5F5F5F5F5F5FFF5F5F5FFFFFF000000"
$"0000FFF5F5F5F5F5F5FFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F5F5FFF9FF000000"
$"0000FFF5F5F5F5F5F5FFF5F5F5F5F5F5F5F5F5F5F5F5FFF5F5F5FFF9FF000000"
$"0000FFF5F5F5F5F5F5F9F5F5F5F5F5F5F5F5F5F5F5F5F9F5F5F5FFF9FF000000"
$"0000FFF5FFFFFFF9F9F9F9F9F9F9F9F9F9F9F9F9F9FFFFF5F5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5F5F5F5F5F5F5F5F5FF05FFF5F5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5F5F5F5F5F5F5FFFF05FFF9F5F5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5F5F5F5F5F5FF0505FFF5F9F5F5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5F5F5F5F5FF0505FFF5F5F9F5F5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5F5F5FFFF0505FFF5FFF5F9F5F5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5F5FF050505FFF5F5F5FFF9F5F5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5FF050505FFFFFFFFFFFFFFFFFFF5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9FFFF050505050505050505FFF9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5FF050505050505050505FFFFF5F9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9FFFFFFFFFF050505FFF5F5F5F9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F9F5F5F5FF050505FFF5F5F5F5F9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F5F5F5FF0505FFFFF5F5F5F5F5F9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F5F5FF0505FFF5F5F5F5F5F5F5F9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5F5FF0505FFF5FFF5F5F5F5F5F5F9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5F5FF05FFFFF5F5F5FCF5F5F5F5F5F9FFF5F5FFF9FF000000"
$"0000FFF5F5FFF5F5FF05FFF5F5F5F5F5FCF5F5F5F5F5F9FFF5F5FFF9FF000000"
$"0000FFF5FFFFFFF9FFFFF9F9F9F9F9F9FCF9F9F9FFFFFFFFFFFFFFF9FF000000"
$"0000FFF5F5F5F5F5F9F5F5F5F5F5F5F5F5F5F5F5FF2B2B2BF7FFF9F7FF000000"
$"0000FFF5F5F5F5F5FFF5F5F5F5F5F5F5F5F5F5F5FF2B2BF7FFF9F72BFF000000"
$"0000FFF5F5F5F5F5FFFFFFFFFFFFFFFFFFFFFFFFFF2BF7FFF9F72BF6FF000000"
$"0000FFF5F5F5F5F5FFF5F5F5F5F5F5F5F5F5F5F5FFF7FFF9F72BF6F6FF000000"
$"0000FFF5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5F5FFFFF9F72BF6F6F6FF000000"
$"0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9F72BF6F6F6F6FF000000"
$"00000000FFF9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F9F72BF6F6F6F6F6FF000000"
$"00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource 'ics#' (FREF_Sesss, purgeable) {
{ /* array: 2 elements */
/* [1] */
$"7FF8 4008 756E 61AA 666A 688A 646A 698A"
$"762A 6A8A 507A 5FD2 4062 7FC2 1002 1FFE",
/* [2] */
$"7FF8 7FF8 7FFE 7FFE 7FFE 7FFE 7FFE 7FFE"
$"7FFE 7FFE 7FFE 7FFE 7FFE 7FFE 1FFE 1FFE"
}
};
resource 'ics4' (FREF_Sesss, purgeable) {
$"0FFFFFFFFFFFF000"
$"0FC0C0C0C0C0F000"
$"0FFDDDDDDFFCFFF0"
$"0FF0C0CFF1F0FDF0"
$"0FFC0FF11FDCFDF0"
$"0FF0F111F0D0FDF0"
$"0FFC0F111FDCFDF0"
$"0FF0F11FF0D0FDF0"
$"0FFF1FFC0CDCFDF0"
$"0FFCFDDDDDD0FDF0"
$"0F0F0C0C0FFFFDF0"
$"0FCFFFFFFFCFDDF0"
$"0F0C0C0C0FFDDCF0"
$"0FFFFFFFFFDDC0F0"
$"000FDDDDDDDC0CF0"
$"000FFFFFFFFFFFF0"
};
resource 'ics8' (FREF_Sesss, purgeable) {
$"00FFFFFFFFFFFFFFFFFFFFFFFF000000"
$"00FFF5F5F5F5F5F5F5F5F5F5FF000000"
$"00FFFFF9F9F9F9F9F9FFFFF5FFFFFF00"
$"00FFFFF5F5F5F5FFFF05FFF5FFF9FF00"
$"00FFFFF5F5FFFF0505FFF9F5FFF9FF00"
$"00FFFFF5FF050505FFF5F9F5FFF9FF00"
$"00FFFFF5F5FF050505FFF9F5FFF9FF00"
$"00FFFFF5FF0505FFFFF5F9F5FFF9FF00"
$"00FFFFFF05FFFFF5F5F5F9F5FFF9FF00"
$"00FFFFF8FFF9F9F9F9F9F9F5FFF9FF00"
$"00FFF5FFF5F5F5F5F5FFFFFFFFF9FF00"
$"00FFF5FFFFFFFFFFFFFF2BFFF9F9FF00"
$"00FFF5F5F5F5F5F5F5FFFFF9F9F5FF00"
$"00FFFFFFFFFFFFFFFFFFF9F9F5F5FF00"
$"000000FFF9F9F9F9F9F9F9F5F5F5FF00"
$"000000FFFFFFFFFFFFFFFFFFFFFFFF"
};
/* Known hosts icon */
resource 'ICN#' (130, purgeable) {
resource 'ICN#' (FREF_HKey, purgeable) {
{ /* array: 2 elements */
/* [1] */
$"1FFFFC00 10000600 10000500 1FFFFC80"
@ -425,7 +582,7 @@ resource 'ICN#' (130, purgeable) {
$"1FFFFFF0 1FFFFFF0 1FFFFFF0 1FFFFFF0"
}
};
resource 'icl4' (130, purgeable) {
resource 'icl4' (FREF_HKey, purgeable) {
$"000FFFFFFFFFFFFFFFFFFF0000000000"
$"000F00000000000000000FF000000000"
$"000F00000000000000000FCF00000000"
@ -459,7 +616,7 @@ resource 'icl4' (130, purgeable) {
$"000FC0C0C0C0C0C0C0C0C0C0C0CF0000"
$"000FFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource 'icl8' (130, purgeable) {
resource 'icl8' (FREF_HKey, purgeable) {
$"000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000"
$"000000FF0000000000000000000000000000000000FFFF000000000000000000"
$"000000FF0000000000000000000000000000000000FFF6FF0000000000000000"
@ -496,7 +653,7 @@ resource 'icl8' (130, purgeable) {
/* Random seed icon */
resource 'ICN#' (131, purgeable) {
resource 'ICN#' (FREF_Seed, purgeable) {
{ /* array: 2 elements */
/* [1] */
$"1FFFFC00 18F36600 161EF500 1CC92C80"
@ -518,7 +675,7 @@ resource 'ICN#' (131, purgeable) {
$"1FFFFFF0 1FFFFFF0 1FFFFFF0 1FFFFFF0"
}
};
resource 'icl4' (131) {
resource 'icl4' (FREF_Seed) {
$"000FFFFFFFFFFFFFFFFFFF0000000000"
$"000FFC0CFFFF0CFF1FFC0FF000000000"
$"000F0FF0C0CFFFF1FFFFCFCF00000000"
@ -552,7 +709,7 @@ resource 'icl4' (131) {
$"000FCFCFFFC0FFF0CFC0CFC0C0FF0000"
$"000FFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource 'icl8' (131) {
resource 'icl8' (FREF_Seed) {
$"000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000"
$"000000FFFFF5F5F5FFFFFFFFF5F5FFFF05FFFFF5F5FFFF000000000000000000"
$"000000FFF5FFFFF5F5F5F5FFFFFFFF05FFFFFFFFF5FF2BFF0000000000000000"
@ -586,7 +743,7 @@ resource 'icl8' (131) {
$"000000FFF5FFF5FFFFFFF5F5FFFFFFF5F5FFF5F5F5FFF5F5F5F5FFFF00000000"
$"000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
};
resource 'ics#' (131) {
resource 'ics#' (FREF_Seed) {
{ /* array: 2 elements */
/* [1] */
$"7FE0 56B0 59A8 637C 51DC 6794 59AC 76EC"
@ -596,7 +753,7 @@ resource 'ics#' (131) {
$"7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC 7FFC"
}
};
resource 'ics4' (131) {
resource 'ics4' (FREF_Seed) {
$"0FFFFFFFFFF00000"
$"0F0F0FF1FCFF0000"
$"0FCFF11FF0FCF000"
@ -614,7 +771,7 @@ resource 'ics4' (131) {
$"0FC0CFC0C0F0CF00"
$"0FFFFFFFFFFFFF"
};
resource 'ics8' (131) {
resource 'ics8' (FREF_Seed) {
$"00FFFFFFFFFFFFFFFFFFFF0000000000"
$"00FFF5FFF5FFFF05FFF5FFFF00000000"
$"00FFF5FFFF0505FFFFF5FF2BFF000000"
@ -681,6 +838,36 @@ resource 'vers' (2, purgeable) {
#endif
};
/*
* Resources to copy into created files
*/
/*
* Application-missing message string, for random seed and host key database
* files.
*/
resource 'STR ' (-16397, purgeable) {
"This file is used internally by PuTTY. It cannot be opened."
};
/* Missing-application name string, for saved sessions. */
resource 'STR ' (-16396, purgeable) {
"PuTTY"
};
/* ResEdit template resource for saved sessions. */
type 'TMPL' {
array {
pstring;
literal longint;
};
};
resource 'TMPL' (TMPL_Int, "Int ", purgeable) {
{ "Value", 'DLNG' }
};
/*
* Internal resources
*/

Просмотреть файл

@ -1,4 +1,4 @@
/* $Id: macresid.h,v 1.3 2002/12/31 01:40:14 ben Exp $ */
/* $Id: macresid.h,v 1.4 2003/01/18 16:10:21 ben Exp $ */
/*
* macresid.h -- Mac resource IDs
@ -6,6 +6,8 @@
* This file is shared by C and Rez source files
*/
/* TMPL for saved sessions */
#define TMPL_Int 128
/* Menu bar IDs */
#define MBAR_Main 128

Просмотреть файл

@ -1,4 +1,4 @@
/* $Id: macstore.c,v 1.9 2003/01/18 12:03:28 ben Exp $ */
/* $Id: macstore.c,v 1.10 2003/01/18 16:10:21 ben Exp $ */
/*
* macstore.c: Macintosh-specific impementation of the interface
@ -16,8 +16,10 @@
#include "putty.h"
#include "storage.h"
#include "mac.h"
#include "macresid.h"
#define PUTTY_CREATOR FOUR_CHAR_CODE('pTTY')
#define INTERNAL_CREATOR FOUR_CHAR_CODE('pTTI')
#define SESS_TYPE FOUR_CHAR_CODE('Sess')
#define SEED_TYPE FOUR_CHAR_CODE('Seed')
@ -95,6 +97,25 @@ OSErr FSpGetDirID(FSSpec *f, long *idp, Boolean makeit) {
return error;
}
/* Copy a resource into the current resource file */
static OSErr copy_resource(ResType restype, short resid)
{
Handle h;
Str255 resname;
fprintf(stderr, "getting resource %x, id %d\n", restype, resid);
h = GetResource(restype, resid);
if (h != NULL) {
GetResInfo(h, &resid, &restype, resname);
DetachResource(h);
AddResource(h, restype, resid, resname);
if (ResError() == noErr)
WriteResource(h);
}
fprintf(stderr, "ResError() == %d\n", ResError());
return ResError();
}
struct write_settings {
int fd;
FSSpec tmpfile;
@ -137,6 +158,10 @@ void *open_settings_w(char const *sessionname) {
ws->fd = FSpOpenResFile(&ws->tmpfile, fsWrPerm);
if (ws->fd == -1) {error = ResError(); goto out;}
/* Set up standard resources. Doesn't matter if these fail. */
copy_resource('STR ', -16396);
copy_resource('TMPL', TMPL_Int);
return ws;
out:
@ -408,15 +433,20 @@ void write_random_seed(void *data, int len)
error = FSMakeFSSpec(puttyVRefNum, puttyDirID, "\pPuTTY Random Seed",
&dstfile);
if (error == fnfErr)
error = FSpCreate(&dstfile, PUTTY_CREATOR, SEED_TYPE, smRoman);
if (error != noErr) return;
if (error == fnfErr) {
/* Set up standard resources */
FSpCreateResFile(&dstfile, INTERNAL_CREATOR, SEED_TYPE, smRoman);
refnum = FSpOpenResFile(&dstfile, fsWrPerm);
if (ResError() == noErr) {
copy_resource('STR ', -16397);
CloseResFile(refnum);
}
} else if (error != noErr) return;
if (FSpOpenDF(&dstfile, fsWrPerm, &refnum) != noErr) return;
FSWrite(refnum, &count, data);
FSClose(refnum);
return;
}