2005-11-08 02:02:16 +00:00
|
|
|
/*
|
|
|
|
*
|
2006-09-15 14:55:39 +00:00
|
|
|
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
|
2005-11-08 02:02:16 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.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(¶m, 0, sizeof(ParamBlockRec));
|
|
|
|
|
|
|
|
param.ioNamePtr = (unsigned char*)name;
|
|
|
|
param.ioPermssn = fsCurPerm;
|
|
|
|
|
|
|
|
err = PBOpenSync(¶m);
|
|
|
|
if (err != noErr)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
*drvrRefNum = param.ioRefNum;
|
|
|
|
|
|
|
|
return param.ioResult;
|
|
|
|
}
|