[PD-dev] Getting path of external
Thomas Mayer
thomas at residuum.org
Wed Apr 17 21:58:48 CEST 2013
Hi,
for PuREST JSON on Windows, I need a way to verify SSL signatures,
because currently this is not working. One way to accomplish that, is
setting the path to the certificate file. As I want to package the file
with the zip, I would like to store it in the same directory as the dll
for the externals.
I have two externals [rest] and [oauth] that share all the code for
libcurl, threading etc. (via a struct), so in the function where I need
to set the path to the certificate file, I need to get the path of the
dll to set the certificate store correctly.
Both classes are created by functions like:
rest_class = class_new(gensym("rest"), (t_newmethod)rest_new,
(t_method)rest_free, sizeof(t_rest), 0,
A_GIMME, 0);
and
t_rest *x = (t_rest *)pd_new(rest_class);
Now, I need a way to get the value "rest" from this *x, for this:
static void *ctw_exec_req(void *thread_args) {
struct _ctw *common = thread_args;
/* more declarations */
#ifdef _WIN32
/* Workaround for loading certificates on Windows */
char path[2048];
/* This will output the path to pd.exe */
GetModuleFileName(NULL, path, 2048);
post("dll path: %s", path);
/* This will output the path to rest.dll, how do I get "rest"
from *thread_args */
GetModuleFileName(GetModuleHandle("rest"), path, 2048);
post("dll path: %s", path);
#endif
/* all the rest to execute request via curl */
}
Thanks in advance,
Thomas
--
"As long as people kept worrying that the machines were taking over,
they wouldn't notice what was really happening. Which was that the
programmers were taking over." (Robert Anton Wilson - The Homing Pidgeons)
http://www.residuum.org/
More information about the Pd-dev
mailing list