| 352 | int main(int argc, char * argv[]) { |
| 353 | #else |
| 354 | int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow){ |
| 355 | int argc; |
| 356 | char ** argv; |
| 357 | WNDCLASS wc; |
| 358 | HWND hwnd = 0; |
| 359 | #endif |
| 360 | |
| 361 | int res = 0; |
| 362 | FILE * fp = NULL; |
| 363 | |
| 364 | #ifdef _WIN32 |
| 365 | unsigned char * arg; |
| 366 | WSADATA wd; |
| 367 | unsigned char tmpbuf[8192]; |
| 368 | |
| 369 | WSAStartup(MAKEWORD( 1, 1 ), &wd); |
| 370 | osv.dwOSVersionInfoSize = sizeof(osv); |
| 371 | GetVersionEx(&osv); |
| 372 | #endif |
| 373 | |
| 374 | |
| 375 | #ifdef _WINCE |
| 376 | argc = ceparseargs((char *)lpCmdLine); |
| 377 | argv = ceargv; |
| 378 | if(FindWindow(L"3proxy", L"3proxy")) return 0; |
| 379 | ZeroMemory(&wc,sizeof(wc)); |
| 380 | wc.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH); |
| 381 | wc.hInstance=hInstance; |
| 382 | wc.hCursor=LoadCursor(NULL,IDC_ARROW); |
| 383 | wc.lpfnWndProc=DefWindowProc; |
| 384 | wc.style=CS_HREDRAW|CS_VREDRAW; |
| 385 | wc.lpszClassName=L"3proxy"; |
| 386 | RegisterClass(&wc); |
| 387 | |
| 388 | hwnd = CreateWindowEx(0,L"3proxy",L"3proxy",WS_VISIBLE|WS_POPUP,0,0,0,0,0,0,hInstance,0); |
| 389 | #endif |
| 390 | |
| 391 | conf.stringtable = strings; |
| 392 | #ifdef _WIN32 |
| 393 | #ifndef _WINCE |
| 394 | if((argc == 2 || argc == 3)&& !strcmp((char *)argv[1], "--install")) { |
| 395 | |
| 396 | sprintf((char *)tmpbuf, "%s will be installed and started.\n" |
| 397 | "By clicking Yes you confirm you read and accepted License Agreement.\n" |
| 398 | "You can use Administration/Services to control %s service.", |
| 399 | conf.stringtable[1], conf.stringtable[2]); |
| 400 | if(MessageBox(NULL, (LPCSTR)tmpbuf, (LPCSTR)conf.stringtable[2], MB_YESNO|MB_ICONASTERISK) != IDYES) return 1; |
| 401 | |
| 402 | |
| 403 | *tmpbuf = '\"'; |
| 404 | if (!(res = SearchPath(NULL, argv[0], ".exe", 256, (char *)tmpbuf+1, (LPTSTR*)&arg))) { |
| 405 | perror("Failed to find executable filename"); |
| 406 | RETURN(102); |
| 407 | } |
| 408 | strcat((char *)tmpbuf, "\" \""); |
| 409 | if(!(res = GetFullPathName ((argc == 3)?argv[2]:(char*)DEFAULTCONFIG, 256, (char *)tmpbuf+res+4, (char **)&arg))){ |
| 410 | perror("Failed to find config filename"); |
| 411 | RETURN(103); |
nothing calls this directly
no test coverage detected