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鈥檒l 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

Open
o0zhhl0o opened this issue May 23, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@o0zhhl0o
Copy link

commented May 23, 2019

馃洃 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 鈥済et 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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Collaborator

commented Jun 4, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.