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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? registry.cpp

?? com 中聚合的情況實現范例
?? CPP
字號:
//
// Registry.cpp
//

#include <objbase.h>
#include <assert.h>

#include "Registry.h"

////////////////////////////////////////////////////////
//
// Internal helper functions prototypes
//

// Set the given key and its value.
BOOL setKeyAndValue(const char* pszPath,
                    const char* szSubkey,
                    const char* szValue) ;

// Convert a CLSID into a char string.
void CLSIDtochar(const CLSID& clsid, 
                 char* szCLSID,
                 int length) ;

// Delete szKeyChild and all of its descendents.
LONG recursiveDeleteKey(HKEY hKeyParent, const char* szKeyChild) ;

////////////////////////////////////////////////////////
//
// Constants
//

// Size of a CLSID as a string
const int CLSID_STRING_SIZE = 39 ;

/////////////////////////////////////////////////////////
//
// Public function implementation
//

//
// Register the component in the registry.
//
HRESULT RegisterServer(HMODULE hModule,            // DLL module handle
                       const CLSID& clsid,         // Class ID
                       const char* szFriendlyName, // Friendly Name
                       const char* szVerIndProgID, // Programmatic
                       const char* szProgID)       //   IDs
{
	// Get server location.
	char szModule[512] ;
	DWORD dwResult =
		::GetModuleFileName(hModule, 
		                    szModule,
		                    sizeof(szModule)/sizeof(char)) ;
	assert(dwResult != 0) ;

	// Convert the CLSID into a char.
	char szCLSID[CLSID_STRING_SIZE] ;
	CLSIDtochar(clsid, szCLSID, sizeof(szCLSID)) ;

	// Build the key CLSID\\{...}
	char szKey[64] ;
	strcpy(szKey, "CLSID\\") ;
	strcat(szKey, szCLSID) ;
  
	// Add the CLSID to the registry.
	setKeyAndValue(szKey, NULL, szFriendlyName) ;

	// Add the server filename subkey under the CLSID key.
	setKeyAndValue(szKey, "InprocServer32", szModule) ;

	// Add the ProgID subkey under the CLSID key.
	setKeyAndValue(szKey, "ProgID", szProgID) ;

	// Add the version-independent ProgID subkey under CLSID key.
	setKeyAndValue(szKey, "VersionIndependentProgID",
	               szVerIndProgID) ;

	// Add the version-independent ProgID subkey under HKEY_CLASSES_ROOT.
	setKeyAndValue(szVerIndProgID, NULL, szFriendlyName) ; 
	setKeyAndValue(szVerIndProgID, "CLSID", szCLSID) ;
	setKeyAndValue(szVerIndProgID, "CurVer", szProgID) ;

	// Add the versioned ProgID subkey under HKEY_CLASSES_ROOT.
	setKeyAndValue(szProgID, NULL, szFriendlyName) ; 
	setKeyAndValue(szProgID, "CLSID", szCLSID) ;

	return S_OK ;
}

//
// Remove the component from the registry.
//
LONG UnregisterServer(const CLSID& clsid,         // Class ID
                      const char* szVerIndProgID, // Programmatic
                      const char* szProgID)       //   IDs
{
	// Convert the CLSID into a char.
	char szCLSID[CLSID_STRING_SIZE] ;
	CLSIDtochar(clsid, szCLSID, sizeof(szCLSID)) ;

	// Build the key CLSID\\{...}
	char szKey[64] ;
	strcpy(szKey, "CLSID\\") ;
	strcat(szKey, szCLSID) ;

	// Delete the CLSID Key - CLSID\{...}
	LONG lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szKey) ;
	assert((lResult == ERROR_SUCCESS) ||
	       (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

	// Delete the version-independent ProgID Key.
	lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szVerIndProgID) ;
	assert((lResult == ERROR_SUCCESS) ||
	       (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

	// Delete the ProgID key.
	lResult = recursiveDeleteKey(HKEY_CLASSES_ROOT, szProgID) ;
	assert((lResult == ERROR_SUCCESS) ||
	       (lResult == ERROR_FILE_NOT_FOUND)) ; // Subkey may not exist.

	return S_OK ;
}

///////////////////////////////////////////////////////////
//
// Internal helper functions
//

// Convert a CLSID to a char string.
void CLSIDtochar(const CLSID& clsid,
                 char* szCLSID,
                 int length)
{
	assert(length >= CLSID_STRING_SIZE) ;
	// Get CLSID
	LPOLESTR wszCLSID = NULL ;
	HRESULT hr = StringFromCLSID(clsid, &wszCLSID) ;
	assert(SUCCEEDED(hr)) ;

	// Covert from wide characters to non-wide.
	wcstombs(szCLSID, wszCLSID, length) ;

	// Free memory.
	CoTaskMemFree(wszCLSID) ;
}

//
// Delete a key and all of its descendents.
//
LONG recursiveDeleteKey(HKEY hKeyParent,           // Parent of key to delete
                        const char* lpszKeyChild)  // Key to delete
{
	// Open the child.
	HKEY hKeyChild ;
	LONG lRes = RegOpenKeyEx(hKeyParent, lpszKeyChild, 0,
	                         KEY_ALL_ACCESS, &hKeyChild) ;
	if (lRes != ERROR_SUCCESS)
	{
		return lRes ;
	}

	// Enumerate all of the decendents of this child.
	FILETIME time ;
	char szBuffer[256] ;
	DWORD dwSize = 256 ;
	while (RegEnumKeyEx(hKeyChild, 0, szBuffer, &dwSize, NULL,
	                    NULL, NULL, &time) == S_OK)
	{
		// Delete the decendents of this child.
		lRes = recursiveDeleteKey(hKeyChild, szBuffer) ;
		if (lRes != ERROR_SUCCESS)
		{
			// Cleanup before exiting.
			RegCloseKey(hKeyChild) ;
			return lRes;
		}
		dwSize = 256 ;
	}

	// Close the child.
	RegCloseKey(hKeyChild) ;

	// Delete this child.
	return RegDeleteKey(hKeyParent, lpszKeyChild) ;
}

//
// Create a key and set its value.
//   - This helper function was borrowed and modifed from
//     Kraig Brockschmidt's book Inside OLE.
//
BOOL setKeyAndValue(const char* szKey,
                    const char* szSubkey,
                    const char* szValue)
{
	HKEY hKey;
	char szKeyBuf[1024] ;

	// Copy keyname into buffer.
	strcpy(szKeyBuf, szKey) ;

	// Add subkey name to buffer.
	if (szSubkey != NULL)
	{
		strcat(szKeyBuf, "\\") ;
		strcat(szKeyBuf, szSubkey ) ;
	}

	// Create and open key and subkey.
	long lResult = RegCreateKeyEx(HKEY_CLASSES_ROOT ,
	                              szKeyBuf, 
	                              0, NULL, REG_OPTION_NON_VOLATILE,
	                              KEY_ALL_ACCESS, NULL, 
	                              &hKey, NULL) ;
	if (lResult != ERROR_SUCCESS)
	{
		return FALSE ;
	}

	// Set the Value.
	if (szValue != NULL)
	{
		RegSetValueEx(hKey, NULL, 0, REG_SZ, 
		              (BYTE *)szValue, 
		              strlen(szValue)+1) ;
	}

	RegCloseKey(hKey) ;
	return TRUE ;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久国产精品韩国三级视频| 欧美视频在线不卡| 欧美日韩激情一区二区| 亚洲精品一线二线三线| 伊人开心综合网| 国产精品一级二级三级| 欧美喷水一区二区| 亚洲美腿欧美偷拍| 波多野结衣在线aⅴ中文字幕不卡| 91精品一区二区三区久久久久久| 国产精品久久三区| 国产精品69毛片高清亚洲| 91精品久久久久久久91蜜桃 | 亚洲国产成人va在线观看天堂| 国产乱子伦一区二区三区国色天香| 在线观看www91| 日韩美女视频一区| 成人性生交大片| 久久久久久久久久电影| 日本成人在线看| 欧美精品 日韩| 亚洲444eee在线观看| 色狠狠色狠狠综合| 亚洲资源中文字幕| 欧美午夜寂寞影院| 亚洲国产视频在线| 欧美三级日韩三级| 亚洲午夜激情网站| 在线一区二区三区四区| 亚洲乱码国产乱码精品精小说 | 中文幕一区二区三区久久蜜桃| 日本在线不卡一区| 欧美一三区三区四区免费在线看 | 欧美性生活一区| 亚洲精品视频在线| 欧美三级蜜桃2在线观看| 亚洲一区视频在线观看视频| 91国在线观看| 午夜欧美大尺度福利影院在线看| 欧美性受xxxx| 久久精品噜噜噜成人av农村| 精品国产91九色蝌蚪| 国产成人在线影院 | 久久久久久一二三区| 亚洲人妖av一区二区| 色av成人天堂桃色av| 午夜免费欧美电影| 久久综合精品国产一区二区三区 | 精品在线亚洲视频| 国产欧美视频一区二区三区| 成人18视频在线播放| 亚洲高清视频中文字幕| 日韩欧美在线一区二区三区| 成人一区二区三区视频| 亚洲午夜久久久久久久久久久 | 欧美a级理论片| 国产午夜精品福利| 欧美在线999| 老色鬼精品视频在线观看播放| 欧美韩日一区二区三区| 在线视频中文字幕一区二区| 视频一区二区不卡| 国产精品久久久久影院| 欧美精品一级二级三级| 国产在线看一区| 亚洲卡通动漫在线| 日韩免费看的电影| 97精品久久久午夜一区二区三区 | 91麻豆免费在线观看| 五月婷婷激情综合| 国产欧美一二三区| 欧美精选午夜久久久乱码6080| 国产a级毛片一区| 亚洲一区二区综合| 久久婷婷国产综合精品青草| 91黄色免费看| 国产成人在线观看免费网站| 亚洲成人tv网| 综合在线观看色| 欧美精品一区二区不卡| 欧美视频第二页| 99久久综合精品| 国产专区欧美精品| 青青草视频一区| 亚洲综合激情小说| 国产精品全国免费观看高清| 精品日韩欧美在线| 欧美乱熟臀69xxxxxx| 色呦呦国产精品| 成人午夜电影小说| 国产一区在线观看麻豆| 日本女优在线视频一区二区| 一区二区三区国产精品| 国产精品女同一区二区三区| 精品国产一区二区三区不卡 | 在线免费观看视频一区| 国产传媒一区在线| 国产一区免费电影| 久久电影网站中文字幕 | 亚洲一区二区三区影院| 亚洲欧洲www| 国产精品久久久久久久久图文区 | 日韩欧美一区二区在线视频| 欧美在线免费观看视频| 91麻豆swag| 色天使色偷偷av一区二区| 成人丝袜视频网| 成人综合日日夜夜| 国产凹凸在线观看一区二区| 国模冰冰炮一区二区| 韩国精品主播一区二区在线观看 | 天天综合日日夜夜精品| 亚洲一二三区视频在线观看| 亚洲精品国产第一综合99久久| 亚洲欧美自拍偷拍色图| 亚洲欧洲日韩综合一区二区| 中文字幕电影一区| 自拍偷在线精品自拍偷无码专区| 中文字幕一区二区三区不卡| 国产精品福利一区| 亚洲欧美日韩中文播放 | 亚洲日本韩国一区| 一区二区成人在线视频| 亚洲综合激情网| 日本不卡中文字幕| 另类小说综合欧美亚洲| 狠狠色丁香婷婷综合| 国产成人亚洲综合a∨婷婷图片| 成人午夜在线视频| 色噜噜狠狠成人网p站| 欧美区在线观看| 久久九九影视网| 亚洲理论在线观看| 日韩av一级片| 国产黄色精品网站| 在线视频一区二区免费| 日韩欧美在线一区二区三区| 欧美激情综合在线| 亚洲第一激情av| 国产美女精品在线| 色综合久久88色综合天天免费| 欧美日韩一区二区三区不卡| 日韩午夜中文字幕| 国产精品国产三级国产普通话三级| 亚洲女人****多毛耸耸8| 日韩福利视频网| 国产91在线|亚洲| 欧美色综合久久| 国产午夜精品在线观看| 亚洲欧美日韩中文播放| 久久精品久久久精品美女| 99精品视频一区| 日韩欧美一区电影| 亚洲欧美日本韩国| 久久9热精品视频| 日本高清不卡aⅴ免费网站| 欧美xxx久久| 亚洲精品免费在线观看| 国产一区二区主播在线| 91久久精品网| 久久久美女毛片| 视频在线在亚洲| 日本精品视频一区二区三区| 久久亚洲一区二区三区明星换脸| 一区二区三区国产精品| 国产成人免费视频网站高清观看视频 | 91国产成人在线| 国产亚洲欧美激情| 奇米亚洲午夜久久精品| 91成人免费在线视频| 26uuuu精品一区二区| 日韩不卡一区二区| 在线视频观看一区| 国产精品三级电影| 精品伊人久久久久7777人| 欧美日韩久久久| 亚洲欧美国产高清| 99久久精品国产一区| 中文字幕av一区二区三区高| 蜜桃视频免费观看一区| 精品污污网站免费看| 中文字幕在线一区| 成人丝袜高跟foot| 国产日韩欧美精品电影三级在线| 久久99这里只有精品| 日韩精品一区二区三区老鸭窝 | ...xxx性欧美| 国产乱淫av一区二区三区 | 国产精品99久| 欧美精品一区二区三区蜜桃视频| 日本女人一区二区三区| 91精选在线观看| 日本网站在线观看一区二区三区| 精品视频一区二区不卡| 日韩理论片一区二区| 色综合久久中文综合久久97| 亚洲裸体xxx| 欧美日韩一区二区在线视频| 一区二区三区四区不卡视频| 色伊人久久综合中文字幕|