• Welcome to Valhalla Legends Archive.
 

A little help needed...

Started by RedPhoenix, April 15, 2004, 02:00 AM

Previous topic - Next topic

RedPhoenix

#45
Anyone know what the replacement for a null char would be?

0x00  -  &H0

When I use that char in a string, for example:


Dim myString As String = "Str" & Chr(&H0) & "ing"
MsgBox myString


It only shows Str in the message box, any reason and a suitable replacement for this?

MyndFyre

#46

Dim myString As String = "Str" & Chr(&H0) & "ing"
MsgBox myString.Replace(Chr(&H0), String.Empty)


The reason is that Windows uses the null (0x0) character to determine where a marshalled string ends.  Once it hits the 0x0 in your string, it stops.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

o.OV

In VB6 I use vbNullChar in place of Chr$(0)
If the facts don't fit the theory, change the facts. - Albert Einstein

Adron

Quote from: RedPhoenix on April 17, 2004, 10:18 PM
It only shows Str in the message box, any reason and a suitable replacement for this?

Why would you want to display a Chr(0)? It's not a letter or something you could write on paper. If it's for debugging purposes, make yourself a hexdump function. You'll need that for all the other non-printable or badly printable things that have to be sent on a binary b.net connection anyway.

RedPhoenix

#49
I figured since this form:


Private msgStart As [String] = Chr(&H3) & Chr(&H4) & Chr(&H52) & Chr(&H65) & Chr(&H64) & Chr(&H50) & Chr(&H68) & Chr(&H6F) _
       & Chr(&H65) & Chr(&H6E) & Chr(&H69) & Chr(&H78) & Chr(&H5B) & Chr(&H48) & Chr(&H73) & Chr(&H5D) & Chr(&HD) & Chr(&HA) & Chr(&H66) _
         & Chr(&H69) & Chr() & Chr() & Chr() & Chr() & Chr() & Chr() & Chr()


gets me into Public Chat, which I got the hex values from Ethereal. That I could do the same method to get into the other channels. Which I'm in the progess of testing right now. Just when looking at the packet in Ethereal, there was alot of 0x00 ( . ). Which interupted my string. But, I got it worked out now. Just testing, debugging and getting IP banned now.

**Tested what I thought would work. I grabbed all the hex values from the data my pc sent to the server. Stored them into a file, then read from that file storing each value in an array of char. I have like 13 different arrays for each packet that was sent. Then per array, I send each value. Once all the values within an array have been sent. Then I pause sending the next packet by 200 miliseconds. But, right now, even though I have all the same hex values stored correctly. I'm getting IP banned after I send the third packet. Maybe my delay isn't long enough. I'll try different delay intervals between packets. *shrugs*

By the way, after sending the second packet though, Ethereal picked up that the server replied back with a data packet ...tenb and other garbage.

Adron

The problem is that your PC doesn't send the same string every time it connects. Your packets must contain different data depending on what the server has previously sent you.

You can send all the packets up until the first time b.net sends you data from the file, but then you need to start parsing what b.net sends you and respond appropriately.


MyndFyre

Phoenix, you CAN NOT get into non-public channels with a CHAT connection that begins with Chr(3).

You MUST log in via a binary product connection that begins with Chr(1).
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

RedPhoenix

#52
I know that already:

&H1 = game
&H2 = Ftp
&H3 = Chat

I start my logon sequence by sending &H1 right off the bat.

I just posted the code above as an example. That if I send the logon sequence in the form of: Chr(hex), that the server acknowledges it. So in turn, if I log the regular logon sequence. Then resend it through my program, it should work. But, the part of each requests to connect changes, is throwing me off. I get to packet 3 and I get IP banned. But, after I send the second packet, I get a response of ( .....tenb... ). Noticed that by using ethereal.

Also I noticed tat the logon sequence uses UDP for 3 of the packets. Should I switch over to UDP for them 3 packets? I think that is where I'm getting banned.

|