pull/32/head
Apex Liu 2017-04-07 15:05:29 +08:00
parent 8777543985
commit 4ee850c83e
7 changed files with 1490 additions and 1480 deletions

View File

@ -25,6 +25,10 @@ class BuilderWin(BuilderBase):
def build_server(self): def build_server(self):
cc.n('build web server ...') cc.n('build web server ...')
# notice: now we can not build debug version of tp_web.exe
if ctx.target_path == 'debug':
cc.w('cannot build debug version of tp_web, skip.')
else:
sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src', 'tp_web.vs2015.sln') sln_file = os.path.join(env.root_path, 'server', 'tp_web', 'src', 'tp_web.vs2015.sln')
out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_web.exe') out_file = os.path.join(env.root_path, 'out', 'server', ctx.bits_path, ctx.target_path, 'tp_web.exe')
if os.path.exists(out_file): if os.path.exists(out_file):

View File

@ -46,8 +46,8 @@
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>..\..\out\client\$(PlatformTarget)\$(Configuration)\</OutDir> <OutDir>..\..\out\client\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir> <IntDir>..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir>
<IncludePath>D:\apps\vld\include;$(IncludePath)</IncludePath> <IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\apps\vld\lib\Win32;$(LibraryPath)</LibraryPath> <LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>

View File

@ -44,8 +44,12 @@ End Sub
ubuntuLinuxSecureCRT ubuntuLinuxSecureCRT
*/ */
#define RDP_CLIENT_SYSTEM_BUILTIN
// #define RDP_CLIENT_SYSTEM_ACTIVE_CONTROL
// #define RDP_CLIENT_FREERDP
#if 0
#ifdef RDP_CLIENT_SYSTEM_BUILTIN
std::string rdp_content = "\ std::string rdp_content = "\
connect to console:i:%d\n\ connect to console:i:%d\n\
screen mode id:i:%d\n\ screen mode id:i:%d\n\
@ -64,7 +68,7 @@ audiocapturemode:i:0\n\
negotiate security layer:i:1\n\ negotiate security layer:i:1\n\
videoplaybackmode:i:1\n\ videoplaybackmode:i:1\n\
connection type:i:2\n\ connection type:i:2\n\
prompt for credentials on client:i:1\r\n\ prompt for credentials on client:i:1\n\
displayconnectionbar:i:1\n\ displayconnectionbar:i:1\n\
disable wallpaper:i:1\n\ disable wallpaper:i:1\n\
allow font smoothing:i:0\n\ allow font smoothing:i:0\n\
@ -116,7 +120,6 @@ void http_rpc_stop(void)
g_http_interface.stop(); g_http_interface.stop();
} }
#define HEXTOI(x) (isdigit(x) ? x - '0' : x - 'W') #define HEXTOI(x) (isdigit(x) ? x - '0' : x - 'W')
int ts_url_decode(const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded) int ts_url_decode(const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded)
@ -582,9 +585,9 @@ void TsHttpRpc::_rpc_func_create_ts_client(const ex_astr& func_args, ex_astr& bu
//============================================== //==============================================
// RDP // RDP
//============================================== //==============================================
#if 1 //#if 1
#if 0 #if defined(RDP_CLIENT_SYSTEM_ACTIVE_CONTROL)
int split_pos = session_id.length() - 2; int split_pos = session_id.length() - 2;
std::string real_s_id = session_id.substr(0, split_pos); std::string real_s_id = session_id.substr(0, split_pos);
std::string str_pwd_len = session_id.substr(split_pos, session_id.length()); std::string str_pwd_len = session_id.substr(split_pos, session_id.length());
@ -624,7 +627,7 @@ void TsHttpRpc::_rpc_func_create_ts_client(const ex_astr& func_args, ex_astr& bu
w_exe_path += w_szCommandLine; w_exe_path += w_szCommandLine;
//BOOL bRet = DeleteFile(w_sz_file_name.c_str()); //BOOL bRet = DeleteFile(w_sz_file_name.c_str());
#else #elif defined(RDP_CLIENT_FREERDP)
wchar_t* w_screen = NULL; wchar_t* w_screen = NULL;
switch (windows_size) switch (windows_size)
@ -677,9 +680,9 @@ void TsHttpRpc::_rpc_func_create_ts_client(const ex_astr& func_args, ex_astr& bu
w_exe_path += w_szCommandLine; w_exe_path += w_szCommandLine;
#endif //#endif
#else #elif defined(RDP_CLIENT_SYSTEM_BUILTIN)
int width = 800; int width = 800;
int higth = 600; int higth = 600;
int cx = 0; int cx = 0;
@ -755,29 +758,32 @@ void TsHttpRpc::_rpc_func_create_ts_client(const ex_astr& func_args, ex_astr& bu
if (ret <= 0) if (ret <= 0)
{ {
printf("fopen failed (%d).\n", GetLastError()); printf("fopen failed (%d).\n", GetLastError());
_create_json_ret(buf, TSR_GETTEMPPATH_ERROR); _create_json_ret(buf, TPE_FAILED);
return; return;
} }
ex_wstr w_s_id; ex_wstr w_s_id;
ex_astr2str(real_sid, w_s_id); ex_astr2wstr(real_sid, w_s_id);
ex_astr temp_host_ip = replace_all_distinct(real_host_ip, ("."), "-"); ex_astr temp_host_ip = real_host_ip;// replace_all_distinct(real_host_ip, ("."), "-");
ex_replace_all(temp_host_ip, ".", "-");
sprintf_s(sz_file_name, ("%s\\%s.rdp"), temp_path, temp_host_ip.c_str()); sprintf_s(sz_file_name, ("%s%s.rdp"), temp_path, temp_host_ip.c_str());
FILE* f = fopen(sz_file_name, ("wt")); //FILE* f = fopen(sz_file_name, ("wt"));
if (f == NULL) //if (f == NULL)
FILE* f = NULL;
if(fopen_s(&f, sz_file_name, "wt") != 0)
{ {
printf("fopen failed (%d).\n", GetLastError()); printf("fopen failed (%d).\n", GetLastError());
_create_json_ret(buf, TSR_OPENFILE_ERROR); _create_json_ret(buf, TPE_OPENFILE);
return; return;
} }
// Write a string into the file. // Write a string into the file.
fwrite(sz_rdp_file_content, strlen(sz_rdp_file_content), 1, f); fwrite(sz_rdp_file_content, strlen(sz_rdp_file_content), 1, f);
fclose(f); fclose(f);
ex_wstr w_sz_file_name; ex_wstr w_sz_file_name;
ex_astr2str(sz_file_name, w_sz_file_name); ex_astr2wstr(sz_file_name, w_sz_file_name);
swprintf_s(w_szCommandLine, _T("mstsc %s"), w_sz_file_name.c_str()); swprintf_s(w_szCommandLine, _T("mstsc \"%s\""), w_sz_file_name.c_str());
w_exe_path = w_szCommandLine; w_exe_path = w_szCommandLine;
//BOOL bRet = DeleteFile(w_sz_file_name.c_str()); //BOOL bRet = DeleteFile(w_sz_file_name.c_str());
#endif #endif

View File

@ -35,7 +35,7 @@
// #define TPE_OPENFILE_ERROR 0x1007 // 无法打开文件 // #define TPE_OPENFILE_ERROR 0x1007 // 无法打开文件
// #define TPE_GETTEMPPATH_ERROR 0x1007 // #define TPE_GETTEMPPATH_ERROR 0x1007
#define TPE_OPENFILE 300
//------------------------------------------------------- //-------------------------------------------------------
// 助手程序专用错误值 // 助手程序专用错误值

View File

@ -3,18 +3,18 @@
//#include "ts_types.h" //#include "ts_types.h"
// #define TS_RDP_PROXY_PORT 3389 #define TS_RDP_PROXY_PORT 3389
// #define TS_RDP_PROXY_HOST "0.0.0.0" #define TS_RDP_PROXY_HOST "0.0.0.0"
#define TS_SSH_PROXY_PORT 22 #define TS_SSH_PROXY_PORT 22
#define TS_SSH_PROXY_HOST "0.0.0.0" #define TS_SSH_PROXY_HOST "0.0.0.0"
//
// #define TS_TELNET_PROXY_PORT 23 #define TS_TELNET_PROXY_PORT 23
// #define TS_TELNET_PROXY_HOST "0.0.0.0" #define TS_TELNET_PROXY_HOST "0.0.0.0"
#define TS_HTTP_RPC_PORT 52080 #define TS_HTTP_RPC_PORT 52080
//#define TS_HTTP_RPC_HOST "127.0.0.1" #define TS_HTTP_RPC_HOST "127.0.0.1"
#define TS_HTTP_RPC_HOST "0.0.0.0" //#define TS_HTTP_RPC_HOST "0.0.0.0"
#define TS_RDP_PROTOCOL_RDP 0 #define TS_RDP_PROTOCOL_RDP 0

View File

@ -74,8 +74,8 @@
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<OutDir>..\..\..\out\server\$(PlatformTarget)\$(Configuration)\</OutDir> <OutDir>..\..\..\out\server\$(PlatformTarget)\$(Configuration)\</OutDir>
<IntDir>..\..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir> <IntDir>..\..\..\out\_tmp_\$(ProjectName)\$(PlatformTarget)\$(Configuration)\</IntDir>
<IncludePath>D:\apps\vld\include;$(IncludePath)</IncludePath> <IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
<LibraryPath>D:\apps\vld\lib\Win32;$(LibraryPath)</LibraryPath> <LibraryPath>C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>

View File

@ -32,7 +32,7 @@ class IndexHandler(TPBaseUserAuthHandler):
param['core'] = { param['core'] = {
'ssh_port': cfg.core.ssh.port, 'ssh_port': cfg.core.ssh.port,
'rdp_port': cfg.core.telnet.port, 'rdp_port': cfg.core.rdp.port,
'telnet_port': cfg.core.telnet.port 'telnet_port': cfg.core.telnet.port
} }