Valhalla Legends Archive

Programming => General Programming => Topic started by: Eric on February 09, 2004, 01:03 AM

Title: Porting C++ to VB
Post by: Eric on February 09, 2004, 01:03 AM
Edit: Accidental double post
Title: Re:Porting C++ to VB
Post by: Eric on February 09, 2004, 01:04 AM
I've been working on porting BnetAuth.dll from C++ to VB so that I can insert it into my VB project without having to include the extra .dll file.
I've gotten a decent amount of the password hashing finished, however I'm stuck.

hashbuf[] is referring to an unsigned long array cotaining 5 blocks of information, each block being 10 bytes long.

What I'm confused about is what exactly hashbuf+5 does, I think it's joining the array someway, but I don't know exactly how.
Title: Re:Porting C++ to VB
Post by: iago on February 09, 2004, 08:09 AM
You can add to an array instead of indexing into it, so this:
a = array[ 7 ];
is the same as
a = array + 7;

or
a = array[ 0 ];
is the same as
a = *array;

Don't forget, however, that Visual Basic doesn't have unsigned datatypes. I hope you have some workaround for that.
Title: Re:Porting C++ to VB
Post by: UserLoser. on February 09, 2004, 10:43 AM
Quote from: LoRd[nK] on February 09, 2004, 01:04 AM
I've been working on porting BnetAuth.dll from C++ to VB so that I can insert it into my VB project without having to include the extra .dll file.
I've gotten a decent amount of the password hashing finished, however I'm stuck.

hashbuf[] is referring to an unsigned long array cotaining 5 blocks of information, each block being 10 bytes long.

What I'm confused about is what exactly hashbuf+5 does, I think it's joining the array someway, but I don't know exactly how.

I have everything ported over into VB - If you want it, I can send it to you when I get home
Title: Re:Porting C++ to VB
Post by: MyndFyre on February 09, 2004, 01:55 PM
Quote from: UserLoser. on February 09, 2004, 10:43 AM
Quote from: LoRd[nK] on February 09, 2004, 01:04 AM
I've been working on porting BnetAuth.dll from C++ to VB so that I can insert it into my VB project without having to include the extra .dll file.
I've gotten a decent amount of the password hashing finished, however I'm stuck.

hashbuf[] is referring to an unsigned long array cotaining 5 blocks of information, each block being 10 bytes long.

What I'm confused about is what exactly hashbuf+5 does, I think it's joining the array someway, but I don't know exactly how.

I have everything ported over into VB - If you want it, I can send it to you when I get home

He's obviously showing the initiative to do it himself....  Why don't you point him in the right direction and help him out?  In the end, that will be a lot better for him anyway....
Title: Re:Porting C++ to VB
Post by: Kp on February 09, 2004, 04:36 PM
Quote from: iago on February 09, 2004, 08:09 AMa = array[7];
is the same as
a = array + 7;

or
a = array[ 0 ];
is the same as
a = *array;

Not quite.  array[ 7 ] refers to the value at offset 7 in the array.  array+7 refers to the address of the element at offset 7.  That is, *(array+7) == array[ 7 ].  Alternately,  &array[ 7 ] == array+7.

No challenge to your second statement, but the forum did damage it (hid your subscript zero).
Title: Re:Porting C++ to VB
Post by: iago on February 09, 2004, 05:20 PM
Quote from: Kp on February 09, 2004, 04:36 PM
Quote from: iago on February 09, 2004, 08:09 AMa = array[7];
is the same as
a = array + 7;

or
a = array[ 0 ];
is the same as
a = *array;

Not quite.  array[ 7 ] refers to the value at offset 7 in the array.  array+7 refers to the address of the element at offset 7.  That is, *(array+7) == array[ 7 ].  Alternately,  &array[ 7 ] == array+7.

No challenge to your second statement, but the forum did damage it (hid your subscript zero).

You're right about everything.  That was my bad not dereferencing, and I fixed the thing that board broke.