Author Topic: MACRO for chains in ANSI and/or UNICODE format  (Read 7610 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
MACRO for chains in ANSI and/or UNICODE format
« on: April 13, 2013, 05:21:02 PM »
I have searched a set of macros who are accepted by ml and JWASM.
It had been a challenge to reach the goal.
Samples are included in the asm file.
Here the result.
« Last Edit: April 13, 2013, 10:13:03 PM by ToutEnMasm »
Fa is a musical note to play with CL

Vortex

  • Member
  • *****
  • Posts: 2583
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #1 on: April 13, 2013, 06:01:12 PM »
Hi ToutEnMasm,

Kindly, could you provide some example usages?

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #2 on: April 13, 2013, 07:46:35 PM »
Hi ToutEnMasm,

yes, some examples would be a great help. Thank you.

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

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #3 on: April 13, 2013, 10:04:47 PM »

The download is an asm files with samples of use (messagebox).
Compile it with jwasm or ml and you will see the result.
The only who can be missing is the sdk32.inc ,get it below

Code: [Select]
comment * «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    The SDK32 Runtime Library include file.

  ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««« *

      .686p   
.XMM
.MMX
                                 
      .model flat, stdcall                     
      option casemap :none               

.NOLIST
include translate.inc ;SDK translate include files
include windows.sdk

;     libraries
;     ~~~~~~~~~
    ; ------------------------------------------
    ; import libraries for Windows API functions
    ; ------------------------------------------
      includelib gdi32.lib
      includelib user32.lib
      includelib kernel32.lib
      includelib Comctl32.lib
      includelib comdlg32.lib
      includelib shell32.lib
      includelib oleaut32.lib
      includelib ole32.lib

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
To switch from ansi to unicode just comment or uncomment those two lines.
Quote
   UNICODE equ
   __UNICODE__ equ UNICODE


Fa is a musical note to play with CL

Gunther

  • Member
  • *****
  • Posts: 3723
  • Forgive your enemies, but never forget their names
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #4 on: April 14, 2013, 01:41:30 AM »
Hi ToutEnMasm,

To switch from ansi to unicode just comment or uncomment those two lines.
Quote
   UNICODE equ
   __UNICODE__ equ UNICODE

thank you.  :t

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

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #5 on: April 14, 2013, 12:20:31 PM »
i'm going to have to take a French class   :P

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #6 on: April 14, 2013, 04:08:39 PM »

Here is the translate  ;)

The CANS write an ANSI chain in data
The CUNI  write an UNICODE chain in data
The CANS_UNI write an ANSI or UNICODE chain in data ( depends of UNICODE switch)
---------- Used in function -------------------------------
PAU   return the addr of an Ansi or Unicode string write in data
PAA   return the addr of an Ansi string write in data
PUU  return the addr of an Unicode string write in data

replace the P with a O in those macros and get the Offset instead of the adress




Fa is a musical note to play with CL

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #7 on: April 14, 2013, 10:45:38 PM »
i was trying to read the comments - lol
i can use google translate, i guess

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #8 on: April 15, 2013, 06:34:46 AM »
Just for curiosity: How do you handle "real" Unicode, e.g. Russian or Chinese? I.e. is there a macro similar to wRes$()?

And given that your editor editmasm can handle Unicode, is there a way to write strings directly in Russian or Chinese?

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #9 on: April 15, 2013, 04:42:02 PM »

My IDE editmasm use only ANSI to write code,the used of UNICODE is allowed in code by the SDK windows translated .
For the comparison with your macro,made it yourself ,you have the full source code.

Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #10 on: April 15, 2013, 06:10:03 PM »
What is the use of Unicode macros if you cannot display Russian or Chinese?

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #11 on: April 15, 2013, 08:32:37 PM »
some functions need it,I just let microsoft made his soup.

Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #12 on: April 26, 2013, 08:10:44 PM »
Here another sample (from the masm32 package) who switch easily between ansi to unicode.
The executable is in unicode

later : the term  cumul in the two macro (CANS and CUNI) is too much usable  and must be replaced by a more unknown like @cumulwxyz.
Code: [Select]
IF CountTheNumberofChar EQ 0
[b]@cumulwxyz[/b] TEXTEQU <DB "&char">
[b]@cumulwxyz[/b] ;execute
ENDIF

« Last Edit: August 11, 2021, 03:06:37 AM by TouEnMasm »
Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: MACRO for chains in ANSI and/or UNICODE format
« Reply #13 on: August 11, 2021, 03:08:20 AM »

Added a note about the term cumul who must be renamed @cumulwxyz to avoid conflict with other cumul (valuable for 32/64)
Fa is a musical note to play with CL