News:

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

Main Menu

Mixed UNICODE/ASCII builds in Masm32

Started by jj2007, November 16, 2014, 04:52:40 PM

Previous topic - Next topic

jj2007

I am testing to what extent mixing Ascii and Unicode is possible with the standard Masm32 installation, and it seems possible but the results are a bit mixed. For example, in the attached testbed, fopen fails for an existing file but succeeds for a file that doesn't exist:
mov esi, ucCmd$(1)
; print str$(fexist(esi)), " for fex", 13, 10
.if fexist(esi) ; OK
print "You have ["
.else
print "YOU DO NOT HAVE ["
.endif
print esi, "], and "
mov ebx, fopen(esi)
.if ebx!=INVALID_HANDLE_VALUE
print "fopen succeeded", 13, 10
fclose ebx
.else
print "NO LUCK for fopen", 13, 10
.endif

Masm32 Unicode: Hello World
print ucCmd$=   [Args for Masm32.bat]
print GetComLine=       [Masm32Commandlines.exe  "Args for Masm32.bat" several a
rguments]
StdOutW ucC=    [Args for Masm32.bat]

You DO have [Args for Masm32.bat], but NO LUCK for fopen


Masm32 Ascii: Hello World
print cmd$=     [牁獧映牯䴠獡㍭⸲慢t]
print GetComLine=       [Masm32Commandlines.exe  "Args for Masm32.bat" several a
rguments]
StdOutA cmd$=   [Args for Masm32.bat]

YOU DO NOT HAVE [牁獧映牯䴠獡㍭⸲慢t], and fopen SUCCEEDED


What's wrong here? Sources and batch files for some args are attached, plus a file with a UNICODE name and spaces, for dragging over the exe. MasmBasicCommandlines.asc file contains the MasmBasic equivalent, with a different logic, i.e. one build but the option to put w like wide in front of the macros:

  wLet esi=wCL$(1)
  .if wExist(esi)            ; OK
      wPrint "You have ["
  .else
      wPrint "YOU DO NOT HAVE ["
  .endif
  wPrint esi, "], and "
  wOpen "I", #1, esi
  .if eax!=INVALID_HANDLE_VALUE
      PrintLine "wOpen succeeded"
      Close #1
  .else
      PrintLine "wOpen FAILED"
  .endif