Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Deskriptor perangkat, konfigurasi, dan antarmuka mungkin berisi referensi ke deskriptor string. Topik ini menjelaskan cara mendapatkan deskriptor string tertentu dari perangkat.
Deskriptor string direferensikan oleh nomor indeks berbasis satu. Deskriptor string berisi satu atau beberapa string Unicode; setiap string adalah terjemahan yang lain ke dalam bahasa lain.
Client drivers use UsbBuildGetDescriptorRequest, with DescriptorType = USB_STRING_DESCRIPTOR_TYPE, to build the request to obtain a string descriptor. The Index parameter specifies the index number, and the LanguageID parameter specifies the language ID (the same values are used as in Microsoft Win32 LANGID values). Driver dapat meminta jumlah indeks khusus nol untuk menentukan ID bahasa mana yang didukung perangkat. Untuk nilai khusus ini, perangkat mengembalikan array ID bahasa daripada string Unicode.
Karena deskriptor string terdiri dari data panjang variabel, driver harus mendapatkannya dalam dua langkah. Pertama, driver harus mengeluarkan permintaan, melewati buffer data yang cukup besar untuk menahan header untuk deskriptor string, struktur USB_STRING_DESCRIPTOR. The bLength member of USB_STRING_DESCRIPTOR specifies the size in bytes of the entire descriptor. The driver then makes the same request with a data buffer of size bLength.
The following code demonstrates how to request the i-th string descriptor, with language ID langID:
USB_STRING_DESCRIPTOR USD, *pFullUSD;
UsbBuildGetDescriptorRequest(
pURB, // points to the URB to be filled in
sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST),
USB_STRING_DESCRIPTOR_TYPE,
i, // index of string descriptor
langID, // language ID of string.
&USD, // points to a USB_STRING_DESCRIPTOR.
NULL,
sizeof(USB_STRING_DESCRIPTOR),
NULL
);
pFullUSD = ExAllocatePool(NonPagedPool, USD.bLength);
UsbBuildGetDescriptorRequest(
pURB, // points to the URB to be filled in
sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST),
USB_STRING_DESCRIPTOR_TYPE,
i, // index of string descriptor
langID, // language ID of string
pFullUSD,
NULL,
USD.bLength,
NULL
);