News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GetThreadContext fails :(

Started by nvidia5500, June 27, 2008, 01:53:52 PM

Previous topic - Next topic

nvidia5500

Anyway, im new here. Just learned assembly programming and im quite stuck with this:

Why does GetThreadContext always fails in this code:

invoke CreateProcess, offset filename, 0, 0, 0, 0, CREATE_SUSPENDED, 0, 0,  offset StartupInfo,  offset ProcessInfo
mov Context.ContextFlags, CONTEXT_FULL
invoke GetThreadContext, ProcessInfo.hThread, offset Context


After stepping from invoke GetThreadContext, my debugger displays eax=0. I cant seem to find the problem.
Also, adding align 16 at .data gives me assembler errors: invalid combination with segment alignment : 16

Help  :'(

bozo

Did you call GetLastError()?

I don't want to tell you the answer, not because i'm mean, but because you wouldn't realise what went wrong
and i've been there, and most on the board has too when learning assembly.
Trust me, you'll be a better programmer solving this error yourself.

things we need to know, are did the process start? if not, is it because some of the structures weren't properly initialized
or received invalid parameters?

http://msdn.microsoft.com/ is very useful

you can get the error message using : net helpmsg <DECIMAL ERROR CODE> or using FormatMessage api

nvidia5500

Quote from: Kernel_Gaddafi on June 27, 2008, 04:12:55 PM
I don't want to tell you the answer, not because i'm mean, but because you wouldn't realise what went wrong
and i've been there, and most on the board has too when learning assembly.
Trust me, you'll be a better programmer solving this error yourself.

You're cruel :). Anyway it waaaas a very stupid mistake. I made it to align 4 and it worked. Haha. Anyway thanks.
Just downloaded the masm reference book and Id say it's quite a useful resource