Delphi 2007のインストール

Delphi 2007をインストールします。

インストール手順

メディアはDVD1枚になっています。DVDをドライブに入れ、AutoRunが起動すると下図のダイアログが表示されます。
Delphi 2007のインストール:画像1

Delphi 2007 for Win32のインストールをクリックします。言語を選択するダイアログが表示されます。デフォルトで選択されているJapaneseを選択してOKを押します。
Delphi 2007のインストール:画像2

使用許諾に同意します。
Delphi 2007のインストール:画像3
Delphi 2007のインストール:画像4

使用者名とライセンスキーを入力します。
Delphi 2007のインストール:画像5

インストールオプションを選択します。デフォルトではすべてインストールされるようになっていますので、そのまま次に進みます。
Delphi 2007のインストール:画像6

インストールオプションは下図のとおりです。
Delphi 2007のインストール:画像7

インストールするフォルダを選択します。デフォルトでは c:\Program files\CodeGear\RAD Studio\5.0にインストールされます。
Delphi 2007のインストール:画像8

拡張子の関連付けの設定です。デフォルトではすべて選択されています。このまま次に進みます。
Delphi 2007のインストール:画像9

スタートメニューの設定です。スタートメニューの名前もデフォルトのまま利用するのでこのまま次に進みます。
Delphi 2007のインストール:画像10

[インストールする準備ができました]画面が表示されます。インストールの準備が完了しました。
Delphi 2007のインストール:画像11

インストールが開始されます。
Delphi 2007のインストール:画像12
Delphi 2007のインストール:画像13

ヘルプファイルのマージなどもインストール中に実行されます。
Delphi 2007のインストール:画像14

インストールが完了すると下図の画面が表示されます。
Delphi 2007のインストール:画像15

インストール手順:Windows 10 32ビットへのインストール

Delphi 2007はソフトウェア保守などで新しいOS環境にインストールする場合もあるため、Windows 10 32ビット 版へのインストール手順も紹介します。

事前準備

Windows 10 32ビット版のインストール

64ビットOSでも動作しますが、Delphi 2007は32ビットコンパイラのため、32ビット版のOSにインストールしたほうが良いです。
2023年時点では、Windows 10 22H2 32ビット版が最新の32ビット版Windowsとなるため、こちらのマシンを準備します。
今回は、Hyper-Vの仮想マシンを準備しています。Windows 10 32ビット版のインストールはこちらの記事を参照してください。

.NET Framework 2.0 のインストール

インストールした32ビット版の Windows 10 に.NET Framewrok 2.0をインストールします。 インストールの手順はこちらの記事を参照してください。

インストールしない場合下図のセットアップエラーが発生するため、あらかじめインストールしておきます。
Delphi 2007のインストール:画像16

インストール

インストールメディアを開きます。
Delphi 2007のインストール:画像17

インストールメディアの自動起動を選択するか、メディアのルートディレクトリのInstall.exeを実行します。
Delphi 2007のインストール:画像18

下図のウィンドウが表示されます。[Delphi 2007 for Win32 のインストール]のタイルをクリックします。
Delphi 2007のインストール:画像19

[Select Setup Language]ダイアログが表示されます。[Japanese]を選択し[OK]ボタンをクリックします。
Delphi 2007のインストール:画像20

[RAD Studio に必要なソフトウェア]の一覧が表示されます。[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像21

セットアップが始まります。
Delphi 2007のインストール:画像22 Delphi 2007のインストール:画像23

「InstallAwareウィザードへようこそ」画面が表示されます。[次へ]ボタンをクリックします。 Delphi 2007のインストール:画像24

使用許諾契約の同意画面が表示されます。
Delphi 2007のインストール:画像25

契約文面の下部の[使用許諾契約に同意する]のチェックをクリックしてチェックをつけます。チェック後[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像26

[製品登録]画面が表示されます。ユーザー名、会社名、プロダクトライセンスキーを入力します。入力後[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像27

[機能の選択]画面が表示されます。今回はデフォルトのままとします。[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像28
Delphi 2007のインストール:画像29

[インスト-ル先フォルダ]の画面が表示されます。今回はデフォルトのままとします。[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像30

[ファイル関連付け更新]画面が表示されます。こちらもデフォルトのままとします。[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像31

[ [スタート]メニュー ]画面が表示されます。こちらもデフォルトのままとします。[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像32

[インストールする準備ができました]画面が表示されます。[次へ]ボタンをクリックします。
Delphi 2007のインストール:画像33

インストールが始まります。
Delphi 2007のインストール:画像34 Delphi 2007のインストール:画像35
Delphi 2007のインストール:画像36

オンラインドキュメンテーションのファイルのインストールも実行されます。
Delphi 2007のインストール:画像37

インストールが完了すると下図の画面が表示されます。[完了]ボタンをクリックしインストーラーを終了します。
Delphi 2007のインストール:画像38

アップデートのインストール

Delphi 2007には複数のアップデートが提供されていますので、インストールをします。

Update 3 for Delphi 2007 for Win32

Update 3をインストールします。Update 1,2の内容を含んでいるため、Update3をインストールすればUpdate1,2は適用されるようです。
Update 3を展開したディレクトリのSetup.exeを実行してインストールします。
Delphi 2007のインストール:画像39

June 08 Linker Hotfix for CodeGear RAD Studio 2007

June 08 Linker Hotfix for CodeGear RAD Studio 2007 をインストールします。ZIPファイルを展開し、ilink32.exe を デフォルトのインストール先の場合は、C:\Program Files\CodeGear\RAD Studio\5.0\binにコピーしてilink32.exeを上書きします。
Delphi 2007のインストール:画像40

CodeGear RAD Studio 2007 December update

CodeGear RAD Studio 2007 December updateをインストールします。
Delphi 2007のインストール:画像41

April 08 Hotfix for CodeGear RAD Studio 2007

April 08 Hotfix for CodeGear RAD Studio 2007 をインストールします。
Delphi 2007のインストール:画像42

GIF and JPG source files for CodeGear RAD Studio 2007

GIF and JPG source files for CodeGear RAD Studio 2007をインストールします。
ZIPファイルを展開し、展開されたファイルをC:\Program Files\CodeGear\RAD Studio\5.0\source に配置します。
Delphi 2007のインストール:画像43

CodeGear RAD Studio May08 Help update (Help Update 4)

CodeGear RAD Studio May08 Help update (Help Update 4)をインストールします。ファイルを展開しHelp_Setup.exe を実行します。
Delphi 2007のインストール:画像44

対策コードの適用

以下のコードを修正します。
C:\Program Files\CodeGear\RAD Studio\5.0\source\Win32\vcl\Graphics.pas を別のフォルダにコピーしたのち開きます。
以下のコードを修正したのち、C:\Program Files\CodeGear\RAD Studio\5.0\source\Win32\vcl\Graphics.pasに上書きします。
変更箇所は以下の3カ所となります。
  • PaletteFromDIBColorTable 関数
  • TMetafile.ReadEMFStream メソッド
  • TBitmap.ReadDIB メソッド

PaletteFromDIBColorTable

PaletteFromDIBColorTable 編集前
function PaletteFromDIBColorTable(DIBHandle: THandle; ColorTable: Pointer;
  ColorCount: Integer): HPalette;
var
  DC: HDC;
  Save: THandle;
  Pal: TMaxLogPalette;
begin
  Result := 0;
  Pal.palVersion := $300;
  if DIBHandle <> 0 then
  begin
    DC := CreateCompatibleDC(0);
    Save := SelectObject(DC, DIBHandle);
    Pal.palNumEntries := GetDIBColorTable(DC, 0, 256, Pal.palPalEntry);
    SelectObject(DC, Save);
    DeleteDC(DC);
  end
  else
  begin
    Pal.palNumEntries := ColorCount;
    Move(ColorTable^, Pal.palPalEntry, ColorCount * 4);
  end;
  if Pal.palNumEntries = 0 then Exit;
  if (Pal.palNumEntries <> 16) or not SystemPaletteOverride(Pal) then
    ByteSwapColors(Pal.palPalEntry, Pal.palNumEntries);
  Result := CreatePalette(PLogPalette(@Pal)^);
end;

PaletteFromDIBColorTable 編集後
function PaletteFromDIBColorTable(DIBHandle: THandle; ColorTable: Pointer;
  ColorCount: Integer): HPalette;
var
  DC: HDC;
  Save: THandle;
  Pal: TMaxLogPalette;
begin
  Result := 0;
  Pal.palVersion := $300;
  if DIBHandle <> 0 then
  begin
    DC := CreateCompatibleDC(0);
    Save := SelectObject(DC, DIBHandle);
    Pal.palNumEntries := GetDIBColorTable(DC, 0, 256, Pal.palPalEntry);
    SelectObject(DC, Save);
    DeleteDC(DC);
  end
  else
  begin
   if ColorCount > 256 then                                //追加
     InvalidGraphic({$IFNDEF CLR}@{$ENDIF}SInvalidBitmap); //追加
    Pal.palNumEntries := ColorCount;
    Move(ColorTable^, Pal.palPalEntry, ColorCount * 4);
  end;
  if Pal.palNumEntries = 0 then Exit;
  if (Pal.palNumEntries <> 16) or not SystemPaletteOverride(Pal) then
    ByteSwapColors(Pal.palPalEntry, Pal.palNumEntries);
  Result := CreatePalette(PLogPalette(@Pal)^);
end;

TMetafile.ReadEMFStream

TMetafile.ReadEMFStream 編集前
procedure TMetafile.ReadEMFStream(Stream: TStream);
var
  EnhHeader: TEnhMetaheader;
  Buf: PChar;
begin
  NewImage;
  Stream.ReadBuffer(EnhHeader, Sizeof(EnhHeader));
  if EnhHeader.dSignature <> ENHMETA_SIGNATURE then InvalidMetafile;
  GetMem(Buf, EnhHeader.nBytes);
  with FImage do
  try
    Move(EnhHeader, Buf^, Sizeof(EnhHeader));
    Stream.ReadBuffer(PChar(Buf + Sizeof(EnhHeader))^,
      EnhHeader.nBytes - Sizeof(EnhHeader));
    FHandle := SetEnhMetafileBits(EnhHeader.nBytes, Buf);
    if FHandle = 0 then InvalidMetafile;
    FInch := 0;
    with EnhHeader.rclFrame do
    begin
      FWidth := Right - Left;    { in 0.01 mm units }
      FHeight := Bottom - Top;
    end;
    Enhanced := True;
  finally
    FreeMem(Buf, EnhHeader.nBytes);
  end;
end;
TMetafile.ReadEMFStream 編集後
procedure TMetafile.ReadEMFStream(Stream: TStream);
var
  EnhHeader: TEnhMetaheader;
  Buf: PChar;
begin
  NewImage;
  Stream.ReadBuffer(EnhHeader, Sizeof(EnhHeader));
  if EnhHeader.dSignature <> ENHMETA_SIGNATURE then InvalidMetafile;
  if EnhHeader.nBytes < Sizeof(EnhHeader) then      //追加
    InvalidMetafile;                                //追加
  GetMem(Buf, EnhHeader.nBytes);
  with FImage do
  try
    Move(EnhHeader, Buf^, Sizeof(EnhHeader));
    Stream.ReadBuffer(PChar(Buf + Sizeof(EnhHeader))^,
      EnhHeader.nBytes - Sizeof(EnhHeader));
    FHandle := SetEnhMetafileBits(EnhHeader.nBytes, Buf);
    if FHandle = 0 then InvalidMetafile;
    FInch := 0;
    with EnhHeader.rclFrame do
    begin
      FWidth := Right - Left;    { in 0.01 mm units }
      FHeight := Bottom - Top;
    end;
    Enhanced := True;
  finally
    FreeMem(Buf, EnhHeader.nBytes);
  end;
end;

TBitmap.ReadDIB

TBitmap.ReadDIB 編集前
procedure TBitmap.ReadDIB(Stream: TStream; ImageSize: LongWord; bmf: PBitmapFileHeader);
const
  DIBPalSizes: array [Boolean] of Byte = (sizeof(TRGBQuad), sizeof(TRGBTriple));
var
  DC, MemDC: HDC;
  BitsMem: Pointer;
  OS2Header: TBitmapCoreHeader;
  BitmapInfo: PBitmapInfo;
  ColorTable: Pointer;
  HeaderSize: Integer;
  OS2Format: Boolean;
  BMHandle, OldBMP: HBITMAP;
  DIB: TDIBSection;
  Pal, OldPal: HPalette;
  RLEStream: TStream;
  vbmf: TBitmapFileHeader;
{$IFDEF LINUX}
  I: Integer;
{$ENDIF}
begin
  Pal := 0;
  BMHandle := 0;
  RLEStream := nil;
  Stream.Read(HeaderSize, sizeof(HeaderSize));
  OS2Format := HeaderSize = sizeof(OS2Header);
  if OS2Format then HeaderSize := sizeof(TBitmapInfoHeader);
  GetMem(BitmapInfo, HeaderSize + 12 + 256 * sizeof(TRGBQuad));
  with BitmapInfo^ do
  try
    try
      if OS2Format then  // convert OS2 DIB to Win DIB
      begin
        Stream.Read(Pointer(Longint(@OS2Header) + sizeof(HeaderSize))^,
          sizeof(OS2Header) - sizeof(HeaderSize));
        FillChar(bmiHeader, sizeof(bmiHeader), 0);
        with bmiHeader, OS2Header do
        begin
          biWidth := bcWidth;
          biHeight := bcHeight;
          biPlanes := bcPlanes;
          biBitCount := bcBitCount;
        end;
        Dec(ImageSize, sizeof(OS2Header));
      end
      else
      begin // support bitmap headers larger than TBitmapInfoHeader
        Stream.Read(Pointer(Longint(BitmapInfo) + sizeof(HeaderSize))^,
          HeaderSize - sizeof(HeaderSize));
        Dec(ImageSize, HeaderSize);

        if (bmiHeader.biCompression <> BI_BITFIELDS) and
          (bmiHeader.biCompression <> BI_RGB) then
        begin // Preserve funky non-DIB data (like RLE) until modified
          RLEStream := TMemoryStream.Create;
          // source stream could be unidirectional.  don't reverse seek
          if bmf = nil then
          begin
            FillChar(vbmf, sizeof(vbmf), 0);
            vbmf.bfType := $4D42;
            vbmf.bfSize := ImageSize + Cardinal(HeaderSize);
            bmf := @vbmf;
          end;
          RLEStream.Write(bmf^, sizeof(bmf^));
          RLEStream.Write(HeaderSize, sizeof(HeaderSize));
          RLEStream.Write(Pointer(Longint(BitmapInfo) + sizeof(HeaderSize))^,
            HeaderSize - sizeof(HeaderSize));
          RLEStream.CopyFrom(Stream, ImageSize);
          { Cast ImageSize (long word) to integer to avoid integer overflow when negating. }
          RLEStream.Seek(-Integer(ImageSize), soFromEnd);
          Stream := RLEStream;  // the rest of the proc reads from RLEStream
        end;
      end;

      with bmiHeader do
      begin
        biSize := HeaderSize;
        ColorTable := Pointer(Longint(BitmapInfo) + HeaderSize);

        { check number of planes. DIBs must be 1 color plane (packed pixels) }
        if biPlanes <> 1 then InvalidBitmap;

        // 3 DWORD color element bit masks (ie 888 or 565) can precede colors
        // TBitmapInfoHeader sucessors include these masks in the headersize
        if (HeaderSize = sizeof(TBitmapInfoHeader)) and
          ((biBitCount = 16) or (biBitCount = 32)) and
          (biCompression = BI_BITFIELDS) then
        begin
          Stream.ReadBuffer(ColorTable^, 3 * sizeof(DWORD));
          Inc(Longint(ColorTable), 3 * sizeof(DWORD));
          Dec(ImageSize, 3 * sizeof(DWORD));
        end;

        // Read the color palette
        if biClrUsed = 0 then
          biClrUsed := GetDInColors(biBitCount);
        Stream.ReadBuffer(ColorTable^, biClrUsed * DIBPalSizes[OS2Format]);
        Dec(ImageSize, biClrUsed * DIBPalSizes[OS2Format]);

        // biSizeImage can be zero. If zero or RGB, compute the size.
        if (biSizeImage = 0) or (biCompression = BI_RGB) then // top-down DIBs have negative height
          biSizeImage := BytesPerScanLine(biWidth, biBitCount, 32) * Abs(biHeight);

        if biSizeImage < ImageSize then ImageSize := biSizeImage;
      end;

 { 以下略 }
end;
TBitmap.ReadDIB 編集後
procedure TBitmap.ReadDIB(Stream: TStream; ImageSize: LongWord; bmf: PBitmapFileHeader);
const
  DIBPalSizes: array [Boolean] of Byte = (sizeof(TRGBQuad), sizeof(TRGBTriple));
var
  DC, MemDC: HDC;
  BitsMem: Pointer;
  OS2Header: TBitmapCoreHeader;
  BitmapInfo: PBitmapInfo;
  ColorTable: Pointer;
  HeaderSize: Integer;
  OS2Format: Boolean;
  BMHandle, OldBMP: HBITMAP;
  DIB: TDIBSection;
  Pal, OldPal: HPalette;
  RLEStream: TStream;
  vbmf: TBitmapFileHeader;
{$IFDEF LINUX}
  I: Integer;
{$ENDIF}
begin
  Pal := 0;
  BMHandle := 0;
  RLEStream := nil;
  Stream.Read(HeaderSize, sizeof(HeaderSize));
  OS2Format := HeaderSize = sizeof(OS2Header);
  if OS2Format then HeaderSize := sizeof(TBitmapInfoHeader);
  GetMem(BitmapInfo, HeaderSize + 12 + 256 * sizeof(TRGBQuad));
  with BitmapInfo^ do
  try
    try
      if OS2Format then  // convert OS2 DIB to Win DIB
      begin
        Stream.Read(Pointer(Longint(@OS2Header) + sizeof(HeaderSize))^,
          sizeof(OS2Header) - sizeof(HeaderSize));
        FillChar(bmiHeader, sizeof(bmiHeader), 0);
        with bmiHeader, OS2Header do
        begin
          biWidth := bcWidth;
          biHeight := bcHeight;
          biPlanes := bcPlanes;
          biBitCount := bcBitCount;
        end;
        Dec(ImageSize, sizeof(OS2Header));
      end
      else
      begin // support bitmap headers larger than TBitmapInfoHeader
        Stream.Read(Pointer(Longint(BitmapInfo) + sizeof(HeaderSize))^,
          HeaderSize - sizeof(HeaderSize));
        Dec(ImageSize, HeaderSize);

        if (bmiHeader.biCompression <> BI_BITFIELDS) and
          (bmiHeader.biCompression <> BI_RGB) then
        begin // Preserve funky non-DIB data (like RLE) until modified
          RLEStream := TMemoryStream.Create;
          // source stream could be unidirectional.  don't reverse seek
          if bmf = nil then
          begin
            FillChar(vbmf, sizeof(vbmf), 0);
            vbmf.bfType := $4D42;
            vbmf.bfSize := ImageSize + Cardinal(HeaderSize);
            bmf := @vbmf;
          end;
          RLEStream.Write(bmf^, sizeof(bmf^));
          RLEStream.Write(HeaderSize, sizeof(HeaderSize));
          RLEStream.Write(Pointer(Longint(BitmapInfo) + sizeof(HeaderSize))^,
            HeaderSize - sizeof(HeaderSize));
          RLEStream.CopyFrom(Stream, ImageSize);
          { Cast ImageSize (long word) to integer to avoid integer overflow when negating. }
          RLEStream.Seek(-Integer(ImageSize), soFromEnd);
          Stream := RLEStream;  // the rest of the proc reads from RLEStream
        end;
      end;

      with bmiHeader do
      begin
        biSize := HeaderSize;
        ColorTable := Pointer(Longint(BitmapInfo) + HeaderSize);

        { check number of planes. DIBs must be 1 color plane (packed pixels) }
        if biPlanes <> 1 then InvalidBitmap;

        // 3 DWORD color element bit masks (ie 888 or 565) can precede colors
        // TBitmapInfoHeader sucessors include these masks in the headersize
        if (HeaderSize = sizeof(TBitmapInfoHeader)) and
          ((biBitCount = 16) or (biBitCount = 32)) and
          (biCompression = BI_BITFIELDS) then
        begin
          Stream.ReadBuffer(ColorTable^, 3 * sizeof(DWORD));
          Inc(Longint(ColorTable), 3 * sizeof(DWORD));
          Dec(ImageSize, 3 * sizeof(DWORD));
        end;

        // Read the color palette
        if biClrUsed = 0 then
          biClrUsed := GetDInColors(biBitCount);

        if (biClrUsed * DIBPalSizes[OS2Format]) > (256 * SizeOf(TRGBQuad)) then    //追加
          InvalidGraphic({$IFNDEF CLR}@{$ENDIF}SInvalidBitmap);                    //追加

        Stream.ReadBuffer(ColorTable^, biClrUsed * DIBPalSizes[OS2Format]);
        Dec(ImageSize, biClrUsed * DIBPalSizes[OS2Format]);

        // biSizeImage can be zero. If zero or RGB, compute the size.
        if (biSizeImage = 0) or (biCompression = BI_RGB) then // top-down DIBs have negative height
          biSizeImage := BytesPerScanLine(biWidth, biBitCount, 32) * Abs(biHeight);

        if biSizeImage < ImageSize then ImageSize := biSizeImage;
      end;

 { 以下略 }
end;
AuthorPortraitAlt
著者
iPentecのメインプログラマー
C#, ASP.NET の開発がメイン、少し前まではDelphiを愛用
作成日: 2007-01-01
Copyright © 1995–2025 iPentec all rights reserverd.