Revision: 9599
Author: fabio...@google.com
Date: Mon Jan 24 08:49:19 2011
Log: Support for IE9 GWT Developer Mode plugin.

http://code.google.com/p/google-web-toolkit/source/detail?r=9599

Added:
 /trunk/plugins/ie/oophm/oophm/Constants.h
 /trunk/plugins/ie/oophm/oophm/IEUtils.h
 /trunk/plugins/platform
 /trunk/plugins/platform/Win
 /trunk/plugins/platform/Win/AllowDialog.cpp
 /trunk/plugins/platform/Win/AllowDialog.h
 /trunk/plugins/platform/Win/Preferences.cpp
 /trunk/plugins/platform/Win/Preferences.h
Modified:
 /trunk/plugins/common/Socket.cpp
 /trunk/plugins/ie/installer/oophm.wxs
 /trunk/plugins/ie/oophm/oophm/IESessionHandler.cpp
 /trunk/plugins/ie/oophm/oophm/JavaObject.cpp
 /trunk/plugins/ie/oophm/oophm/SessionData.h
 /trunk/plugins/ie/oophm/oophm/oophm.rc
 /trunk/plugins/ie/oophm/oophm/oophm.vcproj
 /trunk/plugins/ie/oophm/oophm/plugin.cpp
 /trunk/plugins/ie/oophm/oophm/plugin.h
 /trunk/plugins/ie/oophm/oophm/stdafx.h
 /trunk/plugins/ie/prebuilt/Win32/oophm.dll
 /trunk/plugins/ie/prebuilt/gwt-dev-plugin-x64.msi
 /trunk/plugins/ie/prebuilt/gwt-dev-plugin-x86.msi
 /trunk/plugins/ie/prebuilt/x64/oophm.dll

=======================================
--- /dev/null
+++ /trunk/plugins/ie/oophm/oophm/Constants.h   Mon Jan 24 08:49:19 2011
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "stdafx.h"
+
+class Constants
+{
+public:
+    const static LPOLESTR __gwt_disconnected;
+    const static LPOLESTR valueOf;
+    const static LPOLESTR Error;
+    const static _bstr_t JavaScript;
+    const static LPOLESTR __gwt_makeResult;
+    const static LPOLESTR __gwt_makeTearOff;
+};
+
+__declspec(selectany) const LPOLESTR Constants::__gwt_disconnected = L"__gwt_disconnected";
+__declspec(selectany) const LPOLESTR Constants::valueOf = L"valueOf";
+__declspec(selectany) const LPOLESTR Constants::Error = L"Error";
+__declspec(selectany) const _bstr_t Constants::JavaScript = _bstr_t(L"JavaScript"); +__declspec(selectany) const LPOLESTR Constants::__gwt_makeResult = L"__gwt_makeResult"; +__declspec(selectany) const LPOLESTR Constants::__gwt_makeTearOff = L"__gwt_makeTearOff";
+
=======================================
--- /dev/null
+++ /trunk/plugins/ie/oophm/oophm/IEUtils.h     Mon Jan 24 08:49:19 2011
@@ -0,0 +1,178 @@
+/*
+* Copyright 2008 Google Inc.
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not +* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+#pragma once
+#include "stdafx.h"
+#include "comutil.h"
+#include "dispex.h"
+#include "SessionData.h"
+
+#define SYSLOGERROR(MSG,FMT,...) \
+    LPCWSTR msgArr[3] = {NULL, NULL, NULL}; \
+    msgArr[0] = MSG; \
+    WCHAR buffer1[512]; \
+    swprintf(buffer1, sizeof(buffer1)/sizeof(WCHAR), FMT, __VA_ARGS__); \
+    msgArr[1] = buffer1; \
+    WCHAR buffer2[512]; \
+ swprintf(buffer2, sizeof(buffer2)/sizeof(WCHAR), L"function: %S, file: %S, line: %d", __FUNCTION__, __FILE__, __LINE__); \
+    msgArr[2] = buffer2; \
+    IEUtils::WriteToLog((LPCWSTR*)msgArr, 3);
+
+
+typedef HRESULT (*PFNRESOLVENAME)(IDispatch*, LPOLESTR, DISPID*);
+
+//
+// This class is a collection of helper methods specific to IE
+// It finds the appropriate implementation that resolves javascript
+// names regardless of the specific documentMode that browser is
+// running.
+//
+class IEUtils
+{
+    static HANDLE hEventLog;
+    static LPWSTR logSourceName;
+    static PFNRESOLVENAME pfnResolveName;
+
+    //
+    // finds which IDispatch interface is capable of
+    // of 'resolving' names.
+    //
+    static PFNRESOLVENAME getResolveNameFunction(IDispatch* obj)
+    {
+        _variant_t retVal;
+ std::string probeScript("function _FN3E9738B048214100A6D6B750F2230A34() { return null; }");
+        CComQIPtr<IHTMLWindow2> spWindow2(obj);
+        if (!spWindow2) {
+            return &IEUtils::internalResolveNameEx;
+        }
+        LPOLESTR functionName = L"_FN3E9738B048214100A6D6B750F2230A34";
+ HRESULT hr = spWindow2->execScript(UTF8ToBSTR(probeScript.length(), probeScript.c_str()),
+            UTF8ToBSTR(10, "JavaScript"), retVal.GetAddress());
+        if (SUCCEEDED(hr)) {
+            DISPID dispId;
+            hr = internalResolveName(spWindow2, functionName, &dispId);
+            if (SUCCEEDED(hr)) {
+                return &IEUtils::internalResolveName;
+            } else {
+ hr = internalResolveNameEx(spWindow2, functionName, &dispId);
+                if (SUCCEEDED(hr)) {
+                    return &IEUtils::internalResolveNameEx;
+                } else {
+ SYSLOGERROR(L"Failed to find a IDispatch Implementation able to resolve names",
+                        L"hr=0x%08x", hr);
+                }
+            }
+        }
+        return &IEUtils::internalResolveNameEx;
+    }
+
+    //
+    // resolves 'name' using default IDispatch interface
+    //
+ static HRESULT internalResolveName(IDispatch* obj, LPOLESTR name, DISPID *dispID)
+    {
+        assert(obj != NULL);
+ return obj->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_SYSTEM_DEFAULT, dispID);
+    }
+
+    //
+    // resolves 'name' using IDispatchEx interface
+    //
+ static HRESULT internalResolveNameEx(IDispatch* obj, LPOLESTR name, DISPID *dispID)
+    {
+        assert(obj != NULL);
+        CComQIPtr<IDispatchEx> spDispEx(obj);
+        if (!spDispEx) {
+            return E_FAIL;
+        }
+ return spDispEx->GetIDsOfNames(IID_NULL, &name, 1, LOCALE_SYSTEM_DEFAULT, dispID);
+    }
+
+public:
+
+    static void InitEventLog() {
+        if (NULL == hEventLog) {
+            hEventLog = OpenEventLog(NULL, IEUtils::logSourceName);
+        }
+    }
+
+    static void WriteToLog(LPCWSTR* rgMsg, INT size) {
+        if (NULL != hEventLog) {
+ ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, 0, 0, NULL, size, 0, rgMsg, NULL);
+        }
+    }
+
+    static void CloseEventLog()
+    {
+        if (NULL != hEventLog) {
+            ::CloseEventLog(hEventLog);
+        }
+    }
+
+    static WCHAR* GetSysErrorMessage(DWORD dwErrorCode)
+    {
+        WCHAR * pMsgBuf = NULL;
+        DWORD dwSize = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
+            FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
+            NULL, dwErrorCode, 0, (LPTSTR) &pMsgBuf, 0, NULL);
+        if (dwSize) {
+            return pMsgBuf;
+        }
+        return NULL;
+    }
+
+ static HRESULT resolveName(IDispatch* obj, LPOLESTR name, DISPID *dispID)
+    {
+        if (NULL == pfnResolveName) {
+            pfnResolveName = getResolveNameFunction(obj);
+        }
+        assert(NULL != pfnResolveName);
+        return pfnResolveName(obj, name, dispID);
+    }
+
+ static HRESULT resolveName(IDispatch* obj, std::string name, DISPID *dispID)
+    {
+ return resolveName(obj, UTF8ToBSTR(name.length(), name.c_str()), dispID);
+    }
+
+    static void resetResolver()
+    {
+        pfnResolveName = NULL;
+    }
+
+    static HRESULT Invoke(IUnknown* obj,
+        DISPID id,
+        WORD wFlags,
+        DISPPARAMS *pdp,
+        VARIANT *pvarRes,
+        EXCEPINFO *pei,
+        UINT *puArgErr)
+    {
+        HRESULT hr = S_OK;
+        CComQIPtr<IDispatchEx> spDispEx(obj);
+        if (!spDispEx) {
+            return E_FAIL;
+        }
+ hr = spDispEx->Invoke(id, IID_NULL, LOCALE_SYSTEM_DEFAULT, wFlags, pdp, pvarRes, pei, puArgErr);
+        return hr;
+    }
+};
+
+__declspec(selectany) HANDLE IEUtils::hEventLog;
+__declspec(selectany) LPWSTR IEUtils::logSourceName = L"GWT Developer Mode Plugin"; +__declspec(selectany) HRESULT (*IEUtils::pfnResolveName)(IDispatch* object, LPOLESTR name, DISPID *dispID);
+
+
=======================================
--- /dev/null
+++ /trunk/plugins/platform/Win/AllowDialog.cpp Mon Jan 24 08:49:19 2011
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#include "AllowDialog.h"
+#include "Debug.h"
+#include "resource.h"
+
+HINSTANCE AllowDialog::hInstance;
+
+static BOOL CALLBACK allowDialogProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam) {
+  if (message != WM_COMMAND) {
+    return false;
+  }
+  bool allowed;
+  switch (LOWORD(wParam)) {
+    case IDCANCEL:
+      allowed = false;
+      break;
+    case IDC_ALLOW_BUTTON:
+      allowed = true;
+      break;
+    default:
+      // ignore anything but buttons which close the dialog
+      return false;
+  }
+ bool remember = IsDlgButtonChecked(hwndDlg, IDC_REMEMBER_CHECKBOX) == BST_CHECKED;
+  int returnVal = (allowed ? 1 : 0) + (remember ? 2 : 0);
+  EndDialog(hwndDlg, (INT_PTR) returnVal);
+  return true;
+}
+
+void AllowDialog::setHInstance(HINSTANCE hInstance) {
+  AllowDialog::hInstance = hInstance;
+}
+
+bool AllowDialog::askUserToAllow(bool* remember) {
+ int result = (int) DialogBox(hInstance, MAKEINTRESOURCE(IDD_ALLOW_DIALOG),
+      NULL, (DLGPROC) allowDialogProc);
+  *remember = (result & 2) != 0;
+  return (result & 1) != 0;
+}
=======================================
--- /dev/null
+++ /trunk/plugins/platform/Win/AllowDialog.h   Mon Jan 24 08:49:19 2011
@@ -0,0 +1,42 @@
+#ifndef _H_AllowDialog
+#define _H_AllowDialog
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#ifdef _WINDOWS
+#include <windows.h>
+#include <winnt.h>
+#include <windef.h>
+
+class AllowDialog {
+public:
+  static void setHInstance(HINSTANCE hInstance);
+
+  /**
+   * Ask the user if a connection should be allowed.
+   *
+ * @param remember *remember is set to true if the user asked us to remember this decision,
+   *     false otherwise
+   * @return return true if this connection should be allowed
+   */
+  static bool askUserToAllow(bool* remember);
+
+private:
+  static HINSTANCE hInstance;
+};
+#endif
+
+#endif
=======================================
--- /dev/null
+++ /trunk/plugins/platform/Win/Preferences.cpp Mon Jan 24 08:49:19 2011
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#include <windows.h>
+#include <winnt.h>
+#include <winreg.h>
+#include "Debug.h"
+#include "Preferences.h"
+#include "AllowedConnections.h"
+
+#define REG_ACCESS_LIST "SOFTWARE\\Google\\Google Web Toolkit\\gwt-dev-plugin.accessList"
+
+/**
+ * Return a null-terminated string containing the access list.
+ *
+ * @param HKEY registry key for the access list value
+ * @return null-terminated string containing the access list (an empty string + * if the value does not exist) -- caller is responsible for freeing with
+ *     delete[]
+ */
+static char* getAccessList(HKEY keyHandle) {
+  char *buf;
+  DWORD len = 512;
+  while(true) {
+    buf = new char[len];
+ int cc = RegQueryValueExA(keyHandle, NULL, 0, NULL, (LPBYTE) buf, &len);
+    if (cc == ERROR_SUCCESS) {
+      break;
+    } else if (cc == ERROR_FILE_NOT_FOUND) {
+      // special handling if the value doesn't exist
+      len = 0;
+      break;
+    } else if (cc != ERROR_MORE_DATA) {
+      // log unexpected errors
+ Debug::log(Debug::Error) << "Unable to load access list from registry: "
+          << cc << Debug::flush;
+      len = 0;
+      break;
+    }
+    // Buffer wasn't big enough, so make it bigger and try again
+    delete [] buf;
+    len *= 2;
+  }
+  buf[len] = 0;
+  return buf;
+}
+
+void Preferences::addNewRule(const std::string& pattern, bool exclude) {
+  HKEY keyHandle;
+  if (RegCreateKeyExA(HKEY_CURRENT_USER, REG_ACCESS_LIST, 0, 0,
+      REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &keyHandle, NULL)
+      != ERROR_SUCCESS) {
+    return;
+  }
+  char *buf = getAccessList(keyHandle);
+  std::string pref(buf);
+  delete [] buf;
+  if (pref.length() > 0) {
+    pref += ',';
+  }
+  if (exclude) {
+    pref += '!';
+  }
+  pref += pattern;
+ int cc = RegSetValueExA(keyHandle, NULL, 0, REG_SZ, (LPBYTE) pref.c_str(),
+      pref.length() + 1);
+  if (cc != ERROR_SUCCESS) {
+ Debug::log(Debug::Error) << "Unable to store access list in registry: "
+          << cc << Debug::flush;
+  }
+  RegCloseKey(keyHandle);
+}
+
+void Preferences::loadAccessList() {
+  // TODO(jat): can Reg* routines throw exceptions?  If so, we need to make
+ // this exception safe about closing the key hendle and freeing the buffer.
+  HKEY keyHandle;
+  if (RegCreateKeyExA(HKEY_CURRENT_USER, REG_ACCESS_LIST, 0, 0,
+      REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &keyHandle, NULL)
+      != ERROR_SUCCESS) {
+    return;
+  }
+  char *buf = getAccessList(keyHandle);
+  AllowedConnections::initFromAccessList(buf);
+  delete [] buf;
+  RegCloseKey(keyHandle);
+}
=======================================
--- /dev/null
+++ /trunk/plugins/platform/Win/Preferences.h   Mon Jan 24 08:49:19 2011
@@ -0,0 +1,34 @@
+#ifndef _H_Preferences
+#define _H_Preferences
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+#include <string>
+
+/**
+ * Deal with getting/storing/updating preferences in the Windows registry.
+ */
+class Preferences {
+private:
+  // prevent instantiation
+  Preferences() {}
+
+public:
+  static void loadAccessList();
+  static void addNewRule(const std::string& pattern, bool exclude);
+};
+
+#endif
=======================================
--- /trunk/plugins/common/Socket.cpp    Mon Aug  3 08:30:11 2009
+++ /trunk/plugins/common/Socket.cpp    Mon Jan 24 08:49:19 2011
@@ -1,12 +1,12 @@
 /*
  * Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -80,10 +80,12 @@
   if (::connect(fd, (struct sockaddr*) &sockAddr, sizeof(sockAddr)) < 0) {
 #ifdef _WINDOWS
     char buf[256];
-    strerror_s(buf, sizeof(buf), errno);
- Debug::log(Debug::Error) << "Can't connect to " << host << ":" << port << " -- "
-        << buf << Debug::flush;
+    DWORD dwLastError = ::GetLastError();
+    strerror_s(buf, sizeof(buf), dwLastError);
+ Debug::log(Debug::Error) << "Failed to connect to " << host << ":" << port << " -- error code "
+        << dwLastError << Debug::flush;
     closesocket(fd);
+    ::SetLastError(dwLastError);
 #else
Debug::log(Debug::Error) << "Can't connect to " << host << ":" << port << " -- "
         << strerror(errno) << Debug::flush;
@@ -119,7 +121,7 @@
   }
   return true;
 }
-
+
 bool Socket::emptyWriteBuf() {
   size_t len = writeBufPtr - writeBuf;
Debug::log(Debug::Spam) << "Socket::emptyWriteBuf: len=" << len << Debug::flush;
@@ -146,7 +148,7 @@
   writeBufPtr = writeBuf;
   return true;
 }
-
+
 bool Socket::fillReadBuf() {
   readBufPtr = readBuf;
   errno = 0;
=======================================
--- /trunk/plugins/ie/installer/oophm.wxs       Tue Dec 14 08:30:34 2010
+++ /trunk/plugins/ie/installer/oophm.wxs       Mon Jan 24 08:49:19 2011
@@ -12,7 +12,7 @@
     </Fragment>
     <Fragment>
         <ComponentGroup Id="oophmDll">
- <Component Win64="$(var.win64Flag)" Id="cmpC5076456A3EE2DC3FC2683246BE38AD6" Directory="dir315E0C50682DFB472927FE1254A22F6A" Guid="76483594-CBB8-438C-B777-5ABF473A90F0"> + <Component Win64="$(var.win64Flag)" Id="cmpC5076456A3EE2DC3FC2683246BE38AD6" Directory="dir315E0C50682DFB472927FE1254A22F6A" Guid="FA1A9445-6468-4AF2-9132-8089DBE4AA91"> <File Id="filEF78EFE99C26E3436EC9C8852A85BE88" KeyPath="yes" Source="$(var.binDir)\oophm.dll"> <TypeLib Id="{9259F105-BE55-4BF6-B7CE-D0AA878C1BA6}" Description="oophm 1.0 Type Library" HelpDirectory="dir315E0C50682DFB472927FE1254A22F6A" Language="0" MajorVersion="1" MinorVersion="0"> <AppId Description="oophm" Id="{F9365E53-5A14-47F3-BF1D-10CAAB815309}">
@@ -41,7 +41,7 @@
<RegistryValue Root="HKMU" Key="AppID\oophm.DLL" Name="AppID" Value="{F9365E53-5A14-47F3-BF1D-10CAAB815309}" Type="string" Action="write" /> <RegistryValue Root="HKMU" Key="CLSID\{1D6156B6-002B-49E7-B5CA-C138FB843B4E}\MiscStatus\1" Value="131473" Type="string" Action="write" /> <RegistryValue Root="HKMU" Key="CLSID\{1D6156B6-002B-49E7-B5CA-C138FB843B4E}\MiscStatus" Value="0" Type="string" Action="write" /> - <RegistryValue Root="HKMU" Key="CLSID\{1D6156B6-002B-49E7-B5CA-C138FB843B4E}\ToolboxBitmap32" Value="[!filEF78EFE99C26E3436EC9C8852A85BE88], 102" Type="string" Action="write" /> + <RegistryValue Root="HKMU" Key="CLSID\{1D6156B6-002B-49E7-B5CA-C138FB843B4E}\ToolboxBitmap32" Value="[#filEF78EFE99C26E3436EC9C8852A85BE88], 102" Type="string" Action="write" />
             </Component>
         </ComponentGroup>
     </Fragment>
=======================================
--- /trunk/plugins/ie/oophm/oophm/IESessionHandler.cpp Mon Nov 23 13:18:40 2009 +++ /trunk/plugins/ie/oophm/oophm/IESessionHandler.cpp Mon Jan 24 08:49:19 2011
@@ -21,49 +21,54 @@
 #include "IESessionHandler.h"
 #include "ServerMethods.h"
 #include "scoped_ptr/scoped_ptr.h"
+#include "IEUtils.h"
+#include "Constants.h"
+

 IESessionHandler::IESessionHandler(HostChannel* channel,
IHTMLWindow2* window) : SessionData(channel, window, this), jsObjectId(1)
 {
   // window->put_defaultStatus(L"GWT Developer Plugin active");
+  IEUtils::resetResolver();
 }

 IESessionHandler::~IESessionHandler(void) {
Debug::log(Debug::Debugging) << "Destroying session handler" << Debug::flush;
-
Debug::log(Debug::Spam) << jsObjectsById.size() << " active JS object referances" << Debug::flush;
-
   // Put any remaining JavaObject references into zombie-mode in case
   // of lingering references
- Debug::log(Debug::Spam) << javaObjectsById.size() << " active Java object referances" << Debug::flush; + Debug::log(Debug::Spam) << javaObjectsById.size() << " active Java object references" << Debug::flush;
+
+  IEUtils::resetResolver();
   std::map<int, IUnknown*>::iterator it = javaObjectsById.begin();
   while (it != javaObjectsById.end()) {
     ((CJavaObject*)it->second)->shutdown();
     it++;
   }
-
   channel->disconnectFromHost();
 }

 void IESessionHandler::disconnectDetectedImpl() {
   DISPID dispId;
-  LPOLESTR gwtDisconnectedName = L"__gwt_disconnected";
- if (!SUCCEEDED(getWindow()->GetIDsOfNames(IID_NULL, &gwtDisconnectedName, 1,
-    LOCALE_SYSTEM_DEFAULT, &dispId))) {
- Debug::log(Debug::Error) << "Unable to get dispId for __gwt_disconnected" << Debug::flush;
-      return;
+
+ HRESULT hr = IEUtils::resolveName(window, Constants::__gwt_disconnected, &dispId);
+  if(FAILED(hr)) {
+ Debug::log(Debug::Error) << "Unable to get dispId for __gwt_disconnected" << Debug::flush;
+    return;
   }

   DISPPARAMS dispParams = {NULL, NULL, 0, 0};
   CComPtr<IDispatchEx> dispEx;
-  getWindow()->QueryInterface(&dispEx);
-  dispEx->InvokeEx(dispId, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD,
-    &dispParams, NULL, NULL, NULL);
+ hr = IEUtils::Invoke(getWindow(), dispId, DISPATCH_METHOD, &dispParams, NULL, NULL, NULL);
+  if (FAILED(hr)) {
+ Debug::log(Debug::Error) << "Unable to invoke __gwt_disconnected" << Debug::flush;
+    SYSLOGERROR(L"failed to invoke __gwt_disconnected", L"hr=0x%08x", hr);
+  }
 }

 void IESessionHandler::fatalError(HostChannel& channel,
     const std::string& message) {
-  // TODO: better way of reporting error?
+  SYSLOGERROR(L"IESessionHandler::fatalError()", L"%S", message.c_str());
   Debug::log(Debug::Error) << "Fatal error: " << message << Debug::flush;
 }

@@ -92,6 +97,7 @@
   if (!ServerMethods::freeJava(channel, this, idCount, ids.get())) {
Debug::log(Debug::Error) << "Unable to free Java ids on server" << Debug::flush;
   }
+
   javaObjectsToFree.clear();
 }

@@ -113,17 +119,17 @@
                                const std::string& methodName, int numArgs,
                                const Value* const args, Value* returnValue)
 {
- Debug::log(Debug::Debugging) << "Executing method " << methodName << " on object " << thisObj.toString() << Debug::flush;
-
-  HRESULT res;
-
-  // Get the function off of the window
+  Debug::log(Debug::Debugging) << "Executing method " << methodName <<
+      " on object " << thisObj.toString() << Debug::flush;
+
   DISPID methodDispId;
- _bstr_t methodNameBstr = UTF8ToBSTR(methodName.length(), methodName.c_str());
-  res = window->GetIDsOfNames(IID_NULL, &methodNameBstr.GetBSTR(), 1,
-    LOCALE_SYSTEM_DEFAULT, &methodDispId);
-  if (res) {
- Debug::log(Debug::Error) << "Unable to find method " << methodName << " on the window object" <<Debug::flush;
+  HRESULT hr = IEUtils::resolveName(window, methodName, &methodDispId);
+  if (FAILED(hr)) {
+    SYSLOGERROR(L"Failed to resolve name to DISPID",
+        L"IESessionHandler::invoke(thisObj=%S, methodName=%S)",
+        thisObj.toString().c_str(), methodName.c_str());
+    Debug::log(Debug::Error) << "Unable to find method " << methodName
+        << " on the window object" <<Debug::flush;
makeExceptionValue(*returnValue, "Unable to find named method on window");
     return true;
   }
@@ -132,14 +138,16 @@
   // TODO try PROPERTYGET|EXECUTE instead?
   _variant_t functionObject;
   DISPPARAMS disparamsNoArgs = {NULL, NULL, 0, 0};
-  res = window->Invoke(methodDispId, IID_NULL, LOCALE_SYSTEM_DEFAULT,
- DISPATCH_PROPERTYGET, &disparamsNoArgs, functionObject.GetAddress(), NULL, NULL);
-  if (res) {
- Debug::log(Debug::Error) << "Unable to get method " << methodName << Debug::flush; + hr = IEUtils::Invoke(window, methodDispId, DISPATCH_PROPERTYGET, &disparamsNoArgs,
+      functionObject.GetAddress(), NULL, NULL);
+  if (FAILED(hr)) {
+    Debug::log(Debug::Error) << "Unable to get method " << methodName
+        << Debug::flush;
     makeExceptionValue(*returnValue, "Unable to get method from window");
     return true;
   } else if (functionObject.vt != VT_DISPATCH) {
- Debug::log(Debug::Error) << "Did not get a VT_DISPATCH, got " << functionObject.vt << Debug::flush;
+    Debug::log(Debug::Error) << "Did not get a VT_DISPATCH, got " <<
+        functionObject.vt << Debug::flush;
     makeExceptionValue(*returnValue, "Did not get a VT_DISPATCH");
     return true;
   }
@@ -148,7 +156,8 @@
   CComPtr<IDispatchEx> ex;
   if (functionObject.pdispVal->QueryInterface(&ex)) {
     // Probably not a function
- Debug::log(Debug::Error) << "Failed to invoke " << methodName << " which is not an IDispatchEx" << Debug::flush;
+    Debug::log(Debug::Error) << "Failed to invoke " << methodName <<
+        " which is not an IDispatchEx" << Debug::flush;
     makeExceptionValue(*returnValue, "Unable to invoke method");
     return true;
   }
@@ -171,7 +180,7 @@

   CComPtr<IServiceProvider> serviceProvider;
   catcher->QueryInterface(&serviceProvider);
-  res = ex->InvokeEx(DISPID_VALUE, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD,
+  hr = ex->InvokeEx(DISPID_VALUE, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD,
     &callDispParams, retVal.GetAddress(), &excepInfo, serviceProvider);

   // There are cases where an exception was thrown and we've caught it, but
@@ -187,7 +196,7 @@
     makeValue(*returnValue, exception);
     exceptionFlag = true;

-  } else if (!SUCCEEDED(res)) {
+  } else if (!SUCCEEDED(hr)) {
     makeExceptionValue(*returnValue, "Unknown failure");
     exceptionFlag = true;

@@ -205,40 +214,43 @@
makeExceptionValue(*returnValue, "InvokeSpecial is currently unimplemented");
   return true;
 }
+

void IESessionHandler::loadJsni(HostChannel& channel, const std::string& js) {
-  Debug::log(Debug::Spam) << "loadJsni " << js << Debug::flush;
-
-  _bstr_t code = UTF8ToBSTR(js.length(), js.c_str());
-  _bstr_t language = UTF8ToBSTR(10, "JavaScript");
-  _variant_t retVal;
-  Value toReturn;
-
-  HRESULT res = window->execScript(code, language, retVal.GetAddress());
-  if (!SUCCEEDED(res)) {
- Debug::log(Debug::Error) << "Unable to evaluate JSNI code" << Debug::flush;
-  }
+ Debug::log(Debug::Spam) << ">>> loadJsni\n" << js << "\n<<< loadJsni" << Debug::flush;
+
+    _variant_t retVal;
+    HRESULT hr = window->execScript(UTF8ToBSTR(js.length(), js.c_str()),
+        Constants::JavaScript, retVal.GetAddress());
+    if (FAILED(hr)) {
+ Debug::log(Debug::Error) << "Unable to evaluate JSNI code" << Debug::flush;
+    }
 }

 void IESessionHandler::makeException(_variant_t& in, const char* message) {
- Debug::log(Debug::Debugging) << "Creating exception variant " << std::string(message) << Debug::flush;
-  HRESULT res;
+  Debug::log(Debug::Debugging) << "Creating exception variant " <<
+      std::string(message) << Debug::flush;
+
+ SYSLOGERROR(L"IESessionHandler::makeException()", L"exception: %S", message);
   DISPID dispId;
-  LPOLESTR error = L"Error";
- res = window->GetIDsOfNames(IID_NULL, &error, 1, LOCALE_SYSTEM_DEFAULT, &dispId);
+  HRESULT hr = IEUtils::resolveName(window, Constants::Error, &dispId);
+  if (FAILED(hr)) {
+      SYSLOGERROR(L"failed to resolve Error object", L"hr=0x%08x", hr);
+      return;
+  }

   DISPPARAMS emptyParams = {NULL, NULL, 0, 0};
   _variant_t errorConstructor;
- res = window->Invoke(dispId, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET,
-    &emptyParams, errorConstructor.GetAddress(), NULL, NULL);
-  if (res) {
+  hr = IEUtils::Invoke(window, dispId, DISPATCH_PROPERTYGET, &emptyParams,
+      errorConstructor.GetAddress(), NULL, NULL);
+  if (FAILED(hr)) {
Debug::log(Debug::Error) << "Unable to get Error constructor" << Debug::flush;
     in.SetString("Unable to get Error constructor");
   }

   CComPtr<IDispatchEx> ex;
-  res = errorConstructor.pdispVal->QueryInterface(&ex);
-  if (res) {
+  hr = errorConstructor.pdispVal->QueryInterface(&ex);
+  if (FAILED(hr)) {
Debug::log(Debug::Error) << "Error constructor not IDispatchEx" << Debug::flush;
     in.SetString("Error constructor not IDispatchEx");
   }
@@ -246,10 +258,10 @@
   _variant_t param = _variant_t(message);
   DISPPARAMS dispParams = {&param, NULL, 1, 0};

- res = ex->InvokeEx(DISPID_VALUE, LOCALE_SYSTEM_DEFAULT, DISPATCH_CONSTRUCT, + hr = ex->InvokeEx(DISPID_VALUE, LOCALE_SYSTEM_DEFAULT, DISPATCH_CONSTRUCT,
     &dispParams, in.GetAddress(), NULL, NULL);

-  if (res) {
+  if (FAILED(hr)) {
Debug::log(Debug::Error) << "Unable to invoke Error constructor" << Debug::flush;
     in.SetString("Unable to invoke Error constructor");
   }
@@ -315,10 +327,9 @@
         _variant_t stringValue;
         DISPPARAMS emptyParams = {NULL, NULL, 0, 0};
         DISPID valueOfDispId = -1;
-        LPOLESTR valueOfString = L"valueOf";
-
- dispObj->GetIDsOfNames(IID_NULL, &valueOfString, 1, LOCALE_SYSTEM_DEFAULT, &valueOfDispId);
         // See if it's a wrapped String object by invoking valueOf()
+ HRESULT hr = dispObj->GetIDsOfNames(IID_NULL, (LPOLESTR*)&Constants::valueOf, 1,
+            LOCALE_SYSTEM_DEFAULT, &valueOfDispId);
         if ((valueOfDispId != -1) &&
SUCCEEDED(dispObj->Invoke(valueOfDispId, IID_NULL, LOCALE_SYSTEM_DEFAULT,
               DISPATCH_METHOD, &emptyParams, stringValue.GetAddress(),
=======================================
--- /trunk/plugins/ie/oophm/oophm/JavaObject.cpp        Mon Nov 23 13:18:40 2009
+++ /trunk/plugins/ie/oophm/oophm/JavaObject.cpp        Mon Jan 24 08:49:19 2011
@@ -1,12 +1,12 @@
 /*
  * Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -22,6 +22,8 @@
 #include "ReturnMessage.h"
 #include "ServerMethods.h"
 #include "scoped_ptr/scoped_ptr.h"
+#include "IEUtils.h"
+#include "Constants.h"
 //#include "activscp.h"

 static const DISPID DISPID_TOSTRING = 1;
@@ -179,9 +181,9 @@
     }

     DISPID dispId;
-    LPOLESTR makeResultName = L"__gwt_makeResult";
- if (!SUCCEEDED(sessionData->getWindow()->GetIDsOfNames(IID_NULL, &makeResultName, 1,
-      LOCALE_SYSTEM_DEFAULT, &dispId))) {
+
+ HRESULT hr = IEUtils::resolveName(sessionData->getWindow(), Constants::__gwt_makeResult, &dispId);
+    if (FAILED(hr)) {
Debug::log(Debug::Error) << "Unable to get dispId for __gwt_makeResult" << Debug::flush;
         return E_FAIL;
     }
@@ -207,14 +209,11 @@
     } else if (dispidMember == DISPID_TOSTRING) {
       // Asking for a tear-off of the .toString function
Debug::log(Debug::Spam) << "Making .toString tearoff" << Debug::flush;
-      HRESULT res;

       // Get a reference to __gwt_makeTearOff
       DISPID tearOffDispid;
-      LPOLESTR tearOffName = L"__gwt_makeTearOff";
-      res = sessionData->getWindow()->GetIDsOfNames(IID_NULL,
-        &tearOffName, 1, LOCALE_SYSTEM_DEFAULT, &tearOffDispid);
-      if (FAILED(res)) {
+ HRESULT hr = IEUtils::resolveName(sessionData->getWindow(), Constants::__gwt_makeTearOff, &tearOffDispid);
+      if (FAILED(hr)) {
Debug::log(Debug::Error) << "Unable to find __gwt_makeTearOff" << Debug::flush;
         return E_FAIL;
       }
@@ -228,9 +227,9 @@
       DISPPARAMS tearOffParams = {tearOffArgs.get(), NULL, 3, 0};

       // Invoke __gwt_makeTearOff
- res = sessionData->getWindow()->Invoke(tearOffDispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
-        DISPATCH_METHOD, &tearOffParams, pvarResult, NULL, 0);
-      if (FAILED(res)) {
+ hr = IEUtils::Invoke(sessionData->getWindow(), tearOffDispid,DISPATCH_METHOD,
+          &tearOffParams, pvarResult, NULL, 0);
+      if (FAILED(hr)) {
Debug::log(Debug::Error) << "Unable to invoke __gwt_makeTearOff" << Debug::flush;
         return E_FAIL;
       }
=======================================
--- /trunk/plugins/ie/oophm/oophm/SessionData.h Thu Sep  3 15:22:56 2009
+++ /trunk/plugins/ie/oophm/oophm/SessionData.h Mon Jan 24 08:49:19 2011
@@ -1,12 +1,12 @@
 /*
  * Copyright 2008 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of
  * the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -77,7 +77,7 @@

 // TODO move these to a utility header

-static std::string BSTRToUTF8(BSTR bstr) {
+__inline static std::string BSTRToUTF8(BSTR bstr) {
   // Need an explict length due to the possibility of embedded nulls
   int length = SysStringLen(bstr);
int numChars = WideCharToMultiByte(CP_UTF8, 0, bstr, length, NULL, 0, NULL, NULL);
@@ -93,7 +93,7 @@
  * Convert a utf8-encoded string into a BSTR.  The length is explicitly
  * specified because the incoming string may have embedded null charachers.
  */
-static _bstr_t UTF8ToBSTR(int length, const char* utf8) {
+__inline static _bstr_t UTF8ToBSTR(int length, const char* utf8) {
   // We explicitly use MultiByteToWideChar to handle embedded nulls
   int numChars = MultiByteToWideChar(CP_UTF8, 0, utf8, length, NULL, 0);
   OLECHAR* buffer = new OLECHAR[numChars];
=======================================
--- /trunk/plugins/ie/oophm/oophm/oophm.rc      Tue Dec  8 12:51:47 2009
+++ /trunk/plugins/ie/oophm/oophm/oophm.rc      Mon Jan 24 08:49:19 2011
@@ -59,8 +59,8 @@
 //

 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,7263,0
- PRODUCTVERSION 1,0,7263,0
+ FILEVERSION 1,2,9570,0
+ PRODUCTVERSION 1,2,9570,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -77,12 +77,12 @@
         BEGIN
             VALUE "CompanyName", "Google Inc."
             VALUE "FileDescription", "Google Web Toolkit Developer Plugin"
-            VALUE "FileVersion", "1.0.7263.0"
+            VALUE "FileVersion", "1.2.9570.0"
             VALUE "InternalName", "oophm.dll"
VALUE "LegalCopyright", "Copyright 2008 Google Inc. Licensed under the Apache 2.0 license."
             VALUE "OriginalFilename", "oophm.dll"
             VALUE "ProductName", "Google Web Toolkit"
-            VALUE "ProductVersion", "1.0.7263.0"
+            VALUE "ProductVersion", "1.2.9570.0"
         END
     END
     BLOCK "VarFileInfo"
=======================================
--- /trunk/plugins/ie/oophm/oophm/oophm.vcproj  Thu Dec  2 07:41:14 2010
+++ /trunk/plugins/ie/oophm/oophm/oophm.vcproj  Mon Jan 24 08:49:19 2011
@@ -245,6 +245,9 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="2"
+                               InlineFunctionExpansion="2"
+                               EnableIntrinsicFunctions="true"
+                               FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;../../../platform/Win;../../../common"
                                
PreprocessorDefinitions="_WINDOWS;GWT_DEBUGDISABLE"
                                RuntimeLibrary="0"
@@ -339,6 +342,8 @@
                        <Tool
                                Name="VCCLCompilerTool"
                                Optimization="2"
+                               InlineFunctionExpansion="2"
+                               EnableIntrinsicFunctions="true"
                                FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="&quot;$(ProjectDir)&quot;;../../../platform/Win;../../../common"
                                
PreprocessorDefinitions="_WINDOWS;GWT_DEBUGDISABLE"
@@ -602,6 +607,10 @@
                        <File
                                
RelativePath="..\..\..\platform\Win\AllowDialog.h"
                                >
+                       </File>
+                       <File
+                               RelativePath=".\Constants.h"
+                               >
                        </File>
                        <File
                                RelativePath=".\dlldatax.h"
@@ -622,6 +631,10 @@
                        <File
                                RelativePath=".\IESessionHandler.h"
                                >
+                       </File>
+                       <File
+                               RelativePath=".\IEUtils.h"
+                               >
                        </File>
                        <File
                                RelativePath=".\JavaObject.h"
=======================================
--- /trunk/plugins/ie/oophm/oophm/plugin.cpp    Wed Sep 30 09:53:45 2009
+++ /trunk/plugins/ie/oophm/oophm/plugin.cpp    Mon Jan 24 08:49:19 2011
@@ -27,6 +27,7 @@
 #include "AllowedConnections.h"
 #include "Preferences.h"
 #include "AllowDialog.h"
+#include "IEUtils.h"

 // Cplugin

@@ -75,10 +76,16 @@
   HostChannel* channel = new HostChannel();

   if (!channel->connectToHost(
-      hostPart.c_str(),
-      atoi(portPart.c_str()))) {
-    *ret = false;
-    return S_OK;
+    hostPart.c_str(),
+    atoi(portPart.c_str()))) {
+      *ret = false;
+      DWORD  errCode = ::GetLastError();
+      PWCHAR errMsg = IEUtils::GetSysErrorMessage(errCode);
+ SYSLOGERROR(L"GWT Developer Mode plugin failed to connect to code server.",
+          L"URL: %S\nERRORMESSAGE: %sERRORCODE: %d (0x%08X)",
+          url.c_str(), errMsg, errCode, errCode);
+      ::LocalFree(errMsg);
+      return S_OK;
   }

   sessionHandler.reset(new IESessionHandler(channel, window));
=======================================
--- /trunk/plugins/ie/oophm/oophm/plugin.h      Thu Sep  3 15:22:56 2009
+++ /trunk/plugins/ie/oophm/oophm/plugin.h      Mon Jan 24 08:49:19 2011
@@ -1,18 +1,18 @@
 /*
- * Copyright 2008 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
+* Copyright 2008 Google Inc.
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not +* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/

 // plugin.h : Declaration of the Cplugin
 #pragma once
@@ -21,204 +21,207 @@
 #include "oophm_i.h"
 #include "Debug.h"
 #include "IESessionHandler.h"
+#include "IEUtils.h"

 #ifdef _WIN32_WCE
 #error "ATL does not support HTML controls for Windows CE."
 #endif
 class ATL_NO_VTABLE CpluginUI :
- public IDispatchImpl<IpluginUI, &IID_IpluginUI, &LIBID_oophmLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
-       public CComObjectRootEx<CComSingleThreadModel>
-{
-BEGIN_COM_MAP(CpluginUI)
-       COM_INTERFACE_ENTRY(IpluginUI)
-       COM_INTERFACE_ENTRY(IDispatch)
-END_COM_MAP()
-// Iplugin
+ public IDispatchImpl<IpluginUI, &IID_IpluginUI, &LIBID_oophmLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
+    public CComObjectRootEx<CComSingleThreadModel>
+{
+    BEGIN_COM_MAP(CpluginUI)
+        COM_INTERFACE_ENTRY(IpluginUI)
+        COM_INTERFACE_ENTRY(IDispatch)
+    END_COM_MAP()
+    // Iplugin
 public:
-       DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-       HRESULT FinalConstruct()
-       {
-               return S_OK;
-       }
-
-       void FinalRelease()
-       {
-       }
-
-       // Example method called by the HTML to change the <BODY> background 
color
-       STDMETHOD(OnClick)(IDispatch* pdispBody, VARIANT varColor)
-       {
-               CComQIPtr<IHTMLBodyElement> spBody(pdispBody);
-               if (spBody != NULL)
-                       spBody->put_bgColor(varColor);
-               return S_OK;
-       }
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    HRESULT FinalConstruct()
+    {
+        return S_OK;
+    }
+
+    void FinalRelease()
+    {
+    }
+
+ // Example method called by the HTML to change the <BODY> background color
+    STDMETHOD(OnClick)(IDispatch* pdispBody, VARIANT varColor)
+    {
+        CComQIPtr<IHTMLBodyElement> spBody(pdispBody);
+        if (spBody != NULL)
+            spBody->put_bgColor(varColor);
+        return S_OK;
+    }
 };



 // Cplugin
 class ATL_NO_VTABLE Cplugin :
-       public CComObjectRootEx<CComSingleThreadModel>,
- public IDispatchImpl<Iplugin, &IID_Iplugin, &LIBID_oophmLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
-       public IPersistStreamInitImpl<Cplugin>,
-       public IOleControlImpl<Cplugin>,
-       public IOleObjectImpl<Cplugin>,
-       public IOleInPlaceActiveObjectImpl<Cplugin>,
-       public IViewObjectExImpl<Cplugin>,
-       public IOleInPlaceObjectWindowlessImpl<Cplugin>,
-       public ISupportErrorInfo,
-       public IPersistStorageImpl<Cplugin>,
-       public ISpecifyPropertyPagesImpl<Cplugin>,
-       public IQuickActivateImpl<Cplugin>,
- public IObjectSafetyImpl<Cplugin, INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA>,
+    public CComObjectRootEx<CComSingleThreadModel>,
+ public IDispatchImpl<Iplugin, &IID_Iplugin, &LIBID_oophmLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
+    public IPersistStreamInitImpl<Cplugin>,
+    public IOleControlImpl<Cplugin>,
+    public IOleObjectImpl<Cplugin>,
+    public IOleInPlaceActiveObjectImpl<Cplugin>,
+    public IViewObjectExImpl<Cplugin>,
+    public IOleInPlaceObjectWindowlessImpl<Cplugin>,
+    public ISupportErrorInfo,
+    public IPersistStorageImpl<Cplugin>,
+    public ISpecifyPropertyPagesImpl<Cplugin>,
+    public IQuickActivateImpl<Cplugin>,
+ public IObjectSafetyImpl<Cplugin, INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA>,
 #ifndef _WIN32_WCE
-       public IDataObjectImpl<Cplugin>,
+    public IDataObjectImpl<Cplugin>,
 #endif
-       public IProvideClassInfo2Impl<&CLSID_plugin, NULL, &LIBID_oophmLib>,
+    public IProvideClassInfo2Impl<&CLSID_plugin, NULL, &LIBID_oophmLib>,
#ifdef _WIN32_WCE // IObjectSafety is required on Windows CE for the control to be loaded correctly
-       public IObjectSafetyImpl<Cplugin, INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
+    public IObjectSafetyImpl<Cplugin, INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
 #endif
-       public CComCoClass<Cplugin, &CLSID_plugin>,
-       public CComControl<Cplugin>
+    public CComCoClass<Cplugin, &CLSID_plugin>,
+    public CComControl<Cplugin>
 {
 public:


-       Cplugin()
-       {
-               m_bWindowOnly = TRUE;
-       }
-
-DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE |
-       OLEMISC_CANTLINKINSIDE |
-       OLEMISC_INSIDEOUT |
-       OLEMISC_ACTIVATEWHENVISIBLE |
-       OLEMISC_SETCLIENTSITEFIRST
-)
-
-DECLARE_REGISTRY_RESOURCEID(IDR_PLUGIN)
+    Cplugin()
+    {
+        m_bWindowOnly = TRUE;
+    }
+
+    DECLARE_OLEMISC_STATUS(OLEMISC_RECOMPOSEONRESIZE |
+    OLEMISC_CANTLINKINSIDE |
+        OLEMISC_INSIDEOUT |
+        OLEMISC_ACTIVATEWHENVISIBLE |
+        OLEMISC_SETCLIENTSITEFIRST
+        )
+
+        DECLARE_REGISTRY_RESOURCEID(IDR_PLUGIN)


-BEGIN_COM_MAP(Cplugin)
-       COM_INTERFACE_ENTRY(Iplugin)
-       COM_INTERFACE_ENTRY(IDispatch)
-       COM_INTERFACE_ENTRY(IViewObjectEx)
-       COM_INTERFACE_ENTRY(IViewObject2)
-       COM_INTERFACE_ENTRY(IViewObject)
-       COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceObject)
-       COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
-       COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
-       COM_INTERFACE_ENTRY(IOleControl)
-       COM_INTERFACE_ENTRY(IOleObject)
-       COM_INTERFACE_ENTRY(IPersistStreamInit)
-       COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
-       COM_INTERFACE_ENTRY(ISupportErrorInfo)
-       COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
-       COM_INTERFACE_ENTRY(IQuickActivate)
-       COM_INTERFACE_ENTRY(IPersistStorage)
-       COM_INTERFACE_ENTRY(IObjectSafety)
+    BEGIN_COM_MAP(Cplugin)
+        COM_INTERFACE_ENTRY(Iplugin)
+        COM_INTERFACE_ENTRY(IDispatch)
+        COM_INTERFACE_ENTRY(IViewObjectEx)
+        COM_INTERFACE_ENTRY(IViewObject2)
+        COM_INTERFACE_ENTRY(IViewObject)
+        COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
+        COM_INTERFACE_ENTRY(IOleInPlaceObject)
+        COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
+        COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
+        COM_INTERFACE_ENTRY(IOleControl)
+        COM_INTERFACE_ENTRY(IOleObject)
+        COM_INTERFACE_ENTRY(IPersistStreamInit)
+        COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
+        COM_INTERFACE_ENTRY(ISupportErrorInfo)
+        COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
+        COM_INTERFACE_ENTRY(IQuickActivate)
+        COM_INTERFACE_ENTRY(IPersistStorage)
+        COM_INTERFACE_ENTRY(IObjectSafety)
 #ifndef _WIN32_WCE
-       COM_INTERFACE_ENTRY(IDataObject)
+        COM_INTERFACE_ENTRY(IDataObject)
 #endif
-       COM_INTERFACE_ENTRY(IProvideClassInfo)
-       COM_INTERFACE_ENTRY(IProvideClassInfo2)
+        COM_INTERFACE_ENTRY(IProvideClassInfo)
+        COM_INTERFACE_ENTRY(IProvideClassInfo2)
#ifdef _WIN32_WCE // IObjectSafety is required on Windows CE for the control to be loaded correctly
-       COM_INTERFACE_ENTRY_IID(IID_IObjectSafety, IObjectSafety)
+        COM_INTERFACE_ENTRY_IID(IID_IObjectSafety, IObjectSafety)
 #endif
-END_COM_MAP()
-
-BEGIN_PROP_MAP(Cplugin)
-       PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
-       PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
-       // Example entries
-       // PROP_ENTRY_TYPE("Property Name", dispid, clsid, vtType)
-       // PROP_PAGE(CLSID_StockColorPage)
-END_PROP_MAP()
+    END_COM_MAP()
+
+    BEGIN_PROP_MAP(Cplugin)
+        PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
+        PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
+        // Example entries
+        // PROP_ENTRY_TYPE("Property Name", dispid, clsid, vtType)
+        // PROP_PAGE(CLSID_StockColorPage)
+    END_PROP_MAP()


-BEGIN_MSG_MAP(Cplugin)
-       MESSAGE_HANDLER(WM_CREATE, OnCreate)
-       CHAIN_MSG_MAP(CComControl<Cplugin>)
-       DEFAULT_REFLECTION_HANDLER()
-END_MSG_MAP()
-// Handler prototypes:
-// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); -// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
-//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
-
-// ISupportsErrorInfo
-       STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
-       {
-               static const IID* arr[] =
-               {
-                       &IID_Iplugin,
-               };
-
-               for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
-               {
-                       if (InlineIsEqualGUID(*arr[i], riid))
-                               return S_OK;
-               }
-               return S_FALSE;
-       }
-
-// IViewObjectEx
-       DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
-
-// Iplugin
-
- LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
-       {
-               CAxWindow wnd(m_hWnd);
-               wnd.ModifyStyle(0, WS_HSCROLL | WS_VSCROLL);
-               HRESULT hr = wnd.CreateControl(IDH_PLUGIN);
-               if (SUCCEEDED(hr))
-               {
-                       CComObject<CpluginUI> *pObject = NULL;
-                       hr = CComObject<CpluginUI>::CreateInstance(&pObject);
-                       if (SUCCEEDED(hr) && pObject != NULL)
-                               hr = 
wnd.SetExternalDispatch(static_cast<IpluginUI*>(pObject));
-               }
-               if (SUCCEEDED(hr))
-                       hr = wnd.QueryControl(IID_IWebBrowser2, 
(void**)&m_spBrowser);
-               return SUCCEEDED(hr) ? 0 : -1;
-       }
-
-       STDMETHOD(TranslateAccelerator)(LPMSG pMsg)
-       {
-               CComPtr<IOleInPlaceActiveObject> spIOleInPlaceActiveObject;
-
-               HRESULT hr = 
m_spBrowser->QueryInterface(&spIOleInPlaceActiveObject);
-               if (SUCCEEDED(hr))
-                       hr = 
spIOleInPlaceActiveObject->TranslateAccelerator(pMsg);
-               if (hr != S_OK)
-                       hr = 
IOleInPlaceActiveObjectImpl<Cplugin>::TranslateAccelerator(pMsg);
-
-               return hr;
-       }
-       CComPtr<IWebBrowser2> m_spBrowser;
-
-       DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-       HRESULT FinalConstruct()
-       {
-               return S_OK;
-       }
-
-       void FinalRelease()
-       {
- Debug::log(Debug::Debugging) << "OOPHM plugin FinalRelease" << Debug::flush;
-       }
-
-       STDMETHOD(connect)(BSTR url, BSTR sessionKey, BSTR hostedServer,
-           BSTR moduleName, BSTR hostedHtmlVersion, VARIANT_BOOL* ret);
-  STDMETHOD(init)(IDispatch* jsniContext, VARIANT_BOOL* ret);
-       STDMETHOD(testObject)(IDispatch** ret);
+    BEGIN_MSG_MAP(Cplugin)
+        MESSAGE_HANDLER(WM_CREATE, OnCreate)
+        CHAIN_MSG_MAP(CComControl<Cplugin>)
+        DEFAULT_REFLECTION_HANDLER()
+    END_MSG_MAP()
+    // Handler prototypes:
+ // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+    //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
+
+    // ISupportsErrorInfo
+    STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
+    {
+        static const IID* arr[] =
+        {
+            &IID_Iplugin,
+        };
+
+        for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
+        {
+            if (InlineIsEqualGUID(*arr[i], riid))
+                return S_OK;
+        }
+        return S_FALSE;
+    }
+
+    // IViewObjectEx
+    DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
+
+    // Iplugin
+
+ LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
+    {
+        CAxWindow wnd(m_hWnd);
+        wnd.ModifyStyle(0, WS_HSCROLL | WS_VSCROLL);
+        HRESULT hr = wnd.CreateControl(IDH_PLUGIN);
+        if (SUCCEEDED(hr))
+        {
+            CComObject<CpluginUI> *pObject = NULL;
+            hr = CComObject<CpluginUI>::CreateInstance(&pObject);
+            if (SUCCEEDED(hr) && pObject != NULL)
+ hr = wnd.SetExternalDispatch(static_cast<IpluginUI*>(pObject));
+        }
+        if (SUCCEEDED(hr))
+            hr = wnd.QueryControl(IID_IWebBrowser2, (void**)&m_spBrowser);
+        return SUCCEEDED(hr) ? 0 : -1;
+    }
+
+    STDMETHOD(TranslateAccelerator)(LPMSG pMsg)
+    {
+        CComPtr<IOleInPlaceActiveObject> spIOleInPlaceActiveObject;
+
+ HRESULT hr = m_spBrowser->QueryInterface(&spIOleInPlaceActiveObject);
+        if (SUCCEEDED(hr))
+            hr = spIOleInPlaceActiveObject->TranslateAccelerator(pMsg);
+        if (hr != S_OK)
+ hr = IOleInPlaceActiveObjectImpl<Cplugin>::TranslateAccelerator(pMsg);
+
+        return hr;
+    }
+    CComPtr<IWebBrowser2> m_spBrowser;
+
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    HRESULT FinalConstruct()
+    {
+        IEUtils::InitEventLog();
+        return S_OK;
+    }
+
+    void FinalRelease()
+    {
+        IEUtils::CloseEventLog();
+ Debug::log(Debug::Debugging) << "OOPHM plugin FinalRelease" << Debug::flush;
+    }
+
+    STDMETHOD(connect)(BSTR url, BSTR sessionKey, BSTR hostedServer,
+        BSTR moduleName, BSTR hostedHtmlVersion, VARIANT_BOOL* ret);
+    STDMETHOD(init)(IDispatch* jsniContext, VARIANT_BOOL* ret);
+    STDMETHOD(testObject)(IDispatch** ret);
 private:
-  scoped_ptr<IESessionHandler> sessionHandler;
+    scoped_ptr<IESessionHandler> sessionHandler;
 };

 OBJECT_ENTRY_AUTO(__uuidof(plugin), Cplugin)
=======================================
--- /trunk/plugins/ie/oophm/oophm/stdafx.h      Thu Sep  3 15:22:56 2009
+++ /trunk/plugins/ie/oophm/oophm/stdafx.h      Mon Jan 24 08:49:19 2011
@@ -40,3 +40,7 @@
 #include "initguid.h"

 using namespace ATL;
+
+#include <windows.h>
+#include <stdio.h>
+#include <winevt.h>
=======================================
--- /trunk/plugins/ie/prebuilt/Win32/oophm.dll  Thu Dec  2 07:41:14 2010
+++ /trunk/plugins/ie/prebuilt/Win32/oophm.dll  Mon Jan 24 08:49:19 2011
Binary file, no diff available.
=======================================
--- /trunk/plugins/ie/prebuilt/gwt-dev-plugin-x64.msi Mon Dec 20 09:16:35 2010 +++ /trunk/plugins/ie/prebuilt/gwt-dev-plugin-x64.msi Mon Jan 24 08:49:19 2011
Binary file, no diff available.
=======================================
--- /trunk/plugins/ie/prebuilt/gwt-dev-plugin-x86.msi Mon Dec 20 09:16:35 2010 +++ /trunk/plugins/ie/prebuilt/gwt-dev-plugin-x86.msi Mon Jan 24 08:49:19 2011
Binary file, no diff available.
=======================================
--- /trunk/plugins/ie/prebuilt/x64/oophm.dll    Thu Dec  2 07:41:14 2010
+++ /trunk/plugins/ie/prebuilt/x64/oophm.dll    Mon Jan 24 08:49:19 2011
Binary file, no diff available.

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to