flat assembler
Message board for the users of flat assembler.

Index > Windows > Invalid Handle : GetExitCodeThread

Author
Thread Post new topic Reply to topic
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
Code:
invoke GetCurrentThreadId
mov dword [threadter],eax
invoke  CreateRemoteThread,-1,0,0,start6,0,0,thrid


;invoke  CreateThread,0,0,start5,0,0,thrid
;invoke CloseHandle,eax

;invoke TerminateThread,eax,0

SysInvoke ZWTerminateThread,0,0





proc start6
align 16


invoke GetExitCodeThread, dword [threadter],dword [codebegin]    


I'm getting invalid handle when calling getexitcode thread... And I'm just wondering why?
Post 19 Jan 2006, 06:40
View user's profile Send private message Reply with quote
chris



Joined: 05 Jan 2006
Posts: 62
Location: China->US->China->?
chris
Hi, shism2

GetExitCodeThread takes the thread handle not the thread id as the first parameter.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getexitcodethread.asp
Post 19 Jan 2006, 06:53
View user's profile Send private message Reply with quote
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
so how can I get my starting process thread handle ?
Post 19 Jan 2006, 12:11
View user's profile Send private message Reply with quote
velox



Joined: 06 Jan 2006
Posts: 14
velox
the return value of CreateThread / CreateRemoteThread api is the handle.
Post 19 Jan 2006, 12:26
View user's profile Send private message Reply with quote
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
i know that... but how can I get my own process thread handle...
Post 19 Jan 2006, 20:26
View user's profile Send private message Reply with quote
velox



Joined: 06 Jan 2006
Posts: 14
velox
GetCurrentProcess, GetCurrentThread - read msdn for more information, especially if you want to obtain a "real" handle, which is valid in other
processes too..
Post 19 Jan 2006, 21:51
View user's profile Send private message Reply with quote
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
Code:
invoke GetCurrentThread
mov dword [threadter],eax
invoke  CreateRemoteThread,-1,0,0,start6,0,0,thrid


;invoke  CreateThread,0,0,start5,0,0,thrid
;invoke CloseHandle,eax

;invoke TerminateThread,eax,0

SysInvoke ZWTerminateThread,0,0



proc start6
align 16


invoke GetExitCodeThread, dword [threadter],dword [codebegin]    


The program just crashes... at GetExitCodeThread
Post 19 Jan 2006, 22:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.