annotate src/os_win32.h @ 32669:448aef880252

normalize line endings
author Christian Brabandt <cb@256bit.org>
date Mon, 26 Jun 2023 09:54:34 +0200
parents c0b3e3c7786c
children 695b50472e85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32669
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
2 *
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
4 *
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
7 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
8
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
9 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
10 * Win32 (Windows NT and Windows 95) machine-dependent things.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
11 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
12
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
13 #include "os_dos.h" // common MS-DOS and Win32 stuff
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
14 // cproto fails on missing include files
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
15 #ifndef PROTO
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
16 # include <direct.h> // for _mkdir()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
17 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
18
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
19 #define BINARY_FILE_IO
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
20 #define USE_EXE_NAME // use argv[0] for $VIM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
21 #define USE_TERM_CONSOLE
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
22 #ifndef HAVE_STRING_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
23 # define HAVE_STRING_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
24 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
25 #ifndef HAVE_MATH_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
26 # define HAVE_MATH_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
27 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
28 #define HAVE_STRCSPN
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
29 #ifndef __GNUC__
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
30 #define HAVE_STRICMP
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
31 #define HAVE_STRNICMP
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
32 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
33 #ifndef HAVE_STRFTIME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
34 # define HAVE_STRFTIME // guessed
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
35 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
36 #define HAVE_MEMSET
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
37 #ifndef HAVE_LOCALE_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
38 # define HAVE_LOCALE_H 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
39 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
40 #ifndef HAVE_FCNTL_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
41 # define HAVE_FCNTL_H
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
42 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
43 #define HAVE_QSORT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
44 #define HAVE_ST_MODE // have stat.st_mode
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
45
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
46 #define FEAT_SHORTCUT // resolve shortcuts
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
47
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
48 // Access Control List (actually security info).
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
49 #define HAVE_ACL
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
50
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
51 #define USE_FNAME_CASE // adjust case of file names
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
52 #if !defined(FEAT_CLIPBOARD)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
53 # define FEAT_CLIPBOARD // include clipboard support
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
54 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
55 #if defined(__DATE__) && defined(__TIME__)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
56 # define HAVE_DATE_TIME
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
57 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
58 #ifndef FEAT_GUI_MSWIN // GUI works different
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
59 # define BREAKCHECK_SKIP 1 // call mch_breakcheck() each time, it's fast
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
60 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
61
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
62 #define HAVE_TOTAL_MEM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
63
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
64 #define HAVE_PUTENV // at least Bcc 5.2 and MSC have it
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
65
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
66 #if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
67 # define NO_CONSOLE // don't include console-only code
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
68 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
69
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
70 // toupper() is not really broken, but it's very slow. Probably because of
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
71 // using Unicode characters on Windows NT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
72 #define BROKEN_TOUPPER
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
73
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
74 #define FNAME_ILLEGAL "\"*?><|" // illegal characters in a file name
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
75
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
76 #include <signal.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
77 #include <stdlib.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
78 #include <time.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
79 #include <sys/types.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
80
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
81 #ifndef STRICT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
82 # define STRICT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
83 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
84 #ifndef COBJMACROS
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
85 # define COBJMACROS // For OLE: Enable "friendlier" access to objects
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
86 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
87 #ifndef PROTO
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
88 # include <windows.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
89
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
90 // Weird: rpcndr.h defines "small" to "char", which causes trouble
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
91 #undef small
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
92
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
93 # ifndef SM_CXPADDEDBORDER
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
94 # define SM_CXPADDEDBORDER 92
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
95 # endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
96 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
97
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
98 typedef void (*sighandler_T)(int, int);
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
99
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
100 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
101 * Win32 has plenty of memory, use large buffers
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
102 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
103 #define CMDBUFFSIZE 1024 // size of the command processing buffer
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
104
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
105 // _MAX_PATH is only 260 (stdlib.h), but we want more for the 'path' option,
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
106 // thus use a larger number.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
107 #define MAXPATHL 1024
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
108
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
109 #ifndef BASENAMELEN
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
110 # define BASENAMELEN (_MAX_PATH - 5) // length of base of file name
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
111 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
112
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
113 #define TEMPNAMELEN _MAX_PATH // length of temp file name path
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
114
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
115 #ifndef DFLT_MAXMEM
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
116 # define DFLT_MAXMEM (2*1024) // use up to 2 Mbyte for a buffer
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
117 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
118
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
119 #ifndef DFLT_MAXMEMTOT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
120 # define DFLT_MAXMEMTOT (5*1024) // use up to 5 Mbyte for Vim
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
121 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
122
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
123 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
124 * Reparse Point
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
125 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
126 #ifndef FILE_ATTRIBUTE_REPARSE_POINT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
127 # define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
128 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
129 #ifndef IO_REPARSE_TAG_MOUNT_POINT
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
130 # define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
131 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
132 #ifndef IO_REPARSE_TAG_SYMLINK
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
133 # define IO_REPARSE_TAG_SYMLINK 0xA000000C
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
134 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
135 #ifndef IO_REPARSE_TAG_APPEXECLINK
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
136 # define IO_REPARSE_TAG_APPEXECLINK 0x8000001B
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
137 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
138
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
139 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
140 * Definition of the reparse point buffer.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
141 * This is usually defined in the DDK, copy the definition here to avoid
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
142 * adding it as a dependence only for a single structure.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
143 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
144 typedef struct _REPARSE_DATA_BUFFER {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
145 ULONG ReparseTag;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
146 USHORT ReparseDataLength;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
147 USHORT Reserved;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
148 union {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
149 struct {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
150 USHORT SubstituteNameOffset;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
151 USHORT SubstituteNameLength;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
152 USHORT PrintNameOffset;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
153 USHORT PrintNameLength;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
154 ULONG Flags;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
155 WCHAR PathBuffer[1];
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
156 } SymbolicLinkReparseBuffer;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
157 struct {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
158 USHORT SubstituteNameOffset;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
159 USHORT SubstituteNameLength;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
160 USHORT PrintNameOffset;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
161 USHORT PrintNameLength;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
162 WCHAR PathBuffer[1];
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
163 } MountPointReparseBuffer;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
164 struct {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
165 UCHAR DataBuffer[1];
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
166 } GenericReparseBuffer;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
167 struct
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
168 {
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
169 ULONG StringCount;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
170 WCHAR StringList[1];
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
171 } AppExecLinkReparseBuffer;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
172 } DUMMYUNIONNAME;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
173 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
174
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
175 #ifdef _MSC_VER
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
176 // Support for __try / __except. All versions of MSVC are
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
177 // expected to have this. Any other compilers that support it?
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
178 # define HAVE_TRY_EXCEPT 1
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
179 # include <malloc.h> // for _resetstkoflw()
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
180 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
181
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
182 /*
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
183 * Some simple debugging macros that look and behave a lot like their
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
184 * namesakes in MFC.
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
185 */
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
186
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
187 #ifdef _DEBUG
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
188
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
189 # include <crtdbg.h>
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
190 # define ASSERT(f) _ASSERT(f)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
191
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
192 # define TRACE Trace
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
193 # define TRACE0(sz) Trace(_T("%s"), _T(sz))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
194 # define TRACE1(sz, p1) Trace(_T(sz), p1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
195 # define TRACE2(sz, p1, p2) Trace(_T(sz), p1, p2)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
196 # define TRACE3(sz, p1, p2, p3) Trace(_T(sz), p1, p2, p3)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
197 # define TRACE4(sz, p1, p2, p3, p4) Trace(_T(sz), p1, p2, p3, p4)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
198
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
199 // In debug version, writes trace messages to debug stream
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
200 void __cdecl
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
201 Trace(char *pszFormat, ...);
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
202
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
203 #else // !_DEBUG
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
204
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
205 // These macros should all compile away to nothing
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
206 # define ASSERT(f) ((void)0)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
207 # define TRACE 1 ? (void)0 : (void)printf
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
208 # define TRACE0(sz)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
209 # define TRACE1(sz, p1)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
210 # define TRACE2(sz, p1, p2)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
211 # define TRACE3(sz, p1, p2, p3)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
212 # define TRACE4(sz, p1, p2, p3, p4)
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
213
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
214 #endif // !_DEBUG
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
215
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
216
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
217 #define ASSERT_POINTER(p, type) \
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
218 ASSERT(((p) != NULL) && IsValidAddress((p), sizeof(type), FALSE))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
219
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
220 #define ASSERT_NULL_OR_POINTER(p, type) \
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
221 ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
222
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
223 #ifndef HAVE_SETENV
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
224 # define HAVE_SETENV
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
225 #endif
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
226 #define mch_getenv(x) (char_u *)getenv((char *)(x))
448aef880252 normalize line endings
Christian Brabandt <cb@256bit.org>
parents: 32425
diff changeset
227 #define vim_mkdir(x, y) mch_mkdir(x)