mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
456 lines
14 KiB
456 lines
14 KiB
// emsvc.idl : IDL source for emsvc.dll
|
|
//
|
|
|
|
// This file will be processed by the MIDL tool to
|
|
// produce the type library (emsvc.tlb) and marshalling code.
|
|
#define EM_MAX_PATH 256
|
|
|
|
import "oaidl.idl";
|
|
import "ocidl.idl";
|
|
|
|
[
|
|
uuid(93409732-67DE-4B5F-BCEA-ADEF6D8F5596),
|
|
version(1.0),
|
|
helpstring("emsvc 1.0 Type Library")
|
|
]
|
|
library EMSVCLib
|
|
{
|
|
importlib("stdole2.tlb");
|
|
|
|
//
|
|
// Debug Session Types
|
|
//
|
|
typedef enum SessionType {
|
|
SessType_Automatic,
|
|
// SessType_Recursive,
|
|
SessType_Manual
|
|
} SessionType;
|
|
|
|
enum DebugExLParams {
|
|
|
|
// When this flag is set, Automatic session will
|
|
// be started in recursive mode.
|
|
RECURSIVE_MODE = 1 << 0,
|
|
|
|
// If this flag is set, mini dump will be
|
|
// generated soon after the session gets started.
|
|
PRODUCE_MINI_DUMP = 1 << 1,
|
|
|
|
// User dump will be generated soon after the
|
|
// session gets started.
|
|
PRODUCE_USER_DUMP = 1 << 2,
|
|
|
|
//
|
|
BLOCK_INCOMING_IPCALLS = 1 << 3,
|
|
};
|
|
|
|
//
|
|
// Objects in the EM System
|
|
//
|
|
typedef enum EmObjectType {
|
|
|
|
// invalid object
|
|
EMOBJ_UNKNOWNOBJECT = 0,
|
|
|
|
// Services registered in the system
|
|
EMOBJ_SERVICE = 1<<0,
|
|
|
|
// Running processes (precludes Services)
|
|
EMOBJ_PROCESS = 1<<1,
|
|
|
|
// Log files created by dbgengine
|
|
EMOBJ_LOGFILE = 1<<2,
|
|
|
|
// Mini Dump files created by dbgengine
|
|
EMOBJ_MINIDUMP = 1<<3,
|
|
|
|
// User Dump files created by dbgengine
|
|
EMOBJ_USERDUMP = 1<<4,
|
|
|
|
// ecx files
|
|
EMOBJ_CMDSET = 1<<5,
|
|
|
|
// msinfo files
|
|
EMOBJ_MSINFO = 1<<6
|
|
|
|
} EmObjectType;
|
|
|
|
//
|
|
// EmObject Fields
|
|
//
|
|
typedef enum EmObjectFields {
|
|
|
|
// "type" of the EmObject
|
|
EMOBJ_FLD_TYPE = 1<<0,
|
|
|
|
// "type2" of the EmObject
|
|
EMOBJ_FLD_TYPE2 = 1<<1,
|
|
|
|
// "guidstream" of the EmObject
|
|
EMOBJ_FLD_GUIDSTREAM = 1<<2,
|
|
|
|
// "nId" of the EmObject
|
|
EMOBJ_FLD_NID = 1<<3,
|
|
|
|
// "szName" of the EmObject
|
|
EMOBJ_FLD_SZNAME = 1<<4,
|
|
|
|
// "szSecName" of the EmObject
|
|
EMOBJ_FLD_SZSECNAME = 1<<5,
|
|
|
|
// "nStatus" of the EmObject
|
|
EMOBJ_FLD_NSTATUS = 1<<6,
|
|
|
|
// "dateStart" of the EmObject
|
|
EMOBJ_FLD_DATESTART = 1<<7,
|
|
|
|
// "dateEnd" of the EmObject
|
|
EMOBJ_FLD_DATEEND = 1<<8,
|
|
|
|
// "szBucket1" of the EmObject
|
|
EMOBJ_FLD_SZBUCKET1 = 1<<9,
|
|
|
|
// "dwBucket1" of the EmObject
|
|
EMOBJ_FLD_DWBUCKET1 = 1<<10,
|
|
|
|
// "hr" of the EmObject
|
|
EMOBJ_FLD_HR = 1<<11,
|
|
|
|
// all the members of EmObject
|
|
EMOBJ_FLD_ALL = 0xffff,
|
|
|
|
// none of the members of EmObject
|
|
EMOBJ_FLD_NONE = 0x0
|
|
|
|
} EmObjectFields;
|
|
|
|
//
|
|
// EmObject layout
|
|
//
|
|
typedef struct EmObject {
|
|
|
|
// EmObjectType
|
|
short type;
|
|
|
|
// type2
|
|
short type2;
|
|
|
|
// GUID
|
|
unsigned char guidstream [ 16 ];
|
|
|
|
// numeric id
|
|
LONG nId;
|
|
|
|
// Basic name of this object
|
|
TCHAR szName [ EM_MAX_PATH ];
|
|
|
|
// Secondary name
|
|
TCHAR szSecName [ EM_MAX_PATH ];
|
|
|
|
// Status of this object
|
|
LONG nStatus;
|
|
|
|
// Start time
|
|
DATE dateStart;
|
|
|
|
// End time
|
|
DATE dateEnd;
|
|
|
|
// general purpose storage
|
|
TCHAR szBucket1 [64];
|
|
|
|
// general purpose storage
|
|
DWORD dwBucket1;
|
|
|
|
// error value recorded when an error occurs
|
|
HRESULT hr;
|
|
|
|
} EmObject, *PEmObject, **PPEmObject;
|
|
|
|
//
|
|
// Column definition
|
|
// - EMOBJ_SERVICE
|
|
// - EMOBJ_PROCESS
|
|
//
|
|
enum {
|
|
EXE_COL_TYPE,
|
|
EXE_COL_ID,
|
|
EXE_COL_NAME,
|
|
EXE_COL_DESCRIPTION,
|
|
EXE_COL_STATUS,
|
|
EXE_COL_STARTDATE,
|
|
EXE_COL_ENDDATE,
|
|
};
|
|
|
|
//
|
|
// Column definition
|
|
// - EMOBJ_LOGFILE
|
|
// - EMOBJ_USERDUMP
|
|
// - EMOBJ_MINIDUMP
|
|
// - EMOBJ_CMDSET
|
|
enum {
|
|
FILE_COL_TYPE,
|
|
FILE_COL_NAME,
|
|
FILE_COL_SIZE,
|
|
FILE_COL_DESCRIPTION,
|
|
};
|
|
|
|
//
|
|
// Object Status - EmStatusHiWord + EmStatusLoWord
|
|
// CAUTION : EmStatusLoWord should not exceed 16 bits.
|
|
//
|
|
typedef enum EmStatusHiWord {
|
|
|
|
//
|
|
STAT_SESS_NONE = 1 << 16,
|
|
|
|
// The session has not yet started..
|
|
STAT_SESS_NOT_STARTED = 1 << 17,
|
|
|
|
// Debug session has been started and is in progress
|
|
STAT_SESS_DEBUG_IN_PROGRESS = 1 << 18,
|
|
|
|
// Debug session has stopped.
|
|
STAT_SESS_STOPPED = 1 << 19,
|
|
|
|
} EmStatusHiWord;
|
|
|
|
typedef enum EmStatusLoWord {
|
|
|
|
//
|
|
STAT_NONE = 0,
|
|
|
|
//
|
|
// This state is applicable to sessions that have been
|
|
// started but the master is dead without calling
|
|
// CloseSession..
|
|
// CAUTION !!! Take care to see that any new state added
|
|
// do this item is with in 0 to 14th bit of the lo word.
|
|
//
|
|
STAT_ORPHAN = 1 << 15,
|
|
|
|
//
|
|
// The following 2 states are valid only when the
|
|
// hi word is STAT_SESS_NOT_STARTED
|
|
//
|
|
|
|
// The debuggee is not running.
|
|
STAT_NOTRUNNING = 1 << 0,
|
|
|
|
// The debuggee is running.
|
|
STAT_RUNNING = 1 << 1,
|
|
|
|
//
|
|
// The following 2 states are valid only when the
|
|
// hi word is STAT_SESS_DEBUG_IN_PROGRESS
|
|
//
|
|
|
|
// The requested file was created successfully
|
|
STAT_FILECREATED_SUCCESSFULLY = 1 << 2,
|
|
|
|
// The file creation process failed.
|
|
STAT_FILECREATION_FAILED = 1 << 3,
|
|
|
|
//
|
|
// The follwing states are valid only when the
|
|
// hi word is STAT_SESS_STOPPED
|
|
//
|
|
|
|
//
|
|
STAT_SUCCESS = 1 << 4,
|
|
|
|
//
|
|
STAT_FAILED = 1 << 5,
|
|
|
|
// The debuggee in a debugging session was killed externally
|
|
STAT_DEBUGGEE_KILLED = 1 << 6,
|
|
|
|
// The debuggee exited.
|
|
STAT_DEBUGGEE_EXITED = 1 << 7,
|
|
|
|
// The debuggee caused an exception to occur.
|
|
STAT_EXCEPTION_OCCURED = 1 << 8,
|
|
|
|
// The debuggee caused an access violation.
|
|
STAT_ACCESSVIOLATION_OCCURED = 1 << 9,
|
|
|
|
} EmStatusLoWord;
|
|
|
|
typedef enum EmSessionStatus {
|
|
|
|
// Session status NONE
|
|
STAT_SESS_NONE_STAT_NONE = STAT_SESS_NONE + STAT_NONE,
|
|
|
|
// Session is not started and the process is not running.
|
|
STAT_SESS_NOT_STARTED_NOTRUNNING = STAT_SESS_NOT_STARTED + STAT_NOTRUNNING,
|
|
|
|
// Session is not started and the process is running.
|
|
STAT_SESS_NOT_STARTED_RUNNING = STAT_SESS_NOT_STARTED + STAT_RUNNING,
|
|
|
|
// Session is not started and the file got create successfully.
|
|
STAT_SESS_NOT_STARTED_FILECREATED_SUCCESSFULLY = STAT_SESS_NOT_STARTED + STAT_FILECREATED_SUCCESSFULLY,
|
|
|
|
// Session is not started and the file creation failed.
|
|
STAT_SESS_NOT_STARTED_FILECREATION_FAILED = STAT_SESS_NOT_STARTED + STAT_FILECREATION_FAILED,
|
|
|
|
// Debug session is proceeding without events but the session has been orphaned.
|
|
STAT_SESS_DEBUG_IN_PROGRESS_ORPHAN_NONE = STAT_SESS_DEBUG_IN_PROGRESS + STAT_ORPHAN + STAT_NONE,
|
|
|
|
// Debug session is active and the file was created successfully but the session has been orphaned.
|
|
STAT_SESS_DEBUG_IN_PROGRESS_ORPHAN_FILECREATED_SUCESSFULLY = STAT_SESS_DEBUG_IN_PROGRESS + STAT_ORPHAN + STAT_FILECREATED_SUCCESSFULLY,
|
|
|
|
// Debug sessoin is active but the file did not get created successfully and the session has been orphaned.
|
|
STAT_SESS_DEBUG_IN_PROGRESS_ORPHAN_FILECREATION_FAILED = STAT_SESS_DEBUG_IN_PROGRESS + STAT_ORPHAN + STAT_FILECREATION_FAILED,
|
|
|
|
// Session has been stopped successfully, but the session has been orphaned
|
|
STAT_SESS_STOPPED_ORPHAN_SUCCESS = STAT_SESS_STOPPED + STAT_ORPHAN + STAT_SUCCESS,
|
|
|
|
// Session could not be stopped successfully and the session has been orphaned
|
|
STAT_SESS_STOPPED_ORPHAN_FAILED = STAT_SESS_STOPPED + STAT_ORPHAN + STAT_FAILED,
|
|
|
|
// Debug session is stopped because the debuggee was killed and the session has been orphaned.
|
|
STAT_SESS_STOPPED_ORPHAN_DEBUGGEE_KILLED = STAT_SESS_STOPPED + STAT_ORPHAN + STAT_DEBUGGEE_KILLED,
|
|
|
|
// Debug session is stopped because the debuggee exited and the session has been orphaned.
|
|
STAT_SESS_STOPPED_ORPHAN_DEBUGGEE_EXITED = STAT_SESS_STOPPED + STAT_ORPHAN + STAT_DEBUGGEE_EXITED,
|
|
|
|
// Debug session is stopped because the debuggee caused an exception and the session has been orphaned.
|
|
STAT_SESS_STOPPED_ORPHAN_EXCEPTION_OCCURED = STAT_SESS_STOPPED + STAT_ORPHAN + STAT_EXCEPTION_OCCURED,
|
|
|
|
// Debug session is stopped because the debuggee caused an access violation and the session has been orphaned.
|
|
STAT_SESS_STOPPED_ORPHAN_ACCESSVIOLATION_OCCURED = STAT_SESS_STOPPED + STAT_ORPHAN + STAT_ACCESSVIOLATION_OCCURED,
|
|
|
|
// Debug session is proceeding without events.
|
|
STAT_SESS_DEBUG_IN_PROGRESS_NONE = STAT_SESS_DEBUG_IN_PROGRESS + STAT_NONE,
|
|
|
|
// Debug session is active and the file was created successfully.
|
|
STAT_SESS_DEBUG_IN_PROGRESS_FILECREATED_SUCESSFULLY = STAT_SESS_DEBUG_IN_PROGRESS + STAT_FILECREATED_SUCCESSFULLY,
|
|
|
|
// Debug sessoin is active but the file did not get created successfully.
|
|
STAT_SESS_DEBUG_IN_PROGRESS_FILECREATION_FAILED = STAT_SESS_DEBUG_IN_PROGRESS + STAT_FILECREATION_FAILED,
|
|
|
|
//
|
|
STAT_SESS_STOPPED_SUCCESS = STAT_SESS_STOPPED + STAT_SUCCESS,
|
|
|
|
//
|
|
STAT_SESS_STOPPED_FAILED = STAT_SESS_STOPPED + STAT_FAILED,
|
|
|
|
// Debug session is stopped because the debuggee was killed.
|
|
STAT_SESS_STOPPED_DEBUGGEE_KILLED = STAT_SESS_STOPPED + STAT_DEBUGGEE_KILLED,
|
|
|
|
// Debug session is stopped because the debuggee exited.
|
|
STAT_SESS_STOPPED_DEBUGGEE_EXITED = STAT_SESS_STOPPED + STAT_DEBUGGEE_EXITED,
|
|
|
|
// Debug session is stopped because the debuggee caused an exception.
|
|
STAT_SESS_STOPPED_EXCEPTION_OCCURED = STAT_SESS_STOPPED + STAT_EXCEPTION_OCCURED,
|
|
|
|
// Debug session is stopped because the debuggee caused an access violation.
|
|
STAT_SESS_STOPPED_ACCESSVIOLATION_OCCURED = STAT_SESS_STOPPED + STAT_ACCESSVIOLATION_OCCURED,
|
|
|
|
} EmSessionStatus;
|
|
|
|
[
|
|
object,
|
|
uuid(74FA475F-492D-406E-B267-BBCB28AF262A),
|
|
dual,
|
|
helpstring("IEmDebugSession Interface"),
|
|
pointer_default(unique)
|
|
]
|
|
interface IEmDebugSession : IDispatch
|
|
{
|
|
[id(1), helpstring("method Debug")] HRESULT Debug([in, out] BSTR bstrEmObj, [in] SessionType eSessType);
|
|
[id(2), helpstring("method StopDebug")] HRESULT StopDebug([in] BOOL bForceStop);
|
|
[id(3), helpstring("method GenerateDumpFile")] HRESULT GenerateDumpFile([in] UINT nDumpType);
|
|
[id(4), helpstring("method GetStatus")] HRESULT GetStatus([in, out] BSTR bstrEmObj);
|
|
[id(5), helpstring("method DebugEx")] HRESULT DebugEx([in, out] BSTR bstrEmObj, [in] SessionType eSessType, [in] BSTR bstrEcxFilePath, [in] LONG lParam, [in, optional] VARIANT vtUserName, [in, optional] VARIANT vtPassword, [in, optional] VARIANT vtPort, [in, optional] VARIANT vtNotifyAdmin, [in, optional] VARIANT vtAltSymPath);
|
|
[id(6), helpstring("method CancelDebug")] HRESULT CancelDebug([in] BOOL bForceCancel);
|
|
[id(7), helpstring("method TakeOwnerShip")] HRESULT AdoptOrphan();
|
|
};
|
|
[
|
|
object,
|
|
uuid(1B60057D-B15A-4A30-A1FC-905B6AF24FB4),
|
|
dual,
|
|
helpstring("IEmManager Interface"),
|
|
pointer_default(unique)
|
|
]
|
|
interface IEmManager : IDispatch
|
|
{
|
|
[id(1), helpstring("method EnumObjects")] HRESULT EnumObjects([in] EmObjectType eObjectType, [out] VARIANT *lpVariant);
|
|
[id(2), helpstring("method OpenSession")] HRESULT OpenSession([in, out] BSTR bstrEmObj, [out]IEmDebugSession **ppEmDebugSession);
|
|
[id(3), helpstring("method DeleteSession")] HRESULT DeleteSession([in] BSTR bstrEmObj);
|
|
[id(4), helpstring("method EnumObjectsEx")] HRESULT EnumObjectsEx([in] BSTR bstrEmObj, [out] VARIANT *lpVariant);
|
|
[id(5), helpstring("method GetEmFileInterface")] HRESULT GetEmFileInterface([in] BSTR bstrEmObj, [out] IStream **ppstrm);
|
|
[id(6), helpstring("method GenerateDumpFile")] HRESULT GenerateDumpFile(BSTR bstrEmObj, UINT nDumpType);
|
|
[id(7), helpstring("method DeleteFile")] HRESULT DeleteFile([in, out] BSTR bstrEmObj);
|
|
[id(8), helpstring("method MakeNFO")] HRESULT MakeNFO([in] BSTR bstrPath, [in] BSTR bstrMachineName, [in] BSTR bstrCategories);
|
|
};
|
|
|
|
[
|
|
uuid(32305ED8-359D-45C9-B996-74A97858B048),
|
|
helpstring("_IEmManagerEvents Interface")
|
|
]
|
|
dispinterface _IEmManagerEvents
|
|
{
|
|
properties:
|
|
methods:
|
|
};
|
|
|
|
[
|
|
uuid(8424B9F5-6682-44D8-8D73-9BFEDE59DDC5),
|
|
helpstring("EmManager Class")
|
|
]
|
|
coclass EmManager
|
|
{
|
|
[default] interface IEmManager;
|
|
[default, source] dispinterface _IEmManagerEvents;
|
|
};
|
|
[
|
|
uuid(8E2EE030-5E0C-481B-974D-510CA090F100),
|
|
helpstring("_IEmDebugSessionEvents Interface")
|
|
]
|
|
dispinterface _IEmDebugSessionEvents
|
|
{
|
|
properties:
|
|
methods:
|
|
};
|
|
[
|
|
object,
|
|
uuid(3939636C-5C12-44F6-A7F8-8FE5ECF46672),
|
|
dual,
|
|
helpstring("IEmFile Interface"),
|
|
pointer_default(unique)
|
|
]
|
|
interface IEmFile : IDispatch
|
|
{
|
|
[id(1), helpstring("method Read")] HRESULT Read([out] void *pv, [in] ULONG cb, [out] ULONG *pcbRead);
|
|
[id(2), helpstring("method Write")] HRESULT Write([in] void const *pv, [in] ULONG cb, [out] ULONG *pcbWritten);
|
|
[id(3), helpstring("method Seek")] HRESULT Seek([in] LARGE_INTEGER dlibMove, [in] DWORD dwOrigin, [out] ULARGE_INTEGER *plibNewPosition);
|
|
[id(4), helpstring("method SetSize")] HRESULT SetSize([in] ULARGE_INTEGER libNewSize);
|
|
[id(5), helpstring("method CopyTo")] HRESULT CopyTo([in] IStream *pstm, [in] ULARGE_INTEGER cb, [out] ULARGE_INTEGER *pcbRead, [out] ULARGE_INTEGER *pcbWritten);
|
|
[id(6), helpstring("method Commit")] HRESULT Commit([in] DWORD grfCommitFlags);
|
|
[id(7), helpstring("method Revert")] HRESULT Revert(void);
|
|
[id(8), helpstring("method LockRegion")] HRESULT LockRegion([in] ULARGE_INTEGER libOffset, [in] ULARGE_INTEGER cb, [in] DWORD dwLockType);
|
|
[id(9), helpstring("method UnlockRegion")] HRESULT UnlockRegion([in] ULARGE_INTEGER libOffset, [in] ULARGE_INTEGER cb, [in] DWORD dwLockType);
|
|
[id(10), helpstring("method Stat")] HRESULT Stat([out] STATSTG *pstatstg, DWORD grfStatFlag);
|
|
[id(11), helpstring("method Clone")] HRESULT Clone([out] IStream **ppstm);
|
|
[id(12), helpstring("method InitFile")] HRESULT InitFile(BSTR bstrFileName);
|
|
};
|
|
|
|
[
|
|
uuid(AB959592-B2DC-4F57-B3F1-8D8116F74BAF),
|
|
helpstring("EmDebugSession Class")
|
|
]
|
|
coclass EmDebugSession
|
|
{
|
|
[default] interface IEmDebugSession;
|
|
[default, source] dispinterface _IEmDebugSessionEvents;
|
|
};
|
|
[
|
|
uuid(30A533DF-9885-472E-8F8B-94AD3A6C6DE6),
|
|
helpstring("EmFile Class")
|
|
]
|
|
coclass EmFile
|
|
{
|
|
[default] interface IEmFile;
|
|
};
|
|
};
|