Author Topic: Mixed UNICODE/ASCII builds in Masm32  (Read 984 times)

jj2007

  • Member
  • *****
  • Posts: 7737
  • Assembler is fun ;-)
    • MasmBasic
Mixed UNICODE/ASCII builds in Masm32
« on: November 16, 2014, 04:52:40 PM »
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:
Code: [Select]
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