Can this be split up into 2 lines to improve readability ?
stringpointers BYTE "T","h","i","s"," ","i","s"," ","a","n"," ","e","x","a","m","p","l","e","."," ","S","i","e","g","e","W","o","r","k","s"," ","2","0","1","1",0
yes,
example:
lbl BYTE "xyz"
BYTE "xyz2",0
Also, you may want to use the WSTR-macro for this declaration?
I tried this but it said
C:\masm32\SOURCE\test.asm(26) : error A2050:real or BCD number not allowed
I tried this but it said
C:\masm32\SOURCE\test.asm(26) : error A2050:real or BCD number not allowed
stringpointers BYTE "T","h","i","s"," ","i","s"," ","a","n"," ","e","x","a","m","p","l","e"
BYTE ,"."," ","S","i","e","g","e","W","o","r","k","s"," ","2","0","1","1",0
Quote from: Magnum on November 11, 2011, 08:58:24 PMstringpointers BYTE "T","h","i","s"," ","i","s"," ","a","n"," ","e","x","a","m","p","l","e"
BYTE ,"."," ","S","i","e","g","e","W","o","r","k","s"," ","2","0","1","1",0
remove the comma. Also, for Unicode, you must use WORD instead of BYTE
You know the WSTR-macro in macros.asm?:
WSTR stringpointers,"This is an example."
Quote from: qWord on November 11, 2011, 09:21:58 PM
Quote from: Magnum on November 11, 2011, 08:58:24 PMstringpointers BYTE "T","h","i","s"," ","i","s"," ","a","n"," ","e","x","a","m","p","l","e"
BYTE ,"."," ","S","i","e","g","e","W","o","r","k","s"," ","2","0","1","1",0
remove the comma. Also, for Unicode, you must use WORD instead of BYTE
You know the WSTR-macro in macros.asm?:
WSTR stringpointers,"This is an example."
Thanks Qword.
If I used WSTR with a long string, I would have to split that up into multiple lines too.
I used the macro, but MyString doesn't show up.
.data
OutputBuffer BYTE 512 dup(0)
Provider_Name BYTE 'Have no idea', 0
Failed BYTE 'Failure, Register Event Function Returned %d.',0
Success BYTE 'Success, Register Event Function Returned %d.', 0
AppName BYTE 'SiegeWorks 2011',0
; Unicode created by UniString.exe
;stringpointers WORD "T","h","i","s"," ","i","s"," ","a","n"," ","e","x","a","m","p","l","e"
; WORD "."," ","S","i","e","g","e","W","o","r","k","s"," ","2","0","1","1",0
WSTR MyString,"This is an example. Siegeworks 2011"
p_string_input DWORD 0
.DATA?
hEventLog HWND ?
dwEventDataSize WORD ?
.code
start:
invoke RegisterEventSource, 0, ADDR Provider_Name
mov hEventLog, EAX
call Display_Return_Message
lea EAX, MyString
mov p_string_input, EAX
invoke ReportEvent, hEventLog, \ ; handle to log file
1, \ ; EVENTLOG_ERROR_TYPE
2, \ ; DATABASE_CATEGORY
0C0000101H, \ ; MSG_BAD_FILE_CONTENTS the event ID
0, \ ; NULL
1, \ ; number input strings
0, \ ; number bytes to write in word value or 0
ADDR p_string_input, \ ; ADDRess of strings
0 ; pointer to binary data or NULL
call Display_Return_Message
invoke DeregisterEventSource, hEventLog
call Display_Return_Message
invoke ExitProcess, NULL
Display_Return_Message proc
.if EAX == 0
pusha
invoke GetLastError
invoke wsprintf, ADDR OutputBuffer, ADDR Failed, EAX
invoke MessageBox, 0, ADDR OutputBuffer, ADDR AppName, 0
popa
.endif
.if EAX != 0
invoke wsprintf, ADDR OutputBuffer, ADDR Success, EAX
invoke MessageBox, 0, ADDR OutputBuffer, ADDR AppName, 0
.endif
ret
Display_Return_Message endp
END start
Quote from: Magnum on November 11, 2011, 09:57:50 PM
Provider_Name BYTE 'Have no idea', 0 ; ???
[...]
invoke ReportEventW, hEventLog, \ ; handle to log file
1, \ ; EVENTLOG_ERROR_TYPE
2, \ ; DATABASE_CATEGORY
0C0000101H, \ ; MSG_BAD_FILE_CONTENTS the event ID
0, \ ; NULL
1, \ ; number input strings
0, \ ; number bytes to write in word value or 0
ADDR p_string_input, \ ; ADDRess of strings
The attachment has the source that works.
Using the WSTR macro is what isn't working for some reason.
Andy,
Shortly the new version of MASM32 will be available and it has 2 different macro systems for UNICODE, a generic one and an advanced on by qWord. Both can handle strings up to 240 characters. There are other techniques for much longer strings, an external utility or store a complete unicode text in an object module.
Thanks Hutch.