Oct 02

After switching blogging software, due to a server crash i never really got the old posts reposted from the original blog. I have had a lot of requests for one particular post: Dynamics NAV and the ROT table. I started finding the old backup of the database, to restore the post and realized it is almost 3 years old. Cant believe how fast times goes by. But after reading the very interesting post from Waldo about their new tool ReVision i came to think of this old post. (unfortunately i will not be at Directions in San Diego myself, even though i just live a couple of hours from there! But i hope to get some updates from people seeing the tool demonstrated!).

Basically what the post was about was the features of Rolling Object Table, a feature that allows Windows programs to publish “interfaces” to some of it internal features – i dont know it this is the correct description of it though :). Dynamics NAV is exposing some methods to read/write objects through the client, as well as querying forms and getting other data from the client. Since my original post, there has been quite a few additional blogs featuring the technology. We (see kudos section at the bottom) were playing around with the .NET Reflector tool, and used it on one of Celenia Version Controls dll’s. I had the same features as used in the Developers Toolkit for importing/exporting objects from the running client.

Here are some of the latest blog posts about the subject, that will give you much more information:

Here is the original post from December 2007:

With the introduction of hyperlinks for the Dynamics NAV client, the approach taken was the Running Object Table (ROT Table). From the http://msdn2.microsoft.com/en-us/library/ms695276.aspx article: “The most common type of moniker provider is a compound-document link source. This includes server applications that support linking to their documents (or portions of a document) and container applications that support linking to embeddings within their documents.”

Im not a wizard in to this, and it has been a lot of googling for the information, so if you have additional information on this issue, any hints and information would be very helpful.

Where do we find information about the interfaces? In the registry, take a look at this key:

Here are the some class names from the registry:

  1. INSHyperlink
  2. INSObjectDesigner
  3. INSApplication
  4. INSForm
  5. _INSApplicationEvents
  6. INSHook
  7. INSTable
  8. INSRec
  9. INSMenuButton
  10. _INSMenuButtonEvents
  11. INSAppBase
  12. INSCallbackEnum

For now i have only been able to find Interfaces to INSObjectDesigner (as they are used in Celenia Version Control), which of course is very interesting. It exposes methods for these functions:

But where is the “documenation” on these interfaces??????

The format for the Read and Write functions are text files, like the ones that can be imported/exported through the object designer.

Currently i have created small installers for code dropping into NAV objects, that uses the ReadObject, then parses the file, and inserts the code, and finally imports back into NAV with WriteObjects.

Here is some screenshots from a simple application reading objects into a texteditor, allows editing, and then writing back to NAV:

Step 1: Read object into editor

Step 2: Find documentation trigger

Step 3: Add text

Step 4: Write back to NAV

Step 5: Code changed in NAV

So currently im interested in finding information about the other interfaces. I will continue this series of post here when i get some decent frameworks done in .NET. Perhaps making a Dynamics NAV Installer project in the open source community would be interesting, what do you think?

Other resources:


Not to forget, kudo’s go out to Claus Hornbæk, Alexey Pavlov and Lutz Roeder.

GotCAL.CSideInstaller Source

Monday, March 24, 2008 by Administrator

(note this is a post in progress, please post comments etc.)

This is the second part of Dynamics NAV and the ROT Table, which was posted in december 2007. In this article i will discuss some of the uses of the interfaces, and also give give you access to the sourcecode for a simple application created in Visual Studio 2005.

First off let’s take a look at the Interface for the NSObjectDesigner class:

namespace GotCAL.CSIDEInstaller
using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
[ComImport, Guid("50000004-0000-1000-0001-0000836BD2D2"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IObjectDesigner
[PreserveSig, DispId(1)]
int ReadObject([In] int objectType, [In] int objectId, [In] IStream destination);

[PreserveSig, DispId(2)]
int ReadObjects([In] string filter, [In] IStream destination);

[PreserveSig, DispId(3)]
int WriteObjects([In] IStream source);

[PreserveSig, DispId(4)]
int CompileObject([In] int objectType, [In] int objectId);

[PreserveSig, DispId(5)]
int CompileObjects([In] string filter);

[PreserveSig, DispId(6)]
int GetServerName(out string serverName);

[PreserveSig, DispId(7)]
int GetDatabaseName(out string databaseName);

[PreserveSig, DispId(8)]
int GetServerType(out int serverType);

[PreserveSig, DispId(9)]
int GetCSIDEVersion(out string csideVersion);

[PreserveSig, DispId(10)]
int GetApplicationVersion(out string applicationVersion);

[PreserveSig, DispId(11)]
int GetCompanyName(out string companyName);

as you can see we import the COM library, which we discovered in the registry. In the registry it shows it has 14 methods, so far i only know 11 of them. These were found using reflection on the Celenia Version Control software, and it is also the way (i guess!) the Developers Toolkit can extract the ojbects through the CSide Client.

Most of the methods are very simple, and just return a string, and thus they are very easy to implement, eg.:

public string GetDatabaseName()
string databaseName;
int num = this._objectDesigner.GetDatabaseName(out databaseName);
return databaseName;

As most of you who have been playing around with this after the first post have discovered the biggest issue, is reading and writing the streams that holds the actual objects. At first I used “AuthHelper.dll” a library that somehow could handle the reading and writing of streams. But here is a StreamSupport class that handles it in .NET:

namespace GotCAL.CSIDEInstaller
using System;
using System.IO;
using System.Runtime.InteropServices.ComTypes;

public class StreamSupport
public static unsafe IStream ToIStream(Stream stream, ref IStream comStream)

byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
uint num = 0;
IntPtr pcbWritten = new IntPtr((void*) &num);
comStream.Write(buffer, buffer.Length, pcbWritten);
return comStream;

public static unsafe MemoryStream ToMemoryStream(IStream comStream)
MemoryStream stream = new MemoryStream();
byte[] pv = new byte[100];
uint num = 0;
IntPtr pcbRead = new IntPtr((void*) &num);
num = 0;
comStream.Read(pv, pv.Length, pcbRead);
stream.Write(pv, 0, (int) num);
while (num > 0);
return stream;

Hope to get some feedback from all you out there, please post a comment, idea, or just a quick hello.

Download the sample application here.


Here are some of the old comments for the blog posts:

  1. Ryan Says:
    Wednesday, January 23, 2008Dude ! You rock !

    I have looked briefly at this… But am struggling…

    Any chance of an example of linking the dll into the c# ?

  2. Tim Says:
    Tuesday, January 08, 2008Interesting concept, I have been looking for something like this, would it be possible to get a copy of your source code for testing.


  3. Attie Retief Says:
    Monday, January 07, 2008Just what I’ve been looking for – I would LOVE your sample code…any chance of sending it?


  4. Alex Says:
    Sunday, December 23, 2007I found it very interesting.

    I think that there is no public documentation for the interfacs because Microsoft designedly wipe out all typelib information from dll. But you can make a reverse engeniiring of NSObjectXProxy.dll. It should contains list of methods and arguments for the interfaces.

    Why don’t share the results of your research with the community?

  5. Tommy Olesen Says:
    Wednesday, December 12, 2007Thats sooo cool. Can you send me a copy of the .NET code for your little application?


6 Responses to “Repost: Dynamics NAV and the ROT Table”

  1. waldo says:

    Sorren, you’re right .. that’s what got us started .. so big thanks to you, man. Too bad you’re not coming to Directions..

  2. […] external editor.. . It's something like Sorren already showed in his blog (recently re-posted here), but we're using your favorite editor. Me personally like to use Notepad++, but the genuine […]

  3. Thad says:

    Just thought I’d mention that when I attempt to download the C/AL extractor Kaspersky antivirus is telling me it is infected with Worm.MSIL.Amiricil.bm
    I don’t know if this is a false positive, but in case it isn’t, there it is.

  4. I have scanned the files with ESET NOD, and it does not find anything. But thanks for the heads up! Wasnt it Kaspersky Labs, that had their website taken down by hackers??

  5. Thad says:

    Hmm not that I’m aware of but I could have just not heard about it. They’re a pretty good company as far as I know.

  6. Thad says:

    Apparently so. I wasn’t aware of it, but I went looking after reading your comment. That surprises me given that their antivirus is pretty rock solid. Quite an embarrassment for such a company. I use them because they their application control feature was the closest thing to what Black Ice used to provide before Norton bought them and then sank them.
    It turned out it was the built exe that it didn’t like so I just cleaned the project, built the project and now the antivirus is no longer complaining 🙂

Leave a Reply

preload preload preload
pornpants.com pornofri.com kilporn.com