|
|
Up |
|
|
  |
Author: Andrew FalangaAndrew Falanga
Date: Jan 31, 2008 12:27
Hi,
I've got something of a chicken and egg situation that I'm wondering
about. This has to do with the sharing of certain data between
separate processes (see some of my earlier postings). I'm trying to
duplicate a socket from one processes to another. The problem is, to
create the socket in the target process, one uses WSADuplicateSocket
in the source and WSASocket in the target.
In the target process, the WSASocket call requires a WSAPROTOCOL_INFO
struct which would be filled from the call to WSADuplicateSocket in
the source process. However, the WSADuplicateSocket call requires a
handle to the target process for the duplication of the socket. Thus,
the target process must be started and then the call to
WSADuplicateSocket.
The problem is, I'm concerned my target process will startup and
attempt to read from my shared memory area before I'm able to populate
it with the contents of the necessary WSAPROTOCOL_INFO structure
needed to create the duplicated socket. Basically, because the source
process must do; CreateProcess, WSADuplicateSocket, CopyMemory instead
of something like, WSADuplicateSocket, CopyMemory, CreateProcess.
|
| Show full article (2.32Kb) |
|
| |
2 Comments |
|
  |
Author: Andrew FalangaAndrew Falanga
Date: Jan 31, 2008 09:21
On Jan 30, 6:52 pm, Norman Bullen BlackKittenAssociates.com>
wrote:
> Andrew Falanga wrote:
>> On Jan 30, 3:19 pm, "Scott McPhillips [MVP]"
>> scottmcp> wrote:
>
>>>"Andrew Falanga" gmail.com> wrote in message
>
>
>>>>2) the source then duplicates the socket and then sends the
>>>>WSAPROTOCOL_INFO structure to the target process. How is this done,
>>>>exactly? Is this done with signals? Is it done with shared memory?
>>>>What form of IPC is utilized in Windows? If there are more than one
>>>>mechanism which is preferred.
>
>>>There are about a dozen forms of IPC available. Perhaps the simplest,
>>>appropriate only if the receiving side runs a message pump, is
>>>SendMessage(hwnd, WM_COPYDATA, ....), where the required destinationn HWND
>>>can be obtained from FindWindow(). This copies a structure you pass from ...
|
| Show full article (2.65Kb) |
|
| |
1 Comment |
|
  |
Author:
Date: Jan 31, 2008 08:35
> Now, here is where it gets ugly. login() is a simple function where I
> just have a few more tasks to do in OnDocumentComplete. However, I
> have many more automation tasks that perform much more complex tasks
> and it is difficult to keep track of the program flow. If I have to
> navigate to a few pages, I have to chop up the code between the main
> function and the callpack function. Is there an elegant way to handle
> this? The program is single-threaded so I can't use loop to wait
> until navigate2 finishes loading the page. It would be nice if I can
> somehow make navigate2 not return until the page is done loading.
"Somehow make navigate2 not return until..." is called procedural
programming. It is dead in GUI programs. The necessary alternative is
event-driven programming, in which you must relinquish control until you are
notified that new input is available. And yes, this looks ugly, especially
to folks who are new to this paradigm.
|
| Show full article (1.92Kb) |
|
no comments
|
|
  |
Author: Andrew FalangaAndrew Falanga
Date: Jan 31, 2008 07:36
On Jan 30, 6:52 pm, Norman Bullen BlackKittenAssociates.com>
wrote:
> Andrew Falanga wrote:
>> On Jan 30, 3:19 pm, "Scott McPhillips [MVP]"
>> scottmcp> wrote:
>
>>>"Andrew Falanga" gmail.com> wrote in message
>
>
>>>>2) the source then duplicates the socket and then sends the
>>>>WSAPROTOCOL_INFO structure to the target process. How is this done,
>>>>exactly? Is this done with signals? Is it done with shared memory?
>>>>What form of IPC is utilized in Windows? If there are more than one
>>>>mechanism which is preferred.
>
>>>There are about a dozen forms of IPC available. Perhaps the simplest,
>>>appropriate only if the receiving side runs a message pump, is
>>>SendMessage(hwnd, WM_COPYDATA, ....), where the required destinationn HWND
>>>can be obtained from FindWindow(). This copies a structure you pass from ...
|
| Show full article (2.39Kb) |
|
no comments
|
|
  |
|
|
  |
Author: Andrew FalangaAndrew Falanga
Date: Jan 31, 2008 07:25
On Jan 30, 6:52 pm, Norman Bullen BlackKittenAssociates.com>
wrote:
> Andrew Falanga wrote:
>> On Jan 30, 3:19 pm, "Scott McPhillips [MVP]"
>> scottmcp> wrote:
>
>>>"Andrew Falanga" gmail.com> wrote in message
>
>
>>>>2) the source then duplicates the socket and then sends the
>>>>WSAPROTOCOL_INFO structure to the target process. How is this done,
>>>>exactly? Is this done with signals? Is it done with shared memory?
>>>>What form of IPC is utilized in Windows? If there are more than one
>>>>mechanism which is preferred.
>
>>>There are about a dozen forms of IPC available. Perhaps the simplest,
>>>appropriate only if the receiving side runs a message pump, is
>>>SendMessage(hwnd, WM_COPYDATA, ....), where the required destinationn HWND
>>>can be obtained from FindWindow(). This copies a structure you pass from ...
|
| Show full article (2.39Kb) |
|
no comments
|
|
|
|
|