diff --git a/config.c b/config.c index ddc9c10..d2ed0c3 100644 --- a/config.c +++ b/config.c @@ -27,6 +27,7 @@ int read_config(void) char buf[512], config_fname[MAX_PATH]; FILE *fp; unsigned int i; + unsigned int vallen; sprintf(config_fname, "C:\\%u.ini", GetCurrentProcessId()); @@ -53,10 +54,10 @@ int read_config(void) const char *key = buf, *value = p + 1; *p = 0; - + vallen = strlen(value); if(!strcmp(key, "pipe")) { - strncpy(g_config.pipe_name, value, - ARRAYSIZE(g_config.pipe_name)); + for (i = 0; i < vallen; i++) + g_config.pipe_name[i] = (wchar_t)(unsigned short)value[i]; } else if (!strcmp(key, "logserver")) { strncpy(g_config.logserver, value, diff --git a/config.h b/config.h index 902402c..cfab6e0 100644 --- a/config.h +++ b/config.h @@ -18,7 +18,7 @@ along with this program. If not, see . struct _g_config { // name of the pipe to communicate with cuckoo - char pipe_name[MAX_PATH]; + wchar_t pipe_name[MAX_PATH]; char logserver[MAX_PATH]; diff --git a/pipe.c b/pipe.c index 10b8a7e..b8bc709 100644 --- a/pipe.c +++ b/pipe.c @@ -187,7 +187,7 @@ int pipe(const char *fmt, ...) ret = 0; } #else - if (CallNamedPipe(g_config.pipe_name, buf, len, buf, len, + if (CallNamedPipeW(g_config.pipe_name, buf, len, buf, len, (unsigned long *)&len, NMPWAIT_WAIT_FOREVER) != 0) ret = 0; #endif @@ -213,7 +213,7 @@ int pipe2(void *out, int *outlen, const char *fmt, ...) _pipe_sprintf(buf, fmt, args); va_end(args); - if(CallNamedPipe(g_config.pipe_name, buf, len, out, *outlen, + if(CallNamedPipeW(g_config.pipe_name, buf, len, out, *outlen, (DWORD *) outlen, NMPWAIT_WAIT_FOREVER) != 0) ret = 0; free(buf);