
#ifndef __WINIOEX_IOCONTROLCODE_H__
#define __WINIOEX_IOCONTROLCODE_H__




typedef unsigned long ERRORCODE;


//-----------------------------------------------------
//ERROR_PKG.
typedef struct _ERR_PKG{	
	unsigned long	SRC;
	unsigned long	API;
	unsigned long	MSG;
}ERR_PKG, *PERR_PKG;


//-----------------------------------------------------
//Private Functions.
bool IsSuccessful(ERRORCODE _err_code);
ERRORCODE GErrorCode(unsigned long _source,unsigned long _api, unsigned long _msg);
ERRORCODE GErrorCode(ERR_PKG _err_pkg);
ERRORCODE GErrorCode(ERRORCODE _err_code);



//===========================================================
// [31:26] 6Bits
enum ERR_SRC
{
	//---------------------------	
	WINIOEX_SUCCESSFUL					= 0,
	WINIOEX_DRV_WINIOEX 				= 1,	//WINIOEX.sys

	//---------------------------
	WINIOEX_DLL_WINIOEX 				= 8,	//WINIOEX.dl

	//---------------------------
	WINIOEX_CLASS_NTDRIVERINSTALLER		= 48,
	
};


//===========================================================
// [21:11] 0~1023
enum ERR_API
{
	//Common.
	WINIOEX_API_SUCCESSFUL	=0,


	//--------------------------------------
	//Class - NtDriverInstall.	
	WINIOEX_API_GETHANDLE,
	WINIOEX_API_CREATEHANDLE,
	WINIOEX_API_CLOSEHANDLE,
	WINIOEX_API_INSTALLDRIVER,
	WINIOEX_API_STARTDRIVER,
	WINIOEX_API_REMOVEDRIVER,

	

	//WinIoEx.dll.
	PRIVATE_API_ISFIXEDDRIVE,
	WINIOEX_API_WINIOEXNOTREADY,
	WINIOEX_API_INIT,
	WINIOEX_API_UNINIT,
	WINIOEX_API_IOCONTROLEXECUTE,
	WINIOEX_API_AVAILABLE,
	WINIOEX_API_GETIOPORTUCHAR,
	WINIOEX_API_GETIOPORTUSHORT,
	WINIOEX_API_GETIOPORTULONG,
	WINIOEX_API_SETIOPORTUCHAR,
	WINIOEX_API_SETIOPORTUSHORT,
	WINIOEX_API_SETIOPORTULONG,
	WINIOEX_API_GETIOPORTUCHAREX,


	WINIOEX_API_GETPCIBUSUCHAR,
	WINIOEX_API_SETPCIBUSUCHAR,
	WINIOEX_API_GETPCIBUSULONG,
	WINIOEX_API_SETPCIBUSULONG,


	WINIOEX_API_GETCPUMSR,
	WINIOEX_API_SETCPUMSR,

	WINIOEX_API_GETMEMBLOCK,
	WINIOEX_API_SETMEMBLOCK,
	



};


//===========================================================
// [10:00] 0~1023
enum ERR_MSG
{
	//COMMON ......................................
	WINIOEX_MSG_SUCCESSFUL					= 0,
	
	
	WINIOEX_WIN32API_FAIL_SETCPUMASK,
	WINIOEX_WIN32API_FAIL_CLOSEHANDLE,
	
	WINIOEX_WIN32API_GetFullPathName,
	WINIOEX_WIN32API_IsNotFixedDrive,
	WINIOEX_WIN32API_RegCreateKeyEx,
	WINIOEX_WIN32API_RegSetValueEx,
	WINIOEX_WIN32API_OpenSCManager,
	WINIOEX_WIN32API_CreateService,
	WINIOEX_WIN32API_OpenService,
	WINIOEX_WIN32API_QueryServiceStatus,
	WINIOEX_WIN32API_ControlService,
	WINIOEX_WIN32API_StartService,
	WINIOEX_WIN32API_CreateFile,
	WINIOEX_WIN32API_CloseHandle,
	WINIOEX_WIN32API_DeleteService,

	//DLL ......................................
	WINIOEX_DLL_PATHWRONG,
	WINIOEX_DLL_INSTALLDRIVER_FAIL,
	WINIOEX_DLL_STARTDRIVER_FAIL,
	WINIOEX_DLL_CREATEHANDLE_FAIL,
	WINIOEX_DLL_CLOSEHANDLE_FAIL,
	WINIOEX_DLL_DRIVERHANDLE_NULL,
	WINIOEX_DLL_INIT_FAILED	,
	WINIOEX_DLL_LOADLIBRARY_FAILED,	
	WINIOEX_DLL_GETPROCESSADDR_FAILED,		
	WINIOEX_DLL_NOT_FOUND,

	//LOSS ......................................
	WINIOEX_LOSS_IOCTRLCODE,
	WINIOEX_LOSS_SWITCH,

	//FAIL ......................................
	WINIOEX_FAIL_NOINITIAL,
	WINIOEX_FAIL_IOCTRLCODE,
	WINIOEX_FAIL_NOTFIXEDDRIVE,
	

	//NULL ......................................
	WINIOEX_NULL_INPUTBUFFER,
	WINIOEX_NULL_OUTPUTBUFFER,
	WINIOEX_NULL_HANDLE,	
	WINIOEX_NULL_PARAMETERS,
	WINIOEX_NULL_WINIOEXHANDLE,


	WINIOEX_OVER_OUTOFBUFFERRANGE,
	WINIOEX_WRONG_INPUTBUFFERLENGTH,
	



	WINIOEX_NULL_OBJECT_OF_BUFFER,
	WINIOEX_NULL_PROCESSADDR,

	WINIOEX_BAD_ARGUMENTS,
	WINIOEX_BAD_COMMAND,
	WINIOEX_BAD_DEV_TYPE,
	WINIOEX_BAD_ENVIRONMENT,
	WINIOEX_BAD_LENGTH,
	WINIOEX_BAD_PATHNAME,

	WINIOEX_CANCEL_VIOLATION,
	WINIOEX_CANCELLED,
	WINIOEX_CANNOT_COPY,
	WINIOEX_CANTOPEN,
	WINIOEX_DEV_NOT_EXIST,
	WINIOEX_DEVICE_IN_USE,

	WINIOEX_OPEN_FAILED,
	WINIOEX_OPEN_FILES,

	WINIOEX_FILE_EXISTS,
	WINIOEX_FILE_INVALID,
	WINIOEX_FILE_NOT_FOUND,

	WINIOEX_ACCESS_DENIED,
	WINIOEX_ALREADY_EXISTS,
	WINIOEX_ALREADY_INITIALIZED,

	WINIOEX_BUSY,
	WINIOEX_ARITHMETIC_OVERFLOW,
	
	
	WINIOEX_INVALID_INDEX,
	WINIOEX_INVALID_HANDLE,
	WINIOEX_INVALID_FUNCTION,

	WINIOEX_INVALID_FLAGS,
	WINIOEX_INVALID_PARAMETER,
	WINIOEX_INVALID_PASSWORD,
	WINIOEX_INVALID_PRIORITY,
	WINIOEX_INVALID_TIME,
	WINIOEX_INVALID_CONFIG_SETTING,



	WINIOEX_NO_DATA,
	WINIOEX_NO_STRING,

	WINIOEX_NOT_ENOUGH_MEMORY,

	WINIOEX_NOT_READY,
	WINIOEX_NOT_SUPPORTED,
	


	WINIOEX_OUT_OF_BUFFER,
	WINIOEX_OUT_OF_STRUCTURES,
	WINIOEX_OUTOFMEMORY,
	WINIOEX_RETRY,


	WINIOEX_CREATEFILE_FAILED,
	WINIOEX_IOCONTROL_EXECUTE_FAILED,
	WINIOEX_IOCONTROL_CMDLESS_THAN_ZERO,
	WINIOEX_IOCONTROL_CMDTYPE_CASELOSS,	
	WINIOEX_NULL_HANDLER,
	
	WINIOEX_INDEX_OUTOFRANGE,
	WINIOEX_FALSE_ACTION,
	WINIOEX_FALSE_SetProcessAffinityMask,
	WINIOEX_NULL_FUNCTIONPOINT,	
	WINIOEX_FUNCTIONLIST_OUTOFRANGE,
	WINIOEX_FUNCTIONLIST_IS_ZERO,
	WINIOEX_TOO_SMALL_BUFFER,	
	WINIOEX_CONFFILE_NOT_EXIST,
	WINIOEX_CONFFILE_CORRUPT,
	WINIOEX_CONFFILE_HEADER_WARNING,
	WINIOEX_CONFFILE_PARSER_WARNING,
	WINIOEX_CONFFILE_OBJECT_EMPTY,
};




#endif


