Try this one:

[pascal]
{------------------------------------------------------------------}
{ Load BMP Texture }
{------------------------------------------------------------------}
function LoadBMPTexture(Filename: Tstream; var Texture: GLuint): Boolean;
var
FileHeader: TBITMAPFILEHEADER;
InfoHeader: TBITMAPINFOHEADER;
Palette: array of RGBQUAD;
BitmapLength: LongWord;
PaletteLength: LongWord;
ReadBytes: LongWord;
TextureImage: TTextureImage;
begin
LoadBMPTexture:=False;
// Get header information
Filename.Read(FileHeader, SizeOf(FileHeader));
Filename.Read(InfoHeader, SizeOf(InfoHeader));
// Get palette
PaletteLength := InfoHeader.biClrUsed;
SetLength(Palette, PaletteLength);
ReadBytes:=Filename.Read(Palette,PaletteLength);
if (ReadBytes <> PaletteLength) then
begin
MessageBox(0, PChar('Error reading palette'), PChar('BMP Loader'), MB_OK);
Exit;
end;
textureimage.Width := InfoHeader.biWidth;
textureimage.Height := InfoHeader.biHeight;
BitmapLength := InfoHeader.biSizeImage;
if BitmapLength = 0 then
BitmapLength := Textureimage.Width * Textureimage.Height * InfoHeader.biBitCount Div 8;
// Get the actual pixel data
GetMem(textureimage.imageData, BitmapLength);
ReadBytes:=Filename.Read(textureimage.imagedata^, BitmapLength);
if (ReadBytes <> BitmapLength) then
begin
MessageBox(0, PChar('Error reading bitmap data'), PChar('BMP Unit'), MB_OK);
Exit;
end;
//BMP files are stored BGR so use GL_BGR
Texture:=CreateTexture(textureimage.width, textureimage.height, GL_BGR, textureimage.imagedata);
//clean up
FreeMem(textureimage.imageData)
end;
[/pascal]

You may want to remove opengl specifcs like the call to CreateTexture.