Jump to content
The simFlight Network Forums

Writing Access Key to offset 8001 using Visual Basic?


Recommended Posts

Hi!

I am trying to write my program access key 12 bytes to offset &H8001 so users of my application wont have to manually enter the key in to register the application. And it appears to be working because I am not getting the popup message in FS2002, but it appears to be an error in FSUIPC log. If it is just incorrect only and informational in the log, that's fine with me, I just wanted to make sure all users of my program will not experience any problems that I haven't seen.

VISUAL BASIC 6.0 CODE ("123456789012" is where my access key is):

If FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then

MsgBox "FSUIPC Freeware Key was not successfully written"

FSUIPC_Close

FSUIPC_Open = False

Exit Function

End If

LINE FROM FSUIPC.1.LOG:

3864547 WRITE0 (failed, read-only!) 8F8001, 12 bytes: 4D 58 4B 56 49 4F 4C 32 4F 35 4C 53

Thanks for reading post and any feedback is welcomed!

John McCormack

Active AirSource

(http://www.air-source.us)

Application Developer

Link to comment
Share on other sites

If FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then

3864547 WRITE0 (failed, read-only!) 8F8001, 12 bytes: 4D 58 4B 56 49 4F 4C 32 4F 35 4C 53

Odd that most all the programming queries come from VB programmers. Is it just because there are more, or is VB really as bad a language as it seems from my point of view?

As far as I understand it, &H8001 when used in a 32-bit variable situation will be sign-extended, coming over as FFFF8001, NOT 00008001!

FSUIPC uses a lot of those high bits as flags for one thing or another (see the AWI for instance), and the only sense it can make is the offset 8F8001, which, I think is actually a way of getting to someplace somewhere in one of FS's modules.

I don't know VB, and I really don't want to know VB as it seems astonishingly bad from where I sit, but I am informed that appending a '&' character stops a sign extension, so "&H8001&" should work. I would also think that &H00008001 should work, and also the decimal 32769. But don't take my word for any of this, go look it up in your VB books please.

Regards,

Pete

Link to comment
Share on other sites

you may want to change the line

If FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then

to

If FSUIPC_WriteS(&H8001, 13, "123456789012" & chr(0), dwResult) = False Then

Link to comment
Share on other sites

you may want to change the line

If FSUIPC_WriteS(&H8001, 12, "123456789012", dwResult) = False Then

to

If FSUIPC_WriteS(&H8001, 13, "123456789012" & chr(0), dwResult) = False Then

Hey John, wasn't it you that told be the &H8001 had to be &H8001&, according to some VB book?

On the "chr(0) part, doesn't VB have strings ending with a zero? If not, if they are like the original MSBasic of old pre-war PCs (), isn't there a length byte at the beginning that needs deleting somehow?

Pete

Link to comment
Share on other sites

yep, it was me :-)

here is my code that i use, and it works :-)

sstring = "ABCD1234WXYZ" & Chr(0)

Call FSUIPC_WriteS(&H8001&, Len(sstring), sstring, dwResult) '

Call FSUIPC_Process(dwResult)

Link to comment
Share on other sites

Thanks I will use what works! This is my first week programming using FSUIPC, so I am stumbling a bit at the moment. But, hopefully I will be able to get use to it enough where I can proceed without havings so many elementary questions.

Thanks again!

John McCormack

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.