[Bug 788] New: - Delphi command line program gives err:dosmem:dos_mem Cannot use first megabyte for DOS address space, please report

wine-bugs at winehq.com wine-bugs at winehq.com
Wed Jun 12 08:10:54 CDT 2002


http://bugs.winehq.com/show_bug.cgi?id=788

           Summary: Delphi command line program gives err:dosmem:dos_mem
                    Cannot use first megabyte for DOS address space, please
                    report
           Product: Wine
           Version: CVS
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: wine-dos
        AssignedTo: wine-bugs at winehq.com
        ReportedBy: gary at evalunet.co.za


The delphi program below gives the error when run with wine:

gary at larry:~/tmp/brainy$ wine -- tools/MakeMakefiles/MakeMakefiles.exe
err:dosmem:setup_dos_mem Cannot use first megabyte for DOS address space, 
please report
gary at larry:~/tmp/brainy$ wine --version
Wine 20020605

-- Contents of MakeMakefiles.dpr --
program MakeMakefiles;

uses
  Classes, SysUtils, Windows;

const tabchar = #9;

function SubstSpaceIn(s: string; subs: string): string;
var
  i : Integer;
begin
  Result := '';
  for i := 1 to Length(s) do
    if (s[i] <> ' ') then
      Result := Result + s[i]
    else
      Result := Result + subs;
end;


procedure WriteSubdirs(var tf: TextFile; DirList: TStringList);
var
  i : Integer;
begin
  if (DirList.Count = 0) then
  begin
    Writeln(tf,'SUBDIRS = ');
    Exit;
  end;
  Writeln(tf,'SUBDIRS = \');
  for i := 0 to DirList.Count-1 do
    Writeln(tf,'          ' + SubstSpaceIn(DirList[i],'_') + '\');
end;

function GetTargetList(DprList: TStringList): string;
var
  i: Integer;
begin
  Result := '';
  for i := 0 to DprList.Count-1 do
    Result := Result + ChangeFileExt(DprList[i],'.exe') + ' ';
  Result := Trim(Result);
end;

procedure WriteUnsafeDirs(var tf: TextFile; DirList: TStringList);
var
  i: Integer;
begin
  for i := 0 to DirList.Count-1 do
    if (DirList[i] <> SubstSpaceIn(DirList[i],'_')) then
    begin
      Writeln(tf,SubstSpaceIn(DirList[i],'_')+':');
      Writeln(tf,tabchar + 'ln -s ' + SubstSpaceIn(DirList[i],'\ ') +
        ' ' + SubstSpaceIn(DirList[i],'_'));
    end;
end;

function GetUnsafeDirs(DirList: TStringList) : string;
var
  i: Integer;
begin
  Result := '';
  for i := 0 to DirList.Count-1 do
    if (DirList[i] <> SubstSpaceIn(DirList[i],'_')) then
      Result := Result + SubstSpaceIn(DirList[i],'_') + ' ';
  Result := Trim(Result);
end;

procedure WriteMakefiles(dir : string; DprList, DirList : TStringList);
var
  tf : TextFile;
begin
  AssignFile(tf, dir + 'Makefile');
  Rewrite(tf);
  Writeln(tf,'RM=rm -f');
  Writeln(tf,'DCC = wine -- /usr/local/delphi/Bin/dcc32.exe');
  Writeln(tf,'TODOS = todos');
  Writeln(tf,'FROMDOS = fromdos');
  Writeln(tf,'CONVERT = wine -- /usr/local/delphi/Bin/convert.exe -i -t');
  Writeln(tf,'');
  Writeln(tf,'PASFILES = $(wildcard *.pas)');
  Writeln(tf,'DPRFILES = $(wildcard *.dpr)');
  Writeln(tf,'DFMFILES = $(wildcard *.dfm)');
  Writeln(tf,'DOFFILES = $(wildcard *.dof)');
  Writeln(tf,'CFGFILES = $(wildcard *.cfg)');
  Writeln(tf,'SRCFILES = $(PASFILES) $(DFMFILES) $(DPRFILES) $(DOFFILES) 
$(CFGFILES)');
  WriteSubdirs(tf,DirList);
  Writeln(tf,'');
  Writeln(tf,'.PHONY: all clean convert convertfiles dummy fixup fixuphere 
fromdos  todos');
  Writeln(tf,'');
  Writeln(tf,'all: $(SUBDIRS) ' + GetTargetList(DprList));
  Writeln(tf,'');
  Writeln(tf,'dummy:');
  Writeln(tf,'');
  Writeln(tf,'fixuphere: dummy');
  Writeln(tf,tabchar + 'make -f Makefile.fixup fixup');
  Writeln(tf,'');
  Writeln(tf,'fixup: fixuphere $(SUBDIRS:%=%/__fixup__)');
  Writeln(tf,'');
  Writeln(tf,'%.exe : %.dpr');
  Writeln(tf,tabchar + '$(DCC) $<');
  Writeln(tf,'');
  Writeln(tf,'$(SUBDIRS): dummy');
  Writeln(tf,tabchar + '@cd $@ && $(MAKE)');
  Writeln(tf,'');
  Writeln(tf,'$(SUBDIRS:%=%/__clean__): dummy');
  Writeln(tf,tabchar + 'cd `dirname $@` && $(MAKE) clean');
  Writeln(tf,'');
  Writeln(tf,'$(SUBDIRS:%=%/__todos__): dummy');
  Writeln(tf,tabchar + 'cd `dirname $@` && $(MAKE) todos');
  Writeln(tf,'');
  Writeln(tf,'$(SUBDIRS:%=%/__fromdos__): dummy');
  Writeln(tf,tabchar + 'cd `dirname $@` && $(MAKE) fromdos');
  Writeln(tf,'');
  Writeln(tf,'$(SUBDIRS:%=%/__convert__): dummy');
  Writeln(tf,tabchar + 'cd `dirname $@` && $(MAKE) convert');
  Writeln(tf,'');
  Writeln(tf,'$(SUBDIRS:%=%/__precvsclean__): dummy');
  Writeln(tf,tabchar + 'cd `dirname $@` && $(MAKE) precvsclean');
  Writeln(tf,'');
  Writeln(tf,'$(SUBDIRS:%=%/__fixup__): dummy');
  Writeln(tf,tabchar + 'cd `dirname $@` && $(MAKE) fixup');
  Writeln(tf,'');
  Writeln(tf,'$(SRCFILES:%=%/__todos__): dummy');
  Writeln(tf,tabchar + '$(TODOS) `dirname $@`');
  Writeln(tf,'');
  Writeln(tf,'$(SRCFILES:%=%/__fromdos__): dummy');
  Writeln(tf,tabchar + '$(FROMDOS) `dirname $@`');
  Writeln(tf,'');
  Writeln(tf,'convertfiles: $(DFMFILES)');
  Writeln(tf,tabchar + '$(CONVERT) $^');
  Writeln(tf,'');
  Writeln(tf,'clean: $(SUBDIRS:%=%/__clean__)');
  Writeln(tf,tabchar + '$(RM) *.dcu *.exe');
  Writeln(tf,'');
  Writeln(tf,'todos: $(SUBDIRS:%=%/__todos__) $(SRCFILES:%=%/__todos__)');
  Writeln(tf,'fromdos: $(SUBDIRS:%=%/__fromdos__) $(SRCFILES:%=%/__fromdos__)');
  Writeln(tf,'convert: $(SUBDIRS:%=%/__convert__) convertfiles');
  CloseFile(tf);

  AssignFile(tf, dir + 'Makefile.fixup');
  Rewrite(tf);
  Writeln(tf,'fixup: dummy ' + GetUnsafeDirs(DirList));
  Writeln(tf,'.phony: dummy fixup');
  Writeln(tf,'dummy:');
  Writeln(tf,'');
  WriteUnsafeDirs(tf,DirList);
  CloseFile(tf);
end;

procedure ProcessDirectory(dir : string);
var
  FindFileData   : WIN32_FIND_DATA;
  hFind          : THandle;
  res            : BOOL;
  attrs          : DWORD;
  DprList       : TStringList;
  DirList        : TStringList;
begin
  DprList := TStringList.Create;
  DirList := TStringList.Create;
  hFind := FindFirstFile(PChar(dir + '*.*'), FindFileData);
  if (hFind <> INVALID_HANDLE_VALUE) then
    res := True
  else
    res := False;
  while (res)do
  begin
    if (('.' <> string(FindFileData.cFileName)) and
        (string(FindFileData.cFileName) <> '..') and
        (string(FindFileData.cFileName) <> 'CVS') and
        (string(FindFileData.cFileName) <> 'Data') and
        (string(FindFileData.cFileName) <> 'Output')) then
    begin
      attrs := GetFileAttributes(PChar(dir + FindFileData.cFileName));
      if ((attrs and FILE_ATTRIBUTE_DIRECTORY) = FILE_ATTRIBUTE_DIRECTORY) then
      begin
        ProcessDirectory(IncludeTrailingBackslash(dir + 
FindFileData.cFileName));
        DirList.Add(FindFileData.cFileName);
      end else
        if (UpperCase(ExtractFileExt(FindFileData.cFileName)) = '.DPR') then
          DprList.Add(FindFileData.cFileName);
    end;
    res := FindNextFile(hFind, FindFileData);
  end;
  Windows.FindClose(hFind);
  WriteMakefiles(dir,DprList,DirList);
  DprList.Free;
  DirList.Free;
end;

begin
  if (ParamCount <> 1) then
    Exit;
  ProcessDirectory(IncludeTrailingBackslash(ParamStr(1)));
end.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://bugs.winehq.com/show_bug.cgi?id=788>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.



More information about the wine-bugs mailing list