mirror of
https://github.com/reactos/reactos.git
synced 2025-05-30 06:28:34 +00:00
[DEVMGR] m_DisplayName: Some functions need bytes, not chars
Also: Always use explicit _countof() and sizeof(). Add a missing 'Size' re-init.
This commit is contained in:
parent
c3da027012
commit
9c82d16b14
4 changed files with 8 additions and 7 deletions
|
@ -42,10 +42,10 @@ CClassNode::SetupNode()
|
||||||
0);
|
0);
|
||||||
if (hKey != INVALID_HANDLE_VALUE)
|
if (hKey != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
Size = DISPLAY_NAME_LEN;
|
|
||||||
Type = REG_SZ;
|
Type = REG_SZ;
|
||||||
|
|
||||||
// Lookup the class description (win7+)
|
// Lookup the class description (win7+)
|
||||||
|
Size = sizeof(m_DisplayName);
|
||||||
Success = RegQueryValueExW(hKey,
|
Success = RegQueryValueExW(hKey,
|
||||||
L"ClassDesc",
|
L"ClassDesc",
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -58,12 +58,13 @@ CClassNode::SetupNode()
|
||||||
if (m_DisplayName[0] == L'@')
|
if (m_DisplayName[0] == L'@')
|
||||||
{
|
{
|
||||||
// The description is located in a module resource
|
// The description is located in a module resource
|
||||||
Success = ConvertResourceDescriptorToString(m_DisplayName, DISPLAY_NAME_LEN);
|
Success = ConvertResourceDescriptorToString(m_DisplayName, sizeof(m_DisplayName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Success == ERROR_FILE_NOT_FOUND)
|
else if (Success == ERROR_FILE_NOT_FOUND)
|
||||||
{
|
{
|
||||||
// WinXP stores the description in the default value
|
// WinXP stores the description in the default value
|
||||||
|
Size = sizeof(m_DisplayName);
|
||||||
Success = RegQueryValueExW(hKey,
|
Success = RegQueryValueExW(hKey,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -84,7 +85,7 @@ CClassNode::SetupNode()
|
||||||
if (Success != ERROR_SUCCESS)
|
if (Success != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// Use the class name as the description
|
// Use the class name as the description
|
||||||
RequiredSize = DISPLAY_NAME_LEN;
|
RequiredSize = _countof(m_DisplayName);
|
||||||
(VOID)SetupDiClassNameFromGuidW(&m_ClassGuid,
|
(VOID)SetupDiClassNameFromGuidW(&m_ClassGuid,
|
||||||
m_DisplayName,
|
m_DisplayName,
|
||||||
RequiredSize,
|
RequiredSize,
|
||||||
|
|
|
@ -131,7 +131,7 @@ CDeviceNode::SetupNode()
|
||||||
&m_ClassImage);
|
&m_ClassImage);
|
||||||
|
|
||||||
// Get the description for the device
|
// Get the description for the device
|
||||||
ulLength = DISPLAY_NAME_LEN * sizeof(WCHAR);
|
ulLength = sizeof(m_DisplayName);
|
||||||
cr = CM_Get_DevNode_Registry_PropertyW(m_DevInst,
|
cr = CM_Get_DevNode_Registry_PropertyW(m_DevInst,
|
||||||
CM_DRP_FRIENDLYNAME,
|
CM_DRP_FRIENDLYNAME,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -140,7 +140,7 @@ CDeviceNode::SetupNode()
|
||||||
0);
|
0);
|
||||||
if (cr != CR_SUCCESS)
|
if (cr != CR_SUCCESS)
|
||||||
{
|
{
|
||||||
ulLength = DISPLAY_NAME_LEN * sizeof(WCHAR);
|
ulLength = sizeof(m_DisplayName);
|
||||||
cr = CM_Get_DevNode_Registry_PropertyW(m_DevInst,
|
cr = CM_Get_DevNode_Registry_PropertyW(m_DevInst,
|
||||||
CM_DRP_DEVICEDESC,
|
CM_DRP_DEVICEDESC,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -32,7 +32,7 @@ CNode::CNode(const CNode &Node)
|
||||||
m_DeviceId = Node.m_DeviceId;
|
m_DeviceId = Node.m_DeviceId;
|
||||||
m_ClassImage = Node.m_ClassImage;
|
m_ClassImage = Node.m_ClassImage;
|
||||||
|
|
||||||
StringCbCopyW(m_DisplayName, DISPLAY_NAME_LEN, Node.m_DisplayName);
|
StringCbCopyW(m_DisplayName, sizeof(m_DisplayName), Node.m_DisplayName);
|
||||||
CopyMemory(&m_ClassGuid, &Node.m_ClassGuid, sizeof(GUID));
|
CopyMemory(&m_ClassGuid, &Node.m_ClassGuid, sizeof(GUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ CRootNode::SetupNode()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The root name is the computer name
|
// The root name is the computer name
|
||||||
DWORD Size = DISPLAY_NAME_LEN;
|
DWORD Size = _countof(m_DisplayName);
|
||||||
GetComputerNameW(m_DisplayName, &Size);
|
GetComputerNameW(m_DisplayName, &Size);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue