BOOL GetSystemSerialComport(CArray<CString,CString> &comarray)
{
HKEY hKey=NULL;
comarray.RemoveAll();
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,TEXT("HARDWARE\\DEVICEMAP\\SERIALCOMM"),0,KEY_READ,&hKey)!=ERROR_SUCCESS)
{
return FALSE;
}
CString valuename,databuffer;
DWORD valuenamebufferlength=200,valuetype,databuddersize=200;
int i=0;
while(RegEnumValue(hKey,i++,valuename.GetBuffer(200),&valuenamebufferlength,NULL,&valuetype,(BYTE*)databuffer.GetBuffer(200),&databuddersize) != ERROR_NO_MORE_ITEMS)
{
comarray.Add(CString(databuffer));
databuddersize=200;
valuenamebufferlength=200;
}
RegCloseKey(hKey);
return TRUE;
}