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