News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

guidinit guiddef devguid

Started by bomz, February 24, 2013, 03:07:05 AM

Previous topic - Next topic

bomz

example.asm(42) : error A2008: syntax error : SEGMENT DEFINE_GUID(21): Macro Called From

Quote.386

.model flat, stdcall
option casemap :none

GUID STRUCT
   Data1   DWORD   ?
   Data2   WORD   ?
   Data3   WORD   ?
   Data4   BYTE 8 dup(?)
GUID ENDS
PGUID typedef ptr GUID

IFNDEF GUID_DEFINED
DEFINE_GUID MACRO name:REQ, l:REQ, w1:REQ, w2:REQ, b1:REQ, b2:REQ, b3:REQ, b4:REQ, b5:REQ, b6:REQ, b7:REQ, b8:REQ

   local segn

   segn TEXTEQU @CurSeg
   
   .const
      ALIGN 4
      name   dd l
            dw w1
            dw w2
            db b1
            db b2
            db b3
            db b4
            db b5
            db b6
            db b7
            db b8

   @CurSeg ENDS
   segn SEGMENT

ENDM

ENDIF ; GUID_DEFINED

DEFINE_GUID GUID_DEVCLASS_1394,            06bdd1fc1h, 0810fh, 011d0h, 0beh, 0c7h, 008h, 000h, 02bh, 0e2h, 009h, 02fh

.code
start:

end start
realy I trying use guiddef.inc devguid.inc from KMDKits

segn ;SEGMENT ?

dedndave

that macro tries to play a trick to preserve the current open segment, then restore it after switching to .CONST

not sure why you need a macro, at all   :P
just use the GUID struct
GUID_DEVCLASS_1394 GUID <6BDD1FC1h,810Fh,11D0h,<0BEh,0C7h,8,0,2Bh,0E2h,9,2Fh>>
i think that's right

if you want it to be in the .CONST segment, put it there
        .CONST

GUID_DEVCLASS_1394 GUID <6BDD1FC1h,810Fh,11D0h,<0BEh,0C7h,8,0,2Bh,0E2h,9,2Fh>>

        .DATA
;
;

bomz

http://blurredlogic.net/ebooks/Kernel_Driver_tut/KmdKit/include/w2k/guiddef.inc


http://blurredlogic.net/ebooks/Kernel_Driver_tut/KmdKit/include/w2k/devguid.inc

I comment all redefenition with windows.inc .leave only this two and this one
http://blurredlogic.net/ebooks/Kernel_Driver_tut/KmdKit/include/w2k/w2kundoc.inc

dedndave

you must have a typo or something
it assembles ok, here
i did convert the EOL's to cr/lf

i am currently using masm 6.15

dedndave

i see what the problem is   :biggrin:

you are calling the macro from a place in the source where there is no open segment
so - when it tries to get and restore the previous segment, there is none
put the macro call in .CONST, .DATA, .DATA?, or .CODE

.386

.model flat, stdcall
option casemap :none

GUID STRUCT
   Data1   DWORD   ?
   Data2   WORD   ?
   Data3   WORD   ?
   Data4   BYTE 8 dup(?)
GUID ENDS
PGUID typedef ptr GUID

IFNDEF GUID_DEFINED
DEFINE_GUID MACRO name:REQ, l:REQ, w1:REQ, w2:REQ, b1:REQ, b2:REQ, b3:REQ, b4:REQ, b5:REQ, b6:REQ, b7:REQ, b8:REQ

   local segn

   segn TEXTEQU @CurSeg
   
   .const
      ALIGN 4
      name   dd l
            dw w1
            dw w2
            db b1
            db b2
            db b3
            db b4
            db b5
            db b6
            db b7
            db b8

   @CurSeg ENDS
   segn SEGMENT

ENDM

ENDIF ; GUID_DEFINED

    .DATA                                                 ;it has to be in some open segment

DEFINE_GUID GUID_DEVCLASS_1394,            06bdd1fc1h, 0810fh, 011d0h, 0beh, 0c7h, 008h, 000h, 02bh, 0e2h, 009h, 02fh

dedndave

btw, that's a nice trick to preserve the segment
some of the masm32 macros could use that   :P

bomz

Hm. I need time to understand this. The way with GUID struct looks better and simplest. Don't share result according hutch politics. makes all very quickly with this code.
Quote.386
.model flat, stdcall
option casemap :none
include windows.inc
include ntddk.inc
.code
start:
end start
this batch file which open me INC on strings with errors
Quote@echo off
color 0a
cd %~dp1
\masm32\bin\ml.exe /c /coff /errorReport:none "%~1" 1>error.txt
for /f "tokens=2 delims=^(^)" %%i in ('findstr "(.*)" error.txt') do (
echo %%i
call notepad2 /g %%i ntddk.inc
)
and notepad2 http://www.flos-freeware.ch/notepad2.html
windows.inc need only two corrections in my opinion http://masm32.com/board/index.php?topic=1399.0
I try to send Four-F e-mail , and I am sure he not againsts and gives agreement. I want contain all includes to WINEXTRA_EXT.INC


QuoteDear Four-F, due to the clear policy of Mr. Hutch-and about the copyright, if you will not mind that I razderbanil latest version KMDKits-and in the process put your product in a modified form to the forum for collective MASM.COM edit because I complete Lamo and one can not do it. I would like to make a single file to a compatible MASM32 11, which of course will be marked with your main part and keep your copyright without mention of editors. Thanks in advance, Bum.
PS. once again I want to take this opportunity to thank you for KMDKits from the international community, which to this day remains the only guide in the world of drivers with the assembler.

bomz

batch to accumulate KMDKits files, and easy check it's order
Quote;@echo off>WINNT.INC
;color e0
;goto :make

.386

.model flat, stdcall
option casemap :none

include \masm32\include\windows.inc
include WINNT.INC

.code
start:

end start

:make
for /f "skip=30 delims=" %%i in (%~nx0) do (
rem <nul set /p value=;
findstr /B /V "include.*inc" .\w2k\%%i
echo.
)>>WINNT.INC
\masm32\bin\ml.exe /c /coff /errorReport:none "%~nx0" 1>error.txt
type error.txt
pause
exit /b


======== string №30 ========
ntddcdrm.inc
ntddchgr.inc
mountmgr.inc
mountdev.inc
ipfirewall.inc
gameport.inc
devioctl.inc
winioctl.inc
winsvc.inc
dbt.inc
accctrl.inc
ntdef.inc
ntstatus.inc
ntddk.inc
native.inc
ntdddisk.inc
ntddft.inc
ntddkbd.inc
ntddmou.inc
ntddscsi.inc
ntddser.inc
ntddstor.inc
ntddtdi.inc

bomz


QuoteHi! Thanks for the thanks from the world community :)

About the update for masm11 ... If the time has come such a course should be
update, so it is further yuzalos. My copyrights leave Itself,
but by prebednyatsya not. If the work is done, you need to specify who
it did.

"Updated on xx.xx.2013 for compatibility with MASM32 v.11 by Vasya
Pupkin ... "and no one to whom no complaints.

bomz

Here all includes from KMDKits in which I comment all redefinitions with WINDOWS.INC and WINEXTRA.INC. file windows.txt possible corrections in WINDOWS.INC - may be PFILE_SEGMENT_ELEMENT        typedef DWORD better. batch file makeKMDKits.bat connect all INC's in non-conflict order in some one (put all inc to w2k directory near batch file) leave only ntifs and guiddef with devguid. may be better resort all.....
seems still working