Click here to Skip to main content
16,005,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: full text search code Pin
Jörgen Sigvardsson10-Aug-03 0:43
Jörgen Sigvardsson10-Aug-03 0:43 
GeneralRe: full text search code Pin
Neville Franks10-Aug-03 0:51
Neville Franks10-Aug-03 0:51 
GeneralRe: full text search code Pin
Hans Dietrich10-Aug-03 2:08
mentorHans Dietrich10-Aug-03 2:08 
GeneralRe: full text search code Pin
Neville Franks10-Aug-03 2:56
Neville Franks10-Aug-03 2:56 
GeneralRe: full text search code Pin
Hans Dietrich10-Aug-03 3:26
mentorHans Dietrich10-Aug-03 3:26 
GeneralRe: full text search code Pin
Neville Franks11-Aug-03 0:28
Neville Franks11-Aug-03 0:28 
Generalautomate Office without give Password Pin
Jason Truong9-Aug-03 22:33
Jason Truong9-Aug-03 22:33 
GeneralDynamic Allocation! Pin
Abbas_Riazi9-Aug-03 22:29
professionalAbbas_Riazi9-Aug-03 22:29 
I want to use SetupDiGetDeviceInterfaceDetail() API. This function retrieves detailed information about a specified device interface. The definition of function is:

BOOL SetupDiGetDeviceInterfaceDetail(
  HDEVINFO DeviceInfoSet,
  PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  PSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData,
  DWORD DeviceInterfaceDetailDataSize,
  PDWORD RequiredSize,
  PSP_DEVINFO_DATA DeviceInfoData);

As you see, one of arguments is DeviceInterfaceDetailData. the definition of structure is as below:
typedef struct _SP_DEVICE_INTERFACE_DETAIL_DATA 
{  
  DWORD cbSize;  
  TCHAR DevicePath[ANYSIZE_ARRAY];
} SP_DEVICE_INTERFACE_DETAIL_DATA, *PSP_DEVICE_INTERFACE_DETAIL_DATA;

DevicePath is member variable of this structure (An array of TCHAR). ANYSIZE_ARRAY defined as 1. in other hand:
#define ANYSIZE_ARRAY    1    //winnt.h

According to MSDN:
Using the SetupDiGetDeviceInterfaceDetail() function to get details about an interface is typically a two-step process:

1- Get the required buffer size. Call SetupDiGetDeviceInterfaceDetail() with a NULL DeviceInterfaceDetailData pointer, a DeviceInterfaceDetailDataSize of zero, and a valid RequiredSize variable. In response to such a call, this function fails, GetLastError() returns ERROR_INSUFFICIENT_BUFFER, and the RequiredSize parameter receives the required buffer size.

2- Allocate an appropriately sized buffer and call the function again to get the interface details.

Now, my question is, how can I allocate memory for DevicePath member variable of that structure? You know that DevicePath defined as an array not a pointer.

Thanks,
A. Riazi
GeneralMS Office automate and Unicode Pin
Jason Truong9-Aug-03 22:29
Jason Truong9-Aug-03 22:29 
GeneralExcel automate Pin
Jason Truong9-Aug-03 22:25
Jason Truong9-Aug-03 22:25 
GeneralVideo Codec Pin
fbaumgaertel9-Aug-03 21:49
fbaumgaertel9-Aug-03 21:49 
GeneralRe: Video Codec Pin
Joe Woodbury10-Aug-03 8:42
professionalJoe Woodbury10-Aug-03 8:42 
GeneralInterrop: .NET->COM server Pin
devvvy9-Aug-03 20:22
devvvy9-Aug-03 20:22 
GeneralRe: Interrop: .NET->COM server Pin
igor196011-Aug-03 19:14
igor196011-Aug-03 19:14 
QuestionHow to use GetGuiThreadInfo? Pin
Asyura9-Aug-03 16:54
Asyura9-Aug-03 16:54 
AnswerRe: How to use GetGuiThreadInfo? Pin
Michael Dunn9-Aug-03 17:28
sitebuilderMichael Dunn9-Aug-03 17:28 
Generalsuggest a book for... Pin
Beer269-Aug-03 12:26
Beer269-Aug-03 12:26 
GeneralRe: suggest a book for... Pin
Neville Franks9-Aug-03 12:46
Neville Franks9-Aug-03 12:46 
GeneralTree Control and Menu questions Pin
Binayak9-Aug-03 11:15
Binayak9-Aug-03 11:15 
GeneralRe: Tree Control and Menu questions Pin
Neville Franks9-Aug-03 11:24
Neville Franks9-Aug-03 11:24 
GeneralSilly Excel Pin
Anonymous9-Aug-03 10:50
Anonymous9-Aug-03 10:50 
GeneralRe: Silly Excel Pin
Joey Bloggs10-Aug-03 2:49
Joey Bloggs10-Aug-03 2:49 
GeneralRe: Silly Excel Pin
Anonymous10-Aug-03 10:32
Anonymous10-Aug-03 10:32 
GeneralRe: Silly Excel Pin
Joey Bloggs10-Aug-03 17:13
Joey Bloggs10-Aug-03 17:13 
GeneralRe: Silly Excel Pin
Anonymous11-Aug-03 9:52
Anonymous11-Aug-03 9:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.