From: Aaron Ballman Date: Thu, 23 Jun 2016 14:45:54 +0000 (+0000) Subject: Explicitly specify the ANSI version of these Win32 APIs. While these are seemingly... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00fb6abc741e3ca395939ba5bbdd8115caf9149e;p=llvm Explicitly specify the ANSI version of these Win32 APIs. While these are seemingly unrelated changes, they are all NFC because we currently default to the ANSI versions of the APIs when building for Windows. This simply makes the ANSI usage explicit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273564 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/Windows/Signals.inc b/lib/Support/Windows/Signals.inc index 834f50ad10e..1e2fa4210df 100644 --- a/lib/Support/Windows/Signals.inc +++ b/lib/Support/Windows/Signals.inc @@ -588,9 +588,9 @@ void llvm::sys::RunInterruptHandlers() { /// \returns a valid HKEY if the location exists, else NULL. static HKEY FindWERKey(const llvm::Twine &RegistryLocation) { HKEY Key; - if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, - RegistryLocation.str().c_str(), 0, - KEY_QUERY_VALUE | KEY_READ, &Key)) + if (ERROR_SUCCESS != ::RegOpenKeyExA(HKEY_LOCAL_MACHINE, + RegistryLocation.str().c_str(), 0, + KEY_QUERY_VALUE | KEY_READ, &Key)) return NULL; return Key; diff --git a/lib/Support/Windows/WindowsSupport.h b/lib/Support/Windows/WindowsSupport.h index fa611a955af..18ecdf4e73d 100644 --- a/lib/Support/Windows/WindowsSupport.h +++ b/lib/Support/Windows/WindowsSupport.h @@ -68,15 +68,15 @@ inline bool RunningWindows8OrGreater() { Mask) != FALSE; } -inline bool MakeErrMsg(std::string* ErrMsg, const std::string& prefix) { +inline bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix) { if (!ErrMsg) return true; char *buffer = NULL; DWORD LastError = GetLastError(); - DWORD R = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_MAX_WIDTH_MASK, - NULL, LastError, 0, (LPSTR)&buffer, 1, NULL); + DWORD R = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, LastError, 0, (LPSTR)&buffer, 1, NULL); if (R) *ErrMsg = prefix + ": " + buffer; else diff --git a/utils/KillTheDoctor/KillTheDoctor.cpp b/utils/KillTheDoctor/KillTheDoctor.cpp index 180b42ff5b6..c9e96617f37 100644 --- a/utils/KillTheDoctor/KillTheDoctor.cpp +++ b/utils/KillTheDoctor/KillTheDoctor.cpp @@ -337,7 +337,7 @@ int main(int argc, char **argv) { errs() << ToolName << ": Program Image Path: " << ProgramToRun << '\n' << ToolName << ": Command Line: " << CommandLine << '\n'; - STARTUPINFO StartupInfo; + STARTUPINFOA StartupInfo; PROCESS_INFORMATION ProcessInfo; std::memset(&StartupInfo, 0, sizeof(StartupInfo)); StartupInfo.cb = sizeof(StartupInfo);