RT.刚看见,对不住了!

解决方案 »

  1.   

    什么意思?
    程序要有管理员权限;CreateFile打开\\.\盘符,WriteFile,CloseHandle;做得完整一点需要写之前LOCK,写完后DISMOUNT。
      

  2.   

    winhex应该可以。
    自己实现可能要用到驱动技术。
      

  3.   

    from msdn: WriteLogicalSectors   (hDev,   bDrive,   dwStartSector,   wSectors,   lpSectBuff)   
        
            Purpose:   
                  Writes   sectors   to   a   logical   drive.   Uses   Int   26h   
        
            Parameters:   
                  hDev   
                        Handle   of   VWIN32   
        
                  bDrive   
                        The   MS-DOS   logical   drive   number.   1   =   A,   2   =   B,   3   =   C,   etc.   
        
                  dwStartSector   
                        The   first   logical   sector   to   write   
        
                  wSectors   
                        The   number   of   sectors   to   write   
        
                  lpSectBuff   
                        The   caller-supplied   buffer   that   contains   the   sector   data   
        
            Return   Value:   
                  Returns   TRUE   if   successful,   or   FALSE   if   failure.   
        
            Comments:   
                  This   function   does   not   validate   its   parameters.   
            ------------------------------------------------------------------*/     
            BOOL   WriteLogicalSectors   (HANDLE   hDev,   
                                                                BYTE       bDrive,   
                                                                DWORD     dwStartSector,   
                                                                WORD       wSectors,   
                                                                LPBYTE   lpSectBuff)   
            {   
                  BOOL                       fResult;   
                  DWORD                     cb;   
                  DIOC_REGISTERS   reg   =   {0};   
                  DISKIO                   dio   =   {0};   
        
                  dio.dwStartSector   =   dwStartSector;   
                  dio.wSectors             =   wSectors;   
                  dio.dwBuffer             =   (DWORD)lpSectBuff;   
        
                  reg.reg_EAX   =   bDrive   -   1;         //   Int   26h   drive   numbers   are   0-based.   
                  reg.reg_EBX   =   (DWORD)&dio;   
                  reg.reg_ECX   =   0xFFFF;                 //   use   DISKIO   struct   
        
                  fResult   =   DeviceIoControl(hDev,   VWIN32_DIOC_DOS_INT26,   
                                                                      &reg,   sizeof(reg),   
                                                                      &reg,   sizeof(reg),   &cb,   0);   
        
                  //   Determine   if   the   DeviceIoControl   call   and   the   write   succeeded.   
                  fResult   =   fResult   &&   !(reg.reg_Flags   &   CARRY_FLAG);   
        
                  return   fResult;   
            }   
      
      

  4.   

    如果是xp系统,写U盘与与硬盘是一样的,用CreateFile打开U盘,用WriteFile可以写。
    如果是vista系统,需要写驱动,因为vista不允许直接写物理硬盘,可以直接读物理硬盘。