]> git.lyx.org Git - lyx.git/blob - development/Win32/vld/src/ntapi.h
add leak tool for msvc 'Visual Leak Detection' 1.9f: original files
[lyx.git] / development / Win32 / vld / src / ntapi.h
1 ////////////////////////////////////////////////////////////////////////////////
2 //  $Id: ntapi.h,v 1.8 2006/11/18 03:12:35 dmouldin Exp $
3 //
4 //  Visual Leak Detector - NT API Definitions
5 //  Copyright (c) 2006 Dan Moulding
6 //
7 //  This library is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU Lesser General Public
9 //  License as published by the Free Software Foundation; either
10 //  version 2.1 of the License, or (at your option) any later version.
11 //
12 //  This library is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //  Lesser General Public License for more details.
16 //
17 //  You should have received a copy of the GNU Lesser General Public
18 //  License along with this library; if not, write to the Free Software
19 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 //
21 //  See COPYING.txt for the full terms of the GNU Lesser General Public License.
22 //
23 ////////////////////////////////////////////////////////////////////////////////
24
25 #pragma once
26
27 #ifndef VLDBUILD
28 #error \
29 "This header should only be included by Visual Leak Detector when building it from source. \
30 Applications should never include this header."
31 #endif
32
33 #include <windows.h>
34
35 // Return code type used by LdrLoadDll.
36 typedef ULONG NTSTATUS;
37 #define   STATUS_SUCCESS 0
38
39 // Unicode string structure used by NT APIs.
40 typedef struct unicodestring_s {
41     USHORT length;    // Length of the string.
42     USHORT maxlength; // Length of the buffer.
43     PWSTR  buffer;    // The buffer containing the string.
44 } unicodestring_t;
45
46 // Function pointer types for explicit dynamic linking with functions that can't
47 // be load-time linked (no import library is available for these).
48 typedef NTSTATUS (__stdcall *LdrLoadDll_t) (LPWSTR, PDWORD, unicodestring_t *, PHANDLE);
49 typedef LPVOID (__stdcall *RtlAllocateHeap_t) (HANDLE, DWORD, SIZE_T);
50 typedef BOOL (__stdcall *RtlFreeHeap_t) (HANDLE, DWORD, LPVOID);
51 typedef LPVOID (__stdcall *RtlReAllocateHeap_t) (HANDLE, DWORD, LPVOID, SIZE_T);
52
53 // Provide forward declarations for the NT APIs for any source files that
54 // include this header.
55 extern LdrLoadDll_t        LdrLoadDll;
56 extern RtlAllocateHeap_t   RtlAllocateHeap;
57 extern RtlFreeHeap_t       RtlFreeHeap;
58 extern RtlReAllocateHeap_t RtlReAllocateHeap;