News:

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

Duplicate Handle

Started by Danesh, July 13, 2005, 12:06:26 AM

Previous topic - Next topic

Danesh

Hi all,

I want to know is duplicating a file handle a costly task ? I mean would it have any negative effect on performance if each write operation be done by one handle duplicating ? I am working on a program and the source file which is shared may change so I can can not get a handle to ir once and should get handle each time I want to write to it, would it kill the performance ? Besides, I thought DuplicateHandle may work for duplicating file handles but it seems it doesn't. It just works for process handles not files. Does anybody know how a file handle can be duplicated ?

Thanks,

Danesh


Danesh

Hi again,

Well it is solved. Thanks for your helps  :lol
I found out that DuplicateHandle can be used to duplicate an object handle and therefor files too.
I used it like this:

Invoke GetCurrentProcess
Mov ProcessHdl, eax

Invoke DuplicateHandle, ProcessHdl, OrigHandle, ProcessHdl, Addr DupHandle, DUPLICATE_SAME_ACCESS, FALSE, DUPLICATE_SAME_ACCESS


and it works.