diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/win_updater/updater.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/win_updater/updater.cpp | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/linden/indra/win_updater/updater.cpp b/linden/indra/win_updater/updater.cpp index e41ab00..8f162ec 100644 --- a/linden/indra/win_updater/updater.cpp +++ b/linden/indra/win_updater/updater.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 5 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -26,13 +27,14 @@ | |||
26 | */ | 27 | */ |
27 | 28 | ||
28 | // | 29 | // |
29 | // Usage: updater -userserver <server> [-name <window_title>] [-program <program_name>] [-silent] | 30 | // Usage: updater -url <url> [-name <window_title>] [-program <program_name>] [-silent] |
30 | // | 31 | // |
31 | 32 | ||
32 | #include <windows.h> | 33 | #include <windows.h> |
33 | #include <wininet.h> | 34 | #include <wininet.h> |
34 | 35 | ||
35 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | #include <stdarg.h> | ||
36 | #include "llpreprocessor.h" | 38 | #include "llpreprocessor.h" |
37 | #include "llfile.h" | 39 | #include "llfile.h" |
38 | 40 | ||
@@ -41,7 +43,7 @@ | |||
41 | int gTotalBytesRead = 0; | 43 | int gTotalBytesRead = 0; |
42 | HWND gWindow = NULL; | 44 | HWND gWindow = NULL; |
43 | WCHAR gProgress[256]; | 45 | WCHAR gProgress[256]; |
44 | char* gUserServer; | 46 | char* gUpdateURL; |
45 | char* gProgramName; | 47 | char* gProgramName; |
46 | char* gProductName; | 48 | char* gProductName; |
47 | bool gIsSilent; | 49 | bool gIsSilent; |
@@ -272,28 +274,20 @@ LRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) | |||
272 | } | 274 | } |
273 | 275 | ||
274 | #define win_class_name L"FullScreen" | 276 | #define win_class_name L"FullScreen" |
275 | #define UPDATE_URIBASE L"http://secondlife.com/update.php?userserver=" | ||
276 | 277 | ||
277 | int parse_args(int argc, char **argv) | 278 | int parse_args(int argc, char **argv) |
278 | { | 279 | { |
279 | // Check for old-type arguments. | ||
280 | if (2 == argc) | ||
281 | { | ||
282 | gUserServer = argv[1]; | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | int j; | 280 | int j; |
287 | 281 | ||
288 | for (j = 1; j < argc; j++) | 282 | for (j = 1; j < argc; j++) |
289 | { | 283 | { |
290 | if ((!strcmp(argv[j], "-userserver")) && (++j < argc)) | 284 | if ((!strcmp(argv[j], "-name")) && (++j < argc)) |
291 | { | 285 | { |
292 | gUserServer = argv[j]; | 286 | gProductName = argv[j]; |
293 | } | 287 | } |
294 | else if ((!strcmp(argv[j], "-name")) && (++j < argc)) | 288 | else if ((!strcmp(argv[j], "-url")) && (++j < argc)) |
295 | { | 289 | { |
296 | gProductName = argv[j]; | 290 | gUpdateURL = argv[j]; |
297 | } | 291 | } |
298 | else if ((!strcmp(argv[j], "-program")) && (++j < argc)) | 292 | else if ((!strcmp(argv[j], "-program")) && (++j < argc)) |
299 | { | 293 | { |
@@ -306,7 +300,7 @@ int parse_args(int argc, char **argv) | |||
306 | } | 300 | } |
307 | 301 | ||
308 | // If nothing was set, let the caller know. | 302 | // If nothing was set, let the caller know. |
309 | if (!gUserServer && !gProductName && !gProgramName && !gIsSilent) | 303 | if (!gProductName && !gProgramName && !gIsSilent && !gUpdateURL) |
310 | { | 304 | { |
311 | return 1; | 305 | return 1; |
312 | } | 306 | } |
@@ -357,7 +351,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho | |||
357 | } | 351 | } |
358 | } | 352 | } |
359 | 353 | ||
360 | gUserServer = NULL; | 354 | gUpdateURL = NULL; |
361 | gProgramName = NULL; | 355 | gProgramName = NULL; |
362 | gProductName = NULL; | 356 | gProductName = NULL; |
363 | gIsSilent = false; | 357 | gIsSilent = false; |
@@ -391,7 +385,6 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho | |||
391 | DEVMODE dev_mode = { 0 }; | 385 | DEVMODE dev_mode = { 0 }; |
392 | char update_exec_path[MAX_PATH]; /* Flawfinder: ignore */ | 386 | char update_exec_path[MAX_PATH]; /* Flawfinder: ignore */ |
393 | char *ptr; | 387 | char *ptr; |
394 | WCHAR update_uri[4096]; | ||
395 | 388 | ||
396 | const int WINDOW_WIDTH = 250; | 389 | const int WINDOW_WIDTH = 250; |
397 | const int WINDOW_HEIGHT = 100; | 390 | const int WINDOW_HEIGHT = 100; |
@@ -426,15 +419,15 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho | |||
426 | if (parse_args_result) | 419 | if (parse_args_result) |
427 | { | 420 | { |
428 | MessageBox(gWindow, | 421 | MessageBox(gWindow, |
429 | L"Usage: updater -userserver <server> [-name <window_title>] [-program <program_name>] [-silent]", | 422 | L"Usage: updater -url <url> [-name <window_title>] [-program <program_name>] [-silent]", |
430 | L"Usage", MB_OK); | 423 | L"Usage", MB_OK); |
431 | return parse_args_result; | 424 | return parse_args_result; |
432 | } | 425 | } |
433 | 426 | ||
434 | // Did we get a userserver to work with? | 427 | // Did we get a userserver to work with? |
435 | if (!gUserServer) | 428 | if (!gUpdateURL) |
436 | { | 429 | { |
437 | MessageBox(gWindow, L"Please specify the IP address of the userserver on the command line", | 430 | MessageBox(gWindow, L"Please specify the download url from the command line", |
438 | L"Error", MB_OK); | 431 | L"Error", MB_OK); |
439 | return 1; | 432 | return 1; |
440 | } | 433 | } |
@@ -458,10 +451,9 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho | |||
458 | *(ptr + 2) = 'x'; | 451 | *(ptr + 2) = 'x'; |
459 | *(ptr + 3) = 'e'; | 452 | *(ptr + 3) = 'e'; |
460 | *(ptr + 4) = 0; | 453 | *(ptr + 4) = 0; |
461 | wcscpy(update_uri, UPDATE_URIBASE); /* Flawfinder: ignore */ | 454 | |
462 | WCHAR wcmdline[2048]; | 455 | WCHAR update_uri[4096]; |
463 | mbstowcs(wcmdline, gUserServer, 2048); | 456 | mbstowcs(update_uri, gUpdateURL, 4096); |
464 | wcscat(update_uri, wcmdline); /* Flawfinder: ignore */ | ||
465 | 457 | ||
466 | int success; | 458 | int success; |
467 | int cancelled; | 459 | int cancelled; |
@@ -507,11 +499,13 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nSho | |||
507 | char params[2048]; /* Flawfinder: ignore */ | 499 | char params[2048]; /* Flawfinder: ignore */ |
508 | if (gIsSilent && gProgramName) | 500 | if (gIsSilent && gProgramName) |
509 | { | 501 | { |
510 | snprintf(params, sizeof(params), "/S /P=\"%s\"", gProgramName); /* Flawfinder: ignore */ | 502 | _snprintf(params, sizeof(params), "/S /P=\"%s\"", gProgramName); /* Flawfinder: ignore */ |
503 | params[2047] = '\0'; | ||
511 | } | 504 | } |
512 | else if (gProgramName) | 505 | else if (gProgramName) |
513 | { | 506 | { |
514 | snprintf(params, sizeof(params), "/P=\"%s\"", gProgramName); /* Flawfinder: ignore */ | 507 | _snprintf(params, sizeof(params), "/P=\"%s\"", gProgramName); /* Flawfinder: ignore */ |
508 | params[2047] = '\0'; | ||
515 | } | 509 | } |
516 | else if (gIsSilent) | 510 | else if (gIsSilent) |
517 | { | 511 | { |