home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d3xx
/
d346
/
gowb.lha
/
GoWB
/
GoWB.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-04-15
|
3KB
|
113 lines
/*
Replacement for
LOADWB
ENDCLI >nil:
use Lettuce-C V5.04
don't link with "c.o", it's not neccessary!
don't use GO, there seems to be a serious bug in the
lettuce package which causes a CXERR25 on LC2.
Freeware, © 1989 by
Oliver Wagner
Landsberge 5
4322 Sprockhövel
West Germany
All Rights Reserved!
Dieses Programm darf nicht von juristischen Personen genutzt
werden, die auf der "Schwarzen Liste" der PD-Anbieter stehen.
*/
#include <proto/exec.h>
#include <proto/dos.h>
/*
this structure is the msg send to the newly
created "workbench.task" process to start
up. LockList is not used in this context.
Please, don't use in any other code -
this is undocumented!!!!
All this information has been gathered by analyzing
the original CBM "LoadWB" (by the way: LoadWB is a C-programm
which has got all the necessary startup stuff to be run
from - Workbench :-) and the ARP "EndCLI" using the demonstration
version of "ReSource", an interactive disassembler.
*/
struct wbgo {
struct Message wbm;
struct Locklist *locks;
long debug;
};
/* proto */
void main(void);
void main()
{
/* open DOS */
struct Library *DOSBase=OldOpenLibrary("dos.library");
/* find the Workbench in ROM */
struct Resident *wbres=FindResident("workbench.task");
/* my process */
struct Process *pr=(struct Process*)FindTask(0);
/* my CLI */
struct CommandLineInterface *mycli=(struct CommandLineInterface*)(BADDR(pr->pr_CLI));
/* CLI-Output (must be closed for EndCLI */
BPTR cfh=mycli->cli_CurrentInput;
BPTR sfh=mycli->cli_StandardInput;
struct FileHandle *mfh=(struct FileHandle*)BADDR(sfh);
/* start workbench task */
struct Port *newproc=CreateProc("workbench.task",0,((long)wbres+0x2a)>>2,5000);
/* my very own process msg-port */
struct Port *myport=&pr->pr_MsgPort;
/* startup message */
struct wbgo wbmsg;
/* initialize startup message */
wbmsg.wbm.mn_ReplyPort=myport;
/* not used, for additional information only */
wbmsg.locks=0;
wbmsg.debug=0;
/* send Msg and wait for reply */
PutMsg(newproc,&wbmsg);
WaitPort(myport);
GetMsg(myport);
/* EndCLI */
/* close Input() and Output(), Batch-file */
mfh->fh_Pos=mfh->fh_End;
mfh->fh_End=0;
if(sfh!=cfh) {
mycli->cli_CurrentInput=sfh;
Close(cfh);
}
/* cancel CLI */
mycli->cli_Background=-1;
Exit(0);
}