Keyword - DLL

Entries feed - Comments feed

Tuesday, November 28 2006

Using Microsoft RTC API under Windows Vista

If you are developping an application base on the Microsoft RTC API, a big surprise is awaiting you with Windows Vista. The installation of the RTC API miserably failed, because of lack of privileges. The result is that the RTC side-by-side assemblies are not available, thus the application does not want to start. Crawling through the forums doesn't help much. So what can you do to make this application work ? Here is an answer.

The basic idea is that if the RTC side-by-side assemblies cannot be installed, then they have to be deployed within the application, thus making the application isolated. MSDN is a great source of knowledge about isolated applications and side-by-side assemblies. To avoid any problem during the library lookup, the workaround also uses tips about the assembly searching sequence.

To deploy side-by-side assemblies to be used with an isolated application, we must copy them in the same folder that the application exectuable. The naming of the Manifest files is important to enable a proper lookup. The last trick is to force the local resolution of the DLLs, by indicating that no system-wide search is needed. Now that you have the full picture, here are the details.

  1. Extract the RTC DLLs and Manifests files from a successful install of the RTC API. This can be done on a Windows XP SP2 system. The files to grab are (for a RTC 1.3 API) :
    C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Networking.Dxmrtp_6595b64144ccf1df_5.2.1002.3_x-ww_021cfae0\dxmrtp.dll
    C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Networking.RtcDll_6595b64144ccf1df_5.2.1002.3_x-ww_92561fce\rtcdll.dll
    C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Networking.RtcRes_6595b64144ccf1df_5.2.1002.3_x-ww_88ef1b2a\rtcres.dll
    C:\WINDOWS\WinSxS\Manifests\x86_Microsoft.Windows.Networking.Dxmrtp_6595b64144ccf1df_5.2.1002.3_x-ww_021cfae0.Manifest
    C:\WINDOWS\WinSxS\Manifests\x86_Microsoft.Windows.Networking.RtcDll_6595b64144ccf1df_5.2.1002.3_x-ww_92561fce.Manifest
    C:\WINDOWS\WinSxS\Manifests\x86_Microsoft.Windows.Networking.RtcRes_6595b64144ccf1df_5.2.1002.3_x-ww_88ef1b2a.Manifest
  2. Rename the Manifests. The changes are :
    x86_Microsoft.Windows.Networking.Dxmrtp_6595b64144ccf1df_5.2.1002.3_x-ww_021cfae0.Manifest becomes Microsoft.Windows.Networking.Dxmrtp.Manifest
    x86_Microsoft.Windows.Networking.RtcDll_6595b64144ccf1df_5.2.1002.3_x-ww_92561fce.Manifest becomes Microsoft.Windows.Networking.RtcDll.Manifest
    x86_Microsoft.Windows.Networking.RtcRes_6595b64144ccf1df_5.2.1002.3_x-ww_88ef1b2a.Manifest becomes Microsoft.Windows.Networking.RtcRes.Manifest
  3. Copy the files in the direction where lies your application. They must be in the same folder.
  4. In your RTC based application, create a Manifest file to reference the exact version of the RTC API. The dependency section in the Manifest file should look like that (taken from the RTC samples) :
    <dependency>
    <dependentAssembly>
    <assemblyIdentity
    type="win32"
    name="Microsoft.Windows.Networking.RtcDll"
    version="5.2.1002.3"
    processorArchitecture="X86"
    publicKeyToken="6595b64144ccf1df"
    language="*"
    />
    </dependentAssembly>
    </dependency>
  5. Create an empty file, named like your application executable file, with a local extension. If your application executable is WindowsApplication.exe, the empy file should be named WindowsApplication.exe.local.
  6. Launch your application. It should work properly.

Tuesday, June 20 2006

Easy P/Invoke on .NET

When you need to use a P/Invoke call in Microsoft , it is always hard to find the right DLL signature and the additionnal structures in one shot. I recommend the following site pinvoke.net which lists all the method signatures and the required structures for a lot of system DLLs. And it is open to comments, so the documentation is becoming richer and richer with notes and sample code.

Tuesday, March 21 2006

Microsoft.mshtml.dll within a .NET application

If you are using the package in your .NET application, be aware that does not copy it into you project. Instead, it references it like any other assemblies of the .

The problem is that this DLL is not installed by default on a Windows XP SP2 system. So when you launched your .NET application, it miserably failed with a cryptic error message. The solution is to tell Visual Studio to make a local copy of the DLL so it will be include in the redistribuables files of the application. Select the MSHTML reference and in the properties sheet, set "Copy Local" to true. That's it.

Solution Explorer Reference Properties