Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Fix invalid signatures for hooked functions
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenByteDev committed Jul 9, 2021
1 parent 3f88e9c commit 4bc2034
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions InjectionPayload/InjectionEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public class MySimpleEntryPoint : IEntryPoint {

#region Hooks
#pragma warning disable IDE1006 // Naming Styles
[UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Auto, SetLastError = true)]
private unsafe delegate IntPtr cef_urlrequest_create_delegate(cef_request_t* request, IntPtr client, IntPtr request_context, IntPtr unknown);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode, SetLastError = true)]
private unsafe delegate IntPtr cef_urlrequest_create_delegate(cef_request_t* request, IntPtr client, IntPtr request_context);

[DllImport("libcef.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto, SetLastError = true)]
private unsafe static extern IntPtr cef_urlrequest_create(cef_request_t* request, IntPtr client, IntPtr request_context, IntPtr unknown);
[DllImport("libcef.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, SetLastError = true)]
private unsafe static extern IntPtr cef_urlrequest_create(cef_request_t* request, IntPtr client, IntPtr request_context);

private unsafe IntPtr cef_urlrequest_create_hook(cef_request_t* request, IntPtr client, IntPtr request_context, IntPtr unknown) {
private unsafe IntPtr cef_urlrequest_create_hook(cef_request_t* request, IntPtr client, IntPtr request_context) {
try {
var req = new CefRequest(request);
var url = req.GetUrl();
Expand All @@ -83,13 +83,13 @@ public class MySimpleEntryPoint : IEntryPoint {
}

// now call the original API...
return cef_urlrequest_create(request, client, request_context, unknown);
return cef_urlrequest_create(request, client, request_context);
}

[UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)]
private delegate int getaddrinfo_delegate(IntPtr node, IntPtr service, IntPtr hints, IntPtr res);

[DllImport("WS2_32.dll", SetLastError = true, CharSet = CharSet.Auto)]
[DllImport("WS2_32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, SetLastError = true)]
private static extern int getaddrinfo(IntPtr node, IntPtr service, IntPtr hints, IntPtr res);

private int get_addr_info_hook(IntPtr node, IntPtr service, IntPtr hints, IntPtr res) {
Expand Down

0 comments on commit 4bc2034

Please sign in to comment.