Skip to content

Instantly share code, notes, and snippets.

@kumatti1
kumatti1 / Module1.bas
Created June 1, 2015 22:28
DispInvokeHook
Option Explicit
Private Declare Function IsBadWritePtr Lib "kernel32" _
(ByVal lp As Long, ByVal ucb As Long) As Long
Private Declare Function VirtualProtect Lib "kernel32" _
(ByVal lpAddress As Long, ByVal dwSize As Long, _
ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
Private Declare Function VirtualAlloc Lib "kernel32" _
(ByVal lpAddress As Long, ByVal dwSize As Long, _
ByVal flAllocationType As Long, _
@kumatti1
kumatti1 / Module1.bas
Last active January 8, 2021 04:10
Declareフック
Option Explicit
Private Declare PtrSafe Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As LongPtr
Private Declare Function IsBadWritePtr Lib "kernel32" _
(ByVal lp As Long, ByVal ucb As Long) As Long
Private Declare Function VirtualProtect Lib "kernel32" _
(ByVal lpAddress As Long, ByVal dwSize As Long, _
ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
Private Declare Function VirtualAlloc Lib "kernel32" _
(ByVal lpAddress As Long, ByVal dwSize As Long, _
@kumatti1
kumatti1 / Module2.bas
Last active January 8, 2021 04:07
RtlCaptureStackBackTrace
Option Explicit
Private Declare PtrSafe _
Function SymInitialize Lib "imagehlp.dll" ( _
ByVal FramesToSkip As LongPtr, _
ByVal UserSearchPath As String, _
ByVal fInvadeProcess As Long _
) As Long
Private Declare PtrSafe _
@kumatti1
kumatti1 / Module3.bas
Created June 20, 2015 21:00
E_INVALIDARG
Private Declare PtrSafe _
Function InitVariantFromVariantArrayElem Lib "Propsys" ( _
ByRef varIn As Any, _
ByVal iElem As Long, _
ByRef pvar As Variant _
) As Long
Sub hoge()
Dim hr&
@kumatti1
kumatti1 / Module1.bas
Created July 3, 2015 22:04
マウスカーソル直下の要素を取得
'目的の要素を選択
Sub Main()
Application.OnTime Now + TimeSerial(0, 0, 2), "GetSub"
End Sub
Option Explicit
Private Const PAGE_EXECUTE_READWRITE = &H40
Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Long, Source As Long, ByVal Length As Long)
Private Declare Function VirtualProtect Lib "kernel32" (lpAddress As Long, _
ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
Private Declare Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _
ByVal lpProcName As String) As Long
Private Declare Function DialogBoxParam Lib "user32" Alias "DialogBoxParamA" (ByVal hInstance As Long, _
@kumatti1
kumatti1 / Module1.bas
Created December 30, 2015 22:46
ダイアログ出します(`・ω・´)ゞ
Option Explicit
Private Declare PtrSafe Function DoFileDownload Lib "ieframe.dll" (ByVal arg1 As LongPtr) As Long
Sub hoge()
DoFileDownload StrPtr("http://k.yimg.jp/images/top/sp2/cmn/logo-ns-131205.png")
End Sub
@kumatti1
kumatti1 / Module1.bas
Created January 23, 2016 04:12
Explorer検索
Option Explicit
Declare Function ILCreateFromPathW& Lib "Shell32.dll" (ByVal pszPath&)
Declare Sub ILFree Lib "Shell32.dll" (ByVal pidl&)
Declare Function ILGetSize& Lib "Shell32.dll" (ByVal pidl&)
Private Declare _
Function InitVariantFromBuffer Lib "propsys.dll" ( _
ByVal pv As LongPtr, _
ByVal cb As Long, _
ByRef pvar As Variant _
@kumatti1
kumatti1 / Module1.bas
Last active January 8, 2021 02:28
Explorerのファイル選択
Option Explicit
Private Declare Function ILCreateFromPathW& Lib "Shell32.dll" (ByVal pszPath&)
Private Declare Sub ILFree Lib "Shell32.dll" (ByVal pidl&)
Private Declare Function ILGetSize& Lib "Shell32.dll" (ByVal pidl&)
Private Declare _
Function InitVariantFromBuffer Lib "propsys.dll" ( _
ByVal pv As LongPtr, _
ByVal cb As Long, _
ByRef pvar As Variant _
@kumatti1
kumatti1 / Module1.bas
Last active January 8, 2021 02:27
WinHttpとIPersistStreamInit
Option Explicit
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type