Author Topic: error using ntdll.(inc|lib)  (Read 84 times)

Nox

  • Regular Member
  • *
  • Posts: 2
error using ntdll.(inc|lib)
« on: June 13, 2018, 08:54:45 AM »
Hi everybody!

I have a problem when I try build 64-bit binary using ntdll include and lib.

Code: [Select]
include \masm32\include64\ntdll.inc
include \masm32\include64\masm64rt.inc
includelib \masm32\lib64\ntdll.lib

.data?

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

start proc


invoke NtAllocateVirtualMemory, -1, 1, 0, 4096, MEM_COMMIT, PAGE_READWRITE

Ret

start endp

    end

Code: [Select]
@echo off

set appname=nullpage

del %appname%.obj
del %appname%.exe

"C:\masm32\bin64\ml64.exe" /c %appname%.asm

"C:\masm32\bin64\link.exe" /SUBSYSTEM:CONSOLE /MACHINE:X64 /ENTRY:start /nologo %appname%.obj

dir %appname%.*

pause

output error

Code: [Select]
Microsoft (R) Macro Assembler (x64) Version 14.13.26129.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: nullpage.asm
\masm32\include64\ntdll.inc(1) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(4) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(7) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(10) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(13) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(16) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(19) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(22) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(25) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(28) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(31) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(34) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(37) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(40) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(43) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(46) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(49) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(52) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(55) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(58) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(61) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(64) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(67) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(70) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(73) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(76) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(79) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(82) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(85) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(88) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(91) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(94) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(97) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(100) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(106) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(112) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(115) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(118) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(121) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(127) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(133) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(136) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(139) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(142) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(148) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(154) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(160) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(166) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(172) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(178) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(184) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(190) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(196) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(202) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(208) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(214) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(220) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(226) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(229) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(232) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(235) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(238) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(241) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(247) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(253) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(256) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(259) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(262) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(265) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(268) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(271) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(274) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(277) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(280) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(283) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(286) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(289) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(292) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(295) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(298) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(301) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(304) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(307) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(310) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(313) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(316) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(319) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(322) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(325) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(328) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(331) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(334) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(337) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(340) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(343) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(346) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(349) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(352) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(355) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(358) : error A2006:undefined symbol : PPROC
\masm32\include64\ntdll.inc(361) : fatal error A1012:error count exceeds 100; st
opping assembly
LINK : fatal error LNK1181: cannot open input file 'nullpage.obj'
 Volume in drive C is OS
 Volume Serial Number is 7056-A24A

 Directory of C:\projects-masm\x64\allocnullpage

12/06/2018  07:52 p.m.               421 nullpage.asm
               1 File(s)            421 bytes
               0 Dir(s)  271.060.041.728 bytes free
Press any key to continue . . .

someone know what happend?

Regards!

felipe

  • Member
  • ****
  • Posts: 827
  • Eagles are just great!
Re: error using ntdll.(inc|lib)
« Reply #1 on: June 13, 2018, 09:10:42 AM »
Probably you need to include first the win64.inc file.  :idea:
Welcome to the forum!  :icon14:
Felipe.

felipe

  • Member
  • ****
  • Posts: 827
  • Eagles are just great!
Re: error using ntdll.(inc|lib)
« Reply #2 on: June 13, 2018, 09:13:24 AM »
Oh, sorry my wrong. I didn't noticed that you include the masm64rt.inc. I think you should include that first and all other include files (that aren't already in that "main" include file) after it.  :idea:
Felipe.

Nox

  • Regular Member
  • *
  • Posts: 2
Re: error using ntdll.(inc|lib)
« Reply #3 on: June 13, 2018, 09:22:22 AM »
Yep I change the order

Now, I have other  output error :'(

Code: [Select]
Microsoft (R) Macro Assembler (x64) Version 14.13.26129.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: nullpage.asm
\masm32\include64\ntdll.inc(4016) : error A2008:syntax error : equ
LINK : fatal error LNK1181: cannot open input file 'nullpage.obj'
 Volume in drive C is OS
 Volume Serial Number is 7056-A24A

 Directory of C:\projects-masm\x64\allocnullpage

12/06/2018  08:22 p.m.               429 nullpage.asm
               1 File(s)            429 bytes
               0 Dir(s)  271.066.652.672 bytes free
Press any key to continue . . .

Thanks for the wellcome :D

Regards!

felipe

  • Member
  • ****
  • Posts: 827
  • Eagles are just great!
Re: error using ntdll.(inc|lib)
« Reply #4 on: June 13, 2018, 09:44:40 AM »
You are right, i have commented that line (in the ntdll include file) and now assembled and linked fine:
Code: [Select]
externdef __imp_fabs:PPROC   
;fabs equ <__imp_fabs>   ; This is line 4016.

Maybe is some kind of name conflict (repeated names). Don't know. But Hutch is the author and maybe you can have more luck with him.  :idea:
Felipe.

jj2007

  • Member
  • *****
  • Posts: 8442
  • Assembler is fun ;-)
    • MasmBasic
Re: error using ntdll.(inc|lib)
« Reply #5 on: June 13, 2018, 10:09:29 AM »
include \Masm32\MasmBasic\Res\JBasic.inc
Init           
  PrintLine Chr$("This code was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format")
  jinvoke SetLastError, 0
  jinvoke NtAllocateVirtualMemory, -1, 1, 0, 4096, MEM_COMMIT, PAGE_READWRITE
  Inkey Err$()
EndOfCode


Code: [Select]
This code was assembled with UAsm64 in 64-bit format

Operation completed.

Works fine, but what do you need it for? Did you read the forum rules?

Quote
3. Legality of content is not a negotiable matter in the forum.

felipe

  • Member
  • ****
  • Posts: 827
  • Eagles are just great!
Re: error using ntdll.(inc|lib)
« Reply #6 on: June 13, 2018, 11:10:49 AM »
Yes that's true Nox.
Btw, seems like the problem is because fabs is a fpu instruction.  :idea:
Felipe.