home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / changemode.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.5 KB  |  101 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: changemode.c,v 1.4 1997/01/27 00:36:14 ldp Exp $
  4.     $Log: changemode.c,v $
  5.     Revision 1.4  1997/01/27 00:36:14  ldp
  6.     Polish
  7.  
  8.     Revision 1.3  1996/12/09 13:53:21  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.2  1996/10/24 15:50:24  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.1  1996/09/11 12:54:45  digulla
  17.     A couple of new DOS functions from M. Fleischer
  18.  
  19.     Desc:
  20.     Lang: english
  21. */
  22. #include <proto/exec.h>
  23. #include <dos/dosextens.h>
  24. #include <dos/filesystem.h>
  25. #include "dos_intern.h"
  26.  
  27. /*****************************************************************************
  28.  
  29.     NAME */
  30. #include <proto/dos.h>
  31.  
  32.     AROS_LH3(BOOL, ChangeMode,
  33.  
  34. /*  SYNOPSIS */
  35.     AROS_LHA(ULONG, type,    D1),
  36.     AROS_LHA(BPTR,  object,  D2),
  37.     AROS_LHA(ULONG, newmode, D3),
  38.  
  39. /*  LOCATION */
  40.     struct DosLibrary *, DOSBase, 75, Dos)
  41.  
  42. /*  FUNCTION
  43.     Try to change the mode used by a lock or filehandle.
  44.  
  45.     INPUTS
  46.     type    - CHANGE_FH or CHANGE_LOCK.
  47.     object  - Filehandle or lock.
  48.     newmode - New mode.
  49.  
  50.     RESULT
  51.     !=0 if all went well, 0 else. IoErr() gives additional information
  52.     in that case.
  53.  
  54.     NOTES
  55.     Since filehandles and locks are identical under AROS the type
  56.     argument is ignored.
  57.  
  58.     EXAMPLE
  59.  
  60.     BUGS
  61.  
  62.     SEE ALSO
  63.  
  64.     INTERNALS
  65.  
  66.     HISTORY
  67.     29-10-95    digulla automatically created from
  68.                 dos_lib.fd and clib/dos_protos.h
  69.  
  70. *****************************************************************************/
  71. {
  72.     AROS_LIBFUNC_INIT
  73.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  74.  
  75.     /* Get pointer to filehandle */
  76.     struct FileHandle *fh=(struct FileHandle *)BADDR(object);
  77.  
  78.     /* Get pointer to process structure */
  79.     struct Process *me=(struct Process *)FindTask(NULL);
  80.  
  81.     /* Get pointer to I/O request. Use stackspace for now. */
  82.     struct IOFileSys io,*iofs=&io;
  83.  
  84.     /* Prepare I/O request. */
  85.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  86.     iofs->IOFS.io_Message.mn_ReplyPort   =&me->pr_MsgPort;
  87.     iofs->IOFS.io_Message.mn_Length      =sizeof(struct IOFileSys);
  88.     iofs->IOFS.io_Device =fh->fh_Device;
  89.     iofs->IOFS.io_Unit   =fh->fh_Unit;
  90.     iofs->IOFS.io_Command=FSA_FILE_MODE;
  91.     iofs->IOFS.io_Flags  =0;
  92.     iofs->io_Args[0]=newmode;
  93.  
  94.     /* Send the request. */
  95.     DoIO(&iofs->IOFS);
  96.     
  97.     /* Set error code and return */
  98.     return (me->pr_Result2=iofs->io_DosError)==0;
  99.     AROS_LIBFUNC_EXIT
  100. } /* ChangeMode */
  101.