Skip to content

Instantly share code, notes, and snippets.

@trylek
Created April 13, 2020 16:51
Show Gist options
  • Save trylek/73b47675c550163bc047325d8e3096d7 to your computer and use it in GitHub Desktop.
Save trylek/73b47675c550163bc047325d8e3096d7 to your computer and use it in GitHub Desktop.
Interop+Kernel32::ReadFile PInvoke IL stub generated by Crossgen2
NDirect IL stub dump: ILStubClass::IL_STUB_PInvoke
incoming managed sig: 00007FFC5AF71DB1: int32 *(class System.Runtime.InteropServices.SafeHandle,uint8*,int32,int32&,native int)
locals sig: 00000222930A8DC1: (int32,native int,bool,int64,int64,int32& pinned,int64,int32,int32,int32)
try_begin: 0x0004 try_end: 0x005e finally_begin: 0x0061 finally_end: 0x006e
dwStubFlags: 0x00000002
NDIRECTSTUB_FL_BESTFIT
jitFlags:
CORJIT_FLAGS::CORJIT_FLAG_IL_STUB
CORJIT_FLAGS::CORJIT_FLAG_PUBLISH_SECRET_PARAM
Initialize {
( 0) ldc.i4.0
( 1) stloc.2
}
Marshal {
( 0) ldc.i4.0
( 1) stloc.0
IL_0004: ( 0) ldarg.0
( 1) ldloca.s 0x2
( 2) call 0x06000001 native int [System.Private.CoreLib] System.StubHelpers.StubHelpers::SafeHandleAddRef(class System.Runtime.InteropServices.SafeHandle,bool&)
( 1) stloc.1
( 0) nop // argument {
( 0) ldarg.1
( 1) stloc.3
( 0) nop // } argument
( 0) nop // argument {
( 0) ldarg.2
( 1) conv.i8
( 1) stloc.s 0x4
( 0) nop // } argument
( 0) nop // argument {
( 0) ldarg.3
( 1) stloc.s 0x5
( 0) nop // } argument
( 0) nop // argument {
( 0) ldarg.s 0x4
( 1) stloc.s 0x6
( 0) nop // } argument
( 0) nop // return {
( 0) nop // } return
}
CallMethod {
( 0) ldloc.1
( 1) ldloc.3
( 2) ldloc.s 0x4
( 3) ldloc.s 0x5
( 4) ldloc.s 0x6
( 5) call 0x06000003 void [System.Private.CoreLib] System.StubHelpers.StubHelpers::ClearLastError()
( 5) call 0x06000004 native int [System.Private.CoreLib] System.StubHelpers.StubHelpers::GetStubContext()
( 6) ldc.i4.s 0x48
( 7) add
( 6) ldind.i
( 6) ldind.i
( 6) calli 0x11ffffff unmanaged stdcall int32(native int,int64,int64,native int,int64)
( 1) call 0x06000005 void [System.Private.CoreLib] System.StubHelpers.StubHelpers::SetLastError()
}
UnmarshalReturn {
( 1) nop // return {
( 1) stloc.s 0x8
( 0) ldloc.s 0x8
( 1) stloc.s 0x7
( 0) ldloc.s 0x7
( 1) nop // } return
( 1) stloc.s 0x9
}
Unmarshal {
( 0) nop // argument {
( 0) nop // } argument
( 0) nop // argument {
( 0) nop // } argument
( 0) nop // argument {
( 0) nop // } argument
( 0) nop // argument {
( 0) nop // } argument
( 0) leave IL_005e
IL_005e: ( 0) ldloc.s 0x9
( 1) ret
}
ExceptionCleanup {
IL_0061:
}
Cleanup {
( 0) ldloc.2
( 1) brfalse IL_006d
( 0) ldarg.0
( 1) call 0x06000002 void [System.Private.CoreLib] System.StubHelpers.StubHelpers::SafeHandleRelease(class System.Runtime.InteropServices.SafeHandle)
IL_006d: ( 0) endfinally
IL_006e:
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment