39 #define DBG_PROGNAME "OPENCBM.DLL"
46 #ifndef INVALID_FILE_ATTRIBUTES
47 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
51 #define FILENAME_CONFIGFILE "opencbm.conf"
54 get_environment(
const char * environment)
60 length = GetEnvironmentVariable(environment, NULL, 0);
67 buffer = malloc(length + 1);
69 length2 = GetEnvironmentVariable(environment, buffer, length + 1);
71 if (length2 > length) {
84 return get_environment(
"WINDIR");
90 return get_environment(
"USERPROFILE");
116 configuration_get_default_filename_candidate(
unsigned int index)
118 char * buffer = NULL;
122 case INDEX_DEFAULT_FILENAME_LOCAL :
126 case INDEX_DEFAULT_FILENAME_USERDIR :
128 char * userdir = get_userdir();
134 case INDEX_DEFAULT_FILENAME_WINDIR :
136 char * windir = get_windir();
152 FileExists(
const char * filename)
154 DWORD attrib = GetFileAttributes(filename);
174 configuration_get_default_filename_index(
const char ** pstring_candidate)
176 unsigned int index = 0;
177 *pstring_candidate = NULL;
179 while (NULL != (*pstring_candidate = configuration_get_default_filename_candidate(index)))
181 if (FileExists(*pstring_candidate)) {
189 return (*pstring_candidate == NULL) ? -1 : index;
202 char * string_candidate;
204 configuration_get_default_filename_index(&string_candidate);
206 return string_candidate;
226 return configuration_get_default_filename_candidate(DefaultLocation);
#define FILENAME_CONFIGFILE
The filename of the configuration file.
const char * configuration_get_default_filename_for_install(unsigned int DefaultLocation)
Get the default filename for the configuration file on installation.
char * cbmlibmisc_strdup(const char *const OldString)
Duplicate a given string.
Define makros for debugging purposes.
#define INVALID_FILE_ATTRIBUTES
Shared library / DLL for accessing the driver Read configuration file.
char * cbmlibmisc_strcat(const char *First, const char *Second)
Concatenate two strings.
Defining OpenCBM version.
const char * configuration_get_default_filename(void)
Get the default filename for the configuration file.
Some functions for string handling.