static UnsafeNativeMethods() 
 { 
     // This static contructor was added to make sure we load the proper version of Penimc.dll.
     // 
     // Details:
     // P/invoke will use LoadLibrary to load penimc.dll and it will check the current
     // application directory before checking the system32 directory where this DLL
     // is installed to.  If penimc.dll happens to be in the application directory as well 
     // as the system32 directory we'll actually end up loaded two versions of
     // penimc.dll.  One that we'd use for P/invokes and one that we'd use for COM. 
     // If this happens then our Stylus code will fail since it relies on both P/invoke and COM 
     // calls to talk to penimc.dll and it requires just one instance of this DLL to work.
     // So to make sure this doesn't happen we want to ensure we load the DLL using the COM 
     // registered path before doing any P/invokes into it.
     _pimcManager = (IPimcManager)new PimcManager();
 }
Exemplo n.º 2
0
 static UnsafeNativeMethods()
 {
     // This static contructor was added to make sure we load the proper version of Penimc.dll.
     //
     // Details:
     // P/invoke will use LoadLibrary to load penimc.dll and it will check the current
     // application directory before checking the system32 directory where this DLL
     // is installed to.  If penimc.dll happens to be in the application directory as well
     // as the system32 directory we'll actually end up loaded two versions of
     // penimc.dll.  One that we'd use for P/invokes and one that we'd use for COM.
     // If this happens then our Stylus code will fail since it relies on both P/invoke and COM
     // calls to talk to penimc.dll and it requires just one instance of this DLL to work.
     // So to make sure this doesn't happen we want to ensure we load the DLL using the COM
     // registered path before doing any P/invokes into it.
     _pimcManager = CreatePimcManager();
 }