Blitz (103/640)

From:Curt Esser
Date:2 Sep 99 at 12:25:07
Subject:Re: Enforcer Hits

Hi Tony

On 02-Sep-99, Tony Rolfe wrote:
> I've just started using Enforcer to test my Motelmanager and have
> encountered a W*I*E*R*D hit.
>
> If I click into a blank area of the Workbench screen, or double-click
> an Icon on the workbench screen I get a couple of Long Reads from
> zero. Even if I've just started my machine from Cold!!
>
> Anyway, that's not -my- problem.
>
> My problem is, why does the "Program$ =" line below give a hit?
> Someone suggested this code to get my current program name, but I get
> one read from zero. Looking at the Task Newtype, I can't see
> anything which looks like a pointer to a program name.

It's in there somewhere - the code does work for me ;)
You could work out from the Task structure just where the offset $B0 is...

Anyway I have added a saftey check (just as you have in the "from CLI" part
in case it fails.

This is always a good idea for any routine like this.

> If FromCLI
> *stringbuffer.l = AllocMem_(255, 0)
> If GetProgramName_(*stringbuffer,255)
> Program$ = Peek$(*stringbuffer)
> EndIf
> FreeMem_ *stringbuffer,255
> Else
*mytask = FindTask_(0)
If *mytask
Program$ = Peek$(Peek.l(*mytask+$B0)+4) ;<---
EndIf
> EndIf

Later...



Love thy neighbour - but don't get caught.

Yours electronically,
Curt Esser
camge@ix.netcom.com
http://members.xoom.com/Curt_Esser/

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie