Changeset 1885 for trunk/src/kernel32


Ignore:
Timestamp:
Nov 30, 1999, 3:19:03 PM (26 years ago)
Author:
sandervl
Message:

Added process api + virtualprotect fix

Location:
trunk/src/kernel32
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.CPP

    r1833 r1885  
    1 /* $Id: KERNEL32.CPP,v 1.34 1999-11-24 19:31:22 sandervl Exp $ */
     1/* $Id: KERNEL32.CPP,v 1.35 1999-11-30 14:15:53 sandervl Exp $ */
    22
    33/*
    44 * Win32 compatibility file functions for OS/2
    55 *
    6  * Copyright 1998 Sander van Leeuven
     6 * Copyright 1998 Sander van Leeuwen
    77 * Copyright 1998 Patrick Haller
    88 * Copyright 1998 Peter Fitzsimmons
     
    375375    return(rc);
    376376}
    377 //******************************************************************************
    378 //******************************************************************************
    379 BOOL WIN32API GetExitCodeProcess(HANDLE arg1, LPDWORD  arg2)
    380 {
    381     dprintf(("KERNEL32:  GetExitCodeProcess\n"));
    382     return O32_GetExitCodeProcess(arg1, arg2);
    383 }
    384 //******************************************************************************
    385 //******************************************************************************
    386 HANDLE WIN32API GetCurrentProcess(void)
    387 {
    388     dprintf2(("KERNEL32:  GetCurrentProcess\n"));
    389     return O32_GetCurrentProcess();
    390 }
    391 //******************************************************************************
    392 //******************************************************************************
    393 DWORD WIN32API GetCurrentProcessId(void)
    394 {
    395     dprintf2(("KERNEL32:  GetCurrentProcessId\n"));
    396     return O32_GetCurrentProcessId();
    397 }
    398 //******************************************************************************
    399 //******************************************************************************
    400 BOOL WIN32API TerminateProcess( HANDLE arg1, DWORD arg2)
    401 {
    402     dprintf(("KERNEL32:  TerminateProcess\n"));
    403     return O32_TerminateProcess(arg1, arg2);
    404 }
    405 //******************************************************************************
    406 //******************************************************************************
    407377VOID WIN32API Sleep(DWORD arg1)
    408378{
     
    540510
    541511    return O32_MulDiv(arg1, arg2, arg3);
    542 }
    543 //******************************************************************************
    544 //******************************************************************************
    545 HANDLE WIN32API OpenProcess(DWORD arg1, BOOL arg2, DWORD arg3)
    546 {
    547     dprintf(("KERNEL32:  OS2OpenProcess\n"));
    548     return O32_OpenProcess(arg1, arg2, arg3);
    549512}
    550513//******************************************************************************
     
    734697}
    735698//******************************************************************************
    736 //Should retrieve this from the exe...
    737 //******************************************************************************
    738 DWORD WIN32API GetProcessVersion(DWORD Processid)
    739 {
    740   dprintf(("KERNEL32:  OS2GetProcessVersion not correctly implemented!!\n"));
    741   return(WIN32OS2_VERSION);
    742 }
    743 //******************************************************************************
    744699//******************************************************************************
    745700LONG WIN32API GetVersion()
     
    772727}
    773728//******************************************************************************
    774 //Obsolete
    775 //******************************************************************************
    776 DWORD WIN32API GetProcessHeaps(DWORD NumberOfHeaps, PHANDLE ProcessHeaps)
    777 {
    778   dprintf(("KERNEL32:  GetProcessHeaps, Not implemented\n"));
    779   return(0);
    780 }
    781 //******************************************************************************
    782 //WINE
    783 //******************************************************************************
    784 BOOL WIN32API GetProcessAffinityMask(HANDLE  hProcess,
    785                                         LPDWORD lpProcessAffinityMask,
    786                                         LPDWORD lpSystemAffinityMask)
    787 {
    788         /* It is definitely important for a process to know on what processor
    789            it is running :-) */
    790         if(lpProcessAffinityMask)
    791                 *lpProcessAffinityMask=1;
    792         if(lpSystemAffinityMask)
    793                 *lpSystemAffinityMask=1;
    794         return TRUE;
    795 }
    796 //******************************************************************************
    797 //******************************************************************************
    798 
    799 
     729//******************************************************************************
    800730BOOL WIN32API FlushInstructionCache(     /*PLF Mon  98-02-09 23:56:49 : STUB STUB STUB STUB STUB */
    801731    HANDLE hProcess,    /* process with cache to flush  */
  • trunk/src/kernel32/KERNEL32.DEF

    r1815 r1885  
    1 ; $Id: KERNEL32.DEF,v 1.52 1999-11-23 19:31:34 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.53 1999-11-30 14:15:53 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    464464     GetProcAddress             = _GetProcAddress@8           @372
    465465     GetProcessAffinityMask     = _GetProcessAffinityMask@12  @373
     466     GetProcessDword            = _GetProcessDword@8          @885
    466467;    GetProcessFlags            = _GetProcessFlags@??         @374      ;W95
    467468     GetProcessHeap             = _GetProcessHeap@0           @375
    468469     GetProcessHeaps            = _GetProcessHeaps@8          @376
    469 ;    GetProcessPriorityBoost    = _GetProcessPriorityBoost@??           ;NT
     470;     GetProcessPriorityBoost    = _GetProcessPriorityBoost@??           ;NT
    470471     GetProcessShutdownParameters  = _GetProcessShutdownParameters@8 @377
    471472     GetProcessTimes            = _GetProcessTimes@20         @378
     
    794795    SetNamedPipeHandleState    = _SetNamedPipeHandleState@16 @659
    795796    SetPriorityClass           = _SetPriorityClass@8         @660
    796 ;   SetProcessAffinityMask     = _SetProcessAffinityMask@??             ;NT
    797 ;   SetProcessPriorityBoost    = _SetPriorityBoost@??                   ;NT
     797    SetProcessAffinityMask     = _SetProcessAffinityMask@8   @862
     798    SetProcessDword            = _SetProcessDword@12         @884
     799    SetProcessPriorityBoost    = _SetProcessPriorityBoost@8  @863
    798800    SetProcessShutdownParameters  = _SetProcessShutdownParameters@8 @661
    799801    SetProcessWorkingSetSize   = _SetProcessWorkingSetSize@12 @662
  • trunk/src/kernel32/makefile

    r1872 r1885  
    1 # $Id: makefile,v 1.64 1999-11-29 00:04:05 bird Exp $
     1# $Id: makefile,v 1.65 1999-11-30 14:15:54 sandervl Exp $
    22
    33#
     
    4343pefile.OBJ winimgres.OBJ wintls.obj async.OBJ fileio.obj \
    4444atom.obj disk.obj directory.obj cvtbitmap.obj hmmmap.obj winfakepeldr.obj \
    45 cvtaccel.obj cvticon.obj cvticongrp.obj oslibexcept.obj cpu.obj \
     45cvtaccel.obj cvticon.obj cvticongrp.obj oslibexcept.obj cpu.obj process.obj \
    4646cvtcursor.obj cvtcursorgrp.obj stubs.obj interlock.obj toolhelp.obj
    4747
     
    9393    $(PDWIN32_INCLUDE)\unicode.h \
    9494    $(PDWIN32_INCLUDE)\heap.h \
     95    $(PDWIN32_INCLUDE)\wprocess.h
     96
     97process.obj: process.cpp \
     98    $(PDWIN32_INCLUDE)\misc.h \
    9599    $(PDWIN32_INCLUDE)\wprocess.h
    96100
  • trunk/src/kernel32/resource.cpp

    r1879 r1885  
    1 /* $Id: resource.cpp,v 1.11 1999-11-29 20:43:01 sandervl Exp $ */
     1/* $Id: resource.cpp,v 1.12 1999-11-30 14:15:54 sandervl Exp $ */
    22
    33/*
     
    2626 Win32ImageBase *module;
    2727
    28     dprintf(("FindResourceA %X", hModule));
    2928    module = Win32ImageBase::findModule(hModule);
    30     if(module == NULL)
    31       return(NULL);
    32 
     29    if(module == NULL) {
     30          dprintf(("FindResourceA Module %X not found (%x %d)", hModule, lpszName, lpszType));
     31          return(NULL);
     32    }
    3333    return module->findResourceA(lpszName, (LPSTR)lpszType);
    3434}
     
    4040 Win32ImageBase *module;
    4141
    42     dprintf(("FindResourceW %X", hModule));
    4342    module = Win32ImageBase::findModule(hModule);
    44     if(module == NULL)
    45         return(NULL);
     43    if(module == NULL) {
     44          dprintf(("FindResourceW Module %X not found (%x %d)", hModule, lpszName, lpszType));
     45          return(NULL);
     46    }
    4647
    4748    return module->findResourceW((LPWSTR)lpszName, (LPWSTR)lpszType);
  • trunk/src/kernel32/stubs.cpp

    r1879 r1885  
    1 /* $Id: stubs.cpp,v 1.9 1999-11-29 20:43:01 sandervl Exp $ */
     1/* $Id: stubs.cpp,v 1.10 1999-11-30 14:15:54 sandervl Exp $ */
    22
    33/*
     
    21362136}
    21372137
    2138 
    2139 
    2140 /*****************************************************************************
    2141  * Name      : BOOL GetProcessShutdownParameters
    2142  * Purpose   : The GetProcessShutdownParameters function retrieves shutdown
    2143  *             parameters for the currently calling process.
    2144  * Parameters: LPDWORD lpdwLevel
    2145  *             LPDWORD lpdwFlags
    2146  * Variables :
    2147  * Result    : TRUE / FALSE
    2148  * Remark    :
    2149  * Status    : UNTESTED STUB
    2150  *
    2151  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    2152  *****************************************************************************/
    2153 
    2154 BOOL WIN32API GetProcessShutdownParameters(LPDWORD lpdwLevel,
    2155                                               LPDWORD lpdwFlags)
    2156 {
    2157   dprintf(("Kernel32: GetProcessShutdownParameters(%08xh,%08xh) not implemented.\n",
    2158            lpdwLevel,
    2159            lpdwFlags));
    2160 
    2161   return (FALSE);
    2162 }
    2163 
    2164 
    2165 
    21662138/*****************************************************************************
    21672139 * Name      : BOOL GetProcessTimes
     
    21962168}
    21972169
    2198 
    2199 /*****************************************************************************
    2200  * Name      : BOOL GetProcessWorkingSetSize
    2201  * Purpose   : The GetProcessWorkingSetSize function obtains the minimum and
    2202  *             maximum working set sizes of a specified process.
    2203  * Parameters: HANDLE  hProcess                open handle to the process of interest
    2204  *             LPDWORD lpMinimumWorkingSetSize points to variable to receive minimum working set size
    2205  *             LPDWORD lpMaximumWorkingSetSize points to variable to receive maximum working set size
    2206  * Variables :
    2207  * Result    : TRUE / FALSE
    2208  * Remark    :
    2209  * Status    : UNTESTED STUB
    2210  *
    2211  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    2212  *****************************************************************************/
    2213 
    2214 BOOL WIN32API GetProcessWorkingSetSize(HANDLE  hProcess,
    2215                                           LPDWORD lpMinimumWorkingSetSize,
    2216                                           LPDWORD lpMaximumWorkingSetSize)
    2217 {
    2218   dprintf(("Kernel32: GetProcessWorkingSetSize(%08xh,%08xh,%08xh) not implemented - dummy values, TRUE.\n",
    2219            hProcess,
    2220            lpMinimumWorkingSetSize,
    2221            lpMaximumWorkingSetSize));
    2222 
    2223   /* PH: we're returning dummy values here */
    2224   *lpMinimumWorkingSetSize =   512 * 1024; /* 512k */
    2225   *lpMaximumWorkingSetSize = 65536 * 1024; /* 64M  */
    2226 
    2227   return (TRUE);
    2228 }
    22292170
    22302171
     
    27962737}
    27972738
    2798 
    2799 /*****************************************************************************
    2800  * Name      : BOOL SetProcessShutdownParameters
    2801  * Purpose   : The SetProcessShutdownParameters function sets shutdown parameters
    2802  *             for the currently calling process. This function sets a shutdown
    2803  *             order for a process relative to the other processes in the system.
    2804  * Parameters: DWORD dwLevel  shutdown priority
    2805  *             DWORD dwFlags  shutdown flags
    2806  * Variables :
    2807  * Result    : TRUE / FALSE
    2808  * Remark    :
    2809  * Status    : UNTESTED STUB
    2810  *
    2811  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    2812  *****************************************************************************/
    2813 
    2814 BOOL WIN32API SetProcessShutdownParameters(DWORD dwLevel,
    2815                                               DWORD dwFlags)
    2816 {
    2817   dprintf(("KERNEL32: SetProcessShutdownParameters(%08xh,%08xh) not implemented.\n",
    2818            dwLevel,
    2819            dwFlags));
    2820 
    2821   return (FALSE);
    2822 }
    2823 
    2824 
    2825 /*****************************************************************************
    2826  * Name      : BOOL SetProcessWorkingSetSize
    2827  * Purpose   : The SetProcessWorkingSetSize function sets the minimum and
    2828  *             maximum working set sizes for a specified process.
    2829  *             The working set of a process is the set of memory pages currently
    2830  *             visible to the process in physical RAM memory. These pages are
    2831  *             resident and available for an application to use without triggering
    2832  *             a page fault. The size of the working set of a process is specified
    2833  *             in bytes. The minimum and maximum working set sizes affect the
    2834  *             virtual memory paging behavior of a process.
    2835  * Parameters: HANDLE hProcess                open handle to the process of interest
    2836  *             DWORD  dwMinimumWorkingSetSize specifies minimum working set size
    2837  *             DWORD  dwMaximumWorkingSetSize specifies maximum working set size
    2838  * Variables :
    2839  * Result    : TRUE / FALSE
    2840  * Remark    :
    2841  * Status    : UNTESTED STUB
    2842  *
    2843  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
    2844  *****************************************************************************/
    2845 
    2846 BOOL WIN32API SetProcessWorkingSetSize(HANDLE hProcess,
    2847                                           DWORD  dwMinimumWorkingSetSize,
    2848                                           DWORD  dwMaximumWorkingSetSize)
    2849 {
    2850   dprintf(("KERNEL32: SetProcessWorkingSetSize(%08xh,%08xh,%08xh) not implemented.\n",
    2851            hProcess,
    2852            dwMinimumWorkingSetSize,
    2853            dwMaximumWorkingSetSize));
    2854 
    2855   return (FALSE);
    2856 }
    2857 
    2858 
    28592739/*****************************************************************************
    28602740 * Name      : BOOL SetSystemPowerState
  • trunk/src/kernel32/virtual.cpp

    r1811 r1885  
    1 /* $Id: virtual.cpp,v 1.23 1999-11-22 20:35:52 sandervl Exp $ */
     1/* $Id: virtual.cpp,v 1.24 1999-11-30 14:15:55 sandervl Exp $ */
    22
    33/*
     
    454454{
    455455  DWORD rc;
     456  DWORD  cb = cbSize;
    456457  ULONG  pageFlags = 0;
    457458  int npages;
     
    460461        return(FALSE);
    461462
    462   rc = OSLibDosQueryMem(lpvAddress, &cbSize, &pageFlags);
     463  rc = OSLibDosQueryMem(lpvAddress, &cb, &pageFlags);
    463464  if(rc) {
    464465        dprintf(("DosQueryMem returned %d\n", rc));
     
    502503  npages = (cbSize >> 12);
    503504
    504   if( (cbSize & 0xFFF) + offset > 0 ) {
     505  cb = (cbSize & 0xFFF) + offset; // !!! added, some optimization :)
     506  if( cb > 0 ) { // changed
    505507        npages++;
    506508  }
    507 
    508   if( (cbSize & 0xFFF) + offset >= 4096 ) {
     509  if( cb > 4096 ) { // changed, note '>' sign ( not '>=' ) 4096 is exactly one page
    509510        npages++;
    510511  }
  • trunk/src/kernel32/winimgres.cpp

    r1879 r1885  
    1 /* $Id: winimgres.cpp,v 1.28 1999-11-29 20:43:02 sandervl Exp $ */
     1/* $Id: winimgres.cpp,v 1.29 1999-11-30 14:15:55 sandervl Exp $ */
    22
    33/*
     
    267267        return 0;
    268268    }
     269    if(HIWORD(id)) {
     270            dprintf(("FindResource %s: resource %s (type %d, lang %d)", szModule, id, type, lang));
     271    }
     272    else    dprintf(("FindResource %s: resource %d (type %d, lang %d)", szModule, id, type, lang));
    269273    //ulRVAResourceSection contains the relative virtual address (relative to the start of the image)
    270274    //for the resource section (images loaded by the pe.exe and pe2lx/win32k)
  • trunk/src/kernel32/winres.cpp

    r1454 r1885  
    1 /* $Id: winres.cpp,v 1.21 1999-10-26 11:15:33 sandervl Exp $ */
     1/* $Id: winres.cpp,v 1.22 1999-11-30 14:15:55 sandervl Exp $ */
    22
    33/*
     
    115115PVOID Win32Resource::lockResource()
    116116{
    117   dprintf(("Win32Resource::lockResource %d\n", id));
     117  dprintf(("Win32Resource::lockResource %d %x\n", id, winresdata));
    118118
    119119  if(winresdata)
  • trunk/src/kernel32/wprocess.cpp

    r1844 r1885  
    1 /* $Id: wprocess.cpp,v 1.51 1999-11-26 00:05:20 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.52 1999-11-30 14:15:56 sandervl Exp $ */
    22
    33/*
     
    146146        //TLS in executable always TLS index 0?
    147147        ProcessTIBSel = tibsel;
     148        ProcessPDB.exit_code       = 0x103; /* STILL_ACTIVE */
     149        ProcessPDB.threads         = 1;
     150        ProcessPDB.running_threads = 1;
     151        ProcessPDB.ring0_threads   = 1;
     152        ProcessPDB.system_heap     = GetProcessHeap();
     153        ProcessPDB.parent          = 0;
     154        ProcessPDB.group           = &ProcessPDB;
     155        ProcessPDB.priority        = 8;  /* Normal */
     156        ProcessPDB.heap            = ProcessPDB.system_heap;  /* will be changed later on */
     157        ProcessPDB.next            = NULL;
     158        ProcessPDB.winver          = 0xffff; /* to be determined */
    148159   }
    149160   dprintf(("InitializeTIB setup TEB with selector %x", tibsel));
     
    822833}
    823834//******************************************************************************
    824 //******************************************************************************
    825 
    826 
    827 /***********************************************************************
    828  *           RegisterServiceProcess             (KERNEL, KERNEL32)
    829  *
    830  * A service process calls this function to ensure that it continues to run
    831  * even after a user logged off.
    832  */
    833 DWORD WIN32API RegisterServiceProcess(DWORD dwProcessId,
    834                                       DWORD dwType)
    835 {
    836   dprintf(("KERNEL32: RegisterServiceProcess(%08xh,%08xh) not implemented.\n",
    837            dwProcessId,
    838            dwType));
    839 
    840   /* I don't think that Wine needs to do anything in that function */
    841   return 1; /* success */
    842 }
    843 
    844 //******************************************************************************
    845835//TODO:What does this do exactly??
    846836//******************************************************************************
     
    865855  }
    866856}
    867 
     857//******************************************************************************
     858//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.