Thank you for your help! No luck so far. I wrote a C program and got the same results as python: Win 7 Notebook (with SD card inserted directly i.e. no SD card reader) Error code: 1 Win 7 Notebook (without SD card inserted at all) Error code: 6 WinXP desktop (with USB stick but without SD card inserted at all) Error code: 50
int main(int argc, char* argv[]) { string sdrive("\\\\.\\e:"); HANDLE hcd = CreateFile(sdrive.c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL); if (hcd == INVALID_HANDLE_VALUE) printf("Could not open drive\\\n"); else printf ("%s \n", "opened drive"); DWORD d = 0; int nSizeOfCmd = sizeof(SFFDISK_QUERY_DEVICE_PROTOCOL_DATA) ; SFFDISK_QUERY_DEVICE_PROTOCOL_DATA *pCmdBuf = (SFFDISK_QUERY_DEVICE_PROTOCOL_DATA*) new BYTE[nSizeOfCmd]; memset(pCmdBuf, 0, nSizeOfCmd); BOOL bResult=DeviceIoControl(hcd, IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL, NULL, 0, pCmdBuf, nSizeOfCmd, &d, NULL); DWORD dwErr = GetLastError(); CloseHandle(hcd); if(!bResult){ printf("Failed to get ProtocolGUID, err code: %d",dwErr); } else{ printf("%s \n", pCmdBuf->ProtocolGUID); } delete [] pCmdBuf; return 0; } Thank you, Jane Jane Chen wrote: > Sorry. It's a mistake. However, I still get the same error message. > Maybe there is another mistake. :( > Is there any tool for debugging purpose? What I would do is write the code as a C program just to make sure the API does what I expect. That at least eliminates the Python layers from consideration. What SD card reader are you using? Not all of the behave nicely. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32