What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » trouble with strings [C++]

trouble with strings [C++]
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: trouble with strings [C++]
The question you need to ask yourself first is what are you going todo with the data in the Plus! script.

This is highly important as this dictates how the data is to be send. eg: if you are going to show the data, the data must be in unicode.
If you are going to manipulate the data with JScript functions like Replace, Substr, etc it must be unicode too. If the data is like a picture stream or something you need to send it as real byte data (of course you can show this as a string too, but this requires some additional converting with the proper APIs (never simply add or remove null bytes when you want to convert from or to unicode!!!)).

But I assume you are at least going to manipulate the recieved data with Jscript functions. So send it as unicode...

But for byte arrays you can not use C-style strings (null terminated strings), you need to use BSTRs, which can contain null bytes since the length of the string is not defined by the first occurance of a null byte, but by the length indicator in front of the string.

BSTRs are unicode. But don't simply add null bytes to your original data bytes to make them unicode. That will not work and will render wrong results. You need to use proper ascii to unicode convertion.

PS: I hope I make some sense here, it is very late (or better early) here :P

PS2: all these problems you have for your sniffer (multithreading, infinitate loops, strings/data sending) can all easly be avoided if you use/make an AciveX DLL though ;)

This post was edited on 06-10-2007 at 03:12 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
06-10-2007 03:06 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
trouble with strings [C++] - by cooldude_i06 on 06-08-2007 at 03:40 AM
RE: trouble with strings [C++] - by TazDevil on 06-08-2007 at 07:49 AM
RE: trouble with strings [C++] - by cooldude_i06 on 06-09-2007 at 08:54 AM
RE: trouble with strings [C++] - by vikke on 06-09-2007 at 09:07 AM
RE: trouble with strings [C++] - by cooldude_i06 on 06-09-2007 at 08:29 PM
RE: RE: trouble with strings [C++] - by TazDevil on 06-09-2007 at 08:44 PM
RE: trouble with strings [C++] - by cooldude_i06 on 06-09-2007 at 10:29 PM
RE: trouble with strings [C++] - by CookieRevised on 06-10-2007 at 03:06 AM
RE: RE: trouble with strings [C++] - by cooldude_i06 on 06-10-2007 at 07:06 AM
RE: trouble with strings [C++] - by TheBlasphemer on 06-10-2007 at 12:05 PM
RE: trouble with strings [C++] - by cooldude_i06 on 06-10-2007 at 09:09 PM
RE: trouble with strings [C++] - by -dt- on 06-11-2007 at 04:10 AM
RE: trouble with strings [C++] - by cooldude_i06 on 06-11-2007 at 07:34 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On