Index: chrome/tools/crash_service/caps/main_win.cc |
diff --git a/chrome/tools/crash_service/caps/main_win.cc b/chrome/tools/crash_service/caps/main_win.cc |
index b2c0174548f349bd3a899a0cb049054db5a423cb..61461652a1054b35aa320c3b24335188702da8e2 100644 |
--- a/chrome/tools/crash_service/caps/main_win.cc |
+++ b/chrome/tools/crash_service/caps/main_win.cc |
@@ -4,6 +4,33 @@ |
#include <windows.h> |
+#include "base/at_exit.h" |
+#include "base/files/file_path.h" |
+#include "base/path_service.h" |
+#include "base/version.h" |
+#include "chrome/tools/crash_service/caps/exit_codes.h" |
+#include "chrome/tools/crash_service/caps/logger_win.h" |
+#include "chrome/tools/crash_service/caps/process_singleton_win.h" |
+ |
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { |
- return 0; |
+ base::AtExitManager at_exit_manager; |
+ base::FilePath dir_exe; |
+ if (!PathService::Get(base::DIR_EXE, &dir_exe)) |
+ return caps::EC_INIT_ERROR; |
+ |
+ // What directory we write depends if we are being run from the actual |
+ // location (a versioned directory) or from a build output directory. |
+ base::Version version(dir_exe.BaseName().MaybeAsASCII()); |
+ auto data_path = version.IsValid() ? dir_exe.DirName() : dir_exe; |
+ |
+ // Start logging. |
+ caps::Logger logger(data_path); |
+ |
+ // Check for an existing running instance. |
+ caps::ProcessSingleton process_singleton; |
+ if (process_singleton.other_instance()) |
+ return caps::EC_EXISTING_INSTANCE; |
+ |
+ return caps::EC_NORMAL_EXIT; |
} |
+ |