📄 wimadll.cs
字号:
public static extern bool GetDirInfo(IntPtr Ima, [In, Out] [MarshalAs(UnmanagedType.LPArray)] DIRINFO[] di, byte bSort);
//' 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
[DllImport("wimadll.dll", EntryPoint = "RefreshInternalBufferDirInfo", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool RefreshInternalBufferDirInfo(IntPtr Ima, byte bSort, ref int pdwNumberItem);
//Declare Function GetBufferDirInfoItem Lib "wimadll.dll" (ByVal Ima As IntPtr, ByRef diItem As DIRINFO, ByVal dwItemPos As Integer) As Boolean
[DllImport("wimadll.dll", EntryPoint = "GetBufferDirInfoItem", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool GetBufferDirInfoItem(IntPtr Ima, ref DIRINFO diItem, int dwItemPos);
//Declare Function ReSortBufferDirInfo Lib "wimadll.dll" (ByVal Ima As IntPtr, ByVal bSort As Byte) As Boolean
[DllImport("wimadll.dll", EntryPoint = "ReSortBufferDirInfo", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ReSortBufferDirInfo(IntPtr Ima, byte bSort);
// 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"'
[DllImport("wimadll.dll", EntryPoint = "Sort", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool Sort(IntPtr Ima, [In, Out] [MarshalAs(UnmanagedType.LPArray)] DIRINFO[] di, byte bSort);
// GetLabel : Get the label of Image
// lpBuf : will receive the label
//BOOL WIMAAPI GetLabel(HIMA hIma,LPSTR lpBuf);
[DllImport("wimadll.dll", EntryPoint = "GetLabel", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
//public static extern bool GetLabel(int Ima, string label);
public static extern bool GetLabel(IntPtr Ima, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpDir);
// SetLabel : Set the label of Image
// lpBuf : contain the new label
// BOOL WIMAAPI SetLabel(HIMA hIma,LPSTR lpBuf);
[DllImport("wimadll.dll", EntryPoint = "SetLabel", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool SetLabel(IntPtr Ima, string lpDir);
// 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
[DllImport("wimadll.dll", EntryPoint = "ExtractFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ExtractFile(IntPtr Ima, uint uiPosDir, string lpPath, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpFullName);
[DllImport("wimadll.dll", EntryPoint = "ExtractFileCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ExtractFileCB(IntPtr Ima, WimCB pEventNotifCallBack, IntPtr lpUsrParam, uint uiPosDir, string lpPath, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpFullName);
// CheckSpaceForFile : Check you've space for inject a file of dwSize bytes
// BOOL WIMAAPI CheckSpaceForFile(HIMA hIma,DWORD dwSize);
[DllImport("wimadll.dll", EntryPoint = "CheckSpaceForFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool CheckSpaceForFile(IntPtr Ima, int dwSize);
// 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);
[DllImport("wimadll.dll", EntryPoint = "IfInjectPossibleButNeedReplace", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool IfInjectPossibleButNeedReplace(IntPtr Ima, string lpFn, ref int lpdwSize, string lpShortName, string lpShortExt, string lpNameWhenInjected);
// RemoveDir : 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"'
[DllImport("wimadll.dll", EntryPoint = "RmDir", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool RemoveDir(IntPtr Ima, int uiPosDir);
// 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
[DllImport("wimadll.dll", EntryPoint = "DeleteFileNameExt", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool DeleteFileNameExt(IntPtr Ima, string lpNom, string lpExt, bool fRealDel);
//BOOL WIMAAPI MoveFileToDir(HIMA hIma,LPCSTR lpName,LPCSTR lpExt,LPCSTR lpszDestDir,
// LPBOOL lpfReplaceNeeded,BOOL fDoRealMove,BOOL fDoReplaceIfNeeded,
// LPDWORD lpdwErrInfo);
[DllImport("wimadll.dll", EntryPoint = "MoveFileToDir", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool MoveFileToDir(IntPtr Ima, string lpName, string lpExt, string lpszDestDir, bool lpfReplaceNeeded, bool fDoRealMove, bool fDoReplaceIfNeeded, int lpdwErrInfo);
// 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);
[DllImport("wimadll.dll", EntryPoint = "RenameFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool RenameFile(IntPtr Ima, int uiPosDir, string lpNewLongName);
// 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);
[DllImport("wimadll.dll", EntryPoint = "ChangeDateAndAttribute", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern object ChangeDateAndAttribute(IntPtr Ima, int uiPosDir, ref byte NewAttr, ref short NewDosDate, ref short NewDosTime, ref byte Newdir_CreateMSec, ref short lpwNewdir_CreateTime, ref short Newdir_CreateDate, ref short lpwNewdir_LastAccessDate);
// 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);
[DllImport("wimadll.dll", EntryPoint = "ReadData", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ReadData(IntPtr Ima, int dwPos, int dwSize, string lpBuf);
// 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);
[DllImport("wimadll.dll", EntryPoint = "WriteData", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WriteData(IntPtr Ima, int dwPos, int dwSize, string lpBuf);
//// 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);
[DllImport("wimadll.dll", EntryPoint = "GetFatImaSizeFileName", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool GetFatImaSizeFileName(string lpFn, ref int lpdwSize, ref int lpdwSizeHigh, ref bool lpfIsBigFat, ref int lpdwPosInFile);
//// GetDriveInfo : Get info about drive type
//// bDrive : number of driver (0 = 'A:', 1 = 'B:')
//// return the kind of drive
//DRIVEINFO WIMAAPI GetDriveInfo(BYTE bDrive);
[DllImport("wimadll.dll", EntryPoint = "GetDriveInfo", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern DriveInfo GetDriveInfo(byte bDrive);
//// 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"'
[DllImport("wimadll.dll", EntryPoint = "WimLargeAspiCdromInquiryFillArray", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern int WimLargeAspiCdromInquiryFillArray([In, Out] [MarshalAs(UnmanagedType.LPArray)] ASPIINQUIRYTAB[] AspiInqTab, int dwMaxNumberInArray);
//// 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);
[DllImport("wimadll.dll", EntryPoint = "WimLargeReadAspiCDImage", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeReadAspiCDImage(IntPtr hWnd, int dwHost, int dwTarget, string lpFn, ref int lpdwTotal);
//// 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);
[DllImport("wimadll.dll", EntryPoint = "WimLargeReadAspiCDImageIgnoreError", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeReadAspiCDImageIgnoreError(IntPtr hWnd, int dwHost, int dwTarget, string lpFn, ref int lpdwTotal, bool fIgnoreError);
[DllImport("wimadll.dll", EntryPoint = "WimLargeReadAspiCDImageIgnoreErrorCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeReadAspiCDImageIgnoreErrorCB(IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, int dwHost, int dwTarget, string lpFn, ref int lpdwTotal, bool fIgnoreError);
//// return value != 0 if WimLargeReadLargeIma can be used with CDRom
//// (elsewhere, only hard disk partition)
//DWORD WIMAAPI WimLargeIsReadImaIsoPossible();
[DllImport("wimadll.dll", EntryPoint = "WimLargeIsReadImaIsoPossible", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern int WimLargeIsReadImaIsoPossible();
//// 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);
[DllImport("wimadll.dll", EntryPoint = "WimLargeReadLargeIma", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeReadLargeIma(IntPtr hWnd, byte cDrive, string lpFn, ref int lpdwTotal, ChoiceApp caRead);
[DllImport("wimadll.dll", EntryPoint = "WimLargeReadLargeImaCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeReadLargeImaCB(IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, byte cDrive, string lpFn, ref int lpdwTotal, ChoiceApp caRead);
//// 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);
[DllImport("wimadll.dll", EntryPoint = "WimLargeWriteLargeIma", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeWriteLargeIma(IntPtr Ima, IntPtr hWnd, byte cDrive, ref int lpdwTotal, ChoiceApp caWrite, bool fCheckDiskBeforeWriteThis);
[DllImport("wimadll.dll", EntryPoint = "WimLargeWriteLargeImaCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeWriteLargeImaCB(IntPtr Ima, IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, byte cDrive, ref int lpdwTotal, ChoiceApp caWrite, bool fCheckDiskBeforeWriteThis);
//// say if a letter if a CDRom
//BOOL WIMAAPI WimLargeIsIsoCDDrive(char cDrive);
[DllImport("wimadll.dll", EntryPoint = "WimLargeIsIsoCDDrive", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WimLargeIsIsoCDDrive(char cDrive);
//// Write the boot sector of an image
//BOOL WIMAAPI WriteSectBoot(HIMA hIma,const BYTE* lpBuf,DWORD dwSizeBuf);
[DllImport("wimadll.dll", EntryPoint = "WriteSectBoot", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WriteSectBoot(IntPtr Ima, string lpBuf, int dwSizeBuf);
//// Read the boot sector of an image
//BOOL WIMAAPI GetSectBoot(HIMA hIma,LPBYTE lpBuf,DWORD dwSizeBuf,LPDWORD lpdwSizeBoot);
[DllImport("wimadll.dll", EntryPoint = "GetSectBoot", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool GetSectBoot(IntPtr Ima, string lpBuf, int dwSizeBuf, ref int lpdwSizeBoot);
// // Get the total size of an image
// BOOL WIMAAPI GetImageSize(HIMA hIma,LPDWORD lpdwLow,LPDWORD lpdwHigh)
[DllImport("wimadll.dll", EntryPoint = "GetImageSize", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool GetImageSize(IntPtr Ima, ref int lpdwLow, ref int lpdwHigh);
// // Get the free space in an image
// BOOL WIMAAPI GetFreeSpaceInImage(HIMA hIma,LPDWORD lpdwLow,LPDWORD lpdwHigh)
[DllImport("wimadll.dll", EntryPoint = "GetFreeSpaceInImage", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool GetFreeSpaceInImage(IntPtr Ima, ref int lpdwLow, ref int lpdwHigh);
//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
[DllImport("wimadll.dll", EntryPoint = "MakePartitionList", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern int MakePartitionList(string lpFn, string lpszPassword, ref int lpdwNbPartFound, ref int dwNbFat32Found, int dwArraySize,ref PARTDESCArray pdarr);
// public static extern bool MakePartitionList(string lpFn, string lpszPassword, ref int lpdwNbPartFound, ref int dwNbFat32Found, int dwArraySize, int fooav);
//public static extern bool MakePartitionList(string lpFn, string lpszPassword, ref int lpdwNbPartFound, ref int dwNbFat32Found, int dwArraySize, int fooav);
//public static extern bool MakePartitionList(int a, int b, int c, int d, int e, int f);
#endregion
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -