| 149 | } |
| 150 | |
| 151 | BOOL WINAPI GetFilterVersion(HTTP_FILTER_VERSION *pVer) |
| 152 | { |
| 153 | pVer->dwFilterVersion = HTTP_FILTER_REVISION; |
| 154 | // ensure our handler ready to go |
| 155 | if (!filterHandler.Init(&pyEngine, name_filter_factory, |
| 156 | name_filter_init, name_filter_do, name_filter_term)) |
| 157 | // error already reported. |
| 158 | return FALSE; |
| 159 | |
| 160 | CEnterLeavePython celp; |
| 161 | PyFILTER_VERSION *pyFV = new PyFILTER_VERSION(pVer); |
| 162 | PyObject *resultobject = filterHandler.Callback(HANDLER_INIT, "(N)", pyFV); |
| 163 | BOOL bRetStatus; |
| 164 | if (! resultobject) { |
| 165 | FilterError(NULL, "Filter version function failed!"); |
| 166 | bRetStatus = false; |
| 167 | } else { |
| 168 | if (resultobject == Py_None) |
| 169 | bRetStatus = TRUE; |
| 170 | else if (PyInt_Check(resultobject)) |
| 171 | bRetStatus = PyInt_AsLong(resultobject) ? true : false; |
| 172 | else { |
| 173 | FilterError(NULL, "Filter init should return an int, or None"); |
| 174 | bRetStatus = FALSE; |
| 175 | } |
| 176 | } |
| 177 | if (bRetStatus) |
| 178 | // We need the SF_NOTIFY_END_OF_NET_SESSION notification for cleanup |
| 179 | pVer->dwFlags |= SF_NOTIFY_END_OF_NET_SESSION; |
| 180 | Py_XDECREF(resultobject); |
| 181 | return bRetStatus; |
| 182 | } |
| 183 | |
| 184 | DWORD WINAPI HttpFilterProc(HTTP_FILTER_CONTEXT *phfc, DWORD NotificationType, VOID *pvData) |
| 185 | { |
nothing calls this directly
no test coverage detected