Changeset 9693 for trunk/src


Ignore:
Timestamp:
Jan 20, 2003, 11:46:28 AM (23 years ago)
Author:
sandervl
Message:

Only load LVM.DLL when we actually need it; CreateProcess bugfix for thread id if launched directly; CreateFile returns ERROR_ALREADY_EXISTS if file not found and CREATE_NEW; Check and correct process type in thread wrapper

Location:
trunk/src/kernel32
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/initkernel32.cpp

    r9496 r9693  
    1 /* $Id: initkernel32.cpp,v 1.24 2002-12-13 16:46:44 sandervl Exp $
     1/* $Id: initkernel32.cpp,v 1.25 2003-01-20 10:46:26 sandervl Exp $
    22 *
    33 * KERNEL32 DLL entry point
     
    196196            InitDynamicRegistry();
    197197
    198             //Load LVM subsystem for volume/mountpoint win32 functions
    199             OSLibLVMInit();
    200 
    201198            //Set the process affinity mask to the system affinity mask
    202199            DWORD dwProcessAffinityMask, dwSystemAffinityMask;
  • trunk/src/kernel32/oslibdos.cpp

    r9691 r9693  
    1 /* $Id: oslibdos.cpp,v 1.113 2003-01-18 20:11:46 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.114 2003-01-20 10:46:27 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    10051005      int winError = error2WinError(rc);
    10061006      if (winError == ERROR_OPEN_FAILED_W || winError == ERROR_PATH_NOT_FOUND_W)
    1007         winError = ERROR_FILE_NOT_FOUND_W;
     1007      {
     1008          //Windows returns ERROR_FILE_EXISTS if create new & file exists
     1009          if(fuCreate == CREATE_NEW_W) {
     1010                winError = ERROR_FILE_EXISTS_W;
     1011          }
     1012          else  winError = ERROR_FILE_NOT_FOUND_W;
     1013      }
    10081014      SetLastError(winError);
    10091015      return INVALID_HANDLE_VALUE_W;
  • trunk/src/kernel32/osliblvm.cpp

    r9304 r9693  
    1 /* $Id: osliblvm.cpp,v 1.4 2002-09-27 14:35:56 sandervl Exp $ */
     1/* $Id: osliblvm.cpp,v 1.5 2003-01-20 10:46:27 sandervl Exp $ */
    22
    33/*
     
    5252static BOOL    fLVMOpened = FALSE;
    5353
     54static void Close_LVM_Engine ( void );
     55
     56//******************************************************************************
     57//******************************************************************************
     58static BOOL OSLibLVMInit()
     59{
     60    APIRET rc;
     61    CHAR   szModuleFailure[CCHMAXPATH];
     62
     63    rc = DosLoadModule(szModuleFailure, sizeof(szModuleFailure), "LVM.DLL", (HMODULE *)&hModLVM);
     64    if(rc) {
     65        return FALSE;
     66    }
     67    rc = DosQueryProcAddr(hModLVM, 0, "Open_LVM_Engine", (PFN *)&pfnOpen_LVM_Engine);
     68    if(rc) goto fail;
     69    rc = DosQueryProcAddr(hModLVM, 0, "Close_LVM_Engine", (PFN *)&pfnClose_LVM_Engine);
     70    if(rc) goto fail;
     71    rc = DosQueryProcAddr(hModLVM, 0, "Get_Drive_Control_Data", (PFN *)&pfnGet_Drive_Control_Data);
     72    if(rc) goto fail;
     73    rc = DosQueryProcAddr(hModLVM, 0, "Get_Drive_Status", (PFN *)&pfnGet_Drive_Status);
     74    if(rc) goto fail;
     75    rc = DosQueryProcAddr(hModLVM, 0, "Get_Partitions", (PFN *)&pfnGet_Partitions);
     76    if(rc) goto fail;
     77    rc = DosQueryProcAddr(hModLVM, 0, "Get_Partition_Handle", (PFN *)&pfnGet_Partition_Handle);
     78    if(rc) goto fail;
     79    rc = DosQueryProcAddr(hModLVM, 0, "Get_Partition_Information", (PFN *)&pfnGet_Partition_Information);
     80    if(rc) goto fail;
     81    rc = DosQueryProcAddr(hModLVM, 0, "Get_Volume_Control_Data", (PFN *)&pfnGet_Volume_Control_Data);
     82    if(rc) goto fail;
     83    rc = DosQueryProcAddr(hModLVM, 0, "Get_Volume_Information", (PFN *)&pfnGet_Volume_Information);
     84    if(rc) goto fail;
     85    rc = DosQueryProcAddr(hModLVM, 0, "Free_Engine_Memory", (PFN *)&pfnFree_Engine_Memory);
     86    if(rc) goto fail;
     87    rc = DosQueryProcAddr(hModLVM, 0, "Read_Sectors", (PFN *)&pfnRead_Sectors);
     88    if(rc) goto fail;
     89    rc = DosQueryProcAddr(hModLVM, 0, "Write_Sectors", (PFN *)&pfnWrite_Sectors);
     90    if(rc) goto fail;
     91   
     92    return TRUE;
     93
     94fail:
     95    if(hModLVM) {
     96        DosFreeModule(hModLVM);
     97        hModLVM = 0;
     98    }
     99    return FALSE;
     100}
     101//******************************************************************************
     102//******************************************************************************
     103void OSLibLVMExit()
     104{
     105    if(fLVMOpened) {
     106        Close_LVM_Engine();
     107    }
     108    if(hModLVM) {
     109        DosFreeModule(hModLVM);
     110        hModLVM = 0;
     111    }
     112}
    54113//******************************************************************************
    55114//******************************************************************************
     
    57116{
    58117    USHORT               sel;
     118
     119    //Load LVM dll
     120    OSLibLVMInit();
    59121
    60122    sel = RestoreOS2FS();
     
    198260    SetFS(sel);
    199261    return;
    200 }
    201 //******************************************************************************
    202 //******************************************************************************
    203 BOOL OSLibLVMInit()
    204 {
    205     APIRET rc;
    206     CHAR   szModuleFailure[CCHMAXPATH];
    207 
    208     rc = DosLoadModule(szModuleFailure, sizeof(szModuleFailure), "LVM.DLL", (HMODULE *)&hModLVM);
    209     if(rc) {
    210         return FALSE;
    211     }
    212     rc = DosQueryProcAddr(hModLVM, 0, "Open_LVM_Engine", (PFN *)&pfnOpen_LVM_Engine);
    213     if(rc) goto fail;
    214     rc = DosQueryProcAddr(hModLVM, 0, "Close_LVM_Engine", (PFN *)&pfnClose_LVM_Engine);
    215     if(rc) goto fail;
    216     rc = DosQueryProcAddr(hModLVM, 0, "Get_Drive_Control_Data", (PFN *)&pfnGet_Drive_Control_Data);
    217     if(rc) goto fail;
    218     rc = DosQueryProcAddr(hModLVM, 0, "Get_Drive_Status", (PFN *)&pfnGet_Drive_Status);
    219     if(rc) goto fail;
    220     rc = DosQueryProcAddr(hModLVM, 0, "Get_Partitions", (PFN *)&pfnGet_Partitions);
    221     if(rc) goto fail;
    222     rc = DosQueryProcAddr(hModLVM, 0, "Get_Partition_Handle", (PFN *)&pfnGet_Partition_Handle);
    223     if(rc) goto fail;
    224     rc = DosQueryProcAddr(hModLVM, 0, "Get_Partition_Information", (PFN *)&pfnGet_Partition_Information);
    225     if(rc) goto fail;
    226     rc = DosQueryProcAddr(hModLVM, 0, "Get_Volume_Control_Data", (PFN *)&pfnGet_Volume_Control_Data);
    227     if(rc) goto fail;
    228     rc = DosQueryProcAddr(hModLVM, 0, "Get_Volume_Information", (PFN *)&pfnGet_Volume_Information);
    229     if(rc) goto fail;
    230     rc = DosQueryProcAddr(hModLVM, 0, "Free_Engine_Memory", (PFN *)&pfnFree_Engine_Memory);
    231     if(rc) goto fail;
    232     rc = DosQueryProcAddr(hModLVM, 0, "Read_Sectors", (PFN *)&pfnRead_Sectors);
    233     if(rc) goto fail;
    234     rc = DosQueryProcAddr(hModLVM, 0, "Write_Sectors", (PFN *)&pfnWrite_Sectors);
    235     if(rc) goto fail;
    236    
    237     return TRUE;
    238 
    239 fail:
    240     if(hModLVM) {
    241         DosFreeModule(hModLVM);
    242         hModLVM = 0;
    243     }
    244     return FALSE;
    245 }
    246 //******************************************************************************
    247 //******************************************************************************
    248 void OSLibLVMExit()
    249 {
    250     if(fLVMOpened) {
    251         Close_LVM_Engine();
    252     }
    253     if(hModLVM) {
    254         DosFreeModule(hModLVM);
    255         hModLVM = 0;
    256     }
    257262}
    258263//******************************************************************************
  • trunk/src/kernel32/osliblvm.h

    r9617 r9693  
    1 /* $Id: osliblvm.h,v 1.5 2003-01-05 12:31:24 sandervl Exp $ */
     1/* $Id: osliblvm.h,v 1.6 2003-01-20 10:46:27 sandervl Exp $ */
    22/*
    33 * OS/2 LVM (Logical Volume Management) functions
     
    327327#define VOLUME_NAME_PREFIX  "\\\\?\\Volume\\"
    328328
    329 BOOL   OSLibLVMInit();
    330329void   OSLibLVMExit();
    331330HANDLE OSLibLVMQueryVolumeControlData();
  • trunk/src/kernel32/oslibmisc.cpp

    r9678 r9693  
    1 /* $Id: oslibmisc.cpp,v 1.16 2003-01-16 00:44:31 sandervl Exp $ */
     1/* $Id: oslibmisc.cpp,v 1.17 2003-01-20 10:46:28 sandervl Exp $ */
    22/*
    33 * Misc OS/2 util. procedures
     
    280280ULONG OSLibWinQueryMsgQueue(ULONG hab)
    281281{
    282   ULONG hmq;
    283 
    284   hmq = (ULONG)WinCreateMsgQueue((HAB)hab, 0);
     282  ULONG  hmq;
     283  APIRET rc;
     284  PTIB   ptib;
     285  PPIB   ppib;
     286
     287  rc = DosGetInfoBlocks(&ptib, &ppib);
     288  if(rc != NO_ERROR) {
     289      dprintf(("DosGetInfoBlocks failed with rc %d", rc));
     290      DebugInt3();
     291      return 0;
     292  }
     293  if(ppib->pib_ultype == 2) {
     294      dprintf(("Warning: app type changed back to VIO!!"));
     295      ppib->pib_ultype = 3;
     296  }
     297  hmq = WinQueueFromID(hab, ppib->pib_ulpid, ptib->tib_ptib2->tib2_ultid);
     298
    285299  if(!hmq) {
    286       PTIB ptib;
    287       PPIB ppib;
    288 
    289       DosGetInfoBlocks(&ptib, &ppib);
    290 
    291       hmq = WinQueueFromID(hab, ppib->pib_ulpid, ptib->tib_ptib2->tib2_ultid);
     300      dprintf(("WinQueueFromID %x %x %x proc type %x failed with error %x", hab, ppib->pib_ulpid, ptib->tib_ptib2->tib2_ultid, ppib->pib_ultype, WinGetLastError(hab)));
     301
     302      hmq = (ULONG)WinCreateMsgQueue((HAB)hab, 0);
     303      if(!hmq) {
     304          dprintf(("WinCreateMsgQueue failed with error %x", WinGetLastError(hab)));
     305      }
    292306  }
    293307  return hmq;
  • trunk/src/kernel32/thread.cpp

    r9667 r9693  
    1 /* $Id: thread.cpp,v 1.48 2003-01-13 16:51:40 sandervl Exp $ */
     1/* $Id: thread.cpp,v 1.49 2003-01-20 10:46:28 sandervl Exp $ */
    22
    33/*
     
    310310
    311311    winteb->o.odin.hab = OSLibWinInitialize();
     312    dprintf(("Thread HAB %x", winteb->o.odin.hab));
    312313    winteb->o.odin.hmq = OSLibWinQueryMsgQueue(winteb->o.odin.hab);
    313314    rc = OSLibWinSetCp(winteb->o.odin.hmq, GetDisplayCodepage());
  • trunk/src/kernel32/wprocess.cpp

    r9681 r9693  
    1 /* $Id: wprocess.cpp,v 1.175 2003-01-16 13:16:59 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.176 2003-01-20 10:46:28 sandervl Exp $ */
    22
    33/*
     
    18811881      else pThreadDB->o.odin.pidDebuggee = 0;
    18821882
     1883      if(lpProcessInfo)
     1884      {
     1885          lpProcessInfo->dwThreadId = MAKE_THREADID(lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId);
     1886      }
     1887
    18831888      return(TRUE);
    18841889    }
Note: See TracChangeset for help on using the changeset viewer.