mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
agent.c: Fix Unicode builds on Windows (#417)
File: agent.c Notes: Fixes unicode builds for Windows in Visual Studio 16.3.2. Credit: Zenju
This commit is contained in:
@@ -274,7 +274,7 @@ static int
|
|||||||
agent_connect_pageant(LIBSSH2_AGENT *agent)
|
agent_connect_pageant(LIBSSH2_AGENT *agent)
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
hwnd = FindWindow("Pageant", "Pageant");
|
hwnd = FindWindowA("Pageant", "Pageant");
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
|
return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
|
||||||
"failed connecting agent");
|
"failed connecting agent");
|
||||||
@@ -297,14 +297,14 @@ agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
|
|||||||
return _libssh2_error(agent->session, LIBSSH2_ERROR_INVAL,
|
return _libssh2_error(agent->session, LIBSSH2_ERROR_INVAL,
|
||||||
"illegal input");
|
"illegal input");
|
||||||
|
|
||||||
hwnd = FindWindow("Pageant", "Pageant");
|
hwnd = FindWindowA("Pageant", "Pageant");
|
||||||
if(!hwnd)
|
if(!hwnd)
|
||||||
return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
|
return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
|
||||||
"found no pageant");
|
"found no pageant");
|
||||||
|
|
||||||
snprintf(mapname, sizeof(mapname),
|
snprintf(mapname, sizeof(mapname),
|
||||||
"PageantRequest%08x%c", (unsigned)GetCurrentThreadId(), '\0');
|
"PageantRequest%08x%c", (unsigned)GetCurrentThreadId(), '\0');
|
||||||
filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
|
filemap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
|
||||||
0, PAGEANT_MAX_MSGLEN, mapname);
|
0, PAGEANT_MAX_MSGLEN, mapname);
|
||||||
|
|
||||||
if(filemap == NULL || filemap == INVALID_HANDLE_VALUE)
|
if(filemap == NULL || filemap == INVALID_HANDLE_VALUE)
|
||||||
|
|||||||
Reference in New Issue
Block a user