Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal unsafe static uint InjectDll(sbyte* process, sbyte* dll)
- {
- //IL_0002: Expected I, but got I8
- //IL_0006: Expected I, but got I8
- //IL_0009: Expected I, but got I8
- //IL_004b: Expected I, but got I8
- //IL_0096: Expected I, but got I8
- void* ptr = null;
- void* ptr2 = null;
- void* ptr3 = null;
- uint num7;
- if (GetProcessbyNameOrId(process, &ptr2, 1082u) != 0)
- {
- ulong num = strnlen(dll, 260uL);
- if (num < 260)
- {
- ulong num2 = num + 1;
- ptr = VirtualAllocEx(ptr2, null, num2, 12288u, 4u);
- if (ptr != null)
- {
- ulong num3;
- if (WriteProcessMemory(ptr2, ptr, dll, num2, &num3) != 0)
- {
- IntPtr procAddress = GetProcAddress(GetModuleHandleA((sbyte*)(&?A0x51f828d3.unnamed-global-31)), (sbyte*)(&?A0x51f828d3.unnamed-global-30));
- if (procAddress != (IntPtr)0)
- {
- uint num4;
- ptr3 = CreateRemoteThread(ptr2, null, 0uL, procAddress, ptr, 0u, &num4);
- if (ptr3 != null)
- {
- uint num5 = WaitForSingleObject(ptr3, 10000u);
- if (num5 == 0)
- {
- uint num6;
- int exitCodeThread = GetExitCodeThread(ptr3, &num6);
- if (exitCodeThread != 0 && num6 != 0)
- {
- num7 = 0u;
- }
- else if (exitCodeThread != 0)
- {
- num7 = 1287u;
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-32), __arglist());
- }
- else
- {
- num7 = GetLastError();
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-33), __arglist(num7));
- }
- }
- else
- {
- num7 = num5;
- sbyte* ptr4 = (sbyte*)(long)((num5 != 258) ? ((IntPtr)(&?A0x51f828d3.unnamed-global-35)) : ((IntPtr)(&?A0x51f828d3.unnamed-global-34)));
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-36), __arglist(ptr4));
- }
- CloseHandle(ptr3);
- }
- else
- {
- num7 = GetLastError();
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-37), __arglist(GetProcessId(ptr2), num7));
- }
- }
- else
- {
- num7 = GetLastError();
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-38), __arglist(num7));
- }
- }
- else
- {
- num7 = GetLastError();
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-39), __arglist(GetProcessId(ptr2), num7));
- }
- if (VirtualFreeEx(ptr2, ptr, 0uL, 32768u) == 0)
- {
- num7 = GetLastError();
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-40), __arglist(num7));
- }
- }
- else
- {
- num7 = GetLastError();
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-41), __arglist(GetProcessId(ptr2), num7));
- }
- }
- else
- {
- num7 = 111u;
- printf((sbyte*)(&?A0x51f828d3.unnamed-global-42), __arglist());
- }
- CloseHandle(ptr2);
- }
- else
- {
- num7 = 1168u;
- }
- return num7;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement