Skip to content

Commit e1b0391

Browse files
committed
OnlineChecks: Add VirusTotal detection actions to the options window (Not working yet); Fix build errors;
1 parent 58c1f11 commit e1b0391

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

plugins/OnlineChecks/OnlineChecks.rc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ END
8787
// Dialog
8888
//
8989

90-
IDD_OPTIONS DIALOGEX 0, 0, 201, 57
90+
IDD_OPTIONS DIALOGEX 0, 0, 185, 103
9191
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
9292
CAPTION "Options"
9393
FONT 8, "MS Shell Dlg", 400, 0, 0x1
@@ -96,7 +96,12 @@ BEGIN
9696
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,101,10
9797
CONTROL "Enable VirusTotal detection highlighting",IDC_ENABLE_IDC_ENABLE_VIRUSTOTAL_HIGHLIGHT,
9898
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,19,141,10
99-
PUSHBUTTON "Close",IDCANCEL,145,36,50,14
99+
PUSHBUTTON "Close",IDCANCEL,129,82,50,14
100+
CONTROL "Enable detection actions",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34,94,10
101+
EDITTEXT IDC_EDIT1,91,47,37,14,ES_AUTOHSCROLL
102+
LTEXT "Minimum detection ratio:",IDC_STATIC,8,50,79,8
103+
COMBOBOX IDC_COMBO1,91,65,88,14,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
104+
LTEXT "Minimum detection action:",IDC_STATIC,7,67,84,8
100105
END
101106

102107

@@ -111,9 +116,9 @@ BEGIN
111116
IDD_OPTIONS, DIALOG
112117
BEGIN
113118
LEFTMARGIN, 7
114-
RIGHTMARGIN, 195
119+
RIGHTMARGIN, 179
115120
TOPMARGIN, 7
116-
BOTTOMMARGIN, 50
121+
BOTTOMMARGIN, 96
117122
END
118123
END
119124
#endif // APSTUDIO_INVOKED

plugins/OnlineChecks/page1.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ HRESULT CALLBACK CheckingForUpdatesCallbackProc(
4242
if (context->TaskbarListClass)
4343
ITaskbarList3_SetProgressState(context->TaskbarListClass, PhMainWndHandle, TBPF_INDETERMINATE);
4444

45-
// reference the context for the new thread
4645
PhReferenceObject(context);
47-
48-
// create the new thread
4946
PhQueueItemWorkQueue(PhGetGlobalWorkQueue(), UploadCheckThreadStart, context);
5047
}
5148
break;

plugins/OnlineChecks/page2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
static TASKDIALOG_BUTTON TaskDialogButtonArray[] =
2626
{
27-
{ IDRETRY, L"Reanalyse file\nRescan the existing sample on VirusTotal" },
2827
{ IDOK, L"Upload file\nUpload fresh sample to VirusTotal for analysis" },
28+
{ IDRETRY, L"Reanalyse file\nRescan the existing sample on VirusTotal" },
2929
{ IDYES, L"View last analysis\nOpen the last VirusTotal analysis page" },
3030
};
3131

plugins/OnlineChecks/page3.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ HRESULT CALLBACK ShowProgressCallbackProc(
4242
if (context->TaskbarListClass)
4343
ITaskbarList3_SetProgressState(context->TaskbarListClass, PhMainWndHandle, TBPF_INDETERMINATE);
4444

45-
// reference the context for the new thread
4645
PhReferenceObject(context);
47-
48-
// create the new thread
4946
context->UploadThreadHandle = PhCreateThread(0, UploadFileThreadStart, context);
5047
}
5148
break;

plugins/OnlineChecks/resource.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
#define IDD_OPTIONS 102
66
#define IDC_ENABLE_VIRUSTOTAL 1001
77
#define IDC_ENABLE_IDC_ENABLE_VIRUSTOTAL_HIGHLIGHT 1002
8+
#define IDC_CHECK1 1010
9+
#define IDC_EDIT1 1011
10+
#define IDC_COMBO1 1012
811

912
// Next default values for new objects
1013
//
1114
#ifdef APSTUDIO_INVOKED
1215
#ifndef APSTUDIO_READONLY_SYMBOLS
1316
#define _APS_NEXT_RESOURCE_VALUE 103
1417
#define _APS_NEXT_COMMAND_VALUE 40001
15-
#define _APS_NEXT_CONTROL_VALUE 1010
18+
#define _APS_NEXT_CONTROL_VALUE 1013
1619
#define _APS_NEXT_SYMED_VALUE 103
1720
#endif
1821
#endif

plugins/OnlineChecks/upload.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ NTSTATUS HashFileAndResetPosition(
266266
NTSTATUS status;
267267
IO_STATUS_BLOCK iosb;
268268
PH_HASH_CONTEXT hashContext;
269-
PPH_STRING hashString;
269+
PPH_STRING hashString = NULL;
270270
ULONG64 bytesRemaining;
271271
FILE_POSITION_INFORMATION positionInfo;
272272
LONG priority;
@@ -277,15 +277,15 @@ NTSTATUS HashFileAndResetPosition(
277277

278278
bytesRemaining = FileSize->QuadPart;
279279

280-
PhInitializeHash(&hashContext, Algorithm);
281-
282280
newpriority = THREAD_PRIORITY_LOWEST;
283281
newioPriority = IoPriorityVeryLow;
284282
NtQueryInformationThread(NtCurrentThread(), ThreadBasePriority, &priority, sizeof(LONG), NULL);
285283
NtQueryInformationThread(NtCurrentThread(), ThreadIoPriority, &ioPriority, sizeof(IO_PRIORITY_HINT), NULL);
286284
NtSetInformationThread(NtCurrentThread(), ThreadBasePriority, &newpriority, sizeof(LONG));
287285
NtSetInformationThread(NtCurrentThread(), ThreadIoPriority, &newioPriority, sizeof(IO_PRIORITY_HINT));
288286

287+
PhInitializeHash(&hashContext, Algorithm);
288+
289289
while (bytesRemaining)
290290
{
291291
status = NtReadFile(
@@ -318,20 +318,18 @@ NTSTATUS HashFileAndResetPosition(
318318
{
319319
case Md5HashAlgorithm:
320320
PhFinalHash(&hashContext, hash, 16, NULL);
321-
hashString = PhBufferToHexString(hash, 16);
321+
*HashString = PhBufferToHexString(hash, 16);
322322
break;
323323
case Sha1HashAlgorithm:
324324
PhFinalHash(&hashContext, hash, 20, NULL);
325-
hashString = PhBufferToHexString(hash, 20);
325+
*HashString = PhBufferToHexString(hash, 20);
326326
break;
327327
case Sha256HashAlgorithm:
328328
PhFinalHash(&hashContext, hash, 32, NULL);
329-
hashString = PhBufferToHexString(hash, 32);
329+
*HashString = PhBufferToHexString(hash, 32);
330330
break;
331331
}
332332

333-
*HashString = hashString;
334-
335333
positionInfo.CurrentByteOffset.QuadPart = 0;
336334
status = NtSetInformationFile(
337335
FileHandle,

0 commit comments

Comments
 (0)