i have source code like this one
namespace TrialCheck
{
class Program
{
static void Main(string[] args)
{
string[] urls = new string[] { "http://localhost:9900" };
if (File.Exists("urls.txt"))
urls = File.ReadAllLines("urls.txt");
var webHost = new WebHostBuilder()
.UseKestrel()
.UseUrls(urls)
.UseStartup<Program>()
.Build();
webHost.Run();
}
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(LogLevel.Information);
app.UseMvc();
}
}
}
namespace TrialCheck
{
public class Trial : Controller
{
[Route("ping")]
[HttpGet]
public IActionResult Ping()
{
Response.Headers.Add("Access-Control-Allow-Origin", "*");
return Ok(DateTime.Now.ToString());
}
[Route("loginid")]
[HttpPost]
public IActionResult LoginId()
{
try
{
string str = new StreamReader(Request.Body).ReadToEnd();
byte[] bytes = Convert.FromBase64String(str);
string res = TradingAPI.MT4Server.LoginId.Decode(bytes, 0).ToString();
Console.Write(".");
return Ok(res);
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex.Message);
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White;
return new NoContentResult();
}
}
}
}
this code run well. and here when the loginId.cpp
namespace TradingAPI
{
namespace MT4Server
{
public ref class LoginId
{
public:
static ULONGLONG Decode(array<Byte>^ data, int arg8)
{
pin_ptr<Byte> pData = &data[0];
vLoginId login;
return login.Decode((ULONGLONG*)pData, data->Length / 8, arg8);
}
};
}
}
and here for ulonglong we call vloginid.cpp
extern "C" ULONGLONG _aullrem(ULONGLONG a, ULONGLONG b);
int main(int, char**)
{
return 0;
}
ULONGLONG t00D62EC8[64] = {
0x145C311F09F7FC13, 0x35527CFB98BC2B31, 0x5648C8D827805A4F, 0x773F14B4B644896D,
0x183560914508B88A, 0x392BAC6DD3CCE7A8, 0x5A21F84A629116C6, 0x7B184426F15545E4,
0x1C0E900380197503, 0x3D04DBE00EDDA421, 0x5DFB27BC9DA1D33F, 0x7EF173992C66025D,
0x1FE7BF75BB2A317A, 0x40DE0B5249EE6098, 0x61D4572ED8B28FB6, 0x02CAA30B6776BED5,
0x23C0EEE7F63AEDF3, 0x44B73AC484FF1D11, 0x65AD86A113C34C2F, 0x06A3D27DA2877B4C,
0x279A1E5A314BAA6A, 0x48906A36C00FD988, 0x6986B6134ED408A6, 0x0A7D01EFDD9837C5,
0x2B734DCC6C5C66E3, 0x4C6999A8FB209601, 0x6D5FE58589E4C51F, 0x0E56316218A8F43C,
0x2F4C7D3EA76D235A, 0x5042C91B36315278, 0x713914F7C4F58196, 0x122F60D453B9B0B5,
0x3325ACB0E27DDFD3, 0x541BF88D71420EF1, 0x7512446A00063E0F, 0x160890468ECA6D2C,
0x36FEDC231D8E9C4A, 0x57F527FFAC52CB68, 0x78EB73DC3B16FA86, 0x19E1BFB8C9DB29A5,
0x3AD80B95589F58C3, 0x5BCE5771E76387E1, 0x7CC4A34E7627B6FF, 0x1DBAEF2B04EBE61C,
0x3EB13B0793B0153A, 0x5FA786E422744458, 0x009DD2C0B1387377, 0x21941E9D3FFCA295,
0x428A6A79CEC0D1B3, 0x6380B6565D8500D1, 0x04770232EC492FEE, 0x256D4E0F7B0D5F0C,
0x466399EC09D18E2A, 0x6759E5C89895BD48, 0x085031A52759EC67, 0x29467D81B61E1B85,
0x4A3CC95E44E24AA3, 0x6B33153AD3A679C1, 0x0C296117626AA8DE, 0x2D1FACF3F12ED7FC,
0x4E15F8D07FF3071A, 0x6F0C44AD0EB73638, 0x100290899D7B6557, 0x30F8DC662C3F9475 };
ULONGLONG t00D630C8[64] = {
0x145C311F09F7FC12, 0x35527CFB98BC2B33, 0x5648C8D827805A4B, 0x773F14B4B6448965,
0x183560914508B89A, 0x392BAC6DD3CCE788, 0x5A21F84A62911686, 0x7B184426F1554564,
0x1C0E900380197403, 0x3D04DBE00EDDA621, 0x5DFB27BC9DA1D73F, 0x7EF173992C660A5D,
0x1FE7BF75BB2A217A, 0x40DE0B5249EE4098, 0x61D4572ED8B2CFB6, 0x02CAA30B67763ED5,
0x23C0EEE7F63BEDF3, 0x44B73AC484FD1D11, 0x65AD86A113C74C2F, 0x06A3D27DA28F7B4C,
0x279A1E5A315BAA6A, 0x48906A36C02FD988, 0x6986B6134E9408A6, 0x0A7D01EFDD1837C5,
0x2B734DCC6D5C66E3, 0x4C6999A8F9209601, 0x6D5FE5858DE4C51F, 0x0E56316210A8F43C,
0x2F4C7D3EB76D235A, 0x5042C91B16315278, 0x713914F784F58196, 0x122F60D4D3B9B0B5,
0x3325ACB1E27DDFD3, 0x541BF88F71420EF1, 0x7512446E00063E0F, 0x1608904E8ECA6D2C,
0x36FEDC331D8E9C4A, 0x57F527DFAC52CB68, 0x78EB739C3B16FA86, 0x19E1BF38C9DB29A5,
0x3AD80A95589F58C3, 0x5BCE5571E76387E1, 0x7CC4A74E7627B6FF, 0x1DBAE72B04EBE61C,
0x3EB12B0793B0153A, 0x5FA7A6E422744458, 0x009D92C0B1387377, 0x21949E9D3FFCA295,
0x428B6A79CEC0D1B3, 0x6382B6565D8500D1, 0x04730232EC492FEE, 0x25654E0F7B0D5F0C,
0x467399EC09D18E2A, 0x6779E5C89895BD48, 0x081031A52759EC67, 0x29C67D81B61E1B85,
0x4B3CC95E44E24AA3, 0x6933153AD3A679C1, 0x08296117626AA8DE, 0x251FACF3F12ED7FC,
0x5E15F8D07FF3071A, 0x4F0C44AD0EB73638, 0x500290899D7B6557, 0xB0F8DC662C3F9475 };
ULONGLONG d00D632C8 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D632D0 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D632D8 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D632E0 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D632E8 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D632F0 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D632F8 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63300 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63308 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63310 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63318 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63320 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63328 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63330 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63338 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63340 = 0xFFFFFFFFFFFFFFFF;
ULONGLONG d00D63348 = 0xFFFFFFFFFFFFFFFF;
//-------------------------------------------------------------------------------
//+401000 c
vLoginId::vLoginId()
{
s0 = 0;
s8 = 0;
s10 = 0;
s18 = 0;
}
//+401040 c
ULONGLONG vLoginId::Decode(ULONGLONG* pData, size_t szData, int arg8)
{
__asm
{
sub esp, 0x000001C0
mov ebx, ecx
mov ecx, dword ptr ss:[ebp + 8] //ecx = pData
test ecx, ecx
je l0130767D
mov dword ptr ss:[esp + 0x00000034], 0
mov dword ptr ss:[esp + 0x00000030], 0
mov eax, dword ptr [ecx]
mov ecx, dword ptr [ecx + 4]
mov dword ptr ss:[esp + 0x0000002C], ecx
mov dword ptr ss:[esp + 0x00000028], eax
mov eax, dword ptr ss:[esp + 0x00000028]
mov ecx, dword ptr ss:[esp + 0x0000002C]
i have build the class program as program.exe and it can be running well. but when i hit using my java code
if (hdr.PackType == 9)
{
LoginIdWebServer lid = new LoginIdWebServer();
//LoginIdWebServer2 lid2 = new LoginIdWebServer2();
_LoginId = 0;
for (int i = 0; i < QC.LoginIdWebServerUrls.size(); i++) {
try
{// ini gue ubah
//_LoginId ^= ((long)_Account << 32) + _Session;
//throw new RuntimeException("Cannot recieve LoginID + Unreachable Ip" + QC.LoginIdWebServerUrls.get(i)+pack +QC.LoginIdWebServerTimeout+QC.Log);
_LoginId = lid.Decode(QC.LoginIdWebServerUrls.get(i), pack, QC.LoginIdWebServerTimeout, QC.Log);
if(_LoginId != 0) {
//// //throw new RuntimeException("Cannot recieve LoginID + Unreachable Ip" + _LoginId );
QC.LoginIdWebServerUrlInd = i;
break;
}
}catch(Exception e)
{
e.toString();
}
}
if(_LoginId == 0)
throw new RuntimeException("Cannot recieve LoginID + Unreachable Ip" + pack+"pack");
//_LoginId ^= ((long)_Account << 32) + _Session;
//_LoginId ^= 0x05286AED3286692AL;
//LoginIdPow = lid.PowId;
// _LoginId ^= ((long)_Account << 32) + _Session;
//// _LoginId ^= 0x05286AED3286692AL;
}
}
i cannot get the response from my loginwebserver here when i want to get the response
_LoginId = lid.Decode(QC.LoginIdWebServerUrls.get(i), pack, QC.LoginIdWebServerTimeout, QC.Log);
Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke failed: [[o:QuoteClient]]->Connect. Cause: online.mtapi.mt4.Exception.ConnectException: java.lang.RuntimeException: Cannot recieve LoginID + Unreachable Ip[B@4390a022pack VM: 1.8.0_261@http://java.oracle.com/" at: #-14 online.mtapi.mt4.QuoteConnector.connect(QuoteConnector.java:96) #-13 online.mtapi.mt4.QuoteClient.Connect(QuoteClient.java:665) #-12 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
i cannot get the response well. so my code call this loginId=0 why like that ?
i also have built my loginId.cpp as loginId.dll.
here when i run my loginWebserver.exe from program.cs it is run well
User contributions licensed under CC BY-SA 3.0