![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#4
|
||||
|
||||
|
Cita:
Aquí te muestro un script para conocer el serial del disco duro desde Inno Setup, espero que te sea útil. Tomado de la página Inno Setup Knowledge Base/How to get drive volumen and serial number [code] ; ; ISX 3.0.6.2 ; [Setup] AppName=DriveVolume AppVerName=DriveVolume Uninstallable=false UpdateUninstallLogAppName=false DisableDirPage=true DisableProgramGroupPage=true DefaultDirName={pf}\DriveVolume DisableStartupPrompt=true [_ISTool] EnableISX=true Código:
function GetVolumeInformation( lpRootPathName: PChar; lpVolumeNameBuffer: PChar; nVolumeNameSize: LongInt; var lpVolumeSerialNumber: LongInt; lpMaximumComponentLength: LongInt; lpFileSystemFlags : LongInt; lpFileSystemNameBuffer: PChar; nFileSystemNameSize: LongInt ) : Integer; external '[email protected] 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 '[email protected] 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( Format3( 'Volume of %s is (%s) serial is %s', srcdisk, volume, IntToStr(sernum) ) , mbInformation, MB_OK ); end; end; |
|
|
|