DeviceIoControl on ATA_PASS_THROUGH_DIRECT returns error code 87

Dear all,
the following code produces error code 87 (invalid parameter) only when PTE-> DataTransferLength is greater than 512 * 256.
Would you please find out what is the problem and how to fix it.
Thank you.

Changwen Xie

#################################
The actual values PTE before call DeviceIoControl are:
##################################
PTE
5 unsigned AtaFlags in brief
[- CurrentTaskFile {length = 8} unsigned char]
[0] 7 unsigned char
[1] 13 unsigned char
[2] 1 unsigned char
[3] 0 unsigned char
[4] 0 unsigned char
[5] 0 unsigned char
[6] 146 unsigned char //0x92 downoad microcode
[7] 0 unsigned char
DataBuffer 0x05CB0068 void *.
DataTransferLength 137728 unsigned int / / it is greater than 512 * 256, so return an error code 87
Length 40 unsigned in brief
LUN 0' unsigned char
PathId 0 unsigned char
[- PreviousTaskFile {length = 8} unsigned char]
[0] 0 unsigned char
[1] 0 unsigned char
[2] 0 unsigned char
[3] 0 unsigned char
[4] 0 unsigned char
[5] 0 unsigned char
[6] 0 unsigned char
[7] 0 unsigned char
ReservedAsUchar 0 unsigned char
ReservedAsUlong 0 unsigned int
TargetId 0 unsigned char
TimeOutValue 10 unsigned int

#############################################
The actual source code:
#############################################
 
ATA_PASS_THROUGH_DIRECT * PTE = new ATA_PASS_THROUGH_DIRECT;
Memset (PTE, 0, sizeof (ATA_PASS_THROUGH_DIRECT));
PTE-> length = sizeof (ATA_PASS_THROUGH_DIRECT);
PTE-> AtaFlags = 0;
PTE-> AtaFlags | = ATA_FLAGS_DRDY_REQUIRED;
PTE-> AtaFlags | = cmd-> isread()? ATA_FLAGS_DATA_IN: ATA_FLAGS_DATA_OUT;
order of 28 bits
PTE-> AtaFlags | = cmd-> is48bit()? ATA_FLAGS_48BIT_COMMAND: 0;
PTE-> AtaFlags | = cmd-> isDMA()? ATA_FLAGS_USE_DMA: 0;
PTE-> DataTransferLength = cmd-> getbuffersize();
PTE-> TimeOutValue = 10;
PTE-> DataBuffer = cmd-> getbuffer();
PTE-> CurrentTaskFile [0] = cmd-> getfeaturesbyte (false);
PTE-> CurrentTaskFile [1] = cmd-> getnumsectorsbyte (false);
PTE-> CurrentTaskFile [2] = cmd-> getLBAbyte(0,false);
PTE-> CurrentTaskFile [3] = cmd-> getLBAbyte(1,false);
PTE-> CurrentTaskFile [4] = cmd-> getLBAbyte(2,false);
PTE-> CurrentTaskFile [5] = cmd-> getLBAbyte(3,false);
PTE-> CurrentTaskFile [5] | = cmd-> getdevice();
PTE-> CurrentTaskFile [6] = cmd-> getcommand();
PTE-> PreviousTaskFile [0] = cmd-> getfeaturesbyte (true);
PTE-> PreviousTaskFile [1] = cmd-> getnumsectorsbyte (true);
PTE-> PreviousTaskFile [2] = cmd-> getLBAbyte(0,true);
PTE-> PreviousTaskFile [3] = cmd-> getLBAbyte(1,true);
PTE-> PreviousTaskFile [4] = cmd-> getLBAbyte(2,true);
PTE-> PreviousTaskFile [5] = 0;
PTE-> PreviousTaskFile [6] = cmd-> getcontrol();
PTE-> PreviousTaskFile [7] = 0;
   
make Ctrl + IO
DWORD BR;
int ret = (DeviceIoControl
_handle,
IOCTL_ATA_PASS_THROUGH_DIRECT,
PTE,
sizeof (ATA_PASS_THROUGH_DIRECT),
PTE,
sizeof (ATA_PASS_THROUGH_DIRECT),
& BR,
(0);
 
If (! ret) DWORD dwLastError = GetLastError();

Hello CWXie,

I suggest you post your question on our MSDN Developer for support forums:

Tags: Windows

Similar Questions

  • Component returned error code: 0 x 80570015

    Loading Firefox, I get this error

    Component returned error code: 0 x 80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]

    I click OK and Firefox loads as if nothing is wrong - but it's embarrassing

    Hello OleDad127, this error message is probably triggered by one of your extensions - please disable them one by one (and reboot after each step) to know that could be causing it.

    then please directly contact the developers of extension through the channels of support they provide - they can probably give you more detailed advice and are the only ones who can fix bugs or make necessary adjustments in the addon for new versions of firefox. Thank you...

    Troubleshoot extensions, themes, and issues of hardware acceleration to resolve common problems of Firefox

  • Windows Vista has stopped auto update cannot update manually. Used windows 'Mr fix - it' returned error code: 0 x 80040154

    I don't know when this problem occurred. All of a sudden I lost sound on my Windows Vista Business System. In trying to find a solution to this problem, I went to the Microsoft Fix - It Center and downloaded the troubleshooting Fix - It. After insalling the Fix - It store and then you try to run the program an error code indicating: "C:\windows\System32\dssenh.dll is not designed to run on windows or it contains an error. Try to install the program using Intallation to original media or software to support provider or system administrator. "before you begin to solve the problem, as well, I decided to create a restore point, then I went to windows update and had an error code: 802440F when you try to update. Go to the Microsoft site and then try to download the updates manually it immediately opens the automatic update dialog box and activating returns the same error code: 8024402F. After reading the list of error codes, the closest codes of this number were 8024402C and 80244022

    and the main board seems to rerun the update with the firewall shutdown, then restart the firewall after the download. I did this and still have not solved my problem. I think I have a sound card problem, but would not interfere with the automatic windows update. I then tried the option repair on windows vista drive still no luck.

    Hello

    I had the same problem and I tried the steps in the following article and it worked for me.

    http://support.Microsoft.com/kb/900936

    http://support.Microsoft.com/kb/883821

    http://support.Microsoft.com/kb/836941

    All the best!

  • Update for Windows Vista (kb975467) Security manages not to install and returns error Code 80092004

    The update of the topic was in Quebec City to install on my machine since October 16, 2009. Whenever I shut the machine down it tries to install, but fails to return code 80092004. I tried to download the KB975467 from Microsoft Update and received an error that the download is not compatible with my system. Can someone please help?

    Thank you

    Dustin

    Windows Update Forum:

    It comes with Vista, upgrade install and activate Forum.

    You will get the best help for any problem of Update/Service Pack in the Windows Update Forum; the link below:

    http://social.answers.Microsoft.com/forums/en-us/vistawu/threads

    When you repost here, kindly include the Error Codes, and exactly what is happening when you try to update.

    In this way, you will receive the best help.

    See you soon.

    Mick Murphy - Microsoft partner

  • The arbiter of USB VMware returned error code 4 (9)

    Hello.

    First, it is write in English, because I am an American or a European. (in fact, Korean)

    So I hope that my message will be pretty silly to make you sneer.

    What I tried to do is just acknowledging my withdrawal on virture OS disk.

    This device, use the usb port, was given by my friend, helps me to play the game online automatically.

    But I found the problem: this device does not work on Windows 7, my current operating system.

    So I used "vmware workstation", hoping that my camera works well on virture OS.

    But whenever I click on "Connect (disconnect host)" button, nothing happens.

    I could just hear the sound of disconnection of the drive of the abduction, on my host computer.

    I tried to solve this problem, research and research until almost 5 hours... but nothing has nothing.

    Reads the error message: The VMware USB arbitrator returned the error code 4 (sometimes 9 error code)

    the solutions I do is:

    1 reinstall the VMware software

    2 reinstall the VMware tools

    3. open the unit on the computer prompt administrator → check → yellow exclamation usb driver delete corresponding

    (I could not find the device in the list, it seems that my device was not recognized at all)

    4. open the Registry Editor → go to the path: deletion → HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ (36FC9E60-C465-11CF-8056-444553540000) the value of key named "UpperFilters" or "LowerFiltters".

    5. Remove AMD USB Filter Driver

    (my motherboard is not AMD)

    6 restore the driver 'USB hub root'

    (I could not click the Cancel button, it has not been activated)

    7. start the Windows Service named "VMware USB Arbitration Service"

    (He's already started)

    many should be listed, but I do not remember...

    I use the desktop version 7.0.1.

    Desperately need someone help... hope the answer comes soon.

    Please check if vmusbarbservice is working correctly - see
    http://FAQ.sanbarrow.com/index.php?solution_id=1113

    If it works as expected, try adding the USB device to your virtual machine - then set later the vmware.log here

  • CreativeCloudSet - Up.exe fails to load, returns error code 48

    As the title says.

    Following the advice of a support representative, I deleted the contents of my file folder and deleted the opm.db file.

    I then rebooted (Unfortunately my computer had some problems and I lost contact with the technical support representative) and I tried to re - run CreativeCloudSet-Up with exactly the same result.

    I repeated the procedure above without success. The program always returns the error code 48, cannot access a critical file.

    Any ideas? Thank you.

    * solved *.

    My users folder is on my D: drive and so is my downloads directory (such as configured by Windows)-this seems to be the problem. I moved CreativeCloudSet - Up.exe on my desk (which is always on drive C :) and it says now that it's installing.)

    Hope this helps someone else.

  • Windows Vista update KB980248 on my Sony VGC-JS160J installation returns error code 80070017

    There is a persistant problem with my computer. It is a 64-bit system with Pentium Dual - Core CPU E5200 @ 2.50 GHz and 4.0 GB RAM.

    No idea why the update fails? What are the consequences of not being able to install it?

    The errorcde means that you have a CRC error. In order to check your HARD disk for error (chkdsk C: /r f). ALS try to download the update from the download area:

    http://www.Microsoft.com/downloads/details.aspx?FamilyId=c16e703f-5a4a-4e8a-8998-87eda1efc302

    "A programmer is just a tool that converts the caffeine in code" Deputy CLIP - http://www.winvistaside.de/

  • JavaScript Error: Error: component returned error code: [nsIDOMLocation.href] 0x805e0006

    When I run farmville2 game above error then. Why

    I can confirm the answer of guigs2. It's a question of AdBlockPlus, at least, it was the way I solved this problem on my own site.

    You can solve it by disabling ABP for this single page only.

  • Error: Javascript Application: what happened: [Exception... "Component returned error code: 0 x 80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIFile.createUnique]" nsresult: "0 x 80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "

    When I double click on the Firefox icon, a box appears under the heading Application Javascript and inside is the error message as described above. The box offers only one option 'OK' and once I click that the program works well. I access email online and when I click on the button of respons or send a new email, the error message appears.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of your modules is causing your problem (switch to the DEFAULT theme: Tools > Modules > themes).

    See the extensions, themes and problems of hardware acceleration to resolve common troubleshooting Firefox problems and troubleshooting questions with plugins like Flash or Java to solve common Firefox problems

  • Whenever I open Firefox, I'm getting following error message: preferences to shorten the URL was not loaded. [Exception... "Component returned error code:

    How can I take the need for preferences of bit.ly . Although I have chosen it as an add-on Firefox some time back, I use any longer.

    Hello mikec1, this article explains how you can remove the extensions you don't use anymore: disable or remove modules

  • Vista - installing KB2237744 getting error code: 80070652

    When I tried to install the update KB2237744, MS Search Enhancement Pack, there no 80070652 returned error code.  I see no solution to this particular error code.  I am running Windows Vista.

    0 x 80070652 - ERROR_INSTALL_ALREADY_RUNNING

    If all goes well he'll eventually install on its own.

    TaurArian [MVP] 2005-2010 - Update Services

  • Do not install update KB2690729 with error code 663

    I am running Windows Vista SP2 and I get failures in installing the update for Silverlight KB2690729 security and it returns error code 663. Is this a problem with my machine or the update?

    Hi DavidRAtkinson,

    Follow the suggestions below for a possible solution:

     

    Method 1: Follow all the methods listed in the following Microsoft Knowledge Base article to resolve the problem:

    Troubleshooting Windows Update or Microsoft Update when you are repeatedly offered an update

    http://support.Microsoft.com/kb/910339

     

    Method 2: If the method above doesn't help then you can reset the Windows Update components and if the problem persists.

    How to reset the Windows Update settings?

     http://support.Microsoft.com/kb/971058

    Let us know if that helps.

  • Photosmart D110: Photosmart D110 Driver Install results in error Code 1327

    I have a fresh install of Windows 7 on a new disc of starting with the letter 'L '.

    When I try to install the Photosmart D110 driver software, the installer returns error Code 1327 and the drive not valid "C:\". ».

    The files on this site for troubleshooting 1327 error Code seems to indicate that the problem is the drive letter of the DVD drive has changed.  This is not the case, and I get the same error when you run a downloaded version of the driver (instead of the CD supplied with the printer).

    It seems to me that the installer drive letter C hard somewhere.  Correctly, it says that it will install on my 'L' disc during the pre-installation steps.

    Is it possible to get the D110 driver to install on one disk other than "C"?

    Hi bglocker,

    The installation of default HP driver C, which is an expected behavior.

    To work around this problem, follow these steps:

    1. On the road L dark a new folder and name it as HP.
    2. in the type of menu start CMD in the search, according to the results bar right-click the listed CMD / command command prompt and select run as administrator... confirm any command prompt.
    3. In the command line box, type the following command:
      Note: you can paste in the CMD by clicking with the right button on the screen and select Paste, CTRL + V does not work...

      subst c: l:\HP

    Now run the installation once more, action above created temporarily a virtual drive C on your PC once installation is complete that restart your PC and the temporary folder will no longer appear.

    Shlomi

  • JsonDataAccess 3 error code

    Hello

    DOE anyone know why the JsonDataAccess returns the error 3 code?

    2 hours ago, the app worked like a charm, and now it returns error code 3 on JsonDataAccess on all my json (witch is valid json checked on jsonlint.org)

    JsonDataAcces error message:

    "* Line 1, column 1".

    Syntax error: value, object or table provided.

    "

    Someone an idea?

    THX.

    Gr.

    I found the sollution I made a mistake.

    qDebug() < qstring(reply-=""> readAll());<== returned="" the="" json="" value="" like="">

    JsonDataAccess.loadFromBuffer (response-> readAll()); readAll() <== here="" reply-="">is empty, so it returns the error

  • Win7 32bits version - 0x8002801c error code company

    Recently upgraded from WinXP SP2 for the 32-bit version of Win7 Enterprise - new system.

    I need to record and run an Indian tax called eTDSRPU dept.program who has run ok under WinXP.

    I cannot register the program under Win7 - system returns error codes and asks me to search online for an answer. Error codes are 0x8002801c, 0 x 80040200 and 0 x 8004005

    For each .ocx or .dll error messages are in format-
    "The module xxxxxx.ocx / xxxxxxxxxxxx.dll was loaded but the call to DllRegisterServer failed with error... code. »

    Any help to run will be more useful.

    Thank you.

    http://www.caclubindia.com/Forum/ETDs-RPU-in-Windows-7-148739.asp

Maybe you are looking for

  • How can I prevent the download itself ScoriponSaver?

    After I delete in the menu program and reset Firefox, it seems to reappear one day or later. Many ads not Firefox and ad through my speakers. Very boring more it uses too much memory and other resources. Thanks for any help on how to stop this thing.

  • Windows Media pLayer 12 will not maximize windows and stay like that

    HelloI'm using windows 7 Home Edition premium and wmp12.everytime I play a video file, the shrink to match the video screen...Uncheck IV ' e the "feet video"and still can't do the stay wmp12 to maximize the window mode...»

  • Flash to blackBerry Smartphones

    How can I play flash like on my blackberry hulu.com files? dilemmamike

  • Algorithm in PL/SQL

    I have a table that contains versions of a tool installed in the format1.0.21.0.31.0.3.11.0.41.0.4.11.0.4.2I want a digital equivalent of these versions, 1.0.3.1 is a version of 1.0.3 supIts digital equivalent must follow the rule belowthat is numeri

  • Who is the directory of the connector server bundle?

    Hello experts, I'm doing a flat file connection an i got to the point where I have to copy the jar file generated from the build.xml to bundle Server Connector directory. My question is this: where can I find this specific directory in terms of path?