本文整理汇总了C++中RegEnumValue函数的典型用法代码示例。如果您正苦于以下问题:C++ RegEnumValue函数的具体用法?C++ RegEnumValue怎么用?C++ RegEnumValue使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RegEnumValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsDotNet35
bool IsDotNet35()
{
bool ret = false;
int lpType = 0;
HKEY key;
DWORD dwValSize = 50;
LONG regret;
LPTSTR lpValname = new TCHAR[50];
regret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\.NETCompactFramework"), 0, KEY_QUERY_VALUE, &key);
if (regret == 0)
{
int i = 0;
while((regret = RegEnumValue(key, i++, lpValname, &dwValSize, NULL,NULL, NULL, NULL)) == 0)
{
lpValname[1] = 0;
lpValname[3] = 0;
int majVer = _ttoi(&lpValname[0]);
int minVer = _ttoi(&lpValname[2]);
if(majVer > 3 || (majVer == 3 && minVer >= 5))
{
ret = true;
break;
}
}
RegCloseKey(key);
}
return ret;
}
示例2: subkeys
// On input dwValueNameSize is size in characters of buffer pointed by pchValueNameBuffer
// On output dwValueNameSize contains number of characters stored in buffer
LONG CRegistryKey::GetNextValue(DWORD *pdwNameActualSize, DWORD *pdwDataActualSize)
{
if (!m_hKey)
return ERROR_NO_MORE_ITEMS; // the root key abstraction has only subkeys (hives)
DWORD dwValueNameBufferSize = m_dwValueNameBufferSize;
DWORD dwValueDataBufferSize = m_dwValueDataBufferSize;
LONG nError = RegEnumValue(m_hKey,
m_dwCurrentValueIndex,
m_pszValueNameBuffer,
&dwValueNameBufferSize,
NULL,
m_pdwType,
m_pbValueDataBuffer,
&dwValueDataBufferSize);
if (pdwNameActualSize)
*pdwNameActualSize = dwValueNameBufferSize;
if (pdwDataActualSize)
*pdwDataActualSize = dwValueDataBufferSize;
m_dwCurrentValueIndex++;
return nError;
}
示例3: wxASSERT
bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
{
wxASSERT( IsOpened() );
// are we already at the end of enumeration?
if ( lIndex == -1 )
return false;
wxChar szValueName[1024]; // @@ use RegQueryInfoKey...
DWORD dwValueLen = WXSIZEOF(szValueName);
m_dwLastError = RegEnumValue((HKEY) m_hKey, lIndex++,
szValueName, &dwValueLen,
RESERVED,
NULL, // [out] type
NULL, // [out] buffer for value
NULL); // [i/o] it's length
if ( m_dwLastError != ERROR_SUCCESS ) {
if ( m_dwLastError == ERROR_NO_MORE_ITEMS ) {
m_dwLastError = ERROR_SUCCESS;
lIndex = -1;
}
else {
wxLogSysError(m_dwLastError, _("Can't enumerate values of key '%s'"),
GetName().c_str());
}
return false;
}
strValueName = szValueName;
return true;
}
示例4: ERROR_MSG
void UsbDeviceList::FetchInterfaceFilters(LPCUSB_FUNCS lpUsbFuncs,
LPCWSTR szUniqueDriverId)
{
HKEY key;
LONG result;
DWORD numValues = 0, maxNameLen = 0, maxValueLen = 0;
DWORD valueType;
PWCHAR nameBuf;
PBYTE valueBuf;
// We do not support dynamic updating of the filter list
if (mNumInterfaceFilters > 0) {
return;
}
key = lpUsbFuncs->lpOpenClientRegistyKey(szUniqueDriverId);
if (!key) {
ERROR_MSG((TEXT("USBKWrapperDrv!UsbDeviceList::FetchInterfaceFilters() - Failed to open client registry key\r\n")));
return;
}
result = RegQueryInfoKey(key, NULL, NULL, NULL, NULL, NULL, NULL,
&numValues, &maxNameLen, &maxValueLen, NULL, NULL);
if (result != ERROR_SUCCESS) {
ERROR_MSG((TEXT("USBKWrapperDrv!UsbDeviceList::FetchInterfaceFilters() - Failed to query key info: error %i\r\n"), result));
RegCloseKey(key);
return;
}
nameBuf = new (std::nothrow) WCHAR[maxNameLen+1];
valueBuf = new (std::nothrow) BYTE[maxValueLen];
if (!nameBuf || !valueBuf) {
ERROR_MSG((TEXT("USBKWrapperDrv!UsbDeviceList::FetchInterfaceFilters() - Out of memory allocating buffers\r\n")));
delete[] nameBuf;
delete[] valueBuf;
RegCloseKey(key);
return;
}
for (DWORD index = 0; index < numValues && result == ERROR_SUCCESS; index++) {
DWORD nameBufSize = maxNameLen + 1;
DWORD valueBufSize = maxValueLen;
result = RegEnumValue(key, index, nameBuf, &nameBufSize, NULL, &valueType,
valueBuf, &valueBufSize);
if (result == ERROR_SUCCESS) {
// Pay attention only to unicode strings (REG_SZ) whose name has the
// InterfaceFilter_ prefix
if (nameBufSize > 16 && wcsncmp(nameBuf, TEXT("InterfaceFilter_"), 16) == 0 &&
valueType == REG_SZ) {
AddInterfaceFilter(&nameBuf[16], (LPCWSTR) valueBuf);
}
}
}
delete[] nameBuf;
delete[] valueBuf;
RegCloseKey(key);
}
示例5: RegOpenKeyEx
// CComSetDlg 消息处理程序
INT_PTR CComSetDlg::GetSerialPort(CStringArray &arrCom)
{
arrCom.RemoveAll();
HKEY hkey;
LONG32 lRes = RegOpenKeyEx(
HKEY_LOCAL_MACHINE,_T("HARDWARE\\DEVICEMAP\\SERIALCOMM"),
NULL,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|KEY_READ,&hkey);
if (lRes == ERROR_SUCCESS)
{
TCHAR tchKey[MAX_PATH];
TCHAR tchValue[20];
DWORD dwIndex = 0;
DWORD dwType = REG_SZ;
while(lRes == ERROR_SUCCESS)
{
DWORD dwCnt = MAX_PATH;
DWORD dwVCount = 20;
lRes = RegEnumValue(hkey,dwIndex++,tchKey,&dwCnt,NULL,
&dwType,(LPBYTE)tchValue,&dwVCount);
if (lRes == ERROR_SUCCESS)
{
if(dwVCount >0 && dwCnt >0)
arrCom.Add(tchValue);
}
}
}
RegCloseKey(hkey);
return arrCom.GetSize();
}
示例6: while
// 查找串口
void CPMSRSet::FindComPort()
{
HKEY hKey;
st_CommPara.usCommNum = 0; // 串口数量
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Hardware\\DeviceMap\\SerialComm"), NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
{
TCHAR szPortName[256], szComName[256];
DWORD dwLong, dwSize;
int nCount = 0;
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
pCombo->ResetContent();
while (true)
{
dwLong = dwSize = 256;
if (RegEnumValue(hKey, nCount, szPortName, &dwLong, NULL, NULL, (PUCHAR)szComName, &dwSize) == ERROR_NO_MORE_ITEMS)
break;
pCombo->InsertString(nCount, szComName);
nCount++;
st_CommPara.usCommNum++;
}
RegCloseKey(hKey);
pCombo->SetCurSel(0);
}
}
示例7: parse_reg_values
static krb5_error_code
parse_reg_values(krb5_context context,
HKEY key,
krb5_config_section ** parent)
{
DWORD index;
LONG rcode;
for (index = 0; ; index ++) {
char name[16385];
DWORD cch = sizeof(name)/sizeof(name[0]);
DWORD type;
DWORD cbdata = 0;
krb5_error_code code;
rcode = RegEnumValue(key, index, name, &cch, NULL,
&type, NULL, &cbdata);
if (rcode != ERROR_SUCCESS)
break;
if (cbdata == 0)
continue;
code = parse_reg_value(context, key, name, type, cbdata, parent);
if (code != 0)
return code;
}
return 0;
}
示例8: GetLayoutCount
INT
GetLayoutCount(LPTSTR szLang)
{
HKEY hKey;
TCHAR szLayoutID[3 + 1], szPreload[CCH_LAYOUT_ID + 1], szLOLang[MAX_PATH];
DWORD dwIndex = 0, dwType, dwSize;
UINT Count = 0, i, j;
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Keyboard Layout\\Preload"),
0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
{
dwSize = sizeof(szLayoutID);
while (RegEnumValue(hKey, dwIndex, szLayoutID, &dwSize, NULL, &dwType, NULL, NULL) == ERROR_SUCCESS)
{
dwSize = sizeof(szPreload);
RegQueryValueEx(hKey, szLayoutID, NULL, NULL, (LPBYTE)szPreload, &dwSize);
for (i = 4, j = 0; i < _tcslen(szPreload)+1; i++, j++)
szLOLang[j] = szPreload[i];
if (_tcscmp(szLOLang, szLang) == 0) Count += 1;
dwSize = sizeof(szLayoutID);
dwIndex++;
}
RegCloseKey(hKey);
}
return Count;
}
示例9: while
void RegistryKeys::GetSupplyIntervalMultiplier(int *multi)
{
// If this is the first time running, or the key doesn't exist, return default values
*multi=6;
HKEY hKey;
char subkey[]="Software\\MediaDefender\\WinMx\\Supply Interval Multiplier";
if(RegOpenKeyEx(HKEY_CURRENT_USER,subkey,0,KEY_READ,&hKey)==ERROR_SUCCESS)
{
char szName[1024];
DWORD cbName=sizeof(szName)/sizeof(szName[0]);
DWORD dwType;
int val;
DWORD cbData=sizeof(int);
DWORD index=0;
while(RegEnumValue(hKey,index,szName,&cbName,NULL,&dwType,(unsigned char *)&val,&cbData)==ERROR_SUCCESS)
{
if(strcmp(szName,"Multiplier")==0)
{
*multi=val;
}
cbName=sizeof(szName)/sizeof(szName[0]); // reset the size
index++;
}
}
RegCloseKey(hKey);
}
示例10: main
int main()
{
unsigned long com_nb;
char reg_key[CHAR_LEN];
char reg_val[CHAR_LEN];
long ret;
unsigned long reg_index = 0;
unsigned long len_key;
unsigned long len_val;
unsigned long type;
HKEY hkey;
char *key_str="HARDWARE\\DEVICEMAP\\SERIALCOMM\\";
len_key = sizeof(reg_key);
len_val = sizeof(reg_val);
//long ret0 = (::RegOpenKeyEx(HKEY_LOCAL_MACHINE, data_Set, 0, KEY_READ, &hKey));
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, key_str, 0, KEY_READ, &hkey) == ERROR_SUCCESS) {
printf("NODE\t\t PORTNUM \t\t CYGWIN\n\n");
do {
ret = RegEnumValue(hkey, reg_index++, reg_key, &len_key, NULL, &type, reg_val, &len_val);
if((ret == ERROR_SUCCESS) || (ret == ERROR_MORE_DATA)) {
com_nb = atoi(strtok(reg_val, "COM"));
printf("%-30s \t\t %5s \t\t /dev/ttyS%d\n", reg_key, reg_val, com_nb - 1);
}
len_key = sizeof(reg_key);
len_val = sizeof(reg_val);
} while ((ret == ERROR_SUCCESS) || (ret == ERROR_MORE_DATA));
RegCloseKey(hkey);
} else {
printf("Can not open HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\SERIALCOMM\\\n");
}
}
示例11: EnumValues
/*
* Enumeration
*/
bool EnumValues(TSTRING &tsNameOut, BYTE *pValueData, DWORD_PTR dwDataSize,
DWORD_PTR dwType = REG_SZ)
{
bool r = false;
static DWORD dwIndex = 0UL;
LONG lRet = ERROR_SUCCESS;
TCHAR szBuf[16383] = {0};
DWORD dwNameSize = 16383;
lRet = RegEnumValue(m_hKey,
dwIndex++,
szBuf,
&dwNameSize,
NULL,
&dwType,
pValueData,
&dwDataSize);
if (ERROR_SUCCESS == lRet) {
tsNameOut = szBuf;
r = true;
} else if (ERROR_NO_MORE_ITEMS == lRet) {
tsNameOut = _T("");
dwIndex = 0UL;
ZeroMemory(pValueData, dwDataSize);
}
return r;
}
示例12: get_value_names
static LIST* get_value_names(HKEY key, char const* path)
{
LIST* result = 0;
if ( ERROR_SUCCESS == RegOpenKeyEx(key, path, 0, KEY_QUERY_VALUE, &key) )
{
char name[MAX_REGISTRY_VALUENAME_LENGTH];
DWORD name_size = sizeof(name);
DWORD index;
for ( index = 0;
ERROR_SUCCESS == RegEnumValue(
key, index, name, &name_size, 0, 0, 0, 0);
++index,
name_size = sizeof(name)
)
{
name[name_size] = 0;
result = list_append(result, list_new(0, newstr(name)));
}
RegCloseKey(key);
}
return result;
}
示例13: _T
void CDownloads::PurgeDeletes()
{
CStringList pRemove;
HKEY hKey = NULL;
if ( ERROR_SUCCESS != RegOpenKeyEx( HKEY_CURRENT_USER,
_T("Software\\Shareaza\\Shareaza\\Delete"), 0, KEY_ALL_ACCESS, &hKey ) ) return;
for ( DWORD nIndex = 0 ; nIndex < 1000 ; nIndex ++ )
{
DWORD nPath = MAX_PATH*2;
TCHAR szPath[MAX_PATH*2];
if ( ERROR_SUCCESS != RegEnumValue( hKey, nIndex, szPath, &nPath, NULL,
NULL, NULL, NULL ) ) break;
if ( GetFileAttributes( szPath ) == 0xFFFFFFFF || DeleteFile( szPath ) )
{
pRemove.AddTail( szPath );
}
}
while ( ! pRemove.IsEmpty() )
{
RegDeleteValue( hKey, pRemove.RemoveHead() );
}
RegCloseKey( hKey );
}
示例14: RegOpenKeyEx
// Read the data from the registry filling in the data areas.
int CRegistryData::ReadRegistry(void)
{
HKEY hKey = 0;
LONG lRetVal = RegOpenKeyEx (HKEY_LOCAL_MACHINE, m_OposRootKey, 0, KEY_READ, &hKey);
if (lRetVal == ERROR_SUCCESS) {
DWORD dwIndex = 0;
DWORD dwType;
do {
wchar_t wsValueName[128] = {0};
BYTE wsValueValue[256] = {0};
DWORD dwValueNameSize = 124, dwValueValueSize = sizeof(wsValueValue);
lRetVal = RegEnumValue (hKey, dwIndex, wsValueName, &dwValueNameSize, NULL, &dwType, wsValueValue, &dwValueValueSize);
if (dwValueNameSize > 0 && lRetVal == ERROR_SUCCESS) {
wsValueName[dwValueNameSize] = 0;
wsValueValue[dwValueValueSize] = wsValueValue[dwValueValueSize+1] = 0;
m_RegistryData.Add(std::wstring(wsValueName), std::wstring((wchar_t *)wsValueValue));
}
dwIndex++;
} while (lRetVal == ERROR_SUCCESS);
lRetVal = RegCloseKey (hKey);
}
return 0;
}
示例15: enumerateRegistry
// Enumerate a key or a value. Returns a string option containing NONE if
// no key/value could be found or SOME s where s is the name of the key/value.
static Handle enumerateRegistry(TaskData *taskData, Handle args, HKEY hkey, BOOL isKey)
{
DWORD num = get_C_unsigned(taskData, DEREFWORDHANDLE(args)->Get(1));
LONG lRes;
TCHAR keyName[MAX_PATH];
DWORD dwLength = sizeof(keyName)/sizeof(keyName[0]);
Handle result, resVal;
if (isKey)
{
FILETIME ftMod;
lRes = RegEnumKeyEx(hkey, num, keyName, &dwLength, NULL, NULL, NULL, &ftMod);
if (lRes != ERROR_SUCCESS && lRes != ERROR_NO_MORE_ITEMS)
raise_syscall(taskData, "RegEnumKeyEx failed", -lRes);
}
else
{
lRes = RegEnumValue(hkey, num, keyName, &dwLength, NULL, NULL, NULL, NULL);
if (lRes != ERROR_SUCCESS && lRes != ERROR_NO_MORE_ITEMS)
raise_syscall(taskData, "RegEnumValue failed", -lRes);
}
if (lRes == ERROR_NO_MORE_ITEMS)
return SAVE(NONE_VALUE); /* NONE. */
resVal = SAVE(C_string_to_Poly(taskData, keyName));
result = alloc_and_save(taskData, 1);
DEREFHANDLE(result)->Set(0, DEREFWORDHANDLE(resVal));
return result;
}