Changeset 3737 for trunk/src


Ignore:
Timestamp:
Jun 21, 2000, 8:39:32 PM (25 years ago)
Author:
phaller
Message:

Fix: CRTDLLclose corrupted FS:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/crtdll/crtdll.cpp

    r3370 r3737  
    1 /* $Id: crtdll.cpp,v 1.25 2000-04-13 18:46:15 sandervl Exp $ */
     1/* $Id: crtdll.cpp,v 1.26 2000-06-21 18:39:32 phaller Exp $ */
    22
    33/*
     
    66 * Implements C run-time functionality as known from UNIX.
    77 *
    8  * TODO: Check setjmp(3)
     8 * TODO:
     9 *   - Check setjmp(3)
     10 *   - fix *ALL* functions for the FS: wrapper problem
    911 *
    1012 * Partialy based on Wine
     
    1719 */
    1820
     21
     22#include <odin.h>
     23#include <odinwrap.h>
     24#include <os2sel.h>
     25
     26
     27
    1928#include <os2win.h>
    2029#include <stdio.h>
    2130#include <stdlib.h>
    2231#include <string.h>
    23 #include <odinwrap.h>
    2432#include <misc.h>
    2533#include <unicode.h>
     
    5664
    5765
    58 DEFAULT_DEBUG_CHANNEL(crtdll)
     66ODINDEBUGCHANNEL(CRTDLL)
     67
     68
     69
     70#define FS_OS2   unsigned short sel = RestoreOS2FS();
     71#define FS_WIN32 SetFS(sel);
     72
     73#define dprintf2 dprintf
    5974
    6075
     
    6479BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    6580{
    66         if (fdwReason == DLL_PROCESS_ATTACH) {
    67                 _fdopen(0,"r");
    68                 _fdopen(1,"w");
    69                 _fdopen(2,"w");
    70                 CRTDLL_hHeap = HeapCreate(0, 0x10000, 0);
    71         }
    72         else
    73         if (fdwReason == DLL_PROCESS_DETACH) {
    74                 HeapDestroy(CRTDLL_hHeap);
    75                 CRTDLL_hHeap = 0;
    76         }       
    77         return TRUE;
     81  FS_OS2
     82   
     83    if (fdwReason == DLL_PROCESS_ATTACH) {
     84      _fdopen(0,"r");
     85      _fdopen(1,"w");
     86      _fdopen(2,"w");
     87      CRTDLL_hHeap = HeapCreate(0, 0x10000, 0);
     88    }
     89    else
     90      if (fdwReason == DLL_PROCESS_DETACH) {
     91        HeapDestroy(CRTDLL_hHeap);
     92        CRTDLL_hHeap = 0;
     93      }
     94 
     95  FS_WIN32
     96  return TRUE;
    7897}
    7998
     
    674693{
    675694  dprintf2(("CRTDLL: _close\n"));
    676   return (_close(handle));
     695 
     696  return CloseHandle(handle);
    677697}
    678698
Note: See TracChangeset for help on using the changeset viewer.