On Wed, 22 Mar 2000 dubi@il.ibm.com wrote:
Hi there,
Does anybody know how to use the Native API of NT directly from user mode .
I want to use NtCreateSection()
(the user equivalent of ZwCreateSection) instead of CreateFileMapping()
because it gives more control
over parameters but there is no NTDLL.LIB to link to and these functions
are declared unresolved at link time!
thanks
Dubi
Hi!
Sorry, my English is very bad but I hope You can understand me.
I use the Borland compiler and linker but I was made import library for
using “NTDLL.DLL” functions with “impdef” and “implib” utility. And in
“ntdll.h” file I was made some changes in declarations of prototypes.
For example:
/*This is standard declaration and linker does not work with my library*/
NTSYSAPI
NTSTATUS
NTAPI
ZwCreateSection (
OUT PHANDLE SectionHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN PLARGE_INTEGER MaximumSize OPTIONAL,
IN ULONG SectionPageProtection,
IN ULONG AllocationAttributes,
IN HANDLE FileHandle OPTIONAL
);
/*Instead declaration above I use another, and linker works properly
and there is no need to using “LoadLibrary” and “GetProcAddress”.*/
extern “C” DWORD __stdcall ZwCreateSection (
OUT PHANDLE SectionHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN PLARGE_INTEGER MaximumSize OPTIONAL,
IN ULONG SectionPageProtection,
IN ULONG AllocationAttributes,
IN HANDLE FileHandle OPTIONAL
);
I understand that my linker is not Microsoft linker but I think that the
Microsoft DDK and SDK have the same utilities. Maybe these utilities have
another names but I think they does the same things.
Excuse me if I said something wrong
Hope these things can help You…
**********************************************
Best regards, Alex Pro (Alexey Prokoptchuk),
System Administrator
Contact phone - +380-6452 99622
ICQ - 17815755
**********************************************