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

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

?? btmodem.cxx

?? 這些文件包括藍(lán)牙虛擬串口與打印機(jī)程序?qū)嵗?
?? CXX
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
		CloseHandle (hModemComPort);

		gfServiceState = SERVICE_STATE_OFF;
		return 0;
    }

    if (! SetCommState(hModemComPort, &dcb)) {
		RETAILMSG(1, (L"Bluetooth modem gateway: Initialization failed: could not configure state of modem port (error %d)" CRLF, GetLastError ()));

		CloseHandle (hModemComPort);

		gfServiceState = SERVICE_STATE_OFF;
		return 0;
    }

	// Create and open Bluetooth device

	HANDLE hBthDevice = CreatePort (port, channel, mtu, fAuthenticate, fEncrypt);
	if (! hBthDevice) {
		CloseHandle (hModemComPort);

		gfServiceState = SERVICE_STATE_OFF;
		return 0;
	}

	HANDLE hBthComPort = CreateFile (szBthPortName,
                GENERIC_READ | GENERIC_WRITE,
                0,    // comm devices must be opened w/exclusive-access
                NULL, // no security attrs
                OPEN_EXISTING, // comm devices must use OPEN_EXISTING
                FILE_ATTRIBUTE_NORMAL,    // overlapped I/O 
                NULL  // hTemplate must be NULL for comm devices  
				);

	if (hBthComPort == INVALID_HANDLE_VALUE) {
		RETAILMSG(1, (L"Bluetooth modem gateway: Initialization failed: could not open Bluetooth device port (error %d)" CRLF, GetLastError ()));
		DeactivateDevice (hBthDevice);
		CloseHandle (hModemComPort);

		gfServiceState = SERVICE_STATE_OFF;
		return 0;
	}

    commTimeouts.ReadTotalTimeoutMultiplier = 1;
    commTimeouts.ReadIntervalTimeout = 50;
    commTimeouts.ReadTotalTimeoutConstant = 50;
    commTimeouts.WriteTotalTimeoutMultiplier = 5;
    commTimeouts.WriteTotalTimeoutConstant = 500;

    if (! SetCommTimeouts (hBthComPort, &commTimeouts)) {
		RETAILMSG(1, (L"Bluetooth modem gateway: Initialization failed: could not configure timeouts on bluetooth port (error %d)" CRLF, GetLastError ()));

		CloseHandle (hBthComPort);
		DeactivateDevice (hBthDevice);
		CloseHandle (hModemComPort);

		gfServiceState = SERVICE_STATE_OFF;
		return 0;
    }

	unsigned long ulSdpRecord = RegisterSDP (hBthComPort);

	if (! ulSdpRecord) {
		RETAILMSG(1, (L"Bluetooth modem gateway: Initialization failed: could not register SDP" CRLF));
		CloseHandle (hBthComPort);
		DeactivateDevice (hBthDevice);
		CloseHandle (hModemComPort);

		gfServiceState = SERVICE_STATE_OFF;
		return 0;
	}

	// Go on listening...

	void *ahA[3];
	void *ahB[3];

	ahA[0] = hBthComPort;
	ahA[1] = hModemComPort;
	ahA[2] = BTH_BLUETOOTH_READER;

	ahB[0] = hModemComPort;
	ahB[1] = hBthComPort;
	ahB[2] = BTH_MODEM_READER;

	HANDLE hThreadA = CreateThread (NULL, 0, ComCopyThread, ahA, 0, NULL);
	HANDLE hThreadB = CreateThread (NULL, 0, ComCopyThread, ahB, 0, NULL);

	if (hThreadA && hThreadB) {
		gfServiceState = SERVICE_STATE_ON;
		BT_ADDR bt;
		if (BthReadLocalAddr (&bt) == ERROR_SUCCESS)
			RETAILMSG(1, (L"Bluetooth modem gateway: Initialization complete. Local address %04x%08x" CRLF, GET_NAP(bt), GET_SAP(bt)));
		else
			RETAILMSG(1, (L"Bluetooth modem gateway: Initialization complete. No bluetooth adapter detected." CRLF));

		WaitForSingleObject (ghServiceExitEvent, INFINITE);
	} else
		RETAILMSG(1, (L"Bluetooth modem gateway: could not create worker threads." CRLF));

	gfServiceState = SERVICE_STATE_SHUTTING_DOWN;

	RETAILMSG(1, (L"Bluetooth modem gateway: closing down." CRLF));
	SetEvent (ghServiceExitEvent);
	CloseHandle (hBthComPort);
	HangUpModem (hModemComPort);
	CloseHandle (hModemComPort);

	DeRegisterSDP (ulSdpRecord);
	DeactivateDevice (hBthDevice);

	if (hThreadA) {
		if (WAIT_TIMEOUT != WaitForSingleObject (hThreadA, BTH_MODEM_TIMEOUT))
			TerminateThread (hThreadA, 0);
		CloseHandle (hThreadA);
	}

	if (hThreadB) {
		if (WAIT_TIMEOUT != WaitForSingleObject (hThreadB, BTH_MODEM_TIMEOUT))
			TerminateThread (hThreadB, 0);
		CloseHandle (hThreadB);
	}

	gfServiceState = SERVICE_STATE_OFF;

	RETAILMSG(1, (L"Bluetooth modem gateway: down." CRLF));

	return 0;
}

//  @func PVOID | HLO_Init | Service initialization routine
//  @parm DWORD | dwData | Info passed to RegisterDevice
//  @rdesc      Returns a DWORD which will be passed to Open & Deinit or NULL if
//              unable to initialize the device.
//
//  This is called only once. Do the startup initialization in a thread
//  spawned by this function, but DO NOT BLOCK HERE!
//        
extern "C" DWORD BTM_Init (DWORD dwData)
{
	ghServiceExitEvent = CreateEvent (NULL, TRUE, FALSE, NULL);
	if (! ghServiceExitEvent)
		return 0;

	ghServiceThread = CreateThread (NULL, 0, ComServiceThread, NULL, 0, NULL);
	if (! ghServiceThread) {
		CloseHandle (ghServiceExitEvent);
		return 0;
	}

    return 1;
}

//  @func PVOID | HLO_Deinit | Device deinitialization routine
//  @parm DWORD | dwData | value returned from HLO_Init call
//  @rdesc	Returns TRUE for success, FALSE for failure.
//
//  The library WILL BE UNLOADED after this. Block here
//  until the state is completely clear and all the
//  threads are gone.
//
extern "C" BOOL BTM_Deinit(DWORD dwData)
{
	if (ghServiceExitEvent) {
		SetEvent (ghServiceExitEvent);
		CloseHandle (ghServiceExitEvent);
		ghServiceExitEvent = NULL;
	}

	if (ghServiceThread) {
		if (WAIT_OBJECT_0 != WaitForSingleObject (ghServiceThread, BTH_MODEM_TIMEOUT))
			TerminateThread (ghServiceThread, 0);
		CloseHandle (ghServiceThread);
		ghServiceThread = NULL;
	}

    return TRUE;
}

//  @func PVOID | HLO_Open     | Device open routine
//  @parm DWORD | dwData       | value returned from HLO_Init call
//  @parm DWORD | dwAccess     | requested access (combination of GENERIC_READ
//                               and GENERIC_WRITE)
//  @parm DWORD | dwShareMode | requested share mode (combination of
//                               FILE_SHARE_READ and FILE_SHARE_WRITE)
//  @rdesc	Returns a DWORD which will be passed to Read, Write, etc or NULL if
//                               unable to open device.
//
//  We don't do anything here, but in a real service this is a place to create
//  client process state. HCO_Close will be called with this handle when the process
//  exits or terminates, so the clean-up is easy.
//
extern "C" DWORD BTM_Open (DWORD dwData, DWORD dwAccess, DWORD dwShareMode)
{
    return TRUE;
}

//  @func BOOL  | HLO_Close | Device close routine
//  @parm DWORD | dwOpenData | value returned from HLO_Open call
//  @rdesc      Returns TRUE for success, FALSE for failure
//
//  Clean-up the client process state here.
//
extern "C" BOOL BTM_Close (DWORD dwData) 
{
    return TRUE;
}

//  @func DWORD   | HLO_Write  | Device write routine
//  @parm DWORD   | dwOpenData | value returned from HLO_Open call
//  @parm LPCVOID | pBuf     | buffer containing data
//  @parm DWORD   | len        | maximum length to write [IN BYTES, NOT WORDS!!!]
//  @rdesc           Returns -1 for error, otherwise the number of bytes written.  The
//                   length returned is guaranteed to be the length requested unless an
//                   error condition occurs.
//
//  This is a vestige of streaming driver interface. We don't use it for services.
//
extern "C" DWORD BTM_Write (DWORD dwData, LPCVOID pInBuf, DWORD dwInLen)
{
    return -1;
}

//  @func DWORD  | HLO_Read   | Device read routine
//  @parm DWORD  | dwOpenData | value returned from HLO_Open call
//  @parm LPVOID | pBuf       | buffer to receive data
//  @parm DWORD  | len        | maximum length to read [IN BYTES, not WORDS!!]
//  @rdesc      Returns 0 for end of file, -1 for error, otherwise the number of
//              bytes read.  The length returned is guaranteed to be the length
//              requested unless end of file or an error condition occurs.
//
//  This is a vestige of streaming driver interface. We don't use it for services.
//
extern "C" DWORD BTM_Read (DWORD dwData, LPVOID pBuf, DWORD dwLen)
{
    return -1;
}

//  @func DWORD | HLO_Seek   | Device seek routine
//  @parm DWORD | dwOpenData | value returned from HLO_Open call
//  @parm long  | pos        | position to seek to (relative to type)
//  @parm DWORD | type       | FILE_BEGIN, FILE_CURRENT, or FILE_END
//  @rdesc      Returns current position relative to start of file, or -1 on error
//
//  This is a vestige of streaming driver interface. We don't use it for services.
//
extern "C" DWORD BTM_Seek (DWORD dwData, long pos, DWORD type)
{
    return (DWORD)-1;
}

//  @func void | HLO_PowerUp | Device powerup routine
//  @comm       Called to restore device from suspend mode. 
//              You cannot call any routines aside from those in your dll in this call.
//
//  This is a vestige of streaming driver interface. We don't use it for services.
//
extern "C" void BTM_PowerUp(void)
{
	return;
}

//  @func void | HLO_PowerDown | Device powerdown routine
//  @comm      Called to suspend device.  You cannot call any routines aside from
//             those in your dll in this call.
//
//  This is a vestige of streaming driver interface. We don't use it for services.
//
extern "C" void BTM_PowerDown(void)
{
    return;
}

//  @func BOOL   | HLO_IOControl | Device IO control routine
//  @parm DWORD  | dwOpenData | value returned from HLO_Open call
//  @parm DWORD  | dwCode | io control code to be performed
//  @parm PBYTE  | pBufIn | input data to the device
//  @parm DWORD  | dwLenIn | number of bytes being passed in
//  @parm PBYTE  | pBufOut | output data from the device
//  @parm DWORD  | dwLenOut |maximum number of bytes to receive from device
//  @parm PDWORD | pdwActualOut | actual number of bytes received from device
//  @rdesc         Returns TRUE for success, FALSE for failure
//  @remark	Routine exported by a device driver.  "PRF" is the string passed
//		in as lpszType in RegisterDevice
//
//  This is THE way to expose both manageability of the service and the feature API set.
//  Consumer of the API set will marshal input arguments into input buffer (pBufIn).
//  This function unmarshals it and executes the API, and then marshals output parameters
//  into output buffer (pBufOut).
//
extern "C" BOOL BTM_IOControl(DWORD dwData, DWORD dwCode, PBYTE pBufIn,
			  DWORD dwLenIn, PBYTE pBufOut, DWORD dwLenOut,
			  PDWORD pdwActualOut)
{
    switch (dwCode) {
        // Control code sent to start a service (not the same as IOCTL_SERVICE_STARTED).
        case IOCTL_SERVICE_START: // start a service that is currently in the stopped stage.
			if (gfServiceState == SERVICE_STATE_OFF) {
				if (ghServiceThread) {
					if (WAIT_TIMEOUT == WaitForSingleObject (ghServiceThread, BTH_MODEM_TIMEOUT))
						return FALSE;

					CloseHandle (ghServiceThread);
					ghServiceThread = NULL;
				}

				ResetEvent (ghServiceExitEvent);
				ghServiceThread = CreateThread (NULL, 0, ComServiceThread, NULL, 0, NULL);
				return ghServiceThread != NULL;
			}

			SetLastError (ERROR_SERVICE_ALREADY_RUNNING);
			return FALSE;

                // stop a service and for refresh bring it up again.
                // REFRESH is required for more complicated servers
                // that only read in their registry configuration
                // during initilization.

        case IOCTL_SERVICE_REFRESH:
        case IOCTL_SERVICE_STOP:
			if (gfServiceState == SERVICE_STATE_ON) {
				if (ghServiceThread) {
					SetEvent (ghServiceExitEvent);
					if (WAIT_TIMEOUT == WaitForSingleObject (ghServiceThread, BTH_MODEM_TIMEOUT))
						return FALSE;

					CloseHandle (ghServiceThread);
					ghServiceThread = NULL;
				}

				if (dwCode == IOCTL_SERVICE_REFRESH) {
					ResetEvent (ghServiceExitEvent);
					ghServiceThread = CreateThread (NULL, 0, ComServiceThread, NULL, 0, NULL);
					return ghServiceThread != NULL;
				}

				return TRUE;
			}

			SetLastError (ERROR_SERVICE_NOT_ACTIVE);
			return FALSE;


        case IOCTL_SERVICE_STATUS:
            if (pBufOut && dwLenOut == sizeof(DWORD))  {
                *(DWORD *)pBufOut = gfServiceState;
                if (pdwActualOut)
                    *pdwActualOut = sizeof(DWORD);
                return TRUE;
            }
            break;

                // IOCTL_SERVICE_CONTROL contains service specific information passed to it by
                // a calling application.
        case IOCTL_SERVICE_CONTROL:
            return TRUE;

                // Called once all initialization has completed and the session is ready
                // to start running.  By convention all services will (or at least should) be
                // passed their service handle (what RegisterService() returns).  This value
                // can be saved in case a service wishes to call DeregisterService on itself.
                //
                // This is not available in device.exe!
                //
        case IOCTL_SERVICE_STARTED:
            return TRUE;

        case IOCTL_SERVICE_REGISTER_SOCKADDR:
                // The super services thread or an application will call this IOCTL will
                // pBufIn = NULL as a means of querying whether or not the particular service
                // will support having a socket bound to it or not.  Service will return FALSE
                // if it was not designed to take IOCTL_SERVICE_CONNECTION commands, or
                // if it is not ready.
                //
                // This is not available in device.exe!
                //
            return FALSE;

        case IOCTL_SERVICE_DEREGISTER_SOCKADDR:
                // When our sockets are being disconnected this message is sent to us.
                //
                // This is not available in device.exe!
                //
            return TRUE;

        case IOCTL_SERVICE_CONNECTION:
                // This IOControl is called when a socket connection for a socked associated
				// with the service comes off the wire.  The socket accept() returns is the
                // value passed.  Note that it is the service's responsibilty to close
                // the socket, even if the service is not in the active state.
                //
                // This is not available in device.exe!
                //
            return FALSE;

                // This can be used to programmatically turn on/off debug zones.
        case IOCTL_SERVICE_DEBUG:
            return TRUE;

//		Unsupported SERVICES IOCTLs
//		case IOCTL_SERVICE_INSTALL:
//		case IOCTL_SERVICE_UNINSTALL:
    }

    SetLastError(ERROR_INVALID_PARAMETER);
    return FALSE;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩免费福利电影在线观看| 国产aⅴ综合色| 久久国产精品露脸对白| 精品一区二区三区久久| 成人免费看片app下载| 91久久人澡人人添人人爽欧美| 在线观看不卡一区| 精品少妇一区二区三区| 激情综合亚洲精品| 不卡一区二区在线| 91精品国产综合久久久蜜臀粉嫩 | 国产精品丝袜91| 亚洲少妇最新在线视频| 天堂av在线一区| 国产精品一卡二| 欧美亚洲动漫精品| 久久久亚洲精华液精华液精华液| 又紧又大又爽精品一区二区| 日本91福利区| 91蜜桃网址入口| 日韩欧美亚洲一区二区| 中文字幕在线一区免费| 日本aⅴ亚洲精品中文乱码| 成人成人成人在线视频| 欧美一区二区视频网站| 国产精品伦一区| 亚洲第一福利视频在线| 国产a区久久久| 欧美一二三区在线| 一个色妞综合视频在线观看| 国产一区二区三区免费播放| 欧洲在线/亚洲| 中文字幕欧美日韩一区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 国产日韩av一区二区| 一区二区三区精品| 粉嫩在线一区二区三区视频| 欧美精品在线视频| 亚洲人精品午夜| 国产精品一二三区| 午夜精品福利一区二区蜜股av| 成人综合在线视频| 久久综合久久鬼色中文字| 亚洲影院理伦片| av在线综合网| 久久久亚洲综合| 美国十次了思思久久精品导航| 色婷婷久久综合| 国产精品麻豆久久久| 国产在线视频不卡二| 欧美日韩免费在线视频| 综合久久综合久久| 成人精品视频一区| 久久亚洲综合色一区二区三区| 天天色天天爱天天射综合| 色88888久久久久久影院野外| 国产亚洲人成网站| 激情综合色播激情啊| 欧美丰满高潮xxxx喷水动漫| 伊人一区二区三区| 91女厕偷拍女厕偷拍高清| 国产亚洲精品精华液| 国内外精品视频| 精品福利av导航| 奇米色一区二区三区四区| 欧美视频在线不卡| 亚洲国产日韩在线一区模特| 在线中文字幕不卡| 洋洋成人永久网站入口| 91国产视频在线观看| 亚洲免费观看视频| 日本黄色一区二区| 一区二区三区高清不卡| 一本色道久久综合亚洲精品按摩| 亚洲天堂免费在线观看视频| 成人av网站免费观看| 国产精品嫩草久久久久| a级精品国产片在线观看| 中文字幕亚洲电影| 色综合久久中文字幕| 亚洲少妇中出一区| 91久久久免费一区二区| 午夜欧美视频在线观看| 日韩高清在线电影| 日韩欧美激情一区| 韩国欧美国产1区| 国产视频一区二区在线| 波多野结衣欧美| 亚洲欧美日韩国产成人精品影院| 99国产精品视频免费观看| 一区二区三区自拍| 欧美性感一类影片在线播放| 亚洲成人午夜影院| 欧美一级一级性生活免费录像| 麻豆高清免费国产一区| 久久新电视剧免费观看| 懂色av中文一区二区三区| 亚洲欧洲精品成人久久奇米网| 99re热这里只有精品视频| 一区二区三区四区高清精品免费观看 | 色网站国产精品| 亚洲午夜电影在线| 欧美刺激脚交jootjob| 国产大陆精品国产| 17c精品麻豆一区二区免费| 欧美日韩中文字幕一区二区| 美女爽到高潮91| 国产欧美日本一区二区三区| 91免费视频观看| 午夜视黄欧洲亚洲| 久久久亚洲高清| 91麻豆福利精品推荐| 日韩一区精品字幕| 久久久一区二区| 在线区一区二视频| 激情成人综合网| 日韩一区在线免费观看| 欧美精品乱码久久久久久按摩| 国产真实乱对白精彩久久| 亚洲人成在线观看一区二区| 欧美一区二区久久| 91在线一区二区三区| 日韩—二三区免费观看av| 欧美国产精品一区| 亚洲国产视频在线| 日本一区二区三区国色天香 | 亚洲影视在线播放| 精品国产凹凸成av人网站| 91蜜桃免费观看视频| 久久成人久久鬼色| 一区二区三区欧美日| 久久精品夜夜夜夜久久| 欧美在线free| 国产成人99久久亚洲综合精品| 亚洲国产欧美在线| 国产精品午夜电影| 日韩欧美精品在线| 欧美自拍偷拍一区| 成人丝袜18视频在线观看| 天天影视网天天综合色在线播放| 国产欧美一区二区三区网站| 欧美日韩在线精品一区二区三区激情| 国产伦精品一区二区三区免费| 亚洲一区二区五区| 国产精品青草综合久久久久99| 欧美日本国产视频| 99re这里都是精品| 高清国产午夜精品久久久久久| 无吗不卡中文字幕| 亚洲人吸女人奶水| 日本一区二区三区在线观看| 日韩一级精品视频在线观看| 色老汉一区二区三区| 国产乱一区二区| 久久精品国产秦先生| 一区二区在线观看视频 | 国产亚洲精品bt天堂精选| 欧美日韩精品是欧美日韩精品| 99久久99久久精品免费观看| 经典三级在线一区| 日韩av午夜在线观看| 亚洲最大的成人av| 日韩毛片一二三区| 欧美国产在线观看| 欧美精品一区在线观看| 日韩一级欧美一级| 日韩一区二区三区在线观看| 欧美在线|欧美| 日本久久精品电影| 色综合久久综合网97色综合| 成人动漫一区二区三区| 国产91对白在线观看九色| 久久电影网站中文字幕| 丝袜美腿高跟呻吟高潮一区| 亚洲午夜免费视频| 亚洲自拍另类综合| 一区二区视频在线| 亚洲免费观看视频| 亚洲精品亚洲人成人网| 国产精品久久久久影院老司| 国产女人水真多18毛片18精品视频| 26uuu精品一区二区在线观看| 91精品国模一区二区三区| 欧美一区二区三区四区高清| 91精品一区二区三区久久久久久 | 性做久久久久久免费观看欧美| 自拍偷拍国产精品| 亚洲精品乱码久久久久久| 日韩理论片在线| 亚洲婷婷在线视频| 亚洲精品国产视频| 亚洲精品国产精华液| 一区二区视频在线| 午夜久久久久久久久久一区二区| 亚洲一区二区三区自拍| 婷婷久久综合九色综合伊人色| 五月天精品一区二区三区| 日韩高清欧美激情| 免费成人在线播放| 国内精品伊人久久久久av影院 |