MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / String

Method String

pkg/event/param_windows.go:76–178  ·  view source on GitHub ↗

String returns the string representation of the parameter value.

()

Source from the content-addressed store, hash-verified

74
75// String returns the string representation of the parameter value.
76func (p Param) String() string {
77 if p.Value == nil {
78 return ""
79 }
80 switch p.Type {
81 case params.UnicodeString, params.AnsiString, params.Path:
82 return p.Value.(string)
83 case params.SID, params.WbemSID:
84 sid, err := getSID(&p)
85 if err != nil {
86 return ""
87 }
88 if p.Name == params.ProcessTokenIntegrityLevel {
89 return sys.RidToString(sid)
90 }
91 return sid.String()
92 case params.DOSPath:
93 return devMapper.Convert(p.Value.(string))
94 case params.Key:
95 rootKey, keyName := key.Format(p.Value.(string))
96 if keyName != "" && rootKey != key.Invalid {
97 return rootKey.String() + "\\" + keyName
98 }
99 if rootKey != key.Invalid {
100 return rootKey.String()
101 }
102 unknownKeysCount.Add(1)
103 return keyName
104 case params.HandleType:
105 return htypes.ConvertTypeIDToName(p.Value.(uint16))
106 case params.Status:
107 v, ok := p.Value.(uint32)
108 if !ok {
109 return ""
110 }
111 return ntstatus.FormatMessage(v)
112 case params.Address:
113 v, ok := p.Value.(uint64)
114 if !ok {
115 return ""
116 }
117 return va.Address(v).String()
118 case params.Int8:
119 return strconv.Itoa(int(p.Value.(int8)))
120 case params.Uint8:
121 return strconv.Itoa(int(p.Value.(uint8)))
122 case params.Int16:
123 return strconv.Itoa(int(p.Value.(int16)))
124 case params.Uint16, params.Port:
125 return strconv.Itoa(int(p.Value.(uint16)))
126 case params.Uint32, params.PID, params.TID:
127 return strconv.Itoa(int(p.Value.(uint32)))
128 case params.Int32:
129 return strconv.Itoa(int(p.Value.(int32)))
130 case params.Uint64:
131 return strconv.FormatUint(p.Value.(uint64), 10)
132 case params.Int64:
133 return strconv.Itoa(int(p.Value.(int64)))

Callers 1

colorMethod · 0.95

Calls 8

RidToStringFunction · 0.92
FormatFunction · 0.92
FormatMessageFunction · 0.92
AddressTypeAlias · 0.92
getSIDFunction · 0.85
StringMethod · 0.65
ConvertMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected