]> git.saurik.com Git - apple/mdnsresponder.git/blob - mDNSMacOS9/mDNSLibraryLoader.c
mDNSResponder-320.5.tar.gz
[apple/mdnsresponder.git] / mDNSMacOS9 / mDNSLibraryLoader.c
1 /* -*- Mode: C; tab-width: 4 -*-
2 *
3 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 #include <Resources.h>
19 #include <CodeFragments.h>
20 #include "ShowInitIcon.h"
21
22 extern pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister);
23
24 extern void main(void)
25 {
26 OSStatus err;
27 FCBPBRec fcbPB;
28 FSSpec fss;
29
30 // 1. Show our "icon march" icon
31 ShowInitIcon(128, true);
32
33 // 2. Find our FSSpec
34 fss.name[0] = 0;
35 fcbPB.ioNamePtr = fss.name;
36 fcbPB.ioVRefNum = 0;
37 fcbPB.ioRefNum = (short)CurResFile();
38 fcbPB.ioFCBIndx = 0;
39 err = PBGetFCBInfoSync(&fcbPB);
40
41 // 3. Tell CFM that we're a CFM library container file
42 fss.vRefNum = fcbPB.ioFCBVRefNum;
43 fss.parID = fcbPB.ioFCBParID;
44 if (err == noErr) err = FragRegisterFileLibs(&fss, false);
45
46 // 4. Now that CFM knows we're a library container, tell it to go and get our library
47 if (err == noErr)
48 {
49 CFragConnectionID c;
50 Ptr m;
51 Str255 e;
52 THz oldZone = GetZone();
53 SetZone(SystemZone());
54 err = GetSharedLibrary("\pDarwin;mDNS", kPowerPCCFragArch, kLoadCFrag, &c, &m, e);
55 SetZone(oldZone);
56 }
57 }
58
59 // There's no CFM stub library for the FragRegisterFileLibs() call, so we'll make our own
60 #if __ide_target("FragRegisterFileLibsStub")
61 #pragma export on
62 pascal OSErr FragRegisterFileLibs(ConstFSSpecPtr fss, Boolean unregister)
63 {
64 (void)fss; // Unused
65 (void)unregister; // Unused
66 return(0);
67 }
68 #endif