#ifndef _NMERR_H
#define _NMERR_H

/* Microsoft Network Monitor error code definitions */

#ifndef HRESULT
typedef LONG HRESULT;
#endif

#ifndef INLINE
#define INLINE  __inline
#endif

#include <winerror.h>

#define NMERR_SUCCESS  0
#define NMERR_MEMORY_MAPPED_FILE_ERROR  1
#define NMERR_INVALID_HFILTER  2
#define NMERR_CAPTURING  3
#define NMERR_NOT_CAPTURING  4
#define NMERR_NO_MORE_FRAMES  5
#define NMERR_BUFFER_TOO_SMALL  6
#define NMERR_FRAME_NOT_RECOGNIZED  7
#define NMERR_FILE_ALREADY_EXISTS  8
#define NMERR_DRIVER_NOT_FOUND  9
#define NMERR_ADDRESS_ALREADY_EXISTS  10
#define NMERR_INVALID_HFRAME  11
#define NMERR_INVALID_HPROTOCOL  12
#define NMERR_INVALID_HPROPERTY  13
#define NMERR_LOCKED  14
#define NMERR_STACK_EMPTY  15
#define NMERR_STACK_OVERFLOW  16
#define NMERR_TOO_MANY_PROTOCOLS  17
#define NMERR_FILE_NOT_FOUND  18
#define NMERR_OUT_OF_MEMORY  19
#define NMERR_CAPTURE_PAUSED  20
#define NMERR_NO_BUFFERS  21
#define NMERR_BUFFERS_ALREADY_EXIST  22
#define NMERR_NOT_LOCKED  23
#define NMERR_OUT_OF_RANGE  24
#define NMERR_LOCK_NESTING_TOO_DEEP  25
#define NMERR_LOAD_PARSER_FAILED  26
#define NMERR_UNLOAD_PARSER_FAILED  27
#define NMERR_INVALID_HADDRESSDB  28
#define NMERR_ADDRESS_NOT_FOUND  29
#define NMERR_NETWORK_NOT_PRESENT  30
#define NMERR_NO_PROPERTY_DATABASE  31
#define NMERR_PROPERTY_NOT_FOUND  32
#define NMERR_INVALID_HPROPERTYDB  33
#define NMERR_PROTOCOL_NOT_ENABLED  34
#define NMERR_PROTOCOL_NOT_FOUND  35
#define NMERR_INVALID_PARSER_DLL  36
#define NMERR_NO_ATTACHED_PROPERTIES  37
#define NMERR_NO_FRAMES  38
#define NMERR_INVALID_FILE_FORMAT  39
#define NMERR_COULD_NOT_CREATE_TEMPFILE  40
#define NMERR_OUT_OF_DOS_MEMORY  41
#define NMERR_NO_PROTOCOLS_ENABLED  42
#define NMERR_UNKNOWN_MACTYPE  46
#define NMERR_ROUTING_INFO_NOT_PRESENT  47
#define NMERR_INVALID_HNETWORK  48
#define NMERR_NETWORK_ALREADY_OPENED  49
#define NMERR_NETWORK_NOT_OPENED  50
#define NMERR_FRAME_NOT_FOUND  51
#define NMERR_NO_HANDLES  53
#define NMERR_INVALID_NETWORK_ID  54
#define NMERR_INVALID_HCAPTURE  55
#define NMERR_PROTOCOL_ALREADY_ENABLED  56
#define NMERR_FILTER_INVALID_EXPRESSION  57
#define NMERR_TRANSMIT_ERROR  58
#define NMERR_INVALID_HBUFFER  59
#define NMERR_INVALID_DATA  60
#define NMERR_MSDOS_DRIVER_NOT_LOADED  61
#define NMERR_WINDOWS_DRIVER_NOT_LOADED  62
#define NMERR_MSDOS_DRIVER_INIT_FAILURE  63
#define NMERR_WINDOWS_DRIVER_INIT_FAILURE  64
#define NMERR_NETWORK_BUSY  65
#define NMERR_CAPTURE_NOT_PAUSED  66
#define NMERR_INVALID_PACKET_LENGTH  67
#define NMERR_INTERNAL_EXCEPTION  69
#define NMERR_PROMISCUOUS_MODE_NOT_SUPPORTED 70
#define NMERR_MAC_DRIVER_OPEN_FAILURE  71
#define NMERR_RUNAWAY_PROTOCOL  72
#define NMERR_PENDING  73
#define NMERR_ACCESS_DENIED  74
#define NMERR_INVALID_HPASSWORD  75
#define NMERR_INVALID_PARAMETER  76
#define NMERR_FILE_READ_ERROR  77
#define NMERR_FILE_WRITE_ERROR  78
#define NMERR_PROTOCOL_NOT_REGISTERED  79
#define NMERR_IP_ADDRESS_NOT_FOUND  80
#define NMERR_TRANSMIT_CANCELLED  81
#define NMERR_LOCKED_FRAMES  82
#define NMERR_NO_TRANSMITS_PENDING  83
#define NMERR_PATH_NOT_FOUND  84
#define NMERR_WINDOWS_ERROR  85
#define NMERR_NO_FRAME_NUMBER  86
#define NMERR_FRAME_HAS_NO_CAPTURE  87
#define NMERR_FRAME_ALREADY_HAS_CAPTURE  88
#define NMERR_NAL_IS_NOT_REMOTE  89
#define NMERR_NOT_SUPPORTED  90
#define NMERR_DISCARD_FRAME  91
#define NMERR_CANCEL_SAVE_CAPTURE  92
#define NMERR_LOST_CONNECTION  93
#define NMERR_INVALID_MEDIA_TYPE  94
#define NMERR_AGENT_IN_USE  95
#define NMERR_TIMEOUT  96
#define NMERR_DISCONNECTED  97
#define NMERR_SETTIMER_FAILED  98
#define NMERR_NETWORK_ERROR  99
#define NMERR_INVALID_FRAMESPROC  100
#define NMERR_UNKNOWN_CAPTURETYPE  101
#define NMERR_NOT_CONNECTED  102
#define NMERR_ALREADY_CONNECTED  103
#define NMERR_INVALID_REGISTRY_CONFIGURATION 104
#define NMERR_DELAYED  105
#define NMERR_NOT_DELAYED  106
#define NMERR_REALTIME  107
#define NMERR_NOT_REALTIME  108
#define NMERR_STATS_ONLY  109
#define NMERR_NOT_STATS_ONLY  110
#define NMERR_TRANSMIT  111
#define NMERR_NOT_TRANSMIT  112
#define NMERR_TRANSMITTING  113
#define NMERR_DISK_NOT_LOCAL_FIXED  114
#define NMERR_COULD_NOT_CREATE_DIRECTORY  115
#define NMERR_NO_DEFAULT_CAPTURE_DIRECTORY  116
#define NMERR_UPLEVEL_CAPTURE_FILE  117
#define NMERR_LOAD_EXPERT_FAILED  118
#define NMERR_EXPERT_REPORT_FAILED  119
#define NMERR_REG_OPERATION_FAILED  120
#define NMERR_NO_DLLS_FOUND  121
#define NMERR_NO_CONVERSATION_STATS  122
#define NMERR_SECURITY_BREACH_CAPTURE_DELETED  123
#define NMERR_FRAME_FAILED_FILTER  124
#define NMERR_EXPERT_TERMINATE  125
#define NMERR_REMOTE_NOT_A_SERVER  126
#define NMERR_REMOTE_VERSION_OUTOFSYNC  127
#define NMERR_INVALID_EXPERT_GROUP  128
#define NMERR_INVALID_EXPERT_NAME  129
#define NMERR_INVALID_EXPERT_HANDLE 130
#define NMERR_GROUP_NAME_ALREADY_EXISTS  131
#define NMERR_INVALID_GROUP_NAME  132
#define NMERR_EXPERT_ALREADY_IN_GROUP  133
#define NMERR_EXPERT_NOT_IN_GROUP  134
#define NMERR_NOT_INITIALIZED  135
#define NMERR_INVALID_GROUP_ROOT  136
#define NMERR_BAD_VERSION  137
#define NMERR_ESP  138
#define NMERR_NOT_ESP  139

INLINE HRESULT NMERR_TO_HRESULT(DWORD nmerror)
{
    HRESULT hResult;
    if (nmerror == NMERR_SUCCESS)
        hResult = NOERROR;
    else
        hResult = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,(WORD)nmerror);
    return hResult;
}

INLINE DWORD HRESULT_TO_NMERR(HRESULT hResult)
{
    return HRESULT_CODE(hResult);
}

#endif /* _NMERR_H */
