0

How can i fix this problem? the code works fine as I tested it on a 32 bit computer but my 64 bit computer returns that error with getlasterror();

what can i do to fix this?

lolwut123
  • 33
  • 1
  • 5
  • Can you clarify what is 32-bit and what is 64-bit? When you say "my 64-bit computer", do you mean on a computer running a 64-bit operating system? Or when the code is compiled into a 64-bit executable? Or when you call `CreateRemoteThread` on a 64-bit remote process? Or what? (Also see answers to [this question](http://stackoverflow.com/questions/9456228/createremotethread-returning-error-access-denied-windows-7-dll-injection)) – David Schwartz Sep 04 '12 at 05:05
  • my computer is running on a 64-bit OS and i compiled the problem as 32bit. – lolwut123 Sep 04 '12 at 05:07
  • Are you trying to attach to a 64-bit process? – David Schwartz Sep 04 '12 at 05:07
  • that link did not help me i already saw that. – lolwut123 Sep 04 '12 at 06:03
  • Well, do you *have* the permission on your 64bit machine? Are you sure isn't [UAC](http://www.windowsecurity.com/articles/understanding-user-account-control-vista.html) at work? – Remus Rusanu Sep 04 '12 at 07:39
  • i run as admin and gave permissions in open process – lolwut123 Sep 04 '12 at 15:51

2 Answers2

0

Partial info:

When I was working with CreateRemoteThread on Win2000, everything was working fine except for the cases when I was starting remote threads in the processes that belonged to different terminal server sessions. On Win2003 (and on) all system processes work in TS session 0 that is different from the interactive session that you are currently logged in. At that time I has not managed to solve the TS session boundary problem. This is what you might need to check first.

It is more likely that this is not a 32/64 bit problem but some sort of security problem that requires special privileges and/or permissions.

Kirill Kobelev
  • 10,252
  • 6
  • 30
  • 51
  • i thought openProcess requests those permissions so i gave it to it (PROCESS_ALL_ACCESS) – lolwut123 Sep 04 '12 at 07:05
  • No, this is not true at all. I know this for sure from reliable sources from inside MS. Params to OpenProcess control what you can can do with the handle of the process itself. Other actions is a separate story. – Kirill Kobelev Sep 04 '12 at 08:20
0

I'm going to guess that your target process is a Managed executable, compiled for "Any CPU"...

If so, when you launch that exe on 64-bit Windows, it will JIT compile to 64-bit code, and thus become a 64-bit process.

You can then not call CreateRemoteThread on it, from a 32-bit process.

The same Managed exe launched on 32-bit Windows would JIT to 32-bit code, and therefore would work.

If that's the case, and you are the author of the Managed exe in question, rebuild it for x86.

pconnell
  • 4,551
  • 1
  • 14
  • 9