TweetFollow Us on Twitter

FakeFinder
Volume Number:12
Issue Number:4
Column Tag:Assembler Workshop

FakeFinder

A tiny file-launching hack for those emergencies...

By Lee David Rimar

Note: Source code files accompanying article are located on MacTech CD-ROM or source code disks.

What with it being April and the call of April Fool’s Day echoing in the breezes, it seems an appropriate time to put before the public this little horror that arrived at our desks a while back. Please bear in mind that when we say, “Kids, don’t try this at home,” this is one case where we mean it. It really does work, but the publisher, editors and staff of MacTech Magazine categorically refuse to stand behind or endorse it in any way, and will not be held responsible for what happens to you or anyone else as a result of your assembling this code or downloading the alternate Finder app. In fact, we can’t even be held responsible for what may happen to you if you read the article! Why not just turn the page now? Hey, I said turn the page! Okay, you asked for it

What It Is and
Why You Might Want It

With current releases of the Mac OS, it’s sometimes hard to build a useful emergency boot diskette. If your hard-drive won’t boot, you can usually use the Disk Tools floppy to bring up your system. But if you want other diagnostic and/or system recovery programs on your “emergency” diskette, there usually isn’t enough space. Enter FakeFinder.

FakeFinder is a tiny program (under 800 bytes) that simply launches other programs. On emergency boot diskettes, FakeFinder replaces the real Finder, and frees a lot of space.

How To Use It

To create an emergency boot disk with FakeFinder:

• Format a diskette and label it Emergency.

• Copy the following file(s) from your Disk Tools diskette to the root directory of Emergency:

1) the System file

2) optional: the Apple CD-ROM Extension

• If your Mac requires any system enablers, copy these also to the root directory of Emergency.

• Copy the “Finder” application from the FakeFinder package to the root directory of Emergency.

You now have a bootable diskette with considerable free space on it. Go ahead and add any other programs you want in the root directory of this disk, anything that will fit. My personal preference is to keep most of what’s on the Disk Tools floppy, and add my tape backup/restore software.

When you reboot with this diskette, FakeFinder loads and creates a File menu with only two items on it: Open and Quit.

To launch any program(s), select Open. This will let you select any applications, aliases to applications, and even a “real” Finder on any mounted drive - including CDs, if you copied the Apple CD-ROM Extension to the diskette.

To shut down your Mac, select Quit, and also quit any other applications you may have launched. Your Mac will then shut down normally.

Limitations
(or, This Ain’t No Swiss Army Knife)

To be so small, FakeFinder leaves a lot of stuff out. The most important limitations:

• No desk accesories/Apple Menu items.

• Without a real Finder present, you can’t use File Sharing.

• Programs needing to find a “Blessed Folder,” containing a real Finder and System, may not work.

The point of FakeFinder was to make it as small as possible, so I don’t plan to solve any of these problems.

By The Way: How Did It Get So Small?

Normally, to create an application this small, you would start in assembly language. But I don’t grok 68K assembler well enough to write anything from the ground up. So I wrote, compiled, linked, and tested FakeFinder using FORTRAN, a language I do know. Then I disassembled the compiler’s output, modified it to reduce the code size, and re-assembled it.

Disclaimers
(or, Anything Free Comes With No Guarantee)

Though FakeFinder works properly on every system I have tested so far, it may not work on tomorrow’s systems. This is because it uses the _Launch trap to sublaunch applications, and Apple says this functionality may go away in future OS releases. If and when that time comes, it will be necessary to rewrite any applications using the sublaunch facility.

References

Macintosh Tech Notes #126, #180, #205 (old numbering system).

MACHINE MC68000

; system routines used in this module

_AppendMenu     OPWORD  $A933
_DrawMenuBar    OPWORD  $A937
_ExitToShell    OPWORD  $A9F4
_FindWindow     OPWORD  $A92C
_HFSDispatch    OPWORD  $A260
_HiliteMenu     OPWORD  $A938
_InitCursor     OPWORD  $A850
_InitDialogs    OPWORD  $A97B
_InitFonts      OPWORD  $A8FE
_InitGraf       OPWORD  $A86E
_InitMenus      OPWORD  $A930
_InitWindows    OPWORD  $A912
_InsertMenu     OPWORD  $A935
_Launch         OPWORD  $A9F2
_MenuSelect     OPWORD  $A93D
_NewMenu        OPWORD  $A931
_StdFile        OPWORD  $A9EA
_SetVol         OPWORD  $A015
_WaitNextEvent  OPWORD  $A860

START:  MAIN

; make a stack, initialize managers, and set up menus

        link            a6,#-664

        lea             (266,a7),a2 ; qd.grafport
        move.l          a2,(a7)
        _InitGraf
        _InitFonts
        _InitWindows
        _InitMenus
        _InitDialogs
        _InitCursor

        lea             AppleMenu,a2
        move.l          a2,(a7)
        move.w          #$80,(4,a7)
        _NewMenu
        move.l          (a7),a3
        move.w          #0,(a7)
        move.l          a3,(2,a7)
        _InsertMenu
        lea             FileMenu,a2
        move.l          a2,(a7)
        move.w          #$81,(4,a7)
        _NewMenu
        move.l          (a7),a3
        move.w          #0,(a7)
        move.l          a3,(2,a7)
        _InsertMenu
        lea             MenuItems,a2
        move.l          a2,(a7)
        move.l          a3,(4,a7)
        _AppendMenu
        _DrawMenuBar

        sub.l           #36,a7

Loop:

; If (.NOT. WaitNextEvent(
;       VAL2(-1),event,VAL(15),VAL(0))) Loop

        move.l          #0,(a7)
        move.l          #15,(4,a7)
        lea             (288,a7),a2
        move.l          a2,(8,a7)
        move.w          #-1,(12,a7)
        _WaitNextEvent
        move.b          (a7),d3
        sub.l           #$000e,a7
        tst.b           d3
        beq.s           Loop

; If (event.what != mouseDown) Loop

        move.w          (288,a7),d3
        cmp.w           #1,d3
        bne.s           Loop

; If (FindWindow(
;       VAL(event.where),dummy) != inMenuBar) Loop

        lea             (272,a7),a2
        move.l          a2,(a7)
        move.l          (298,a7),(4,a7)
        _FindWindow
        move.w          (a7),d3
        sub.l           #8,a7
        cmp.w           #1,d3
        bne.s           Loop

; pick = MenuSelect(VAL(event.where))
; Call HiliteMenu(VAL2(0))

        move.l          (298,a7),(a7)
        _MenuSelect
        move.l          (a7),d3
        move.w          #0,(a7)
        _HiliteMenu
        sub.l           #6,a7

; If (pick == z'00810001') GetFile
; If (pick != z'00810002') Loop
; Call ExitToShell

        cmp.l           #$810001,d3
        beq.s           GetFile
        cmp.l           #$810002,d3
        bne.s           Loop

        _ExitToShell

GetFile:

; Call SFGetFile(
;       VAL(coords),0,VAL(0),VAL2(3),types,VAL(0),reply)

        lea             (304,a7),a2
        move.l          a2,(a7)
        move.l          #0,(4,a7)
        lea             types,a2
        move.l          a2,(8,a7)
        move.w          #3,(12,a7)
        move.l          #0,(14,a7)
        move.l          #0,(18,a7)
        move.l          #$00400040,(22,a7)
        move.w          #$2,-(a7)
        _StdFile
        sub.l           #$001a,a7

; If (.NOT. reply.good) Loop

        move.b          (304,a7),d3
        tst.b           d3
        beq.s           final

; myPB.p_ioName = LOC(reply.fName)
; myPB.ioVRefNum = reply.vRefNum
; myPB.ioFDirIndex = 0
; myPB.ioDirID = 0
; If (PBGetCatInfoSync(myPB) != 0) Loop

        lea             (314,a7),a2
        move.l          a2,(478,a7)
        move.w          (310,a7),(482,a7)
        move.l          #0,(488,a7)
        move.l          #0,(508,a7)
        lea             (460,a7),a2
        move.l          a2,(a7)
        movea.l         (a7)+,a0
        move.w          #9,d0
        _HFSDispatch
        sub.l           #4,a7
        tst.w           d0
        bne.s           final

; params.ioCompletion = 0
; params.ioResult = 0
; params.p_ioName = 0
; params.ioVRefNum = reply.vRefNum
; If(PBSetVolSync(params).LT.0) Loop

        move.l          #0,(392,a7)
        move.w          #0,(396,a7)
        move.l          #0,(398,a7)
        move.w          (310,a7),(402,a7)
        lea             (380,a7),a2
        move.l          a2,(a7)
        movea.l         (a7)+,a0
        _SetVol
        sub.l           #4,a7

; ap.pfName = LOC(reply.fName)
; ap.param = 0
; ap.LC = z'4C43'
; ap.extBlockLen = 6
; ap.fFlags = myPB.ioFlFndrInfo.fdFlags
; ap.launchFlags = z'C0000000'

        lea             (314,a7),a2
        move.l          a2,(568,a7)
        move.w          #0,(572,a7)
        move.w          #$4C43,(574,a7)
        move.l          #6,(576,a7)
        move.w          (500,a7),(580,a7)
        move.l          #$c0000000,(582,a7)

; ignore = launch(ap)

        lea             (568,a7),a2
        move.l          a2,(a7)
        movea.l         (a7)+,a0
        _Launch
        sub.l           #4,a7

final:  bra             Loop

; some constants embedded in code section

types: ; file types for getfile, what you can launch with FakeFinder

        dc.l            $4150504c ; APPL
        dc.l            $464e4452 ; FNDR
        dc.l            $61647270 ; adrp (application aliases)

AppleMenu: ; Apple Menu character, for appearances only!

        dc.b    1
        dc.b    20

FileMenu: ; Pascal String “File”

        dc.b    4
        dc.b    70
        dc.b    105
        dc.b    108
        dc.b    101
        dc.b    0 ; pad so next lands on even address

MenuItems: ; Pascal string “Open;Quit”

        dc.b    9
        dc.b    79
        dc.b    112
        dc.b    101
        dc.b    110
        dc.b    59
        dc.b    81
        dc.b    117
        dc.b    105
        dc.b    116

        ENDMAIN
        END

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Whitethorn Games combines two completely...
If you have ever gone fishing then you know that it is a lesson in patience, sitting around waiting for a bite that may never come. Well, that's because you have been doing it wrong, since as Whitehorn Games now demonstrates in new release Skate... | Read more »
Call of Duty Warzone is a Waiting Simula...
It's always fun when a splashy multiplayer game comes to mobile because they are few and far between, so I was excited to see the notification about Call of Duty: Warzone Mobile (finally) launching last week and wanted to try it out. As someone who... | Read more »
Albion Online introduces some massive ne...
Sandbox Interactive has announced an upcoming update to its flagship MMORPG Albion Online, containing massive updates to its existing guild Vs guild systems. Someone clearly rewatched the Helms Deep battle in Lord of the Rings and spent the next... | Read more »
Chucklefish announces launch date of the...
Chucklefish, the indie London-based team we probably all know from developing Terraria or their stint publishing Stardew Valley, has revealed the mobile release date for roguelike deck-builder Wildfrost. Developed by Gaziter and Deadpan Games, the... | Read more »
Netmarble opens pre-registration for act...
It has been close to three years since Netmarble announced they would be adapting the smash series Solo Leveling into a video game, and at last, they have announced the opening of pre-orders for Solo Leveling: Arise. [Read more] | Read more »
PUBG Mobile celebrates sixth anniversary...
For the past six years, PUBG Mobile has been one of the most popular shooters you can play in the palm of your hand, and Krafton is celebrating this milestone and many years of ups by teaming up with hit music man JVKE to create a special song for... | Read more »
ASTRA: Knights of Veda refuse to pump th...
In perhaps the most recent example of being incredibly eager, ASTRA: Knights of Veda has dropped its second collaboration with South Korean boyband Seventeen, named so as it consists of exactly thirteen members and a video collaboration with Lee... | Read more »
Collect all your cats and caterpillars a...
If you are growing tired of trying to build a town with your phone by using it as a tiny, ineffectual shover then fear no longer, as Independent Arts Software has announced the upcoming release of Construction Simulator 4, from the critically... | Read more »
Backbone complete its lineup of 2nd Gene...
With all the ports of big AAA games that have been coming to mobile, it is becoming more convenient than ever to own a good controller, and to help with this Backbone has announced the completion of their 2nd generation product lineup with their... | Read more »
Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »

Price Scanner via MacPrices.net

Deal Alert! B&H Photo has Apple’s 14-inch...
B&H Photo has new Gray and Black 14″ M3, M3 Pro, and M3 Max MacBook Pros on sale for $200-$300 off MSRP, starting at only $1399. B&H offers free 1-2 day delivery to most US addresses: – 14″ 8... Read more
Department Of Justice Sets Sights On Apple In...
NEWS – The ball has finally dropped on the big Apple. The ball (metaphorically speaking) — an antitrust lawsuit filed in the U.S. on March 21 by the Department of Justice (DOJ) — came down following... Read more
New 13-inch M3 MacBook Air on sale for $999,...
Amazon has Apple’s new 13″ M3 MacBook Air on sale for $100 off MSRP for the first time, now just $999 shipped. Shipping is free: – 13″ MacBook Air (8GB RAM/256GB SSD/Space Gray): $999 $100 off MSRP... Read more
Amazon has Apple’s 9th-generation WiFi iPads...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Discounted 14-inch M3 MacBook Pros with 16GB...
Apple retailer Expercom has 14″ MacBook Pros with M3 CPUs and 16GB of standard memory discounted by up to $120 off Apple’s MSRP: – 14″ M3 MacBook Pro (16GB RAM/256GB SSD): $1691.06 $108 off MSRP – 14... Read more
Clearance 15-inch M2 MacBook Airs on sale for...
B&H Photo has Apple’s 15″ MacBook Airs with M2 CPUs (8GB RAM/256GB SSD) in stock today and on clearance sale for $999 in all four colors. Free 1-2 delivery is available to most US addresses.... Read more
Clearance 13-inch M1 MacBook Airs drop to onl...
B&H has Apple’s base 13″ M1 MacBook Air (Space Gray, Silver, & Gold) in stock and on clearance sale today for $300 off MSRP, only $699. Free 1-2 day shipping is available to most addresses in... Read more
New promo at Visible: Buy a new iPhone, get $...
Switch to Visible, and buy a new iPhone, and Visible will take $10 off their monthly Visible+ service for 24 months. Visible+ is normally $45 per month. With this promotion, the cost of Visible+ is... Read more
B&H has Apple’s 13-inch M2 MacBook Airs o...
B&H Photo has 13″ MacBook Airs with M2 CPUs and 256GB of storage in stock and on sale for $100 off Apple’s new MSRP, only $899. Free 1-2 day delivery is available to most US addresses. Their... Read more
Take advantage of Apple’s steep discounts on...
Apple has a full line of 16″ M3 Pro and M3 Max MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free... Read more

Jobs Board

Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Business Analyst | *Apple* Pay - Banco Popu...
Business Analyst | Apple PayApply now " Apply now + Apply Now + Start applying with LinkedIn Start + Please wait Date:Mar 19, 2024 Location: San Juan-Cupey, PR Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.