|
楼主 |
发表于 2023-5-7 12:11
|
显示全部楼层
MoveMemory ByVal pFunc, ByVal VarPtr(HookBytes(0)), 6 运行这句代码后加密了的vbaproject就出问题打不开了,请各路- Public Function Hook() As Boolean
- Dim TmpBytes(0 To 5) As Byte
- Dim p As LongLong
- Dim OriginProtect As LongLong
- Hook = False
- pFunc = GetProcAddress(GetModuleHandleA("user32.dll"), "DialogBoxParamA")
- If VirtualProtect(ByVal pFunc, 6, &H40, OriginProtect) <> 0 Then
- MoveMemory ByVal VarPtr(TmpBytes(0)), ByVal pFunc, 6
- If TmpBytes(0) <> &H68 Then
- MoveMemory ByVal VarPtr(OriginBytes(0)), ByVal pFunc, 6
- p = GetPtr(AddressOf MyDialogBoxParam)
- HookBytes(0) = &H68
- MoveMemory ByVal VarPtr(HookBytes(1)), ByVal VarPtr(p), 4
- HookBytes(5) = &HC3
- MoveMemory ByVal pFunc, ByVal VarPtr(HookBytes(0)), 6
- Flag = True
- Hook = True
- End If
- End If
- End Function
复制代码 大师指点。 |
|