Hi,
the topic says all. I use this code from C# to call the
NtQuerySystemInformation.
When i call NtQuerySystemInformation the first time with zero buffer length
to
get the buffer size needed for the information i get a
STATUS_INFO_LENGTH_MISMATCH
which is -1073741820 in number, this is ok, but why does the function not
store the required
buffer size in "ReturnLength"? Its always zero,...why? Is something wrong
with my declaration:
[DllImport("ntdll.dll",
EntryPoint = "NtQuerySystemInformation",
SetLastError = true,
CharSet = CharSet.Unicode,
ExactSpelling = true,
CallingConvention = CallingConvention.Winapi)]
public static extern int NtQuerySystemInformation(
SYSTEM_INFORMATION_CLASS SystemInformationClass,
IntPtr SystemInformation,
uint SystemInformationLength,
out uint ReturnLength);
uint l = 0;
IntPtr ptrBuffer = Marshal.AllocHGlobal(10000000); //just some "buffer"
space, not used
int err = DRWin32APIClass.NtQuerySystemInformation(
DRWin32APIClass.SYSTEM_INFORMATION_CLASS.SystemBas icInformation,
ptrBuffer,
10000000,
out l);
MessageBox.Show(DRWin32APIClass.NtStatusToWin32Exc eption(err).Message + "\n"
+ err.ToString() + "\n" + l.ToString());
Marshal.FreeHGlobal(ptrBuffer);
The "ReturnLength" is always zero (0),...very strange. I am doing something
wrong here,...
I know that i can use for this class the Win32 API GetSystemInfo(...), but
the
call fails on any class, no matter if i want some Handles/Objects, etc
Information,...
Regards
Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."