Page 1 of 1
NetSend the 'Mailslots-Way'
Posted: Mon Jul 14, 2003 4:04 pm
by Rings
Code updated for 5.20+
I do not know if this works under Win89, but its a cool way to send messages over the network
Code: Select all
Sender.s="srings";Source (ME)
Reciepent.s="Ringsnb2" ;Destination, here my Notebook
Reciepent.s="*" ;BroadCast to all in network :)
Message.s="This is a Testmessage ! " ;The Message
Needed=Len(Sender.s)+Len(Reciepent.s)+Len(Message.s)+4 ;Calculate the needed Memory
buff = AllocateMemory(needed);and allocate them
If Buff
;Set the Data to our buffer
PokeS(Buff,Sender)
PokeS(Buff+Len(Sender.s)+1,Reciepent.s)
PokeS(Buff+Len(Sender.s)+Len(Reciepent)+2,Message.s)
SlotName.s = "\\" + Reciepent.s + "\mailslot\messngr"
hFile = CreateFile_(@SlotName.s, #GENERIC_WRITE, #FILE_SHARE_READ, 0, #OPEN_EXISTING, #FILE_ATTRIBUTE_NORMAL, 0)
byteswritten=0
If HFile
Result=WriteFile_(hFile, buff, Needed, @byteswritten, 0)
If Result
MessageRequester("Info","Message written to "+Slotname.s+" : "+ Str(byteswritten),0)
EndIf
CloseHandle_(hFile)
Else
MessageRequester("Info","problem with Slotname:"+Slotname.s,0);Error
EndIf
FreeMemory(Buff);Free Memory
EndIf
This is good stuff
Posted: Tue Jul 15, 2003 3:35 am
by Fangbeast
Thanks for this Rings...I have been annoying my teenage daughter all day with it as she sits on her bum and does nothing (ROFL)
Now to give it a window and really make her mad:):)
Excellent
Posted: Tue Jul 15, 2003 5:34 am
by LJ
Excellent Rings. Your code is the first 'net' code that works on my network configuration (no base, peer to peer, linksys wireless). It seems other network code that has been posted requires a server/client configuration. I like the simple yet direct approach. I wonder if your code sends a message over any network regardless of the configuration of the network? Nice one. Lj
Re: Excellent
Posted: Tue Jul 15, 2003 9:16 am
by Rings
LJ wrote:Excellent Rings. Your code is the first 'net' code that works on my network configuration (no base, peer to peer, linksys wireless). It seems other network code that has been posted requires a server/client configuration. I like the simple yet direct approach. I wonder if your code sends a message over any network regardless of the configuration of the network? Nice one. Lj
mmh.... so did it work under w89 and derivates ?
Posted: Tue Jul 15, 2003 11:48 am
by dige
Damn cool Rings! :D
But why this works?
cya dige
PS: tested on win2ksp4
Posted: Tue Jul 15, 2003 12:23 pm
by hypervox
In days of old, when knights were bold etc.., microsoft had it's own brand of networking known as "workgroups", which uses the netbeui protocol (from 3.11 i believe). This protocol is non-routable, and relies on broadcasts to work. It's so fundamental to how windows networks that it's often enabled by default. The messages you are seeing are sent on this protocol, and are picked up the messenger service (or it's equivilent if you're on a old version of windows).
it's only problem is the fact that is does broadcast! On a NT network, you may see messages from servers who broadcast administrative messages to everybody, so it's not very secure.
Posted: Tue Jul 15, 2003 12:47 pm
by gnozal
Don't undestand the thing

, but it works

!
Posted: Tue Jul 15, 2003 1:42 pm
by Rings
have anyone tested these snippet on older machines (Win95, Win98 or WinME ) ?
thx for you interrest.
Posted: Tue Jul 15, 2003 2:01 pm
by dmoc
Win98se - says message written but no pop-up.
Posted: Tue Jul 15, 2003 2:12 pm
by hypervox
I think on older machines, you need to run "winpopup" to see the messages (NT/Win2000/XP have it built in)
Posted: Tue Jul 15, 2003 2:16 pm
by dmoc
Yep, winpopup gets the message.
PS: Whadaya mean "older machines"!? My PIII-600MHz Win98se is state-of-the-art

Posted: Tue Jul 15, 2003 3:05 pm
by Rings
dmoc wrote:Yep, winpopup gets the message.
PS: Whadaya mean "older machines"!? My PIII-600MHz Win98se is state-of-the-art

nop

Posted: Tue Jul 15, 2003 3:20 pm
by hypervox
Sorry - for older machines read "older O/S".
Windows XP
Posted: Tue Jul 15, 2003 3:51 pm
by LJ
Rings:
I'm running two machines on Windows XP.
Hypervox:
So this is the same technology that a company called MessageHammer was using to spam millions by. As soon as I got the company shutdown, they opened up another web site and started over again. Basically they broadcast a message saying that this form of advertising was coming and if you want to stop it from happening, you must go and purchase their product for $10. Sleezy and cheezy. They targeted entire ISP blocks. Anyways, as soon as I put up my firewall, it blocked these pop ups.
Posted: Tue Jul 15, 2003 4:01 pm
by hypervox
Yup. The problem is that all of the NT based versions of windows have the ports that use this messenger service OPEN BY DEFAULT. The only safe way to stop the messages (as you've discovered) is to block them using a firewall. You can (if you want) disable the messenger service itself, but it's a poor fix. On the older windows O/S's, you just didn't run WinPopUp
