1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2003-2006 - Stefan Kueng
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "debughelpers.h"
\r
22 CString GetLastErrorMessageString(int err)
\r
26 FORMAT_MESSAGE_ALLOCATE_BUFFER |
\r
27 FORMAT_MESSAGE_FROM_SYSTEM |
\r
28 FORMAT_MESSAGE_IGNORE_INSERTS,
\r
31 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
\r
36 CString temp = CString((LPCTSTR)lpMsgBuf);
\r
37 LocalFree(lpMsgBuf);
\r
41 CString GetLastErrorMessageString()
\r
45 FORMAT_MESSAGE_ALLOCATE_BUFFER |
\r
46 FORMAT_MESSAGE_FROM_SYSTEM |
\r
47 FORMAT_MESSAGE_IGNORE_INSERTS,
\r
50 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
\r
55 CString temp = CString((LPCTSTR)lpMsgBuf);
\r
56 LocalFree(lpMsgBuf);
\r
60 void SetThreadName(DWORD dwThreadID, LPCTSTR szThreadName)
\r
63 char narrow[_MAX_PATH * 3];
\r
64 BOOL defaultCharUsed;
\r
65 int ret = WideCharToMultiByte(CP_ACP, 0, szThreadName, (int)_tcslen(szThreadName), narrow, _MAX_PATH*3 - 1, ".", &defaultCharUsed);
\r
68 THREADNAME_INFO info;
\r
69 info.dwType = 0x1000;
\r
71 info.szName = narrow;
\r
73 info.szName = szThreadName;
\r
75 info.dwThreadID = dwThreadID;
\r
80 RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD),
\r
81 (const ULONG_PTR *)&info);
\r
83 __except (EXCEPTION_CONTINUE_EXECUTION)
\r