Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: goopdate/com_forwarder.cc

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « goopdate/code_red_check.cc ('k') | goopdate/com_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2009-2010 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 // ========================================================================
15
16 #include <shlwapi.h>
17 #include <tchar.h>
18 #include <strsafe.h>
19 #include <windows.h>
20 #include "base/basictypes.h"
21 #include "omaha/base/constants.h"
22 #include "omaha/common/const_cmd_line.h"
23
24 // TODO(omaha): Use a registry override instead.
25 #if !OFFICIAL_BUILD
26 bool IsRunningFromStaging(const WCHAR* const command_line) {
27 return !wcscmp(command_line + (wcslen(command_line) - wcslen(L"staging")),
28 L"staging");
29 }
30 #endif
31
32 int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous_instance,
33 LPSTR cmd_line, int show) {
34 UNREFERENCED_PARAMETER(instance);
35 UNREFERENCED_PARAMETER(previous_instance);
36 UNREFERENCED_PARAMETER(cmd_line);
37 UNREFERENCED_PARAMETER(show);
38
39 WCHAR command_line[MAX_PATH * 2] = {};
40 if (0 == ::GetModuleFileName(NULL,
41 command_line,
42 arraysize(command_line))) {
43 return E_UNEXPECTED;
44 }
45
46 // TODO(omaha): Use the registry to get the path of the constant shell.
47 // Remove filename and move up one directory, because we want to use the
48 // constant shell GoogleUpdate.exe.
49 ::PathRemoveFileSpec(command_line);
50 #if OFFICIAL_BUILD
51 ::PathRemoveFileSpec(command_line);
52 #else
53 // This is to facilitate unit tests such as
54 // GoogleUpdateCoreTest.LaunchCmdElevated_LocalServerRegistered. If we are
55 // running from the staging directory, the shell is in the same directory.
56 if (!IsRunningFromStaging(command_line)) {
57 ::PathRemoveFileSpec(command_line);
58 }
59 #endif
60
61 if (!::PathAppend(command_line, omaha::kOmahaShellFileName)) {
62 return E_UNEXPECTED;
63 }
64
65 if (FAILED(StringCchCat(command_line, arraysize(command_line), L" ")) ||
66 FAILED(StringCchCat(command_line, arraysize(command_line),
67 CMD_LINE_SWITCH))) {
68 return E_UNEXPECTED;
69 }
70
71 STARTUPINFO si = { sizeof(si) };
72 // XXX: Normally, you should close the handles returned in
73 // PROCESS_INFORMATION. That step is skipped here since we are exiting
74 // immediately once the new process is created.
75 PROCESS_INFORMATION pi = {};
76 if (!::CreateProcess(
77 NULL,
78 command_line,
79 NULL,
80 NULL,
81 FALSE,
82 0,
83 NULL,
84 NULL,
85 &si,
86 &pi)) {
87 return E_UNEXPECTED;
88 }
89
90 return 0;
91 }
OLDNEW
« no previous file with comments | « goopdate/code_red_check.cc ('k') | goopdate/com_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698