Changeset 154367 in webkit
- Timestamp:
- Aug 20, 2013 3:25:29 PM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r154328 r154367 1 2013-08-20 Brent Fulgham <bfulgham@apple.com> 2 3 <https://webkit.org/b/120090> Report better error messages from WinLauncher/DRT 4 5 Reviewed by Tim Horton. 6 7 * win/DLLLauncher/DLLLauncherMain.cpp: 8 (getLastErrorString): New method to convert GetLastError to text. 9 (wWinMain): Use new error formatter to provide useful diagnostic text to user. 10 1 11 2013-08-19 Gustavo Noronha Silva <gns@gnome.org> 2 12 -
trunk/Tools/win/DLLLauncher/DLLLauncherMain.cpp
r153544 r154367 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012-2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 149 149 } 150 150 151 static wstring getLastErrorString(HRESULT hr) 152 { 153 static const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; 154 static const size_t bufSize = 4096; 155 156 wchar_t errorMessage[bufSize]; 157 DWORD len = ::FormatMessageW(kFlags, 0, hr, 0, errorMessage, bufSize, 0); 158 if (len >= bufSize) 159 len = bufSize - 1; 160 161 errorMessage[len + 1] = 0; 162 163 return errorMessage; 164 } 165 151 166 #if USE_CONSOLE_ENTRY_POINT 152 167 int main(int argc, const char* argv[]) … … 160 175 wchar_t exePath[MAX_PATH]; 161 176 if (!::GetModuleFileNameW(0, exePath, _countof(exePath))) 162 return fatalError(L"Unknown Program", L"Failed to determine name of executable .");177 return fatalError(L"Unknown Program", L"Failed to determine name of executable: " + getLastErrorString(::GetLastError())); 163 178 164 179 ::PathRemoveExtensionW(exePath); … … 172 187 wstring dllName = programName + L".dll"; 173 188 if (!::PathRemoveFileSpecW(exePath)) 174 return fatalError(programName, L"::PathRemoveFileSpecW failed .");189 return fatalError(programName, L"::PathRemoveFileSpecW failed: " + getLastErrorString(::GetLastError())); 175 190 if (!::PathAppendW(exePath, dllName.c_str())) 176 return fatalError(programName, L"::PathAppendW failed .");191 return fatalError(programName, L"::PathAppendW failed: " + getLastErrorString(::GetLastError())); 177 192 HMODULE module = ::LoadLibraryW(exePath); 178 193 if (!module) 179 return fatalError(programName, L"::LoadLibraryW failed .");194 return fatalError(programName, L"::LoadLibraryW failed: \npath=" + wstring(exePath) + L"\n" + getLastErrorString(::GetLastError())); 180 195 181 196 #if USE_CONSOLE_ENTRY_POINT … … 197 212 EntryPoint entryPoint = reinterpret_cast<EntryPoint>(::GetProcAddress(module, entryPointName)); 198 213 if (!entryPoint) 199 return fatalError(programName, L"Failed to find dllLauncherEntryPoint function .");214 return fatalError(programName, L"Failed to find dllLauncherEntryPoint function: " + getLastErrorString(::GetLastError())); 200 215 201 216 #if USE_CONSOLE_ENTRY_POINT
Note: See TracChangeset
for help on using the changeset viewer.