亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? notlstnr.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁 / 共 2 頁
字號(hào):
APIEXPORT DWORD S4N_Write(
        DWORD dwData,
        LPVOID pInBuf,
        DWORD dwInLen
        ) {
    DebugPrint(TEXT("Write - dwData: %lx\n"), dwData);
    return 0;
}


/**
* Service callback: not implemented.
*/
APIEXPORT DWORD S4N_Seek(
        DWORD dwData,
        long pos,
        DWORD type
        ) {
    DebugPrint(TEXT("Seek - dwData: %lx\n"), dwData);
    return 0;
}



///////////////////////////////////////////////////////////////////
// Notification Listener: connection handler
///////////////////////////////////////////////////////////////////
/**
* Open the socket connection and waits for the server messages.
*/
static DWORD acceptConnection(SOCKET sock)
{
    if (g_dwServiceState != SERVICE_STATE_ON) {
        // Do not accept connections unless the service is on

        // ALWAYS close the socket, even if you return
        // FALSE. Services.exe leaves it to the
        // service to close the socket in all cases.
        DebugPrint(L"S4ND: ERROR: Service Conn fails."
                L"Service State != ON.  State = <%d>\r\n",
                g_dwServiceState);

        send(sock, RESP_BUSY, strlen(RESP_BUSY),0);
        closesocket(sock);
        return ERROR_SERVICE_NOT_ACTIVE;
    }
    int ret = ERROR_EXCEPTION_IN_SERVICE;

    __try {
        DebugPrint(L"Starting worker...\n");
        ret = startWorker(sock);
    }
    __except (EXCEPTION_EXECUTE_HANDLER) {
        DebugPrint(L"Exception in Worker thread.\n\n");
    }

    if( ret != ERROR_SUCCESS ) {
        if (ret == ERROR_BUSY ){
            DebugPrint(L"Worker busy...\n\r");
            send(sock, RESP_BUSY, strlen(RESP_BUSY),0);
        }
        else {
            DebugPrint(L"Worker error...\n\r");
            send(sock, RESP_GENERIC, strlen(RESP_BUSY),0);
        }
        closesocket(sock);
    }
    // Worker thread will close the socket.
    return ret;
}


///////////////////////////////////////////////////////////////////
// Address change handler
///////////////////////////////////////////////////////////////////

// FIXME: use the DM
/*
* Test a configuration property to understand if the client has already
* notified the server.
*/
static bool isServerNotified()
{
    wchar_t buf[10];

    memset(buf, 0, 10*sizeof(wchar_t));
    getClientConfigurationInternal (TEXT(""), PROPERTY_SPDM_SERVER_NOTIFIED,
                                     buf, FALSE);
    return ( wcscmp(buf, TEXT("1")) == 0);
}

// FIXME: use the DM
/*
* Set a configuration property to mark the client has
* notified the server.
*/
void setServerNotified(bool val)
{
    setClientConfiguration(
            TEXT(""),
            PROPERTY_SPDM_SERVER_NOTIFIED,
            ( (val) ? TEXT("1") : TEXT("0") ),
            NULL);
}

/*
* Start a particular sync saying to the server the new client IP address.
* It sets the server notified parameter if succesfully finished.
*/
DWORD addressChangeHandler(void)
{
    static wchar_t oldIP[40] = TEXT("127.0.0.1");
    wchar_t newIP[40];
    DWORD ret = ERROR_SUCCESS;
    bool useSTP = false;
    bool useCTP = false;

    //MessageBox (NULL, TEXT("addressChangeHandler"), TEXT("Test"), MB_SETFOREGROUND | MB_OK);

    // Read getPush -> switch if using STP / CTP
    int pushType = getPushTypeFromRegistry();
    if (pushType & 1) {
        useSTP = true;
    }
    if (pushType & 2) {
        useCTP = true;
    }

    if (!useSTP && !useCTP) {
        // Nothing to do
        setServerNotified(false);
        return 0;
    }
    LOG.debug("useSTP = %d, useCTP = %d", useSTP, useCTP);

    if (checkNetwork()) {

        getIPAddress(newIP);

        if (wcscmp(newIP, TEXT("192.168.55.101"))==0 ||
             wcsstr(newIP, TEXT("169.254.2.")) ) {
            DebugPrint(L"Device is using ActiveSync -> use only CTP\n");
            wcscpy(oldIP, newIP);
            setServerNotified(false);
            useSTP = false;
            useCTP = true;
        }

        // The server is already notified and the IP is
        // the same of the current, do not send a new notification.
        if ( isServerNotified() && (wcscmp(oldIP, newIP)==0) ) {
            DebugPrint(TEXT("Server already notified.\n"));
            return ret;
        }

        // Save the IP
        wcscpy(oldIP, newIP);
        DebugPrint(L"New IP: %s\n", newIP);

        HANDLE stpThread = NULL;
        CTPManager* ctpManager = CTPManager::getInstance();

        // ----------- STP -----------
        if (useSTP) {
            // create STP thread, get handle of stpThread
            stpThread = CreateThread(NULL, 0, stpWorker, NULL, 0, NULL);
            if (!stpThread) {
                LOG.error("Error creating STP thread: code 0x%08x", GetLastError());
            }
        }

        // ----------- CTP -----------
        if (useCTP) {
            // create CTP thread, passing handle stpThread (NULL if not created)
            ctpManager->startCTP(stpThread);
        }
    }
    else { // end server notification
        setServerNotified(false);
    }

    LOG.debug("Exiting addressChangeHandler");
    return ret;
}





int getPushTypeFromRegistry() {

    CTPConfig config(APPLICATION_URI);
    config.readCTPConfig();
    return config.getPush();
}



char* extractNonceParam(CTPMessage* authStatusMsg) {

    if (authStatusMsg->params.size() == 0) {
        // Expected NONCE param is missing -> restore connection
        //LOG.debug("Error receiving Status message: NONCE param is missing");
        return NULL;
    }

    list<CTPParam>::iterator param = authStatusMsg->params.begin();
    if ((*param).getParamCode() == P_NONCE) {
        int nonceLen = (*param).getValueLength();
        void* nonce  = (*param).getValue();

        // Return buffer is new allocated!
        return stringdup((char*)nonce, nonceLen);
    }
    else {
        // Unexpected Status param -> restore connection
        //LOG.debug("Error receiving Status message: unexpected param '0x%02x'", (*param).getParamCode());
        return NULL;
    }
}



/**
 * Starts the program "startsync.exe" (or syncmail.exe) with params:
 * "manual <sourcename1, sourcename2,...>" where sourcenames are
 * retrieved from the SyncNotification passed.
 * @note      the process is started and then the control is returned
 *            immediately to the caller (no wait on the process started)
 * @param sn  pointer to the SyncNotification object to read
 * @return    the PID of process started, a value < 0 in case of errors
 */
int startSyncFromSAN(SyncNotification* sn) {

    if (!sn) {
        LOG.error("CTP notification error: SyncNotification is NULL");
        return -1;
    }

    // Get number of sources to sync
    int n = sn->getNumSyncs();
    if (!n) {
        LOG.info("CTP notification error: no sources to sync from server");
        return -2;
    }

    //
    // Call "startsync.exe" with command-line parameters (sequence of source names)
    //
    wstring app     = L"startsync.exe";
    wstring cmdLine = L"manual";
    int count = 0;
    for (int i=0; i<n; i++) {
        SyncAlert* sync = sn->getSyncAlert(i);
        if(!sync) {
            LOG.error("CTP notification error: no SyncAlert in SyncNotification");
            return -3;
        }

        WCHAR* srcname = getSSourceName(APPLICATION_URI, sync->getServerURI());
        if (srcname) {
            if (count == 0) { cmdLine += L" "; }
            else            { cmdLine += L","; }
            cmdLine += srcname;
            delete [] srcname;
            count++;
        } 
        else {
            LOG.error("CTP notification error: no source found from server notification request: %s", sync->getServerURI());
            continue;
        }
    }

    if (count == 0) {
        // 0 sources to sync -> out
        LOG.info("No sources to sync");
        return NULL;
    }
    
    //
    // Start the sync process: "startsync.exe manual <sourcename1, sourcename2,...>"
    //
    LOG.info("Starting sync: '%ls %ls'", app.c_str(), cmdLine.c_str());
    int pid = startProgram(app.c_str(), cmdLine.c_str());
    return pid;
}



/**
 * Utility to extract the message length from a CTP package.
 * The message length is stored in the first 2 bytes of the CTP package.
 * @param  package    the input package
 * @param  packageLen the length of the passed package
 * @return            the message length
 */
int extractMsgLength(const char* package, int packageLen) {

    if (packageLen < 2) {
        LOG.error("Unable to read the package length: not enough bytes received (%d)", packageLen);
        return 0;
    }

    int messageLen  = (int)((unsigned char)package[0]);
    int messageLen1 = (int)((unsigned char)package[1]);

    messageLen <<= 8;
    messageLen = messageLen | messageLen1;
    //LOG.debug("messageLen = %d", messageLen);
    return messageLen;
}




/**
 * Utility function to retrieve the correspondant message for the Wininet error code passed.
 * Pointer returned is allocated new, must be freed by caller.
 * @param errorCode  the code of the last error
 * @return           the error message for the passed code, new allocated buffer
 */
char* createErrorMsg(DWORD errorCode) {

    WCHAR* errorMessage = new WCHAR[512];
    memset(errorMessage, 0, 512);

    FormatMessage(
                FORMAT_MESSAGE_FROM_SYSTEM,
                NULL,
                errorCode,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                errorMessage,
                512,
                NULL);

    if (!errorMessage || wcslen(errorMessage) == 0) {
        wsprintf(errorMessage, L"Unknown error.");
    }

    char* ret = toMultibyte(errorMessage);
    if (errorMessage) delete [] errorMessage;
    return ret;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品精品一区| 99久久精品一区二区| 日韩美女一区二区三区四区| 石原莉奈在线亚洲二区| 日韩三级.com| 国产精品18久久久久| 国产欧美一区二区精品忘忧草| 国产成人高清在线| 国产精品无码永久免费888| 不卡一区中文字幕| 亚洲国产欧美在线| 日韩女同互慰一区二区| 国产91在线观看丝袜| 亚洲欧美日韩电影| 51精品久久久久久久蜜臀| 国产在线精品一区二区不卡了| 欧美激情资源网| 日本精品裸体写真集在线观看| 亚洲自拍偷拍图区| 欧美一卡2卡三卡4卡5免费| 日韩精品一区二区三区三区免费 | 色婷婷久久久亚洲一区二区三区| 综合久久久久久久| 91精品国产福利| 国产精品一区二区在线看| ...av二区三区久久精品| 欧美一区二区在线观看| 日韩欧美国产一区二区三区| 国产aⅴ综合色| 五月天一区二区| 国产丝袜在线精品| 91麻豆精品国产自产在线| 成人国产精品免费观看动漫| 视频在线在亚洲| 18成人在线观看| 欧美精品一区二区三区很污很色的 | 777奇米四色成人影色区| 成人免费毛片高清视频| 亚洲超碰精品一区二区| 中文字幕一区免费在线观看| 日韩欧美国产wwwww| 欧美天堂一区二区三区| 成人黄色av网站在线| 狠狠色丁香久久婷婷综| 亚洲bt欧美bt精品777| 国产精品久久久久久久蜜臀| 2017欧美狠狠色| 欧美精品久久天天躁| 99久久精品费精品国产一区二区| 激情综合亚洲精品| 免费欧美在线视频| 亚洲成a人片在线观看中文| 中文字幕一区二区三区精华液 | 在线精品视频免费播放| 国产成人久久精品77777最新版本| 亚洲成人资源网| 亚洲欧美色图小说| 中文字幕一区二区三区不卡 | 国产精品成人在线观看| 久久久www免费人成精品| 欧美精品一卡两卡| 欧美日韩一区二区欧美激情| 91女厕偷拍女厕偷拍高清| 成人午夜av电影| 国产精品911| 激情综合一区二区三区| 久久99热狠狠色一区二区| 视频一区欧美日韩| 日韩专区在线视频| 日韩电影一区二区三区四区| 亚洲大片免费看| 亚洲电影一区二区| 亚洲成a人在线观看| 性感美女极品91精品| 亚洲国产一区二区三区青草影视| 亚洲另类春色国产| 亚洲精品日韩一| 曰韩精品一区二区| 亚洲国产另类av| 欧美日韩一区视频| 欧美视频中文一区二区三区在线观看| 在线一区二区三区四区五区| 色婷婷av一区二区三区大白胸| 91网站在线观看视频| 色呦呦国产精品| 欧美日韩在线亚洲一区蜜芽| 欧美日韩高清一区二区三区| 欧美人与性动xxxx| 精品国产成人系列| 亚洲国产精品成人综合| 亚洲私人影院在线观看| 亚洲一级二级三级在线免费观看| 亚洲高清不卡在线观看| 老司机免费视频一区二区| 国产裸体歌舞团一区二区| 成人一道本在线| 91福利国产成人精品照片| 91精品一区二区三区久久久久久 | 久久久精品国产免大香伊| 国产精品视频一二三区| 夜夜操天天操亚洲| 久久66热re国产| 成人av手机在线观看| 欧美日韩国产精品成人| 精品国产伦一区二区三区免费| 欧美国产精品劲爆| 午夜精品福利一区二区蜜股av| 九九视频精品免费| 91色综合久久久久婷婷| 欧美一级日韩不卡播放免费| 久久精品一区蜜桃臀影院| 依依成人精品视频| 国模娜娜一区二区三区| 色偷偷久久一区二区三区| 日韩欧美激情在线| 亚洲四区在线观看| 国产在线视视频有精品| 在线精品国精品国产尤物884a| 欧美sm极限捆绑bd| 亚洲最大色网站| 国产精品一区二区在线观看不卡| 在线观看不卡视频| 国产精品丝袜一区| 麻豆高清免费国产一区| 色狠狠色狠狠综合| 国产偷v国产偷v亚洲高清| 天堂成人国产精品一区| av在线不卡网| 久久婷婷国产综合精品青草 | 美女视频黄频大全不卡视频在线播放 | 国产精品免费观看视频| 青椒成人免费视频| 一本久久a久久免费精品不卡| 精品美女在线观看| 亚洲国产视频在线| www.亚洲在线| 国产欧美视频在线观看| 免费在线看一区| 欧美日韩另类国产亚洲欧美一级| 久久99精品国产| 欧美日韩一级黄| 亚洲美女免费在线| 国产aⅴ精品一区二区三区色成熟| 欧美日本一区二区三区| 亚洲人精品午夜| 高清免费成人av| 久久久久国产精品麻豆ai换脸| 日本午夜一区二区| 精品视频一区 二区 三区| 亚洲男同1069视频| 福利一区二区在线| 久久久亚洲高清| 精品影院一区二区久久久| 欧美二区三区的天堂| 亚洲午夜久久久久久久久久久| av中文字幕在线不卡| 中文在线一区二区| 成人性生交大合| 国产精品天美传媒| 国产91综合网| 国产精品视频在线看| 成人在线综合网站| 欧美高清在线视频| 成人黄色片在线观看| 日本一区二区三区高清不卡| 国产精品香蕉一区二区三区| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美日韩另类国产亚洲欧美一级| 亚洲猫色日本管| 在线视频一区二区三| 亚洲午夜在线观看视频在线| 欧美日韩卡一卡二| 石原莉奈一区二区三区在线观看| 7799精品视频| 精品一区二区三区的国产在线播放| 日韩欧美你懂的| 国模大尺度一区二区三区| 久久丝袜美腿综合| 成人的网站免费观看| 亚洲麻豆国产自偷在线| 欧美日韩精品是欧美日韩精品| 午夜国产精品影院在线观看| 欧美一区二区三区四区久久| 久久国产精品免费| 久久女同精品一区二区| 风间由美一区二区三区在线观看| 欧美激情一区二区三区蜜桃视频 | 在线欧美一区二区| 天堂一区二区在线免费观看| 精品国产sm最大网站免费看| 成人免费视频视频在线观看免费| 亚洲色图19p| 欧美一区二区日韩一区二区| 国产乱子伦视频一区二区三区| 国产精品久线在线观看| 欧美视频在线播放| 狠狠色丁香久久婷婷综合_中| 一区免费观看视频| 7777精品伊人久久久大香线蕉经典版下载| 美女在线一区二区|