能力值:
( LV2,RANK:10 )
|
-
-
2 楼
貌似远线程注入啊
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
goto....
|
能力值:
( LV9,RANK:210 )
|
-
-
4 楼
你再多写点程序吧,这样的问题其实不该问。代码没有测试过,你自己调试改改。
function CprjVPackV4BatchToolsDlg.FSendDropFile(strFilePath: AnsiString): Boolean;
var
dwBufferSize, dwProcessId: Dword;
hMain: HWND;
DropData: AnsiString;
pDrop: PDROPFILES;
hProcess: THandle;
pszRemote: Pointer;
begin
Result := False;
hMain = FindWindow(nil, '主程序界面');
if ( hMain = nil)
begin
ShowMessage('不能找到主程序!');
Exit;
end;
dwBufferSize := SizeOf(DROPFILES) + Length(strFilePath) + 1;
SetLength(DropData, dwBufferSize);
FillChar(PAnsiChar(DropData)^, dwBufferSize, 0);
pDrop := PDROPFILES(PAnsiChar(DropData));
pDrop^.pFiles := SizeOf(DROPFILES);
Move(PAnsiChar(strFilePath)^, (PAnsiChar(DropData) + SizeOf(DROPFILES))^, Length(strFilePath));
GetWindowThreadProcessId(hMain, dwProcessId);
if dwProcessId = 0 then Exit;
hProcess := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_WRITE, FALSE, dwProcessId);
if hProcess = 0 then Exit;
pszRemote := VirtualAllocEx(hProcess, nil, dwBufSize, MEM_COMMIT, PAGE_READWRITE);
if (pszRemote <> nil) then
begin
if(WriteProcessMemory(hProcess, pszRemote, pBuf, dwBufSize, 0)) then
begin
SendMessage(hMain, WM_DROPFILES, WPARAM(pszRemote), nil);
Resullt := True;
end;
VirtualFreeEx(hProcess, pszRemote, 0, MEM_RELEASE);//内存泄露1
end;
CloseHandle(hProcess);//内存泄露2
end;
|
能力值:
( LV6,RANK:90 )
|
-
-
5 楼
貌似是我写的,被百度到这里来了  疏忽了远程进程内存和句柄泄漏,多谢楼上提醒。
|