Esempio n. 1
0
int main()
{
    IPC_InitLog(">>>");
    IPC_Connect("/builds/moz-trunk/seamonkey-debug-build/dist/bin/mozilla-ipcd");
    IPC_Disconnect();
    return 0;
}
Esempio n. 2
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
#endif
{
    IPC_InitLog("###");

    LOG(("daemon started...\n"));

    if (!AcquireLock()) {
        // unblock the parent; it should be able to find the IPC window of the
        // other daemon process.
        IPC_NotifyParent();
        return 0;
    }

    // initialize global data
    memset(ipcClientArray, 0, sizeof(ipcClientArray));
    ipcClients = ipcClientArray;
    ipcClientCount = 0;

    // create message window up front...
    WNDCLASS wc;
    memset(&wc, 0, sizeof(wc));
    wc.lpfnWndProc = WindowProc;
    wc.lpszClassName = IPC_WINDOW_CLASS;

    RegisterClass(&wc);

    ipcHwnd = CreateWindow(IPC_WINDOW_CLASS, IPC_WINDOW_NAME,
                           0, 0, 0, 10, 10, NULL, NULL, NULL, NULL);

    // unblock the parent process; it should now look for the IPC window.
    IPC_NotifyParent();

    if (!ipcHwnd)
        return -1;

    // load modules relative to the location of the executable...
    {
        char path[MAX_PATH];
        GetModuleFileName(NULL, path, sizeof(path));
        IPC_InitModuleReg(path);
    }

    LOG(("entering message loop...\n"));
    MSG msg;
    while (GetMessage(&msg, ipcHwnd, 0, 0))
        DispatchMessage(&msg);

    // unload modules
    IPC_ShutdownModuleReg();

    //
    // we release the daemon lock before destroying the window because the
    // absence of our window is what will cause clients to try to spawn the
    // daemon.
    //
    ReleaseLock();

    //LOG(("sleeping 5 seconds...\n"));
    //PR_Sleep(PR_SecondsToInterval(5));

    LOG(("destroying message window...\n"));
    DestroyWindow(ipcHwnd);
    ipcHwnd = NULL;

    LOG(("exiting\n"));
    return 0;
}