It doesn't work :(
This is my code in JITCompilationStarted callback (trying swap
System.Environment.Exit with my own)
//---------------------
HRESULT hr=0;
if (functionID==exitFunctionID)
{
    IMethodMalloc *allocator;
    m_pProfilerInfo->GetILFunctionBodyAllocator(mscorlibID,&allocator);
    allocator->Alloc(nopSize);
    hr=m_pProfilerInfo->SetILFunctionBody(mscorlibID,exitID,nopHeader); //
returns negative HRESULT
}
return S_OK;
//---------------------------
I set variables
    mscorlibID (ModuleID of mscorlib),
    exitID (mdMethodDef of System.Environmwnt.Exit(int)),
    nopSize and nopHeader (size and header of my own funcion)
in AssemblyLoadFinished callback;
    exitFunctionID (FunctionID of  System.Environmwnt.Exit(int))
in ClassLoadFinished callback.

Am I doing something wrong?


----- Original Message -----
From: "John Lam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 28, 2002 2:38 PM
Subject: Re: [DOTNET] Profiler API question

> I do this all day long ;)
>
> The docs aren't exactly clear about what profiler events you can use
> this from. It works fine when called during the JITCompilationStarted
> event. I used to know all of the boundary cases, but that should
> probably get you started.
>
> Have fun,
>
> -John
> http://www.iunknown.com

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to