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

GetProcessVersion changes

File:
1 edited

Legend:

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