/** * Use this to instantiate a COM registered object * you can use this trick to expose .NET 4 and above * libraries to PHP. * * To register de COM object use regasm. Then place the .dll file * in a discoverable place such as with the php.exe or you can * register it into the GAC. * * Common mistakes when registering with regasm: * @see http://stackoverflow.com/questions/5136638/regasm-just-doesnt-work * * - Forgetting to use the /codebase option. Required if you don't deploy the assembly to the GAC, * something you should not do on your dev machine. * * - Using the wrong version of Regasm.exe. There are two on a 64-bit machine, the * Framework64 directory contains the one you have to use if the client code is 64-bit. * * - Running it from a command prompt that is not elevated. Regasm.exe writes to the HKLM hive * of the registry, something that UAC actively prevents. That's an issue on Vista and Win7. * * @param string $name */ protected function _InstantiateCOM($name) { try { $this->host = new \COM($name); } catch (\Exception $e) { COMExceptionManager::Manage($e); } }
/** * Make sure that the internal instance to the * MagicWrapperUtilities is loaded. * * @return void */ private static function EnsureLoaded() { if (static::$utils !== NULL) { return; } try { static::$utils = MagicWrapperUtilities::GetInstance(); } catch (\Exception $e) { COMExceptionManager::Manage($e); } }