📄 wimadll.vb
字号:
'// error in writing image file in WimLargeReadAspiCDImage*
'// dwWin32Err : Win32 error number, like GetLastError()
'
'
Public Const DWEV_ERRORIOCTL As Integer = &H7FFF000D
'#define DWEV_ERRORIOCTL ((DWORD)0x7fff000d)
'// IOCTL error when reading Disk partition under Win9x
'// dwEventParam is Int25/26 error value
'// return value : IDCANCEL or IDRETRY
'
Public Const DWEV_ROOTREADDONE As Integer = &H7FFF000E
'// when reading FAT image, say when the root is read
'// return value is not used
Public Const ON_FORMAT As Short = 0
Public Const ON_READ As Short = 1
Public Const ON_WRITE As Short = 2
Public Const ON_COMPARE As Short = 3
'typedef struct
'{
' DWORD dwSizeStruct;
' LOCATEERROR LocErr;
' DWORD dwHead;
' DWORD dwTrack;
' DWORD dwPosLow;
' DWORD dwPosHigh;
' DWORD dwStyleAnswer;
' DWORD dwErrNumber;
' LPCTSTR lpszErrorText;
'} ERROR_SUPINFO;
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1)> _
Public Structure ERROR_SUPINFO
Public dwSizeStruct As Integer
Public LocErr As Integer
Public dwHead As Integer
Public dwTrack As Integer
Public dwPosLow As Integer
Public dwPosHigh As Integer
Public dwStyleAnswer As Integer
Public dwErrNumber As Integer
Public lpszErrorTest As String
End Structure
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Delegate Function WimWrCB(ByRef Buf As byteArrayBuf, _
ByVal dwDataSize As Integer, _
ByVal dwUserValue As IntPtr) As Boolean
' CreateMemFatHima : Create an Image Object.
' you need call ReadImaFile, ReadFloppy or MakeEmptyImage
Declare Function CreateMemFatHima Lib "wimadll.dll" () As IntPtr
' CreateMemHfsHima : Create an Image Object for Mac floppy.
' you need call ReadImaFile, ReadFloppy
' extract, inject... cannot be used
Declare Function CreateMemHfsHima Lib "wimadll.dll" () As IntPtr
' CreateCDIsoIma : Create an Image Object by loading CDRom ISO image
' lpFn : Filename of .ISO file
' inject,...cannot be used
Declare Function CreateCDIsoIma Lib "wimadll.dll" (ByVal lpFn As String) As IntPtr
' OpenFatLargeFile : Open a large disk image (hard disk image)
' hWnd : parent window for progress window
' lpFn : FileName
' dwPosFileBegin : position in file (usualy 0)
' dwPosFileBegin : position in file, high (usualy 0), for file > 4GB
' fReadOnlyAsked : if the file must be opened in read-only mode
'HIMA WIMAAPI OpenFatLargeFile(HWND hWnd,LPCSTR lpFn,DWORD dwPosInFile,DWORD dwPosInFileHigh,BOOL fReadOnlyAsked);
'HIMA WIMAAPI OpenFatLargeFileCB(HWND hWnd,EVENTNOTIFCALLBACK pEventNotifCallBack,LPVOID lpUsrParam,
' LPCSTR lpFn,DWORD dwPosInFile,DWORD dwPosInFileHigh,BOOL fReadOnlyAsked);
Declare Function OpenFatLargeFile Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal lpFn As String, ByVal dwPosInFile As Integer, ByVal dwPosInFileHigh As Integer, ByVal fReadOnlyAsked As Boolean) As IntPtr
Declare Function OpenFatLargeFileCB Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal lpFn As String, ByVal dwPosInFile As Integer, ByVal dwPosInFileHigh As Integer, ByVal fReadOnlyAsked As Boolean) As IntPtr
Declare Function OpenLargeImageFile Lib "wimadll.dll" (ByVal hWnd As IntPtr, ByVal lpFn As String, ByVal dwPosInFile As Integer, ByVal dwPosInFileHigh As Integer, ByVal fReadOnlyAsked As Boolean) As IntPtr
' DeleteIma : Delete an Image Object.
Declare Sub DeleteIma Lib "wimadll.dll" (ByVal Ima As IntPtr)
' ReadImaFile: Read an image file (.IMA or .IMZ)
' hWnd : parent window for progress window
' lpFn : FileName
' lpfCompr : pointer to Boolean (will receive TRUE if file is compressed)
' dwPosFileBegin : position in file (usualy 0, except in WLZ)
Declare Function ReadImaFile Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal lpFn As String, ByRef lpfCompr As Boolean, ByVal dwPosFileBegin As Integer) As Boolean
Declare Function ReadImaFileEx Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal lpFn As String, ByRef lpfCompr As Boolean, ByVal dwPosFileBegin As Integer, ByVal lpszPassword As String) As Boolean
Declare Function ReadImaFileExCB Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal lpFn As String, ByRef lpfCompr As Boolean, ByVal dwPosFileBegin As Integer, ByVal lpszPassword As String) As Boolean
' WriteImaFile : WriteCompressed image
' hWnd : parent window for progress window
' lpFn : FileName
' fTruncate : TRUE if you want truncate unused part of image
' fCompress : TRUE if you want compress
' iLevelCompress : used is fCompress is TRUE, level of compress (1 to 9)
' dwPosBeginWrite : position in file (usualy 0)
' lpNameInCompr : alternate name in compressed file (can be NULL)
Declare Function WriteImaFile Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal lpFn As String, ByVal fTruncate As Boolean, ByVal fCompr As Boolean, ByVal iLevelCompress As Integer, ByVal dwPosBeginWrite As Integer, ByVal lpNameInCompr As String) As Boolean
Declare Function WriteImaFileEx Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal lpFn As String, ByVal fTruncate As Boolean, ByVal fCompr As Boolean, ByVal iLevelCompress As Integer, ByVal dwPosBeginWrite As Integer, ByVal lpNameInCompr As String, ByVal lpszPassword As String) As Boolean
Declare Function WriteImaFileExCB Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal lpFn As String, ByVal fTruncate As Boolean, ByVal fCompr As Boolean, ByVal iLevelCompress As Integer, ByVal dwPosBeginWrite As Integer, ByVal lpNameInCompr As String, ByVal lpszPassword As String) As Boolean
' ReadFloppy : Read a floppy
' hWnd : parent window for progress window
' bFloppy : Floppy to read (0 for A:)
' caRead : USED, or ALL (ALL if you want read unused part of floppy)
' BOOL WIMAAPI ReadFloppy(HIMA hIma,HWND hWnd,BYTE bFloppy,CHOICEAPP caRead);
Declare Function ReadFloppy Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal bFloppy As Byte, ByVal caRead As Integer) As Boolean
Declare Function ReadFloppyCB Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal bFloppy As Byte, ByVal caRead As Integer) As Boolean
' WriteFloppy : Write a floppy
' hWnd : parent window for progress window
' bFloppy : Floppy to write (0 for A:)
' caFormat : NOTHING or ALL (ALL for format)
' caWrite : USED or ALL
' caCompare : NOTHING, USED or ALL
' fCheckDiskBeforeWrite : if you want check disk is empty
'BOOL WIMAAPI WriteFloppy(HIMA hIma,HWND hWnd,BYTE bFloppy,CHOICEAPP caFormat,
' CHOICEAPP caWrite,CHOICEAPP caCompare,
' BYTE fCheckDiskBeforeWrite);alias
Declare Function WriteFloppy Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal bFloppy As Byte, ByVal caFormat As Integer, ByVal caWrite As Integer, ByVal caCompare As Integer, ByVal fCheckDiskBeforeWrite As Byte) As Boolean
Declare Function WriteFloppyCB Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal hWnd As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal bFloppy As Byte, ByVal caFormat As Integer, ByVal caWrite As Integer, ByVal caCompare As Integer, ByVal fCheckDiskBeforeWrite As Byte) As Boolean
' Create a directory in the image
' lpDir : Directory name
' BOOL WIMAAPI MkDir(HIMA hIma,LPSTR lpDir);
'UPGRADE_NOTE: MkDir was upgraded to MkDir_Renamed. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1061"'
Declare Function MkDir_Renamed Lib "wimadll.dll" Alias "MkDir" (ByVal Ima As IntPtr, ByVal lpDir As String) As Boolean
' Change current directory by name
' lpDir : Directory name
' BOOL WIMAAPI ChszDir(HIMA hIma,LPSTR lpDir);
Declare Function ChszDir Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpDir As String) As Boolean
' Change current directory by mode
' bMode : CDM_ROOT or CDM_UPPER (equiv. to cd \ and cd ..)
' BOOL WIMAAPI ChDir(HIMA hIma,BYTE bMode);
'UPGRADE_NOTE: ChDir was upgraded to ChDir_Renamed. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1061"'
Declare Function ChDir_Renamed Lib "wimadll.dll" Alias "ChDir" (ByVal Ima As IntPtr, ByVal bMode As Byte) As Boolean
Declare Function ChDirPos Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal bMode As Byte, ByVal dwPosDir As Integer) As Boolean
' InjectFile : Inject a file in floppy
' lpFn : file to inject
' lpDwSize : Pointer to DWORD that will receive the size. Can be NULL.
' lpTooBig : Pointer to BOOL, become TRUE if file too big to be injected
' (if InjectFile return FALSE). Can be NULL.
' lpNameWhenInjected : if not NULL, contain a new name in the image
' (if the file must have another name when injected). Can be NULL.
' for the CB version, the only event is DWEV_PROGRESSPERCENT
'BOOL WIMAAPI InjectFile(HIMA hIma,LPSTR lpFn,
' LPDWORD lpDwSize,LPBOOL lpTooBig,
' LPSTR lpNameWhenInjected);
Declare Function InjectFile Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpFn As String, ByRef lpdwSize As Integer, ByRef lpTooBig As Boolean, ByVal lpNameWhenInjected As String) As Boolean
Declare Function InjectFileCB Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, ByVal lpFn As String, ByRef lpdwSize As Integer, ByRef lpTooBig As Boolean, ByVal lpNameWhenInjected As String) As Boolean
' MakeEmptyImage : make an empty image
' iNotypeDisk : 4=720K,6=1440K,7=2880K,8=DMF2048,9=DMF1024,10=1680K
' 0=160K,1=180K,2=320K,3=360K,5=1200K (old, no ! :-))
'BOOL WIMAAPI MakeEmptyImage(HIMA hIma,int iNoTypeDisk);
Declare Function MakeEmptyImage Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal iNoTypeDisk As Integer) As Boolean
Declare Function MakeEmptyImageEx Lib "wimadll.dll" (ByVal Ima As IntPtr, _
ByVal lpszBootSectorGeom As String, ByVal lpszBootSectorCode As String) As Boolean
Declare Function BuildImaNewFormat Lib "wimadll.dll" (ByVal hOldIma As IntPtr, ByVal fNewTypeDisk As Boolean, ByVal iNoTypeDisk As Integer) As Integer
Declare Function BuildImaNewFormatEx Lib "wimadll.dll" (ByVal hOldIma As IntPtr, ByVal hNewIma As IntPtr, _
ByVal lpszBootSectForGeometry As String, ByVal fDiscardOldIma As Boolean) As Boolean
Declare Function BuildImaNewFormatExCB Lib "wimadll.dll" (ByVal hOldIma As IntPtr, ByVal hNewIma As IntPtr, _
ByVal pEventNotifCallBack As WimCB, ByVal lpUsrParam As IntPtr, _
ByVal lpszBootSectForGeometry As String, ByVal fDiscardOldIma As Boolean) As Boolean
' InitWimaSdk : Init the DLL and use hinstdll for resource
'#define DEBENUSTD "ENU"
' #define BASEENUSTD (10000)
Const DEBENUSTD As String = "ENU"
Const BASEENUSTD As Short = (10000)
' BOOL WIMAAPI InitWimaSdk(HINSTANCE hinstdll,LPSTR lpDeb,WORD wBase);
Declare Function InitWimaSdk Lib "wimadll.dll" (ByVal hinstdll As Integer, ByVal lpDeb As String, ByVal wBase As Short) As Boolean
' GetCurDir : Get the name of current directory
' lpBuf : buffer that will receive the name
' uiMaxSize : the size of buffer
' BOOL WIMAAPI GetCurDir(HIMA hIma,LPSTR lpBuf,UINT uiMaxSize);
Declare Function GetCurDir Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpBuf As String, ByVal uiMaxSize As Integer) As Boolean
' GetNbEntryCurDir : Get the number of entry of cur directory
' DWORD WIMAAPI GetNbEntryCurDir(HIMA hIma);
Declare Function GetNbEntryCurDir Lib "wimadll.dll" (ByVal Ima As IntPtr) As Integer
' GetDirInfo : Get info about the entry of cur directory
' LPDIRINFO : array of DIRINFO that will receive the info
' (use GetNbEntryCurDir for know the size needed)
' bSort : specify how the file must be sort
' (SORT_NONE, SORT_NAME, SORT_EXT, SORT_SIZE or SORT_DATE)
' BOOL WIMAAPI GetDirInfo(HIMA hIma,LPDIRINFO lpdi,BYTE bSort);
'' GetDirInfo and Sort MUST BE CHECKED IN BASIC!!!
'UPGRADE_WARNING: Structure DIRINFO 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 GetDirInfo Lib "wimadll.dll" (ByVal Ima As IntPtr, ByRef di As DIRINFO, ByVal bSort As Byte) As Boolean
' Sort : Resort the array obtained by GetDirInfo
'BOOL WIMAAPI Sort(HIMA hIma,LPDIRINFO lpdi,BYTE bSort);
'UPGRADE_WARNING: Structure DIRINFO 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 Sort Lib "wimadll.dll" (ByVal Ima As IntPtr, ByRef di As DIRINFO, ByVal bSort As Byte) As Boolean
' use these three function to get one item by function call
Declare Function RefreshInternalBufferDirInfo Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal bSort As Byte, ByRef dwNumberItem As Integer) As Boolean
Declare Function GetBufferDirInfoItem Lib "wimadll.dll" (ByVal Ima As IntPtr, ByRef diItem As DIRINFO, ByVal dwItemPos As Integer) As Boolean
Declare Function ReSortBufferDirInfo Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal bSort As Byte) As Boolean
' GetLabel : Get the label of Image
' lpBuf : will receive the label
'BOOL WIMAAPI GetLabel(HIMA hIma,LPSTR lpBuf);
Declare Function GetLabel Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpDir As String) As Boolean
' SetLabel : Set the label of Image
' lpBuf : contain the new label
' BOOL WIMAAPI SetLabel(HIMA hIma,LPSTR lpBuf);
Declare Function SetLabel Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal lpDir As String) As Boolean
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -