Valhalla Legends Forums Archive | Battle.net Bot Development | Question regarding the BinaryChat plugin API

AuthorMessageTime
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?
February 15, 2005, 9:27 AM
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).
February 15, 2005, 4:51 PM
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.
February 15, 2005, 6:41 PM
Myndfyr
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.
February 15, 2005, 9:09 PM
tA-Kane
Here is the function definition:
[code]BOOL QueryConfigurationSetting(BinaryChatAPI::ConfigurationSetting Setting,
  char* Profile, void* Buffer, DWORD* BufferLength)[/code]

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()).
February 16, 2005, 5:46 AM
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:

[code]
// 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
[/code]

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 :)
February 16, 2005, 5:56 AM
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().
February 16, 2005, 7:09 AM
UserLoser.
I'd assume the following:

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

QueryConfigurationSetting(Setup_Username, "MyProfile", &Buffer, &BufferSize);
[/code]

Anyways, I hope you're not trying to grab a configuration value on SphtBotv3 by using QueryConfigurationSetting()
February 16, 2005, 7:45 PM
tA-Kane
Hmm?
February 16, 2005, 11:37 PM

Search