diff options
Diffstat (limited to 'PC/clinic')
-rw-r--r-- | PC/clinic/msvcrtmodule.c.h | 554 | ||||
-rw-r--r-- | PC/clinic/winreg.c.h | 1059 | ||||
-rw-r--r-- | PC/clinic/winsound.c.h | 100 |
3 files changed, 1713 insertions, 0 deletions
diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h new file mode 100644 index 0000000..c8e6ed8 --- /dev/null +++ b/PC/clinic/msvcrtmodule.c.h @@ -0,0 +1,554 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(msvcrt_heapmin__doc__, +"heapmin($module, /)\n" +"--\n" +"\n" +"Minimize the malloc() heap.\n" +"\n" +"Force the malloc() heap to clean itself up and return unused blocks\n" +"to the operating system. On failure, this raises OSError."); + +#define MSVCRT_HEAPMIN_METHODDEF \ + {"heapmin", (PyCFunction)msvcrt_heapmin, METH_NOARGS, msvcrt_heapmin__doc__}, + +static PyObject * +msvcrt_heapmin_impl(PyModuleDef *module); + +static PyObject * +msvcrt_heapmin(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) +{ + return msvcrt_heapmin_impl(module); +} + +PyDoc_STRVAR(msvcrt_locking__doc__, +"locking($module, fd, mode, nbytes, /)\n" +"--\n" +"\n" +"Lock part of a file based on file descriptor fd from the C runtime.\n" +"\n" +"Raises IOError on failure. The locked region of the file extends from\n" +"the current file position for nbytes bytes, and may continue beyond\n" +"the end of the file. mode must be one of the LK_* constants listed\n" +"below. Multiple regions in a file may be locked at the same time, but\n" +"may not overlap. Adjacent regions are not merged; they must be unlocked\n" +"individually."); + +#define MSVCRT_LOCKING_METHODDEF \ + {"locking", (PyCFunction)msvcrt_locking, METH_VARARGS, msvcrt_locking__doc__}, + +static PyObject * +msvcrt_locking_impl(PyModuleDef *module, int fd, int mode, long nbytes); + +static PyObject * +msvcrt_locking(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + int fd; + int mode; + long nbytes; + + if (!PyArg_ParseTuple(args, "iil:locking", + &fd, &mode, &nbytes)) + goto exit; + return_value = msvcrt_locking_impl(module, fd, mode, nbytes); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_setmode__doc__, +"setmode($module, fd, mode, /)\n" +"--\n" +"\n" +"Set the line-end translation mode for the file descriptor fd.\n" +"\n" +"To set it to text mode, flags should be os.O_TEXT; for binary, it\n" +"should be os.O_BINARY.\n" +"\n" +"Return value is the previous mode."); + +#define MSVCRT_SETMODE_METHODDEF \ + {"setmode", (PyCFunction)msvcrt_setmode, METH_VARARGS, msvcrt_setmode__doc__}, + +static long +msvcrt_setmode_impl(PyModuleDef *module, int fd, int flags); + +static PyObject * +msvcrt_setmode(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + int fd; + int flags; + long _return_value; + + if (!PyArg_ParseTuple(args, "ii:setmode", + &fd, &flags)) + goto exit; + _return_value = msvcrt_setmode_impl(module, fd, flags); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_open_osfhandle__doc__, +"open_osfhandle($module, handle, flags, /)\n" +"--\n" +"\n" +"Create a C runtime file descriptor from the file handle handle.\n" +"\n" +"The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,\n" +"and os.O_TEXT. The returned file descriptor may be used as a parameter\n" +"to os.fdopen() to create a file object."); + +#define MSVCRT_OPEN_OSFHANDLE_METHODDEF \ + {"open_osfhandle", (PyCFunction)msvcrt_open_osfhandle, METH_VARARGS, msvcrt_open_osfhandle__doc__}, + +static long +msvcrt_open_osfhandle_impl(PyModuleDef *module, Py_intptr_t handle, + int flags); + +static PyObject * +msvcrt_open_osfhandle(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + Py_intptr_t handle; + int flags; + long _return_value; + + if (!PyArg_ParseTuple(args, ""_Py_PARSE_INTPTR"i:open_osfhandle", + &handle, &flags)) + goto exit; + _return_value = msvcrt_open_osfhandle_impl(module, handle, flags); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_get_osfhandle__doc__, +"get_osfhandle($module, fd, /)\n" +"--\n" +"\n" +"Return the file handle for the file descriptor fd.\n" +"\n" +"Raises IOError if fd is not recognized."); + +#define MSVCRT_GET_OSFHANDLE_METHODDEF \ + {"get_osfhandle", (PyCFunction)msvcrt_get_osfhandle, METH_O, msvcrt_get_osfhandle__doc__}, + +static Py_intptr_t +msvcrt_get_osfhandle_impl(PyModuleDef *module, int fd); + +static PyObject * +msvcrt_get_osfhandle(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int fd; + Py_intptr_t _return_value; + + if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) + goto exit; + _return_value = msvcrt_get_osfhandle_impl(module, fd); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromVoidPtr((void *)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_kbhit__doc__, +"kbhit($module, /)\n" +"--\n" +"\n" +"Return true if a keypress is waiting to be read."); + +#define MSVCRT_KBHIT_METHODDEF \ + {"kbhit", (PyCFunction)msvcrt_kbhit, METH_NOARGS, msvcrt_kbhit__doc__}, + +static long +msvcrt_kbhit_impl(PyModuleDef *module); + +static PyObject * +msvcrt_kbhit(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + long _return_value; + + _return_value = msvcrt_kbhit_impl(module); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_getch__doc__, +"getch($module, /)\n" +"--\n" +"\n" +"Read a keypress and return the resulting character as a byte string.\n" +"\n" +"Nothing is echoed to the console. This call will block if a keypress is\n" +"not already available, but will not wait for Enter to be pressed. If the\n" +"pressed key was a special function key, this will return \'\\000\' or\n" +"\'\\xe0\'; the next call will return the keycode. The Control-C keypress\n" +"cannot be read with this function."); + +#define MSVCRT_GETCH_METHODDEF \ + {"getch", (PyCFunction)msvcrt_getch, METH_NOARGS, msvcrt_getch__doc__}, + +static int +msvcrt_getch_impl(PyModuleDef *module); + +static PyObject * +msvcrt_getch(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + char s[1]; + + s[0] = msvcrt_getch_impl(module); + return_value = PyBytes_FromStringAndSize(s, 1); + + return return_value; +} + +PyDoc_STRVAR(msvcrt_getwch__doc__, +"getwch($module, /)\n" +"--\n" +"\n" +"Wide char variant of getch(), returning a Unicode value."); + +#define MSVCRT_GETWCH_METHODDEF \ + {"getwch", (PyCFunction)msvcrt_getwch, METH_NOARGS, msvcrt_getwch__doc__}, + +static wchar_t +msvcrt_getwch_impl(PyModuleDef *module); + +static PyObject * +msvcrt_getwch(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + wchar_t _return_value; + + _return_value = msvcrt_getwch_impl(module); + return_value = PyUnicode_FromOrdinal(_return_value); + + return return_value; +} + +PyDoc_STRVAR(msvcrt_getche__doc__, +"getche($module, /)\n" +"--\n" +"\n" +"Similar to getch(), but the keypress will be echoed if possible."); + +#define MSVCRT_GETCHE_METHODDEF \ + {"getche", (PyCFunction)msvcrt_getche, METH_NOARGS, msvcrt_getche__doc__}, + +static int +msvcrt_getche_impl(PyModuleDef *module); + +static PyObject * +msvcrt_getche(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + char s[1]; + + s[0] = msvcrt_getche_impl(module); + return_value = PyBytes_FromStringAndSize(s, 1); + + return return_value; +} + +PyDoc_STRVAR(msvcrt_getwche__doc__, +"getwche($module, /)\n" +"--\n" +"\n" +"Wide char variant of getche(), returning a Unicode value."); + +#define MSVCRT_GETWCHE_METHODDEF \ + {"getwche", (PyCFunction)msvcrt_getwche, METH_NOARGS, msvcrt_getwche__doc__}, + +static wchar_t +msvcrt_getwche_impl(PyModuleDef *module); + +static PyObject * +msvcrt_getwche(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + wchar_t _return_value; + + _return_value = msvcrt_getwche_impl(module); + return_value = PyUnicode_FromOrdinal(_return_value); + + return return_value; +} + +PyDoc_STRVAR(msvcrt_putch__doc__, +"putch($module, char, /)\n" +"--\n" +"\n" +"Print the byte string char to the console without buffering."); + +#define MSVCRT_PUTCH_METHODDEF \ + {"putch", (PyCFunction)msvcrt_putch, METH_O, msvcrt_putch__doc__}, + +static PyObject * +msvcrt_putch_impl(PyModuleDef *module, char char_value); + +static PyObject * +msvcrt_putch(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + char char_value; + + if (!PyArg_Parse(arg, "c:putch", &char_value)) + goto exit; + return_value = msvcrt_putch_impl(module, char_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_putwch__doc__, +"putwch($module, unicode_char, /)\n" +"--\n" +"\n" +"Wide char variant of putch(), accepting a Unicode value."); + +#define MSVCRT_PUTWCH_METHODDEF \ + {"putwch", (PyCFunction)msvcrt_putwch, METH_O, msvcrt_putwch__doc__}, + +static PyObject * +msvcrt_putwch_impl(PyModuleDef *module, int unicode_char); + +static PyObject * +msvcrt_putwch(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int unicode_char; + + if (!PyArg_Parse(arg, "C:putwch", &unicode_char)) + goto exit; + return_value = msvcrt_putwch_impl(module, unicode_char); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_ungetch__doc__, +"ungetch($module, char, /)\n" +"--\n" +"\n" +"Opposite of getch.\n" +"\n" +"Cause the byte string char to be \"pushed back\" into the\n" +"console buffer; it will be the next character read by\n" +"getch() or getche()."); + +#define MSVCRT_UNGETCH_METHODDEF \ + {"ungetch", (PyCFunction)msvcrt_ungetch, METH_O, msvcrt_ungetch__doc__}, + +static PyObject * +msvcrt_ungetch_impl(PyModuleDef *module, char char_value); + +static PyObject * +msvcrt_ungetch(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + char char_value; + + if (!PyArg_Parse(arg, "c:ungetch", &char_value)) + goto exit; + return_value = msvcrt_ungetch_impl(module, char_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(msvcrt_ungetwch__doc__, +"ungetwch($module, unicode_char, /)\n" +"--\n" +"\n" +"Wide char variant of ungetch(), accepting a Unicode value."); + +#define MSVCRT_UNGETWCH_METHODDEF \ + {"ungetwch", (PyCFunction)msvcrt_ungetwch, METH_O, msvcrt_ungetwch__doc__}, + +static PyObject * +msvcrt_ungetwch_impl(PyModuleDef *module, int unicode_char); + +static PyObject * +msvcrt_ungetwch(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int unicode_char; + + if (!PyArg_Parse(arg, "C:ungetwch", &unicode_char)) + goto exit; + return_value = msvcrt_ungetwch_impl(module, unicode_char); + +exit: + return return_value; +} + +#if defined(_DEBUG) + +PyDoc_STRVAR(msvcrt_CrtSetReportFile__doc__, +"CrtSetReportFile($module, type, file, /)\n" +"--\n" +"\n" +"Wrapper around _CrtSetReportFile.\n" +"\n" +"Only available on Debug builds."); + +#define MSVCRT_CRTSETREPORTFILE_METHODDEF \ + {"CrtSetReportFile", (PyCFunction)msvcrt_CrtSetReportFile, METH_VARARGS, msvcrt_CrtSetReportFile__doc__}, + +static long +msvcrt_CrtSetReportFile_impl(PyModuleDef *module, int type, int file); + +static PyObject * +msvcrt_CrtSetReportFile(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + int type; + int file; + long _return_value; + + if (!PyArg_ParseTuple(args, "ii:CrtSetReportFile", + &type, &file)) + goto exit; + _return_value = msvcrt_CrtSetReportFile_impl(module, type, file); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong(_return_value); + +exit: + return return_value; +} + +#endif /* defined(_DEBUG) */ + +#if defined(_DEBUG) + +PyDoc_STRVAR(msvcrt_CrtSetReportMode__doc__, +"CrtSetReportMode($module, type, mode, /)\n" +"--\n" +"\n" +"Wrapper around _CrtSetReportMode.\n" +"\n" +"Only available on Debug builds."); + +#define MSVCRT_CRTSETREPORTMODE_METHODDEF \ + {"CrtSetReportMode", (PyCFunction)msvcrt_CrtSetReportMode, METH_VARARGS, msvcrt_CrtSetReportMode__doc__}, + +static long +msvcrt_CrtSetReportMode_impl(PyModuleDef *module, int type, int mode); + +static PyObject * +msvcrt_CrtSetReportMode(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + int type; + int mode; + long _return_value; + + if (!PyArg_ParseTuple(args, "ii:CrtSetReportMode", + &type, &mode)) + goto exit; + _return_value = msvcrt_CrtSetReportMode_impl(module, type, mode); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong(_return_value); + +exit: + return return_value; +} + +#endif /* defined(_DEBUG) */ + +#if defined(_DEBUG) + +PyDoc_STRVAR(msvcrt_set_error_mode__doc__, +"set_error_mode($module, mode, /)\n" +"--\n" +"\n" +"Wrapper around _set_error_mode.\n" +"\n" +"Only available on Debug builds."); + +#define MSVCRT_SET_ERROR_MODE_METHODDEF \ + {"set_error_mode", (PyCFunction)msvcrt_set_error_mode, METH_O, msvcrt_set_error_mode__doc__}, + +static long +msvcrt_set_error_mode_impl(PyModuleDef *module, int mode); + +static PyObject * +msvcrt_set_error_mode(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int mode; + long _return_value; + + if (!PyArg_Parse(arg, "i:set_error_mode", &mode)) + goto exit; + _return_value = msvcrt_set_error_mode_impl(module, mode); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong(_return_value); + +exit: + return return_value; +} + +#endif /* defined(_DEBUG) */ + +PyDoc_STRVAR(msvcrt_SetErrorMode__doc__, +"SetErrorMode($module, mode, /)\n" +"--\n" +"\n" +"Wrapper around SetErrorMode."); + +#define MSVCRT_SETERRORMODE_METHODDEF \ + {"SetErrorMode", (PyCFunction)msvcrt_SetErrorMode, METH_O, msvcrt_SetErrorMode__doc__}, + +static PyObject * +msvcrt_SetErrorMode_impl(PyModuleDef *module, unsigned int mode); + +static PyObject * +msvcrt_SetErrorMode(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + unsigned int mode; + + if (!PyArg_Parse(arg, "I:SetErrorMode", &mode)) + goto exit; + return_value = msvcrt_SetErrorMode_impl(module, mode); + +exit: + return return_value; +} + +#ifndef MSVCRT_CRTSETREPORTFILE_METHODDEF + #define MSVCRT_CRTSETREPORTFILE_METHODDEF +#endif /* !defined(MSVCRT_CRTSETREPORTFILE_METHODDEF) */ + +#ifndef MSVCRT_CRTSETREPORTMODE_METHODDEF + #define MSVCRT_CRTSETREPORTMODE_METHODDEF +#endif /* !defined(MSVCRT_CRTSETREPORTMODE_METHODDEF) */ + +#ifndef MSVCRT_SET_ERROR_MODE_METHODDEF + #define MSVCRT_SET_ERROR_MODE_METHODDEF +#endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */ +/*[clinic end generated code: output=16613d3119a1fd44 input=a9049054013a1b77]*/ diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h new file mode 100644 index 0000000..22b332f --- /dev/null +++ b/PC/clinic/winreg.c.h @@ -0,0 +1,1059 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(winreg_HKEYType_Close__doc__, +"Close($self, /)\n" +"--\n" +"\n" +"Closes the underlying Windows handle.\n" +"\n" +"If the handle is already closed, no error is raised."); + +#define WINREG_HKEYTYPE_CLOSE_METHODDEF \ + {"Close", (PyCFunction)winreg_HKEYType_Close, METH_NOARGS, winreg_HKEYType_Close__doc__}, + +static PyObject * +winreg_HKEYType_Close_impl(PyHKEYObject *self); + +static PyObject * +winreg_HKEYType_Close(PyHKEYObject *self, PyObject *Py_UNUSED(ignored)) +{ + return winreg_HKEYType_Close_impl(self); +} + +PyDoc_STRVAR(winreg_HKEYType_Detach__doc__, +"Detach($self, /)\n" +"--\n" +"\n" +"Detaches the Windows handle from the handle object.\n" +"\n" +"The result is the value of the handle before it is detached. If the\n" +"handle is already detached, this will return zero.\n" +"\n" +"After calling this function, the handle is effectively invalidated,\n" +"but the handle is not closed. You would call this function when you\n" +"need the underlying win32 handle to exist beyond the lifetime of the\n" +"handle object."); + +#define WINREG_HKEYTYPE_DETACH_METHODDEF \ + {"Detach", (PyCFunction)winreg_HKEYType_Detach, METH_NOARGS, winreg_HKEYType_Detach__doc__}, + +static PyObject * +winreg_HKEYType_Detach_impl(PyHKEYObject *self); + +static PyObject * +winreg_HKEYType_Detach(PyHKEYObject *self, PyObject *Py_UNUSED(ignored)) +{ + return winreg_HKEYType_Detach_impl(self); +} + +PyDoc_STRVAR(winreg_HKEYType___enter____doc__, +"__enter__($self, /)\n" +"--\n" +"\n"); + +#define WINREG_HKEYTYPE___ENTER___METHODDEF \ + {"__enter__", (PyCFunction)winreg_HKEYType___enter__, METH_NOARGS, winreg_HKEYType___enter____doc__}, + +static PyHKEYObject * +winreg_HKEYType___enter___impl(PyHKEYObject *self); + +static PyObject * +winreg_HKEYType___enter__(PyHKEYObject *self, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + PyHKEYObject *_return_value; + + _return_value = winreg_HKEYType___enter___impl(self); + return_value = (PyObject *)_return_value; + + return return_value; +} + +PyDoc_STRVAR(winreg_HKEYType___exit____doc__, +"__exit__($self, /, exc_type, exc_value, traceback)\n" +"--\n" +"\n"); + +#define WINREG_HKEYTYPE___EXIT___METHODDEF \ + {"__exit__", (PyCFunction)winreg_HKEYType___exit__, METH_VARARGS|METH_KEYWORDS, winreg_HKEYType___exit____doc__}, + +static PyObject * +winreg_HKEYType___exit___impl(PyHKEYObject *self, PyObject *exc_type, + PyObject *exc_value, PyObject *traceback); + +static PyObject * +winreg_HKEYType___exit__(PyHKEYObject *self, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static char *_keywords[] = {"exc_type", "exc_value", "traceback", NULL}; + PyObject *exc_type; + PyObject *exc_value; + PyObject *traceback; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:__exit__", _keywords, + &exc_type, &exc_value, &traceback)) + goto exit; + return_value = winreg_HKEYType___exit___impl(self, exc_type, exc_value, traceback); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_CloseKey__doc__, +"CloseKey($module, hkey, /)\n" +"--\n" +"\n" +"Closes a previously opened registry key.\n" +"\n" +" hkey\n" +" A previously opened key.\n" +"\n" +"Note that if the key is not closed using this method, it will be\n" +"closed when the hkey object is destroyed by Python."); + +#define WINREG_CLOSEKEY_METHODDEF \ + {"CloseKey", (PyCFunction)winreg_CloseKey, METH_O, winreg_CloseKey__doc__}, + +PyDoc_STRVAR(winreg_ConnectRegistry__doc__, +"ConnectRegistry($module, computer_name, key, /)\n" +"--\n" +"\n" +"Establishes a connection to the registry on on another computer.\n" +"\n" +" computer_name\n" +" The name of the remote computer, of the form r\"\\\\computername\". If\n" +" None, the local computer is used.\n" +" key\n" +" The predefined key to connect to.\n" +"\n" +"The return value is the handle of the opened key.\n" +"If the function fails, an OSError exception is raised."); + +#define WINREG_CONNECTREGISTRY_METHODDEF \ + {"ConnectRegistry", (PyCFunction)winreg_ConnectRegistry, METH_VARARGS, winreg_ConnectRegistry__doc__}, + +static HKEY +winreg_ConnectRegistry_impl(PyModuleDef *module, Py_UNICODE *computer_name, + HKEY key); + +static PyObject * +winreg_ConnectRegistry(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + Py_UNICODE *computer_name; + HKEY key; + HKEY _return_value; + + if (!PyArg_ParseTuple(args, "ZO&:ConnectRegistry", + &computer_name, clinic_HKEY_converter, &key)) + goto exit; + _return_value = winreg_ConnectRegistry_impl(module, computer_name, key); + if (_return_value == NULL) + goto exit; + return_value = PyHKEY_FromHKEY(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_CreateKey__doc__, +"CreateKey($module, key, sub_key, /)\n" +"--\n" +"\n" +"Creates or opens the specified key.\n" +"\n" +" key\n" +" An already open key, or one of the predefined HKEY_* constants.\n" +" sub_key\n" +" The name of the key this method opens or creates.\n" +"\n" +"If key is one of the predefined keys, sub_key may be None. In that case,\n" +"the handle returned is the same key handle passed in to the function.\n" +"\n" +"If the key already exists, this function opens the existing key.\n" +"\n" +"The return value is the handle of the opened key.\n" +"If the function fails, an OSError exception is raised."); + +#define WINREG_CREATEKEY_METHODDEF \ + {"CreateKey", (PyCFunction)winreg_CreateKey, METH_VARARGS, winreg_CreateKey__doc__}, + +static HKEY +winreg_CreateKey_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key); + +static PyObject * +winreg_CreateKey(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *sub_key; + HKEY _return_value; + + if (!PyArg_ParseTuple(args, "O&Z:CreateKey", + clinic_HKEY_converter, &key, &sub_key)) + goto exit; + _return_value = winreg_CreateKey_impl(module, key, sub_key); + if (_return_value == NULL) + goto exit; + return_value = PyHKEY_FromHKEY(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_CreateKeyEx__doc__, +"CreateKeyEx($module, /, key, sub_key, reserved=0,\n" +" access=winreg.KEY_WRITE)\n" +"--\n" +"\n" +"Creates or opens the specified key.\n" +"\n" +" key\n" +" An already open key, or one of the predefined HKEY_* constants.\n" +" sub_key\n" +" The name of the key this method opens or creates.\n" +" reserved\n" +" A reserved integer, and must be zero. Default is zero.\n" +" access\n" +" An integer that specifies an access mask that describes the\n" +" desired security access for the key. Default is KEY_WRITE.\n" +"\n" +"If key is one of the predefined keys, sub_key may be None. In that case,\n" +"the handle returned is the same key handle passed in to the function.\n" +"\n" +"If the key already exists, this function opens the existing key\n" +"\n" +"The return value is the handle of the opened key.\n" +"If the function fails, an OSError exception is raised."); + +#define WINREG_CREATEKEYEX_METHODDEF \ + {"CreateKeyEx", (PyCFunction)winreg_CreateKeyEx, METH_VARARGS|METH_KEYWORDS, winreg_CreateKeyEx__doc__}, + +static HKEY +winreg_CreateKeyEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key, + int reserved, REGSAM access); + +static PyObject * +winreg_CreateKeyEx(PyModuleDef *module, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static char *_keywords[] = {"key", "sub_key", "reserved", "access", NULL}; + HKEY key; + Py_UNICODE *sub_key; + int reserved = 0; + REGSAM access = KEY_WRITE; + HKEY _return_value; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&Z|ii:CreateKeyEx", _keywords, + clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) + goto exit; + _return_value = winreg_CreateKeyEx_impl(module, key, sub_key, reserved, access); + if (_return_value == NULL) + goto exit; + return_value = PyHKEY_FromHKEY(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_DeleteKey__doc__, +"DeleteKey($module, key, sub_key, /)\n" +"--\n" +"\n" +"Deletes the specified key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that must be the name of a subkey of the key identified by\n" +" the key parameter. This value must not be None, and the key may not\n" +" have subkeys.\n" +"\n" +"This method can not delete keys with subkeys.\n" +"\n" +"If the function succeeds, the entire key, including all of its values,\n" +"is removed. If the function fails, an OSError exception is raised."); + +#define WINREG_DELETEKEY_METHODDEF \ + {"DeleteKey", (PyCFunction)winreg_DeleteKey, METH_VARARGS, winreg_DeleteKey__doc__}, + +static PyObject * +winreg_DeleteKey_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key); + +static PyObject * +winreg_DeleteKey(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *sub_key; + + if (!PyArg_ParseTuple(args, "O&u:DeleteKey", + clinic_HKEY_converter, &key, &sub_key)) + goto exit; + return_value = winreg_DeleteKey_impl(module, key, sub_key); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_DeleteKeyEx__doc__, +"DeleteKeyEx($module, /, key, sub_key, access=winreg.KEY_WOW64_64KEY,\n" +" reserved=0)\n" +"--\n" +"\n" +"Deletes the specified key (64-bit OS only).\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that must be the name of a subkey of the key identified by\n" +" the key parameter. This value must not be None, and the key may not\n" +" have subkeys.\n" +" access\n" +" An integer that specifies an access mask that describes the\n" +" desired security access for the key. Default is KEY_WOW64_64KEY.\n" +" reserved\n" +" A reserved integer, and must be zero. Default is zero.\n" +"\n" +"This method can not delete keys with subkeys.\n" +"\n" +"If the function succeeds, the entire key, including all of its values,\n" +"is removed. If the function fails, an OSError exception is raised.\n" +"On unsupported Windows versions, NotImplementedError is raised."); + +#define WINREG_DELETEKEYEX_METHODDEF \ + {"DeleteKeyEx", (PyCFunction)winreg_DeleteKeyEx, METH_VARARGS|METH_KEYWORDS, winreg_DeleteKeyEx__doc__}, + +static PyObject * +winreg_DeleteKeyEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key, + REGSAM access, int reserved); + +static PyObject * +winreg_DeleteKeyEx(PyModuleDef *module, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static char *_keywords[] = {"key", "sub_key", "access", "reserved", NULL}; + HKEY key; + Py_UNICODE *sub_key; + REGSAM access = KEY_WOW64_64KEY; + int reserved = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&u|ii:DeleteKeyEx", _keywords, + clinic_HKEY_converter, &key, &sub_key, &access, &reserved)) + goto exit; + return_value = winreg_DeleteKeyEx_impl(module, key, sub_key, access, reserved); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_DeleteValue__doc__, +"DeleteValue($module, key, value, /)\n" +"--\n" +"\n" +"Removes a named value from a registry key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" value\n" +" A string that identifies the value to remove."); + +#define WINREG_DELETEVALUE_METHODDEF \ + {"DeleteValue", (PyCFunction)winreg_DeleteValue, METH_VARARGS, winreg_DeleteValue__doc__}, + +static PyObject * +winreg_DeleteValue_impl(PyModuleDef *module, HKEY key, Py_UNICODE *value); + +static PyObject * +winreg_DeleteValue(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *value; + + if (!PyArg_ParseTuple(args, "O&Z:DeleteValue", + clinic_HKEY_converter, &key, &value)) + goto exit; + return_value = winreg_DeleteValue_impl(module, key, value); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_EnumKey__doc__, +"EnumKey($module, key, index, /)\n" +"--\n" +"\n" +"Enumerates subkeys of an open registry key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" index\n" +" An integer that identifies the index of the key to retrieve.\n" +"\n" +"The function retrieves the name of one subkey each time it is called.\n" +"It is typically called repeatedly until an OSError exception is\n" +"raised, indicating no more values are available."); + +#define WINREG_ENUMKEY_METHODDEF \ + {"EnumKey", (PyCFunction)winreg_EnumKey, METH_VARARGS, winreg_EnumKey__doc__}, + +static PyObject * +winreg_EnumKey_impl(PyModuleDef *module, HKEY key, int index); + +static PyObject * +winreg_EnumKey(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + int index; + + if (!PyArg_ParseTuple(args, "O&i:EnumKey", + clinic_HKEY_converter, &key, &index)) + goto exit; + return_value = winreg_EnumKey_impl(module, key, index); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_EnumValue__doc__, +"EnumValue($module, key, index, /)\n" +"--\n" +"\n" +"Enumerates values of an open registry key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" index\n" +" An integer that identifies the index of the value to retrieve.\n" +"\n" +"The function retrieves the name of one subkey each time it is called.\n" +"It is typically called repeatedly, until an OSError exception\n" +"is raised, indicating no more values.\n" +"\n" +"The result is a tuple of 3 items:\n" +" value_name\n" +" A string that identifies the value.\n" +" value_data\n" +" An object that holds the value data, and whose type depends\n" +" on the underlying registry type.\n" +" data_type\n" +" An integer that identifies the type of the value data."); + +#define WINREG_ENUMVALUE_METHODDEF \ + {"EnumValue", (PyCFunction)winreg_EnumValue, METH_VARARGS, winreg_EnumValue__doc__}, + +static PyObject * +winreg_EnumValue_impl(PyModuleDef *module, HKEY key, int index); + +static PyObject * +winreg_EnumValue(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + int index; + + if (!PyArg_ParseTuple(args, "O&i:EnumValue", + clinic_HKEY_converter, &key, &index)) + goto exit; + return_value = winreg_EnumValue_impl(module, key, index); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_ExpandEnvironmentStrings__doc__, +"ExpandEnvironmentStrings($module, string, /)\n" +"--\n" +"\n" +"Expand environment vars."); + +#define WINREG_EXPANDENVIRONMENTSTRINGS_METHODDEF \ + {"ExpandEnvironmentStrings", (PyCFunction)winreg_ExpandEnvironmentStrings, METH_O, winreg_ExpandEnvironmentStrings__doc__}, + +static PyObject * +winreg_ExpandEnvironmentStrings_impl(PyModuleDef *module, Py_UNICODE *string); + +static PyObject * +winreg_ExpandEnvironmentStrings(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + Py_UNICODE *string; + + if (!PyArg_Parse(arg, "u:ExpandEnvironmentStrings", &string)) + goto exit; + return_value = winreg_ExpandEnvironmentStrings_impl(module, string); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_FlushKey__doc__, +"FlushKey($module, key, /)\n" +"--\n" +"\n" +"Writes all the attributes of a key to the registry.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +"\n" +"It is not necessary to call FlushKey to change a key. Registry changes\n" +"are flushed to disk by the registry using its lazy flusher. Registry\n" +"changes are also flushed to disk at system shutdown. Unlike\n" +"CloseKey(), the FlushKey() method returns only when all the data has\n" +"been written to the registry.\n" +"\n" +"An application should only call FlushKey() if it requires absolute\n" +"certainty that registry changes are on disk. If you don\'t know whether\n" +"a FlushKey() call is required, it probably isn\'t."); + +#define WINREG_FLUSHKEY_METHODDEF \ + {"FlushKey", (PyCFunction)winreg_FlushKey, METH_O, winreg_FlushKey__doc__}, + +static PyObject * +winreg_FlushKey_impl(PyModuleDef *module, HKEY key); + +static PyObject * +winreg_FlushKey(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + HKEY key; + + if (!PyArg_Parse(arg, "O&:FlushKey", clinic_HKEY_converter, &key)) + goto exit; + return_value = winreg_FlushKey_impl(module, key); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_LoadKey__doc__, +"LoadKey($module, key, sub_key, file_name, /)\n" +"--\n" +"\n" +"Insert data into the registry from a file.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that identifies the sub-key to load.\n" +" file_name\n" +" The name of the file to load registry data from. This file must\n" +" have been created with the SaveKey() function. Under the file\n" +" allocation table (FAT) file system, the filename may not have an\n" +" extension.\n" +"\n" +"Creates a subkey under the specified key and stores registration\n" +"information from a specified file into that subkey.\n" +"\n" +"A call to LoadKey() fails if the calling process does not have the\n" +"SE_RESTORE_PRIVILEGE privilege.\n" +"\n" +"If key is a handle returned by ConnectRegistry(), then the path\n" +"specified in fileName is relative to the remote computer.\n" +"\n" +"The MSDN docs imply key must be in the HKEY_USER or HKEY_LOCAL_MACHINE\n" +"tree."); + +#define WINREG_LOADKEY_METHODDEF \ + {"LoadKey", (PyCFunction)winreg_LoadKey, METH_VARARGS, winreg_LoadKey__doc__}, + +static PyObject * +winreg_LoadKey_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key, + Py_UNICODE *file_name); + +static PyObject * +winreg_LoadKey(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *sub_key; + Py_UNICODE *file_name; + + if (!PyArg_ParseTuple(args, "O&uu:LoadKey", + clinic_HKEY_converter, &key, &sub_key, &file_name)) + goto exit; + return_value = winreg_LoadKey_impl(module, key, sub_key, file_name); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_OpenKey__doc__, +"OpenKey($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n" +"--\n" +"\n" +"Opens the specified key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that identifies the sub_key to open.\n" +" reserved\n" +" A reserved integer that must be zero. Default is zero.\n" +" access\n" +" An integer that specifies an access mask that describes the desired\n" +" security access for the key. Default is KEY_READ.\n" +"\n" +"The result is a new handle to the specified key.\n" +"If the function fails, an OSError exception is raised."); + +#define WINREG_OPENKEY_METHODDEF \ + {"OpenKey", (PyCFunction)winreg_OpenKey, METH_VARARGS|METH_KEYWORDS, winreg_OpenKey__doc__}, + +static HKEY +winreg_OpenKey_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key, + int reserved, REGSAM access); + +static PyObject * +winreg_OpenKey(PyModuleDef *module, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static char *_keywords[] = {"key", "sub_key", "reserved", "access", NULL}; + HKEY key; + Py_UNICODE *sub_key; + int reserved = 0; + REGSAM access = KEY_READ; + HKEY _return_value; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&Z|ii:OpenKey", _keywords, + clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) + goto exit; + _return_value = winreg_OpenKey_impl(module, key, sub_key, reserved, access); + if (_return_value == NULL) + goto exit; + return_value = PyHKEY_FromHKEY(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_OpenKeyEx__doc__, +"OpenKeyEx($module, /, key, sub_key, reserved=0, access=winreg.KEY_READ)\n" +"--\n" +"\n" +"Opens the specified key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that identifies the sub_key to open.\n" +" reserved\n" +" A reserved integer that must be zero. Default is zero.\n" +" access\n" +" An integer that specifies an access mask that describes the desired\n" +" security access for the key. Default is KEY_READ.\n" +"\n" +"The result is a new handle to the specified key.\n" +"If the function fails, an OSError exception is raised."); + +#define WINREG_OPENKEYEX_METHODDEF \ + {"OpenKeyEx", (PyCFunction)winreg_OpenKeyEx, METH_VARARGS|METH_KEYWORDS, winreg_OpenKeyEx__doc__}, + +static HKEY +winreg_OpenKeyEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key, + int reserved, REGSAM access); + +static PyObject * +winreg_OpenKeyEx(PyModuleDef *module, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static char *_keywords[] = {"key", "sub_key", "reserved", "access", NULL}; + HKEY key; + Py_UNICODE *sub_key; + int reserved = 0; + REGSAM access = KEY_READ; + HKEY _return_value; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&Z|ii:OpenKeyEx", _keywords, + clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) + goto exit; + _return_value = winreg_OpenKeyEx_impl(module, key, sub_key, reserved, access); + if (_return_value == NULL) + goto exit; + return_value = PyHKEY_FromHKEY(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_QueryInfoKey__doc__, +"QueryInfoKey($module, key, /)\n" +"--\n" +"\n" +"Returns information about a key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +"\n" +"The result is a tuple of 3 items:\n" +"An integer that identifies the number of sub keys this key has.\n" +"An integer that identifies the number of values this key has.\n" +"An integer that identifies when the key was last modified (if available)\n" +"as 100\'s of nanoseconds since Jan 1, 1600."); + +#define WINREG_QUERYINFOKEY_METHODDEF \ + {"QueryInfoKey", (PyCFunction)winreg_QueryInfoKey, METH_O, winreg_QueryInfoKey__doc__}, + +static PyObject * +winreg_QueryInfoKey_impl(PyModuleDef *module, HKEY key); + +static PyObject * +winreg_QueryInfoKey(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + HKEY key; + + if (!PyArg_Parse(arg, "O&:QueryInfoKey", clinic_HKEY_converter, &key)) + goto exit; + return_value = winreg_QueryInfoKey_impl(module, key); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_QueryValue__doc__, +"QueryValue($module, key, sub_key, /)\n" +"--\n" +"\n" +"Retrieves the unnamed value for a key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that holds the name of the subkey with which the value\n" +" is associated. If this parameter is None or empty, the function\n" +" retrieves the value set by the SetValue() method for the key\n" +" identified by key.\n" +"\n" +"Values in the registry have name, type, and data components. This method\n" +"retrieves the data for a key\'s first value that has a NULL name.\n" +"But since the underlying API call doesn\'t return the type, you\'ll\n" +"probably be happier using QueryValueEx; this function is just here for\n" +"completeness."); + +#define WINREG_QUERYVALUE_METHODDEF \ + {"QueryValue", (PyCFunction)winreg_QueryValue, METH_VARARGS, winreg_QueryValue__doc__}, + +static PyObject * +winreg_QueryValue_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key); + +static PyObject * +winreg_QueryValue(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *sub_key; + + if (!PyArg_ParseTuple(args, "O&Z:QueryValue", + clinic_HKEY_converter, &key, &sub_key)) + goto exit; + return_value = winreg_QueryValue_impl(module, key, sub_key); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_QueryValueEx__doc__, +"QueryValueEx($module, key, name, /)\n" +"--\n" +"\n" +"Retrieves the type and value of a specified sub-key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" name\n" +" A string indicating the value to query.\n" +"\n" +"Behaves mostly like QueryValue(), but also returns the type of the\n" +"specified value name associated with the given open registry key.\n" +"\n" +"The return value is a tuple of the value and the type_id."); + +#define WINREG_QUERYVALUEEX_METHODDEF \ + {"QueryValueEx", (PyCFunction)winreg_QueryValueEx, METH_VARARGS, winreg_QueryValueEx__doc__}, + +static PyObject * +winreg_QueryValueEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *name); + +static PyObject * +winreg_QueryValueEx(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *name; + + if (!PyArg_ParseTuple(args, "O&Z:QueryValueEx", + clinic_HKEY_converter, &key, &name)) + goto exit; + return_value = winreg_QueryValueEx_impl(module, key, name); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_SaveKey__doc__, +"SaveKey($module, key, file_name, /)\n" +"--\n" +"\n" +"Saves the specified key, and all its subkeys to the specified file.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" file_name\n" +" The name of the file to save registry data to. This file cannot\n" +" already exist. If this filename includes an extension, it cannot be\n" +" used on file allocation table (FAT) file systems by the LoadKey(),\n" +" ReplaceKey() or RestoreKey() methods.\n" +"\n" +"If key represents a key on a remote computer, the path described by\n" +"file_name is relative to the remote computer.\n" +"\n" +"The caller of this method must possess the SeBackupPrivilege\n" +"security privilege. This function passes NULL for security_attributes\n" +"to the API."); + +#define WINREG_SAVEKEY_METHODDEF \ + {"SaveKey", (PyCFunction)winreg_SaveKey, METH_VARARGS, winreg_SaveKey__doc__}, + +static PyObject * +winreg_SaveKey_impl(PyModuleDef *module, HKEY key, Py_UNICODE *file_name); + +static PyObject * +winreg_SaveKey(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *file_name; + + if (!PyArg_ParseTuple(args, "O&u:SaveKey", + clinic_HKEY_converter, &key, &file_name)) + goto exit; + return_value = winreg_SaveKey_impl(module, key, file_name); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_SetValue__doc__, +"SetValue($module, key, sub_key, type, value, /)\n" +"--\n" +"\n" +"Associates a value with a specified key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" sub_key\n" +" A string that names the subkey with which the value is associated.\n" +" type\n" +" An integer that specifies the type of the data. Currently this must\n" +" be REG_SZ, meaning only strings are supported.\n" +" value\n" +" A string that specifies the new value.\n" +"\n" +"If the key specified by the sub_key parameter does not exist, the\n" +"SetValue function creates it.\n" +"\n" +"Value lengths are limited by available memory. Long values (more than\n" +"2048 bytes) should be stored as files with the filenames stored in\n" +"the configuration registry to help the registry perform efficiently.\n" +"\n" +"The key identified by the key parameter must have been opened with\n" +"KEY_SET_VALUE access."); + +#define WINREG_SETVALUE_METHODDEF \ + {"SetValue", (PyCFunction)winreg_SetValue, METH_VARARGS, winreg_SetValue__doc__}, + +static PyObject * +winreg_SetValue_impl(PyModuleDef *module, HKEY key, Py_UNICODE *sub_key, + DWORD type, Py_UNICODE *value, + Py_ssize_clean_t value_length); + +static PyObject * +winreg_SetValue(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *sub_key; + DWORD type; + Py_UNICODE *value; + Py_ssize_clean_t value_length; + + if (!PyArg_ParseTuple(args, "O&Zku#:SetValue", + clinic_HKEY_converter, &key, &sub_key, &type, &value, &value_length)) + goto exit; + return_value = winreg_SetValue_impl(module, key, sub_key, type, value, value_length); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_SetValueEx__doc__, +"SetValueEx($module, key, value_name, reserved, type, value, /)\n" +"--\n" +"\n" +"Stores data in the value field of an open registry key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +" value_name\n" +" A string containing the name of the value to set, or None.\n" +" reserved\n" +" Can be anything - zero is always passed to the API.\n" +" type\n" +" An integer that specifies the type of the data, one of:\n" +" REG_BINARY -- Binary data in any form.\n" +" REG_DWORD -- A 32-bit number.\n" +" REG_DWORD_LITTLE_ENDIAN -- A 32-bit number in little-endian format.\n" +" REG_DWORD_BIG_ENDIAN -- A 32-bit number in big-endian format.\n" +" REG_EXPAND_SZ -- A null-terminated string that contains unexpanded\n" +" references to environment variables (for example,\n" +" %PATH%).\n" +" REG_LINK -- A Unicode symbolic link.\n" +" REG_MULTI_SZ -- An sequence of null-terminated strings, terminated\n" +" by two null characters. Note that Python handles\n" +" this termination automatically.\n" +" REG_NONE -- No defined value type.\n" +" REG_RESOURCE_LIST -- A device-driver resource list.\n" +" REG_SZ -- A null-terminated string.\n" +" value\n" +" A string that specifies the new value.\n" +"\n" +"This method can also set additional value and type information for the\n" +"specified key. The key identified by the key parameter must have been\n" +"opened with KEY_SET_VALUE access.\n" +"\n" +"To open the key, use the CreateKeyEx() or OpenKeyEx() methods.\n" +"\n" +"Value lengths are limited by available memory. Long values (more than\n" +"2048 bytes) should be stored as files with the filenames stored in\n" +"the configuration registry to help the registry perform efficiently."); + +#define WINREG_SETVALUEEX_METHODDEF \ + {"SetValueEx", (PyCFunction)winreg_SetValueEx, METH_VARARGS, winreg_SetValueEx__doc__}, + +static PyObject * +winreg_SetValueEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *value_name, + PyObject *reserved, DWORD type, PyObject *value); + +static PyObject * +winreg_SetValueEx(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + HKEY key; + Py_UNICODE *value_name; + PyObject *reserved; + DWORD type; + PyObject *value; + + if (!PyArg_ParseTuple(args, "O&ZOkO:SetValueEx", + clinic_HKEY_converter, &key, &value_name, &reserved, &type, &value)) + goto exit; + return_value = winreg_SetValueEx_impl(module, key, value_name, reserved, type, value); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_DisableReflectionKey__doc__, +"DisableReflectionKey($module, key, /)\n" +"--\n" +"\n" +"Disables registry reflection for 32bit processes running on a 64bit OS.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +"\n" +"Will generally raise NotImplemented if executed on a 32bit OS.\n" +"\n" +"If the key is not on the reflection list, the function succeeds but has\n" +"no effect. Disabling reflection for a key does not affect reflection\n" +"of any subkeys."); + +#define WINREG_DISABLEREFLECTIONKEY_METHODDEF \ + {"DisableReflectionKey", (PyCFunction)winreg_DisableReflectionKey, METH_O, winreg_DisableReflectionKey__doc__}, + +static PyObject * +winreg_DisableReflectionKey_impl(PyModuleDef *module, HKEY key); + +static PyObject * +winreg_DisableReflectionKey(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + HKEY key; + + if (!PyArg_Parse(arg, "O&:DisableReflectionKey", clinic_HKEY_converter, &key)) + goto exit; + return_value = winreg_DisableReflectionKey_impl(module, key); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_EnableReflectionKey__doc__, +"EnableReflectionKey($module, key, /)\n" +"--\n" +"\n" +"Restores registry reflection for the specified disabled key.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +"\n" +"Will generally raise NotImplemented if executed on a 32bit OS.\n" +"Restoring reflection for a key does not affect reflection of any\n" +"subkeys."); + +#define WINREG_ENABLEREFLECTIONKEY_METHODDEF \ + {"EnableReflectionKey", (PyCFunction)winreg_EnableReflectionKey, METH_O, winreg_EnableReflectionKey__doc__}, + +static PyObject * +winreg_EnableReflectionKey_impl(PyModuleDef *module, HKEY key); + +static PyObject * +winreg_EnableReflectionKey(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + HKEY key; + + if (!PyArg_Parse(arg, "O&:EnableReflectionKey", clinic_HKEY_converter, &key)) + goto exit; + return_value = winreg_EnableReflectionKey_impl(module, key); + +exit: + return return_value; +} + +PyDoc_STRVAR(winreg_QueryReflectionKey__doc__, +"QueryReflectionKey($module, key, /)\n" +"--\n" +"\n" +"Returns the reflection state for the specified key as a bool.\n" +"\n" +" key\n" +" An already open key, or any one of the predefined HKEY_* constants.\n" +"\n" +"Will generally raise NotImplemented if executed on a 32bit OS."); + +#define WINREG_QUERYREFLECTIONKEY_METHODDEF \ + {"QueryReflectionKey", (PyCFunction)winreg_QueryReflectionKey, METH_O, winreg_QueryReflectionKey__doc__}, + +static PyObject * +winreg_QueryReflectionKey_impl(PyModuleDef *module, HKEY key); + +static PyObject * +winreg_QueryReflectionKey(PyModuleDef *module, PyObject *arg) +{ + PyObject *return_value = NULL; + HKEY key; + + if (!PyArg_Parse(arg, "O&:QueryReflectionKey", clinic_HKEY_converter, &key)) + goto exit; + return_value = winreg_QueryReflectionKey_impl(module, key); + +exit: + return return_value; +} +/*[clinic end generated code: output=71f5bc30b646807b input=a9049054013a1b77]*/ diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h new file mode 100644 index 0000000..dca5a42 --- /dev/null +++ b/PC/clinic/winsound.c.h @@ -0,0 +1,100 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(winsound_PlaySound__doc__, +"PlaySound($module, sound, flags, /)\n" +"--\n" +"\n" +"A wrapper around the Windows PlaySound API.\n" +"\n" +" sound\n" +" The sound to play; a filename, data, or None.\n" +" flags\n" +" Flag values, ored together. See module documentation."); + +#define WINSOUND_PLAYSOUND_METHODDEF \ + {"PlaySound", (PyCFunction)winsound_PlaySound, METH_VARARGS, winsound_PlaySound__doc__}, + +static PyObject * +winsound_PlaySound_impl(PyModuleDef *module, Py_UNICODE *sound, int flags); + +static PyObject * +winsound_PlaySound(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + Py_UNICODE *sound; + int flags; + + if (!PyArg_ParseTuple(args, "Zi:PlaySound", + &sound, &flags)) + goto exit; + return_value = winsound_PlaySound_impl(module, sound, flags); + +exit: + return return_value; +} + +PyDoc_STRVAR(winsound_Beep__doc__, +"Beep($module, frequency, duration, /)\n" +"--\n" +"\n" +"A wrapper around the Windows Beep API.\n" +"\n" +" frequency\n" +" Frequency of the sound in hertz.\n" +" Must be in the range 37 through 32,767.\n" +" duration\n" +" How long the sound should play, in milliseconds."); + +#define WINSOUND_BEEP_METHODDEF \ + {"Beep", (PyCFunction)winsound_Beep, METH_VARARGS, winsound_Beep__doc__}, + +static PyObject * +winsound_Beep_impl(PyModuleDef *module, int frequency, int duration); + +static PyObject * +winsound_Beep(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + int frequency; + int duration; + + if (!PyArg_ParseTuple(args, "ii:Beep", + &frequency, &duration)) + goto exit; + return_value = winsound_Beep_impl(module, frequency, duration); + +exit: + return return_value; +} + +PyDoc_STRVAR(winsound_MessageBeep__doc__, +"MessageBeep($module, x=MB_OK, /)\n" +"--\n" +"\n" +"Call Windows MessageBeep(x).\n" +"\n" +"x defaults to MB_OK."); + +#define WINSOUND_MESSAGEBEEP_METHODDEF \ + {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_VARARGS, winsound_MessageBeep__doc__}, + +static PyObject * +winsound_MessageBeep_impl(PyModuleDef *module, int x); + +static PyObject * +winsound_MessageBeep(PyModuleDef *module, PyObject *args) +{ + PyObject *return_value = NULL; + int x = MB_OK; + + if (!PyArg_ParseTuple(args, "|i:MessageBeep", + &x)) + goto exit; + return_value = winsound_MessageBeep_impl(module, x); + +exit: + return return_value; +} +/*[clinic end generated code: output=c5b018ac9dc1f500 input=a9049054013a1b77]*/ |