473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

read SD CID

Any help will be appreciated...
2 days no luck 87 error...
please anyone look on the code:
int nSizeOfCmd = sizeof (SFFDISK_DEVICE_COMMAND_DATA) + sizeof(SDCMD_DESCRIPTOR) + 6;
SFFDISK_DEVICE_COMMAND_DATA *scData = (SFFDISK_DEVICE_COMMAND_DATA*) new BYTE[nSizeOfCmd];
//SFFDISK_DEVICE_COMMAND_DATA scData = {0};
memset(scData, 0, nSizeOfCmd);
scData->HeaderSize = sizeof(SFFDISK_DEVICE_COMMAND_DATA);
scData->Command = SFFDISK_DC_DEVICE_COMMAND;
BYTE bySDCmd[6] = {0x42, 0x00,0x00,0x00,0x00,0x00};
scData->ProtocolArgumentSize = sizeof (SDCMD_DESCRIPTOR);
scData->DeviceDataBufferSize = sizeof (bySDCmd);

SDCMD_DESCRIPTOR stCmdDescriptor = { 0 };
stCmdDescriptor.Cmd = SDCMD_IO_RW_DIRECT;
stCmdDescriptor.CmdClass = SDCC_APP_CMD;
stCmdDescriptor.TransferDirection = SDTD_WRITE;
stCmdDescriptor.ResponseType = SDRT_2;
stCmdDescriptor.TransferType = SDTT_CMD_ONLY;
memcpy((BYTE *)(&(scData->Data[0])), &stCmdDescriptor,sizeof(SDCMD_DESCRIPTOR));
memcpy(&(scData->Data[0]) + sizeof (SDCMD_DESCRIPTOR), &bySDCmd,sizeof (bySDCmd));
DWORD dwReturn;
LPVOID idDisk;
if (!DeviceIoControl(hDevice, IOCTL_SFFDISK_DEVICE_COMMAND,
&scData, nSizeOfCmd,
&idDisk, nSizeOfCmd,
&dwReturn,
NULL)){
DWORD dwLastError = GetLastError();;
}
Oct 24 '08 #1
1 6423
change:
DeviceIoControl(hDevice, IOCTL_SFFDISK_DEVICE_COMMAND,
&scData, nSizeOfCmd,
&idDisk, nSizeOfCmd,
&dwReturn,
NULL))

and now we have error 5 ....

Please, help.
Oct 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Gunnar | last post by:
Hello, I've just written a CPP program that reads integers from a binary file, and used this code while (my_ifstram.read( (char* ) &number, sizeof(int)) { // do something with number } My...
11
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to...
12
by: Steven T. Hatton | last post by:
I know of a least one person who believes std::ifstream::read() and std::ofstream::write() are "mistakes". They seem to do the job I want done. What's wrong with them. This is the code I...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
4
by: Ollie Cook | last post by:
Hi, I am having some difficulty with read(2) and interrupting signals. I expect I am misunderstanding how the two work together, so would appreciate some guidance. I am trying to 'time out' a...
6
by: BBM | last post by:
I have an object that has a fairly complex construction sequence, so I have written a dedicated "factory" class that invokes the constructor of my object class (which does nothing but instantiate...
8
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
1
by: Jose Reckoner | last post by:
I'm running python 2.3 on Windows XP. Anyone have a quick small script to convert .DT1 and .DEM data to ASCII or some other format? I don't need a viewer. Thanks!
0
by: phplasma | last post by:
Hey, I am currently attempting to implement a multi-threaded C# socket, using SSL (.pem file/certification/private key combo) server using Visual Studio C# Express. I have successfully made...
6
by: arnuld | last post by:
This works fine, I welcome any views/advices/coding-practices :) /* C++ Primer - 4/e * * Exercise 8.9 * STATEMENT: * write a program to store each line from a file into a *...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.