MCPcopy Create free account
hub / github.com/T3nb3w/ComDotNetExploit / GetStaticMethodLoad

Method GetStaticMethodLoad

Bypass_COM_PPL/dotnet_interop.cpp:40–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 }
39
40mscorlib::_MethodInfoPtr DotNetInterop::GetStaticMethodLoad(mscorlib::_TypePtr type, LPCWSTR methodName, int pcount) {
41
42 LPSAFEARRAY methods = type->GetMethods_2();
43 mscorlib::_MethodInfoPtr ret;
44 LONG methodCount = GetSafeArrayLen(methods);
45 int choose = 0;
46 for (long i = 0; i < methodCount; ++i)
47 {
48 IUnknown* v = nullptr;
49
50 if (SUCCEEDED(SafeArrayGetElement(methods, &i, &v)))
51 {
52 mscorlib::_MethodInfoPtr method = v;
53 bstr_t name = method->Getname();
54 LPSAFEARRAY params = method->GetParameters();
55 long paramCount = GetSafeArrayLen(params);
56
57 if (method->IsStatic && wcscmp(name.GetBSTR(), methodName) == 0 && paramCount == pcount)
58 {
59 if (choose == 2)
60 {
61 ret = method;
62
63 break;
64 }
65 choose += 1;
66
67 }
68
69 }
70 }
71
72 SafeArrayDestroy(methods);
73
74 return ret;
75}

Callers

nothing calls this directly

Calls 1

GetSafeArrayLenFunction · 0.85

Tested by

no test coverage detected