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 Problem mit NtQueryObject (https://www.delphipraxis.net/11174-problem-mit-ntqueryobject.html)

Chewie 1. Nov 2003 14:22


Problem mit NtQueryObject
 
Ich will NtQueryObject aufrufen, bekomme aber eine AccessViolation. Wieso?

So ist NtQueryObject importiert:

Delphi-Quellcode:
const
  ntdll = 'ntdll.dll';

  NTSTATUS = ULONG;
  PVOID = Pointer;
  USHORT = Word;
 
  OBJECT_INFORMATION_CLASS = (ObjectBasicInformation, ObjectNameInformation,
    ObjectTypeInformation, ObjectAllInformation, ObjectDataInformation);
  TObjectInformationClass = OBJECT_INFORMATION_CLASS;


function NtQueryObject(
  ObjectHandle: THandle;
  ObjectInformationClas: TObjectInformationClass;
  out ObjectInformation: PVOID;
  ObjectInformationLength: ULONG;
  out ReturnLength: PULONG): NTSTATUS; stdcall; external ntdll name 'NtQueryObject';
So rufe ich es auf:
Delphi-Quellcode:
var
  ObjectInformation: Pointer;
  ReturnLength: PULONG;
  hMutex: THandle;
begin
  hMutex := CreateMutex(nil, False, 'testmutex');
  if hMutex = 0 then
  begin
    SysErrorMessage(GetLastError);
    Exit;
  end;
  NtQueryObject(hMutex, ObjectNameInformation,
    ObjectInformation, 2048, ReturnLength);
end;

Assarbad 1. Nov 2003 17:24

Re: Problem mit NtQueryObject
 
Also erstmal:

Delphi-Quellcode:
{$MINENUMSIZE 4}
Tcha und dann müßte ich näher drauf schauen ... hab aber bis Freitag kommender Woche keine Zeot für solche Kapriolen. Wenn bis dahin keine Lösung existiert, schreib mir ne kurze Mail.


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:49 Uhr.

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