Changeset 126 for trunk/src


Ignore:
Timestamp:
Jun 20, 1999, 12:55:37 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

Location:
trunk/src/kernel32
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.DEF

    r115 r126  
    1 ; $Id: KERNEL32.DEF,v 1.11 1999-06-17 22:06:10 phaller Exp $
     1; $Id: KERNEL32.DEF,v 1.12 1999-06-20 10:55:35 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    964964   GetFS                = GetFS                                    @1226
    965965   SetFS                = SetFS                                    @1227
     966
     967   RestoreOS2TIB        = _RestoreOS2TIB@0                         @1228
     968   SetWin32TIB          = _SetWin32TIB@0                           @1229
  • trunk/src/kernel32/conwin.h

    r111 r126  
    1 /* $Id: conwin.h,v 1.1 1999-06-17 18:22:43 phaller Exp $ */
     1/* $Id: conwin.h,v 1.2 1999-06-20 10:55:36 sandervl Exp $ */
    22
    33#ifndef _CONWIN_H_
    44#define _CONWIN_H_
    5 
    6 #ifndef _FILETIME_
    7 #define _FILETIME_
    8 /* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */
    9 typedef struct
    10 {
    11   DWORD  dwLowDateTime;
    12   DWORD  dwHighDateTime;
    13 } FILETIME, *LPFILETIME;
    14 #endif /* _FILETIME_ */
    15 
    16 typedef struct
    17 {
    18   int dwFileAttributes;
    19   FILETIME ftCreationTime;
    20   FILETIME ftLastAccessTime;
    21   FILETIME ftLastWriteTime;
    22   int dwVolumeSerialNumber;
    23   int nFileSizeHigh;
    24   int nFileSizeLow;
    25   int nNumberOfLinks;
    26   int nFileIndexHigh;
    27   int nFileIndexLow;
    28 } BY_HANDLE_FILE_INFORMATION ;
    29 
    30 
    31 #define OFS_MAXPATHNAME 128
    32 typedef struct
    33 {
    34     BYTE cBytes;
    35     BYTE fFixedDisk;
    36     WORD nErrCode;
    37     BYTE reserved[4];
    38     BYTE szPathName[OFS_MAXPATHNAME];
    39 } OFSTRUCT, *LPOFSTRUCT;
    40 
    41 
    42 /* The security attributes structure */
    43 typedef struct
    44 {
    45     DWORD   nLength;
    46     LPVOID  lpSecurityDescriptor;
    47     BOOL  bInheritHandle;
    48 } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
    495
    506#ifndef INVALID_HANDLE_VALUE
  • trunk/src/kernel32/except.h

    r123 r126  
    1 /* $Id: except.h,v 1.4 1999-06-19 13:57:51 sandervl Exp $ */
     1/* $Id: except.h,v 1.5 1999-06-20 10:55:36 sandervl Exp $ */
    22
    33/*
     
    1414
    1515//SvL: Replace original startup code exception handler
     16#ifndef WIN32_TIBSEL
    1617void  ReplaceExceptionHandler(void);
     18void  ChangeTIBStack();
     19#endif
     20void __cdecl SetExceptionChain(DWORD);
     21
    1722void  DisableFPUExceptions();
    18 void __cdecl SetExceptionChain(DWORD);
    19 void  ChangeTIBStack();
    2023ULONG GetDllEntryPoint();
    2124
  • trunk/src/kernel32/initterm.cpp

    r123 r126  
    1 /* $Id: initterm.cpp,v 1.4 1999-06-19 13:57:51 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.5 1999-06-20 10:55:36 sandervl Exp $ */
    22
    33/*
     
    3434#include <misc.h>
    3535#include <wprocess.h>
     36#include <handlemanager.h>
    3637
    3738extern "C" {
     
    130131
    131132            InitializeTIB(TRUE);
     133            //SvL: Do it here instead of during the exe object creation
     134            //(std handles can be used in win32 dll initialization routines
     135            HMInitialize();             /* store standard handles within HandleManager */
    132136            break;
    133137        case 1 :
  • trunk/src/kernel32/kernel32exp.def

    r100 r126  
    1 ; $Id: kernel32exp.def,v 1.4 1999-06-10 20:47:59 phaller Exp $
     1; $Id: kernel32exp.def,v 1.5 1999-06-20 10:55:36 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    830830GetFS                                      @1226
    831831SetFS                                      @1227
     832_RestoreOS2TIB@0                         @1228
     833_SetWin32TIB@0                           @1229
  • trunk/src/kernel32/makefile

    r125 r126  
    1 # $Id: makefile,v 1.7 1999-06-19 17:58:32 sandervl Exp $
     1# $Id: makefile,v 1.8 1999-06-20 10:55:36 sandervl Exp $
    22
    33#
     
    9595    $(PDWIN32_INCLUDE)\unicode.h \
    9696    heap.h \
    97     wprocess.h \
     97    $(PDWIN32_INCLUDE)\wprocess.h \
    9898    os2util.h \
    9999    $(PDWIN32_INCLUDE)\nameid.h
     
    232232lfile.OBJ: \
    233233    .\lfile.cpp \
    234     wprocess.h \
     234    $(PDWIN32_INCLUDE)\wprocess.h \
    235235    os2util.h
    236236
  • trunk/src/kernel32/thread.H

    r125 r126  
    1 /* $Id: thread.H,v 1.4 1999-06-19 17:58:33 sandervl Exp $ */
     1/* $Id: thread.H,v 1.5 1999-06-20 10:55:36 sandervl Exp $ */
    22
    3 /*
    4  *
    5  * Project Odin Software License can be found in LICENSE.TXT
    6  *
    7  */
    83/*
    94 * Win32 Thread API functions
    105 *
    116 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
     7 *
     8 *
     9 * Project Odin Software License can be found in LICENSE.TXT
    1210 *
    1311 */
  • trunk/src/kernel32/thread.cpp

    r125 r126  
    1 /* $Id: thread.cpp,v 1.5 1999-06-19 17:58:33 sandervl Exp $ */
     1/* $Id: thread.cpp,v 1.6 1999-06-20 10:55:36 sandervl Exp $ */
    22
    3 /*
    4  *
    5  * Project Odin Software License can be found in LICENSE.TXT
    6  *
    7  */
    83/*
    94 * Win32 Thread API functions
    105 *
    116 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
     7 *
     8 *
     9 * Project Odin Software License can be found in LICENSE.TXT
    1210 *
    1311 */
     
    161159
    162160#ifdef WIN32_TIBSEL
     161  TEB *winteb = (TEB *)InitializeTIB();
     162  if(winteb == NULL) {
     163        dprintf(("Win32ThreadProc: InitializeTIB failed!!"));
     164        DebugInt3();
     165        return 0;
     166  }
     167  winteb->flags = me->dwFlags;
     168
     169  THDB *thdb   = (THDB *)(winteb+1);
     170  thdb->entry_point = (void *)winthread;
     171  thdb->entry_arg   = (void *)userdata;
     172  SetWin32TIB();
    163173#else
    164174  ReplaceExceptionHandler();
  • trunk/src/kernel32/winexe.cpp

    r120 r126  
    1 /* $Id: winexe.cpp,v 1.6 1999-06-19 10:54:43 sandervl Exp $ */
     1/* $Id: winexe.cpp,v 1.7 1999-06-20 10:55:36 sandervl Exp $ */
    22
    33/*
     
    2121#include <iostream.h>
    2222#include <fstream.h>
    23 #include "misc.h"
    24 #include "nameid.h"
    25 #include "win32type.h"
     23#include <misc.h>
     24#include <nameid.h>
     25#include <win32type.h>
    2626#include <winexe.h>
    27 #include "wprocess.h"
    28 #include "pefile.h"
     27#include <wprocess.h>
     28#include <pefile.h>
    2929#include "cio.h"
    3030
    3131#include "conwin.h"          // Windows Header for console only
    3232#include "console.h"
    33 #include "handlemanager.h"
    34 
    3533
    3634Win32Exe *WinExe = NULL;
     
    4644  dprintf(("Win32Exe ctor: %s", szFileName));
    4745
    48   HMInitialize();             /* store standard handles within HandleManager */
    49   dprintf(("KERNEL32/WINEXE: HandleManager Initialized.\n"));
    5046  if(fConsoleApp) {
    5147   dprintf(("Console application!\n"));
     
    6258         fConsoleApp(FALSE), cmdline(NULL), OS2InstanceHandle(-1)
    6359{
    64   HMInitialize();             /* store standard handles within HandleManager */
    65   dprintf(("KERNEL32/WINEXE: HandleManager Initialized.\n"));
    66 
    6760  if(GET_CONSOLE(Win32TableId) == 1) {//console app
    6861   dprintf(("Console application!\n"));
     
    8679ULONG Win32Exe::start()
    8780{
     81 ULONG rc;
     82
    8883  if(getenv("WIN32_IOPL2")) {
    8984   io_init1();
     
    9287
    9388  fExeStarted  = TRUE;
    94   return ((WIN32EXEENTRY)entryPoint)();
     89  SetWin32TIB();
     90  rc = ((WIN32EXEENTRY)entryPoint)();
     91  RestoreOS2TIB();
     92  return rc;
    9593}
    9694//******************************************************************************
  • trunk/src/kernel32/wprocess.cpp

    r125 r126  
    1 /* $Id: wprocess.cpp,v 1.10 1999-06-19 17:58:33 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.11 1999-06-20 10:55:36 sandervl Exp $ */
    22
    33/*
     
    2828#include "cio.h"
    2929#include "versionos2.h"    /*PLF Wed  98-03-18 02:36:51*/
    30 
    31 #include <winprocess.h>
    32 #include <thread.h>
     30#include <wprocess.h>
    3331
    3432BOOL      fExeStarted = FALSE;
     
    4341// Set up the TIB selector and memory for the current thread
    4442//******************************************************************************
    45 void InitializeTIB(BOOL fMainThread)
     43TEB *InitializeTIB(BOOL fMainThread)
    4644{
    4745#ifdef WIN32_TIBSEL
     
    5654        dprintf(("InitializeTIB: local thread memory alloc failed!!"));
    5755        DebugInt3();
    58         return;
     56        return NULL;
    5957   }
    6058   if(OS2AllocSel(PAGE_SIZE, &tibsel) == FALSE)
     
    6260        dprintf(("InitializeTIB: selector alloc failed!!"));
    6361        DebugInt3();
    64         return;
     62        return NULL;
    6563   }
    6664   winteb = (TEB *)OS2SelToFlat(tibsel);
     
    6967        dprintf(("InitializeTIB: DosSelToFlat failed!!"));
    7068        DebugInt3();
    71         return;
     69        return NULL;
    7270   }
    7371   memset(winteb, 0, PAGE_SIZE);
    7472   thdb       = (THDB *)(winteb+1);
    75    TIBFlatPtr = (DWORD)winteb;
     73   TIBFlatPtr = (DWORD *)winteb;
    7674
    7775   winteb->except      = (PVOID)-1;               /* 00 Head of exception handling chain */
     
    105103        ProcessTIBSel = tibsel;
    106104   }
    107    SetFS(tibsel);
    108    dprintf(("InitializeTIB set up TEB with selector %x", tibsel));
    109    return;
     105   dprintf(("InitializeTIB setup TEB with selector %x", tibsel));
     106   return winteb;
     107#else
     108   return 0;
    110109#endif
    111110}
     
    133132        OS2FreeSel(thdb->teb_sel);
    134133   }
    135    else DebugInt3();
    136 
     134   else dprintf(("Already destroyed TIB"));
     135
     136   TIBFlatPtr = NULL;
    137137   return;
     138#endif
     139}
     140/******************************************************************************/
     141/******************************************************************************/
     142void WIN32API RestoreOS2TIB()
     143{
     144#ifdef WIN32_TIBSEL
     145 SHORT  orgtibsel;
     146 TEB   *winteb;
     147 THDB  *thdb;
     148
     149   winteb = (TEB *)TIBFlatPtr;
     150   if(winteb) {
     151        thdb = (THDB *)(winteb+1);
     152        orgtibsel = thdb->OrgTIBSel;
     153
     154        //Restore our original FS selector
     155        SetFS(orgtibsel);
     156   }
     157#endif
     158}
     159/******************************************************************************/
     160/******************************************************************************/
     161void WIN32API SetWin32TIB()
     162{
     163#ifdef WIN32_TIBSEL
     164 SHORT  win32tibsel;
     165 TEB   *winteb;
     166 THDB  *thdb;
     167
     168   winteb = (TEB *)TIBFlatPtr;
     169   if(winteb) {
     170        thdb = (THDB *)(winteb+1);
     171        win32tibsel = thdb->teb_sel;
     172
     173        //Restore our win32 FS selector
     174        SetFS(win32tibsel);
     175   }
     176   else DebugInt3();
    138177#endif
    139178}
     
    175214                    HINSTANCE hinstance)
    176215{
    177 #ifdef WIN32_TIBSEL
    178   SetFS(ProcessTIBSel);
    179 #endif
     216  SetWin32TIB();
    180217
    181218  if(getenv("WIN32_IOPL2")) {
     
    217254//******************************************************************************
    218255VOID WIN32API RegisterDll(LONG Win32TableId, LONG NameTableId,
    219                   LONG VersionResId, LONG Pe2lxVersion,
    220               HINSTANCE hinstance)
     256                          LONG VersionResId, LONG Pe2lxVersion,
     257                          HINSTANCE hinstance)
    221258{
    222259 WIN32DLLENTRY  pfnDllEntry;
     
    237274  /* @@@PH 1998/03/17 console devices initialization */
    238275  iConsoleDevicesRegister();
     276
     277  SetWin32TIB();
     278  dprintf(("RegisterDll: FS = %x", GetFS()));
    239279}
    240280//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.