MCPcopy Create free account
hub / github.com/mhammond/pywin32 / PyServiceInitialize

Function PyServiceInitialize

win32/src/PythonService.cpp:448–468  ·  view source on GitHub ↗

@pymethod |servicemanager|Initialize|Initialize the module for hosting a service. This is generally called automatically

Source from the content-addressed store, hash-verified

446
447// @pymethod |servicemanager|Initialize|Initialize the module for hosting a service. This is generally called automatically
448static PyObject *PyServiceInitialize(PyObject *self, PyObject *args)
449{
450 PyObject *nameOb = Py_None, *fileOb = Py_None;
451 // @pyparm <o PyUnicode>|eventSourceName|None|The event source name
452 // @pyparm <o PyUnicode>|eventSourceFile|None|The name of the file
453 // (generally a DLL) with the event source messages.
454 if (!PyArg_ParseTuple(args, "|OO", &nameOb, &fileOb))
455 return NULL;
456 TCHAR *name, *file;
457 if (!PyWinObject_AsTCHAR(nameOb, &name, TRUE))
458 return NULL;
459 if (!PyWinObject_AsTCHAR(fileOb, &file, TRUE)) {
460 PyWinObject_FreeTCHAR(name);
461 return NULL;
462 }
463 PythonService_Initialize(name, file);
464 PyWinObject_FreeTCHAR(name);
465 PyWinObject_FreeTCHAR(file);
466 Py_INCREF(Py_None);
467 return Py_None;
468}
469
470// @pymethod |servicemanager|Finalize|
471static PyObject *PyServiceFinalize(PyObject *self)

Callers

nothing calls this directly

Calls 1

PythonService_InitializeFunction · 0.85

Tested by

no test coverage detected