|
发表于 2018-1-17 23:02:17
|
显示全部楼层
江苏省连云港市
本帖最后由 阿婆 于 2018-1-17 23:06 编辑
我来跟个贴,顺便纠正你的一个小BUG,详见数据结构注释fWide
|
WinDropFile | 逻辑型 | | |
hWnd | 整数型 | | | | sFile | 文本型 | | | | UseAnsi | 逻辑型 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | ProcessId | 整数型 | | | hProcess | 整数型 | | | Buffer | 字节集 | | | hAddress | 整数型 | | | lenBuffer | 整数型 | | | lenWrite | 整数型 | | |
UseAnsi = 选择 (是否为空 (UseAnsi ), 真, UseAnsi )GetWindowThreadProcessId (hWnd, PtrInt (ProcessId )) 如果真 (ProcessId ≤ 0 )返回 (假)如果 (UseAnsi )Buffer = { 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + 到字节集 (sFile )Buffer = AnsiToUnicode (sFile ) Buffer = 取字节集左边 (Buffer, 取字节集长度 (Buffer ) - 2 ) Buffer = { 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 } + Buffer lenBuffer = 取字节集长度 (Buffer )hProcess = OpenProcess (位或 (8, 32 ), 0, ProcessId )hAddress = VirtualAllocEx (hProcess, 0, lenBuffer, 4096, 4 )WriteProcessMemory (hProcess, hAddress, PtrBin (Buffer ), lenBuffer, PtrInt (lenWrite )) 如果真 (lenWrite ≠ lenBuffer )返回 (假)如果 (UseAnsi )SendMessageA (hWnd, #WM_DROPFILES, hAddress, 0 )SendMessageW (hWnd, #WM_DROPFILES, hAddress, 0 )VirtualFreeEx (hProcess, hAddress, 0, #MEM_RELEASE )CloseHandle (hProcess )返回 (真)
|
|