Android: Get rid of extra dup()s on launching child processes
[chromium-blink-merge.git] / chrome / installer / util / installer_util_test_common.cc
blob6c1553732ae841c5c366b1d50a569d27663fb42e
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/installer/util/installer_util_test_common.h"
7 #include <windows.h>
8 #include <shellapi.h>
10 #include "base/files/file_path.h"
11 #include "base/strings/string16.h"
13 namespace installer {
15 namespace test {
17 bool CopyFileHierarchy(const base::FilePath& from, const base::FilePath& to) {
18 // In SHFILEOPSTRUCT below, |pFrom| and |pTo| have to be double-null
19 // terminated: http://msdn.microsoft.com/library/bb759795.aspx
20 base::string16 double_null_from(from.value());
21 double_null_from.push_back(L'\0');
22 base::string16 double_null_to(to.value());
23 double_null_to.push_back(L'\0');
25 SHFILEOPSTRUCT file_op = {};
26 file_op.wFunc = FO_COPY;
27 file_op.pFrom = double_null_from.c_str();
28 file_op.pTo = double_null_to.c_str();
29 file_op.fFlags = FOF_NO_UI;
31 return (SHFileOperation(&file_op) == 0 && !file_op.fAnyOperationsAborted);
34 } // namespace test
36 } // namespace installer