Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Hooked NtQuerySystemInformation Problem (https://www.delphipraxis.net/91337-hooked-ntquerysysteminformation-problem.html)

sk0r 3. Mai 2007 15:49


Hooked NtQuerySystemInformation Problem
 
Tag

ich habe mal NtQuerySystemInformation gehookt. Ziel ist es eine
Anwendung im Taskmanager zu verstecken (mache das NUR zum lernen).
Naja, das Problem ist, dass ich nun nicht weiß, wie ich in der
Funktion arbeiten soll. Tuts gibts dafür nicht, desshalb hab ich
erstmal rumprobiert.

Delphi-Quellcode:
function scNtQuerySystemInformation(SystemInformationClass: SYSTEM_INFORMATION_CLASS; SystemInformation: Pointer; SystemInformationLength:ULONG; ReturnLength:PULONG):LongInt; stdcall;
var
  NtQueryResult: LongInt;
  SysProcInfo: PSYSTEM_PROCESS_INFORMATION;
  lpProcName: PChar;
  cProcId: Cardinal;
begin
 NtQueryResult := scorigNtQuerySystemInformation(SystemInformationClass, SystemInformation, SystemInformationLength, ReturnLength);
  if SystemInformationClass = SystemProcessesAndThreadsInformation then
  begin
    SysProcInfo := PSYSTEM_PROCESS_INFORMATION(SystemInformation);
    lpProcName := SysProcInfo.ProcessName.Buffer;
    if lpProcName <> nil then
    begin
      MessageBox(0, lpProcName, 'test', 0);
    end;
  end;
  result := NtQueryResult;
end;
Leider funktioniert es nicht. Die abfrage ob SystemInformationClass = SystemProcessesAndThreadsInformation
ist, funktioniert zwar, aber dann geht nichts mehr. lpProcName hat immer keinen Wert, so wie mein
Code da nun ist. meine Frage ist halt nun, was ich falsch mache, bzw was ich ändern muss. Denke mal
da fehlt noch Code. Hilfe wäre echt nett.

Und nochmal: Ich mach nichts illegales damit, ich mach das nur weils interessant ist.

MfG: sk0r


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz