Skip to content

Commit

Permalink
[general/toaster] Update GetDeviceDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
wm1 committed Jan 16, 2023
1 parent 13092c6 commit 38434bf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions general/toaster/toastDrv/exe/notify/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Revision History:
// Annotation to indicate to prefast that this is nondriver user-mode code.
//
#include <DriverSpecs.h>
_Analysis_mode_(_Analysis_code_type_user_code_)
_Analysis_mode_(_Analysis_code_type_user_code_)

#include <windows.h>
#include <stdlib.h>
Expand Down Expand Up @@ -494,7 +494,7 @@ HandleDeviceInterfaceChange(


if(!GetDeviceDescription(dip->dbcc_name,
(PBYTE)deviceInfo->DeviceName,
deviceInfo->DeviceName,
sizeof(deviceInfo->DeviceName),
&deviceInfo->SerialNo)) {
MessageBox(hWnd, TEXT("GetDeviceDescription failed"), TEXT("Error!"), MB_OK);
Expand Down Expand Up @@ -783,7 +783,7 @@ EnumExistingDevices(
// Get the device details such as friendly name and SerialNo
//
if(!GetDeviceDescription(deviceInterfaceDetailData->DevicePath,
(PBYTE)deviceInfo->DeviceName,
deviceInfo->DeviceName,
sizeof(deviceInfo->DeviceName),
&deviceInfo->SerialNo)){
goto Error;
Expand Down Expand Up @@ -873,7 +873,7 @@ BOOLEAN Cleanup(HWND hWnd)
BOOL
GetDeviceDescription(
_In_ LPTSTR DevPath,
_Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer,
_Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer,
_In_ ULONG OutBufferLen,
_In_ PULONG SerialNo
)
Expand Down Expand Up @@ -917,14 +917,14 @@ GetDeviceDescription(
if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData,
SPDRP_FRIENDLYNAME,
&dwRegType,
OutBuffer,
(PBYTE) OutBuffer,
OutBufferLen,
NULL))
{
if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData,
SPDRP_DEVICEDESC,
&dwRegType,
OutBuffer,
(PBYTE) OutBuffer,
OutBufferLen,
NULL)){
goto Error;
Expand Down
2 changes: 1 addition & 1 deletion general/toaster/toastDrv/exe/notify/notify.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ BOOLEAN Cleanup(
BOOL
GetDeviceDescription(
_In_ LPTSTR DevPath,
_Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer,
_Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer,
_In_ ULONG OutBufferLen,
_In_ PULONG SerialNo
);
Expand Down
12 changes: 6 additions & 6 deletions general/toaster/umdf2/exe/notify/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Revision History:
// Annotation to indicate to prefast that this is nondriver user-mode code.
//
#include <DriverSpecs.h>
_Analysis_mode_(_Analysis_code_type_user_code_)
_Analysis_mode_(_Analysis_code_type_user_code_)

#include <windows.h>
#include <stdlib.h>
Expand Down Expand Up @@ -494,7 +494,7 @@ HandleDeviceInterfaceChange(


if(!GetDeviceDescription(dip->dbcc_name,
(PBYTE)deviceInfo->DeviceName,
deviceInfo->DeviceName,
sizeof(deviceInfo->DeviceName),
&deviceInfo->SerialNo)) {
MessageBox(hWnd, TEXT("GetDeviceDescription failed"), TEXT("Error!"), MB_OK);
Expand Down Expand Up @@ -783,7 +783,7 @@ EnumExistingDevices(
// Get the device details such as friendly name and SerialNo
//
if(!GetDeviceDescription(deviceInterfaceDetailData->DevicePath,
(PBYTE)deviceInfo->DeviceName,
deviceInfo->DeviceName,
sizeof(deviceInfo->DeviceName),
&deviceInfo->SerialNo)){
goto Error;
Expand Down Expand Up @@ -873,7 +873,7 @@ BOOLEAN Cleanup(HWND hWnd)
BOOL
GetDeviceDescription(
_In_ LPTSTR DevPath,
_Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer,
_Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer,
_In_ ULONG OutBufferLen,
_In_ PULONG SerialNo
)
Expand Down Expand Up @@ -917,14 +917,14 @@ GetDeviceDescription(
if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData,
SPDRP_FRIENDLYNAME,
&dwRegType,
OutBuffer,
(PBYTE) OutBuffer,
OutBufferLen,
NULL))
{
if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData,
SPDRP_DEVICEDESC,
&dwRegType,
OutBuffer,
(PBYTE) OutBuffer,
OutBufferLen,
NULL)){
goto Error;
Expand Down
2 changes: 1 addition & 1 deletion general/toaster/umdf2/exe/notify/notify.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ BOOLEAN Cleanup(
BOOL
GetDeviceDescription(
_In_ LPTSTR DevPath,
_Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer,
_Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer,
_In_ ULONG OutBufferLen,
_In_ PULONG SerialNo
);
Expand Down

0 comments on commit 38434bf

Please sign in to comment.