| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <setupapi.h> | 6 #include <setupapi.h> |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <winioctl.h> | 8 #include <winioctl.h> |
| 9 | 9 |
| 10 #include "chrome/utility/image_writer/error_messages.h" | 10 #include "chrome/utility/image_writer/error_messages.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 if (!device_handle.IsValid()) { | 26 if (!device_handle.IsValid()) { |
| 27 Error(error::kOpenDevice); | 27 Error(error::kOpenDevice); |
| 28 return false; | 28 return false; |
| 29 } | 29 } |
| 30 | 30 |
| 31 STORAGE_PROPERTY_QUERY query = STORAGE_PROPERTY_QUERY(); | 31 STORAGE_PROPERTY_QUERY query = STORAGE_PROPERTY_QUERY(); |
| 32 query.PropertyId = StorageDeviceProperty; | 32 query.PropertyId = StorageDeviceProperty; |
| 33 query.QueryType = PropertyStandardQuery; | 33 query.QueryType = PropertyStandardQuery; |
| 34 DWORD bytes_returned; | 34 DWORD bytes_returned; |
| 35 | 35 |
| 36 scoped_ptr<char[]> output_buf(new char[kStorageQueryBufferSize]); | 36 std::unique_ptr<char[]> output_buf(new char[kStorageQueryBufferSize]); |
| 37 BOOL status = DeviceIoControl( | 37 BOOL status = DeviceIoControl( |
| 38 device_handle.Get(), // Device handle. | 38 device_handle.Get(), // Device handle. |
| 39 IOCTL_STORAGE_QUERY_PROPERTY, // Flag to request device properties. | 39 IOCTL_STORAGE_QUERY_PROPERTY, // Flag to request device properties. |
| 40 &query, // Query parameters. | 40 &query, // Query parameters. |
| 41 sizeof(STORAGE_PROPERTY_QUERY), // query parameters size. | 41 sizeof(STORAGE_PROPERTY_QUERY), // query parameters size. |
| 42 output_buf.get(), // output buffer. | 42 output_buf.get(), // output buffer. |
| 43 kStorageQueryBufferSize, // Size of buffer. | 43 kStorageQueryBufferSize, // Size of buffer. |
| 44 &bytes_returned, // Number of bytes returned. | 44 &bytes_returned, // Number of bytes returned. |
| 45 // Must not be null. | 45 // Must not be null. |
| 46 NULL); // Optional unused overlapped perameter. | 46 NULL); // Optional unused overlapped perameter. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 if (volume_finder != INVALID_HANDLE_VALUE) { | 192 if (volume_finder != INVALID_HANDLE_VALUE) { |
| 193 FindVolumeClose(volume_finder); | 193 FindVolumeClose(volume_finder); |
| 194 } | 194 } |
| 195 | 195 |
| 196 if (success) | 196 if (success) |
| 197 continuation.Run(); | 197 continuation.Run(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace image_writer | 200 } // namespace image_writer |
| OLD | NEW |