00001
00032
00033
00034
00035
00036 #include "stdafx.h"
00037
00038 #include <stdlib.h>
00039
00040 #include "llcrashloggerwindows.h"
00041
00042
00043
00044
00045
00046
00047
00048 int APIENTRY WinMain(HINSTANCE hInstance,
00049 HINSTANCE hPrevInstance,
00050 LPSTR lpCmdLine,
00051 int nCmdShow)
00052 {
00053 llinfos << "Starting crash reporter" << llendl;
00054
00055
00056
00057
00058
00059
00060
00061 llinfos << "Processing command line" << llendl;
00062 LPSTR cmd_line_including_exe_name = GetCommandLineA();
00063
00064 const S32 MAX_ARGS = 100;
00065 int argc = 0;
00066 char *argv[MAX_ARGS];
00067
00068 char *token = NULL;
00069 if( cmd_line_including_exe_name[0] == '\"' )
00070 {
00071
00072 token = strtok( cmd_line_including_exe_name, "\"" );
00073 argv[argc++] = token;
00074 token = strtok( NULL, " \t," );
00075 }
00076 else
00077 {
00078
00079 token = strtok( cmd_line_including_exe_name, " \t," );
00080 }
00081
00082 while( (token != NULL) && (argc < MAX_ARGS) )
00083 {
00084 argv[argc++] = token;
00085
00086 if (*(token + strlen(token) + 1) == '\"')
00087 {
00088 token = strtok( NULL, "\"");
00089 }
00090 else
00091 {
00092 token = strtok( NULL, " \t," );
00093 }
00094 }
00095
00096 LLCrashLoggerWindows app;
00097 bool ok = app.parseCommandOptions(argc, argv);
00098 if(!ok)
00099 {
00100 llwarns << "Unable to parse command line." << llendl;
00101 }
00102
00103 app.setHandle(hInstance);
00104 ok = app.init();
00105 if(!ok)
00106 {
00107 llwarns << "Unable to initialize application." << llendl;
00108 return -1;
00109 }
00110
00111
00112 if(!LLApp::isQuitting()) app.mainLoop();
00113
00114 if (!app.isError())
00115 {
00116
00117
00118
00119
00120
00121 app.cleanup();
00122 }
00123 return 0;
00124 }