Function writeMailSlot(MailSlotName As String) As Long Dim KO_MSLOT As Long, pHook As String, p() As Byte, ph() As Byte, CF As Long, WF As Long, CH As Long KO_MSLOT = VirtualAllocEx(KO_HANDLE, 0, 1024, MEM_COMMIT, PAGE_READWRITE) If KO_MSLOT <= 0 Then Exit Function: MsgBox "memory could not be opened!", vbCritical CF = GetProcAddress(GetModuleHandle("kernel32.dll"), "CreateFileA") WF = GetProcAddress(GetModuleHandle("kernel32.dll"), "WriteFile") CH = GetProcAddress(GetModuleHandle("kernel32.dll"), "CloseHandle") Debug.Print Hex(KO_MSLOT) ConvHEX2ByteArray StringToHex(MailSlotName), p WriteByteArray KO_MSLOT + &H400, p, UBound(p) - LBound(p) + 1 pHook = "558BEC83C4F433C08945FC33D28955F86A0068800000006A036A006A01680000004068" & AlignDWORD(KO_MSLOT + &H400) & "E8" & AlignDWORD(getCallDiff(KO_MSLOT + &H27, CF)) & "8945F86A008D4DFC51FF750CFF7508FF75F8E8" & AlignDWORD(getCallDiff(KO_MSLOT + &H3E, WF)) & "8945F4FF75F8E8" & AlignDWORD(getCallDiff(KO_MSLOT + &H49, CH)) & "8BE55DC3" '&H49 ConvHEX2ByteArray pHook, ph WriteByteArray KO_MSLOT, ph, UBound(ph) - LBound(ph) + 1 writeMailSlot = KO_MSLOT End Function
Sub recvHook(MailSlotName As String, RecvFunction As Long, RecvBase As Long) Dim KO_MSLOT As Long, KO_RCVHK As Long, pHook As String, ph() As Byte KO_MSLOT = writeMailSlot(MailSlotName) If KO_MSLOT <= 0 Then Exit Sub: MsgBox "memory could not be opened!", vbCritical KO_RCVHK = VirtualAllocEx(KO_HANDLE, 0, 1024, MEM_COMMIT, PAGE_READWRITE) If KO_RCVHK <= 0 Then Exit Sub: MsgBox "memory could not be opened!", vbCritical
pHook = AlignDWORD(KO_RCVHK) ConvHEX2ByteArray pHook, ph WriteByteArray RecvBase, ph, UBound(ph) - LBound(ph) + 1 End Sub
Public Sub FindHook(MailSlotName As String) Dim KO_RECVHK As Long, KO_RCVHKB As Long KO_RECVHK = ReadLong(ReadLong(KO_PTR_DLG - &H14)) + &H8 KO_RCVHKB = ReadLong(KO_RECVHK) Debug.Print Hex(KO_RECVHK) & "//" & Hex(KO_RCVHKB) recvHook MailSlotName, KO_RCVHKB, KO_RECVHK End Sub
< Bu mesaj bu kişi tarafından değiştirildi Madara Uchiha -- 6 Ocak 2019; 20:34:57 >
Private Function ReadMessage1(Handle As Long, MailMessage As String, MessagesLeft As Long) Dim lBytesRead As Long, lNextMsgSize As Long, lpBuffer As String ReadMessage1 = False Call GetMailslotInfo(Handle, ByVal 0&, lNextMsgSize, MessagesLeft, ByVal 0&) If MessagesLeft > 0 And lNextMsgSize <> MAILSLOT_NO_MESSAGE Then lBytesRead = 0 lpBuffer = String$(lNextMsgSize, Chr$(0)) Call ReadFile(Handle, ByVal lpBuffer, Len(lpBuffer), lBytesRead, ByVal 0&) If lBytesRead <> 0 Then MailMessage = Left(lpBuffer, lBytesRead) ReadMessage1 = True Call GetMailslotInfo(Handle, ByVal 0&, lNextMsgSize, MessagesLeft, ByVal 0&) End If End If End Function
< Bu mesaj bu kişi tarafından değiştirildi Madara Uchiha -- 6 Ocak 2019; 20:34:57 >