How to activate VS2010 Process Debug Manager for JavaScript?

I have a server application ( not a website, not HTML or a browser) that provides extensibility in the form of JavaScript scripts. Theoretically, I should be able to debug them using the Visual Studio debugger using the Process Debug Manager application.

My VS2010 is correctly installed and activated, but when I call CoCreateInstance, like this:

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

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

So what do I need to do to register the VS2010 script debugger in the registry so that I can run the Process Debug Manager?

+4
source share
2 answers

If you get REGDB_E_CLASSNOTREG, maybe you are mixing 32-bit and 64-bit things: maybe you are trying to call CoCreateInstance from a 64-bit program if you don't have 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 a pointer to void. You did not specify what type of _PDM is, so I cannot say if you declared it correctly (although you should have received a compiler warning if that were the case.)

Edited 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; } 

There is no real error checking, it does nothing but checking one basic function, etc., but it does not cause any errors. You did not provide any details as to what “does not work” means, and as I said, I don’t know how to use this material, but I can at least get IProcesDebugManager and IDebugApplication with this code.

+1
source

E_INVALIDARG usually indicates passing an invalid function argument! It is usually not very clear what went wrong, I think this is an artifact with which CLR and COM interact.

IProcessDebugManager looks like a CLR interface, see http://msdn.microsoft.com/en-us/library/w1ktkdaz%28v=vs.94%29.aspx

Parameter 4 looks like a CLR interface, not a REFIID, however I can’t be sure, since I don’t know which language you are using, because I do not recognize the use of “nil”; C # uses null, C ++ / CLI uses nullptr, and VB uses Nothing.

IIDs are GUIDs that are represented as strings, can your compiler convert the CLR type to a string and pass this? My best guess: COM wants to have a real GUID for the REFIID and cannot parse everything that IProcessDebugManager.ToString () calls.

0
source

Source: https://habr.com/ru/post/1394039/


All Articles