• Welcome to Valhalla Legends Archive.
 

Question regarding the BinaryChat plugin API

Started by tA-Kane, February 15, 2005, 03:27 AM

Previous topic - Next topic

tA-Kane

I have a question regarding the BinaryChat plugin API, directed at anyone who's knowledgable in that area. I have not found any documentation on the API, except the few comments that's written in the API's headers.

My plugin needs to find out the home channel of the connection, and I'm goign to assume that I need to use API.QueryConfigurationSetting(), however, I am oblivious as to what I need to pass for the Profile parameter, and it seems that the API call returns FALSE and Buffer is unmodified without valid data passed to it (eg, I can't just pass NULL).

Could someone help me please?
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Mephisto

You may find what you're looking for here.  But I suspect that's where you got your original information (though it provides example plugins which you may be able to learn from).

tA-Kane

I did indeed get things from there, and I am actually building off of EmptyPlugin. Nothing else in there, except maybe BCP.h contains anything helpful... BCP.h appears to be a newer header than what I'm using, but even if it is, I would also need the other headers that go with it.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

MyndFyre

Just a thought....  Take it for what you will, as it's not based on looking at the API.

If you're passing a NULL pointer, the actual value of the pointer is 0.  The API can't dereference a NULL pointer, and so it can't store a value in the buffer.  In order to get a returned pointer value in the buffer, you would actually need to pass a double pointer, i.e., a pointer to a pointer.

I think that you probably need to initialize the buffer before you pass it in as a parameter.
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.

tA-Kane

Here is the function definition:
BOOL QueryConfigurationSetting(BinaryChatAPI::ConfigurationSetting Setting,
   char* Profile, void* Buffer, DWORD* BufferLength)


I'm assuming that I need to pass a valid void pointer to Buffer, whose length is specified in BufferLength. On success, the value I need is set to Buffer and the length of the value is set to BufferLength.

However, I have an idea as to what Profile is used for (multiple bot/connection instances), but I'm not sure where to get the data for it.

I tried passing a non-null value as Profile, and the function still returned FALSE. I then tried setting it to the name of the bot, and it's still returning FALSE.

In addition, I've verified that SphtBotv3 actually supports QueryConfigurationSetting(), because m_QueryConfigurationSetting is non-null at the time of trying to call it (QueryConfigurationSetting() checks to see if m_QueryConfigurationSetting is NULL... if it is, it returns -1, else it returns the result of forwarding the parameters on to m_QueryConfigurationSetting()).
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

UserLoser.

Note that this will always fail unless you're using BinaryChat since it grabs the address of the function from the running BinaryChat.exe:


// Version functions
#if BINARYCHATAPI_ENABLED
HINSTANCE BinaryChat;

if(BinaryChat = GetModuleHandle("BinaryChat.exe")) {
(FARPROC&)API.m_GetBotVersion = GetProcAddress(BinaryChat, "GetBotVersion");
(FARPROC&)API.m_GetBotVersionEx = GetProcAddress(BinaryChat, "GetBotVersionEx");
(FARPROC&)API.m_QueryConfigurationSetting = GetProcAddress(BinaryChat, "QueryConfigurationSetting");
}
#endif


SphtBotv3.exe was written in VB6, which doesn't support any function exports unless you 'hack' it when linking.  And besides, SphtBotv3.exe has no exports anyways :)

tA-Kane

That code is already in PluginMain.cpp, and it seems GetModuleHandle does return successfully, and even more importantly, GetProcAddress(BinaryChat, "QueryConfigurationSetting") also returns successfully. I'm indeed using SphtBotv3. So with that in mind, why is it able to find the module BinaryChat.exe, and why is it able to find QueryConfigurationSetting?


Event with all of this, it's only a side-note. I need information on how to use QueryConfigurationSetting(), not how to get the address of QueryConfigurationSetting().
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

UserLoser.

#7
I'd assume the following:


DWORD BufferSize = 128;
unsigned char Buffer[128];

QueryConfigurationSetting(Setup_Username, "MyProfile", &Buffer, &BufferSize);


Anyways, I hope you're not trying to grab a configuration value on SphtBotv3 by using QueryConfigurationSetting()

tA-Kane

Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com