static HwcServer() { // Load the library and get the function pointers for the WebCore entry points IntPtr hwc = NativeMethods.LoadLibrary(hwebcoreDll); IntPtr procaddr = NativeMethods.GetProcAddress(hwc, "WebCoreActivate"); WebCoreActivate = (FnWebCoreActivate)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreActivate)); procaddr = NativeMethods.GetProcAddress(hwc, "WebCoreShutdown"); WebCoreShutdown = (FnWebCoreShutdown)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreShutdown)); }
static HostableWebCore() { // Load the library and get the function pointers for the WebCore entry points const string HWCPath = @"%windir%\system32\inetsrv\hwebcore.dll"; IntPtr hwc = NativeMethods.LoadLibrary(Environment.ExpandEnvironmentVariables(HWCPath)); IntPtr procaddr = NativeMethods.GetProcAddress(hwc, "WebCoreActivate"); WebCoreActivate = (FnWebCoreActivate)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreActivate)); procaddr = NativeMethods.GetProcAddress(hwc, "WebCoreShutdown"); WebCoreShutdown = (FnWebCoreShutdown)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreShutdown)); }
static HostableWebCore() { const string HWCPath = @"%windir%\system32\inetsrv\hwebcore.dll"; IntPtr hwc = NativeMethods.LoadLibrary(Environment.ExpandEnvironmentVariables(HWCPath)); IntPtr procaddr = NativeMethods.GetProcAddress(hwc, "WebCoreActivate"); WebCoreActivate = (FnWebCoreActivate)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreActivate)); procaddr = NativeMethods.GetProcAddress(hwc, "WebCoreShutdown"); WebCoreShutdown = (FnWebCoreShutdown)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreShutdown)); }
static HostableWebCore() { var hostableWebCorePath = Environment.ExpandEnvironmentVariables(HWCPath); if (!File.Exists(hostableWebCorePath)) { throw new FileNotFoundException("Unable to locate hostable web core library, ensure IIS 7+ is installed", hostableWebCorePath); } // Load the library and get the function pointers for the WebCore entry points IntPtr hwc = HWCInterop.LoadLibrary(hostableWebCorePath); IntPtr procaddr = HWCInterop.GetProcAddress(hwc, "WebCoreActivate"); WebCoreActivate = (FnWebCoreActivate) Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreActivate)); procaddr = HWCInterop.GetProcAddress(hwc, "WebCoreShutdown"); WebCoreShutdown = (FnWebCoreShutdown) Marshal.GetDelegateForFunctionPointer(procaddr, typeof(FnWebCoreShutdown)); }