News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

starting to us vs2010 masm

Started by juanppf, July 03, 2013, 03:53:23 AM

Previous topic - Next topic

juanppf

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

ucmacros.asm:

    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
include      \masm32\macros\ucmacros.asm
to
include      \masm32\macros\macros.asm
Hope it will help

juanppf

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

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

Quote from: juanppf on July 03, 2013, 04:25:29 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

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

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

Hey jj2007 it worked nicely!

Thank you very much! :greenclp:

Gunther

And welcome to the forum juanppf.

Gunther
You have to know the facts before you can distort them.