Changeset 1893 for trunk/src


Ignore:
Timestamp:
Nov 30, 1999, 8:40:27 PM (26 years ago)
Author:
sandervl
Message:

GetProcessVersion changes

Location:
trunk/src/kernel32
Files:
6 edited

Legend:

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

    r1853 r1893  
    1 /* $Id: Fileio.cpp,v 1.16 1999-11-27 00:05:39 sandervl Exp $ */
     1/* $Id: Fileio.cpp,v 1.17 1999-11-30 19:40:25 sandervl Exp $ */
    22
    33/*
     
    7777              WIN32_FIND_DATAA *, arg2)
    7878{
     79  dprintf(("FindFirstFileA %s", arg1));
    7980  return O32_FindFirstFile(arg1, arg2);
    8081}
  • trunk/src/kernel32/KERNEL32.CPP

    r1885 r1893  
    1 /* $Id: KERNEL32.CPP,v 1.35 1999-11-30 14:15:53 sandervl Exp $ */
     1/* $Id: KERNEL32.CPP,v 1.36 1999-11-30 19:40:26 sandervl Exp $ */
    22
    33/*
     
    794794//******************************************************************************
    795795
    796 
    797 
    798796/***********************************************************************
    799797*           RtlFillMemory   (KERNEL32.441)
     
    849847}
    850848
    851 
    852849//******************************************************************************
    853850/*KSO Thu 21.05.1998*/
  • trunk/src/kernel32/process.cpp

    r1885 r1893  
    1 /* $Id: process.cpp,v 1.1 1999-11-30 14:16:16 sandervl Exp $ */
     1/* $Id: process.cpp,v 1.2 1999-11-30 19:40:26 sandervl Exp $ */
    22
    33/*
     
    2828#include <wprocess.h>
    2929#include <win\task.h>
     30#include <winimagebase.h>
    3031
    3132#define SHUTDOWN_NORETRY 1
     
    3637static PDB *PROCESS_First = &ProcessPDB;
    3738
     39/***********************************************************************
     40 *           PROCESS_IdToPDB
     41 *
     42 * Convert a process id to a PDB, making sure it is valid.
     43 */
     44PDB *PROCESS_IdToPDB( DWORD id )
     45{
     46    PDB *pdb;
     47
     48    if (!id) return PROCESS_Current();
     49    pdb = PROCESS_First;
     50    while (pdb)
     51    {
     52        if ((DWORD)pdb->server_pid == id) return pdb;
     53        pdb = pdb->next;
     54    }
     55    SetLastError( ERROR_INVALID_PARAMETER );
     56    return NULL;
     57}
    3858//******************************************************************************
    3959//******************************************************************************
     
    7292}
    7393//******************************************************************************
    74 //Should retrieve this from the exe...
    7594//******************************************************************************
    7695DWORD WIN32API GetProcessVersion(DWORD Processid)
    7796{
    78   dprintf(("KERNEL32:  OS2GetProcessVersion not correctly implemented!!\n"));
    79   return(WIN32OS2_VERSION);
     97 Win32ImageBase *image;
     98 PDB *process = PROCESS_IdToPDB( Processid );
     99 DWORD version;
     100
     101  if(process == NULL) {
     102        dprintf(("GetProcessVersion: can't find process (%d)", Processid));
     103        return 0;
     104  }
     105  image = Win32ImageBase::findModule(process->hInstance);
     106  if(image) {
     107        version = image->getVersion();
     108        dprintf(("GetProcessVersion of %x = %x", Processid, version));
     109        return version;
     110  }
     111  dprintf(("GetProcessVersion: can't find module %x (%d)", process->hInstance, Processid));
     112  return 0;
    80113}
    81114/***********************************************************************
     
    237270        if (maxset) *maxset = 32*1024*1024;
    238271        return TRUE;
    239 }
    240 /***********************************************************************
    241  *           PROCESS_IdToPDB
    242  *
    243  * Convert a process id to a PDB, making sure it is valid.
    244  */
    245 PDB *PROCESS_IdToPDB( DWORD id )
    246 {
    247     PDB *pdb;
    248 
    249     if (!id) return PROCESS_Current();
    250     pdb = PROCESS_First;
    251     while (pdb)
    252     {
    253         if ((DWORD)pdb->server_pid == id) return pdb;
    254         pdb = pdb->next;
    255     }
    256     SetLastError( ERROR_INVALID_PARAMETER );
    257     return NULL;
    258272}
    259273/***********************************************************************
  • trunk/src/kernel32/winimagebase.cpp

    r1872 r1893  
    1 /* $Id: winimagebase.cpp,v 1.5 1999-11-29 00:04:06 bird Exp $ */
     1/* $Id: winimagebase.cpp,v 1.6 1999-11-30 19:40:26 sandervl Exp $ */
    22
    33/*
     
    9797}
    9898//******************************************************************************
     99//Returns required OS version for this image
     100//******************************************************************************
     101ULONG Win32ImageBase::getVersion()
     102{
     103  dprintf(("Win32ImageBase::getVersion: NOT IMPLEMENTED!"));
     104  return 0x40000; //NT 4
     105}
     106//******************************************************************************
    99107//******************************************************************************
    100108BOOL Win32ImageBase::isPEImage(char *szFileName)
  • trunk/src/kernel32/winimagepeldr.cpp

    r1889 r1893  
    1 /* $Id: winimagepeldr.cpp,v 1.20 1999-11-30 15:06:55 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.21 1999-11-30 19:40:26 sandervl Exp $ */
    22
    33/*
     
    4646#include "oslibdos.h"
    4747#include "mmap.h"
     48#include <wprocess.h>
    4849
    4950char szErrorTitle[]     = "Odin";
     
    273274  fout << "Image Size        : " << oh.SizeOfImage << endl;
    274275  fout << "Header Size       : " << oh.SizeOfHeaders << endl;
     276  fout << "MajorImageVersion : " << oh.MajorImageVersion << endl;
     277  fout << "MinorImageVersion : " << oh.MinorImageVersion << endl;
    275278
    276279  //get header page
     
    479482  //SvL: Use pointer to image header as module handle now. Some apps needs this
    480483  hinstance = (HINSTANCE)realBaseAddress;
     484
     485  //SvL: Set instance handle in process database structure
     486  SetPDBInstance(hinstance);
    481487
    482488  //PH: get pResDir pointer correct first, since processImports may
     
    14921498}
    14931499//******************************************************************************
     1500//Returns required OS version for this image
     1501//******************************************************************************
     1502ULONG Win32PeLdrImage::getVersion()
     1503{
     1504  return (oh.MajorOperatingSystemVersion << 16) | oh.MinorOperatingSystemVersion;
     1505}
     1506//******************************************************************************
    14941507//******************************************************************************
    14951508ULONG MissingApi()
  • trunk/src/kernel32/wprocess.cpp

    r1885 r1893  
    1 /* $Id: wprocess.cpp,v 1.52 1999-11-30 14:15:56 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.53 1999-11-30 19:40:27 sandervl Exp $ */
    22
    33/*
     
    157157        ProcessPDB.next            = NULL;
    158158        ProcessPDB.winver          = 0xffff; /* to be determined */
     159        ProcessPDB.server_pid      = (void *)GetCurrentProcessId();
     160
     161        /* Initialize the critical section */
     162        InitializeCriticalSection( &ProcessPDB.crit_section );
    159163   }
    160164   dprintf(("InitializeTIB setup TEB with selector %x", tibsel));
     
    190194   *TIBFlatPtr = 0;
    191195   return;
     196}
     197/******************************************************************************/
     198/******************************************************************************/
     199void SetPDBInstance(HINSTANCE hInstance)
     200{
     201  ProcessPDB.hInstance = hInstance;
    192202}
    193203/******************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.