Skip to content

Commit 96c2a9e

Browse files
committed
Plugins: Update commonutil.h
1 parent ff42c8c commit 96c2a9e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

plugins/include/commonutil.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ typedef PVOID (NTAPI *PUTIL_GET_JSON_OBJECT)(
6868
_In_ PSTR Key
6969
);
7070

71+
typedef INT (NTAPI *PUTIL_GET_JSON_OBJECT_LENGTH)(
72+
_In_ PVOID Object
73+
);
74+
7175
typedef BOOL (NTAPI *PUTIL_GET_JSON_OBJECT_BOOL)(
7276
_In_ PVOID Object,
7377
_In_ PSTR Key
@@ -101,6 +105,16 @@ typedef PVOID (NTAPI *PUTIL_GET_JSON_OBJECT_ARRAY_INDEX)(
101105
_In_ INT Index
102106
);
103107

108+
typedef struct _JSON_ARRAY_LIST_OBJECT
109+
{
110+
PSTR Key;
111+
PVOID Entry;
112+
} JSON_ARRAY_LIST_OBJECT, *PJSON_ARRAY_LIST_OBJECT;
113+
114+
typedef PPH_LIST (NTAPI *PUTIL_GET_JSON_OBJECT_ARRAY_LIST)(
115+
_In_ PVOID Object
116+
);
117+
104118
typedef struct _COMMONUTIL_INTERFACE
105119
{
106120
ULONG Version;
@@ -115,12 +129,14 @@ typedef struct _COMMONUTIL_INTERFACE
115129
PUTIL_GET_JSON_OBJECT_BOOL GetJsonValueAsBool;
116130
PUTIL_CREATE_JSON_OBJECT CreateJsonObject;
117131
PUTIL_GET_JSON_OBJECT GetJsonObject;
132+
PUTIL_GET_JSON_OBJECT_LENGTH GetJsonObjectLength;
118133
PUTIL_ADD_JSON_ARRAY_VALUE JsonAddObject;
119134
PUTIL_CREATE_JSON_ARRAY CreateJsonArray;
120135
PUTIL_ADD_JSON_OBJECT_VALUE JsonArrayAddObject;
121136
PUTIL_GET_JSON_ARRAY_STRING GetJsonArrayString;
122137
PUTIL_GET_JSON_ARRAY_LENGTH JsonGetArrayLength;
123138
PUTIL_GET_JSON_OBJECT_ARRAY_INDEX JsonGetObjectArrayIndex;
139+
PUTIL_GET_JSON_OBJECT_ARRAY_LIST JsonGetObjectArrayList;
124140
} COMMONUTIL_INTERFACE, *P_COMMONUTIL_INTERFACE;
125141

126142
FORCEINLINE
@@ -400,6 +416,31 @@ JsonGetObjectArrayIndex(
400416
return NULL;
401417
}
402418

419+
FORCEINLINE
420+
PPH_LIST
421+
JsonGetObjectArrayList(
422+
_In_ PVOID Object
423+
)
424+
{
425+
PPH_PLUGIN toolStatusPlugin;
426+
427+
if (toolStatusPlugin = PhFindPlugin(COMMONUTIL_PLUGIN_NAME))
428+
{
429+
P_COMMONUTIL_INTERFACE Interface;
430+
431+
if (Interface = PhGetPluginInformation(toolStatusPlugin)->Interface)
432+
{
433+
if (Interface->Version <= COMMONUTIL_INTERFACE_VERSION)
434+
{
435+
return Interface->JsonGetObjectArrayList(Object);
436+
}
437+
}
438+
}
439+
440+
return NULL;
441+
}
442+
443+
403444
FORCEINLINE
404445
PVOID
405446
CreateJsonObject(

0 commit comments

Comments
 (0)