Re: debugging - why my app doesn't run under Wine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wine version is 1.4

I am a linux novice so I don't know how to create the "+relay,+seh" log you refer to.  I tried including them as command line arguments to Wine but that didn't work.

The application can be downloaded from http://xxtinc.com/software-downloads.html  The download you would want is the first one (xxMWD-PCSuite V02.10 Setup.zip)  This will install a number of applications, but the one in question is the "xxNETserver" application.  This is all special-purpose code to support our company's hardware products, and when you install it, it will ask you several questions that will likely make you say "huh?".  You can just accept the default values for everything, but when you get to the one asking if you are going to use an RS232 port to connect to our hardware you should just say no.  It might be simpler for you if I were to just send you the EXE in question.

In the meantime, following is the source for the code which contains the failing call to "CoSetProxyBlanket".  Thanks for your help!



Code:
BOOL CxxNETserverApp::InitializeWMI()
{
   HRESULT hres;
	CString strError;

    // Step 1: --------------------------------------------------
    // Initialize COM. ------------------------------------------

    hres =  CoInitializeEx(0, COINIT_MULTITHREADED); 
    if (FAILED(hres))
    {
		strError.Format("Failed to initialize COM library. Error code = %X",hres);
		OutputDebugString (strError+"\n");
		g_EventFile.WriteEventFile(strError);
		AfxMessageBox (strError,MB_OK);
        return FALSE;                  // Program has failed.
    }

    // Step 2: --------------------------------------------------
    // Set general COM security levels --------------------------
    // Note: If you are using Windows 2000, you need to specify -
    // the default authentication credentials for a user by using
    // a SOLE_AUTHENTICATION_LIST structure in the pAuthList ----
    // parameter of CoInitializeSecurity ------------------------

    hres =  CoInitializeSecurity(
        NULL, 
        -1,                          // COM negotiates service
        NULL,                        // Authentication services
        NULL,                        // Reserved
        RPC_C_AUTHN_LEVEL_DEFAULT,   // Default authentication 
        RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation  
        NULL,                        // Authentication info
        EOAC_NONE,                   // Additional capabilities 
        NULL                         // Reserved
        );

                      
    if (FAILED(hres))
    {
		strError.Format("Failed to initialize COM security. Error code = %X",hres);
		OutputDebugString (strError+"\n");
		g_EventFile.WriteEventFile(strError);
		AfxMessageBox (strError,MB_OK);
        CoUninitialize();
        return FALSE;                      // Program has failed.
    }
    
    // Step 3: ---------------------------------------------------
    // Obtain the initial locator to WMI -------------------------

    m_pLoc = NULL;

    hres = CoCreateInstance(
        CLSID_WbemLocator,             
        0, 
        CLSCTX_INPROC_SERVER, 
        IID_IWbemLocator, (LPVOID *) &m_pLoc);
 
    if (FAILED(hres))
    {
		strError.Format("Failed to create IWbemLocator object. Error code = %X",hres);
		OutputDebugString (strError+"\n");
		g_EventFile.WriteEventFile(strError);
		AfxMessageBox (strError,MB_OK);
        CoUninitialize();
        return FALSE;                 // Program has failed.
    }

    // Step 4: ---------------------------------------------------
    // Connect to WMI through the IWbemLocator::ConnectServer method

    m_pSvc = NULL;

   hres = m_pLoc->ConnectServer(
        _bstr_t(L"ROOT\\WMI"), 
        NULL,
        NULL, 
        0, 
        NULL, 
        0, 
        0, 
        &m_pSvc
    );
	    
    if (FAILED(hres))
    {
		strError.Format("Could not connect to ROOT\\WMI namespace. Error code = %X",hres);
		OutputDebugString (strError+"\n");
		g_EventFile.WriteEventFile(strError);
		AfxMessageBox (strError,MB_OK);
        m_pLoc->Release();     
        CoUninitialize();
        return FALSE;                // Program has failed.
    }

    cout << "Connected to ROOT\\WMI namespace" << endl;


    // Step 5: --------------------------------------------------
    // Set security levels on the proxy -------------------------

    hres = CoSetProxyBlanket(
        m_pSvc,                        // Indicates the proxy to set
        RPC_C_AUTHN_WINNT,           // RPC_C_AUTHN_xxx 
        RPC_C_AUTHZ_NONE,            // RPC_C_AUTHZ_xxx 
        NULL,                        // Server principal name 
        RPC_C_AUTHN_LEVEL_CALL,      // RPC_C_AUTHN_LEVEL_xxx 
        RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx
        NULL,                        // client identity
        EOAC_NONE                    // proxy capabilities 
    );

    if (FAILED(hres))
    {
        cout << "Could not set proxy blanket. Error code = 0x" 
             << hex << hres << endl;
        m_pSvc->Release();
        m_pLoc->Release();     
        CoUninitialize();
        return FALSE;               // Program has failed.
    }

    // Step 6: -------------------------------------------------
    // Receive event notifications -----------------------------

    // Use an unsecured apartment for security
    m_pUnsecApp = NULL;

    hres = CoCreateInstance(CLSID_UnsecuredApartment, NULL, 
        CLSCTX_LOCAL_SERVER, IID_IUnsecuredApartment, 
        (void**)&m_pUnsecApp);
 
    m_pSink = new EventSink;
    m_pSink->AddRef();
	m_pSink->m_pProcessingThread = this;

    m_pStubUnk = NULL; 
    m_pUnsecApp->CreateObjectStub(m_pSink, &m_pStubUnk);

    m_pStubSink = NULL;
    m_pStubUnk->QueryInterface(IID_IWbemObjectSink,
        (void **) &m_pStubSink);

    // The ExecNotificationQueryAsync method will call
    // The EventQuery::Indicate method when an event occurs

	// the queries are taken from MS sample code

    hres = m_pSvc->ExecNotificationQueryAsync(
        _bstr_t("WQL"), 
         _bstr_t("SELECT * FROM MSNdis_StatusMediaDisconnect"), 
        WBEM_FLAG_SEND_STATUS, 
        NULL, 
        m_pStubSink);

	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_StatusMediaConnect"), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

 	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_NotifyAdapterRemoval"), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_NotifyAdapterArrival"), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

 	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_StatusResetStart"), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_StatusResetEnd"), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_NotifyVcArrival"), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_StatusLinkSpeedChange"), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

	// added 26 Sept 2011
	if (SUCCEEDED(hres))
	{
		hres = m_pSvc->ExecNotificationQueryAsync(
			_bstr_t("WQL"), 
			 _bstr_t("SELECT * FROM MSNdis_StatusProtocolBind "), 
			WBEM_FLAG_SEND_STATUS, 
			NULL, 
			m_pStubSink);
	}

  // Check for errors.
    if (FAILED(hres))
    {
		strError.Format("ExecNotificationQueryAsync failed. Error code = %X",hres);
		OutputDebugString (strError+"\n");
		g_EventFile.WriteEventFile(strError);
		AfxMessageBox (strError,MB_OK);
        m_pSvc->Release();
        m_pLoc->Release();
        m_pUnsecApp->Release();
        m_pStubUnk->Release();
        m_pSink->Release();
        m_pStubSink->Release();
        CoUninitialize();    
        return FALSE;
    }

    return TRUE;
}









[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux