Changeset 4407 for trunk/src


Ignore:
Timestamp:
Oct 3, 2000, 7:28:32 PM (25 years ago)
Author:
sandervl
Message:

misc updates + fixes

Location:
trunk/src/kernel32
Files:
12 edited

Legend:

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

    r4285 r4407  
    1 /* $Id: HandleManager.cpp,v 1.50 2000-09-20 21:32:50 hugh Exp $ */
     1/* $Id: HandleManager.cpp,v 1.51 2000-10-03 17:28:26 sandervl Exp $ */
    22
    33/*
     
    13771377  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
    13781378
     1379  //Must return FILE_TYPE_CHAR here; (used to fail index check)
     1380  if((hFile == GetStdHandle(STD_INPUT_HANDLE)) ||
     1381     (hFile == GetStdHandle(STD_OUTPUT_HANDLE)) ||
     1382     (hFile == GetStdHandle(STD_ERROR_HANDLE)))
     1383  {
     1384      return FILE_TYPE_CHAR;
     1385  }
    13791386                                                          /* validate handle */
    13801387  iIndex = _HMHandleQuery(hFile);                           /* get the index */
  • trunk/src/kernel32/conin.cpp

    r3978 r4407  
    1 /* $Id: conin.cpp,v 1.11 2000-08-10 16:54:23 phaller Exp $ */
     1/* $Id: conin.cpp,v 1.12 2000-10-03 17:28:28 sandervl Exp $ */
    22
    33/*
     
    993993
    994994
     995DWORD HMDeviceConsoleInClass::GetFileType (PHMHANDLEDATA pHMHandleData)
     996{
     997   return FILE_TYPE_CHAR;
     998}
  • trunk/src/kernel32/conin.h

    r2050 r4407  
    1 /* $Id: conin.h,v 1.2 1999-12-09 19:08:26 sandervl Exp $ */
     1/* $Id: conin.h,v 1.3 2000-10-03 17:28:28 sandervl Exp $ */
    22
    33/*
     
    139139                                    LPDWORD       lpcWritten);
    140140
     141                      /* this is a handler method for calls to GetFileType() */
     142  virtual DWORD GetFileType (PHMHANDLEDATA pHMHandleData);
     143
    141144};
    142145
  • trunk/src/kernel32/conout.cpp

    r2984 r4407  
    1 /* $Id: conout.cpp,v 1.7 2000-03-03 11:15:57 sandervl Exp $ */
     1/* $Id: conout.cpp,v 1.8 2000-10-03 17:28:28 sandervl Exp $ */
    22
    33/*
     
    317317}
    318318
     319
     320DWORD HMDeviceConsoleOutClass::GetFileType (PHMHANDLEDATA pHMHandleData)
     321{
     322   return FILE_TYPE_CHAR;
     323}
  • trunk/src/kernel32/conout.h

    r111 r4407  
    1 /* $Id: conout.h,v 1.1 1999-06-17 18:21:39 phaller Exp $ */
     1/* $Id: conout.h,v 1.2 2000-10-03 17:28:29 sandervl Exp $ */
    22
    33/*
     
    6060
    6161                           /* this is a handler method for calls to ReadFile() */
    62   virtual DWORD  ReadFile   (PHMHANDLEDATA pHMHandleData,
     62  virtual BOOL   ReadFile   (PHMHANDLEDATA pHMHandleData,
    6363                             LPCVOID       lpBuffer,
    6464                             DWORD         nNumberOfBytesToRead,
     
    6767
    6868                        /* this is a handler method for calls to WriteFile() */
    69   virtual DWORD  WriteFile  (PHMHANDLEDATA pHMHandleData,
     69  virtual BOOL   WriteFile  (PHMHANDLEDATA pHMHandleData,
    7070                             LPCVOID       lpBuffer,
    7171                             DWORD         nNumberOfBytesToWrite,
     
    8181                                ULONG         arg3,
    8282                                ULONG         arg4);
     83
     84                      /* this is a handler method for calls to GetFileType() */
     85  virtual DWORD GetFileType (PHMHANDLEDATA pHMHandleData);
     86
    8387};
    8488
  • trunk/src/kernel32/cpu.cpp

    r4074 r4407  
    1 /* $Id: cpu.cpp,v 1.10 2000-08-23 18:03:33 sandervl Exp $ */
     1/* $Id: cpu.cpp,v 1.11 2000-10-03 17:28:29 sandervl Exp $ */
    22/*
    33 * Odin win32 CPU apis
     
    139139                        GetCPUVendorString(buf);
    140140                        RegSetValueExA(xhkey,"VendorIdentifier",0,REG_SZ,(LPBYTE)buf,strlen(buf));
    141                 }
    142 
     141#ifdef __WIN32OS2__
     142                        if(i==0) {
     143                                DWORD mhz;
     144                                features = GetCPUFeatures();
     145                                if(features & CPUID_TIME_STAMP_COUNTER) {
     146                                        LARGE_INTEGER tsc1, tsc2, freq, time1, time2;
     147                                        double clockticks, millisec, frequency, tmp, tmp1, mhertz;
     148
     149                                        QueryPerformanceFrequency(&freq);
     150
     151                                        GetTSC((LONG *)&tsc1.LowPart, &tsc1.HighPart);
     152                                        QueryPerformanceCounter(&time1);
     153
     154                                        Sleep(32);      //sleep for about 32 ms
     155                                       
     156                                        GetTSC((LONG *)&tsc2.LowPart, &tsc2.HighPart);
     157                                        QueryPerformanceCounter(&time2);
     158                                        tmp  = (double)time2.LowPart + (double)time2.HighPart*4.0*1024.0*1024.0;
     159                                        tmp1 = (double)time1.LowPart + (double)time1.HighPart*4.0*1024.0*1024.0;
     160                                        millisec = tmp - tmp1;
     161                                        frequency= (double)freq.LowPart;
     162                                        frequency= frequency / 1000.0;
     163                                        millisec = millisec / frequency;
     164
     165                                        tmp  = (double)tsc2.LowPart + (double)tsc2.HighPart*4.0*1024.0*1024.0;
     166                                        tmp1 = (double)tsc1.LowPart + (double)tsc1.HighPart*4.0*1024.0*1024.0;
     167                                        clockticks = tmp - tmp1;
     168
     169                                        tmp = 1000 / millisec;
     170                                        clockticks = clockticks * tmp;  //ticks per second
     171                                        mhertz = clockticks / 1000000.0;
     172                                        mhz = (DWORD)mhertz;
     173                                }
     174                                else    mhz = 100;
     175                                RegSetValueExA(xhkey,"~Mhz",0,REG_DWORD, (LPBYTE)&mhz, sizeof(DWORD));
     176                        }
     177#endif
     178                }
    143179//TODO: FPU fdiv bug
    144180#if 0
  • trunk/src/kernel32/cpuhlp.asm

    r2798 r4407  
    1 ; $Id: cpuhlp.asm,v 1.3 2000-02-15 19:06:12 sandervl Exp $
     1; $Id: cpuhlp.asm,v 1.4 2000-10-03 17:28:29 sandervl Exp $
    22
    33;/*
     
    109109
    110110
     111_GetTSC proc near
     112        push    ebp
     113        mov     ebp, esp
     114        push    edx
     115        push    esi
     116        push    edi
     117        rdtsc
     118
     119        mov     esi, [ebp+8]    ;ptr to low dword
     120        mov     edi, [ebp+12]   ;ptr to high dword
     121        mov     [esi], eax
     122        mov     [edi], edx
     123
     124        pop     edi
     125        pop     esi
     126        pop     edx
     127        pop     ebp
     128        ret
     129_GetTSC endp
     130
    111131CODE32          ENDS
    112132
  • trunk/src/kernel32/hmopen32.cpp

    r4285 r4407  
    1 /* $Id: hmopen32.cpp,v 1.26 2000-09-20 21:32:52 hugh Exp $ */
     1/* $Id: hmopen32.cpp,v 1.27 2000-10-03 17:28:30 sandervl Exp $ */
    22
    33/*
     
    154154           pHMHandleData));
    155155
    156   //TODO: return FILE_TYPE_UNKNOWN for standard in/out handles; correct??
    157156  return O32_GetFileType(pHMHandleData->hHMHandle);
    158157}
  • trunk/src/kernel32/initsystem.cpp

    r4256 r4407  
    1 /* $Id: initsystem.cpp,v 1.16 2000-09-13 21:10:59 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.17 2000-10-03 17:28:30 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry, directories & environment)
     
    8181#define ODIN_WINMM_RECORD       "OS/2 Dart Audio Record"
    8282
     83#define KEY_DEVICE_TYPE         "Type"
     84#define KEY_DEVICE_START        "Start"
     85#define KEY_DEVICE_GROUP        "Group"
     86#define KEY_DEVICE_ERRORCONTROL "ErrorControl"
     87#define KEY_DEVICE_AUTORUN      "Autorun"
     88#define KEY_DEVICE_TAG          "Tag"
     89#define DEVICE_GROUP_FILESYSTEM "File system"
     90#define DEVICE_GROUP_SCSICDROM  "SCSI CDROM Class"
     91
    8392//******************************************************************************
    8493//******************************************************************************
     
    492501   RegCloseKey(hkey);
    493502#endif
     503
     504// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs]
     505// "Type"=dword:00000002
     506// "Start"=dword:00000004
     507// "Group"="File system"
     508// "ErrorControl"=dword:00000001
     509// "DependOnGroup"=hex(7):53,43,53,49,20,43,44,52,4f,4d,20,43,6c,61,73,73,00,00
     510
     511   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdfs",&hkey)!=ERROR_SUCCESS) {
     512        goto initreg_error;
     513   }
     514   val = 0x2;
     515   RegSetValueExA(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     516   val = 0x4;
     517   RegSetValueExA(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     518   val = 0x1;
     519   RegSetValueExA(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     520   RegSetValueExA(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_FILESYSTEM, sizeof(DEVICE_GROUP_FILESYSTEM));
     521   //todo dependongroup
     522   RegCloseKey(hkey);
     523
     524
     525/*
     526// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdfs\Enum]
     527// "0"="Root\\LEGACY_CDFS\\0000"
     528// "Count"=dword:00000001
     529// "NextInstance"=dword:00000001
     530*/
     531// [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom]
     532// "Type"=dword:00000001
     533// "Start"=dword:00000001
     534// "Group"="SCSI CDROM Class"
     535// "ErrorControl"=dword:00000000
     536// "Tag"=dword:00000002
     537// "DependOnGroup"=hex(7):53,43,53,49,20,6d,69,6e,69,70,6f,72,74,00,00
     538// "Autorun"=dword:00000001
     539
     540   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\Cdrom",&hkey)!=ERROR_SUCCESS) {
     541        goto initreg_error;
     542   }
     543   val = 0x1;
     544   RegSetValueExA(hkey, KEY_DEVICE_TYPE,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     545   val = 0x1;
     546   RegSetValueExA(hkey, KEY_DEVICE_START,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     547   val = 0x0;
     548   RegSetValueExA(hkey, KEY_DEVICE_ERRORCONTROL,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     549   val = 0x2;
     550   RegSetValueExA(hkey, KEY_DEVICE_TAG,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     551   val = 0x0;
     552   RegSetValueExA(hkey, KEY_DEVICE_AUTORUN,0,REG_DWORD, (LPBYTE)&val, sizeof(DWORD));
     553   RegSetValueExA(hkey, KEY_DEVICE_GROUP,0,REG_SZ, (LPBYTE)DEVICE_GROUP_SCSICDROM, sizeof(DEVICE_GROUP_SCSICDROM));
     554   //todo dependongroup
     555   RegCloseKey(hkey);
     556
     557/*
     558[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\Enum]
     559"0"="Root\\LEGACY_CDROM\\0000"
     560"Count"=dword:00000001
     561"NextInstance"=dword:00000001
     562*/
     563
    494564   return TRUE;
    495565
  • trunk/src/kernel32/windlllx.cpp

    r4003 r4407  
    1 /* $Id: windlllx.cpp,v 1.14 2000-08-12 16:58:39 sandervl Exp $ */
     1/* $Id: windlllx.cpp,v 1.15 2000-10-03 17:28:31 sandervl Exp $ */
    22
    33/*
     
    179179}
    180180//******************************************************************************
     181//Returns reference count or -1 if load failed (PE loader only!)
    181182//******************************************************************************
    182183#ifdef DEBUG
     
    216217                item = loadedDlls.getNext(item);
    217218        }
    218         if(attachProcess() == 0)
    219                 return 0;
     219        if(attachProcess() == 0) {
     220                dprintf(("WARNING: Dll %s refused to be loaded; aborting", getName()));
     221                return -1;
     222        }
    220223  }
    221224  return ret; 
  • trunk/src/kernel32/winimagepeldr.cpp

    r4015 r4407  
    1 /* $Id: winimagepeldr.cpp,v 1.53 2000-08-14 19:15:37 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.54 2000-10-03 17:28:31 sandervl Exp $ */
    22
    33/*
     
    14051405                }
    14061406                lxdll->setDllHandleOS2(hInstanceNewDll);
    1407                 lxdll->AddRef();
     1407                if(lxdll->AddRef() == -1) {//-1 -> load failed (attachProcess)
     1408                        dprintf((LOG, "Dll %s refused to be loaded; aborting", modname));
     1409                        delete lxdll;
     1410                        errorState = ERROR_INTERNAL;
     1411                        return(FALSE);
     1412                }
    14081413                WinDll = (Win32DllBase*)lxdll;
    14091414        }
     
    14231428                if(pedll->init(0) == FALSE) {
    14241429                    dprintf((LOG, "Internal WinDll error ", pedll->getError() ));
     1430                    delete pedll;
    14251431                    return(FALSE);
    14261432                }
  • trunk/src/kernel32/wprocess.cpp

    r4372 r4407  
    1 /* $Id: wprocess.cpp,v 1.98 2000-10-02 13:38:58 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.99 2000-10-03 17:28:32 sandervl Exp $ */
    22
    33/*
     
    788788                if(pModule->isLxDll())
    789789                {
    790                     ((Win32LxDll *)pModule)->setDllHandleOS2(hDll);
    791                     if (fPeLoader)
    792                         pModule->AddRef();
     790                        ((Win32LxDll *)pModule)->setDllHandleOS2(hDll);
     791                        if(fPeLoader)
     792                        {
     793                                if(pModule->AddRef() == -1) {//-1 -> load failed (attachProcess)
     794                                        dprintf(("Dll %s refused to be loaded; aborting", szModname));
     795                                        delete pModule;
     796                                        return 0;
     797                                }
     798                        }
    793799                }
    794800                pModule->incDynamicLib();
     
    796802            else
    797803                return hDll; //happens when LoadLibrary is called in kernel32's initterm (nor harmful)
     804
    798805            dprintf(("KERNEL32: LoadLibraryExA(%s, 0x%x, 0x%x): returns 0x%x. Loaded %s using O32_LoadLibrary.",
    799806                     lpszLibFile, hFile, dwFlags, hDll, szModname));
     
    902909                SetLastError(ERROR_DLL_INIT_FAILED);
    903910                delete peldrDll;
     911                return NULL;
    904912            }
    905913        }
     
    910918            SetLastError(ERROR_INVALID_EXE_SIGNATURE);
    911919            delete peldrDll;
     920                return NULL;
    912921        }
    913922    }
     
    917926                 lpszLibFile, hFile, dwFlags, szModname, fPE));
    918927        SetLastError(fPE);
     928        return NULL;
    919929    }
    920930
     
    11001110            return ERROR_NOT_ENOUGH_MEMORY;
    11011111        }
    1102 
     1112        strcpy((char *)pszCmdLineA, pszPeExe);
     1113       
    11031114        rc = NO_ERROR;
    11041115    }
Note: See TracChangeset for help on using the changeset viewer.