Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 1 | /********************************************************* |
| 2 | |
| 3 | msvcrtmodule.c |
| 4 | |
| 5 | A Python interface to the Microsoft Visual C Runtime |
| 6 | Library, providing access to those non-portable, but |
| 7 | still useful routines. |
| 8 | |
| 9 | Only ever compiled with an MS compiler, so no attempt |
| 10 | has been made to avoid MS language extensions, etc... |
| 11 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 12 | This may only work on NT or 95... |
| 13 | |
| 14 | Author: Mark Hammond and Guido van Rossum. |
| 15 | Maintenance: Guido van Rossum. |
| 16 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 17 | ***********************************************************/ |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 18 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 19 | #include "Python.h" |
| 20 | #include "malloc.h" |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 21 | #include <io.h> |
| 22 | #include <conio.h> |
| 23 | #include <sys/locking.h> |
Martin v. Löwis | 3dc33d1 | 2007-08-31 07:58:36 +0000 | [diff] [blame] | 24 | #include <crtdbg.h> |
| 25 | #include <windows.h> |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 26 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 27 | // Force the malloc heap to clean itself up, and free unused blocks |
| 28 | // back to the OS. (According to the docs, only works on NT.) |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 29 | static PyObject * |
| 30 | msvcrt_heapmin(PyObject *self, PyObject *args) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 31 | { |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 32 | if (!PyArg_ParseTuple(args, ":heapmin")) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 33 | return NULL; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 34 | |
| 35 | if (_heapmin() != 0) |
| 36 | return PyErr_SetFromErrno(PyExc_IOError); |
| 37 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 38 | Py_INCREF(Py_None); |
| 39 | return Py_None; |
| 40 | } |
| 41 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 42 | // Perform locking operations on a C runtime file descriptor. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 43 | static PyObject * |
| 44 | msvcrt_locking(PyObject *self, PyObject *args) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 45 | { |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 46 | int fd; |
| 47 | int mode; |
| 48 | long nbytes; |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 49 | int err; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 50 | |
| 51 | if (!PyArg_ParseTuple(args, "iil:locking", &fd, &mode, &nbytes)) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 52 | return NULL; |
| 53 | |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 54 | Py_BEGIN_ALLOW_THREADS |
| 55 | err = _locking(fd, mode, nbytes); |
| 56 | Py_END_ALLOW_THREADS |
| 57 | if (err != 0) |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 58 | return PyErr_SetFromErrno(PyExc_IOError); |
| 59 | |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 60 | Py_INCREF(Py_None); |
| 61 | return Py_None; |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 62 | } |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 63 | |
| 64 | // Set the file translation mode for a C runtime file descriptor. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 65 | static PyObject * |
| 66 | msvcrt_setmode(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 67 | { |
| 68 | int fd; |
| 69 | int flags; |
| 70 | if (!PyArg_ParseTuple(args,"ii:setmode", &fd, &flags)) |
| 71 | return NULL; |
| 72 | |
| 73 | flags = _setmode(fd, flags); |
| 74 | if (flags == -1) |
| 75 | return PyErr_SetFromErrno(PyExc_IOError); |
| 76 | |
Christian Heimes | 217cfd1 | 2007-12-02 14:31:20 +0000 | [diff] [blame] | 77 | return PyLong_FromLong(flags); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | // Convert an OS file handle to a C runtime file descriptor. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 81 | static PyObject * |
| 82 | msvcrt_open_osfhandle(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 83 | { |
| 84 | long handle; |
| 85 | int flags; |
| 86 | int fd; |
| 87 | |
| 88 | if (!PyArg_ParseTuple(args, "li:open_osfhandle", &handle, &flags)) |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 89 | return NULL; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 90 | |
| 91 | fd = _open_osfhandle(handle, flags); |
| 92 | if (fd == -1) |
| 93 | return PyErr_SetFromErrno(PyExc_IOError); |
| 94 | |
Christian Heimes | 217cfd1 | 2007-12-02 14:31:20 +0000 | [diff] [blame] | 95 | return PyLong_FromLong(fd); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | // Convert a C runtime file descriptor to an OS file handle. |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 99 | static PyObject * |
| 100 | msvcrt_get_osfhandle(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 101 | { |
| 102 | int fd; |
Tim Peters | 79248aa | 2001-08-29 21:37:10 +0000 | [diff] [blame] | 103 | Py_intptr_t handle; |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 104 | |
| 105 | if (!PyArg_ParseTuple(args,"i:get_osfhandle", &fd)) |
| 106 | return NULL; |
| 107 | |
| 108 | handle = _get_osfhandle(fd); |
| 109 | if (handle == -1) |
| 110 | return PyErr_SetFromErrno(PyExc_IOError); |
| 111 | |
Fred Drake | 25e1726 | 2000-06-30 17:48:51 +0000 | [diff] [blame] | 112 | /* technically 'handle' is not a pointer, but a integer as |
| 113 | large as a pointer, Python's *VoidPtr interface is the |
| 114 | most appropriate here */ |
| 115 | return PyLong_FromVoidPtr((void*)handle); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | /* Console I/O */ |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 119 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 120 | static PyObject * |
| 121 | msvcrt_kbhit(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 122 | { |
| 123 | int ok; |
| 124 | |
| 125 | if (!PyArg_ParseTuple(args, ":kbhit")) |
| 126 | return NULL; |
| 127 | |
| 128 | ok = _kbhit(); |
Christian Heimes | 217cfd1 | 2007-12-02 14:31:20 +0000 | [diff] [blame] | 129 | return PyLong_FromLong(ok); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 130 | } |
| 131 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 132 | static PyObject * |
| 133 | msvcrt_getch(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 134 | { |
| 135 | int ch; |
| 136 | char s[1]; |
| 137 | |
| 138 | if (!PyArg_ParseTuple(args, ":getch")) |
| 139 | return NULL; |
| 140 | |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 141 | Py_BEGIN_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 142 | ch = _getch(); |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 143 | Py_END_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 144 | s[0] = ch; |
| 145 | return PyString_FromStringAndSize(s, 1); |
| 146 | } |
| 147 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 148 | static PyObject * |
Christian Heimes | 2f1019e | 2007-12-10 16:18:49 +0000 | [diff] [blame^] | 149 | msvcrt_getwch(PyObject *self, PyObject *args) |
| 150 | { |
| 151 | Py_UNICODE ch; |
| 152 | Py_UNICODE u[1]; |
| 153 | |
| 154 | if (!PyArg_ParseTuple(args, ":getwch")) |
| 155 | return NULL; |
| 156 | |
| 157 | Py_BEGIN_ALLOW_THREADS |
| 158 | ch = _getwch(); |
| 159 | Py_END_ALLOW_THREADS |
| 160 | u[0] = ch; |
| 161 | return PyUnicode_FromUnicode(u, 1); |
| 162 | } |
| 163 | |
| 164 | static PyObject * |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 165 | msvcrt_getche(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 166 | { |
| 167 | int ch; |
| 168 | char s[1]; |
| 169 | |
| 170 | if (!PyArg_ParseTuple(args, ":getche")) |
| 171 | return NULL; |
| 172 | |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 173 | Py_BEGIN_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 174 | ch = _getche(); |
Guido van Rossum | e4e021b | 1998-05-29 01:27:07 +0000 | [diff] [blame] | 175 | Py_END_ALLOW_THREADS |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 176 | s[0] = ch; |
| 177 | return PyString_FromStringAndSize(s, 1); |
| 178 | } |
| 179 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 180 | static PyObject * |
Christian Heimes | 2f1019e | 2007-12-10 16:18:49 +0000 | [diff] [blame^] | 181 | msvcrt_getwche(PyObject *self, PyObject *args) |
| 182 | { |
| 183 | Py_UNICODE ch; |
| 184 | Py_UNICODE s[1]; |
| 185 | |
| 186 | if (!PyArg_ParseTuple(args, ":getwche")) |
| 187 | return NULL; |
| 188 | |
| 189 | Py_BEGIN_ALLOW_THREADS |
| 190 | ch = _getwche(); |
| 191 | Py_END_ALLOW_THREADS |
| 192 | s[0] = ch; |
| 193 | return PyUnicode_FromUnicode(s, 1); |
| 194 | } |
| 195 | |
| 196 | static PyObject * |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 197 | msvcrt_putch(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 198 | { |
| 199 | char ch; |
| 200 | |
| 201 | if (!PyArg_ParseTuple(args, "c:putch", &ch)) |
| 202 | return NULL; |
| 203 | |
| 204 | _putch(ch); |
| 205 | Py_INCREF(Py_None); |
| 206 | return Py_None; |
| 207 | } |
| 208 | |
Christian Heimes | 2f1019e | 2007-12-10 16:18:49 +0000 | [diff] [blame^] | 209 | |
| 210 | static PyObject * |
| 211 | msvcrt_putwch(PyObject *self, PyObject *args) |
| 212 | { |
| 213 | Py_UNICODE *ch; |
| 214 | int size; |
| 215 | |
| 216 | if (!PyArg_ParseTuple(args, "u#:putwch", &ch, &size)) |
| 217 | return NULL; |
| 218 | |
| 219 | if (size == 0) { |
| 220 | PyErr_SetString(PyExc_ValueError, |
| 221 | "Expected unicode string of length 1"); |
| 222 | return NULL; |
| 223 | } |
| 224 | _putwch(*ch); |
| 225 | Py_RETURN_NONE; |
| 226 | |
| 227 | } |
| 228 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 229 | static PyObject * |
| 230 | msvcrt_ungetch(PyObject *self, PyObject *args) |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 231 | { |
| 232 | char ch; |
| 233 | |
| 234 | if (!PyArg_ParseTuple(args, "c:ungetch", &ch)) |
| 235 | return NULL; |
| 236 | |
Guido van Rossum | 6543e88 | 1999-02-16 19:40:02 +0000 | [diff] [blame] | 237 | if (_ungetch(ch) == EOF) |
| 238 | return PyErr_SetFromErrno(PyExc_IOError); |
Guido van Rossum | 407a22d | 1997-08-13 19:57:53 +0000 | [diff] [blame] | 239 | Py_INCREF(Py_None); |
| 240 | return Py_None; |
| 241 | } |
| 242 | |
Christian Heimes | 2f1019e | 2007-12-10 16:18:49 +0000 | [diff] [blame^] | 243 | static PyObject * |
| 244 | msvcrt_ungetwch(PyObject *self, PyObject *args) |
| 245 | { |
| 246 | Py_UNICODE ch; |
| 247 | |
| 248 | if (!PyArg_ParseTuple(args, "u:ungetwch", &ch)) |
| 249 | return NULL; |
| 250 | |
| 251 | if (_ungetch(ch) == EOF) |
| 252 | return PyErr_SetFromErrno(PyExc_IOError); |
| 253 | Py_INCREF(Py_None); |
| 254 | return Py_None; |
| 255 | } |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 256 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 257 | static void |
| 258 | insertint(PyObject *d, char *name, int value) |
| 259 | { |
Christian Heimes | 217cfd1 | 2007-12-02 14:31:20 +0000 | [diff] [blame] | 260 | PyObject *v = PyLong_FromLong((long) value); |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 261 | if (v == NULL) { |
| 262 | /* Don't bother reporting this error */ |
| 263 | PyErr_Clear(); |
| 264 | } |
| 265 | else { |
| 266 | PyDict_SetItemString(d, name, v); |
| 267 | Py_DECREF(v); |
| 268 | } |
| 269 | } |
| 270 | |
Martin v. Löwis | 3dc33d1 | 2007-08-31 07:58:36 +0000 | [diff] [blame] | 271 | #ifdef _DEBUG |
| 272 | |
| 273 | static PyObject* |
| 274 | msvcrt_setreportfile(PyObject *self, PyObject *args) |
| 275 | { |
| 276 | int type, file; |
| 277 | _HFILE res; |
| 278 | |
| 279 | if (!PyArg_ParseTuple(args, "ii", &type, &file)) |
| 280 | return NULL; |
| 281 | res = _CrtSetReportFile(type, (_HFILE)file); |
Christian Heimes | 217cfd1 | 2007-12-02 14:31:20 +0000 | [diff] [blame] | 282 | return PyLong_FromLong((long)res); |
Martin v. Löwis | 3dc33d1 | 2007-08-31 07:58:36 +0000 | [diff] [blame] | 283 | Py_INCREF(Py_None); |
| 284 | return Py_None; |
| 285 | } |
| 286 | |
| 287 | static PyObject* |
| 288 | msvcrt_setreportmode(PyObject *self, PyObject *args) |
| 289 | { |
| 290 | int type, mode; |
| 291 | int res; |
| 292 | |
| 293 | if (!PyArg_ParseTuple(args, "ii", &type, &mode)) |
| 294 | return NULL; |
| 295 | res = _CrtSetReportMode(type, mode); |
| 296 | if (res == -1) |
| 297 | return PyErr_SetFromErrno(PyExc_IOError); |
| 298 | return PyLong_FromLong(res); |
| 299 | } |
| 300 | |
| 301 | static PyObject* |
| 302 | msvcrt_seterrormode(PyObject *self, PyObject *args) |
| 303 | { |
| 304 | int mode, res; |
| 305 | |
| 306 | if (!PyArg_ParseTuple(args, "i", &mode)) |
| 307 | return NULL; |
| 308 | res = _set_error_mode(mode); |
| 309 | return PyLong_FromLong(res); |
| 310 | } |
| 311 | |
| 312 | #endif |
| 313 | |
| 314 | static PyObject* |
| 315 | seterrormode(PyObject *self, PyObject *args) |
| 316 | { |
| 317 | unsigned int mode, res; |
| 318 | |
| 319 | if (!PyArg_ParseTuple(args, "I", &mode)) |
| 320 | return NULL; |
| 321 | res = SetErrorMode(mode); |
| 322 | return PyLong_FromUnsignedLong(res); |
| 323 | } |
| 324 | |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 325 | |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 326 | /* List of functions exported by this module */ |
| 327 | static struct PyMethodDef msvcrt_functions[] = { |
Neal Norwitz | 031829d | 2002-03-31 14:37:44 +0000 | [diff] [blame] | 328 | {"heapmin", msvcrt_heapmin, METH_VARARGS}, |
| 329 | {"locking", msvcrt_locking, METH_VARARGS}, |
| 330 | {"setmode", msvcrt_setmode, METH_VARARGS}, |
| 331 | {"open_osfhandle", msvcrt_open_osfhandle, METH_VARARGS}, |
| 332 | {"get_osfhandle", msvcrt_get_osfhandle, METH_VARARGS}, |
| 333 | {"kbhit", msvcrt_kbhit, METH_VARARGS}, |
| 334 | {"getch", msvcrt_getch, METH_VARARGS}, |
| 335 | {"getche", msvcrt_getche, METH_VARARGS}, |
| 336 | {"putch", msvcrt_putch, METH_VARARGS}, |
| 337 | {"ungetch", msvcrt_ungetch, METH_VARARGS}, |
Martin v. Löwis | 3dc33d1 | 2007-08-31 07:58:36 +0000 | [diff] [blame] | 338 | {"SetErrorMode", seterrormode, METH_VARARGS}, |
| 339 | #ifdef _DEBUG |
| 340 | {"CrtSetReportFile", msvcrt_setreportfile, METH_VARARGS}, |
| 341 | {"CrtSetReportMode", msvcrt_setreportmode, METH_VARARGS}, |
| 342 | {"set_error_mode", msvcrt_seterrormode, METH_VARARGS}, |
| 343 | #endif |
Christian Heimes | 2f1019e | 2007-12-10 16:18:49 +0000 | [diff] [blame^] | 344 | {"getwch", msvcrt_getwch, METH_VARARGS}, |
| 345 | {"getwche", msvcrt_getwche, METH_VARARGS}, |
| 346 | {"putwch", msvcrt_putwch, METH_VARARGS}, |
| 347 | {"ungetwch", msvcrt_ungetwch, METH_VARARGS}, |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 348 | {NULL, NULL} |
| 349 | }; |
| 350 | |
Thomas Heller | a18331d | 2004-07-28 20:02:52 +0000 | [diff] [blame] | 351 | PyMODINIT_FUNC |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 352 | initmsvcrt(void) |
| 353 | { |
Tim Peters | 2188bf0 | 2006-01-19 15:21:30 +0000 | [diff] [blame] | 354 | PyObject *d; |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 355 | PyObject *m = Py_InitModule("msvcrt", msvcrt_functions); |
Neal Norwitz | 1ac754f | 2006-01-19 06:09:39 +0000 | [diff] [blame] | 356 | if (m == NULL) |
| 357 | return; |
Tim Peters | 2188bf0 | 2006-01-19 15:21:30 +0000 | [diff] [blame] | 358 | d = PyModule_GetDict(m); |
Tim Peters | 5fa0bd6 | 2000-12-12 01:58:56 +0000 | [diff] [blame] | 359 | |
| 360 | /* constants for the locking() function's mode argument */ |
| 361 | insertint(d, "LK_LOCK", _LK_LOCK); |
| 362 | insertint(d, "LK_NBLCK", _LK_NBLCK); |
| 363 | insertint(d, "LK_NBRLCK", _LK_NBRLCK); |
| 364 | insertint(d, "LK_RLCK", _LK_RLCK); |
| 365 | insertint(d, "LK_UNLCK", _LK_UNLCK); |
Martin v. Löwis | 3dc33d1 | 2007-08-31 07:58:36 +0000 | [diff] [blame] | 366 | insertint(d, "SEM_FAILCRITICALERRORS", SEM_FAILCRITICALERRORS); |
| 367 | insertint(d, "SEM_NOALIGNMENTFAULTEXCEPT", SEM_NOALIGNMENTFAULTEXCEPT); |
| 368 | insertint(d, "SEM_NOGPFAULTERRORBOX", SEM_NOGPFAULTERRORBOX); |
| 369 | insertint(d, "SEM_NOOPENFILEERRORBOX", SEM_NOOPENFILEERRORBOX); |
| 370 | #ifdef _DEBUG |
| 371 | insertint(d, "CRT_WARN", _CRT_WARN); |
| 372 | insertint(d, "CRT_ERROR", _CRT_ERROR); |
| 373 | insertint(d, "CRT_ASSERT", _CRT_ASSERT); |
| 374 | insertint(d, "CRTDBG_MODE_DEBUG", _CRTDBG_MODE_DEBUG); |
| 375 | insertint(d, "CRTDBG_MODE_FILE", _CRTDBG_MODE_FILE); |
| 376 | insertint(d, "CRTDBG_MODE_WNDW", _CRTDBG_MODE_WNDW); |
| 377 | insertint(d, "CRTDBG_REPORT_MODE", _CRTDBG_REPORT_MODE); |
| 378 | insertint(d, "CRTDBG_FILE_STDERR", (int)_CRTDBG_FILE_STDERR); |
| 379 | insertint(d, "CRTDBG_FILE_STDOUT", (int)_CRTDBG_FILE_STDOUT); |
| 380 | insertint(d, "CRTDBG_REPORT_FILE", (int)_CRTDBG_REPORT_FILE); |
| 381 | #endif |
Guido van Rossum | 29c1ea5 | 1997-08-07 00:11:34 +0000 | [diff] [blame] | 382 | } |