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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.