📄 wimadll.pas
字号:
unit WIMADLL;
{ // WinImage SDK Delphi header
// Written with the help of Roel van Nuland
}
interface
uses
Windows;
const
WimaDllName = 'wimadll.dll';
Type PBool = ^WordBool;
PBoolean = ^Boolean;
PByte = ^Byte;
PWord = ^Word;
PShortInt = ^ShortInt;
PInteger = ^Integer;
PLongInt = ^LongInt;
PSingle = ^Single;
PDouble = ^Double;
PPointer = ^Pointer;
HGlobal = THandle;
PRGBTriple = ^TRGBTriple;
PRGBQuad = ^TRGBQuad;
PMenuItemTemplateHeader = ^TMenuItemTemplateHeader;
PMenuItemTemplate = ^TMenuItemTemplate;
PMultiKeyHelp = ^TMultiKeyHelp;
Type str_ima_handle = record
unused: LongInt;
end {str_ima_handle};
Type HIMA = str_ima_handle;
{ BEGIN: NEW CALLBACK FUNCTION ADDITIONS TO THE HEADER FILE }
type TWIMACALLBACK = function(dwEvent, dwEventParam, dwWin32Err: LongInt; lpParam, lpUsrParam: Pointer): LongInt; stdcall;
type TWIMAFILEIOCALLBACK = function(lpData: Pointer; dwDataSize: LongInt; lpUsrParam: Pointer): Bool; stdcall;
{ // dwEvent contain a DWEV_xxx value, see below
// lpUsrParam contain user param gived to function
}
const
DWEV_ERRORSUPINFO = $7fff0001;
{
// 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"
}
DWEV_ERRORWIN32 = $7fff0002;
{
// 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
}
DWEV_ERRORCANTACCESS = $7fff0003;
{// in ReadFloppy* and WriteFloppy*
// "Drive cannot be accessed - Check to see if another application is using it"
// return value not used
}
DWEV_ERRORDRIVEEMPTY = $7fff0004;
{// in ReadFloppy* and WriteFloppy*
// "There is no floppy in the drive"
// return value not used
}
DWEV_ERROR_NOT_MATCH = $7fff0005;
{// in ReadFloppy*
// "Floppies do not match"
// return value not used
}
DWEV_UNSTDFMT = $7fff0006;
{// 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
}
DWEV_UNSUPFMT = $7fff0007;
{// in WriteFloppy* and WriteLargeIma
// "The current image format is not supported by the disk drive"
// return value not used
}
DWEV_DIFFTYPEDISK = $7fff0008;
{// in WriteFloppy*
// "Disk and image formats do not match\nDo you want to reformat it?"
// return IDYES (6) or IDNO (7)
}
DWEV_DISKHASDATA = $7fff0009;
{// 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)
}
DWEV_PROGRESSPERCENT = $7fff000a;
{// 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
}
DWEV_ERRORASPI = $7fff000b;
{// Aspi error in WimLargeReadAspiCDImage*
// dwEventParam contain first sector number of range error
// return value : IDABORT, IDRETRY or IDIGNORE
}
DWEV_ERRORWRITEIMAGEFILE = $7fff000c;
{// error in writing image file in WimLargeReadAspiCDImage*
// dwWin32Err : Win32 error number, like GetLastError()
}
DWEV_ERRORIOCTL = $7fff000d;
{// IOCTL error when reading Disk partition under Win9x
// dwEventParam is Int25/26 error value
// return value : IDCANCEL or IDRETRY
}
DWEV_ROOTREADDONE = $7fff000e;
{// when reading FAT image, say when the root is read
// return value is not used
}
type TLocateError = (ON_FORMAT, ON_READ, ON_WRITE, ON_COMPARE);
type TError_SupInfo = record
dwSizeStruct: LongInt;
LocErr: TLocateError;
dwHead: LongInt;
dwTrack: LongInt;
dwPosLow: LongInt;
dwPosHigh: LongInt;
dwStyleAnswer: LongInt;
dwErrNumber: LongInt;
lpszErrorText: PChar;
end;
// for ExtractFile and InjectFile, in event DWEV_PROGRESSPERCENT lpParam contain a
// PROGRESSFILE_SUPINFO structure
type ProgressFile_SupInfo = record
dwSizeStruct,
dwCurrentPos,
dwReserved1,
dwTotalSize,
dwReserved2: LongInt;
lpszName,
lpszFullName: PChar;
end;
{ END: NEW CALLBACK FUNCTION ADDITIONS TO THE HEADER FILE }
{$IFNDEF _INC_DISK}
{$IFNDEF MAXLFN}
Const MAXLFN = 256;
{$ENDIF}
Type DIRINFO = record
nom: Array[0..8-1] of Char;
ext: Array[0..3-1] of Char;
szCompactName: Array[0..13-1] of Char;
bAttr: BYTE;
dir_CreateMSec: BYTE;
dir_CreateDate: Word;
DosTime: Word;
DosDate: Word;
fIsSubDir: Bool;
fSel: Bool;
fLfnEntry: Bool;
dwSize: LongInt;
uiPosInDir: LongInt;
dwLocalisation: LongInt;
dwTrueSize: LongInt;
longname: Array[0..MAXLFN-1] of Char;
dir_CreateTime: Word;
dir_LastAccessDate: Word;
end {_1};
Type PDIRINFO = ^DIRINFO;
Type LPDIRINFO = PDIRINFO;
Type ASPIINQUIRYTAB = record
dwSizeStruct: LongInt;
dwHost: LongInt;
dwTargetID: LongInt;
dwTargetType: LongInt;
szDeviceName: Array[0..32-1] of Char;
end;
Type PASPIINQUIRYTAB = ^ASPIINQUIRYTAB;
Type LPASPIINQUIRYTAB = PASPIINQUIRYTAB;
{$ENDIF}
{$IFNDEF SORT_NONE}
Const SORT_NONE = 72;
Const SORT_NAME = 73;
Const SORT_EXT = 74;
Const SORT_SIZE = 75;
Const SORT_DATE = 76;
{$ENDIF}
{$IFNDEF CDM_ROOT}
Const CDM_ROOT = 50;
Const CDM_UPPER = 51;
Const CDM_ENTRY = 52; {// use ChszDir}
{$ENDIF}
type CHOICEAPP = LongInt;
Const NOTHING:CHOICEAPP=0;
Const USED:CHOICEAPP = 1;
Const ALL:CHOICEAPP =2;
Const BEGINFLOPPY:CHOICEAPP=3;
{$IFNDEF HWND_NO_PROGRESS}
const HWND_NO_PROGRESS:HWND = INVALID_HANDLE_VALUE;
{$ENDIF}
{/// CreateMemFatHima : Create an Image Object. }
{/// you need call ReadImaFile, ReadFloppy or MakeEmptyImage }
function CreateMemFatHima: HIMA;
stdcall; external WimaDllName name 'CreateMemFatHima';
{/// CreateMemHfsHima : Create an Image Object for Mac floppy. }
{/// you need call ReadImaFile, ReadFloppy }
{/// extract, inject... cannot be used }
function CreateMemHfsHima: HIMA;
stdcall; external WimaDllName name 'CreateMemHfsHima';
{/// CreateCDIsoIma : Create an Image Object by loading CDRom ISO image }
{/// lpFn : Filename of .ISO file }
{/// inject,...cannot be used }
function CreateCDIsoIma(lpFn: PChar): HIMA;
stdcall; external WimaDllName name 'CreateCDIsoIma';
{/// 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 }
function OpenFatLargeFile(hWnd: HWND;
lpszFilename: pChar;
wPosInFile: Word;
wPosInFileHigh: Word;
fReadOnlyAsked: bool): HIMA;
stdcall; external WimaDllName name 'OpenFatLargeFile';
function OpenFatLargeFileCB(hWnd: HWND;
pEventNotifCallBack: TWIMACALLBACK;
lpUsrParam: Pointer;
lpszFilename: pChar;
wPosInFile: Word;
wPosInFileHigh: Word;
fReadOnlyAsked: bool): HIMA;
stdcall; external WimaDllName name 'OpenFatLargeFileCB';
function OpenLargeImageFile(hWnd: HWND;
lpszFilename: pChar;
wPosInFile: Word;
wPosInFileHigh: Word;
fReadOnlyAsked: bool): HIMA;
stdcall; external WimaDllName name 'OpenLargeImageFile';
function OpenLargeImageFileCB(hWnd: HWND;
pEventNotifCallBack: TWIMACALLBACK;
lpUsrParam: Pointer;
lpszFilename: pChar;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -