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

📄 wimadll.cs

📁 对ima、imz压缩文件修改
💻 CS
📖 第 1 页 / 共 3 页
字号:
// WinImage DLL c# header
// translation of winimage.h header, made with the help of Tom McCartney

using System.Runtime.InteropServices;
using System;
internal static class Wimadll
{
    #region EnumeratedTypes
    // value for CaRead or CaCompare or CaWrite or CaFormat
    public enum ChoiceApp { caNOTHING = 0, caUSED, caAll, caBEGINFLOPPY, caONLYBOOT };
    //public const short FL_NOTHING = 0;
    //public const short FL_USED = 1;
    //public const short FL_ALL = 2;
    //public const short FL_BEGINFLOPPY = 3;
    public enum LOCATEERROR { ON_FORMAT = 0, ON_READ = 1, ON_WRITE = 2, ON_COMPARE = 3 };
    //public const short ON_FORMAT = 0;
    //public const short ON_READ = 1;
    //public const short ON_WRITE = 2;
    //public const short ON_COMPARE = 3;
    public enum DriveInfo { NO_FLOPPY = 0, FLOPPY_360 = 1, FLOPPY_12M = 2, FLOPPY_720 = 3, FLOPPY_144 = 4, FLOPPY_288 = 5, LDISK_REMOVABLE = 6, LDISK_HARDDISK = 7, LDIST_CDROM = 8, FLOPPY_LS120 = 9 };
    //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

    #endregion
    #region Constants
    public const short MAXLFN = 256;

    public const byte SORT_NONE = 72;
    public const byte SORT_NAME = 73;
    public const byte SORT_EXT = 74;
    public const byte SORT_SIZE = 75;
    public const byte SORT_DATE = 76;

    //Mode Values for ChDir function
    public const byte CDM_ROOT = 50;
    public const byte CDM_UPPER = 51;
    public const byte CDM_ENTRY = 52;

    //Values for Floppy Density for MakeFloppyImage
    public const short FLOPPY_160K = 0;
    public const short FLOPPY_180K = 1;
    public const short FLOPPY_320K = 2;
    public const short FLOPPY_360K = 3;
    public const short FLOPPY_720K = 4;
    public const short FLOPPY_1200K = 5;
    public const short FLOPPY_1440K = 6;
    public const short FLOPPY_2880K = 7;
    public const short FLOPPY_DMF2048K = 8;
    public const short FLOPPY_DMF1024K = 9;
    public const short FLOPPY_1680K = 10;

    private const string DEBENUSTD = "ENU";
    private const short BASEENUSTD = (10000);



    public const int DWEV_ERRORSUPINFO = 0X7FFF0001;
    //#define DWEV_ERRORSUPINFO       ((DWORD)0x7fff0001)
    //// IO Error with supplemental info (in ReadFloppy and WriteFloppy)
    //// dwEventParam = WinImage error number (see below), Bios like error number
    //// dwWin32Err : Win32 error number, like GetLastError()
    //// lpParam * pointer to an ERROR_SUPINFO structure
    //// return value : IDRETRY (4), IDABORT (3), IDIGNORE (5) or  IDCANCEL (2)
    ////   dwEventParam = 0x01         "Internal error 1\n"
    ////   dwEventParam = 0x02         "Address mark not found"
    ////   dwEventParam = 0x03         "Diskette is write-protected"
    ////   dwEventParam = 0x04         "Sector not found"
    ////   dwEventParam = 0x08         "DMA overflow"
    ////   dwEventParam = 0x09         "Internal error 9"
    ////   dwEventParam = 0x10         "Error in reading"
    ////   dwEventParam = 0x20         "Error in floppy adapter"
    ////   dwEventParam = 0x40         "Track not found"
    ////   dwEventParam = 0x80         "There is no floppy in the drive"
    ////   dwEventParam = 0x100        "Floppies do not match"
    //
    //
    public const int DWEV_ERRORWIN32 = 0X7FFF0002;
    //#define DWEV_ERRORWIN32         ((DWORD)0x7fff0002)
    //// Win32 IO Error in ReadFloppy and WriteFloppy and ReadLargeIma and WriteLargeIma
    //// dwEventParam = WinImage error number (see DWEV_ERRORSUPINFO), Bios like error number or 0
    //// dwWin32Err : Win32 error number, like GetLastError()
    //// return value : IDRETRY to retry (when possible)
    //// elsewhere (IDCANCEL or 0) to stop
    //
    //
    public const int DWEV_ERRORCANTACCESS = 0X7FFF0003;
    //#define DWEV_ERRORCANTACCESS    ((DWORD)0x7fff0003)
    //// in ReadFloppy* and WriteFloppy*
    //// "Drive cannot be accessed - Check to see if another application is using it"
    //// return value not used
    //
    public const int DWEV_ERRORDRIVEEMPTY = 0X7FFF0004;
    //#define DWEV_ERRORDRIVEEMPTY    ((DWORD)0x7fff0004)
    //// in ReadFloppy* and WriteFloppy*
    //// "There is no floppy in the drive"
    //// return value not used
    //
    public const int DWEV_ERROR_NOT_MATCH = 0X7FFF0005;
    //#define DWEV_ERROR_NOT_MATCH    ((DWORD)0x7fff0005)
    //// in ReadFloppy*
    //// "Floppies do not match"
    //// return value not used
    //
    public const int DWEV_UNSTDFMT = 0X7FFF0006;
    //#define DWEV_UNSTDFMT           ((DWORD)0x7fff0006)
    //// in ReadFloppy* and WriteFloppy*
    //// "The current image format differs from the standard format for this disk drive"
    //// return value : IDOK (1) to continue, IDCANCEL to abort
    //
    public const int DWEV_UNSUPFMT = 0X7FFF0007;
    //#define DWEV_UNSUPFMT           ((DWORD)0x7fff0007)
    //// in WriteFloppy* and WriteLargeIma
    //// "The current image format is not supported by the disk drive"
    //// return value not used
    //
    public const int DWEV_DIFFTYPEDISK = 0X7FFF0008;
    //#define DWEV_DIFFTYPEDISK       ((DWORD)0x7fff0008)
    //// in WriteFloppy*
    //// "Disk and image formats do not match\nDo you want to reformat it?"
    //// return IDYES (6) or IDNO (7)
    //
    public const int DWEV_DISKHASDATA = 0X7FFF0009;
    //#define DWEV_DISKHASDATA        ((DWORD)0x7fff0009)
    //// in WriteFloppy*
    //// "Disk is not empty, all data on your disk will be lost!\nDo you want to continue?"
    //// return IDYES (6) or IDNO (7)
    //
    public const int DWEV_PROGRESSPERCENT = 0X7FFF000A;
    //#define DWEV_PROGRESSPERCENT    ((DWORD)0x7fff000a)
    //// Give % progress info
    //// dwEventParam between 0 and 100
    //// for ExtractFile and InjectFile, lpParam contain a PROGRESSFILE_SUPINFO structure
    //// return value : IDCANCEL (2) to stop, 0 to continue
    //
    public const int DWEV_ERRORASPI = 0X7FFF000B;
    //#define DWEV_ERRORASPI          ((DWORD)0x7fff000b)
    //// Aspi error in WimLargeReadAspiCDImage*
    //// dwEventParam contain first sector number of range error
    //// return value : IDABORT, IDRETRY or IDIGNORE
    //
    public const int DWEV_ERRORWRITEIMAGEFILE = 0X7FFF000C;
    //#define DWEV_ERRORWRITEIMAGEFILE    ((DWORD)0x7fff000c)
    //// error in writing image file in WimLargeReadAspiCDImage*
    //// dwWin32Err : Win32 error number, like GetLastError()
    //
    //
    public const int DWEV_ERRORIOCTL = 0X7FFF000D;
    //#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 int DWEV_ROOTREADDONE = 0X7FFF000E;
    //// when reading FAT image, say when the root is read
    //// return value is not used

    public const uint ERRINFO_MOVEFILE_DESTINATIONEQUALSOURCE = 0X80000001;
    public const uint ERRINFO_MOVEFILE_DESTINATIONSUBFOLERDEPL = 0X80000002;

    #endregion
    #region Structures

    [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=1)]
    public struct DIRINFO
    {
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public char[] nom; //Supposed to be 8 bytes
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
        public char[] ext; //Supposed to be 3 bytes
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
        public char[] szCompactName; //Supposed to be 13 bytes
        public byte bAttr;
        public byte dir_CreateMSec;
        public short dir_CreateDate;
        public short DosTime;
        public short DosDate;
        public bool fIsSubDir;
        public bool fSel; //Boolean
        public bool fLfnEntry;
        public int dwSize;
        public uint uiPosInDir;
        public int dwLocalisation;
        public int dwTrueSize;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXLFN)]
        public char[] longname; //Supposed to be MAXLFN bytes (MAXLFN Const defined above)
        public short dir_CreateTime;
        public short dir_LastAccessDate;
    }

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct ASPIINQUIRYTAB
    {
        public int dwSizeStruct;
        public int dwHost;
        public int dwTargetID;
        public int dwTargetType;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
        public char[] szDeviceName; //Supposed to be 32 bytes
    }

    // // for ExtractFile and InjectFile, in event DWEV_PROGRESSPERCENT lpParam contain a
    // //    PROGRESSFILE_SUPINFO structure

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct PROGRESSFILE_SUPINFO
    {
        public int dwSizeStruct;
        public int dwCurrentPos;
        public int dwReserved1;
        public int dwTotalSize;
        public int dwReserved2;
        public string lpszName;
        public string lpszFullName;
    }


    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct PARTITION
    {
        public byte bActivate ;
        public byte bHeadBegin ;
        public short wCylSectBegin ;

        public byte bType ;
        public byte bHeadEnd ;
        public short wCylSectEnd ;

        public int dwDist ;
        public int dwSize ;
    }


    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct PARTDESC
    {

⌨️ 快捷键说明

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