|
正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #ifdef Unicode
- #define A "W"
- #else
- #define A "A"
- #endif
- [Setup]
- AppName=DriveVolume
- AppVerName=DriveVolume
- Uninstallable=false
- UpdateUninstallLogAppName=false
- DisableDirPage=true
- DisableProgramGroupPage=true
- DefaultDirName={pf}\DriveVolume
- DisableStartupPrompt=true
- [_ISTool]
- EnableISX=true
- [Code]
- function GetVolumeInformation(
- lpRootPathName: String;
- lpVolumeNameBuffer: String;
- nVolumeNameSize: LongInt;
- var lpVolumeSerialNumber: LongInt;
- lpMaximumComponentLength: LongInt;
- lpFileSystemFlags : LongInt;
- lpFileSystemNameBuffer: String;
- nFileSystemNameSize: LongInt ) : Integer;
- external 'GetVolumeInformation{#A}@kernel32.dll stdcall';
- { // API declaration in C
- BOOL GetVolumeInformation(
- LPCTSTR lpRootPathName, // root directory
- LPTSTR lpVolumeNameBuffer, // volume name buffer
- DWORD nVolumeNameSize, // length of name buffer
- LPDWORD lpVolumeSerialNumber, // volume serial number
- LPDWORD lpMaximumComponentLength, // maximum file name length
- LPDWORD lpFileSystemFlags, // file system options
- LPTSTR lpFileSystemNameBuffer, // file system name buffer
- DWORD nFileSystemNameSize // length of file system name buffer
- );
- }
- function GetLastError( ) : Integer;
- external 'GetLastError@kernel32.dll stdcall';
- function InitializeSetup(): Boolean;
- var srcdisk, volume: String;
- ercode: Integer; sernum: LongInt;
- begin
- Result := true;
- srcdisk := AddBackslash( ExtractFileDrive( ExpandConstant('{srcexe}') ) );
- volume := StringOfChar( ' ', 16 );
- if GetVolumeInformation( srcdisk, volume, 15, sernum, 0, 0, '', 0 ) = 0 then
- begin
- ercode := GetLastError();
- MsgBox( SysErrorMessage( ercode ), mbError, MB_OK );
- Result := false;
- end
- else begin
- volume := CastIntegerToString( CastStringToInteger(volume) );
- MsgBox( Format( '%s 的卷标是“%s”,序列号是 %s。', [srcdisk, volume, IntToStr(sernum)] )
- , mbInformation, MB_OK );
- end;
- end;
复制代码
|
|