Author Topic: starting to us vs2010 masm  (Read 8060 times)

juanppf

  • Guest
starting to us vs2010 masm
« on: July 03, 2013, 03:53:23 AM »
Hi guys!
I have this code
*************************************************
.586
.model flat, stdcall   
option casemap :none   

; To get unicode support
include      \masm32\macros\ucmacros.asm
 
include      \masm32\include\windows.inc
include      \masm32\include\kernel32.inc
includelib   \masm32\lib\kernel32.lib
 
include      \masm32\include\user32.inc
includelib   \masm32\lib\user32.lib      

.data
; WSTR gets you a unicode string definition
WSTR wstrTitle, "Hello"
WSTR wstrMessage, "World"

.code

main:
   invoke MessageBoxW, NULL, ADDR wstrMessage, ADDR wstrTitle, MB_OK

   invoke ExitProcess, eax
end main
**************************************************************
and it returns

1>------ Rebuild All started: Project: speedy, Configuration: Debug Win32 ------
1>Build started 02/07/2013 12:33:03 p.m..
1>_PrepareForClean:
1>  Deleting file "Debug\speedy.lastbuildstate".
1>InitializeBuildStatus:
1>  Touching "Debug\speedy.unsuccessfulbuild".
1>_MASM:
1>  Assembling [Inputs]...
1>speedy.asm(17): error A2008: syntax error : WSTR
1>speedy.asm(18): error A2008: syntax error : WSTR
1>speedy.asm(23): error A2006: undefined symbol : wstrTitle
1>speedy.asm(23): error A2114: INVOKE argument type mismatch : argument : 3
1>speedy.asm(23): error A2006: undefined symbol : wstrMessage
1>speedy.asm(23): error A2114: INVOKE argument type mismatch : argument : 2
1>\masm32\macros\ucmacros.asm(13): error A2052: forced error
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\speedy.obj" /W3 /errorReport:prompt  /Taspeedy.asm" exited with code 1.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.48
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

think the settings are ok, what I'm doing wrong?

GoneFishing

  • Member
  • ****
  • Posts: 965
  • Gone fishing
Re: starting to us vs2010 masm
« Reply #1 on: July 03, 2013, 04:06:02 AM »
ucmacros.asm:
Code: [Select]
    echo ************************************************************************
    echo ************************************************************************
    echo ************************************************************************
    echo     
    echo The file UCMACROS.ASM is no longer used, the macros that the earlier
    echo version contained are now in the main macro file "MACROS.ASM".
    echo Remove this file name from your include files to build your application.
    echo     
    echo ************************************************************************
    echo ************************************************************************
    echo ************************************************************************
    .err
Try to modify line
Code: [Select]
include      \masm32\macros\ucmacros.asmto
Code: [Select]
include      \masm32\macros\macros.asmHope it will help

juanppf

  • Guest
Re: starting to us vs2010 masm
« Reply #2 on: July 03, 2013, 04:25:29 AM »
Thx vertograd!

chged the ucmacros for macros.asm and keeps saying:
1>------ Build started: Project: speedy, Configuration: Debug Win32 ------
1>Build started 02/07/2013 01:22:39 p.m..
1>InitializeBuildStatus:
1>  Touching "Debug\speedy.unsuccessfulbuild".
1>_MASM:
1>  Assembling [Inputs]...
1>\masm32\include\windows.inc(16527): error A2037: statement not allowed inside structure definition
1>\masm32\include\windows.inc(16527): error A2008: syntax error : db
1>\masm32\include\windows.inc(16527): error A2034: must be in segment block
1>\masm32\include\windows.inc(16539): error A2037: statement not allowed inside structure definition
1>\masm32\include\windows.inc(16539): error A2008: syntax error : db
1>\masm32\include\windows.inc(16539): error A2034: must be in segment block
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\speedy.obj" /W3 /errorReport:prompt  /Taspeedy.asm" exited with code 1.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.44
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

GoneFishing

  • Member
  • ****
  • Posts: 965
  • Gone fishing
Re: starting to us vs2010 masm
« Reply #3 on: July 03, 2013, 04:32:42 AM »
OK, at least one error is already fixed  ;)

Did you try to build this project in QEDITOR ?
Do you use WINDOWS.INC from MASM32 package?
Do you have a full set of includes?

jj2007

  • Member
  • *****
  • Posts: 7734
  • Assembler is fun ;-)
    • MasmBasic
Re: starting to us vs2010 masm
« Reply #4 on: July 03, 2013, 05:11:18 AM »
1>  Assembling [Inputs]...
1>\masm32\include\windows.inc(16527): error A2037: statement not allowed inside structure definition
1>\masm32\include\windows.inc(16527): error A2008: syntax error : db
1>\masm32\include\windows.inc(16527): error A2034: must be in segment block
1>\masm32\include\windows.inc(16539): error A2037: statement not allowed inside structure definition
1>\masm32\include\windows.inc(16539): error A2008: syntax error : db
1>\masm32\include\windows.inc(16539): error A2034: must be in segment block

Check your version...

Windows.inc:
NMTTDISPINFOA STRUCT
  hdr               NMHDR  <>
  lpszText          DWORD  ?
  szText            BYTE 80 dup(?)      <<<<<<<<<< 16527
  union
    hInst           DWORD  ?
    hinst           DWORD  ?
  ends
  uFlags            DWORD  ?
  lParam            DWORD  ?
NMTTDISPINFOA ENDS

NMTTDISPINFOW STRUCT
  hdr               NMHDR  <>
  lpszText          DWORD  ?
  szText            WORD 80 dup(?)      <<<<<<<<<< 16539
  union
    hInst           DWORD  ?
    hinst           DWORD  ?
  ends
  uFlags            DWORD  ?
  lParam            DWORD  ?
NMTTDISPINFOW ENDS


juanppf

  • Guest
Re: starting to us vs2010 masm
« Reply #5 on: July 03, 2013, 06:01:20 AM »
Thank you for your help

I ran the code in qeditor
MASM version 6.14.8444
windows.inc version 1.6

I have exactly the same error as before

Note: my code appears all in black, but when I hit the rocket in qeditor vs2010 pops up with my code in colors but still cannot build it.

jj2007

  • Member
  • *****
  • Posts: 7734
  • Assembler is fun ;-)
    • MasmBasic
Re: starting to us vs2010 masm
« Reply #6 on: July 03, 2013, 06:45:30 AM »
Hi Juan,
You are right, it doesn't work. But the workaround is simple: Just change the order of the includes:

.586
.model flat, stdcall   
option casemap :none   
 
include      \masm32\include\windows.inc
include      \masm32\include\kernel32.inc
includelib   \masm32\lib\kernel32.lib
 
include      \masm32\include\user32.inc
includelib   \masm32\lib\user32.lib     

; To get unicode support
include      \masm32\macros\macros.asm

.data
; WSTR gets you a unicode string definition
WSTR wstrTitle, "Hello"
WSTR wstrMessage, "World"

.code

main:
   invoke MessageBoxW, NULL, ADDR wstrMessage, ADDR wstrTitle, MB_OK

   invoke ExitProcess, eax
end main


Even better:
include \masm32\include\masm32rt.inc  ; handles all standard includes

.data

juanppf

  • Guest
Re: starting to us vs2010 masm
« Reply #7 on: July 03, 2013, 07:17:52 AM »
Hey jj2007 it worked nicely!

Thank you very much! :greenclp:

Gunther

  • Member
  • *****
  • Posts: 3517
  • Forgive your enemies, but never forget their names
Re: starting to us vs2010 masm
« Reply #8 on: July 03, 2013, 08:52:09 AM »
And welcome to the forum juanppf.

Gunther
Get your facts first, and then you can distort them.