添加对urlprotocol参数判断

添加对urlprotocol参数判断
pull/124/head
horizonlin 2018-12-11 14:12:41 +08:00 committed by GitHub
parent 7fa5c8936b
commit a7619aab29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 2 deletions

View File

@ -85,8 +85,9 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmd
if (0 == g_ulSingleInstanceMsgId) if (0 == g_ulSingleInstanceMsgId)
return FALSE; return FALSE;
LPWSTR szCmdLine = (LPWSTR)::GetCommandLineW(); //获取命令行参数; LPWSTR szCmdLine = (LPWSTR)::GetCommandLineW(); //获取命令行参数;
g_argv = CommandLineToArgvW(szCmdLine, &g_argc); //拆分命令行参数字符串; g_argv = CommandLineToArgvW(szCmdLine, &g_argc); //拆分命令行参数字符串;
std::wstring arg;
for (int i = 0; i < g_argc; ++i) for (int i = 0; i < g_argc; ++i)
{ {
@ -96,6 +97,23 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmd
LocalFree(g_argv); LocalFree(g_argv);
g_argv = NULL; g_argv = NULL;
return -1; return -1;
}else if (arg.find(L"teleport_ip",0) !=std::wstring::npos && arg.find(L"teleport_port") != std::wstring::npos && arg.find(L"remote_host_ip") != std::wstring::npos && arg.find(L"session_id") != std::wstring::npos) {
//把wchar_t **转换为std::string
size_t len = wcslen(g_argv[i]) + 1;
size_t converted = 0;
char *CStr;
CStr = (char*)malloc(len * sizeof(char));
wcstombs_s(&converted, CStr, len, g_argv[i], _TRUNCATE);
std::string func_args = CStr;
TsHttpRpc ts_http_rpc;
ex_astr buf;
ts_http_rpc._rpc_func_url_protocol(func_args, buf);
free(CStr);
LocalFree(g_argv);
g_argv = NULL;
return 0;
} }
} }