Page 1 of 3 123>
Topic Options
#103802 - 2003-08-15 05:08 PM String Challenge
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Guys:

I have a challenge for you.

As you probably know a string in KiXtart can contain any charatcer except \0 and \x1a (see KiXtart v4.21 Manual, page 20).

However, I have a requirement where I need to provide a string that will contain at least a \0 to a COM object. Doea anybody know of a way to get this string created in memory, bypassing the KiXtart string limitations.

For example, have a second COM object create the string and pass it into the target COM-object? The COM-object should be native to Windows 2000/XP/2003

[ 18. August 2003, 03:40: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#103803 - 2003-08-15 05:12 PM Re: String Challenge
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is a way.
but it kinda has nothing to do with kix.

you need to create the string with some other com-object and send it directly to the destination without storing it in kixtart's namespace.

haven't actually tried but quickiest quess is that.
_________________________
!

download KiXnet

Top
#103804 - 2003-08-15 05:15 PM Re: String Challenge
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
just off the top of my head, using Lonkero suggestion of not storing it within KIX, is to write out the sting you want to a file in parts...

"...\" + "0..."

and then read it back in as a whole string.

just a thought

W
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#103805 - 2003-08-15 05:17 PM Re: String Challenge
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Jooel, yes, that's my line-of-thought, too. Just haven't yet found soemthing that would do this.

Wizard: No, this has nothing to do with creating a \0 but with creating the character representation of CHR(0) which will not work in KiXtart itself.
_________________________
There are two types of vessels, submarines and targets.

Top
#103806 - 2003-08-15 05:19 PM Re: String Challenge
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Tricky. I've been reading up on automation, preparing to create an automation server, and the COM object you are talking to will need to be able to understand the object you are passing.

If you are passing something that looks like a string, it may well get interpreted as such in which case you will have the same problem.

I think what you need to do is to pass an object that the COM automation can handle in a binary fashion - a BLOB or similar.

Top
#103807 - 2003-08-15 06:26 PM Re: String Challenge
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I didn't dare to say the word binary but you throwed it in the game for me, thanks [Wink]
_________________________
!

download KiXnet

Top
#103808 - 2003-08-15 06:29 PM Re: String Challenge
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
So, now the question is, is there a COM-object which can do this?

I guess, I'll have to pay MSDN a visit and do some searches.
_________________________
There are two types of vessels, submarines and targets.

Top
#103809 - 2003-08-15 06:32 PM Re: String Challenge
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Jens,

I just created a little test com object that dumps the content of strings passed to it. Here's what I tried:

break on

$String = CreateObject("ComString.String")

$String.String = "kixtart"+CHR(0)+"org"

exit 1

When i trace the string, its shows up as:

Len = 10
String = kixtartorg

The CHR(0) got stripped-off, trying other things but if anyone has any further things to try, let us know ...

Top
#103810 - 2003-08-15 06:35 PM Re: String Challenge
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
This was discussed sometime ago and I thought the conclusion then was a suggestion that Ruud provide full support for ascii 0-255.

I can help with Perl [Wink]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#103811 - 2003-08-15 06:50 PM Re: String Challenge
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
should I then promise help with tcl [Big Grin]

shawn, could you do a test with:
-have a com-object throw kix a string that has nul-char
-kix save it in var
-have kix display it and give it back
-have kix ask for the string and directly give it to com-object without first saving it in var

what's the outcome?

if these fail, we would need a real intercommunicating com-object
_________________________
!

download KiXnet

Top
#103812 - 2003-08-15 06:56 PM Re: String Challenge
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I've done some tests, too, and CHR(0) will just not show up inside KiXtart. I event ried passing CHR(0) directly into the COM-object and it didn't work.

BTW, the COM-object where I need this is MSWinsock.Winsock(), which I tried to use to do a Wake-On-LAN. However, MAC addresses do contain CHR(0), thus currently a no-go for KiXtart-COM-WOL [Frown]
_________________________
There are two types of vessels, submarines and targets.

Top
#103813 - 2003-08-15 07:00 PM Re: String Challenge
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Looks like one can pass anything except CHR(0). One can even pass negative numbers like CHR(-32) but no (0).
Top
#103814 - 2003-08-15 07:03 PM Re: String Challenge
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I'm still asking is this the case if the nul-char comes from com.

it might well be that ruud has disabled just feeding the chr(0) but doesn't care if it goes inside some string.
_________________________
!

download KiXnet

Top
#103815 - 2003-08-15 07:06 PM Re: String Challenge
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
If one returns a string that has a CHR(0) in it, from COM, Kixtart doesn't read past the CHR(0), it truncated it.
Top
#103816 - 2003-08-15 07:18 PM Re: String Challenge
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Doesn't writing REG_MULTI_SZ registry require nulls (chr(0))? Yes it does. Ruud has us using pipe "|" to represent chr(0).

https://premier.microsoft.com/premier/library/default.aspx?scid=kb;en-us;258545

Sorry but M$ search is not working at this time.

If Ruud would support chr(0) we could clean all this up.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#103817 - 2003-08-15 08:23 PM Re: String Challenge
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
shawn, tested with what?

hoby, throw him a suggestion and see what he replies.
_________________________
!

download KiXnet

Top
#103818 - 2003-08-15 08:39 PM Re: String Challenge
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
jlo, i just threw together a little COM object that gets and put strings. COM objects support a variant type called a BSTR that does support strings with null chars (usually a null char means end-of-string) but BSTR's can have strings with nulls in them. But it seems that Kixtart doesn't read past the null.
Top
#103819 - 2003-08-15 09:24 PM Re: String Challenge
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
suggestion email away....
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#103820 - 2003-08-15 09:34 PM Re: String Challenge
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
bstr?
don't remember... kinda pointer?

anyway, if I have reverse-engineered kix's way in my mind correctly, I know where it does fail.

I thought there could be 2 possibilities:
- kixtart reads the string and allocates mem by it
- kixtart does not care what it has inside unless needed thus it could have whatever inside, even binary data

these are kinda pseudo thoughts as that is not fully as it really goes.
now, what I've heard from you, it seems that kix uses the first approach which in all means seems worse.
1) it removes ability to have whatever data stored in kix-vars
2) the unneeded scan of the data slows things up which will show up in many milliseconds after some days of hard script execution
3) you name it

now, if kix's lack of support for the other types of data depends of using old routines which depend on some old c-library it should be easy to fix that.
also the logic of pre-tokenized might have a hit but don't think it could in any way reduce the speed nor make it too much more complex to have...

well, once again my thoughts...
as you see, I have hard time of taking your word for it but as am too lazy to play with it, I just keep using my mouth [Big Grin]

k, me of now...
_________________________
!

download KiXnet

Top
#103821 - 2003-08-15 11:54 PM Re: String Challenge
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Got some bad news dudes ...

I have a sml COM component that has a string property, when you send it a string, it loops over it and dumps the ascii contents, heres a sample:

code:
$ComString = CreateObject("ComString.String")

$ComString.String = "kixtart"+chr(1)+"org"

when i run this, the component dumps the contents as:

Dump string:

0=107
1=105
2=120
3=116
4=97
5=114
6=116
7=1
8=111
9=114
10=103

notice #7 that is the CHR(1) ... when I use CHR(0) instead, this is the dump:

Dump string:

0=107
1=105
2=120
3=116
4=97
5=114
6=116
7=111
8=114
9=103

notice the CHR(0) doesn't show up at all. Heres the sad bit, when I code this in VBS and pass it to the same COM component, the result is even worse than in KIX, it only seems to pass up to the CHR(0) and then stops.

code:
Set ComString = CreateObject( "ComString.String" )

ComString.String = "kixtart" & CHR(0) & "org"

the result is:

Dump string:

0=107
1=105
2=120
3=116
4=97
5=114
6=116

anyone know of another (proper) way to do this in vbs ?

-Shawn

[ 15. August 2003, 23:57: Message edited by: Shawn ]

Top
Page 1 of 3 123>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2375 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.135 seconds in which 0.079 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org