Beispiel #1
0
void SystemUtil::disableSystemProxy()
{
#ifdef __WIN32__
    int ret = RemoveConnectionProxy();
#endif
#ifdef __MAC__
    set_global_proxy(0, "", 1998);
#endif
}
Beispiel #2
0
//Main entry point.
int main(int argc, char* argv[])
{
	SAFE_ZERO(cbuffer, char, 2048);
	

	logger = new AlCLogger(L"fixproxy.log", true);

	sprintf_s(cbuffer, "FixProxySettings: arg count: ...%i\n\0", argc);
	logger->debug(cbuffer);

	char proxyAddress[256];
	char bypass[256];

	SAFE_ZERO(proxyAddress, char, 256);
	SAFE_ZERO(bypass, char, 256);

	if (argc > 0)
	{
		for (int i=0; i<argc; i++)
		{
			sprintf_s(cbuffer, "Arg #%i : '%s'\n\0", i, argv[i]);
			logger->debug(cbuffer);

			if (argv[i] != NULL)
			{
				if (strcmp(argv[i], "-remove") == 0)
				{
					logger->debug("arf!!\n\0");
					RemoveConnectionProxy();
					goto done;
				}

				if (strcmp(argv[i], "-proxy") == 0)
				{
					if (i+1 >= argc)
					{
						logger->debug("Proxy address not set.");
						goto done;
					}
					//copyCharToWChar(argv[i + 1], proxyAddress);
					strcpy(proxyAddress, argv[i+1]);
				}

				if (strcmp(argv[i], "-bypass") == 0)
				{
					if (i+1 >= argc)
					{
						logger->debug("Bypass addresses not set.");
						goto done;
					}
					//copyCharToWChar(argv[i + 1], bypass);
					strcpy(bypass, argv[i+1]);
				}

			} //if

		} //for
	} //if

	if (strlen(proxyAddress) > 0 && strlen(bypass) > 0)
	{
		SetConnectionProxy(proxyAddress, bypass);
	} //if

done:
	SAFE_DEL(logger);
	//system("PAUSE");
	return 0;

}