News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

NTOSKRNL

Started by bomz, December 04, 2011, 10:22:11 AM

Previous topic - Next topic

bomz

ExAllocatePoolWithTag - to?

MichaelW

drizz posted some enumeration macros here:

http://www.masm32.com/board/index.php?topic=13269.msg103175#msg103175

And here is an example of the simpler one I use:

ENUM MACRO startval:REQ,lbls:VARARG
    LOCAL val
    val=startval
    FOR lbl,<lbls>
        lbl equ val
        val=val+1
    ENDM
ENDM

ENUM 0, NonPagedPool, PagedPool, NonPagedPoolMustSucceed, \
        DontUseThisType, NonPagedPoolCacheAligned, \
        PagedPoolCacheAligned, NonPagedPoolCacheAlignedMustS

eschew obfuscation

bomz

MichaelW it works
but I think it simply use 0,1,2,3,4,5,6

qWord

If you want to allocate some pages, use the Virtual Memory Functions.
FPU in a trice: SmplMath
It's that simple!

bomz

I want use ExAllocatePool

qWord

FPU in a trice: SmplMath
It's that simple!

bomz


bomz

The reason of error was -
when I making new library with ' inc2l ntoskrnl.inc exe' string in batch, in directory INCLUDE file ntoskrnl.exe appear. which steel there because batch 'move *.lib \masm32\lib' move only .lib files.
if you put LIB INC and this ntoskrnl.exe near your asm file
Quoteinclude \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
include ntoskrnl.inc
includelib ntoskrnl.lib
it's compile good and ExAllocatePool return 0 -
QuoteExAllocatePool returns NULL if there is insufficient memory in the free pool to satisfy the request. Otherwise the routine returns a pointer to the allocated memory.

otherwise if you compile code in usual way (irrespective put ntoskrnl.exe to LIB or INCLUDE directory) c0000005 error occurs


PS the other way put libruary to LIB inc to INCLUDE and this ntoskrn.exe near your ASM file
for compiling I use this batch file. drug file with your code on it. working directory is directory of your code
Quote@ECHO OFF
COLOR 9F
cd /d %~dp1
C:\masm32\bin\ml.exe /c /coff "%~1"
C:\masm32\bin\link.exe /subsystem:windows "%~n1.obj"
del "%~n1.obj"
pause

QuoteINC2L.EXE  Version 4.0 Copyright Steve Hutchesson 1998-2005 for MASM32
MASM32 include file to IMPORT library creator.

SYNTAX   : inc2l [drv:\pth\]filename.inc
           Library is written in the current directory with the
           INCLUDE name and .LIB extension.

SETTINGS : inc2l.exe will read an environment variable 'mdir'
           and if it is set, it will use the path to find both
           ML.EXE and LINK.EXE. If the 'mdir' variable is not
           set, it will default to \MASM32.

EXAMPLE  : set mdir=drv:\path
           inc2l filename.inc
           This is syntax for a batch file.
           NOTE : You should NOT use a trailing '\'
           for the environment variable

ADDITIONAL CAPACITY
           If the library you need to create references a DLL
           with a different extension than DLL you may enter a
           second parameter which specifies the extension that
           will be referenced.
EXAMPLE  : inc2l yourinc.inc ocx
           or
           inc2l myinc.inc drv etc ....

Correct library and this ntoskrnl.exe(50kb)

bomz

Is it possible to make NTOSKRNL.LIB with some other program which, may be put all in one file .LIB. polink or some other?

Vortex

Hi bomz,

You can try polib.exe or def2lib to create import libraries.

bomz

what about detailed instruction

Vortex


bomz

Hi
How convert INC to DEF and where get this - @16 etc

bomz

Quote╥хъёЄют√щ фюъєьхэЄ.obj : error LNK2001: unresolved external symbol _ExAllocatePool@8
╥хъёЄют√щ фюъєьхэЄ.obj : error LNK2001: unresolved external symbol _ExFreePool@4
QuoteFOR /F "DELIMS= " %%I IN (ntoskrnl.inc) DO ECHO ^"%%I^">>ntoskrnl.def
QuoteLIBRARY ntoskrnl.exe
EXPORTS
"CcCanIWrite"
"CcCopyRead"
"CcCopyWrite"
"CcDeferWrite"
"CcFastCopyRead"
.......................
Quotedef2lib ntoskrnl.def -nod

lib about 300 kb only