-
December 16th, 2005, 04:14 PM
#1
Passing a handle between processes
Hi,
I am researching if it is possible to pass a handle to the serial port to another process. If I have process A that opened a handle to the serial port and then process A forks a new process B (If even possible) by calling an execultable on the hardrive. Can process A pass the handle as a command line argument to process B or maybe put the address in the registry where process B can access it. Thanks
Amish
-
December 16th, 2005, 05:02 PM
#2
Re: Passing a handle between processes
child process inherits all handles of the parent. Its not necessary to pass anything from parent to child because child already knows about the open handles.
http://www.hmug.org/man/2/fork.php
>>maybe put the address in the registry
*nix doesn't have anything called "the registry" -- that's an MS-Windows term. And MS-Windows doesn't "fork" new processes, that's a *nix term. Which operating system are you using anyway?
Last edited by stober; December 16th, 2005 at 05:04 PM.
-
December 16th, 2005, 08:05 PM
#3
Re: Passing a handle between processes
Sorry,
I forgot to add that, I will be using Windows. I guess I get confused with all the fuctions between linux and windows. Is there anything like fork in windows.
Amish
-
December 16th, 2005, 11:00 PM
#4
Re: Passing a handle between processes
Processes in Windows can be created using an API like CreateProcess.
One parameter of interest to you might be -
Code:
BOOL CreateProcess(
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
);
-
December 16th, 2005, 11:02 PM
#5
Re: Passing a handle between processes
[ redirected ]
Regards,
Siddhartha
-
December 17th, 2005, 11:31 AM
#6
Re: Passing a handle between processes
Sweet that fits my design. Thanks a lot,
Amish
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|