The MASM Forum

General => The Campus => Topic started by: bomz on January 22, 2013, 09:45:06 AM

Title: masm 10 vs 11
Post by: bomz on January 22, 2013, 09:45:06 AM
why 10 know XMMWORD but 11 not? it belong from includes of ml.exe?
Title: Re: masm 10 vs 11
Post by: qWord on January 22, 2013, 09:51:43 AM
at least ml v. 11.00.40825.2 knows the type XMMWORD  :icon_confused:
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 10:03:09 AM
hm. so ml.exe wich I download 1 year ago from microsoft site better than ml.exe contained in masm 11?

(http://s004.radikal.ru/i207/1301/28/5eace02b7ead.png)
8 version in masm10 I download it from microsoft
Title: Re: masm 10 vs 11
Post by: qWord on January 22, 2013, 10:09:28 AM
MASM32 == SDK by Hutch
MASM (ml.exe) == Microsoft macro assembler

All version of the MASM32 SDK contains ml v6, which does not support SSE.
The XMMWORD type was introduced with ml v8.
Title: Re: masm 10 vs 11
Post by: hutch-- on January 22, 2013, 10:10:56 AM
YES, ML.exe Version 10 or 11 is LATER than ML.EXE version 6.14.

Да, ml.exe версии 10 или 11 позже, чем ml.exe версии 6.14.
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 10:12:13 AM
so masm11 only for drivers?
It's ml.exe have no version

(http://s017.radikal.ru/i402/1301/63/ad172ee4fbae.png)
Title: Re: masm 10 vs 11
Post by: hutch-- on January 22, 2013, 10:14:35 AM
Shrug, I give up, not even Google translate helps.

Пожав плечами, я сдаюсь, даже Google Translate помогает.
Title: Re: masm 10 vs 11
Post by: qWord on January 22, 2013, 10:15:28 AM
run -> cmd->cd C:\masm32\bin -> ml.exe [enter] ;)
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 10:17:11 AM
http://www.masm32.com/masmdl.htm
need masm10

google translate

not even Google translate helps
даже Google Translate помогает means google traslate HELPS (not not helps - word order different in russian and english)
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 10:19:27 AM
give me please the better version of ml.exe for NOTsdk masm


masm11 also need this ml.exe?
http://www.microsoft.com/en-us/download/details.aspx?id=12654
Title: Re: masm 10 vs 11
Post by: jj2007 on January 22, 2013, 10:34:42 AM
Hi bomz,
Give JWasm (http://www.japheth.de/JWasm.html) a chance - it's a perfect clone of ML.xxx, and up-to-date.
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 10:36:57 AM
google translate confused me
masm32 v10 and masm32 v11 need this ml.exe http://www.microsoft.com/en-us/download/details.aspx?id=12654
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 10:38:42 AM
Quote from: jj2007 on January 22, 2013, 10:34:42 AM
Hi bomz,
Give JWasm (http://www.japheth.de/JWasm.html) a chance - it's a perfect clone of ML.xxx, and up-to-date.
JWASM.EXE and ML.EXE the same one?


it's work
QuoteECHO OFF
COLOR 9F
CLS
cd /d %~dp1
C:\masm32\bin\JWASM.exe /c /coff "%~1"
C:\masm32\bin\link.exe /subsystem:windows "%~n1.obj"
del "%~n1.obj"
pause

JWASM don't know ELSEIF  :redface:
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 11:28:22 AM
I download en_visual_studio_professional_2012_x86_dvd_920779
in packages\professionalcore find ml64.exe 11.0.50727.1. There is ml.exe x86?
Title: Re: masm 10 vs 11
Post by: frktons on January 22, 2013, 11:44:24 AM
Quote from: bomz on January 22, 2013, 11:28:22 AM
I download en_visual_studio_professional_2012_x86_dvd_920779
in packages\professionalcore find ml64.exe 11.0.50727.1. There is ml.exe x86?

yes, it is in your computer. search for it.
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 11:49:33 AM
I am not install it. I find ml64 in cab files
FL_ML64_EXE_*********************
Title: Re: masm 10 vs 11
Post by: frktons on January 22, 2013, 12:15:58 PM
Quote from: bomz on January 22, 2013, 11:49:33 AM
I am not install it. I find ml64 in cab files
FL_ML64_EXE_*********************
I don't know if that FL_ML64_EXE_ is what you are looking for.
Usually ML.EXE comes with Visual Studio or the SDK for your Operating
System.
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 12:18:14 PM
I am looking for FL_ML_EXE_*********** and can't find it in any cab files :(
Title: Re: masm 10 vs 11
Post by: qWord on January 22, 2013, 12:42:11 PM
Even if you could extract ml.exe, it won't run because there are several DLLs and a EXE that are also needed. Further more you need the corresponding VC++ redistributable package.
Install visual studio (c++ is needed) and then search and copy the following files in the Microsoft Visual Studio XX\VC\bin and Microsoft Visual Studio XX\Common7\IDE folders:
lib.exe
link.exe
ml.exe
msobj110.dll
mspdb110.dll
mspdbcore.dll
mspdbsrv.exe
msvcr110.dll

(this are the files that needed for version 11 (110))
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 12:45:41 PM
(http://smiles.kolobok.us/light_skin/thank_you2.gif)
Try it tomorrow. yearly morning already (http://smiles.kolobok.us/artists/connie/connie_16.gif)
Title: Re: masm 10 vs 11
Post by: Magnum on January 22, 2013, 01:16:09 PM
There are a lot of native Russians programmers at winasm.net.

Their English is better than most.

Hutch,

For many languages, I think Google is doing a best guess.




Title: Re: masm 10 vs 11
Post by: hutch-- on January 22, 2013, 04:52:19 PM
 :biggrin:

Now you know why I don't bother.  :P
Title: Re: masm 10 vs 11
Post by: jj2007 on January 22, 2013, 05:19:33 PM
Quote from: bomz on January 22, 2013, 10:38:42 AM
JWASM don't know ELSEIF  :redface:

You mean this?

.if eax
  nop
.elseif ; error
  print
.endif

The "blank" .elseif without arguments is a syntax error, it should be .else
Unfortunately, ML.exe tolerates this error. Just replace all .elseif in your source with .else, then fix the few errors.

All my sources assemble just fine with JWasm, even the RichMasm editor which is currently at 15,000+ lines. So go ahead and use JWasm, it's a very good software.
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 07:59:55 PM
I try to compile one my long code and error occurs ELSEIF
QuoteProject.asm(1016) : Error A2199: Syntax error in control-flow directive
Project.asm: 2905 lines, 1 passes, 422 ms, 0 warnings, 1 errors

There has been an error while assembling this project.

Quote
1016  ---             .ELSEIF

Studio 2012 need Windows 7 with framework 4.5 (?) so I ask C programers for this file list and waiting
Title: Re: masm 10 vs 11
Post by: jj2007 on January 22, 2013, 08:27:10 PM
Quote from: bomz on January 22, 2013, 07:59:55 PM
1016  ---             .ELSEIF

.ELSEIF is bad code, the correct syntax is .ELSE

The IF is used only with arguments:
.ELSEIF eax==123 || edx==456
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 08:54:08 PM
yes. it's incorrect

Quoteinvoke SendMessage,hwndCheckBox2,BM_GETCHECK,NULL,NULL
            .IF eax == BST_UNCHECKED
               add ProxySocks, 6
               mov SocksFlag, 1
            .ELSEIF
               mov SocksFlag, 0
            .ENDIF
Title: Re: masm 10 vs 11
Post by: jj2007 on January 22, 2013, 10:45:14 PM
Quoteinvoke SendMessage,hwndCheckBox2,BM_GETCHECK,NULL,NULL
            xor edx, edx
            .IF eax == BST_UNCHECKED
               add ProxySocks, 6
               inc edx
            .ENDIF
            mov SocksFlag, edx

Shorter & faster. And forget .ELSEIF without arguments, it's not proper assembler.
Title: Re: masm 10 vs 11
Post by: bomz on January 22, 2013, 11:28:05 PM
this is not last error or possible optimisation in 2900 line code.

masm11 + ml.exe 8.0.50727.104 is enough. but interesting try very last version with YMMWORD (http://smiles.kolobok.us/artists/connie/connie_pullpigtails.gif)

http://msdn.microsoft.com/ru-ru/library/vstudio/ee404743%28v=vs.100%29.aspx
Title: Re: masm 10 vs 11
Post by: Magnum on January 22, 2013, 11:39:33 PM
Quote from: qWord on January 22, 2013, 12:42:11 PM
Even if you could extract ml.exe, it won't run because there are several DLLs and a EXE that are also needed. Further more you need the corresponding VC++ redistributable package.
Install visual studio (c++ is needed) and then search and copy the following files in the Microsoft Visual Studio XX\VC\bin and Microsoft Visual Studio XX\Common7\IDE folders:
lib.exe
link.exe
ml.exe
msobj110.dll
mspdb110.dll
mspdbcore.dll
mspdbsrv.exe
msvcr110.dll

(this are the files that needed for version 11 (110))

I found that one other thing is necessary.

In mspdbsrv.exe

7c9011f9 0f85f7ec0000    jne     ntdll!RtlDeactivateActivationContextUnsafeFast+0x28

change to                         jne     loc_401449FindMe

Andy
Title: Re: masm 10 vs 11
Post by: qWord on January 22, 2013, 11:48:43 PM
Quote from: Magnum on January 22, 2013, 11:39:33 PMI found that one other thing is necessary.

In mspdbsrv.exe

7c9011f9 0f85f7ec0000    jne     ntdll!RtlDeactivateActivationContextUnsafeFast+0x28

change to                         jne     loc_401449FindMe
:dazzled:
Title: Re: masm 10 vs 11
Post by: BogdanOntanu on January 23, 2013, 01:44:07 AM
Quote from: Magnum on January 22, 2013, 11:39:33 PM
Quote from: qWord on January 22, 2013, 12:42:11 PM
Even if you could extract ml.exe, it won't run because there are several DLLs and a EXE that are also needed. Further more you need the corresponding VC++ redistributable package.
Install visual studio (c++ is needed) and then search and copy the following files in the Microsoft Visual Studio XX\VC\bin and Microsoft Visual Studio XX\Common7\IDE folders:
lib.exe
link.exe
ml.exe
msobj110.dll
mspdb110.dll
mspdbcore.dll
mspdbsrv.exe
msvcr110.dll

(this are the files that needed for version 11 (110))

I found that one other thing is necessary.

In mspdbsrv.exe

7c9011f9 0f85f7ec0000    jne     ntdll!RtlDeactivateActivationContextUnsafeFast+0x28

change to                         jne     loc_401449FindMe

Andy

Andy / Magnum / etc

Please stop posting careless / useless stuff. Also stop posting stuff that is in the "gray area" at the edge of reversing / hacking.
And surely stop posting about changing other's people software :D
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 03:30:03 AM
download en_visual_studio_professional_2012_x86_dvd_920779.iso, insert it virtual CDROM. unpack all cab files in one directory
Quote@ECHO OFF
COLOR 9F
rem dir /b G:\
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /R "G:\" %%I IN (.) DO (
SET string=%%I
REM echo !string:~0,-1!*.cab
expand !string:~0,-1!*.cab -F:* c:\temp
)
pause
and find all need files. rename and put them to BIN. ML.exe 11.0.50727.1

ML.exe is not Win32 application error (http://smiles.kolobok.us/light_skin/vava.gif)

http://rghost.ru/43234706
Title: Re: masm 10 vs 11
Post by: Magnum on January 23, 2013, 03:42:57 AM
Senor Bomz,

Does it have to be a virtual Cd, will a real one work ?

Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 03:48:32 AM
http://www.magiciso.com/tutorials/miso-magicdisc-overview.htm

I don't good understand, but think yes
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 03:56:15 AM
No more animated images thank you.
Title: Re: masm 10 vs 11
Post by: dedndave on January 23, 2013, 03:59:59 AM
i didn't have any luck getting masm v11 to run under xp32, either
if you do, however, it is also nice to get the dumpbin, cvtres, and rc programs (and any required dll's)
for version 9, there was a rcdll.dll file required by rc.exe
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 04:13:38 AM
http://rghost.ru/43235970

can't find rc.exe
Title: Re: masm 10 vs 11
Post by: hutch-- on January 23, 2013, 04:22:05 AM
Dave,

If it won't run under XP 32 bit you have something wrong with your OS setup, it was developed under XP SP3.
Title: Re: masm 10 vs 11
Post by: dedndave on January 23, 2013, 04:27:28 AM
we are talking masm v11, not masm32 v11   :P
(a name/number issue that makes it difficult to search, by the way)

i get "___ is not a valid win32 application" in a message box
then, upon termination, i get the strange message "Access Denied" in the console window

i know for 8, 9, 10, the supporting DLL's had to be in the same folder, and that folder had to be PATH'ed
i can get all those to work, no problem
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 04:30:46 AM
may be in 2012 studio files change through installing not only renamed


i download en_visual_studio_premium_2012_x86_dvd_920758.iso too. prof better than premium?
Title: Re: masm 10 vs 11
Post by: dedndave on January 23, 2013, 04:52:22 AM
i would guess pro is better than premium   :P

you may be right about the build
i see a lot of xml files - it may be that the manifests are not present
or - it could be that some other DLL that eludes us is required - lol

i say - if you can get masm version 10 working, why mess with 11   :t
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 05:06:42 AM
in masm32.v.11 includes without errors and full.
But I see that it don't know XMMWORD and try understand why. Now when I use ml.exe 8.0 SSE and SDK - cool
Title: Re: masm 10 vs 11
Post by: Magnum on January 23, 2013, 05:21:59 AM
Quote from: dedndave on January 23, 2013, 04:27:28 AM
we are talking masm v11, not masm32 v11   :P
(a name/number issue that makes it difficult to search, by the way)

i get "___ is not a valid win32 application" in a message box
then, upon termination, i get the strange message "Access Denied" in the console window

i know for 8, 9, 10, the supporting DLL's had to be in the same folder, and that folder had to be PATH'ed
i can get all those to work, no problem

A look around will probably find a fix unless it's still too new.

Something like invoke MakeItThink_6.1.7207, 21.

But I have seen version 6.14 work with all kinds of code, even the hidden, I mean undocumented APIs.

Andy

"Just the facts, ma'am"
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 07:32:15 AM
Download en_visual_studio_2010_professional_x86_dvd_509727.iso extract ML.EXE from it. it's work. lib.exe and link.exe don't work - they wan't dll but this dll not NT application or there is not such dll. YMMWORD - it's know. What sence in it? (http://smiles.kolobok.us/light_skin/unknw.gif)

ML.EXE.10.0.30319.1.ZIP (http://rghost.ru/43241296)


YMMWORD - 256 bit (http://smiles.kolobok.us/light_skin/scare.gif)
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 07:58:46 AM
I compile all my "long" codes and "unusual" codes - all work.
Trying to make driver - it's impossible without old instruments. May be I don't understand something now
SDK.ZIP (http://rghost.ru/43241876)
Title: Re: masm 10 vs 11
Post by: Magnum on January 23, 2013, 08:53:31 AM
You don't need any new version to make a driver.

Version 6.14 works just fine.
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 09:04:33 AM
the deal is not in ml.exe. masm32 11 - SDK version. but to compile my driver I need
ntstatus.inc
ntddk.inc
ntddstor.inc
guiddef.inc

Much simple method to find files in cab files
Quote@ECHO OFF
COLOR 9F
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /R "G:\" %%I IN (.) DO (
SET string=%%I
expand !string:~0,-1!*.cab -D>>LIST.TXT
)
pause


download mspdb100.dll 10.0.30319.1 from here
http://www.down-dll.com/index.php?file-download=mspdb100.dll&dsc=Microsoft%C2%AE-Program-Database#
and lib.exe link.exe begin working
full kit: ml.exe lib.exe link.exe msvcr100.dll mspdb100.dll cvtres.exe dumpbin.exe editbin.exe rc.exe rcdll.dll v.10.0.30319.1
ML.EXE.10.0.30319.1.ZIP (http://rghost.ru/43243354)

may be this dll better I rename msvcr100
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100_clr0400
Title: Re: masm 10 vs 11
Post by: Magnum on January 23, 2013, 11:07:49 AM
The KMD kit is much simpler.

You can have a driver written in 10 minutes using Four-F examples.

Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 12:19:44 PM
Do not post copyright material in this forum.

I don't care if you want to hide behind poor English.
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 07:55:55 PM
This was to check new version without changes files in original masm32 directory. Need only rename original directory.
This C programmers give me new files from updated studio 2010. ML.EXE 10.0.40219.1 [[[[ NO MEANS NO ]]]]
I try them - it's work. and here exactly good msvcr100_clr0400.dll
This files rghost del in a week
Title: Re: masm 10 vs 11
Post by: hfheatherfox07 on January 23, 2013, 08:10:06 PM
Quote from: bomz on January 23, 2013, 09:04:33 AM
the deal is not in ml.exe. masm32 11 - SDK version. but to compile my driver I need
ntstatus.inc
ntddk.inc
ntddstor.inc
guiddef.inc



Please google "KmdKit"
You will find KmdKit.zip ..... Those includes are in that kit  :biggrin:
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 08:30:06 PM
Yes. I add them like with masm32v10. I think that SDK version include them already.
Title: Re: masm 10 vs 11
Post by: japheth on January 23, 2013, 09:02:19 PM
Quote from: bomz on January 23, 2013, 03:30:03 AM
ML.exe is not Win32 application error (http://smiles.kolobok.us/light_skin/vava.gif)

I checked this. The Masm 11 binary has value 6 in the "OS version" and "Subsystem version" fields of the file header - hence it requires Vista at least.

To patch ML.EXE v11 to make it work with XP? Difficult, because:

- the binary uses import GetTickCount64 in kernel32.dll, which isn't defined in XP
- the CRT MSVCRT110.dll, which is referenced by ML.EXE v11,  also expects a few exports that aren't defined in XP

Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 09:12:44 PM
It's not very important because ml.exe v.10 knows YMMWORD 256bit - so it supported high version SSE and may be some new instructions (which my proccessor not support)

Compile one my code with new files exe file 32 kb - but with ml.exe 8.0 it's only 29.5 kb. after UPS compression size equal - 14.5 kb

Used for 256-bit multimedia operands with Intel Advanced Vector Extensions (AVX) instructions.

QuoteThe width of the SIMD register file is increased from 128 bits to 256 bits, and renamed from XMM0–XMM15 to YMM0–YMM15. In processors with AVX support, the legacy SSE instructions (which previously operated on 128-bit XMM registers) now operate on the lower 128 bits of the YMM registers.
Title: Re: masm 10 vs 11
Post by: bomz on January 23, 2013, 11:04:23 PM
polink polib porc poasm not support AVX instructions :(
What files studio use for make dll's?


Quote@ECHO OFF
COLOR 9F
\masm32\bin\ml /c /coff /Cp MessBox.asm
\masm32\bin\link /DLL /def:MessBox.def /FILEALIGN:0x200 /subsystem:windows /libpath:C:\masm32\lib MessBox.obj
pause
:)
Title: Re: masm 10 vs 11
Post by: dedndave on January 23, 2013, 11:53:49 PM
Quote from: japheth on January 23, 2013, 09:02:19 PM
- the binary uses import GetTickCount64 in kernel32.dll, which isn't defined in XP
- the CRT MSVCRT110.dll, which is referenced by ML.EXE v11,  also expects a few exports that aren't defined in XP

it figures  :P
they could be provided externally, and the versions set, i suppose
but, as i said before, i doubt that it's worth all the effort
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 12:19:40 AM
may be microsoft kill xp? (http://smiles.kolobok.us/light_skin/girl_cray.gif)


exist practically all patches for windows 98, i think xp still live about 10-15 years
Title: Re: masm 10 vs 11
Post by: dedndave on January 24, 2013, 12:57:16 AM
we have another year and a half in the "extended" support life cycle   :(

http://support.microsoft.com/lifecycle/?ln=en-gb&c2=1173 (http://support.microsoft.com/lifecycle/?ln=en-gb&c2=1173)

for the most part, that just means security updates
i don't really want to install anything more
my idea of security is a disk image
Title: Re: masm 10 vs 11
Post by: Magnum on January 24, 2013, 01:55:51 AM
Quote from: dedndave on January 24, 2013, 12:57:16 AM
we have another year and a half in the "extended" support life cycle   :(

http://support.microsoft.com/lifecycle/?ln=en-gb&c2=1173 (http://support.microsoft.com/lifecycle/?ln=en-gb&c2=1173)

for the most part, that just means security updates
i don't really want to install anything more
my idea of security is a disk image

Sometimes I am concerned about security updates.

They don't go into details about what exactly each one does.

It's very rare, but sometimes something will stop working after you have applied an update.

Agree with you about making disk images as part of your recovery toolbox.




I agree.



Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 06:49:35 AM
Why code compilled with MASM.v.11 get exe files bigger than the same code compiled by MASM.v.10?
In the very end of file add the sign table 2 kb long. May be this ml.exe or link.exe command parametres belong?

http://i060.radikal.ru/1301/26/f98f580fcc89.png

yes - link.exe the reason
Title: Re: masm 10 vs 11
Post by: qWord on January 24, 2013, 07:06:36 AM
that are maybe relocation data ... however also link v10 add these automatically. (disable: /DYNAMICBASE:NO)
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 07:10:16 AM
(http://smiles.kolobok.us/light_skin/thank_you2.gif)

do you know some else use full keys?
I just today read about it for ml and link

say please a few word about STUB
Title: Re: masm 10 vs 11
Post by: qWord on January 24, 2013, 07:26:14 AM
Quote from: bomz on January 24, 2013, 07:10:16 AMdo you know some else use full keys?
What key?

Quote from: bomz on January 24, 2013, 07:10:16 AMsay please a few word about STUB
If you mean the DOS stub program, there is nothing more to say then that it exist only for compatibility reasons.
(Running a PE from DOS, the stub shows a message that this program can't run under DOS)
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 07:35:00 AM
command prompt keys for link.exe and ml.exe. I don't understand anuthing because don't know anyting about linking
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 07:47:28 AM
.386
.model flat, stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\ntdll.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\ntdll.lib

.code

start:
invoke  RtlAdjustPrivilege,13h,1h,0h,esp
invoke  NtShutdownSystem,1
invoke ExitProcess, 0
end start


This code with masm32.11 2.5 kb
masm32.11 /dynamicbase:no 2.0 kb
masm32.10 1.5 kb
why?

masm32.10 makes 2.5 kb files for "little" code, 2.0  for "little" code without data? section, and 1.5 kb  for "little" code without data and data? section

/merge:.rdata=.text 1 kb without data and data?
Title: Re: masm 10 vs 11
Post by: ragdog on January 24, 2013, 08:27:45 AM
Hey

You can experiment with the ml and link but the Original Ml and link from Hutch´s Sdk works perfect
or Jwasm.

With Jwasm can your make your own exe like

Quote
op stack=0x40000
format windows nt
runtime windows=4.0
op osname='Windows NT'
op linkversion=1.9
op version=1.0
op checksum
op norelocs
file program.obj

And works a Ml or link not anymore of a later windows scream all here and find a good solution  :biggrin: 8)


For build your Driver with or without KmdKit works fine with Masm32 v10 and v11,
and on a XP-Win7

Regards,
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 08:46:09 AM
.data?
value YMMWORD ?
OK
.data
value YMMWORD 0
ERROR

how init YMMWORD value?


Title: Re: masm 10 vs 11
Post by: qWord on January 24, 2013, 09:01:11 AM
As for XMMWORD, you can't initialize these types, because they represent a union of diffrent typed arrays. As a solution, you can either use it with the LABEL directive or use a corresponding structure/union.

foo LABLE YMMWORD
db 32 dup (0)
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 09:02:05 AM
(http://smiles.kolobok.us/light_skin/dance.gif)
value YMMWORD 0.0
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 10:17:46 AM
.386

.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib

.data
mestitle db "YMMWORD",0
form db "%04hx%04hx%04hx%04hx%04hx%04hx%04hx%04hx", 0
value YMMWORD 6.1111

.data?
buffer db 512 dup(?)

.code
start:
invoke wsprintf,ADDR buffer,ADDR form,\
dword ptr[value],dword ptr[value+4],dword ptr[value+8],dword ptr[value+12],\
dword ptr[value+16],dword ptr[value+20],dword ptr[value+24],dword ptr[value+28]

invoke MessageBox,0,ADDR buffer,ADDR mestitle,MB_ICONASTERISK
invoke ExitProcess,0
end start

(http://smiles.kolobok.us/light_skin/vava.gif)

http://www.masmforum.com/board/index.php?PHPSESSID=8d46cd4ecb1688be429ab49694ec53e6&topic=15872.0;wap2
Quotejj2007:
It's actually a lot more complicated...
Masm does not initialise the XMMWORD (but it does initialise the OWORD)
JWasm initialises both.
Title: Re: masm 10 vs 11
Post by: hutch-- on January 24, 2013, 12:24:47 PM


IF 0  ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
                      Build this template with "CONSOLE ASSEMBLE AND LINK"
ENDIF ; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include\masm32rt.inc

    .data
      align 16
      item16 dd 0,0,0,0
      item32 dd 0,0,0,0,0,0,0,0

    .code

start:
   
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    call main
    inkey
    exit

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

main proc

    print ustr$(lengthof item16),13,10,13,10
    print ustr$(lengthof item32),13,10,13,10

    ret

main endp

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

end start
Title: Re: masm 10 vs 11
Post by: bomz on January 24, 2013, 08:01:41 PM
OK.

Install 2010 studio and update it. Is it possible to find in it something usefull else? May be some libs , includes or exe files?

ML.EXE 10.0.40219.1 not support /AT - report error but compile. and not support directives: .186 .286 .8087
Title: Re: masm 10 vs 11
Post by: bomz on January 25, 2013, 05:27:01 AM
hutch--
I find in studio 2010 a lot of LIB's, try convert them to INC with imp2inc (and protoize) and obtain approximately the same includes.
What principle use which includes include to masm32 and what is not?
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 12:22:17 AM
ML.EXE 10.0.40219.1 m32lib fptoa.asm

    fbstp [esp]
(73) Instruction error must be the same size

    fbstp real10 ptr[esp]
Title: Re: masm 10 vs 11
Post by: hutch-- on January 26, 2013, 12:28:37 AM
Thanks but we already know that, from memory ML started to have this error in version 8.0. It builds fine in version 6.14.
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 12:33:19 AM
must be ready for new ml.exe. many my codes don't compile and need correction
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 12:35:10 AM
byte word dword qword fword oword

real10 - ?
Title: Re: masm 10 vs 11
Post by: dedndave on January 26, 2013, 12:38:29 AM
real10   :biggrin:

tReal   real10 1.05

    fld real10 ptr tReal


there is also "TBYTE", but i think real10 works better
Title: Re: masm 10 vs 11
Post by: jj2007 on January 26, 2013, 01:33:58 AM
Quote from: bomz on January 26, 2013, 12:35:10 AM
byte word dword qword fword oword

What the f*** is fword?
Title: Re: masm 10 vs 11
Post by: qWord on January 26, 2013, 01:47:33 AM
Quote from: jj2007 on January 26, 2013, 01:33:58 AM
Quote from: bomz on January 26, 2013, 12:35:10 AM
byte word dword qword fword oword

What the f*** is fword?
6 bytes
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 04:23:10 AM
I never use macros-es or masm32.lib, datetime.lib, msvcrt.lib, but there is many code examples whit them.
Is it necessary this lib where compiling through MASM32 instalation or it is possible to make them one time?
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 07:48:37 AM
Two libs with inc2l + new link.exe creates with errors (http://smiles.kolobok.us/standart/sad.gif)
Title: Re: masm 10 vs 11
Post by: Vortex on January 26, 2013, 08:40:30 AM
Quote from: bomz on January 26, 2013, 04:23:10 AM
I never use macros-es or masm32.lib, datetime.lib, msvcrt.lib, but there is many code examples whit them.
Is it necessary this lib where compiling through MASM32 instalation or it is possible to make them one time?

Hi bomz,

You can use your own libraries and macros. I would recommend you to have a look at masm32.lib and msvcrt.lib  Especially masm32.lib provides a lot of useful functions for assembly coders.
Title: Re: masm 10 vs 11
Post by: Magnum on January 26, 2013, 08:54:47 AM
I use masm 6.14 and it has worked fine making device drivers, using Undocumented APIs, etc.

I chuckled the other day when I found some code that used one of "Undocumented APIs".

It was dated 2001. Twelve years later it's still undocumented.

Randy

Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 08:59:35 AM
if I need useful codes - I use C with asm includes

QuoteYou can use your own libraries and macros
lib makes on different computers are different?
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 10:09:43 AM
How change (and use DllUnload DllInitialize) lvcodek.inc? DllInitialize use unicode string

; --------------------------------------------------------------------------------------------------
;                           lvcodek.inc Copyright The MASM32 SDK 1998-2010
; --------------------------------------------------------------------------------------------------

IFNDEF LVCODEK_INC
LVCODEK_INC equ <1>

CodecOpen PROTO STDCALL :DWORD
DllUnload PROTO STDCALL
DllInitialize PROTO STDCALL :DWORD

ELSE
  echo ------------------------------------------
  echo WARNING duplicate include file lvcodek.inc
  echo ------------------------------------------
ENDIF


inc2l lvcodek.inc

How use in inc directive PRIVATE?
Title: Re: masm 10 vs 11
Post by: dedndave on January 26, 2013, 02:09:54 PM
SomeFunc PROC PRIVATE

    ret

SomeFunc ENDP
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 07:48:52 PM
in INC no proc and endp.
How make lib from inc without inc2l.exe? I think inc2l convert inc to some asm code and compile

psxdll.inc
Microsoft (R) Macro Assembler Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: psxdll.asm
psxdll.asm(225) : error A2008:syntax error : proc
psxdll.asm(227) : error A2008:syntax error : endp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'psxdll.obj'
Microsoft (R) Macro Assembler Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

lvcodek.inc
Microsoft (R) Macro Assembler Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: lvcodek.asm
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

lvcodek.def : warning LNK4104: export of symbol 'DllUnload' should be PRIVATE
   Creating library lvcodek.lib and object lvcodek.exp
Title: Re: masm 10 vs 11
Post by: dedndave on January 26, 2013, 08:14:38 PM
Erol (Vortex) has a couple of nice tools for this

vortex.masmcode.com (http://vortex.masmcode.com)

Title: Re: masm 10 vs 11
Post by: japheth on January 26, 2013, 08:27:14 PM
Quote from: bomz on January 26, 2013, 07:48:52 PM
I think inc2l convert inc to some asm code and compile

That's would be pretty difficult. The old-style import libraries include members that have sections with the COMDAT attribute - I don't know how this attribute could be set with Masm. Also, the members in import libs usually have "no names" - how are you supposed to add such a member?

The simplest approach to create an import lib is to create a .DEF file and then use either the already mentioned vortex tools or polib or wlib.
Title: Re: masm 10 vs 11
Post by: Vortex on January 26, 2013, 08:45:14 PM
Hi bomz,

Can you attach here your include file? Maybe, I can help you to convert it to an import library.
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 08:58:23 PM
all include files in masm32.v11. the problem is that some mistakes occurs with new ml.exe and link.exe version from studio 2010
http://rghost.ru/43320381

and i find that there is no DllInitialize PROTO STDCALL :DWORD in new includes, only DllUnload PROTO STDCALL



in fptoa.asm fptoa2.asm I changes 73 row to     fbstp real10 ptr [esp] now masm32.lib creates OK the same size than with old ml.exe

fpu.lib - Ok
datetime.lib - Ok
stiill this two inc to lib psxdll lvcodek. and msvcrt.lib - something wrong too
Title: Re: masm 10 vs 11
Post by: Vortex on January 26, 2013, 09:26:52 PM
Hi bomz,

The link http://rghost.ru/43320381 is inaccessible.

Hutch's inc2l works fine :

D:\masm32\bin>cd \masm32\tools\inc2l

D:\masm32\tools\inc2l>inc2l.exe d:\masm32\include\psxrtl.inc
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: psxrtl.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

   Creating library psxrtl.lib and object psxrtl.exp

D:\masm32\tools\inc2l>inc2l.exe d:\masm32\include\lvcodek.inc
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: lvcodek.asm
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

   Creating library lvcodek.lib and object lvcodek.exp


In the \masm32\bin folder, don't try to replace ml.exe version 6.14.8444 with the one supplied with Visual Studio 2010.
Title: Re: masm 10 vs 11
Post by: dedndave on January 26, 2013, 09:29:55 PM
yah, but your inc2lib tool makes much smaller libs   :P
and it doesn't care which version of masm you use
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 09:30:42 PM
with old ml.exe 6.14.8444 and link.exe and lib.exe - all OK. of course I no need the very last ml.exe with AVX because my processor not support them, but I always use ml.exe 8 with SSE - which have the same problem with the same files

[DELETED AGAIN]

Quoteyah, but your inc2lib tool makes much smaller libs   
and it doesn't care which version of masm you use
not smaller they contain less fuctions

---------------------------------------------------------------------------------------------------------
Bomz, if you post another link to copyright code, I will block you from posting!!!!!!!!
---------------------------------------------------------------------------------------------------------
Title: Re: masm 10 vs 11
Post by: Vortex on January 26, 2013, 09:39:35 PM
Hi bomz,

Please accept my apologies but why do you need ml 8 to build the import libraries? Any specific reason?
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 09:45:45 PM
Are you sure that new files works good with old inc and lib's create with ml6?


when I do this I understand the difference between versions, find DllInitialize. and first time thought about how lib makes
Title: Re: masm 10 vs 11
Post by: Vortex on January 26, 2013, 10:12:57 PM
Hi bomz,

To use and build import libraries, there is no any problems with the tools supplied with the Masm32 package.

Creating import libraries is not difficult. One method is to create temporary .asm files to build dummy system DLLs like kernel32.dll  The product of the linker will be a dynamic link library , an .exp file and finally an import library. You can keep the import lib and delete the other temporary files.

The second method is to use Pelles library manager polib.exe to build import libraries. You only .def - module definition files.

A third method is to study the MS COFF file format specification and build your tool creating libs from .def files or include files.

Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 10:21:33 PM
May be exist good short article to understand the main principles what is this - libs, exp, def ....
Title: Re: masm 10 vs 11
Post by: Vortex on January 26, 2013, 10:25:53 PM
Hi bomz,

Here is a nice article by Iczelion :

http://win32assembly.programminghorizon.com/importlib.html
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 10:35:09 PM
Thanks (http://smiles.kolobok.us/artists/laie/Laie_21.gif)
Title: Re: masm 10 vs 11
Post by: bomz on January 26, 2013, 11:58:21 PM
@echo off
color 9F
undname /show_flags
undname ??0?$_SpinWait@$00@details@Concurrency@@QAE@P6AXXZ@Z
pause


undname name undecorator

@echo off
color 9F
cd %~dp0
C:\masm32\bin\dumpbin.exe /EXPORTS psxdll.dll /out:psxdll.txt
echo LIBRARY psxdll>psxdll.def
echo EXPORTS>>psxdll.def
for /f "skip=15 tokens=4 delims= " %%i in (psxdll.txt) do echo %%i>>psxdll.def
C:\masm32\bin\lib.exe /def:psxdll.def
pause
Title: Re: masm 10 vs 11
Post by: bomz on January 27, 2013, 02:06:17 AM
psxdll.inc row 81 comment

Quote;pause PROTO C :VARARG


I think most psxdll.inc function is dll code internal and there is no sence to export them, you never know what they do only you disassemly dll. old lib was good
Title: BOMZ, last warning!!!!
Post by: hutch-- on January 27, 2013, 06:54:00 AM
---------------------------------------------------------------------------------------------------------
Bomz, if you post another link to copyright code, I will block you from posting!!!!!!!!
---------------------------------------------------------------------------------------------------------

I don't care if you hide behind translation issues, I will not carry the responsibility of illegally posted copyright code for you.

Title: Re: masm 10 vs 11
Post by: Vortex on January 27, 2013, 08:24:17 AM
Hi bomz,

psxdll.dll provides the runtime environment of the Microsoft POSIX subsystem. What are you trying to achieve?
Title: Re: masm 10 vs 11
Post by: bomz on January 28, 2013, 08:12:49 AM
Vortex
Thanks for link. (http://smiles.kolobok.us/light_skin/thank_you2.gif)
Quote@echo off
color 9F
if "%~1"=="" goto End
cd /d %~dp0
type %~nx1>nul
rem copy %~nx1 tmp.tmp
SetLocal EnableDelayedExpansion
echo LIBRARY %~n1>%~n1.def
echo ;__NO_NOISE__>%~n1.asm
echo .386>>%~n1.asm
echo .model flat,stdcall>>%~n1.asm
echo option casemap :none>>%~n1.asm
echo .code>>%~n1.asm
echo LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD>>%~n1.asm
echo mov eax, 1 >>%~n1.asm
echo ret>>%~n1.asm
echo LibMain endp>>%~n1.asm
for /f "skip=2 tokens=1,2,3,4 delims= " %%w in ('FIND /I "PROTO " %~nx1') do (
   if not %%w==LibMain (
   set procname=%%w
   set private=!procname:~0,1!
   if not !private!==^; (
   set private=
   if %%w==DllUnload set private= PRIVATE
   if %%w==DllInitialize set private= PRIVATE
   echo EXPORTS !procname!!private!>>%~n1.def
      set string=%%y
      set string1=%%z
      if not "%%y"=="STDCALL" (
      if not "%%y"=="C" (
      if not "%%y"=="" (
      set string=
      set string1=%%y
      )
      )
      )
      if not "!string1!"=="" (
      for /f "tokens=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 delims=:" %%a in ("!string1!") do (
         if not "%%a"=="" set string=!string!param01:%%a
         if not "%%b"=="" set string=!string!param02:%%b
         if not "%%c"=="" set string=!string!param03:%%c
         if not "%%d"=="" set string=!string!param04:%%d
         if not "%%e"=="" set string=!string!param05:%%e
         if not "%%f"=="" set string=!string!param06:%%f
         if not "%%g"=="" set string=!string!param07:%%g
         if not "%%h"=="" set string=!string!param08:%%h
         if not "%%i"=="" set string=!string!param09:%%i
         if not "%%j"=="" set string=!string!param10:%%j
         if not "%%k"=="" set string=!string!param11:%%k
         if not "%%l"=="" set string=!string!param12:%%l
         if not "%%m"=="" set string=!string!param13:%%m
         if not "%%n"=="" set string=!string!param14:%%n
         if not "%%o"=="" set string=!string!param15:%%o
         if not "%%p"=="" set string=!string!param16:%%p
         if not "%%q"=="" set string=!string!param17:%%q
         if not "%%r"=="" set string=!string!param18:%%r
         if not "%%s"=="" set string=!string!param19:%%s
         if not "%%t"=="" set string=!string!param20:%%t
         if not "%%u"=="" set string=!string!param21:%%u
         if not "%%v"=="" set string=!string!param22:%%v
         if not "%%w"=="" set string=!string!param23:%%w
         if not "%%x"=="" set string=!string!param24:%%x
         if not "%%y"=="" set string=!string!param25:%%y
         if not "%%z"=="" set string=!string!param26:%%z
            )
         )
   echo !procname! proc !string!>>%~n1.asm
   echo ret>>%~n1.asm
   echo !procname! endp>>%~n1.asm
)
)
)
echo end LibMain>>%~n1.asm
\masm32\bin\ml.exe /c /coff /Cp %~n1.asm
\masm32\bin\Link.exe /noentry /subsystem:windows /dll /def:%~n1.def %~n1.obj
del %~n1.dll
del %~n1.obj
del %~n1.exp
del %~n1.def
del %~n1.asm
:End
pause
(http://smiles.kolobok.us/artists/just_cuz/JC_link.gif) (http://win32assembly.programminghorizon.com/importlib.html)
Title: Re: masm 10 vs 11
Post by: bomz on January 28, 2013, 07:22:51 PM
awk script, thanks for Alex_Piggy. works very very quickly (http://smiles.kolobok.us/light_skin/girl_witch.gif)

@echo off
color 9F
if "%~1"=="" exit /b
cd /d %~dp0
awk -v "NAME=%~n1" -f script.awk "%~1"
\masm32\bin\ml.exe /c /coff /Cp %~n1.asm
\masm32\bin\Link.exe /noentry /subsystem:windows /dll /def:%~n1.def %~n1.obj
del %~n1.dll
del %~n1.obj
del %~n1.exp
del %~n1.def
del %~n1.asm
pause


BEGIN {
deffile=NAME".def";
asmfile=NAME".asm";
print "LIBRARY "NAME>deffile;
print ";__NO_NOISE__\n.386\n.model flat,stdcall\noption casemap :none\n.code\nLibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD\nmov eax, 1 \nret\nLibMain endp" > asmfile;
}
/PROTO/{
procname = $1;
if (procname==";;;;") next;
if (procname == "DllUnload" || procname == "DllInitialize") private= " PRIVATE";
if (procname != "LibMain") {
print "EXPORTS",procname""private>>deffile;
if ($3 != "STDCALL" && $3 != "C" && $3 != "" ) {string="";string1=$3;string_out="";} else {string=$3; string1=$4;string_out=string" ";}
i = split(string1,part,":");
for(j = 1; j < i; j++) string_out=sprintf(string_out "param%0.2d"":"part[j+1],j);
print procname " proc " string_out>>asmfile;
print "ret">>asmfile;
print procname " endp">>asmfile;
}
}
END {
print "end LibMain">>asmfile;
}

http://gnuwin32.sourceforge.net/packages/gawk.htm
Title: Re: masm 10 vs 11
Post by: Vortex on January 29, 2013, 05:13:37 AM
Hi bomz,

Supporting Windows with UNIX\Linux command-line tools is a nice idea.
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 05:28:36 AM
It's not me idea. I use big forum with live bat theme where wide use sed and awk, I ask how better make bat file and Alex do me this script.
last version - ignore all string with first ; sign after tabs or spaces
BEGIN {
deffile=NAME".def";
asmfile=NAME".asm";
print "LIBRARY "NAME>deffile;
print ";__NO_NOISE__\n.386\n.model flat,stdcall\noption casemap :none\n.code\nLibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD\nmov eax, 1 \nret\nLibMain endp" > asmfile;
}
/PROTO/{
procname = $1;
"if (procname ~ /^[\x20\x09]*;/ ) next;"
if (procname == "DllUnload" || procname == "DllInitialize") private= " PRIVATE";
if (procname != "LibMain") {
print "EXPORTS",procname""private>>deffile;
if ($3 != "STDCALL" && $3 != "C" && $3 != "" ) {string="";string1=$3;string_out="";} else {string=$3; string1=$4;string_out=string" ";}
i = split(string1,part,":");
for(j = 1; j < i; j++) string_out=sprintf(string_out "param%0.2d"":"part[j+1],j);
print procname " proc " string_out>>asmfile;
print "ret">>asmfile;
print procname " endp">>asmfile;
}
}
END {
print "end LibMain">>asmfile;
}
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 05:32:18 AM
The main that script allow easy see what it do, and easy change it properties. the includes from kmdkit have another structure for ex
Title: Re: masm 10 vs 11
Post by: Vortex on January 29, 2013, 05:34:30 AM
Hi bomz,

I know that the idea exists since long time. I wanted to appreciate your efforts supporting the batch file with those external tools.
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 06:39:53 AM
(http://smiles.kolobok.us/light_skin/curtsey.gif)

Alex interested in task with practical application, ask me a lot about libs (i don't know anything) and I think makes useful script for masm
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 11:27:00 AM
masm32.lib create good with ml.exe 6 and ml.exe 10, but with ml.exe 8 (different version I try three) one mistake occurs during assembling fptoa.asm fptoa2.asm
call PowerOf10
string 204,206
this proc inside atofp.asm. How decide this?
(http://smiles.kolobok.us/light_skin/dash1.gif)
I try invoke, includelib....
Title: Re: masm 10 vs 11
Post by: jj2007 on January 29, 2013, 06:42:01 PM
Hi bomz,

You could be a bit more precise with your error messages ;-)

No problems with ML 6.14 and JWasm.

PowerOf10   proto   ; ML 8, 9: error A2006:undefined symbol : PowerOf10
fbstp [esp]   ; ML 8, 9, 10: error A2023:instruction operand must have size
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 08:44:32 PM
Quote***********
ASCII build
***********

Assembling: fptoa.asm
fptoa.asm(207) : error A2006: undefined symbol : PowerOf10
Assembling: fptoa2.asm
fptoa2.asm(205) : error A2006: undefined symbol : PowerOf10
Assembling: frame3d.asm
Assembling: framegrp.asm

in this two codes atofp.asm atofp2.asm only
PowerOf10 proto
so stringscall PowerOf10 calls errors

proc PowerOf10 in file atofp.asm
PowerOf10 PROC public

    mov ecx, eax
    .IF (SDWORD PTR eax < 0)
neg eax
    .ENDIF

    fld1

    mov dl, al
    and edx, 0fh
    .IF (!ZERO?)
lea edx, [edx+edx*4]
fld ten_1[edx*2][-10]
fmulp st(1), st
    .ENDIF

    mov dl, al
    shr dl, 4
    and edx, 0fh
    .IF (!ZERO?)
lea edx, [edx+edx*4]
fld ten_16[edx*2][-10]
fmulp st(1), st
    .ENDIF

    mov dl, ah
    and edx, 1fh
    .IF (!ZERO?)
lea edx, [edx+edx*4]
fld ten_256[edx*2][-10]
fmulp st(1), st
    .ENDIF

    .IF (SDWORD PTR ecx < 0)
fdivp st(1), st
    .ELSE
fmulp st(1), st
    .ENDIF

    ret

PowerOf10 ENDP


I think that ml 6 and 8 during compiling only check function declaration (???), when full masm32.lib creates atofp.asm atofp2.asm call proc from atofp.asm

ml.exe 8.0.50727.100 free on microsoft site. I try it and 8.0.50727.762 and 8.0.50727.42 from 2005 studio
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 08:52:07 PM
you can ty this.....

in the files fptoa.asm and fptoa2.asm
.486
.model flat
      option casemap :none  ; case sensitive

        EXTERNDEF PowerOf10:NEAR


add an externdef
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 08:54:22 PM
not public? what this declair in few word please. proto delete?
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 08:59:13 PM
EXTERNDEF PowerOf10:NEAR
Quote***********
ASCII build
***********

Assembling: fptoa.asm
fptoa.asm(49) : error A2112: PROC and prototype calling conventions conflict
Assembling: fptoa2.asm
fptoa2.asm(49) : error A2112: PROC and prototype calling conventions conflict
Assembling: frame3d.asm
Assembling: framegrp.asm


EXTERNDEF PowerOf10:PUBLIC
Quote***********
ASCII build
***********

Assembling: fptoa.asm
fptoa.asm(11) : error A2008: syntax error : PUBLIC
fptoa.asm(208) : error A2006: undefined symbol : PowerOf10
Assembling: fptoa2.asm
fptoa2.asm(11) : error A2008: syntax error : PUBLIC
fptoa2.asm(206) : error A2006: undefined symbol : PowerOf10
Assembling: frame3d.asm
Assembling: framegrp.asm
EXTERNDEF PowerOf10:FAR
Quote***********
ASCII build
***********

Assembling: fptoa.asm
fptoa.asm(49) : error A2112: PROC and prototype calling conventions conflict
Assembling: fptoa2.asm
fptoa2.asm(49) : error A2112: PROC and prototype calling conventions conflict
Assembling: frame3d.asm
Assembling: framegrp.asm
EXTERNDEF PowerOf10:FAR
;PowerOf10 PROTO

Quote***********
ASCII build
***********

Assembling: fptoa.asm
fptoa.asm(208) : error A2004: symbol type conflict
Assembling: fptoa2.asm
fptoa2.asm(206) : error A2004: symbol type conflict
Assembling: frame3d.asm
Assembling: framegrp.asm
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 09:10:32 PM
try this
    EXTERNDEF PowerOf10

i didn't try it, so i can't say
maybe it needs a PROTO

scratch that - it already has a PROTO
maybe that's the problem   :P
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 09:15:02 PM
EXTERNDEF PowerOf10:NEAR
;PowerOf10   proto

Quote***********
ASCII build
***********

Assembling: fptoa.asm
Assembling: fptoa2.asm
Assembling: frame3d.asm
Assembling: framegrp.asm

now need check it with ml10. may be you have little code to check this two proc calling?

with ml.exe10 - OK

(http://smiles.kolobok.us/light_skin/thank_you2.gif)
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 09:15:45 PM
.code

PowerOf10 proto


it's odd that he did it that way
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 09:21:41 PM
well - you just need a floating point value
    INCLUDE \Masm32\Include\Masm32rt.inc

        .DATA
qwTest  REAL8 3.1415962

        .DATA?
szBuff  db 20 dup(?)

        .CODE

Start:
    INVOKE  FloatToStr,offset qwTest,offset szBuff
    print   offset szBuff,13,10

    INVOKE  FloatToStr2,offset qwTest,offset szBuff
    print   offset szBuff,13,10

    inkey
    exit

    END     Start
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 09:25:53 PM
QuoteMicrosoft (R) Macro Assembler Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: C:\111.txt

***********
ASCII build
***********

C:\111.txt(12) : error A2114:INVOKE argument type mismatch : argument : 1
C:\111.txt(15) : error A2114:INVOKE argument type mismatch : argument : 1
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file '111.obj'
Не удается найти C:\111.obj
Для продолжения нажмите любую клавишу . . .
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 09:27:59 PM
sorry about that - lol
it wants the QWORD passed - not a pointer
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 09:30:26 PM
QuoteINCLUDE \Masm32\Include\Masm32rt.inc

        .DATA
qwTest  REAL8 3.1415962

        .DATA?
szBuff  db 20 dup(?)

        .CODE

Start:
    INVOKE  FloatToStr2,qwTest,offset szBuff
    print   offset szBuff,13,10

    INVOKE  FloatToStr2,qwTest,offset szBuff
    print   offset szBuff,13,10

    inkey
    exit

    END     Start
(http://smiles.kolobok.us/light_skin/thank_you2.gif)
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 09:32:06 PM
i don't know how they do that - maybe there is a better way
but, this should work....
    push    offset szBuff
    push dword ptr qwTest+4
    push dword ptr qwTest
    CALL    FloatToStr
    print   offset szBuff,13,10

    push    offset szBuff
    push dword ptr qwTest+4
    push dword ptr qwTest
    CALL    FloatToStr2
    print   offset szBuff,13,10


oh - good job
i didn't know you could do that   :biggrin:
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 09:35:54 PM
I read masm help, never use macros and functions

(http://smiles.kolobok.us/light_skin/dance.gif)
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 09:41:37 PM
 :t

oops - Pi is 3.1415926
i am getting old
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 09:46:22 PM
now full compatibable with all masm version (http://smiles.kolobok.us/light_skin/girl_sigh.gif)
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 09:59:03 PM
One question leave. How makes lib from this? SDKKit includes

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:                                           FASTCALL                                             ::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

externdef syscall @ExAcquireFastMutexUnsafe@4:proc
ExAcquireFastMutexUnsafe textequ <@ExAcquireFastMutexUnsafe@4>

externdef syscall @ExInterlockedAddLargeStatistic@8:proc
ExInterlockedAddLargeStatistic textequ <@ExInterlockedAddLargeStatistic@8>
Title: Re: masm 10 vs 11
Post by: dedndave on January 29, 2013, 10:01:03 PM
one of the best guys to answer that is Erol
i will leave that one for him   :biggrin:
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 10:44:28 PM
may be like that?
;__NO_NOISE__
.386
.model flat,stdcall
option casemap :none
externdef syscall @ExAcquireFastMutexUnsafe@4:FAR
.code
LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD
mov eax, 1
ret
LibMain endp
Title: Re: masm 10 vs 11
Post by: japheth on January 29, 2013, 11:10:47 PM
Quote from: bomz on January 29, 2013, 10:44:28 PM
may be like that?
;__NO_NOISE__
.386
.model flat,stdcall
option casemap :none
externdef syscall @ExAcquireFastMutexUnsafe@4:FAR
.code
LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD
mov eax, 1
ret
LibMain endp


No. This wild guess is completely wrong.

Simplest way is using POLIB ( as it has been mentioned already in this thread ).

1. Create a .DEF file:


LIBRARY ntoskrnl.exe
EXPORTS
"@ExAcquireFastMutexUnsafe@4"
... [more exports]


2. Run POLIB:

polib /DEF:NTOSKRNL.def /OUT:NTOSKRNL.LIB
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 11:25:21 PM
polib ok thanks. but how use such construction in the asm code, how call this function from driver?
Title: Re: masm 10 vs 11
Post by: japheth on January 29, 2013, 11:30:11 PM
Quote from: bomz on January 29, 2013, 11:25:21 PM
polib ok thanks. but how use such construction in the asm code, how call this function from driver?

It's a FASTCALL proc, hence you have to move argument 1 to register ECX:


mov ecx, value_of_arg_1
call @ExAcquireFastMutexUnsafe@4
Title: Re: masm 10 vs 11
Post by: bomz on January 29, 2013, 11:36:55 PM
Thanks

externdef syscall @IofCallDriver@8:proc
IofCallDriver textequ <@IofCallDriver@8>

what about 2 arguments?

http://msdn.microsoft.com/ru-ru/library/6xa169sk.aspx
ECX EDX

QuoteThe first two DWORD or smaller arguments are passed in ECX and EDX registers; all other arguments are passed right to left.
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 05:54:18 AM
QuoteBEGIN {
deffile=NAME".def";
asmfile=NAME".asm";
if (NAME == "winspool") extention = ".drv";
if (NAME == "ntoskrnl") extention = ".exe";

print "LIBRARY "NAME""extention>deffile;
print ";__NO_NOISE__\n.386\n.model flat,stdcall\noption casemap :none\n.code\nLibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD\nmov eax, 1 \nret\nLibMain endp" > asmfile;
}
/PROTO/{
procname = $1;
"if (procname ~ /^[\x20\x09]*;/ ) next;"
if (procname == "DllUnload" || procname == "DllInitialize") private= " PRIVATE";
if (procname != "LibMain") {
print "EXPORTS",procname""private>>deffile;
if ($3 != "STDCALL" && $3 != "C" && $3 != "" ) {string="";string1=$3;string_out="";} else {string=$3; string1=$4;string_out=string" ";}
i = split(string1,part,":");
for(j = 1; j < i; j++) string_out=sprintf(string_out "param%0.2d"":"part[j+1],j);
print procname " proc " string_out>>asmfile;
print "ret">>asmfile;
print procname " endp">>asmfile;
}
}
END {
print "end LibMain">>asmfile;
}
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 07:47:04 AM
Quote@ExInterlockedPushEntrySList@12 proc syscall param1:DWORD
ret
@ExInterlockedPushEntrySList@12 endp
OR
Quote@ExInterlockedPushEntrySList@12 proc syscall param1:DWORD,param2:DWORD,param3:DWORD
ret
@ExInterlockedPushEntrySList@12 endp

???

there is any sense to leave LibMain proc in hpmon.inc and nwmon.inc?
Title: Re: masm 10 vs 11
Post by: dedndave on January 30, 2013, 11:11:12 AM
"@12" tells you there are 12 bytes of parameters (3 dwords)
ExInterlockedPushEntrySList proc syscall param1:DWORD,param2:DWORD,param3:DWORD
ret
ExInterlockedPushEntrySList endp
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 12:36:55 PM
but syscall say that 2 first parametres in ecx edx. in msdn about syscall any word
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 01:07:57 PM
-2 parametres
.386

.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\kernel32.inc
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\kernel32.lib
include ntdll.inc
includelib ntdll.lib

.data
mestitle db "Bomz",0
form db "EAX: %x EBX: %u ECX: %u EDX: %u ESI: %u EDI: %u", 0

.data?
buffer db 512 dup(?)

.code
start:
xor eax,eax
xor ebx,ebx
xor ecx,ecx
xor edx,edx
xor esi,esi
xor edi,edi

mov ecx, 00ffh
call @RtlUshortByteSwap@4


invoke wsprintf,ADDR buffer,ADDR form,eax,ebx,ecx,edx,esi,edi

invoke MessageBox,0,ADDR buffer,ADDR mestitle,MB_ICONASTERISK
invoke ExitProcess,0
end start


(http://smiles.kolobok.us/light_skin/dance.gif)
Title: Re: masm 10 vs 11
Post by: japheth on January 30, 2013, 07:03:43 PM
Quote from: bomz on January 30, 2013, 12:36:55 PM
but syscall say that 2 first parametres in ecx edx. in msdn about syscall any word

It's fastcall, and there is something at MSDN: http://msdn.microsoft.com/en-us/library/6xa169sk.aspx (http://msdn.microsoft.com/en-us/library/6xa169sk.aspx)

Title: Re: masm 10 vs 11
Post by: jj2007 on January 30, 2013, 08:41:15 PM
Quote from: japheth on January 30, 2013, 07:03:43 PM
It's fastcall, and there is something at MSDN: http://msdn.microsoft.com/en-us/library/6xa169sk.aspx (http://msdn.microsoft.com/en-us/library/6xa169sk.aspx)

QuoteFuture compiler versions may use different registers to store parameters.

I love that one. Sounds like real fun :biggrin:
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 08:55:28 PM
DDK_XP.iso ---> NTOSKRNL.LIB + protogen.exe = NTOSKRNL.INC
Quoteexterndef syscall @InterlockedCompareExchange@12:proc
InterlockedCompareExchange textequ <@InterlockedCompareExchange@12>
http://msdn.microsoft.com/ru-ru/library/windows/desktop/ms683560%28v=vs.85%29.aspx
QuoteC++
Копировать

LONG __cdecl InterlockedCompareExchange(
  _Inout_  LONG volatile *Destination,
  _In_     LONG Exchange,
  _In_     LONG Comparand
);


syscall (http://smiles.kolobok.us/light_skin/search.gif)


windows.inc
QuoteInterlockedCompareExchange PROTO STDCALL :DWORD,:DWORD,:DWORD

mov ebx, esp
call @RtlUshortByteSwap@4
sub ebx, esp

ebx=0
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 09:17:59 PM
The very last script version of Alex_Piggy , works with all masm32 inc's and inc's from DDKKits makes with protogen (except fastcall)
BEGIN {
    IGNORECASE=1;
    deffile=NAME".def";
    asmfile=NAME".asm";
    print "LIBRARY "NAME EXTENSION>deffile;
    print ";__NO_NOISE__\n.386\n.model flat,stdcall\noption casemap :none\n.code\nLibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD\nmov eax, 1 \nret\nLibMain endp" > asmfile;
}
(!/[\x20\x09]*;/) { if ($2 ~ /^PROTO$/) { if (NF >2) {
    procname = $1;
if (procname != "LibMain") {
    if (procname ~ /^DllUnload$/ || procname ~ /^DllInitialize$/) private= " PRIVATE";
print "EXPORTS "procname private>>deffile;
string1="";
string_out="";
for ( j = 3; j <= NF; j++) string1=string1" "$j;
    if (string1 ~ /[, ]:/) {
string1=gensub(/, :/,",:","g",string1);
i = split(string1,part,":");
string_out=part[1];
for(j = 1; j < i; j++) string_out=sprintf(string_out "param%0.2d"":"part[j+1],j);
    } else {
string_out=string1;
    }
    print procname " proc" string_out "\nret\n" procname " endp">>asmfile;
}}}}
END {
    print "end LibMain">>asmfile;
}

@echo off
color 9F
set "mdir=\masm32\
if "%~1"=="" exit /b
cd /d %~dp0
awk -v "NAME=%~n1" -v "EXTENSION=%~2" -f script.awk "%~1"
%mdir%bin\ml.exe /c /coff /Cp %~n1.asm
%mdir%bin\Link.exe /noentry /subsystem:windows /dll /def:%~n1.def %~n1.obj
del %~n1.dll
del %~n1.obj
del %~n1.exp
del %~n1.def
del %~n1.asm

bldlibs
call inc2lib.bat winspool.inc .drv
call inc2lib.bat ntoskrnl.inc .exe


current fastcall batch file
@ECHO OFF
COLOR 9F
cd %~dp1
echo off>%~n1.def
echo off>%~n1.asm
SetLocal EnableDelayedExpansion
set sign=:
for /f "tokens=3 delims=%sign% " %%i in (%~nx1) do (
set string=%%i
set pointer=!string:~0,1!
if !pointer!==@ (
rem echo !pointer!
echo EXPORTS %%i>>%~n1.def

set pointer=!string:~-2!

if !pointer!==@4 echo %%i proc syscall >>%~n1.asm
if !pointer!==@8 echo %%i proc syscall >>%~n1.asm
if !pointer!==12 echo %%i proc syscall param1:DWORD>>%~n1.asm
if !pointer!==16 echo %%i proc syscall param1:DWORD,param2:DWORD>>%~n1.asm
if !pointer!==20 echo %%i proc syscall param1:DWORD,param2:DWORD,param3:DWORD>>%~n1.asm
echo ret>>%~n1.asm
echo %%i endp>>%~n1.asm
)
)
pause
Title: Re: masm 10 vs 11
Post by: japheth on January 30, 2013, 09:18:34 PM
Quote from: bomz on January 30, 2013, 08:55:28 PM
syscall (http://smiles.kolobok.us/light_skin/search.gif)

You mustn't take those things too literally. Most likely the author has used syscall because Masm doesn't know fastcall; using syscall as substitute has the advantage that it doesn't add a prefix or suffix to the name. You cannot use INVOKE to call such functions, though.
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 09:23:28 PM
how do you think batch file must be or not to be
Quoteif !pointer!==@4 echo %%i proc syscall >>%~n1.asm
if !pointer!==@8 echo %%i proc syscall >>%~n1.asm
if !pointer!==12 echo %%i proc syscall param1:DWORD>>%~n1.asm
if !pointer!==16 echo %%i proc syscall param1:DWORD,param2:DWORD>>%~n1.asm
if !pointer!==20 echo %%i proc syscall param1:DWORD,param2:DWORD,param3:DWORD>>%~n1.asm
????
Title: Re: masm 10 vs 11
Post by: japheth on January 30, 2013, 09:31:14 PM
Quote from: bomz on January 30, 2013, 09:23:28 PM
how do you think batch file must be or not to be

I'm sorry, but I have no idea what you want to achieve, so I cannot help.

If you're able to express yourself clearly in English or German ( or Schwäbisch ), I may be able to say something substantial.
Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 09:48:17 PM
@12 in the end of function name means
Quoteparam1:DWORD,param2:DWORD,param3:DWORD
or
Quoteparam1:DWORD
how many parametres ?
Title: Re: masm 10 vs 11
Post by: japheth on January 30, 2013, 11:54:45 PM
Quote from: bomz on January 30, 2013, 09:48:17 PM
@12 in the end of function name means
Quoteparam1:DWORD,param2:DWORD,param3:DWORD
or
Quoteparam1:DWORD
how many parametres ?

It's the size of the "parameter list" - the value doesn't actually tell how many parameters a function has.

However, "usually" in Win32, a parameter has size 4, so the assumption that @12 is to be translated to "3 parameters" has a certain, significant probability.



Title: Re: masm 10 vs 11
Post by: bomz on January 30, 2013, 11:56:18 PM
http://www.c-jump.com/CIS77/ASM/Procedures/lecture.html#P77_0130_fastcall_call_summary
Quote13. FASTCALL Caller and Callee Summary

    *

      The following sample illustrates the code generated in the calling function and in the called function to support __fastcall, the fastcall calling convention:

         int __fastcall FastFunc( int a, int b );

            calling function    called function
            -------------------------------------------
            mov edx, b          @FastFunc@8 PROC NEAR
            mov ecx, a                       .
            call @FastFunc@8                 .
             .                               .
             .                              RET 8
             .                  @FastFunc@8 ENDP
RET 8 - so stack not destroyed but parametres need ecx edx
Title: Re: masm 10 vs 11
Post by: dedndave on January 31, 2013, 01:09:22 AM
that doesn't seem correct
perhaps it's a misprint
see if you can find another source of information to verify
Title: Re: masm 10 vs 11
Post by: bomz on January 31, 2013, 02:24:45 AM
I make code with syscall proc it's work like stdcall function because use ret [N], but I can't export my proc from it to see it's end @8 or @12 (http://smiles.kolobok.us/standart/to_take_umbrage.gif)
Title: Re: masm 10 vs 11
Post by: mineiro on January 31, 2013, 02:48:29 AM
Hello bomz;
from my readings about calling convention, I have see that fastcall differs from one operating system to another, and maybe from different compilers. The fastcall to win64 is not the same as fastcall to linux64, both use fastcall, linux64 use 6 registers to pass parameters, while windows64 use 4 registers. A good read about this is the paper of agner. Well, these calling conventions are a big zoo, it's hard to create portable code because these things, and exceptions handlers change too from win32 to win64, ... .
http://www.agner.org/optimize/calling_conventions.pdf
Title: Re: masm 10 vs 11
Post by: bomz on January 31, 2013, 03:18:04 AM
(http://smiles.kolobok.us/light_skin/suicide2.gif)


The very last version of Alex script here. support masm32, protogen and protoize includes. syscal(http://smiles.kolobok.us/light_skin/unknw.gif)
awk here
http://gnuwin32.sourceforge.net/downlinks/gawk-bin-zip.php
Title: Re: masm 10 vs 11
Post by: Vortex on January 31, 2013, 05:30:47 AM
Hi bomz,

Nice work :t
Title: Re: masm 10 vs 11
Post by: MichaelW on January 31, 2013, 07:25:54 AM

#include <conio.h>
#include <stdio.h>
int __fastcall fastcall( int a, int b )
{
    return a+b;               // line 5
}
// This necessary to prevent compiler from
// optimizing the call by eliminating it:
#pragma optimize( "", off )
void main( void )
{
    int i, a=1, b=2;
    i = fastcall( a, b );     // line 13
    getch();
}


. . .
@fastcall@8 PROC NEAR ; COMDAT
; _a$ = ecx
; _b$ = edx
; File c:\program files\microsoft visual c++ toolkit 2003\my\newcounter\fastcall.c
; Line 5
lea eax, DWORD PTR [ecx+edx]
; Line 6
ret 0
@fastcall@8 ENDP
. . .
_main PROC NEAR ; COMDAT
; Line 11
push ebp
mov ebp, esp
sub esp, 12 ; 0000000cH
; Line 12
mov DWORD PTR _a$[ebp], 1
mov DWORD PTR _b$[ebp], 2
; Line 13
mov edx, DWORD PTR _b$[ebp]
mov ecx, DWORD PTR _a$[ebp]
call @fastcall@8
mov DWORD PTR _i$[ebp], eax
; Line 14
call _getch
; Line 15
xor eax, eax
mov esp, ebp
pop ebp
ret 0
_main ENDP
. . .


In optimized code, and in procedures that have no more than 2 parameters, using the fastcall convention saves a few cycles beyond what can be saved by eliminating the stack frame (as in a naked function). For the 32-bit compilers the Microsoft fastcall convention passed the first 2 parameters in registers. Borland at one time implemented a fastcall convention that passed the first 3 parameters in registers.
Title: Re: masm 10 vs 11
Post by: bomz on January 31, 2013, 08:31:50 AM
I don't know C absolutely. I learn at school basic for Hewlett Pacard

Quoteexterndef syscall @procname@16:proc = procname@16 proto syscall param1:dword,param2:dword,param3:dword,param4:dword
???


Quote from: Vortex on January 31, 2013, 05:30:47 AM
Hi bomz,

Nice work :t
Thanks for Alex. compatible with three ml.exe v8 and two ml.exe v10 + link.exe two version. new non-batch (awk) algorithm much quickly
Title: Re: masm 10 vs 11
Post by: bomz on February 01, 2013, 05:36:22 AM
Four-F KMDKits author send me a letter. He about 10 year not practice with masm (http://smiles.kolobok.us/light_skin/girl_cray.gif)(http://smiles.kolobok.us/light_skin/cray.gif) and don't remember any details
Title: Re: masm 10 vs 11
Post by: bomz on February 13, 2013, 06:40:38 PM
selling the purchase
http://exelab.ru/f/index.php?action=vthread&forum=6&topic=15165&page=0

MASM compiller not support FASTCALL(SYSCALL)  (?no errors occurs?), this functions decorated with @
the decision by Four-F
QuoteEXTERNDEF SYSCALL @InterlockedCompareExchange@12:PROC
InterlockedCompareExchange EQU <@InterlockedCompareExchange@12>
fastcall macro included in ntddk.inc from KMDKit last version (?)
fastcall macro finvoke.asm

fcinv MACRO algo, a1, a2, a3, a4, a5, a6
LOCAL invAlgo$, out$, Description, movreg1, movreg2, movreg3
  invAlgo$ CATSTR <invoke >, <algo>
  ifidn <?>, <algo>
include \masm32\macros\macrohlp.inc
showhelp fcinv
invAlgo$ equ <>
  endif
  movreg1 equ <>
  movreg2 equ <>
  movreg3 equ <>
  ifnb <a1>
movreg1 equ CrtMovReg(a1)
ifb movreg1
invAlgo$ CATSTR invAlgo$, <, >, <a1>
endif
  ifnb <a2>
movreg2 equ CrtMovReg(a2)
ifb movreg2
invAlgo$ CATSTR invAlgo$, <, >, <a2>
endif
  ifnb <a3>
movreg3 equ CrtMovReg(a3)
ifb movreg3
invAlgo$ CATSTR invAlgo$, <, >, <a3>
endif
  ifnb <a4>
invAlgo$ CATSTR invAlgo$, <, >, <a4>
  ifnb <a5>
invAlgo$ CATSTR invAlgo$, <, >, <a5>
  endif
  endif
  endif
  endif
  endif
  movreg1 ;; mov eax, offset arg1 (for example)
  movreg2 ;; mov ecx, offset arg2
  movreg3 ;; mov edx, offset arg3
  ; .err
;;   % echo invAlgo$ ; uncomment in case of problems
  invAlgo$ ;; invoke MyAlgo, arg4, arg5, arg6
ENDM

; Usage:
; showcycles InString, 1, addr MainString, addr SubString
; showcycles FcDemo2Regs, ecx:82, edx:offset MainString, addr SubString ; the FASTCALL variant

CrtMovReg MACRO arg
LOCAL src$, ado$, var$, sc
  if @InStr(1, <arg>, <:>) eq 4
echo A=<arg>
src$ SUBSTR <arg>, 5
% echo S=src$
  % sc SIZESTR <src$>
if sc gt 5
; echo GREATER
ado$ SUBSTR src$, 1, 4
; % echo AD=<ado$>
ifidni ado$, <addr>
var$ SUBSTR src$, 6
; % echo Local=var$
oa = (opattr var$) AND 127
if oa eq 98
MovReg$ CATSTR <lea >, @SubStr(<arg>, 1, 3), <, >, var$
; % echo CM=MovReg$
else
MovReg$ CATSTR <mov >, @SubStr(<arg>, 1, 3), <, offset >, var$
endif
else
MovReg$ CATSTR <mov >, @SubStr(<arg>, 1, 3), <, >, @SubStr(<arg>, 5)
endif
else
; echo smaller
MovReg$ CATSTR <mov >, @SubStr(<arg>, 1, 3), <, >, @SubStr(<arg>, 5)
endif
; % echo MR=MovReg$
; .err
EXITM <MovReg$>
  else
EXITM <>
  endif
ENDM

showcycles MACRO algo, a1, a2, a3, a4, a5, a6
LOCAL invAlgo$, out$, Description, movreg1, movreg2, movreg3
  invAlgo$ CATSTR <invoke >, <algo>
  ifidn <?>, <algo>
include \masm32\macros\macrohlp.inc ;; [url=\masm32\include\macrohlp.inc]open[/url]
showhelp showcycles
invAlgo$ equ <>
  endif
  movreg1 equ <>
  movreg2 equ <>
  movreg3 equ <>
  ifndef LOOP_COUNT
LOOP_COUNT = 1000000/10 ;; default: one Million
  endif
  ifndef CurAlgo
  CurAlgo equ <>
  endif
  ifdif CurAlgo, <algo>
  CurAlgo equ <algo>
  endif

  Description equ <CurAlgo>
  ifnb <a1>
  movreg1 equ CrtMovReg(a1)
ifb movreg1
invAlgo$ CATSTR invAlgo$, <, >, <a1>
endif
Description CATSTR Description, <, >, <a1>

  ifnb <a2>
  movreg2 equ CrtMovReg(a2)
ifb movreg2
invAlgo$ CATSTR invAlgo$, <, >, <a2>
endif
Description CATSTR Description, <, >, <a2>
  ifnb <a3>
  movreg3 equ CrtMovReg(a3)
ifb movreg3
invAlgo$ CATSTR invAlgo$, <, >, <a3>
endif
Description CATSTR Description, <, >, <a3>
  ifnb <a4>
invAlgo$ CATSTR invAlgo$, <, >, <a4>
Description CATSTR Description, <, >, <a4>
  ifnb <a5>
invAlgo$ CATSTR invAlgo$, <, >, <a5>
Description CATSTR Description, <, >, <a5>
  endif
  endif
  endif
  endif
  endif
  ifndef globcycles ;; we might need to calculate a global average count
  .data?
  globcycles dd ?
  globcount dd ?
  .code
  endif
  ifndef REP_CT
REP_CT = 1
  endif
  ifndef REP_CTold
REP_CTold = REP_CT
  endif
  if REP_CT gt 1
  if REP_CTold eq 1
  pushad
print chr$(13, 10)
popad
endif
REP_CTold = REP_CT
  endif
  ;% echo invAlgo$ ;; uncomment to see what exactly you are invoking
  REPEAT REP_CT
pushad
invoke Sleep, 50
popad
counter_begin LOOP_COUNT, HIGH_PRIORITY_CLASS
movreg1
movreg2
movreg3
invAlgo$
counter_end
add globcycles, eax
inc globcount
out$ CATSTR <print str$(eax), 9, ">, Description, <", 13, 10>
out$
  ENDM
  if REP_CT gt 1
print chr$(13, 10)
  endif
ENDM

may be add it to masm32.lib (?), but it redefinition:
atol
isupper
islower
isalpha

such macros turn fastcall to slowcall
mov ecx, param1
sub esp, 4
call [fastcall]
????
Title: Re: masm 10 vs 11
Post by: dedndave on February 14, 2013, 12:28:24 AM
Quoteslowcall
:biggrin:
Title: Re: masm 10 vs 11
Post by: bomz on February 14, 2013, 02:14:43 AM
I leave first @ for mask function to prevent redefinition. fastcall=crazycall
Quote.386

.model flat, stdcall
option casemap :none

include \MASM32\INCLUDE\windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
includelib ntdll.lib
include ntdll.inc
includelib ntoskrnl.lib
include ntoskrnl.inc

.data
mestitle   db "Bomz",0
form      db "EAX: %08hx", 0
form1      db "ECX: %04hx EDX: %04hx", 0
value      dd "A"

.data?
buffer      db 512 dup(?)

.code
start:
;mov eax, "a"
;mov eax, "A"
;invoke isupper, eax
mov ecx, 0ff00h
sub esp, 4
call @RtlUshortByteSwap
invoke wsprintf,ADDR buffer,ADDR form,eax
invoke MessageBox,0,ADDR buffer,ADDR mestitle,MB_ICONASTERISK
push 0ffh
push 0ffh
call @RtlUlonglongByteSwap
invoke wsprintf,ADDR buffer,ADDR form1,ecx, edx
invoke MessageBox,0,ADDR buffer,ADDR mestitle,MB_ICONASTERISK
invoke ExitProcess,0
end start