Skip to content

Commit 2161f58

Browse files
committed
update
1 parent b0bc209 commit 2161f58

3 files changed

Lines changed: 30 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [1.6.1] - 2025-02-??
99

10+
### Added
11+
- added ARM64 driver
1012

1113
### Changed
1214
- updated code to be qt6 comaptible

TaskExplorer/API/Windows/ProcessHacker.cpp

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "stdafx.h"
1414
#include "../../../MiscHelpers/Common/Settings.h"
15+
#include "../../../MiscHelpers/Common/Common.h"
1516
#include "ProcessHacker.h"
1617
#include <kphmsgdyn.h>
1718
extern "C" {
@@ -316,26 +317,29 @@ static VOID NTAPI KsiCommsCallback(
316317
}
317318

318319
NTSTATUS KsiReadConfiguration(
319-
_In_ PWSTR FileName,
320+
const QString &Path,
321+
_In_ PCWSTR FileName,
320322
_Out_ PBYTE* Data,
321323
_Out_ PULONG Length
322324
)
323325
{
324326
NTSTATUS status;
325-
PPH_STRING fileName;
327+
//PPH_STRING fileName;
326328
HANDLE fileHandle;
327329

328330
*Data = NULL;
329331
*Length = 0;
330332

331333
status = STATUS_NO_SUCH_FILE;
332334

333-
fileName = PhGetApplicationDirectoryFileNameZ(FileName, TRUE);
334-
if (fileName)
335+
//fileName = PhGetApplicationDirectoryFileNameZ(FileName, TRUE);
336+
//if (fileName)
335337
{
336-
if (NT_SUCCESS(status = PhCreateFile(
338+
//if (NT_SUCCESS(status = PhCreateFile(
339+
if (NT_SUCCESS(status = PhCreateFileWin32(
337340
&fileHandle,
338-
&fileName->sr,
341+
// &fileName->sr,
342+
(wchar_t*)(Path + "\\" + QString::fromWCharArray(FileName)).utf16(),
339343
FILE_GENERIC_READ,
340344
FILE_ATTRIBUTE_NORMAL,
341345
FILE_SHARE_READ,
@@ -348,7 +352,7 @@ NTSTATUS KsiReadConfiguration(
348352
NtClose(fileHandle);
349353
}
350354

351-
PhDereferenceObject(fileName);
355+
//PhDereferenceObject(fileName);
352356
}
353357

354358
return status;
@@ -393,6 +397,7 @@ NTSTATUS KsiReadConfiguration(
393397
}*/
394398

395399
NTSTATUS KsiGetDynData(
400+
const QString &Path,
396401
_Out_ PBYTE* DynData,
397402
_Out_ PULONG DynDataLength,
398403
_Out_ PBYTE* Signature,
@@ -410,15 +415,15 @@ NTSTATUS KsiGetDynData(
410415
*Signature = NULL;
411416
*SignatureLength = 0;
412417

413-
status = KsiReadConfiguration((PWSTR)L"ksidyn.bin", &data, &dataLength);
418+
status = KsiReadConfiguration(Path, L"ksidyn.bin", &data, &dataLength);
414419
if (!NT_SUCCESS(status))
415420
goto CleanupExit;
416421

417422
//status = KsiValidateDynamicConfiguration(data, dataLength);
418423
//if (!NT_SUCCESS(status))
419424
// goto CleanupExit;
420425

421-
status = KsiReadConfiguration((PWSTR)L"ksidyn.sig", &sig, &sigLength);
426+
status = KsiReadConfiguration(Path, L"ksidyn.sig", &sig, &sigLength);
422427
if (!NT_SUCCESS(status))
423428
goto CleanupExit;
424429

@@ -441,8 +446,8 @@ NTSTATUS KsiGetDynData(
441446
CleanupExit:
442447
if (data)
443448
PhFree(data);
444-
//if (sig)
445-
// PhFree(sig);
449+
if (sig)
450+
PhFree(sig);
446451

447452
return status;
448453
}
@@ -730,8 +735,17 @@ STATUS InitKSI(const QString& AppDir)
730735
KsiEnableLoadFilter = theConf->GetBool("OptionsKSI/EnableLoadFilter", false);
731736

732737
// if the file name is not a full path Add the application directory
733-
if (!FileName.contains("\\"))
734-
FileName = AppDir + "/" + FileName;
738+
if (!FileName.contains("\\"))
739+
{
740+
USHORT ProcessMachine = 0xFFFF;
741+
USHORT NativeMachine = 0xFFFF;
742+
BOOL ok = IsWow64Process2(GetCurrentProcess(), &ProcessMachine, &NativeMachine);
743+
744+
if (NativeMachine == IMAGE_FILE_MACHINE_ARM64)
745+
FileName = Split2(AppDir, "\\", true).first + "\\ARM64\\"+ FileName;
746+
else
747+
FileName = AppDir + "\\" + FileName;
748+
}
735749

736750
FileName = FileName.replace("/", "\\");
737751
if (!QFile::exists(FileName))
@@ -752,7 +766,7 @@ STATUS InitKSI(const QString& AppDir)
752766
PBYTE signature = NULL;
753767
ULONG signatureLength;
754768

755-
status = KsiGetDynData(&dynData, &dynDataLength, &signature, &signatureLength);
769+
status = KsiGetDynData(Split2(FileName, "\\", true).first, &dynData, &dynDataLength, &signature, &signatureLength);
756770
if (!NT_SUCCESS(status))
757771
return ERR("Unsupported windows version.", STATUS_UNKNOWN_REVISION);
758772

TaskExplorer/stdafx.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
#include <QTreeWidget>
8484
#include <QFormLayout>
8585
#include <QLineEdit>
86-
#include <QTextEdit>
8786
#include <QWidgetAction>
8887
#include <QCheckBox>
8988
#include <QScrollArea>
@@ -97,7 +96,6 @@
9796
#include <QPushButton>
9897
#include <QSystemTrayIcon>
9998
#include <QDesktopServices>
100-
#include <QFileDialog>
10199
#include <QProgressBar>
102100
#include <QInputDialog>
103101
#include <QToolTip>

0 commit comments

Comments
 (0)