Exemplo n.º 1
0
// WinMain function
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
{
	INSTANCE *instance;
	is_debug = false;
	MayaquaMinimalMode();
	InitMayaqua(false, is_debug, 0, NULL);
	InitCedar();
	ViSetSkip();
	ViLoadStringTables();
	InitWinUi(_U(IDS_TITLE+skip), _A(IDS_FONT+skip), ToInt(_A(IDS_FONT_SIZE+skip)));
	instance = NewSingleInstance(VI_INSTANCE_NAME);
	if (instance == NULL)
	{
		MsgBox(NULL, MB_ICONINFORMATION, _U(IDS_INSTANCE_EXISTS+skip));
	}
	else
	{
		ViMain();
		FreeSingleInstance(instance);
		if (sleep_before_exit)
		{
			SleepThread(60 * 1000);
		}
	}
	FreeWinUi();
	ViFreeStringTables();
	FreeCedar();
	FreeMayaqua();
	return 0;
}
Exemplo n.º 2
0
void upgradevlan(UINT num, char **arg)
{
	bool ok;
	KAKUSHI *k = NULL;
	MS_DRIVER_VER ver;
	if (num < 1)
	{
		return;
	}

	InitWinUi(L"VPN", _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE"));

	if (MsIsNt())
	{
		k = InitKakushi();
	}

	CiInitDriverVerStruct(&ver);

	ok = MsUpgradeVLan(VLAN_ADAPTER_NAME_TAG, VLAN_CONNECTION_NAME, arg[0], &ver);

	FreeKakushi(k);

	FreeWinUi();

	if (ok == false)
	{
		_exit(1);
	}
	else
	{
		_exit(0);
	}
}
Exemplo n.º 3
0
// Initialize
void InitNM()
{
	if (nm != NULL)
	{
		// Already initialized
		return;
	}

	nm = ZeroMalloc(sizeof(NM));

	InitWinUi(_UU("NM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE"));

	nm->Cedar = NewCedar(NULL, NULL);

	InitCM(false);
	InitSM();
}
Exemplo n.º 4
0
// Start the EtherLogger Manager
void EMExec()
{
	char *host;
	char *ret;
	bool cancel_now = false;
	TOKEN_LIST *t;
	UINT port = EL_ADMIN_PORT;
	InitWinUi(_UU("EM_TITLE"), _SS("DEFAULT_FONT"), _II("DEFAULT_FONT_SIZE"));

	while (true)
	{
		ret = EmRemoteDlg();

		if (ret != NULL)
		{
			t = ParseToken(ret, ":");
			if (t->NumTokens == 1 || t->NumTokens == 2)
			{
				RPC *rpc = NULL;
				bool ok = false;
				UINT ret;
				host = t->Token[0];
				if (t->NumTokens == 2)
				{
					port = ToInt(t->Token[1]);
				}
				else
				{
					port = EL_ADMIN_PORT;
				}

				// Try without a password first
				ret = EcConnect(host, port, "", &rpc);
RETRY:
				if (ret != ERR_NO_ERROR && ret != ERR_AUTH_FAILED)
				{
					// Connection failed
					CALL(NULL, ret);
				}
				else
				{
					if (ret == ERR_NO_ERROR)
					{
						// Successful connection
						ok = true;
					}
					else
					{
						// Password required
						char *pass = SmPassword(NULL, host);
						if (pass == NULL)
						{
							// Cancel
							cancel_now = true;
						}
						else
						{
							// Retry
							ret = EcConnect(host, port, pass, &rpc);
							Free(pass);
							if (ret == ERR_NO_ERROR)
							{
								ok = true;
							}
							else
							{
								goto RETRY;
							}
						}
					}
				}

				if (ok)
				{
					// Main screen
					EMMain(rpc);

					// Disconnect
					EcDisconnect(rpc);
					cancel_now = true;
				}
				FreeToken(t);
			}
			Free(ret);
		}
		else
		{
			cancel_now = true;
		}

		if (cancel_now)
		{
			break;
		}
	}

	FreeWinUi();
}