[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
get_default_conf_file under windows
Greetings.
You are currently using SHGetSpecialFolderPath to get the Application
Data directory under win32. This function is only available in
Windows versions that have the Internet Explorer 4+ integration
installed. It's causing tor not to load under older versions of
Windows such as NT 4.
Might I suggest that you change the get_default_conf_file() function
to something along the lines of this modified version below? It will
achieve the same result but uses functions available under all of the
win32 versions.
static char *get_default_conf_file(void)
{
#ifdef MS_WINDOWS
LPITEMIDLIST idl;
IMalloc *m;
HRESULT result;
char *path = tor_malloc(MAX_PATH);
if (!SUCCEEDED(SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA,
&idl))) {
tor_free(path);
return NULL;
}
result = SHGetPathFromIDList(idl, path);
SHGetMalloc(&m);
if (m) {
m->lpVtbl->Free(m, idl);
m->lpVtbl->Release(m);
}
if (!SUCCEEDED(result)) {
tor_free(path);
return NULL;
}
strlcat(path,"\\tor\\torrc",MAX_PATH);
return path;
#else
return tor_strdup(CONFDIR "/torrc");
#endif
}
--
J Doe