Less sloppy handling of IoErr().
[AROS.git] / rom / intuition / getdefprefs.c
blob3509727741daf6a8fd82ee00cb9d2a19f0e7251b
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2013, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/exec.h>
8 #include <intuition/preferences.h>
9 #include "intuition_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <proto/intuition.h>
16 AROS_LH2(struct Preferences *, GetDefPrefs,
18 /* SYNOPSIS */
19 AROS_LHA(struct Preferences * , prefbuffer, A0),
20 AROS_LHA(WORD , size, D0),
22 /* LOCATION */
23 struct IntuitionBase *, IntuitionBase, 21, Intuition)
25 /* FUNCTION
26 Gets a copy of the Intuition default Preferences structure.
28 INPUTS
29 prefbuffer - The buffer which contains your settings for the
30 preferences.
31 size - The number of bytes of the buffer you want to be copied.
33 RESULT
34 Returns your parameter buffer.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
43 GetPrefs(), SetPrefs()
45 INTERNALS
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 DEBUG_GETDEFPREFS(dprintf("GetDefPrefs: Buffer 0x%lx Size 0x%lx Inform %d\n",
52 prefbuffer, size));
54 if (prefbuffer != NULL && size != 0)
56 ULONG lock = LockIBase(0);
58 CopyMem(&GetPrivIBase(IntuitionBase)->DefaultPreferences,
59 prefbuffer,
60 size <= sizeof(struct Preferences) ? size : sizeof(struct Preferences));
62 UnlockIBase(lock);
65 return (struct Preferences *)prefbuffer;
67 AROS_LIBFUNC_EXIT
68 } /* GetDefPrefs */