⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wimadll.vb

📁 对ima、imz压缩文件修改
💻 VB
📖 第 1 页 / 共 3 页
字号:
    ' ExtractFile : Extract one file
    '  unPosDir :  The uiPosInDir fields in DIRINFO structure that describe
    '                  the file
    '  lpPath :    Path where extract the file
    '  lpFullName: will receive the exact full name of created file. Can be NULL
    'BOOL WIMAAPI ExtractFile(HIMA hIma,UINT uiPosDir,LPSTR lpPath,LPSTR lpFullName);
    ' for the CB version, the only event is DWEV_PROGRESSPERCENT
    Declare Function ExtractFile Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal uiPosDir As Integer, ByVal lpPath As String, ByVal lpFullName As String) As Boolean
    Declare Function ExtractFileCB Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal uiPosDir As Integer, ByVal lpPath As String, ByVal lpFullName As String) As Boolean
    Declare Function ExtractFileVirtual Lib "wimadll.dll" (ByVal Ima As IntPtr, _
        ByVal pFileIoCallBack As WimWrCB, ByVal dwMaxVirtualBufSize As Integer, ByVal lpParamUsrExtractOut As IntPtr, _
        ByVal uiPosDir As Integer, ByVal lpPath As String, ByVal lpFullName As String) As Boolean

    Declare Function ExtractFileVirtualCB Lib "wimadll.dll" (ByVal Ima As IntPtr, _
        ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, _
        ByVal pFileIoCallBack As WimWrCB, ByVal dwMaxVirtualBufSize As Integer, ByVal lpParamUsrExtractOut As IntPtr, _
        ByVal uiPosDir As Integer, ByVal lpPath As String, ByVal lpFullName As String) As Boolean


    ' CheckSpaceForFile : Check you've space for inject a file of dwSize bytes
    ' BOOL WIMAAPI CheckSpaceForFile(HIMA hIma,DWORD dwSize);
    Declare Function CheckSpaceForFile Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal dwSize As Integer) As Boolean

    ' to know if an inject is possible but need replace
    '  lpFn : contain the name of file to be injected
    '  lpDwSize : will receive the size of old file with same name. Can be NULL
    '  lpNameWhenInjected : if not NULL, contain a new name in the image
    '  lpShortName : will receive the short (8) name of file in image. Can be NULL
    '  lpShortExt  : will receive the short (3) ext of file in image. Can be NULL
    '      (if the file must have another name when injected)
    'BOOL WIMAAPI IfInjectPossibleButNeedReplace(HIMA hIma,LPSTR lpFn,
    '         LPDWORD lpDwSize,LPSTR lpShortName,
    '         LPSTR lpShortExt,LPSTR lpNameWhenInjected);
    Declare Function IfInjectPossibleButNeedReplace Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpFn As String, ByRef lpdwSize As Integer, ByVal lpShortName As String, ByVal lpShortExt As String, ByVal lpNameWhenInjected As String) As Boolean

    ' RmDir : Remove a directory
    '  unPosDir :  The uiPosInDir fields in DIRINFO structure that describe
    '                  the file
    'BOOL WIMAAPI RmDir(HIMA hIma,UINT uiPosDir);
    'UPGRADE_NOTE: RmDir was upgraded to RmDir_Renamed. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1061"'
    Declare Function RmDir_Renamed Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal uiPosDir As Integer) As Boolean

    ' DeleteFileNameExt
    ' Delete a file in the image
    ' BOOL WIMAAPI DeleteFileNameExt(HIMA hIma,LPSTR lpNom,LPSTR lpExt,BOOL fRealDel);
    '     for filling lpNom and lpExt, use data obtained from GetDirInfo
    '   lpNom : pointer to array of 8 chars (name of 8.3 name, use DIRINFO.nom)
    '   lpExt : pointer to array of 3 chars (ext  of 8.3 name, use DIRINFO.ext)
    '   fRealDel : TRUE to really delete, FALSE to only test if delete is possible

    Declare Function DeleteFileNameExt Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpNom As String, ByVal lpExt As String, ByVal fRealDel As Boolean) As Boolean


    Public Const ERRINFO_MOVEFILE_DESTINATIONEQUALSOURCE As Integer = &H80000001
    Public Const ERRINFO_MOVEFILE_DESTINATIONSUBFOLERDEPL As Integer = &H80000002

    'BOOL WIMAAPI MoveFileToDir(HIMA hIma,LPCSTR lpName,LPCSTR lpExt,LPCSTR lpszDestDir,
    '                           LPBOOL lpfReplaceNeeded,BOOL fDoRealMove,BOOL fDoReplaceIfNeeded,
    '                           LPDWORD lpdwErrInfo);
    Declare Function MoveFileToDir Lib "wimadll.dll" (ByVal Ima As IntPtr, _
                                    ByVal lpName As String, ByVal lpExt As String, _
                                    ByVal lpszDestDir As String, ByVal lpfReplaceNeeded As Boolean, _
                                    ByVal fDoRealMove As Boolean, ByVal fDoReplaceIfNeeded As Boolean, _
    ByVal lpdwErrInfo As Integer) As Boolean

    ' RenameFile :    Rename one file
    '  uiPosDir :     The uiPosInDir fields in DIRINFO structure that describe
    '                  the file
    '  lpNewLongName: The new name of the file
    ' BOOL RenameFile(HIMA hIma,UINT uiPosDir,LPCSTR lpNewLongName);
    Declare Function RenameFile Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal uiPosDir As Integer, ByVal lpNewLongName As String) As Boolean

    ' ChangeDateAndAttribute :    Change the date and attribute of a File
    '  uiPosDir :     The uiPosInDir fields in DIRINFO structure that describe
    '                  the file
    '  *lpbNewAttr:   Contain the new attribute of the file (or NULL to no change)
    '  *lpNewDosDate,
    '  *lpNewDosTime: Contain the Modified Date and Time (or NULL to no change)
    '  *lpbNewdir_CreateMSec,*lpwNewdir_CreateTime,*lpwNewdir_CreateDate
    '                 Contain the Created Date and Time (or NULL to no change)
    '  *lpwNewdir_LastAccessDate : Contain the Last Access Date (or NULL...)
    ' BOOL ChangeDateAndAttribute(HIMA hIma,UINT uiPosDir,LPBYTE lpbNewAttr,
    '                                     LPWORD lpNewDosDate,LPWORD lpNewDosTime,
    '                                     LPBYTE lpbNewdir_CreateMSec,
    '                                     LPWORD lpwNewdir_CreateTime,LPWORD lpwNewdir_CreateDate,
    '                                     LPWORD lpwNewdir_LastAccessDate);
    Declare Function ChangeDateAndAttribute Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal uiPosDir As Integer, ByRef NewAttr As Byte, ByRef NewDosDate As Short, ByRef NewDosTime As Short, ByRef Newdir_CreateMSec As Byte, ByRef lpwNewdir_CreateTime As Short, ByRef Newdir_CreateDate As Short, ByRef lpwNewdir_LastAccessDate As Short) As Object

    ' ReadData : Direct read data in image.
    '  dwPos :  begin position
    '  dwSize : number of byte to copy (size of buffer)
    '  lpBuf :  buffer that will receive data
    'BOOL WIMAAPI ReadData(HIMA hIma,DWORD dwPos,DWORD dwSize,LPSTR lpBuf);
    Declare Function ReadData Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal dwPos As Integer, ByVal dwSize As Integer, ByVal lpBuf As String) As Boolean

    ' WriteData : Direct write data in image. Be carreful, WI don't refresh dir!
    '  dwPos :  begin position
    '  dwSize : number of byte to copy (size of buffer)
    '  lpBuf :  buffer that contain data
    'BOOL WIMAAPI WriteData(HIMA hIma,DWORD dwPos,DWORD dwSize,LPSTR lpBuf);
    Declare Function WriteData Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal dwPos As Integer, ByVal dwSize As Integer, ByVal lpBuf As String) As Boolean


    ' To be added : DRIVEINFO, GetFatImaSizeFileName, GetDriveInfo


    '//
    '// GetFatImaSizeFileName : Get information about UNCOMPRESSED Fat image
    '//   lpfn :          FileName
    '//   lpdwSize :      Will receive the size of the image, 32 bits low part of 64 bit data
    '//   lpdwSize!high : Will receive the size of the image, 32 bits high part of 64 bit data
    '//   lpfIsBigFat :   Boolean pointer, will receive TRUE if this is a large image (>2.88MB), not floppy image
    '//   lpdwPosInFile : Will receive the position of the image
    'BOOL WIMAAPI GetFatImaSizeFileName(LPCSTR lpFn,LPDWORD lpdwSize,LPDWORD lpdwSizeHigh,LPBOOL lpfIsBigFat,LPDWORD lpdwPosInFile);
    Declare Function GetFatImaSizeFileName Lib "wimadll.dll" (ByVal lpFn As String, ByRef lpdwSize As Integer, ByRef lpdwSizeHigh As Integer, ByRef lpfIsBigFat As Boolean, ByRef lpdwPosInFile As Integer) As Boolean


    '// GetDriveInfo : Get info about drive type
    '//  bDrive : number of driver (0 = 'A:', 1 = 'B:')
    '//  return the kind of drive
    'DriveInfo return:
    '      NO_FLOPPY=0,
    '      FLOPPY_360=1,
    '      FLOPPY_12M=2,
    '      FLOPPY_720=3,
    '      FLOPPY_144=4,
    '      FLOPPY_288=5,
    '      LDISK_REMOVABLE=6,
    '      LDISK_HARDDISK=7,
    '      LDISK_CDROM=8,
    '      FLOPPY_LS120=9
    'DRIVEINFO WIMAAPI GetDriveInfo(BYTE bDrive);
    Declare Function GetDriveInfo Lib "wimadll.dll" (ByVal bDrive As Byte) As Integer


    '// Fill the ASPI Inquiry array.
    '// if lpAspiCdRomInquityTab is NULL AND dwMaxNumberInArray==0, just return the number of ASPI CDrom Unit.
    '//  lpAspiCdRomInquityTab : Will receive the Array of SCSI Unit
    '//  dwMaxNumberInArray : size of array (in number of ASPIINQUIRYTAB)
    'DWORD WIMAAPI WimLargeAspiCdromInquiryFillArray(ASPIINQUIRYTAB* lpAspiCdRomInquityTab,DWORD dwMaxNumberInArray);
    'UPGRADE_WARNING: Structure ASPIINQUIRYTAB may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1050"'
    Declare Function WimLargeAspiCdromInquiryFillArray Lib "wimadll.dll" (ByRef AspiInqTab As ASPIINQUIRYTAB, ByVal dwMaxNumberInArray As Integer) As Integer

    '// Create a CDRom Image fro ASPI Unit, using dwHost and dwTargetID from AspiCdromInquiy
    '//   lpFn : Filename to create
    '//   lpdwTotal : will receive the filesize
    '// Note : I suggest using WimLargeReadAspiCDImageIgnoreError with fIgnoreError at FALSE
    'BOOL WIMAAPI WimLargeReadAspiCDImage(HWND hWnd,DWORD dwHost,DWORD dwTargetID,LPSTR lpFn,LPDWORD lpdwTotal);
    Declare Function WimLargeReadAspiCDImage Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal dwHost As Integer, ByVal dwTarget As Integer, ByVal lpFn As String, ByRef lpdwTotal As Integer) As Boolean


    '// Like WimLargeReadAspiCDImage
    '// fIgnoreError :
    '//    FALSE : if there is error ignore it only if the error is after ISO9660 size (suggested)
    '//    TRUE : Ignore all ISO 9660 error
    'BOOL WIMAAPI WimLargeReadAspiCDImageIgnoreError(HWND hWnd,DWORD dwHost,DWORD dwTargetID,LPSTR lpFn,LPDWORD lpdwTotal,BOOL fIgnoreError);
    Declare Function WimLargeReadAspiCDImageIgnoreError Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal dwHost As Integer, ByVal dwTarget As Integer, ByVal lpFn As String, ByRef lpdwTotal As Integer, ByVal fIgnoreError As Boolean) As Boolean

    Declare Function WimLargeReadAspiCDImageIgnoreErrorCB Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal dwHost As Integer, ByVal dwTarget As Integer, ByVal lpFn As String, ByRef lpdwTotal As Integer, ByVal fIgnoreError As Boolean) As Boolean




    '// return value != 0 if WimLargeReadLargeIma can be used with CDRom
    '// (elsewhere, only hard disk partition)
    'DWORD WIMAAPI WimLargeIsReadImaIsoPossible();
    Declare Function WimLargeIsReadImaIsoPossible Lib "wimadll.dll" () As Integer

    '// Read Disk partition to image
    '//  cDrive : disk letter ('C' for disk C:...)
    '//  lpdwTotal : will receive number of byte processed
    '//  caRead : USED, or ALL (ALL if you want read unused part of disk)
    'BOOL WIMAAPI WimLargeReadLargeIma(HWND hWnd,char cDrive,LPSTR lpFn,LPDWORD lpdwTotal,CHOICEAPP caRead);
    Declare Function WimLargeReadLargeIma Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal cDrive As Byte, ByVal lpFn As String, ByRef lpdwTotal As Integer, ByVal caRead As Integer) As Boolean

    Declare Function WimLargeReadLargeImaCB Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal cDrive As Byte, ByVal lpFn As String, ByRef lpdwTotal As Integer, ByVal caRead As Integer) As Boolean
    '// Write Disk partition from image
    '//  cDrive : disk letter ('C' for disk C:...)
    '//  lpdwTotal : will receive number of byte processed
    '//  caWrite : USED or ALL
    '//  fCheckDiskBeforeWrite : if you want check disk is empty
    'BOOL WIMAAPI WimLargeWriteLargeIma(HIMA hIma,HWND hWnd,char cDrive,LPDWORD lpdwTotal,
    '                                   CHOICEAPP caWrite,BOOL fCheckDiskBeforeWriteThis);
    Declare Function WimLargeWriteLargeIma Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal cDrive As Byte, ByRef lpdwTotal As Integer, ByVal caWrite As Integer, ByVal fCheckDiskBeforeWriteThis As Boolean) As Boolean

    Declare Function WimLargeWriteLargeImaCB Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal cDrive As Byte, ByRef lpdwTotal As Integer, ByVal caWrite As Integer, ByVal fCheckDiskBeforeWriteThis As Boolean) As Boolean


    '// say if a letter if a CDRom
    'BOOL WIMAAPI WimLargeIsIsoCDDrive(char cDrive);
    Declare Function WimLargeIsIsoCDDrive Lib "wimadll.dll" (ByVal cDrive As Byte) As Boolean

    '// Write the boot sector of an image
    'BOOL WIMAAPI WriteSectBoot(HIMA hIma,const BYTE* lpBuf,DWORD dwSizeBuf);
    Declare Function WriteSectBoot Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpBuf As String, ByVal dwSizeBuf As Integer) As Boolean

    '// Read the boot sector of an image
    'BOOL WIMAAPI GetSectBoot(HIMA hIma,LPBYTE lpBuf,DWORD dwSizeBuf,LPDWORD lpdwSizeBoot);
    Declare Function GetSectBoot Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpBuf As String, ByVal dwSizeBuf As Integer, ByRef lpdwSizeBoot As Integer) As Boolean



    ' // Get the total size of an image
    ' BOOL WIMAAPI GetImageSize(HIMA hIma,LPDWORD lpdwLow,LPDWORD lpdwHigh)
    Declare Function GetImageSize Lib "wimadll.dll" (ByVal Ima As IntPtr, ByRef lpdwLow As Integer, ByRef lpdwHigh As Integer) As Boolean

    ' // Get the free space in an image
    ' BOOL WIMAAPI GetFreeSpaceInImage(HIMA hIma,LPDWORD lpdwLow,LPDWORD lpdwHigh)
    Declare Function GetFreeSpaceInImage Lib "wimadll.dll" (ByVal Ima As IntPtr, ByRef lpdwLow As Integer, ByRef lpdwHigh As Integer) As Boolean


    Declare Function MakePartitionList Lib "wimadll.dll" (ByVal lpFn As String, ByVal lpszPassword As String, ByRef dwNbPartFound As Integer, ByRef dwNbFat32Found As Integer, ByVal dwArraySize As Integer, ByRef PartList As PARTDESCArray) As Integer



    ' value for PhysFormat
    Public Const PHYSICALDISKIMAGEFORMAT_UNKNOWN As Integer = 0
    Public Const PHYSICALDISKIMAGEFORMAT_FIXED As Integer = 1
    Public Const PHYSICALDISKIMAGEFORMAT_VHDFIXED As Integer = 2
    Public Const PHYSICALDISKIMAGEFORMAT_VHDDYNAMIC As Integer = 3

    ' Create image of a physical disk
    'BOOL WIMAAPI CreatePhysicalDiskImage(HWND hWnd,DWORD dwDisk,LPCSTR lpFn,PHYSICALDISKIMAGEFORMAT PhysFormat);
    'BOOL WIMAAPI RestorePhysicalDiskImage(HWND hWnd,DWORD dwDisk,LPCSTR szFile);
    Declare Function CreatePhysicalDiskImage Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal dwDisk As Integer, _
                                     ByVal lpFn As String, ByVal PhysFormat As Integer) As Boolean
    Declare Function RestorePhysicalDiskImage Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal dwDisk As Integer, _
                                     ByVal lpFn As String) As Boolean

    'DWORD WIMAAPI GetNumberPhysicalDisk();

    'BOOL WIMAAPI GetPhysicalDiskSizeAndInfo(DWORD dwDisk,LPDWORD lpdwSizeLow,LPDWORD lpdwSizeHigh,
    '                                LPBOOL lpfRemovable,
    '                               LPTSTR lpszUnitName,DWORD dwUnitNameSize);

    Declare Function GetNumberPhysicalDisk Lib "wimadll.dll" (ByVal lpFn As String) As Integer
    Declare Function GetPhysicalDiskSizeAndInfo Lib "wimadll.dll" (ByVal dwDisk As Integer, _
                                   ByRef lpdwSizeLow As Integer, ByRef lpdwSizeHigh As Integer, _
                                   ByRef fRemovable As Boolean, _
                                   ByVal lpszUnitName As String, ByVal dwUnitNameSize As Integer _
                                ) As Integer
End Module

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -