简体   繁体   中英

How do I activate VS2010's Process Debug Manager for JavaScript?

I've got a server application ( not a website, not HTML- or browser-based) that provides extensibility in the form of JavaScript scripts. Theoretically, I'm supposed to be able to debug them with Visual Studio's debugger through something called the Process Debug Manager.

I have VS2010 properly installed and activated, but when I call CoCreateInstance, like so:

CoCreateInstance(CLSID_ProcessDebugManager, nil,
  CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER, IProcessDebugManager, _PDM);

it returns $80070057 (E_INVALIDARG) , which is not documented behavior for CoCreateInstance . The documentation, however, describes an alternative way to do the same thing, with CoGetClassObject . When I try that, it returns REGDB_E_CLASSNOTREG , meaning that the CLSID is not registered in the Registry.

So what do I have to do to register VS2010's script debugger in the Registry so I can run Process Debug Manager?

If you're getting REGDB_E_CLASSNOTREG, you are probably mixing 32- and 64-bit stuff: probably you're trying to call CoCreateInstance from a 64-bit program, unless you've got a 64-bit version of VS2010 (do they have one?)

I also found this which was an instance of someone passing a pointer to void, not a pointer to pointer to void. You didn't show what type _PDM is, so I can't tell whether you declared it correctly (although you should've gotten a compiler warning if that was the case.)

Editted to add:

#pragma comment(lib, "ole32.lib")

#define UNICODE
#define STRICT
#include <windows.h>
#include <activdbg.h>

#include <iostream>
using std::wcout;
using std::hex;
using std::endl;

int main(void)
{
    HRESULT hr;

    IProcessDebugManager *ppdm = NULL;
    IDebugApplication *pda = NULL;
    IClassFactory *pcf = NULL;
    DWORD cook = 0;

    CoInitialize(NULL);

    hr = CoGetClassObject(CLSID_ProcessDebugManager, CLSCTX_INPROC_SERVER,
        NULL, IID_IClassFactory, (LPVOID *)&pcf);
    wcout << L"CoGetClassObject: " << std::hex << hr << endl;
    if (FAILED(hr)) goto done;

    hr = pcf->CreateInstance(0, IID_IProcessDebugManager32, (LPVOID *)&ppdm);
    wcout << L"CreateInstance: " << std::hex << hr << endl;
    if (FAILED(hr)) goto done;
    pcf->Release();

    hr = ppdm->CreateApplication(&pda);
    wcout << L"CreateApplication: " << std::hex << hr << endl;
    if (FAILED(hr)) goto done;

    ppdm->AddApplication(pda, &cook);
    pda->SetName(L"Moosh!");
    ppdm->RemoveApplication(cook);
    pda->Release();
    ppdm->Release();
done:
    CoUninitialize();
    return 0;
}

No real error checking, doesn't do anything but test one basic function, etc., but this doesn't throw any errors. You didn't provide any detail as to what "doesn't work" means, and as I think I mentioned, I don't know how to use this stuff, but I can at least get an IProcesDebugManager and an IDebugApplication with this code.

E_INVALIDARG usually indicates passing an incorrect argument to the function! It usually isn't very clear what went wrong, i think this is an artifact of the way CLR and COM interact.

IProcessDebugManager appears to be a CLR Interface see http://msdn.microsoft.com/en-us/library/w1ktkdaz%28v=vs.94%29.aspx

Parameter 4 appears to be a CLR Interface, not an REFIID, however i can't be sure, since i don't know what language your using as i do not recognize the use of 'nil'; C# uses 'null', C++/CLI uses 'nullptr', and VB uses 'Nothing'.

IIDs are GUIDs, which are represented as strings, could your compiler be converting the CLR type to a string and passing that? My best guess is that COM wants a real GUID for the REFIID, and can't parse whatever IProcessDebugManager.ToString() spits out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM