One immediate problem is this: LOCAL FN FSpOpenRF(spec&,permission%,refNum%) END FN then call with osErr% = FN FSpOpenRF(@procSpec,_FSRdPerm,@myResFileID%) ??? The last parameter is supposed to be a pointer to a short (integer). A pointer is a long, so change the: > ` move.w ^refNum%,-(sp) to > ` move.l ^refNumPtr&,-(sp) and the LOCAL FN FSpOpenRF(spec&,permission%,refNum%) to LOCAL FN FSpOpenRF(spec&,permission%,refNumPtr&) Also, the first parameter is supposed to be a ptr to an FSSpec record, so you either need to pass it as: osErr% = FN FSpOpenRF(@procSpec,_FSRdPerm,@myResFileID%) or if it doesn't like the @ sign, use #@. Alternatively, you could define the function as: LOCAL FN FSpOpenRF(@spec&,permission%,@refNumPtr&) and call it as: osErr% = FN FSpOpenRF(procSpec,_FSRdPerm,myResFileID%) and let the compiler take the pointers for you. hth Chris Young On Sunday, November 21, 1999 10:42 PM, charlied@... [SMTP:charlied@...] wrote: > > Reply to: RE: [FB] vrefnum -> wdRefnum ? > > > >Charlie Dickman wrote: > > >FB friends, > > > > > >I'm using the following code snippet to try to open the resource > >file >of a running process but it doesn't seem to be working. I > >suspect >that the vrefnum returned in the ProcSpec record is not > >what >OPENRFPERM needs. Does this vrefnum have to be converted to > >a >WDrefnum and, if so, how is that done? > > > > > > >_might_ be easier to do this? (Unchecked): > > > > > >osErr% = FN FSpOpenRF(@procSpec,_FSRdPerm,@myResFileID%) > >PRINT "My Resource File ID:";myResFileID% > > > >LOCAL MODE > >LOCAL FN FSpOpenRF(spec&,permission%,refNum%) > > ` CLR.W -(SP) > > ` MOVE.L ^spec&,-(SP) ` MOVE.B > >^permission%,-(SP) ` MOVE.W ^refNum%,-(SP) > >` DC.W $7003,$AA52 > > ` MOVE.W (SP)+,D0 > > ` EXT.L D0 > >END FN = REGISTER(D0) > > > OK, I entered the code... > > LOCAL MODE > LOCAL FN FSpOpenRF(pSpec&, perm%, refNum%) > ` clr.w -(sp) > ` move.l ^pSpec&,-(sp) > ` move.b ^perm%,-(sp) > ` move.w ^refNum%,-(sp) > ` dc.w $7003,$aa52 > ` move.w (sp)+,d0 > ` ext.l d0 > END FN = REGISTER(d0) > > and then call it with > osErr% = FN FSpOpenRF(procSpec, _fsRdPerm, @resFileID%) 'the > compiler won't accept a @ in front of procSpec > > the result is a bus error. Since I don't understand the nuances of to > assembler code I'm sure there's a simple answer to "What am I doing > wrong?" > > > Charlie Dickman > charlied@... > > -- > To unsubscribe, send ANY message to <futurebasic-unsubscribe@...> > > << File: RE_ [FB] vrefnum -_ wdRefnum _.TXT >>