Esempio n. 1
0
bool SharedMemory::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle)
{
    ASSERT_ARG(handle, !handle.m_handle);
    ASSERT_ARG(handle, !handle.m_size);

    uint64_t size;
    if (!decoder->decodeUInt64(size))
        return false;

    uint64_t sourceHandle;
    if (!decoder->decodeUInt64(sourceHandle))
        return false;

    uint32_t sourcePID;
    if (!decoder->decodeUInt32(sourcePID))
        return false;

    HANDLE duplicatedHandle;
    if (!getDuplicatedHandle(reinterpret_cast<HANDLE>(sourceHandle), sourcePID, duplicatedHandle))
        return false;

    handle.m_handle = duplicatedHandle;
    handle.m_size = size;
    return true;
}
Esempio n. 2
0
Bool fillBackandParams(
    void*            self,
    BackendParams    param,
    HANDLE           childProcess,
    int              childPid)
{
    HANDLE signListener;

    strcpy(param->dataDir, DataDir, MAX_PATH);
    memcpy(param->listenSockets, &ListenSockets, sizeof(socket_type));

    param->cancelKey = CancelKey;;
    param->childSlot = ChildSlot;

    param->segmId    = NULL;
    param->segmAddr  = NULL;

    ProcId           = GetProcessId(GetCurrentProcess());
    param->processId = ProcId;

    param->startTime      = StartTime;
    param->reloadTime     = ReloadTime;
    param->loggerFileTime = LoggerFileTime;

    param->redirectDone           = RedirectDone;
    param->IsBinaryUpgrade        = False;
    param->maxSafeFileDescriptors = maxFileDescriptors;
    param->masterHandle           = NULL;

#ifdef _WIN32

    //signListener = createSignalListener(self, childPid);

    if (childProcess == NULL)
    {
        if (!getDuplicatedHandle(
                    self,
                    &(param->initPipe),
                    signListener,
                    childProcess))
        {
            return False;
        }
    }

#endif

    memcpy(&param->logPipe, logPipe, sizeof(logPipe));
    strcpy(param->execPath, ExecPath, MAX_PATH);
    return True;
}