Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source code in article "Working with NVMe drives" is wrong #1527

Closed
o0zhhl0o opened this issue May 23, 2019 · 3 comments
Closed

Source code in article "Working with NVMe drives" is wrong #1527

o0zhhl0o opened this issue May 23, 2019 · 3 comments
Assignees

Comments

@o0zhhl0o
Copy link

🛑 IMPORTANT: You can get your feedback addressed faster if you use the comment section for the article in which you encountered a problem.

Link to article:: https://docs.microsoft.com/zh-cn/windows/desktop/FileIO/working-with-nvme-devices
Tell us where exactly a problem occurs.

Problem:
What's wrong with the article?

This article has source code of sending "get log", "get feature" and "identify" command.
The code of "get log" and "get feature" can be used directly, but the code of "identify" can't be used.
The code of "Example: NVMe Identify query" contains some wrong code:

ZeroMemory(buffer, bufferLength);
query = (PSTORAGE_PROPERTY_QUERY)buffer;  
protocolDataDescr = (PSTORAGE_PROTOCOL_DATA_DESCRIPTOR)buffer;  
protocolData = (PSTORAGE_PROTOCOL_SPECIFIC_DATA)query->AdditionalParameters;  

query->PropertyId = StorageDeviceProtocolSpecificProperty;  
query->QueryType = PropertyStandardQuery;  

protocolData->ProtocolType = ProtocolTypeNvme;  
protocolData->DataType = NVMeDataTypeLogPage;  
protocolData->ProtocolDataRequestValue = NVME_LOG_PAGE_HEALTH_INFO;  
protocolData->ProtocolDataRequestSubValue = 0;  
protocolData->ProtocolDataOffset = sizeof(STORAGE_PROTOCOL_SPECIFIC_DATA);  
protocolData->ProtocolDataLength = sizeof(NVME_HEALTH_INFO_LOG);  

//  
// Send request down.  
//  
result = DeviceIoControl(DeviceList[Index].Handle,  
                         IOCTL_STORAGE_QUERY_PROPERTY,  
                         buffer,  
                         bufferLength,  
                         buffer, 
                         bufferLength,  
                         &returnedLength,  
                         NULL  
                         );  

These are the codes of “get log” and should not appear here. When I delete this part of code, the example code of "identify" can work. Maybe the code and document writer just use "ctrl +c" and "ctrl + v" :)
Please delete these codes. Thank you.

@welcome
Copy link

welcome bot commented May 23, 2019

Thank you for creating the issue! One of our team members will get back to you shortly with additional information.

@ryanmajidi
Copy link
Collaborator

@GrantMeStrength Can you please take a look at this issue?

@GrantMeStrength
Copy link
Collaborator

Assigned to the content owner, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants