EMILE/libmacos/OpenDriver.c
2007-09-03 17:51:12 +00:00

37 lines
569 B
C

/*
*
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
*
*/
#include <string.h>
#include <sys/types.h>
#include <macos/devices.h>
/*
* OpenDriver:
*
* http://developer.apple.com/documentation/mac/Devices/Devices-23.html
*
*/
OSErr OpenDriver(ConstStr255Param name, short *drvrRefNum)
{
OSErr err;
ParamBlockRec param;
memset(&param, 0, sizeof(ParamBlockRec));
param.ioNamePtr = (unsigned char*)name;
param.ioPermssn = fsCurPerm;
err = PBOpenSync(&param);
if (err != noErr)
return err;
*drvrRefNum = param.ioRefNum;
return param.ioResult;
}