From 48d7fb37f85d0f03643214105b04d9e123adb1e6 Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Thu, 10 Mar 2011 01:06:31 +0000 Subject: The code to validate whether plugin dlls are 32 bit failed for some dll's as the attempt to create a memory mapped section with the size of the file fails with the section too large error. As per msdn documentation we can safely pass in 0 for the file size for CreateFileMapping and MapViewOfFile which indicates that the whole file is being mapped. This caused some plugin dlls like acrobat reader 9 to not load in chrome. Fixes bug http://code.google.com/p/chromium/issues/detail?id=75351 BUG=75351 TEST=manually as described in the bug. Review URL: http://codereview.chromium.org/6661010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77575 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_util_win.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'base') diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 2c26a16..af989c8 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -972,10 +972,8 @@ bool MemoryMappedFile::MapFileToMemoryInternalEx(int flags) { if (length_ == INVALID_FILE_SIZE) return false; - // length_ value comes from GetFileSize() above. GetFileSize() returns DWORD, - // therefore the cast here is safe. file_mapping_ = ::CreateFileMapping(file_, NULL, PAGE_READONLY | flags, - 0, static_cast(length_), NULL); + 0, 0, NULL); if (!file_mapping_) { // According to msdn, system error codes are only reserved up to 15999. // http://msdn.microsoft.com/en-us/library/ms681381(v=VS.85).aspx. @@ -985,7 +983,7 @@ bool MemoryMappedFile::MapFileToMemoryInternalEx(int flags) { } data_ = static_cast( - ::MapViewOfFile(file_mapping_, FILE_MAP_READ, 0, 0, length_)); + ::MapViewOfFile(file_mapping_, FILE_MAP_READ, 0, 0, 0)); if (!data_) { UMA_HISTOGRAM_ENUMERATION("MemoryMappedFile.MapViewOfFile", logging::GetLastSystemErrorCode(), 16000); -- cgit v1.1