Changeset 10606 for trunk/src


Ignore:
Timestamp:
May 24, 2004, 10:56:07 AM (21 years ago)
Author:
sandervl
Message:

KOM: Updates

Location:
trunk/src/kernel32
Files:
6 edited

Legend:

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

    r10437 r10606  
    1 ; $Id: KERNEL32.DEF,v 1.163 2004-01-31 02:05:06 bird Exp $
     1; $Id: KERNEL32.DEF,v 1.164 2004-05-24 08:56:05 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    12111211    OSLibDosDevIOCtl                                              @2026 NONAME
    12121212
     1213    OSLibImSetMsgQueueProperty                                    @2029 NONAME
     1214
    12131215    fIsDBCSEnv                                                    @2103 NONAME
    12141216
  • trunk/src/kernel32/initkernel32.cpp

    r10528 r10606  
    1 /* $Id: initkernel32.cpp,v 1.27 2004-03-16 13:34:23 sandervl Exp $
     1/* $Id: initkernel32.cpp,v 1.28 2004-05-24 08:56:06 sandervl Exp $
    22 *
    33 * KERNEL32 DLL entry point
     
    6060#include <stats.h>
    6161#include <heapshared.h>
     62#include <heapstring.h>
    6263
    6364#define DBG_LOCALLOG    DBG_initterm
     
    7071 extern DWORD kernel32_PEResTab;
    7172}
     73
     74extern PFN pfnImSetMsgQueueProperty;
    7275
    7376       ULONG   flAllocMem = 0;    /* flag to optimize DosAllocMem to use all the memory on SMP machines */
     
    7881       BOOL    fInit     = FALSE;
    7982       BOOL    fWin32k   = FALSE;
     83       HMODULE imHandle = 0;
     84       char    szModName[ 256 ] = "";
    8085
    8186/****************************************************************************/
     
    150155            //(std handles can be used in win32 dll initialization routines
    151156            HMInitialize();             /* store standard handles within HandleManager */
    152            
     157
    153158            // VP: Shared heap should be initialized before call to PROFILE_*
    154159            // because they use a critical section which in turn uses smalloc
     
    215220            /* Setup codepage info */
    216221            CODEPAGE_Init();
     222
     223            if( IsDBCSEnv() && DosLoadModule( szModName, sizeof( szModName ), "OS2IM.DLL", &imHandle ) == 0 )
     224                DosQueryProcAddr( imHandle, 140, NULL, &pfnImSetMsgQueueProperty );
    217225
    218226            InitSystemInfo(ulSysinfo);
     
    256264    dprintf(("kernel32 exit %d\n", ulReason));
    257265
     266    if( IsDBCSEnv() && imHandle )
     267        DosFreeModule( imHandle );
     268
    258269    //Flush and delete all open memory mapped files
    259270    Win32MemMap::deleteAll();
  • trunk/src/kernel32/kernel32dbg.def

    r10437 r10606  
    1 ; $Id: kernel32dbg.def,v 1.38 2004-01-31 02:05:05 bird Exp $
     1; $Id: kernel32dbg.def,v 1.39 2004-05-24 08:56:06 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    12111211    OSLibDosDevIOCtl                                              @2026 NONAME
    12121212
     1213    OSLibImSetMsgQueueProperty                                    @2029 NONAME
     1214
    12131215    fIsDBCSEnv                                                    @2103 NONAME
    12141216
  • trunk/src/kernel32/oslibmisc.cpp

    r9890 r10606  
    1 /* $Id: oslibmisc.cpp,v 1.18 2003-03-03 16:38:20 sandervl Exp $ */
     1/* $Id: oslibmisc.cpp,v 1.19 2004-05-24 08:56:07 sandervl Exp $ */
    22/*
    33 * Misc OS/2 util. procedures
     
    1717#define INCL_DOSSEL
    1818#define INCL_DOSNLS        /* National Language Support values */
    19 #include <os2wrap.h>    //Odin32 OS/2 api wrappers
     19#include <os2wrap.h>    //Odin32 OS/2 api wrappers
    2020#include <string.h>
    2121#include <stdlib.h>
     
    2424#include "oslibmisc.h"
    2525#include <misc.h>
    26 
    27 #define DBG_LOCALLOG    DBG_oslibmisc
     26#include <heapstring.h>
     27
     28#define DBG_LOCALLOG    DBG_oslibmisc
    2829#include "dbglocal.h"
    2930
     31typedef APIRET ( APIENTRY *PFN_IMSETMSGQUEUEPROPERTY )( HMQ, ULONG );
     32
     33PFN_IMSETMSGQUEUEPROPERTY pfnImSetMsgQueueProperty = NULL;
     34
    3035//******************************************************************************
    3136//TODO: not reentrant!
     
    3641
    3742  if(DosQueryModuleName(hModule, CCHMAXPATH, modname) != 0) {
    38         return NULL;
     43    return NULL;
    3944  }
    4045  return(modname);
     
    187192   rc = DosGetInfoBlocks(&ptib, &ppib);
    188193   if(rc) {
    189         return 0;
     194    return 0;
    190195   }
    191196   switch(tiboff)
    192197   {
    193         case TIB_STACKTOP:
    194                 return (ULONG)ptib->tib_pstacklimit;
    195         case TIB_STACKLOW:
    196                 return (ULONG)ptib->tib_pstack;
    197         default:
    198                 return 0;
     198    case TIB_STACKTOP:
     199        return (ULONG)ptib->tib_pstacklimit;
     200    case TIB_STACKLOW:
     201        return (ULONG)ptib->tib_pstack;
     202    default:
     203        return 0;
    199204   }
    200205}
     
    217222    if (rc)
    218223    {
    219             dprintf(("KERNEL32: OSLibGetPIB(%d): DosGetInfoBlocks failed with rc=%d\n", iPIB, rc));
     224        dprintf(("KERNEL32: OSLibGetPIB(%d): DosGetInfoBlocks failed with rc=%d\n", iPIB, rc));
    220225        return 0;
    221226    }
     
    248253   rc = DosAllocThreadLocalMemory(nrdwords, &thrdaddr);
    249254   if(rc) {
    250         dprintf(("DosAllocThreadLocalMemory failed %d", rc));
    251         return 0;
     255    dprintf(("DosAllocThreadLocalMemory failed %d", rc));
     256    return 0;
    252257   }
    253258   return (ULONG)thrdaddr;
     
    335340BOOL OSLibDisablePopups()
    336341{
    337    return DosError(FERR_DISABLEEXCEPTION | FERR_DISABLEHARDERR) == NO_ERROR;   
    338 }
    339 //******************************************************************************
    340 //******************************************************************************
     342   return DosError(FERR_DISABLEEXCEPTION | FERR_DISABLEHARDERR) == NO_ERROR;
     343}
     344//******************************************************************************
     345//******************************************************************************
     346ULONG OSLibImSetMsgQueueProperty( ULONG hmq, ULONG ulFlag )
     347{
     348    USHORT sel;
     349    APIRET rc;
     350
     351    if( !pfnImSetMsgQueueProperty )
     352        return 1;
     353
     354    sel = RestoreOS2FS();
     355    rc = pfnImSetMsgQueueProperty( hmq, ulFlag );
     356    SetFS( sel );
     357
     358    return rc;
     359}
     360//******************************************************************************
     361//******************************************************************************
     362
  • trunk/src/kernel32/oslibmisc.h

    r10339 r10606  
    1 /* $Id: oslibmisc.h,v 1.13 2003-11-21 11:29:33 sandervl Exp $ */
     1/* $Id: oslibmisc.h,v 1.14 2004-05-24 08:56:07 sandervl Exp $ */
    22/*
    33 * Misc util. procedures
     
    3434BOOL  OSLibDisablePopups();
    3535
    36 #define TIB_STACKTOP    0
    37 #define TIB_STACKLOW    1
     36#define TIB_STACKTOP    0
     37#define TIB_STACKLOW    1
    3838
    3939ULONG OSLibGetTIB(int tiboff);
    4040
    4141#define PIB_HMTE        0
    42 #define PIB_TASKHNDL    PIB_HMTE
     42#define PIB_TASKHNDL    PIB_HMTE
    4343#define PIB_TASKTYPE    1
    4444#define PIB_PCHCMD      2
    4545
    46 #define TASKTYPE_PM         0
     46#define TASKTYPE_PM     0
    4747#define TASKTYPE_VIO    1
    4848
     
    100100ULONG OSLibQueryCountry();
    101101
     102ULONG OSLibImSetMsgQueueProperty( ULONG hmq, ULONG ulFlag );
     103
    102104#ifdef __cplusplus
    103105}
  • trunk/src/kernel32/thread.cpp

    r9975 r10606  
    1 /* $Id: thread.cpp,v 1.54 2003-04-02 12:58:31 sandervl Exp $ */
     1/* $Id: thread.cpp,v 1.55 2004-05-24 08:56:07 sandervl Exp $ */
    22
    33/*
     
    1515 * Includes                                                                  *
    1616 *****************************************************************************/
    17 
    1817#include <odin.h>
    1918#include <odinwrap.h>
     
    3534#include <handlemanager.h>
    3635#include <codepage.h>
     36#include <heapstring.h>
    3737
    3838#include <FastInfoBlocks.h>
    3939
    40 #define DBG_LOCALLOG    DBG_thread
     40#define DBG_LOCALLOG    DBG_thread
    4141#include "dbglocal.h"
    4242
     
    6969    if(teb == 0) {
    7070        DebugInt3();
    71         SetLastError(ERROR_INVALID_HANDLE); //todo
    72         return 0;
     71        SetLastError(ERROR_INVALID_HANDLE); //todo
     72        return 0;
    7373    }
    7474    return teb->o.odin.hThread;
     
    205205    teb = GetThreadTEB();
    206206    if(teb != 0) {
    207              exceptFrame = (EXCEPTION_FRAME *)teb->o.odin.exceptFrame;
     207         exceptFrame = (EXCEPTION_FRAME *)teb->o.odin.exceptFrame;
    208208    }
    209209    else DebugInt3();
     
    278278/*****************************************************************************
    279279 * Name      : BOOL SetThreadPriorityBoost
    280  * Purpose   : The SetThreadPriorityBoost function disables or enables 
    281  *             the ability of the system to temporarily boost the priority 
     280 * Purpose   : The SetThreadPriorityBoost function disables or enables
     281 *             the ability of the system to temporarily boost the priority
    282282 *             of a thread.
    283283 * Parameters: Unknown (wrong)
     
    312312    }
    313313}
     314
     315#define MQP_INSTANCE_PERMQ              0x00000001 // from os2im.h
    314316//******************************************************************************
    315317//******************************************************************************
     
    326328
    327329    if(InitializeThread(winteb) == FALSE) {
    328             dprintf(("Win32ThreadProc: InitializeTIB failed!!"));
    329             DebugInt3();
    330             return 0;
     330        dprintf(("Win32ThreadProc: InitializeTIB failed!!"));
     331        DebugInt3();
     332        return 0;
    331333    }
    332334    dprintf(("Win32ThreadProc: Thread handle 0x%x, thread id %d", GetCurrentThread(), GetCurrentThreadId()));
     
    341343    winteb->o.odin.hmq = OSLibWinQueryMsgQueue(winteb->o.odin.hab);
    342344    rc = OSLibWinSetCp(winteb->o.odin.hmq, GetDisplayCodepage());
    343     dprintf(("WinSetCP was %sOK", rc ? "" : "not "));
     345    dprintf(("WinSetCP was %sOK(%d, %d)", rc ? "" : "not "));
    344346
    345347    dprintf(("Win32ThreadProc: hab %x hmq %x", winteb->o.odin.hab, winteb->o.odin.hmq));
    346348    dprintf(("Stack top 0x%x, stack end 0x%x", winteb->stack_top, winteb->stack_low));
     349
     350    if( IsDBCSEnv())
     351        /* IM instace is created per message queue, that is, thread */
     352        OSLibImSetMsgQueueProperty( winteb->o.odin.hmq, MQP_INSTANCE_PERMQ );
    347353
    348354    //Note: The Win32 exception structure referenced by FS:[0] is the same
     
    369375    }
    370376
    371     if(WinExe) WinExe->tlsAttachThread();           //setup TLS structure of main exe
     377    if(WinExe) WinExe->tlsAttachThread();       //setup TLS structure of main exe
    372378    Win32DllBase::tlsAttachThreadToAllDlls(); //setup TLS structures of all dlls
    373379    Win32DllBase::attachThreadToAllDlls();    //send DLL_THREAD_ATTACH message to all dlls
     
    387393        Win32DllBase::detachThreadFromAllDlls();  //send DLL_THREAD_DETACH message to all dlls
    388394        Win32DllBase::tlsDetachThreadFromAllDlls(); //destroy TLS structures of all dlls
    389         if(WinExe) WinExe->tlsDetachThread();             //destroy TLS structure of main exe
     395        if(WinExe) WinExe->tlsDetachThread();         //destroy TLS structure of main exe
    390396        DestroyTEB(winteb);  //destroys TIB and restores FS
    391397        OS2UnsetExceptionHandler((void *)&exceptFrame);
Note: See TracChangeset for help on using the changeset viewer.