📄 wimadll.cs
字号:
public PARTITION partition;
public int dwPos ;
public int dwPosPartition ;
public int fIsFat32 ;
public int fIsFat ;
public int fIsNtfs ;
public int fIsLinux ;
public byte bDisk ;
public byte bFill0 ;
public byte bFill1 ;
public byte bFill2 ;
}
public const int MAXPARTITION = (32);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
public struct PARTDESCArray
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPARTITION)]
public PARTDESC[] partItem;
}
//// dwEvent contain a DWEV_xxx value, see below
//// lpUsrParam contain user param gived to function
//
//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 struct ERROR_SUPINFO
{
public int dwSizeStruct;
public LOCATEERROR LocErr;
public int dwHead;
public int dwTrack;
public int dwPosLow;
public int dwPosHigh;
public int dwStyleAnswer;
public int dwErrNumber;
public string lpszErrorTest;
}
#endregion
#region CallBacks
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
// Callback stuff
public delegate int WimCB(uint dwEvent, uint dwEventParam, uint dwWin32Err, int lpParam, int lpUserParam);
//I believe that the lpParam and lpUserParams are pointers to structures with information
//''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#endregion
#region DLL Function Declarations
// CreateMemFatHima : Create an Image Object.
// you need call ReadImaFile, ReadFloppy or MakeEmptyImage
[DllImport("wimadll.dll", EntryPoint = "CreateMemFatHima", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr CreateMemFatHima();
// CreateMemHfsHima : Create an Image Object for Mac floppy.
// you need call ReadImaFile, ReadFloppy
// extract, inject... cannot be used
[DllImport("wimadll.dll", EntryPoint = "CreateMemHfsHima", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr CreateMemHfsHima();
// CreateCDIsoIma : Create an Image Object by loading CDRom ISO image
// lpFn : Filename of .ISO file
// inject,...cannot be used
[DllImport("wimadll.dll", EntryPoint = "CreateCDIsoIma", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr CreateCDIsoIma(string lpFn);
// 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);
[DllImport("wimadll.dll", EntryPoint = "OpenFatLargeFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr OpenFatLargeFile(IntPtr hWnd, string lpFn, int dwPosInFile, int dwPosInFileHigh, bool fReadOnlyAsked);
[DllImport("wimadll.dll", EntryPoint = "OpenFatLargeFileCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr OpenFatLargeFileCB(IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, string lpFn, int dwPosInFile, int dwPosInFileHigh, bool fReadOnlyAsked);
[DllImport("wimadll.dll", EntryPoint = "OpenLargeImageFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr OpenLargeImageFile(IntPtr hWnd, string lpFn, int dwPosInFile, int dwPosInFileHigh, bool fReadOnlyAsked);
// DeleteIma : Delete an Image Object.
[DllImport("wimadll.dll", EntryPoint = "DeleteIma", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern void DeleteIma(IntPtr Ima);
// 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)
[DllImport("wimadll.dll", EntryPoint = "ReadImaFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ReadImaFile(IntPtr Ima, IntPtr hWnd, string lpFn, ref bool lpfCompr, int dwPosFileBegin);
[DllImport("wimadll.dll", EntryPoint = "ReadImaFileEx", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ReadImaFileEx(IntPtr Ima, IntPtr hWnd, string lpFn, ref bool lpfCompr, int dwPosFileBegin, string lpszPassword);
[DllImport("wimadll.dll", EntryPoint = "ReadImaFileExCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ReadImaFileExCB(IntPtr Ima, IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, string lpFn, ref bool lpfCompr, int dwPosFileBegin, string lpszPassword);
// 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)
[DllImport("wimadll.dll", EntryPoint = "WriteImaFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WriteImaFile(IntPtr Ima, IntPtr hWnd, string lpFn, bool fTruncate, bool fCompr, int iLevelCompress, int dwPosBeginWrite, string lpNameInCompr);
[DllImport("wimadll.dll", EntryPoint = "WriteImaFileEx", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WriteImaFileEx(IntPtr Ima, IntPtr hWnd, string lpFn, bool fTruncate, bool fCompr, int iLevelCompress, int dwPosBeginWrite, string lpNameInCompr, string lpszPassword);
[DllImport("wimadll.dll", EntryPoint = "WriteImaFileExCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WriteImaFileExCB(IntPtr Ima, IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, string lpFn, bool fTruncate, bool fCompr, int iLevelCompress, int dwPosBeginWrite, string lpNameInCompr, string lpszPassword);
// 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);
[DllImport("wimadll.dll", EntryPoint = "ReadFloppy", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ReadFloppy(IntPtr Ima, IntPtr hWnd, byte bFloppy, ChoiceApp caRead);
[DllImport("wimadll.dll", EntryPoint = "ReadFloppyCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ReadFloppyCB(IntPtr Ima, IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, byte bFloppy, ChoiceApp caRead);
// 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
[DllImport("wimadll.dll", EntryPoint = "WriteFloppy", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WriteFloppy(IntPtr Ima, IntPtr hWnd, byte bFloppy, ChoiceApp caFormat, ChoiceApp caWrite, ChoiceApp caCompare, byte fCheckDiskBeforeWrite);
[DllImport("wimadll.dll", EntryPoint = "WriteFloppyCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool WriteFloppyCB(IntPtr Ima, IntPtr hWnd, WimCB pEventNotifCallBack, IntPtr lpUsrParam, byte bFloppy, ChoiceApp caFormat, ChoiceApp caWrite, ChoiceApp caCompare, byte fCheckDiskBeforeWrite);
// 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"'
[DllImport("wimadll.dll", EntryPoint = "MkDir", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool MkDir(IntPtr Ima, string lpDir);
// Change current directory by name
// lpDir : Directory name
// BOOL WIMAAPI ChszDir(HIMA hIma,LPSTR lpDir);
[DllImport("wimadll.dll", EntryPoint = "ChszDir", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ChszDir(IntPtr Ima, string lpDir);
// Change current directory by mode
// bMode : CDM_ROOT or CDM_UPPER (equiv. to cd \ and cd ..)
// BOOL WIMAAPI ChDir(HIMA hIma,BYTE bMode);
[DllImport("wimadll.dll", EntryPoint = "ChDir", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ChDir(IntPtr Ima, byte bMode);
[DllImport("wimadll.dll", EntryPoint = "ChDirPos", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool ChDirPos(IntPtr Ima, byte bMode, int dwPosDir);
// 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);
[DllImport("wimadll.dll", EntryPoint = "InjectFile", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool InjectFile(IntPtr Ima, string lpFn, ref int lpdwSize, ref bool lpTooBig, string lpNameWhenInjected);
[DllImport("wimadll.dll", EntryPoint = "InjectFileCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool InjectFileCB(IntPtr Ima, WimCB pEventNotifCallBack, IntPtr lpUsrParam, string lpFn, ref int lpdwSize, ref bool lpTooBig, string lpNameWhenInjected);
// 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);
[DllImport("wimadll.dll", EntryPoint = "MakeEmptyImage", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool MakeEmptyImage(IntPtr Ima, int iNoTypeDisk);
[DllImport("wimadll.dll", EntryPoint = "MakeEmptyImageEx", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool MakeEmptyImageEx(IntPtr Ima, string lpszBootSectorGeom, string lpszBootSectorCode);
[DllImport("wimadll.dll", EntryPoint = "BuildImaNewFormat", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern int BuildImaNewFormat(IntPtr hOldIma, bool fNewTypeDisk, int iNoTypeDisk);
[DllImport("wimadll.dll", EntryPoint = "BuildImaNewFormatEx", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool BuildImaNewFormatEx(IntPtr hOldIma, IntPtr hNewIma, string lpszBootSectForGeometry, bool fDiscardOldIma);
[DllImport("wimadll.dll", EntryPoint = "BuildImaNewFormatExCB", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool BuildImaNewFormatExCB(IntPtr hOldIma, IntPtr hNewIma, WimCB pEventNotifCallBack, IntPtr lpUsrParam, string lpszBootSectForGeometry, bool fDiscardOldIma);
// InitWimaSdk : Init the DLL and use hinstdll for resource
// BOOL WIMAAPI InitWimaSdk(HINSTANCE hinstdll,LPSTR lpDeb,WORD wBase);
[DllImport("wimadll.dll", EntryPoint = "InitWimaSdk", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool InitWimaSdk(IntPtr hinstdll, string lpDeb, short wBase);
// 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);
[DllImport("wimadll.dll", EntryPoint = "GetCurDir", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool GetCurDir(IntPtr Ima, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder lpBuf, uint uiMaxSize);
// GetNbEntryCurDir : Get the number of entry of cur directory
// DWORD WIMAAPI GetNbEntryCurDir(HIMA hIma);
[DllImport("wimadll.dll", EntryPoint = "GetNbEntryCurDir", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern int GetNbEntryCurDir(IntPtr Ima);
// 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"'
[DllImport("wimadll.dll", EntryPoint = "GetDirInfo", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -