ret = malloc(retlen);
ret = smalloc(retlen);
void agent_query(void *in, int inlen, void **out, int *outlen) {    HWND hwnd;    char mapname[64];    HANDLE filemap;    unsigned char *p, *ret;    int id, retlen;    COPYDATASTRUCT cds;    *out = NULL;    *outlen = 0;    hwnd = FindWindow("Pageant", "Pageant");    debug(("hwnd is %p\n", hwnd));    if (!hwnd)        return;    sprintf(mapname, "PageantRequest%08x", GetCurrentThreadId());    filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,                                0, AGENT_MAX_MSGLEN, mapname);    if (!filemap)        return;    p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);    memcpy(p, in, inlen);    cds.dwData = AGENT_COPYDATA_ID;    cds.cbData = 1+strlen(mapname);    cds.lpData = mapname;    id = SendMessage(hwnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds);    debug(("return is %d\n", id));    if (id > 0) {        retlen = 4 + GET_32BIT(p);        debug(("len is %d\n", retlen));        ret = malloc(retlen);        if (ret) {            memcpy(ret, p, retlen);            *out = ret;            *outlen = retlen;        }    }    UnmapViewOfFile(p);    CloseHandle(filemap);}