Note that there are some explanatory texts on larger screens.

plurals
  1. POIn a remote thread, how do I call functions whose parameters contain pointers?
    primarykey
    data
    text
    <p>I want to call <code>SHFileOperation</code> using code injection. My code works fine while calling simple functions like <code>MessageBox</code> from <code>user32.dll</code>, but won't while calling <code>ShFileOperation</code> from <code>shell32.dll</code>.</p> <p>I'll post the part of the code that I think has the problem. I know the problem is in the struct implementation.</p> <p>Here is the image of RemoteInfo value:</p> <p><a href="http://www.freeimagehosting.net/uploads/219d79fc30.jpg" rel="nofollow noreferrer">http://www.freeimagehosting.net/uploads/219d79fc30.jpg</a></p> <pre> //Structure type LPSHFILEOPSTRUCT = ^SHFILEOPSTRUCT; SHFILEOPSTRUCT = packed record Wnd: HWND; wFunc: UINT; pFrom: PAnsiChar; pTo: PAnsiChar; fFlags: FILEOP_FLAGS; fAnyOperationsAborted: BOOL; hNameMappings: Pointer; lpszProgressTitle: PAnsiChar; end; //Remote Info type TRemoteInfo = record LoadLibrary: function(lpLibFileName: PChar): HMODULE; stdcall; GetProcAddress: function(hModule: HMODULE; lpProcName: LPCSTR): FARPROC; stdcall; shf: SHFILEOPSTRUCT; ; Kernel32: array[0..20] of Char; shell32: array[0..20] of Char; SHFileOperationA: array[0..20] of Char; Fromlpbuff: array[0..20] of char; //Source path Tolpbuff: array[0..20] of Char; //Des Path end; //Initialize .... ZeroMemory(@RemoteInfo, SizeOf(RemoteInfo)); RemoteInfo.shf.Wnd := 0; RemoteInfo.shf.wFunc := FO_COPY; RemoteInfo.shf.pFrom := @remoteInfo.Fromlpbuff; RemoteInfo.shf.pto := @remoteInfo.tolpbuff; lstrcpy(RemoteInfo.shf.pFrom, 'e:\1.jpg' + #0#0); lstrcpy(RemoteInfo.shf.pto, 'f:\1.jpg' + #0#0); RemoteInfo.shf.fFlags := FOF_ALLOWUNDO; RemoteInfo.shf.fAnyOperationsAborted := false; .... </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload