2 Unix SMB/CIFS implementation.
3 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
4 Copyright (C) Tim Potter 2004
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 %typemap(out) WERROR {
22 if (!W_ERROR_IS_OK($1)) {
23 PyObject *obj = Py_BuildValue("(i,s)", $1.v, win_errstr($1));
24 PyErr_SetObject(PyExc_RuntimeError, obj);
26 } else if ($result == NULL) {
31 %typemap(out) NTSTATUS {
32 if (NT_STATUS_IS_ERR($1)) {
33 PyObject *obj = Py_BuildValue("(i,s)", $1.v, nt_errstr($1));
34 PyErr_SetObject(PyExc_RuntimeError, obj);
36 } else if ($result == NULL) {
41 %typemap(in) NTSTATUS {
42 if (PyLong_Check($input))
43 $1 = NT_STATUS(PyLong_AsUnsignedLong($input));
44 else if (PyInt_Check($input))
45 $1 = NT_STATUS(PyInt_AsLong($input));
47 PyErr_SetString(PyExc_TypeError, "Expected a long or an int");