@@ -158,6 +158,13 @@ static PyTypeObject sp_handle_type = {
158158/* -------------------------------------------------------------------- */
159159/* windows API functions */
160160
161+ PyDoc_STRVAR (GetStdHandle_doc ,
162+ "GetStdHandle(handle) -> integer\n\
163+ \n\
164+ Return a handle to the specified standard device\n\
165+ (STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE).\n\
166+ The integer associated with the handle object is returned." );
167+
161168static PyObject *
162169sp_GetStdHandle (PyObject * self , PyObject * args )
163170{
@@ -183,6 +190,11 @@ sp_GetStdHandle(PyObject* self, PyObject* args)
183190 return HANDLE_TO_PYNUM (handle );
184191}
185192
193+ PyDoc_STRVAR (GetCurrentProcess_doc ,
194+ "GetCurrentProcess() -> handle\n\
195+ \n\
196+ Return a handle object for the current process." );
197+
186198static PyObject *
187199sp_GetCurrentProcess (PyObject * self , PyObject * args )
188200{
@@ -192,6 +204,17 @@ sp_GetCurrentProcess(PyObject* self, PyObject* args)
192204 return sp_handle_new (GetCurrentProcess ());
193205}
194206
207+ PyDoc_STRVAR (DuplicateHandle_doc ,
208+ "DuplicateHandle(source_proc_handle, source_handle,\n\
209+ target_proc_handle, target_handle, access,\n\
210+ inherit[, options]) -> handle\n\
211+ \n\
212+ Return a duplicate handle object.\n\
213+ \n\
214+ The duplicate handle refers to the same object as the original\n\
215+ handle. Therefore, any changes to the object are reflected\n\
216+ through both handles." );
217+
195218static PyObject *
196219sp_DuplicateHandle (PyObject * self , PyObject * args )
197220{
@@ -234,6 +257,14 @@ sp_DuplicateHandle(PyObject* self, PyObject* args)
234257 return sp_handle_new (target_handle );
235258}
236259
260+ PyDoc_STRVAR (CreatePipe_doc ,
261+ "CreatePipe(pipe_attrs, size) -> (read_handle, write_handle)\n\
262+ \n\
263+ Create an anonymous pipe, and return handles to the read and\n\
264+ write ends of the pipe.\n\
265+ \n\
266+ pipe_attrs is ignored internally and can be None." );
267+
237268static PyObject *
238269sp_CreatePipe (PyObject * self , PyObject * args )
239270{
@@ -369,6 +400,18 @@ getenvironment(PyObject* environment)
369400 return NULL ;
370401}
371402
403+ PyDoc_STRVAR (CreateProcess_doc ,
404+ "CreateProcess(app_name, cmd_line, proc_attrs, thread_attrs,\n\
405+ inherit, flags, env_mapping, curdir,\n\
406+ startup_info) -> (proc_handle, thread_handle,\n\
407+ pid, tid)\n\
408+ \n\
409+ Create a new process and its primary thread. The return\n\
410+ value is a tuple of the process handle, thread handle,\n\
411+ process ID, and thread ID.\n\
412+ \n\
413+ proc_attrs and thread_attrs are ignored internally and can be None." );
414+
372415static PyObject *
373416sp_CreateProcess (PyObject * self , PyObject * args )
374417{
@@ -445,6 +488,11 @@ sp_CreateProcess(PyObject* self, PyObject* args)
445488 pi .dwThreadId );
446489}
447490
491+ PyDoc_STRVAR (TerminateProcess_doc ,
492+ "TerminateProcess(handle, exit_code) -> None\n\
493+ \n\
494+ Terminate the specified process and all of its threads." );
495+
448496static PyObject *
449497sp_TerminateProcess (PyObject * self , PyObject * args )
450498{
@@ -465,6 +513,11 @@ sp_TerminateProcess(PyObject* self, PyObject* args)
465513 return Py_None ;
466514}
467515
516+ PyDoc_STRVAR (GetExitCodeProcess_doc ,
517+ "GetExitCodeProcess(handle) -> Exit code\n\
518+ \n\
519+ Return the termination status of the specified process." );
520+
468521static PyObject *
469522sp_GetExitCodeProcess (PyObject * self , PyObject * args )
470523{
@@ -483,6 +536,13 @@ sp_GetExitCodeProcess(PyObject* self, PyObject* args)
483536 return PyLong_FromLong (exit_code );
484537}
485538
539+ PyDoc_STRVAR (WaitForSingleObject_doc ,
540+ "WaitForSingleObject(handle, timeout) -> result\n\
541+ \n\
542+ Wait until the specified object is in the signaled state or\n\
543+ the time-out interval elapses. The timeout value is specified\n\
544+ in milliseconds." );
545+
486546static PyObject *
487547sp_WaitForSingleObject (PyObject * self , PyObject * args )
488548{
@@ -505,6 +565,11 @@ sp_WaitForSingleObject(PyObject* self, PyObject* args)
505565 return PyLong_FromLong ((int ) result );
506566}
507567
568+ PyDoc_STRVAR (GetVersion_doc ,
569+ "GetVersion() -> version\n\
570+ \n\
571+ Return the version number of the current operating system." );
572+
508573static PyObject *
509574sp_GetVersion (PyObject * self , PyObject * args )
510575{
@@ -514,6 +579,18 @@ sp_GetVersion(PyObject* self, PyObject* args)
514579 return PyLong_FromLong ((int ) GetVersion ());
515580}
516581
582+ PyDoc_STRVAR (GetModuleFileName_doc ,
583+ "GetModuleFileName(module) -> path\n\
584+ \n\
585+ Return the fully-qualified path for the file that contains\n\
586+ the specified module. The module must have been loaded by the\n\
587+ current process.\n\
588+ \n\
589+ The module parameter should be a handle to the loaded module\n\
590+ whose path is being requested. If this parameter is 0, \n\
591+ GetModuleFileName retrieves the path of the executable file\n\
592+ of the current process." );
593+
517594static PyObject *
518595sp_GetModuleFileName (PyObject * self , PyObject * args )
519596{
@@ -535,16 +612,22 @@ sp_GetModuleFileName(PyObject* self, PyObject* args)
535612}
536613
537614static PyMethodDef sp_functions [] = {
538- {"GetStdHandle" , sp_GetStdHandle , METH_VARARGS },
539- {"GetCurrentProcess" , sp_GetCurrentProcess , METH_VARARGS },
540- {"DuplicateHandle" , sp_DuplicateHandle , METH_VARARGS },
541- {"CreatePipe" , sp_CreatePipe , METH_VARARGS },
542- {"CreateProcess" , sp_CreateProcess , METH_VARARGS },
543- {"TerminateProcess" , sp_TerminateProcess , METH_VARARGS },
544- {"GetExitCodeProcess" , sp_GetExitCodeProcess , METH_VARARGS },
545- {"WaitForSingleObject" , sp_WaitForSingleObject , METH_VARARGS },
546- {"GetVersion" , sp_GetVersion , METH_VARARGS },
547- {"GetModuleFileName" , sp_GetModuleFileName , METH_VARARGS },
615+ {"GetStdHandle" , sp_GetStdHandle , METH_VARARGS , GetStdHandle_doc },
616+ {"GetCurrentProcess" , sp_GetCurrentProcess , METH_VARARGS ,
617+ GetCurrentProcess_doc },
618+ {"DuplicateHandle" , sp_DuplicateHandle , METH_VARARGS ,
619+ DuplicateHandle_doc },
620+ {"CreatePipe" , sp_CreatePipe , METH_VARARGS , CreatePipe_doc },
621+ {"CreateProcess" , sp_CreateProcess , METH_VARARGS , CreateProcess_doc },
622+ {"TerminateProcess" , sp_TerminateProcess , METH_VARARGS ,
623+ TerminateProcess_doc },
624+ {"GetExitCodeProcess" , sp_GetExitCodeProcess , METH_VARARGS ,
625+ GetExitCodeProcess_doc },
626+ {"WaitForSingleObject" , sp_WaitForSingleObject , METH_VARARGS ,
627+ WaitForSingleObject_doc },
628+ {"GetVersion" , sp_GetVersion , METH_VARARGS , GetVersion_doc },
629+ {"GetModuleFileName" , sp_GetModuleFileName , METH_VARARGS ,
630+ GetModuleFileName_doc },
548631 {NULL , NULL }
549632};
550633
0 commit comments