2
2
* Process Hacker Extra Plugins -
3
3
* Plugin Manager
4
4
*
5
- * Copyright (C) 2016 dmex
5
+ * Copyright (C) 2016-2017 dmex
6
6
*
7
7
* This file is part of Process Hacker.
8
8
*
@@ -44,134 +44,6 @@ ULONGLONG ParseVersionString(
44
44
return MAKE_VERSION_ULONGLONG (majorInteger , minorInteger , reservedInteger , revisionInteger );
45
45
}
46
46
47
- HICON PluginDownloadImageThread (
48
- _In_ PPH_STRING ImageDownloadUrl
49
- )
50
- {
51
- HINTERNET httpSessionHandle = NULL ;
52
- HINTERNET httpConnectionHandle = NULL ;
53
- HINTERNET httpRequestHandle = NULL ;
54
- PPH_STRING downloadHostPath = NULL ;
55
- PPH_STRING downloadUrlPath = NULL ;
56
- WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig = { 0 };
57
- ULONG xmlStringBufferLength = 0 ;
58
- PSTR xmlStringBuffer = NULL ;
59
- URL_COMPONENTS httpUrlComponents = { sizeof (URL_COMPONENTS ) };
60
-
61
- WinHttpGetIEProxyConfigForCurrentUser (& proxyConfig );
62
-
63
- // Set lengths to non-zero
64
- httpUrlComponents .dwSchemeLength = (ULONG )- 1 ;
65
- httpUrlComponents .dwHostNameLength = (ULONG )- 1 ;
66
- httpUrlComponents .dwUrlPathLength = (ULONG )- 1 ;
67
-
68
- if (!WinHttpCrackUrl (
69
- PhGetStringOrEmpty (ImageDownloadUrl ),
70
- 0 ,
71
- 0 ,
72
- & httpUrlComponents
73
- ))
74
- {
75
- goto CleanupExit ;
76
- }
77
-
78
- // Create the Host string.
79
- downloadHostPath = PhCreateStringEx (
80
- httpUrlComponents .lpszHostName ,
81
- httpUrlComponents .dwHostNameLength * sizeof (WCHAR )
82
- );
83
- if (PhIsNullOrEmptyString (downloadHostPath ))
84
- goto CleanupExit ;
85
-
86
- // Create the Path string.
87
- downloadUrlPath = PhCreateStringEx (
88
- httpUrlComponents .lpszUrlPath ,
89
- httpUrlComponents .dwUrlPathLength * sizeof (WCHAR )
90
- );
91
- if (PhIsNullOrEmptyString (downloadUrlPath ))
92
- goto CleanupExit ;
93
-
94
- if (!(httpSessionHandle = WinHttpOpen (
95
- L"ExtraPlugins_1.0" ,
96
- proxyConfig .lpszProxy ? WINHTTP_ACCESS_TYPE_NAMED_PROXY : WINHTTP_ACCESS_TYPE_DEFAULT_PROXY ,
97
- proxyConfig .lpszProxy ,
98
- proxyConfig .lpszProxyBypass ,
99
- 0
100
- )))
101
- {
102
- goto CleanupExit ;
103
- }
104
-
105
- if (!(httpConnectionHandle = WinHttpConnect (
106
- httpSessionHandle ,
107
- L"wj32.org" ,
108
- INTERNET_DEFAULT_HTTP_PORT ,
109
- 0
110
- )))
111
- {
112
- goto CleanupExit ;
113
- }
114
-
115
- if (!(httpRequestHandle = WinHttpOpenRequest (
116
- httpConnectionHandle ,
117
- NULL ,
118
- L"/processhacker/plugins/list.php" ,
119
- NULL ,
120
- WINHTTP_NO_REFERER ,
121
- WINHTTP_DEFAULT_ACCEPT_TYPES ,
122
- WINHTTP_FLAG_REFRESH
123
- )))
124
- {
125
- goto CleanupExit ;
126
- }
127
-
128
- if (!WinHttpSendRequest (
129
- httpRequestHandle ,
130
- WINHTTP_NO_ADDITIONAL_HEADERS ,
131
- 0 ,
132
- WINHTTP_NO_REQUEST_DATA ,
133
- 0 ,
134
- WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH ,
135
- 0
136
- ))
137
- {
138
- goto CleanupExit ;
139
- }
140
-
141
- if (!WinHttpReceiveResponse (httpRequestHandle , NULL ))
142
- goto CleanupExit ;
143
-
144
- if (!ReadRequestString (httpRequestHandle , & xmlStringBuffer , & xmlStringBufferLength ))
145
- goto CleanupExit ;
146
-
147
- //pluginDllPath = PhConcatStrings(3, PhGetString(PhGetApplicationDirectory()), L"Plugins\\", PhGetString(entry->FileName));
148
- //PhInitializeStringRefLongHint(&pluginBaseName, PhGetString(entry->FileName));
149
-
150
- //if (PhIsPluginDisabled(&pluginBaseName))
151
- // goto CleanupExit;
152
-
153
- //if (RtlDoesFileExists_U(PhGetString(pluginDllPath)))
154
- //{
155
- //
156
- //}
157
-
158
- CleanupExit :
159
-
160
- if (httpRequestHandle )
161
- WinHttpCloseHandle (httpRequestHandle );
162
-
163
- if (httpConnectionHandle )
164
- WinHttpCloseHandle (httpConnectionHandle );
165
-
166
- if (httpSessionHandle )
167
- WinHttpCloseHandle (httpSessionHandle );
168
-
169
- if (xmlStringBuffer )
170
- PhFree (xmlStringBuffer );
171
-
172
- return NULL ;
173
- }
174
-
175
47
NTSTATUS QueryPluginsCallbackThread (
176
48
_In_ PVOID Parameter
177
49
)
@@ -257,7 +129,6 @@ NTSTATUS QueryPluginsCallbackThread(
257
129
258
130
jvalue = JsonGetObjectArrayIndex (rootJsonObject , i );
259
131
entry -> Id = PhConvertUtf8ToUtf16 (GetJsonValueAsString (jvalue , "plugin_id" ));
260
- entry -> Visible = PhConvertUtf8ToUtf16 (GetJsonValueAsString (jvalue , "plugin_visible" ));
261
132
entry -> InternalName = PhConvertUtf8ToUtf16 (GetJsonValueAsString (jvalue , "plugin_internal_name" ));
262
133
entry -> Name = PhConvertUtf8ToUtf16 (GetJsonValueAsString (jvalue , "plugin_name" ));
263
134
entry -> Version = PhConvertUtf8ToUtf16 (GetJsonValueAsString (jvalue , "plugin_version" ));
@@ -296,6 +167,8 @@ NTSTATUS QueryPluginsCallbackThread(
296
167
297
168
PPH_STRING directory = PhGetApplicationDirectory ();
298
169
pluginDllPath = PhConcatStrings (3 , PhGetString (directory ), L"Plugins\\" , PhGetString (entry -> FileName ));
170
+ PhDereferenceObject (directory );
171
+
299
172
PhInitializeStringRefLongHint (& pluginBaseName , PhGetString (entry -> FileName ));
300
173
301
174
if (PhIsPluginDisabled (& pluginBaseName ))
@@ -441,6 +314,11 @@ NTSTATUS SetupExtractBuild(
441
314
fullSetupPath = PhGetFullPath (PhGetStringOrEmpty (extractPath ), & indexOfFileName );
442
315
443
316
SHCreateDirectoryEx (NULL , PhGetStringOrEmpty (fullSetupPath ), NULL );
317
+
318
+ PhDereferenceObject (fullSetupPath );
319
+ PhDereferenceObject (extractPath );
320
+ PhDereferenceObject (directory );
321
+ PhDereferenceObject (fileName );
444
322
}
445
323
else
446
324
{
@@ -449,16 +327,13 @@ NTSTATUS SetupExtractBuild(
449
327
PPH_STRING fullSetupPath ;
450
328
PPH_STRING extractPath ;
451
329
PPH_STRING directoryPath ;
452
- //PPH_STRING baseNameString;
453
330
PPH_STRING fileNameString ;
454
331
ULONG indexOfFileName = -1 ;
455
332
456
333
fileName = PhConvertUtf8ToUtf16 (stat .m_filename );
457
334
directory = PhGetApplicationDirectory ();
458
335
extractPath = PhConcatStringRef3 (& directory -> sr , & pluginsDirectory , & fileName -> sr );
459
336
fullSetupPath = PhGetFullPath (PhGetStringOrEmpty (extractPath ), & indexOfFileName );
460
- //baseNameString = PhGetBaseName(fullSetupPath);
461
- //fullSetupPath = PhGetFullPath(PhGetStringOrEmpty(fileName), &indexOfFileName);
462
337
fileNameString = PhConcatStrings (2 , fullSetupPath -> Buffer , L".bak" );
463
338
464
339
if (indexOfFileName != -1 )
@@ -480,8 +355,11 @@ NTSTATUS SetupExtractBuild(
480
355
goto error ;
481
356
}
482
357
358
+ PhDereferenceObject (fileNameString );
483
359
PhDereferenceObject (fullSetupPath );
484
360
PhDereferenceObject (extractPath );
361
+ PhDereferenceObject (directory );
362
+ PhDereferenceObject (fileName );
485
363
}
486
364
}
487
365
0 commit comments