views:

191

answers:

0

We have a largish 32-bit MFC/COM app that calls a .NET dll using interop. It works fine on 2k(server & client), XP, & Win2k3. We've been testing it on Server 2008 & Win7 & it hangs with exception 0xc0000005 in ntdll.dll. After attempting to run it from the menu in the COM app, when we close the COM app it hangs as well. Does anyone know of any specific issue with 2008 & interop, say something to do with UAC or permissions( or anything else!)? The .NET app makes calls to the COM app, as well as being started by it, but its worked fine up to now, with no visible errors. I wish I could give more detail of the error, but the only concrete info seems to be the event log error. The COM app runs perfectly on Win2008, by the way. The .NET app doesn't work on 32 or 64 bit versions of Win2008. I'll supply more info, if people tell me what they want...

Response to comments below:

Its compiled on .NET 3.5 now (& was compiled with version 2) both of which are on the 2008 machine (just looked). I'm using the version of gacutils etc. from the appropriate .NET install as well

More comments:

Its compiled for x86. As far as UAC is concerned - I'm not familiar with the programming side of it,I presume there's a .NET API for it, but yes, Access Denied. I'm going to have to get on the UAC learning curve a bit more( and it also makes me wonder what I'm doing that could require elevated privs,perhaps the Win32 prog is demanding them).I've seen this blog entry which talks about using manifests .When I get back to my work machine(been off for day back 22nd p.m.) I shall post a call stack & anything else I can think of that might help. Thanks for your interest, people

Some code:

The calling code in the MFC/COM app:

void CMainFrame::OnTransportResourcetrackingGanntchart()
{
    HRESULT hr = m_spGant.CreateInstance(__uuidof(Fgant::Control_Gant));
    ASSERT(SUCCEEDED(hr));
    m_spGant->Control_Run();
    //m_spGant = NULL;
}


Relevant code in FGant.dll 
using GlobvarsLib;//as well as the .NET declarations
 // COM dll containing system-wide properties imported using tlbimp
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
    [Guid("A4586AC8-BC1D-4cbe-83CA-4F2A56F0E964")]
    public interface IGantControl
    {
     /// <summary>
     /// method to run Fgant from external application
     /// </summary>
        void Control_Run();
    }

    /// <summary>
    /// Control_Gant constructor
    /// </summary>
    [ClassInterface(ClassInterfaceType.None)]
    [Guid("BC4CF302-A973-445d-82BE-1BF0B4873D90")]
    public class Control_Gant : IGantControl
    {
     /// <summary>
     /// Default constructor
     /// </summary>
     public Control_Gant() { }

        [STAThread]
     void IGantControl.Control_Run()
     {
      Fgant gantt = new Fgant(true); //Inits Component,Calls PlotGantt with default date values
      DateTime startdate, enddate;
      int MinsLength = 15;
      startdate = gantt.Start;
      enddate = gantt.End;
      //Add 23:59:59 to enddate
            enddate = enddate.Date.AddSeconds(86399);
            gantt.BlobDivisor = 24;
            gantt.CentreGantt();
            gantt.VehicleRadioChecked = true;
      try
      {
       ResPlot res = new ResPlot(gantt.ResType());
       //See below for PlotGantt code
       gantt.PlotGantt(startdate, enddate, MinsLength, ResPlot.WhereClause, ResPlot.TitleString, ResPlot.ResType);
       Application.EnableVisualStyles();
       GlobalClass pGlobal = new GlobalClass();
       IntPtr pWnd = (IntPtr)pGlobal.get_MainWindow();
                NPlot.PointPlot.Active_Handle = pWnd;
                SwiftWindow sw = new SwiftWindow(pWnd);//'MainFrame' app window
                gantt.Show(sw);
      }

    PlotGantt snippet:
    GantUtils g = new GantUtils();  //Class that contains the DB conn.string from Globvarslib(i.e from the calling app)
      string ConnString = g.DBString;

      string selectCommand = String.Concat("SELECT StartDateTime, EndDateTime, Stage.Description, ", ResourceName, ", LoadNumber ",
                 Rigid, " , ROUND(((DATEDIFF(minute,StartDateTime,EndDateTime))/", MinsLength.ToString(), " ),0) AS \"StageDiff\" ",
                 ", '1' AS \"Orig_Row\", Stage.Type AS \"SType\" FROM Stage ", selectString, " AND StartDateTime >= '",
                 Startdt.ToString(), "' AND EndDateTime <= '", Enddt.ToString(), "' ORDER BY ", ResourceName, Rigid, ",Stage.Type, StartDatetime,EndDateTime");
         //   MessageBox.Show(selectCommand);
       OleDbDataAdapter dataAdapter = new OleDbDataAdapter(selectCommand, ConnString);
      dataAdapter.Fill(table);


    DBString code calling Glovarslib(In GantUtils()):
    public string ConnectionString()
    {
     GlobalClass pGlobal = new GlobalClass();
     string conn_string = "FILE NAME=" + pGlobal.UDLRootPath+pGlobal.SupportDir + SwiftDatabaseUDL;
     return conn_string;
    }

I suspect it could be failing either as soon as it gets the conn_string(1st thing it does involving interop) or when it does the SELECT on the database

(Call stack to follow)

related questions