@@ -44,21 +44,6 @@ ULONGLONG ParseVersionString(
44
44
return MAKE_VERSION_ULONGLONG (majorInteger , minorInteger , reservedInteger , revisionInteger );
45
45
}
46
46
47
- json_object_ptr json_get_object (
48
- _In_ json_object_ptr Object ,
49
- _In_ PCSTR Key
50
- )
51
- {
52
- json_object_ptr returnObj ;
53
-
54
- if (json_object_object_get_ex (Object , Key , & returnObj ))
55
- {
56
- return returnObj ;
57
- }
58
-
59
- return NULL ;
60
- }
61
-
62
47
HICON PluginDownloadImageThread (
63
48
_In_ PPH_STRING ImageDownloadUrl
64
49
)
@@ -197,7 +182,7 @@ NTSTATUS QueryPluginsCallbackThread(
197
182
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig = { 0 };
198
183
ULONG xmlStringBufferLength = 0 ;
199
184
PSTR xmlStringBuffer = NULL ;
200
- json_object_ptr rootJsonObject ;
185
+ PVOID rootJsonObject ;
201
186
PWCT_CONTEXT context = Parameter ;
202
187
203
188
WinHttpGetIEProxyConfigForCurrentUser (& proxyConfig );
@@ -255,12 +240,12 @@ NTSTATUS QueryPluginsCallbackThread(
255
240
if (!ReadRequestString (httpRequestHandle , & xmlStringBuffer , & xmlStringBufferLength ))
256
241
goto CleanupExit ;
257
242
258
- if (!(rootJsonObject = json_tokener_parse (xmlStringBuffer )))
243
+ if (!(rootJsonObject = CreateJsonParser (xmlStringBuffer )))
259
244
goto CleanupExit ;
260
245
261
- for (INT i = 0 ; i < json_object_array_length (rootJsonObject ); i ++ )
246
+ for (INT i = 0 ; i < JsonGetArrayLength (rootJsonObject ); i ++ )
262
247
{
263
- json_object_ptr jvalue ;
248
+ PVOID jvalue ;
264
249
PPLUGIN_NODE entry ;
265
250
SYSTEMTIME time = { 0 };
266
251
SYSTEMTIME localTime = { 0 };
@@ -270,28 +255,28 @@ NTSTATUS QueryPluginsCallbackThread(
270
255
entry = PhCreateAlloc (sizeof (PLUGIN_NODE ));
271
256
memset (entry , 0 , sizeof (PLUGIN_NODE ));
272
257
273
- jvalue = json_object_array_get_idx (rootJsonObject , i );
274
- entry -> Id = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_id" ) ));
275
- entry -> Visible = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_visible" ) ));
276
- entry -> InternalName = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_internal_name" ) ));
277
- entry -> Name = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_name" ) ));
278
- entry -> Version = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_version" ) ));
279
- entry -> Author = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_author" ) ));
280
- entry -> Description = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_description" ) ));
281
- entry -> IconUrl = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_icon" ) ));
282
- entry -> Requirements = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_requirements" ) ));
283
- entry -> FeedbackUrl = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_feedback" ) ));
284
- entry -> Screenshots = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_screenshots" ) ));
285
- entry -> AddedTime = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_datetime_added" ) ));
286
- entry -> UpdatedTime = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_datetime_updated" ) ));
287
- entry -> Download_count = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_download_count" ) ));
288
- entry -> Download_link_32 = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_download_link_32" ) ));
289
- entry -> Download_link_64 = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_download_link_64" ) ));
290
- entry -> SHA2_32 = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_hash_32" ) ));
291
- entry -> SHA2_64 = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_hash_64" ) ));
292
- entry -> HASH_32 = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_signed_32" ) ));
293
- entry -> HASH_64 = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_signed_64" ) ));
294
- entry -> FileName = PhConvertUtf8ToUtf16 (json_object_get_string ( json_get_object ( jvalue , "plugin_filename" ) ));
258
+ jvalue = JsonGetObjectArrayIndex (rootJsonObject , i );
259
+ entry -> Id = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_id" ));
260
+ entry -> Visible = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_visible" ));
261
+ entry -> InternalName = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_internal_name" ));
262
+ entry -> Name = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_name" ));
263
+ entry -> Version = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_version" ));
264
+ entry -> Author = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_author" ));
265
+ entry -> Description = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_description" ));
266
+ entry -> IconUrl = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_icon" ));
267
+ entry -> Requirements = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_requirements" ));
268
+ entry -> FeedbackUrl = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_feedback" ));
269
+ entry -> Screenshots = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_screenshots" ));
270
+ entry -> AddedTime = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_datetime_added" ));
271
+ entry -> UpdatedTime = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_datetime_updated" ));
272
+ entry -> Download_count = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_download_count" ));
273
+ entry -> Download_link_32 = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_download_link_32" ));
274
+ entry -> Download_link_64 = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_download_link_64" ));
275
+ entry -> SHA2_32 = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_hash_32" ));
276
+ entry -> SHA2_64 = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_hash_64" ));
277
+ entry -> HASH_32 = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_signed_32" ));
278
+ entry -> HASH_64 = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_signed_64" ));
279
+ entry -> FileName = PhConvertUtf8ToUtf16 (GetJsonValueAsString ( jvalue , "plugin_filename" ));
295
280
296
281
swscanf (
297
282
PhGetString (entry -> UpdatedTime ),
@@ -347,7 +332,7 @@ NTSTATUS QueryPluginsCallbackThread(
347
332
(info -> dwFileVersionMS >> 0 ) & 0xffff ,
348
333
(info -> dwFileVersionLS >> 16 ) & 0xffff ,
349
334
(info -> dwFileVersionLS >> 0 ) & 0xffff
350
- );
335
+ );
351
336
}
352
337
}
353
338
@@ -357,7 +342,7 @@ NTSTATUS QueryPluginsCallbackThread(
357
342
L"\\StringFileInfo\\%04x%04x\\InternalName" ,
358
343
languageInfo [0 ],
359
344
languageInfo [1 ]
360
- );
345
+ );
361
346
362
347
if (VerQueryValue (versionInfo , PhGetStringOrEmpty (internalNameString ), & buffer , & bufferSize ))
363
348
{
0 commit comments