DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK * pecb) { HSE_EXEC_URL_INFO ExecUrlInfo; DWORD cbData = INTERNET_MAX_URL_LENGTH; char url[INTERNET_MAX_URL_LENGTH]; axis2_bool_t is_for_us = AXIS2_TRUE; /* Get the URL */ if ( pecb->GetServerVariable( pecb->ConnID, "URL", url, &cbData ) == FALSE ) { return HSE_STATUS_ERROR; } if (!is_inited) { DWORD dwBufferSize = 0; axis2_char_t server_software[256]; axis2_char_t *version = NULL; ZeroMemory(szOriginalPath, sizeof szOriginalPath); dwBufferSize = sizeof szOriginalPath; #if _WIN32_WINNT >= 0x0502 GetDllDirectory( dwBufferSize, szOriginalPath ); #else GetCurrentDirectory( dwBufferSize, szOriginalPath ); #endif ZeroMemory(szPath, sizeof szPath); dwBufferSize = sizeof szPath; /* Get the current physical paht */ if (pecb->GetServerVariable(pecb->ConnID, "APPL_PHYSICAL_PATH", szPath, &dwBufferSize) == FALSE) { send_error(pecb, initializing_error); return HSE_STATUS_ERROR; } /* Retrieve the server version */ dwBufferSize = 32; if (pecb->GetServerVariable(pecb->ConnID, "SERVER_SOFTWARE", server_software, &dwBufferSize) == FALSE) { send_error(pecb, initializing_error); return HSE_STATUS_ERROR; } version = axutil_strchr(server_software, '/'); if (version) { server_version = atoi(version + 1); } #if _WIN32_WINNT >= 0x0502 SetDllDirectory( szPath ); #else SetCurrentDirectory( szPath ); #endif /* If we haven't initialized axis2/c before initialization failed */ if (AXIS2_FAILURE == init_axis2()) { send_error(pecb, initializing_error); return HSE_STATUS_ERROR; } #if _WIN32_WINNT >= 0x0502 SetDllDirectory( szOriginalPath ); #else SetCurrentDirectory( szOriginalPath ); #endif } /* Check weather we have a request for Axis2/C */ if (server_version >= 6 && strlen(url) >= strlen(axis2_location)) { int i = 0; is_for_us = AXIS2_TRUE; while (axis2_location[i] != '\0') { if (axis2_location[i] != (url)[i]) { is_for_us = AXIS2_FALSE; break; } i++; } if (url[i] != '/' && url[i] != '\0') { is_for_us = AXIS2_FALSE; } } if (is_for_us) { /* Windows cannot find the correct dlls unless the path is set*/ #if _WIN32_WINNT >= 0x0502 SetDllDirectory( szPath ); #else SetCurrentDirectory( szPath ); #endif pecb->dwHttpStatusCode = HTTP_INTERNAL_SERVER_ERROR; /* We are sure that worker is not NULL since it is NULL init_axis2 would have failed */ axis2_iis_worker_process_request(axis2_worker, axutil_env, pecb); /* Windows cannot find the correct dlls unless the dir is set but we want to reset to previous dir after the load */ #if _WIN32_WINNT >= 0x0502 SetDllDirectory( szOriginalPath ); #else SetCurrentDirectory( szOriginalPath ); #endif return HSE_STATUS_SUCCESS; } else if (server_version >= 6) { /* For IIS 5.1 or earlier this code is never executed. Since the URL is redirected to Axis2/C by the Filter */ /* If not for Axis2/C let the request go to who ever wants it */ ExecUrlInfo.pszUrl = NULL; /* Use original request URL */ ExecUrlInfo.pszMethod = NULL; /* Use original request method */ ExecUrlInfo.pszChildHeaders = NULL; /* Use original request headers */ ExecUrlInfo.pUserInfo = NULL; /* Use original request user info */ ExecUrlInfo.pEntity = NULL; /* Use original request entity */ /* Provent recursion */ ExecUrlInfo.dwExecUrlFlags = HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR; /* Associate the completion routine and the current URL with this request. */ if ( pecb->ServerSupportFunction( pecb->ConnID, HSE_REQ_IO_COMPLETION, ExecUrlCompletion, NULL, NULL) == FALSE ) { return HSE_STATUS_ERROR; } /* Ok, now that everything is set up, let's call the child request */ if ( pecb->ServerSupportFunction( pecb->ConnID, HSE_REQ_EXEC_URL, &ExecUrlInfo, NULL, NULL ) == FALSE ) { return HSE_STATUS_ERROR; } /* Return pending and let the completion clean up */ return HSE_STATUS_PENDING; } return HSE_STATUS_ERROR; }
SString SharedUtil::GetSystemDllDirectory ( void ) { char szResult [ 1024 ] = ""; GetDllDirectory ( sizeof ( szResult ), szResult ); return szResult; }