diff options
| author | David Schulz <david.schulz@nokia.com> | 2012-01-13 13:01:55 +0100 |
|---|---|---|
| committer | hjk <qthjk@ovi.com> | 2012-01-31 16:38:13 +0100 |
| commit | ac3093058c4ce620987e3c1c1dc67ccfbe040996 (patch) | |
| tree | 5e4e439a162c148d15b277701f18a32c174788fa /src/tools/win64interrupt | |
| parent | 7dbc6014e346efea9705f1a69771d009569f93c7 (diff) | |
| download | qt-creator-ac3093058c4ce620987e3c1c1dc67ccfbe040996.tar.gz | |
source for win64interrupt
The WinAPI funcion DebugBreakProcess must be called from the same bitness as the target process, so win64interrupt is a small 64bit executable calling this function.
Task-number: QTCREATORBUG-2521
Change-Id: I3259d505b9b228be72ca4eaca42a9cde5b4984ac
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/tools/win64interrupt')
| -rw-r--r-- | src/tools/win64interrupt/win64interrupt.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/tools/win64interrupt/win64interrupt.c b/src/tools/win64interrupt/win64interrupt.c new file mode 100644 index 0000000000..ebb6f29bf5 --- /dev/null +++ b/src/tools/win64interrupt/win64interrupt.c @@ -0,0 +1,75 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** +** GNU Lesser General Public License Usage +** +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this file. +** Please review the following information to ensure the GNU Lesser General +** Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** Other Usage +** +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +**************************************************************************/ + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif + +#if _WIN32_WINNT < 0x0501 +#error Must target Windows NT 5.0.1 or later for DebugBreakProcess +#endif + +#include <Windows.h> + +/* To debug break a 64bit application under Windows, you must call + * DebugBreakProcess() from an 64bit apllication. Therefore: + * + * This code must be compiled with a 64bit compiler + * Compile with one of these lines: + * gcc-64bit: + * gcc -o ..\..\..\bin\win64interrupt.exe win64interrupt.c + * cl-64bit: + * cl -o ..\..\..\bin\win64interrupt.exe win64interrupt.c + */ + +int main(int argc, char *argv[]) +{ + HANDLE proc; + BOOL break_result; + DWORD proc_id; + + if (argc != 2) + return 1; + + proc_id = strtoul(argv[1], NULL, 0); + + if (proc_id == 0) + return 2; + + proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id); + if (!proc) + return 3; + + break_result = DebugBreakProcess(proc); + CloseHandle(proc); + return !break_result; +} |
