Не могу понять где затаилась ошибка?... Проблема в том что ReadFile возвращает 0, а GetLastError() (0x57 : неверный параметр) ОС ХР х64 Код (Text): #define MAX_BOOT_CODE_SIZE 0x000001BE HANDLE OpenHDD( IN DWORD nDisk ) { WCHAR szDiskName[32]; swprintf( szDiskName, L"\\\\.\\PhysicalDrive%x", nDisk ); return CreateFileW(szDiskName /*szDiskName*/, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,// /*FILE_FLAG_WRITE_THROUGH|*/FILE_FLAG_NO_BUFFERING, NULL ); }; void main(){ CHAR lpFile[MAX_PATH]; BYTE BootCode[MAX_BOOT_CODE_SIZE]= {0x90}; DWORD NumDrive,s=0; printf("Enter number PhysicalDrive: "); scanf("%d",&NumDrive); printf("Enter file name to save: "); scanf("%255s",lpFile); HANDLE hDrive =OpenHDD(NumDrive); if (hDrive == INVALID_HANDLE_VALUE){ PrintError(); printf("Error open hdd\n"); break; }; s = sizeof(BootCode); if(!ReadFile(hDrive,&BootCode[0],s,&s,NULL)) PrintError(); CloseHandle(hDrive); if (!s) break; HANDLE hFile = CreateFile(lpFile,GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0); if (hFile == INVALID_HANDLE_VALUE){ PrintError(); printf("Error create \"%s\"\n",lpFile); break; }; WriteFile(hFile,BootCode,sizeof(BootCode),&s,NULL); CloseHandle(hFile); };