Hi,<br/>Im trying to write and read from a raw SSD. The createfiles result seems to be fine (errorcode 0). WriteFile gives errorcode 6, ERROR_INVALID_HANDLE. ReadFile returns errorcode 0 and a valid numofbytesread, but the read buffer contains all null characters. Im suspicious that theres something wrong with my createfile, though the function gives no error (I also used DeviceIOControl and it gives correct results).<br/><br/>Heres my code to open and write the ssd:<br/><br/><span style="font-size:x-small hDevice = CreateFile(TEXT(<span style="color:#a31515;font-size:x-small <span style="color:#a31515;font-size:x-small "\\.\E:"<span style="font-size:x-small ), <span style="font-size:x-small GENERIC_READ, <span style="font-size:x-small FILE_SHARE_READ | <span style="font-size:x-small FILE_SHARE_WRITE, NULL, <span style="font-size:x-small OPEN_EXISTING, <span style="font-size:x-small 0, <span style="font-size:x-small NULL); <br/><br/><span style="font-size:x-small <span style="color:#0000ff;font-size:x-small <span style="color:#0000ff;font-size:x-small char<span style="font-size:x-small DataBuffer[] = <span style="color:#a31515;font-size:x-small <span style="color:#a31515;font-size:x-small "test"<span style="font-size:x-small ;<br/>DWORD dwBytesToWrite = (DWORD)strlen(DataBuffer);<br/>DWORD dwBytesWritten = 0;<br/>bResult = WriteFile(hDevice, <span style="font-size:x-small DataBuffer, <span style="font-size:x-small dwBytesToWrite, <span style="font-size:x-small &dwBytesWritten, <span style="font-size:x-small NULL);
View the full article
View the full article