Hi aw27,
If you use :printf PROTO :PTR, :vararg
the INVOKE printf, "result: %d", eax will not assemble
but printf PROTO :PTR, :PTR works fine ( see example below)
That means that Johnsa prevented an purpose that to occur because vararg can contain anyting
I'll leave it to him to decide if he will change it or not.
--- strliterals.asm ------------------------------------------------------------
1: .386
2:
3: USELITERALS equ 1
4:
5: .model Flat, C
6: option Casemap :None
7: IFDEF USELITERALS
8: OPTION LITERALS:ON ; Allow string literals use in INVOKE
9: ENDIF
10:
11: TRUE equ 1
12:
13: includelib \masm32\lib\ntdll.lib
14: RtlCompareString PROTO STDCALL :ptr,:ptr,:BYTE
15: RtlInitAnsiString PROTO STDCALL :ptr, :ptr
16:
17: includelib \masm32\lib\msvcrt.lib
18: printf PROTO :PTR, :PTR
19:
20: includelib \masm32\lib\kernel32.lib
21: ExitProcess proto STDCALL :dword
22:
23: _STRING struct
24: _Length word ?
25: _Maximumlength word ?
26: _Buffer dword ?
27: _STRING ends
28:
29: .data
30: format db 'result: %d',13,10,0
31: s1 db "someStr",0 ;
32: s2 db "anotherStr",0 ;
33:
34: .code
35:
36: main proc
009B1010 55 push ebp
009B1011 8B EC mov ebp,esp
009B1013 83 EC 10 sub esp,10h
37: LOCAL str1 : _STRING
38: LOCAL str2 : _STRING
39: INVOKE RtlInitAnsiString, addr str1, "someStr"
009B1016 68 49 50 9B 00 push 9B5049h
009B101B 8D 45 F8 lea eax,[str1]
009B101E 50 push eax
009B101F E8 90 00 00 00 call _RtlInitAnsiString@8 (09B10B4h)
40: INVOKE RtlInitAnsiString, addr str2, "anotherStr"
009B1024 68 51 50 9B 00 push 9B5051h
009B1029 8D 45 F0 lea eax,[str2]
009B102C 50 push eax
009B102D E8 82 00 00 00 call _RtlInitAnsiString@8 (09B10B4h)
41: INVOKE RtlCompareString, addr str1, addr str2, TRUE
009B1032 6A 01 push 1
009B1034 8D 45 F0 lea eax,[str2]
009B1037 50 push eax
009B1038 8D 45 F8 lea eax,[str1]
009B103B 50 push eax
009B103C E8 6D 00 00 00 call _RtlCompareString@12 (09B10AEh)
42: INVOKE printf, "result: %d", eax
009B1041 50 push eax
42: INVOKE printf, "result: %d", eax
009B1042 68 3E 50 9B 00 push 9B503Eh
009B1047 E8 6E 00 00 00 call _printf (09B10BAh)
009B104C 83 C4 08 add esp,8
43:
44: INVOKE RtlInitAnsiString, addr str1, "someStr"
009B104F 68 49 50 9B 00 push 9B5049h
009B1054 8D 45 F8 lea eax,[str1]
009B1057 50 push eax
009B1058 E8 57 00 00 00 call _RtlInitAnsiString@8 (09B10B4h)
45: INVOKE RtlInitAnsiString, addr str2, "anotherStr"
009B105D 68 51 50 9B 00 push 9B5051h
009B1062 8D 45 F0 lea eax,[str2]
009B1065 50 push eax
009B1066 E8 49 00 00 00 call _RtlInitAnsiString@8 (09B10B4h)
46: INVOKE RtlCompareString, addr str1, addr str2, TRUE
009B106B 6A 01 push 1
009B106D 8D 45 F0 lea eax,[str2]
009B1070 50 push eax
009B1071 8D 45 F8 lea eax,[str1]
009B1074 50 push eax
009B1075 E8 34 00 00 00 call _RtlCompareString@12 (09B10AEh)
47: INVOKE printf, addr format, eax
009B107A 50 push eax
009B107B 68 00 50 9B 00 push 9B5000h
009B1080 E8 35 00 00 00 call _printf (09B10BAh)
009B1085 83 C4 08 add esp,8
48:
49: INVOKE ExitProcess,0
009B1088 6A 00 push 0
009B108A E8 35 10 00 00 call _ExitProcess@4 (09B20C4h)
--- No source file -------------------------------------------------------------