GetDefaultCommConfig返回错误87(ERROR_INVALID_PARAMETER) [英] GetDefaultCommConfig is returning error 87 (ERROR_INVALID_PARAMETER)

查看:96
本文介绍了GetDefaultCommConfig返回错误87(ERROR_INVALID_PARAMETER)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为PCI-e控制器上的串行端口实现串行驱动程序。我正在使用此驱动程序测试串行IO API。 
$


我正在将devicename字符串(\device \ serialx)写入SERIALCOMM注册表。 



API SEtDefaultCommConfig没有任何问题。但是,GetDefaultCOmmCOnfig API失败,错误87(ERROR_INVALID_PARAMETER)。 
$


我以下面的方式调用此API。



GetDefaultCommConfig(" COM1",& commConfig,& dwSize))



1.我已在我的系统中检查过一个端口名称COM1存在并且正在运行。 
$


2.我尝试将CommCOnfig结构的dwSize成员初始化为COMMCONFIG结构的大小。



3.在DwSize中,我传递了COMMCONFIG结构的大小。 



4.我正在运行管理员的应用程序特权。 
$


我以一种或多或少类似的方式调用SetDefaultCommCOnfig它正常工作。但GetDefaultCommCOnfig失败了......这背后的原因是什么? 



I am implementing a serial driver for the serial ports on my PCI-e controller. I am testing the serial IO APIs using this driver. 

I am writing the devicename string (\device\serialx) into SERIALCOMM registry. 

THe API SEtDefaultCommConfig is passing without any problems. However the API GetDefaultCOmmCOnfig fails with error 87(ERROR_INVALID_PARAMETER). 

I am calling this API in the below way.

GetDefaultCommConfig("COM1",&commConfig,&dwSize))

1. I have checked in my system that a port with name COM1 exists and it is working. 

2. I tried initializing the dwSize member of CommCOnfig structure to size of COMMCONFIG structure.

3. In DwSize i am passing the size of the COMMCONFIG structure. 

4. I am running the application with Administrator privileges. 

I am calling SetDefaultCommCOnfig in a more or less similar way as above it is working properly. But GetDefaultCommCOnfig is failing...What could be the reason behind this? 


推荐答案

您具体要写什么来写SERIALCOMM键?密钥名称必须是COM端口名称,并且与传递给GetDefaultCommConfig的字符串完全匹配,即"COM1"。 :REG_SZ" \ devvice \serial0"

what specifically are you writing to the SERIALCOMM key? the key name must be the COM port name and exactly match the string you pass to GetDefaultCommConfig, ie "COM1" : REG_SZ "\device\serial0"


这篇关于GetDefaultCommConfig返回错误87(ERROR_INVALID_PARAMETER)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆