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

Side by Side Diff: base/file_util_win.cc

Issue 6019007: Remove win_util::FormatMessage and FormatLastWin32Error. These were only used... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « app/win/window_impl.cc ('k') | base/win_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <propvarutil.h> 8 #include <propvarutil.h>
9 #include <psapi.h> 9 #include <psapi.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 int WriteFile(const FilePath& filename, const char* data, int size) { 750 int WriteFile(const FilePath& filename, const char* data, int size) {
751 base::ThreadRestrictions::AssertIOAllowed(); 751 base::ThreadRestrictions::AssertIOAllowed();
752 base::win::ScopedHandle file(CreateFile(filename.value().c_str(), 752 base::win::ScopedHandle file(CreateFile(filename.value().c_str(),
753 GENERIC_WRITE, 753 GENERIC_WRITE,
754 0, 754 0,
755 NULL, 755 NULL,
756 CREATE_ALWAYS, 756 CREATE_ALWAYS,
757 0, 757 0,
758 NULL)); 758 NULL));
759 if (!file) { 759 if (!file) {
760 LOG(WARNING) << "CreateFile failed for path " << filename.value() << 760 LOG(WARNING) << "CreateFile failed for path " << filename.value()
761 " error code=" << GetLastError() << 761 << " error code=" << GetLastError();
762 " error text=" << win_util::FormatLastWin32Error();
763 return -1; 762 return -1;
764 } 763 }
765 764
766 DWORD written; 765 DWORD written;
767 BOOL result = ::WriteFile(file, data, size, &written, NULL); 766 BOOL result = ::WriteFile(file, data, size, &written, NULL);
768 if (result && static_cast<int>(written) == size) 767 if (result && static_cast<int>(written) == size)
769 return written; 768 return written;
770 769
771 if (!result) { 770 if (!result) {
772 // WriteFile failed. 771 // WriteFile failed.
773 LOG(WARNING) << "writing file " << filename.value() << 772 LOG(WARNING) << "writing file " << filename.value()
774 " failed, error code=" << GetLastError() << 773 << " failed, error code=" << GetLastError();
775 " description=" << win_util::FormatLastWin32Error();
776 } else { 774 } else {
777 // Didn't write all the bytes. 775 // Didn't write all the bytes.
778 LOG(WARNING) << "wrote" << written << " bytes to " << 776 LOG(WARNING) << "wrote" << written << " bytes to " <<
779 filename.value() << " expected " << size; 777 filename.value() << " expected " << size;
780 } 778 }
781 return -1; 779 return -1;
782 } 780 }
783 781
784 bool RenameFileAndResetSecurityDescriptor(const FilePath& source_file_path, 782 bool RenameFileAndResetSecurityDescriptor(const FilePath& source_file_path,
785 const FilePath& target_file_path) { 783 const FilePath& target_file_path) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 uint8 unused = *(touch + offset); 1131 uint8 unused = *(touch + offset);
1134 offset += step_size; 1132 offset += step_size;
1135 } 1133 }
1136 FreeLibrary(dll_module); 1134 FreeLibrary(dll_module);
1137 } 1135 }
1138 1136
1139 return true; 1137 return true;
1140 } 1138 }
1141 1139
1142 } // namespace file_util 1140 } // namespace file_util
OLDNEW
« no previous file with comments | « app/win/window_impl.cc ('k') | base/win_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698