Well i was just messing around with the messenging service to try to actually send a message to myself...
to my demise, the source assembled perfectly, cept nothing happens, it seems to have just passed right along and nothing happened...
here is the source, it looks simple, and everything looks fine to me...but there must be something wrong:
maybe it was something i did wrong with the addrs?
Any help will be greatly appreciated :)
Thanks in advanced!
***********
EDIT:
***********
This is what the WinAPI reference said about NetMessageBufferSend():
to my demise, the source assembled perfectly, cept nothing happens, it seems to have just passed right along and nothing happened...
here is the source, it looks simple, and everything looks fine to me...but there must be something wrong:
.486
.model flat, stdcall
option casemap:none
;Includes and Libraries
;####################################################################
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\netapi32.lib
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\gdi32.inc
include \masm32\include\netapi32.inc
;####################################################################
.data
From db 'Blah',0
To db 'LOCALHOST',0
Message db 'Testing123',0
.code
start:
invoke NetMessageBufferSend, NULL, addr To,addr From,addr Message, sizeof Message
invoke ExitProcess, NULL
end start
maybe it was something i did wrong with the addrs?
Any help will be greatly appreciated :)
Thanks in advanced!
***********
EDIT:
***********
This is what the WinAPI reference said about NetMessageBufferSend():
No special group membership is required to execute NetMessageBufferSend on a LAN Manager or Windows NT system. Admin, Accounts, Print, or Server operator group membership is required to successfully execute NetMessageBufferSend on a remote server.
NET_API_STATUS NetMessageBufferSend(
LPTSTR servername,
LPTSTR msgname,
LPTSTR fromname,
LPBYTE buf,
DWORD buflen
);
Parameters
servername
Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.
msgname
Pointer to a Unicode string containing the message name to which the message buffer should be sent.
fromname
Pointer to a Unicode string containing the message name sending the information. The fromname parameter is new for Windows networking. This parameter is needed for sending interrupting messages from the computer name rather than the logged on user. If NULL is specified, the message is sent from the logged-on user as with LAN Manager 2.x.
buf
Pointer to a buffer of message text.
buflen
The length, in bytes, of the message text in buf.
NET_API_STATUS NetMessageBufferSend(
LPTSTR servername,
LPTSTR msgname,
LPTSTR fromname,
LPBYTE buf,
DWORD buflen
);
Parameters
servername
Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.
msgname
Pointer to a Unicode string containing the message name to which the message buffer should be sent.
fromname
Pointer to a Unicode string containing the message name sending the information. The fromname parameter is new for Windows networking. This parameter is needed for sending interrupting messages from the computer name rather than the logged on user. If NULL is specified, the message is sent from the logged-on user as with LAN Manager 2.x.
buf
Pointer to a buffer of message text.
buflen
The length, in bytes, of the message text in buf.
I have no experience with these api's,
but maybe you can check if NetMessageBufferSend returns a succes or if it returns any error-code,
and get some hints from there?
but maybe you can check if NetMessageBufferSend returns a succes or if it returns any error-code,
and get some hints from there?
PSDK says unicode, you're doing asciz. that's one rather obvious possible problem.
How would i do it in unicode?
Look up MultiByteToWideChar in PSDK. It will convert
strings to wide-character (Unicode) string.
strings to wide-character (Unicode) string.
Hmm, could someone post some examples? I'm such a newbie :)
:stupid:
:stupid:
well I played a bit around with sending messages inside my LAN and this should work:
NOTE: you could allocate the buffer sizes automatically if you call the MultiBytetoWideChar function with zero as last parameter, it should return the necessary buffer size. But this works for short messages.
HTH, phueghy
buff1 db 256 dup(0)
buff2 db 256 dup(0)
buff db 256 dup(0)
.code
start:
invoke MultiByteToWideChar, CP_ACP, MB_PRECOMPOSED, ADDR From, -1, ADDR buff1, 256
invoke MultiByteToWideChar, CP_ACP, MB_PRECOMPOSED, ADDR To, -1, ADDR buff2, 256
invoke MultiByteToWideChar, CP_ACP, MB_PRECOMPOSED, ADDR Message, -1, ADDR buff, 256
invoke NetMessageBufferSend, NULL, addr buff2,addr buff1,addr buff, 256
NOTE: you could allocate the buffer sizes automatically if you call the MultiBytetoWideChar function with zero as last parameter, it should return the necessary buffer size. But this works for short messages.
HTH, phueghy