The MASM Forum Archive 2004 to 2012

Specialised Projects => Pelle's Macro Assembler Development => Topic started by: petrik on October 03, 2009, 06:49:01 PM

Title: poasm and winioctl.inc
Post by: petrik on October 03, 2009, 06:49:01 PM
I am in the process of writing a Win32 low level disk sector editor to cater for both FAT and NTFS. I have previously written one for DOS and was writing one for Windows 98 but became tired of all the messing around with 16-bit and 32--bit thunking. Win32 seems a lot less hassle.
I am running Windows XP Pro SP3.
I am using Japheth's winioctl.inc, porc.exe, poasm.exe and polink.exe.
The baic file assembles OK but everytime polink (\masm32\bin\polink.exe /VERBOSE /SUBSYSTEM:WINDOWS DiskEdit.obj rsrc.res) runs it throws up the following error: \masm32\include\winioctl.inc(363): fatal error: Must be inside a section.
The offending line 363 is 'if (_WIN32_WINNT ge 0400h)'.
I don't know what to change in winioctl.inc to make it compatible with poilink.
I would be extremely grateful for any help.
Many thanks.

Title: Re: poasm and winioctl.inc
Post by: hutch-- on October 07, 2009, 07:41:55 AM
petrik,

In the short term for testing, just load the two values into registers and do the comparison that way. Check the SIZE of both _WIN32_WINNT and 0400h to ensure they are the same so the comparison can be done. Also check the values in the include file to make sure they are correct.
Title: Re: poasm and winioctl.inc
Post by: japheth on October 07, 2009, 09:26:17 AM
Quote from: petrik on October 03, 2009, 06:49:01 PM
I am using Japheth's winioctl.inc, porc.exe, poasm.exe and polink.exe.
The baic file assembles OK but everytime polink (\masm32\bin\polink.exe /VERBOSE /SUBSYSTEM:WINDOWS DiskEdit.obj rsrc.res) runs it throws up the following error: \masm32\include\winioctl.inc(363): fatal error: Must be inside a section.
The offending line 363 is 'if (_WIN32_WINNT ge 0400h)'.
I don't know what to change in winioctl.inc to make it compatible with poilink.

Please elaborate more carefully which tool displays the error. Because PoLink is a linker, it has nothing to do with assembly source files (winioctl.inc).
If it is poasm which complains then just define _WIN32_WINNT somewhere. The winioctl.inc was generated from MS PSDK sources, IIRC common values are:

_WIN32_WINNT equ 400h  ;for Windows NT
_WIN32_WINNT equ 500h  ;for Windows XP
Title: Re: poasm and winioctl.inc
Post by: petrik on October 07, 2009, 06:11:57 PM
 :bg
Thank you very much Hutch and Japheth.
Simply adding _WIN32_WINNT equ 500h to winioctl.inc solved the problem.
Why didn't I figure this out myself?
I guess I'll have to stop being lazy and relying on everything always being in the relevant predefined .inc files.
Thanks again.