소스 검색

* DLL crash fixed : ExitProcess can not be called in DLL system_exit
Problem : Halt or RunError code inside DLL will return to caller !!
* Changed the "if h<4 then" into "if do_isdevice(h) then " in do_close
to avoid closing of standard files

pierre 25 년 전
부모
커밋
5cf8dc7d80
1개의 변경된 파일19개의 추가작업 그리고 8개의 파일을 삭제
  1. 19 8
      rtl/win32/syswin32.pp

+ 19 - 8
rtl/win32/syswin32.pp

@@ -330,10 +330,15 @@ begin
      if p[i]='/' then p[i]:='\';
 end;
 
+function do_isdevice(handle:longint):boolean;
+begin
+  do_isdevice:=(getfiletype(handle)=2);
+end;
+
 
 procedure do_close(h : longint);
 begin
-  if H<=4 then
+  if do_isdevice(h) then
    exit;
   CloseHandle(h);
 end;
@@ -549,11 +554,6 @@ begin
 end;
 
 
-function do_isdevice(handle:longint):boolean;
-begin
-  do_isdevice:=(getfiletype(handle)=2);
-end;
-
 
 
 {*****************************************************************************
@@ -751,6 +751,11 @@ end;
 *****************************************************************************}
 Procedure system_exit;
 begin
+  { don't call ExitProcess inside
+    the DLL exit code !!
+    This crashes Win95 at least PM }
+  if IsLibrary then
+    Exit;
   if not IsConsole then
    begin
      Close(stderr);
@@ -1161,7 +1166,13 @@ end.
 
 {
   $Log$
-  Revision 1.56  2000-01-16 23:05:03  peter
+  Revision 1.57  2000-01-18 09:03:04  pierre
+    * DLL crash fixed : ExitProcess can not be called in DLL system_exit
+      Problem : Halt or RunError code inside DLL will return to caller !!
+    * Changed the "if h<4 then" into "if do_isdevice(h) then " in do_close
+      to avoid closing of standard files
+
+  Revision 1.56  2000/01/16 23:05:03  peter
     * fixed typo
 
   Revision 1.55  2000/01/16 22:25:38  peter
@@ -1333,4 +1344,4 @@ end.
 
   Revision 1.3  1998/04/26 21:49:57  florian
     + more stuff added (??dir procedures etc.)
-}
+}