foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions
component_installation_validatorabstract

#include <componentversion.h>

+ Inheritance diagram for component_installation_validator:

Public Member Functions

virtual bool is_installed_correctly ()=0
 
- Public Member Functions inherited from service_base
template<typename outPtr_t >
bool cast (outPtr_t &outPtr)
 
virtual int service_add_ref ()=0 throw ()
 
virtual bool service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid)
 
template<class T >
bool service_query_t (service_ptr_t< T > &p_out)
 
virtual int service_release ()=0 throw ()
 

Static Public Member Functions

static bool have_other_file (const char *fn)
 
static bool test_my_name (const char *fn)
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

Since
1.0 Allows components to cleanly abort app startup in case the installation appears to have become corrupted.

Definition at line 71 of file componentversion.h.

Member Function Documentation

bool component_installation_validator::have_other_file ( const char *  fn)
static

Definition at line 10 of file componentversion.cpp.

10  {
11  for(int retry = 0;;) {
13  path.truncate(path.scan_filename());
14  path << fn;
15  try {
16  try {
17  abort_callback_dummy aborter;
18  bool v = filesystem::g_exists(path, aborter);
19  PFC_ASSERT( v );
20  return v;
21  } catch(std::exception const & e) {
22  FB2K_console_formatter() << "Component integrity check error: " << e << " (on: " << fn << ")";
23  throw;
24  }
25  } catch(exception_io_denied) {
26  continue;
27  } catch(exception_io_sharing_violation) {
28  continue;
29  } catch(exception_io_file_corrupted) { // happens
30  return false;
31  } catch(...) {
32  uBugCheck();
33  }
34  if (++retry == 10) uBugCheck();
35  Sleep(100);
36  }
37 }
void truncate(t_size len)
Definition: string_base.h:390
abort_callback_impl abort_callback_dummy
const char * get_my_full_path()
Retrieves full path of calling dll, e.g. file://c:.dll.
t_size scan_filename() const
Definition: string_base.h:235
std::exception exception
Definition: primitives.h:193
PFC_NORETURN void SHARED_EXPORT uBugCheck()
virtual bool component_installation_validator::is_installed_correctly ( )
pure virtual
bool component_installation_validator::test_my_name ( const char *  fn)
static

Definition at line 3 of file componentversion.cpp.

3  {
4  const char * path = core_api::get_my_full_path();
5  path += pfc::scan_filename(path);
6  bool retVal = ( strcmp(path, fn) == 0 );
7  PFC_ASSERT( retVal );
8  return retVal;
9 }
const char * get_my_full_path()
Retrieves full path of calling dll, e.g. file://c:.dll.
t_size scan_filename(const char *ptr)

The documentation for this class was generated from the following files: