⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 neroapi.h

📁 本源码是通过调用NeroAPI实现刻录功能
💻 H
📖 第 1 页 / 共 5 页
字号:
/******************************************************************************
|* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|* PARTICULAR PURPOSE.
|* 
|* Copyright 1995-2004 Ahead Software AG. All Rights Reserved.
|*-----------------------------------------------------------------------------
|* NeroSDK / NeroAPI
|*
|* PROGRAM: NeroAPI.h
|*
|* PURPOSE: Main interface for Nero API DLL
******************************************************************************/
#ifndef _NEROAPI_
#define _NEROAPI_

#ifdef __cplusplus
extern "C"
{
#endif

   
/*
// If included within the glue code, then don't add special
// attributes to the functions.
*/
#define NADLL_ATTR  __cdecl
#ifdef __NEROAPIGLUE__
	#define NEROAPI_API
#else

	/* NEROAPI must not be defined when using the DLL */
	#ifdef NEROAPI
		#define NEROAPI_API __declspec(dllexport)
	#else
		#define NEROAPI_API __declspec(dllimport)
	#endif /* NEROAPI */

#endif /* __NEROAPIGLUE__ */

#ifdef  __cplusplus
class CSourceDriveInfo;
typedef CSourceDriveInfo *NERO_DEVICEHANDLE;
#else
typedef void *NERO_DEVICEHANDLE;
#endif


#include <windows.h> // the data types used below are those of windows
   
#include <time.h>

#include "NeroUserDialog.h"


#if defined(__BORLANDC__)
// NEROAPI expects structs to be 8byte aligned
#pragma pack(push, 8) 
// tell Borland C++ Builder to treat enums as int
#pragma option push -b 
#endif


/*
// The NeroAPI never uses static memory. Instead, memory is allocated
// dynamically on behalf of the application, e.g. for strings. This
// memory has to be freed with this function.
//
// Passing a NULL is allowed.
*/
NEROAPI_API void NADLL_ATTR NeroFreeMem (void *pMem);


/*
// All functions returning an DWORD will return 0 for success and a
// error number otherwise. This error numbers are opaque and neither
// can nor should be interpreted by the application. Instead, localized
// strings are provided for errors and informative displays.
//
// The NeroAPI keeps a log of such informative messages or errors.

// In case of an error, NeroGetLastError() will return more information
// about the last error and NeroGetErrorLog() will show all recorded
// events.
//
// Both functions return NULL if no error is available.
//
// Memory is allocated for the string, which has to be freed with NeroFreeMem().
//
// Note: NeroCloseDrive() has to throw away all errors, because they 
//       might be bound to the driver. Handle errors before calling it!
*/
NEROAPI_API char * NADLL_ATTR NeroGetLastError ();
NEROAPI_API char * NADLL_ATTR NeroGetErrorLog ();

/* NeroAPI >= 6.0.0.29: returns the last iNum errors */
NEROAPI_API char * NADLL_ATTR NeroGetLastErrors(int iNum, DWORD dwFlags, void *reserved);

/* include also errors which does not contain a description to be shown in the GUI */
#define NGLE_ALL (1<<0) 
/* format the errors as in the NeroAPI error log */
#define NGLE_REPORT (1<<1) 



/*
// NeroAPI >= 6.0.0.0:
// Error code describing an error happened during communication with a drive.
// This error code is returned by NeroIsDeviceReady. Other functions set an internal error
// variable to one of these codes if an error occured. This error can be received with
// NeroGetLastDriveError.
*/
typedef enum
{
   NDE_NO_ERROR  = 0, // no error occured/ drive is ready
   NDE_GENERIC_ERROR = 1, // generic error, not handled with other enums
   NDE_DRIVE_IN_USE = 2, // drive cannot be locked, maybe a other application uses this drive at the moment
   NDE_DRIVE_NOT_READY = 3, // drive is not ready
   NDE_NO_DRIVE = 4, // The given device is not available . Probably removed by the user (USB/Firewire)
   NDE_DISC_NOT_PRESENT = 5, // no medium in drive, status of tray unknown
   NDE_DISC_NOT_PRESENT_TRAY_OPEN = 6, // no medium - tray open
   NDE_DISC_NOT_PRESENT_TRAY_CLOSED = 7 // no medium - tray closed
} NERO_DRIVE_ERROR;

// Check for all variations of 'disc not present'
#define DISC_NOT_PRESENT(x)	(((x == NDE_DISC_NOT_PRESENT) || \
								  (x == NDE_DISC_NOT_PRESENT_TRAY_CLOSED) || \
								  (x == NDE_DISC_NOT_PRESENT_TRAY_OPEN)) ? TRUE : FALSE)

/*
// NeroAPI >= 6.0.0.0:
// get the last error occured during communication with a drive
// 
// The following methods set this error value:
//  - NeroGetCDInfo
//  - NeroImportDataTrack
//  - NeroEjectLoadCD
//  - NeroGetCDRWErasingTime
//  - NeroEraseDisc
//
// All these methods first reset the error value and if an error occured the value is set
// accordingly.
*/
NEROAPI_API void NADLL_ATTR NeroGetLastDriveError( NERO_DRIVE_ERROR *driveError, void *reserved);


/*
// Clear errors and log (done automatically for every read or write function,
// but can be used to avoid false memory leak warnings).
*/
NEROAPI_API void NADLL_ATTR NeroClearErrors ();


/*
// Version management for this API:
*/

// This file is the interface for this version of NeroAPI
#define NEROAPI_VERSION_MAJOR_HIGH		6
#define NEROAPI_VERSION_MAJOR_LOW		3
#define NEROAPI_VERSION_MINOR_HIGH		1
#define NEROAPI_VERSION_MINOR_LOW		4

/* Fills the pointed numbers with version number and returns true for 
   success. Extended in NeroAPI 5.5.9.9 to support multiple digits */
NEROAPI_API BOOL NADLL_ATTR NeroGetAPIVersionEx(WORD *majhi
											   ,WORD *majlo
											   ,WORD *minhi
											   ,WORD *minlo
											   ,void *reserved);  // Must be NULL

/* Using this function, an application can tell NeroAPI for which version of NeroAPI it was
designed to work. NeroAPI will then tries to behave as this version as much as possible. This
ensures the binary compatibility with future versions of NeroAPI. If this function is not called,
NeroAPI will behaves as NeroAPI 5.0.3.9. If your application uses NeroAPIGlue.c, this function
will be automatically called. Extended in NeroAPI 5.5.9.9 to support multiple digits 

If pPrevExpectedVersion is not NULL, it must point onto an array of 4 WORDs that will be filled
with the previously expected version number

Returns true for success*/
NEROAPI_API BOOL NADLL_ATTR NeroSetExpectedAPIVersionEx(WORD majhi
                                                       ,WORD majlo
													   ,WORD minhi
													   ,WORD minlo
													   ,WORD *pPrevExpectedVersion);

/*
// During writing or in several long running functions control
// is transfered to the DLL. The application has to provide services
// and dialog with the user via callback functions.
//
// NERO_CALLBACK_ATTR is defined in "NeroUserDialog.h" and ensures that
// the same conventions are used for passing of parameters.
*/
typedef struct tag_NERO_CALLBACK
{
	void *ncCallbackFunction; /* actually, this is a pointer to one of several different callback functions defined below */
	void *ncUserData;         /* this will be passed to the function as first parameter */
} NERO_CALLBACK;

typedef BOOL (NERO_CALLBACK_ATTR *NERO_IDLE_CALLBACK) (void *pUserData); /* called regularly during long running activities; return TRUE if this activity shall be aborted */


/*
// The NeroAPI needs some information:
*/
typedef struct tag_NERO_SETTINGS
{
	const char *nstNeroFilesPath;   /* directory name with trailing '\' of where to find the additional Nero DLL and text files */
   
	const char *nstVendor,
		*nstSoftware;               /* path for registry settings (use "ahead", "Nero - Burning Rom" for Nero application's settings) */
	const char *nstLanguageFile;    /* name of the Nero language file; relativ to nstNeroFilesPath (e.g. "Nero.txt") */
	NERO_CALLBACK nstIdle;          /* NERO_IDLE_CALLBACK, may be NULL */
	NERO_CALLBACK nstUserDialog;    /* NERO_USER_DIALOG, must not be NULL, see "NeroUserDialog.h" for details */

	/*
	// overburn settings:
	// overburning (writing more than the nominal capacity of a disc) is allowed if:
	//  - nstEnableOverburn == TRUE
	//  - nstOverburnSize >= amount of required blocks for compilation
	// and if
	//  - the drive supports it
	//  - DAO is used.
	// Even then, overburning has to be acknowledged via callback (see DLG_OVERBURN in "NeroUserDialog.h").
	*/
	BOOL  nstEnableOverburn;
	DWORD nstOverburnSize;    /* in blocks */
} NERO_SETTINGS;


/*
// Initialize the DLL. Must be successful before any of the remaining
// functions can be called. Settings structure and strings it points
// to are _not_ copied and function callbacks must be available all
// the time.
*/

typedef enum
{
	NEROAPI_INIT_OK=0,
	NEROAPI_INIT_INVALID_ARGS,
	NEROAPI_INIT_UNSPECIFIED_ERROR,					// Unspecified error
	NEROAPI_INIT_INVALID_SERIAL_NUM,
	NEROAPI_INIT_DEMOVERSION_EXPIRED,
	NEROAPI_INIT_ALREADY_INITIALISED,				
	NEROAPI_INIT_CANNOT_LOCK						
} NEROAPI_INIT_ERROR;

// Make sure to keep *all* the data including the strings valid as long as you're using NeroAPI,
// since Nero will only store a pointer to this structure, not make a copy.
NEROAPI_API NEROAPI_INIT_ERROR NADLL_ATTR NeroInit (const NERO_SETTINGS *pNeroSettings,const char *reserved);


/*
// Call this function before closing the DLL. This is necessary because
// some clean-up actions like stopping threads cannot be done in the
// close function of the DLL.
//
// NeroDone returns TRUE if some memory blocks were not unallocated using NeroFreeMem. They are dumped in
// the debug output.
// NeroDone returns FALSE if it succeeded
*/
NEROAPI_API BOOL NADLL_ATTR NeroDone ();

/*
Call this function to change a global option of NeroAPI
*/

typedef enum
{
	NEROAPI_OPTION_MSG_FILE_NAME,		// Set the language file. The value points to a string containing the file name. This adress will be kept.
	NEROAPI_OPTION_WRITE_BUFFER_SIZE,	// Set write buffer size. Value points onto an integer containing the size in byte
	
	// NeroAPI>=6.0.0.0 Set the user dialog callback, overwriting nstUserDialog of the settings
	// structure passed to NeroInit. 
	// Pass a pointer to a NERO_CALLBACK structure as value. After returning,
	// the struct will contain the previous user callback.
	NEROAPI_OPTION_USER_DLG_CALLBACK,		
	// NeroAPI>=6.0.0.0 Set the idle callback, overwriting nstIdle of the settings
	// structure passed to NeroInit. 
	// Pass a pointer to a NERO_CALLBACK structure as value. After returning,
	// the struct will contain the previous idle callback.
	NEROAPI_OPTION_IDLE_CALLBACK,

	// NeroAPI>=6.0.0.27: Enable/Disable overburning.
	// Value points to a DWORD containing the overburn size in blocks. If the
	// value is NULL, disable overburning.
	NEROAPI_OPTION_OVERBURN

} NEROAPI_OPTION;

NEROAPI_API int NADLL_ATTR NeroSetOption(NEROAPI_OPTION option,void *value);


/*
// Code to scan the SCSI/IDE bus and get information about
// the available WORM/CDROM drives:
*/

typedef enum
{       
	NEA_SCSI_DEVTYPE_UNKNOWN,
	NEA_SCSI_DEVTYPE_WORM,      /* can write */
	NEA_SCSI_DEVTYPE_CDROM,     /* can only read */
	NEA_SCSI_DEVTYPE_UNSUPPORTED_WORM	/* can write but is not supported by NeroAPI */
} NEROAPI_SCSI_DEVTYPE;

typedef struct tag_NERO_SPEED_INFOS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -