Retrieving installed component's version
2010-02-01 07:35:52
Hi all, I'm trying to grab the version info of the components in foobar2000's component folder, but am a bit lost on exactly how to do it. foosion has provided some insight into how to do it in this thread :For future reference, this is how component DLLs are loaded: 1. The core loads the component DLL using LoadLibrary(). 2. The core retrieves a pointer to the foobar2000_get_interface() function and calls it to obtain a pointer to the DLL's foobar2000_client object. 3. After checking that the component's version is compatible with the core, the core calls foobar2000_client::get_service_list(). It also sets the component DLL's path and sets the stored configuration data (if any). So far I've got this, but am having problems compiling when foobar2000_client_impl is being used.typedef foobar2000_client* (__cdecl *MYPROC)(foobar2000_api* p_api, HINSTANCE hIns); HINSTANCE hinstLib; MYPROC fooProc; BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; hinstLib = LoadLibrary(TEXT("components\\foo_bpm.dll")); if (hinstLib != NULL) { fooProc= (MYPROC) GetProcAddress(hinstLib, "foobar2000_get_interface"); if (NULL != fooProc) { fRunTimeLinkSuccess = TRUE; console::formatter() << "Accessing foo_bpm.dll OK"; // I'm not sure what to pass into foobar2000_get_interface here // foobar2000_client_impl causes a compiler error, even though the foobar2000_component_client project is included in the solution foobar2000_client_impl client* = (foobar2000_client_impl) (MYPROC) (NULL, NULL); } fFreeResult = FreeLibrary(hinstLib); } if (!fRunTimeLinkSuccess) console::formatter() << "Failed to access foo_bpm.dll"; Can anyone guide me in the right direction? Also is it possible to access component versions through the foobar2000 core rather than me loading each dll at run time?