Changeset 15093


Ignore:
Timestamp:
Oct 25, 2000, 9:47:00 PM (24 years ago)
Author:
sandervl
Message:

SearchPathA fix (multiple dirs), add rename odin.ini entry for winspool.drv, extra pointer checks in Read/WriteProcessMemory

Location:
tags/trunk/src/kernel32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/kernel32/directory.cpp

    r15040 r15093  
    1 /* $Id: directory.cpp,v 1.32 2000-10-09 22:51:17 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.33 2000-10-25 19:46:59 sandervl Exp $ */
    22
    33/*
     
    589589    if (path && !*path) path = NULL;  /* Ignore empty path */
    590590
     591    /* See if path is a list of directories to search. If so, only search
     592       those (according to SDK docs) */
     593    if ((path != NULL) && strchr(path, ';')) {
     594        ret = OSLibDosSearchPath(OSLIB_SEARCHDIR, (LPSTR)path, (LPSTR)name,
     595                                 full_name, MAX_PATHNAME_LEN);
     596        goto done;
     597    }
     598
    591599    len = strlen(name);
    592600    if (ext) len += strlen(ext);
  • TabularUnified tags/trunk/src/kernel32/initsystem.cpp

    r15077 r15093  
    1 /* $Id: initsystem.cpp,v 1.21 2000-10-21 14:30:46 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.22 2000-10-25 19:46:59 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry, directories & environment)
     
    618618   RegCloseKey(hkey);
    619619
     620
     621//[HKEY_LOCAL_MACHINE\Software\Microsoft\OLE]
     622//# allow cross-machine calls (RPC) (default Y)
     623//"EnableDCOM"="Y"
     624//# allow incoming connections ? (def. N)
     625//"EnableRemoteConnect"="N"
     626   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\OLE",&hkey)!=ERROR_SUCCESS) {
     627    goto initreg_error;
     628   }
     629   digbuf[0] = 'Y';
     630   digbuf[1] = 0;
     631   RegSetValueExA(hkey, "EnableDCOM",0,REG_SZ, (LPBYTE)digbuf, 2);
     632   digbuf[0] = 'N';
     633   digbuf[1] = 0;
     634   RegSetValueExA(hkey, "EnableRemoteConnect",0,REG_SZ, (LPBYTE)digbuf, 2);
     635   RegCloseKey(hkey);
     636
    620637   return TRUE;
    621638
  • TabularUnified tags/trunk/src/kernel32/stubs.cpp

    r14792 r15093  
    16861686
    16871687DWORD WIN32API ReadProcessMemory(HANDLE  hProcess,
    1688                                     LPCVOID lpBaseAddress,
    1689                                     LPVOID  lpBuffer,
    1690                                     DWORD   cbRead,
    1691                                     LPDWORD lpNumberOfBytesRead)
    1692 {
    1693   dprintf(("Kernel32: ReadProcessMemory(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
     1688                                 LPCVOID lpBaseAddress,
     1689                                 LPVOID  lpBuffer,
     1690                                 DWORD   cbRead,
     1691                                 LPDWORD lpNumberOfBytesRead)
     1692{
     1693  dprintf(("Kernel32: ReadProcessMemory(%08xh,%08xh,%08xh,%08xh,%08xh) not completely implemented",
    16941694           hProcess,
    16951695           lpBaseAddress,
     
    16991699
    17001700  // do some (faked) access check
    1701   if (hProcess != GetCurrentProcess())
     1701  if(hProcess != GetCurrentProcess())
    17021702  {
    1703     SetLastError(ERROR_ACCESS_DENIED);
    1704     return FALSE;
     1703        dprintf(("WARNING: ReadProcessMemory: can't read memory from other processes!"));
     1704        SetLastError(ERROR_ACCESS_DENIED);
     1705        return FALSE;
    17051706  }
    17061707
    1707  
     1708  if(IsBadReadPtr(lpBaseAddress, cbRead)) {
     1709        dprintf(("ERROR: ReadProcessMemory bad source pointer!"));
     1710        if(lpNumberOfBytesRead)
     1711            *lpNumberOfBytesRead = 0;
     1712        SetLastError(ERROR_ACCESS_DENIED);
     1713        return FALSE;
     1714  }
    17081715  // FIXME: check this, if we ever run win32 binaries in different addressspaces
    17091716  //    ... and add a sizecheck
    17101717  memcpy(lpBuffer,lpBaseAddress,cbRead);
    1711   if (lpNumberOfBytesRead)
    1712     *lpNumberOfBytesRead = cbRead;
    1713  
     1718  if(lpNumberOfBytesRead)
     1719        *lpNumberOfBytesRead = cbRead;
     1720
     1721  SetLastError(ERROR_SUCCESS);
    17141722  return TRUE;
    17151723}
     
    17401748{
    17411749  // do some (faked) access check
    1742   if (hProcess != GetCurrentProcess())
     1750  if(hProcess != GetCurrentProcess())
    17431751  {
    1744     dprintf(("Kernel32: WriteProcessMemory(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented (different process!!)",
    1745            hProcess,
    1746            lpBaseAddress,
    1747            lpBuffer,
    1748            cbWrite,
    1749            lpNumberOfBytesWritten));
    1750     SetLastError(ERROR_ACCESS_DENIED);
    1751     return FALSE;
     1752        dprintf(("Kernel32: WriteProcessMemory(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented (different process!!)",
     1753                 hProcess, lpBaseAddress, lpBuffer, cbWrite, lpNumberOfBytesWritten));
     1754        SetLastError(ERROR_ACCESS_DENIED);
     1755        return FALSE;
    17521756  }
    17531757  dprintf(("Kernel32: WriteProcessMemory(%08xh,%08xh,%08xh,%08xh,%08xh))",
    1754            hProcess,
    1755            lpBaseAddress,
    1756            lpBuffer,
    1757            cbWrite,
    1758            lpNumberOfBytesWritten));
    1759  
     1758           hProcess,lpBaseAddress, lpBuffer, cbWrite, lpNumberOfBytesWritten));
     1759
     1760  if(IsBadWritePtr((LPVOID)lpBaseAddress, cbWrite))
     1761  {
     1762        dprintf(("ERROR: WriteProcessMemory bad destination pointer!"));
     1763        if(lpNumberOfBytesWritten)
     1764            *lpNumberOfBytesWritten = 0;
     1765        SetLastError(ERROR_ACCESS_DENIED);
     1766        return FALSE;
     1767  }
     1768
    17601769  // FIXME: check this, if we ever run win32 binaries in different addressspaces
    17611770  //    ... and add a sizecheck
    17621771  memcpy((void*)lpBaseAddress,lpBuffer,cbWrite);
    1763   if (lpNumberOfBytesWritten)
    1764     *lpNumberOfBytesWritten = cbWrite;
    1765  
     1772  if(lpNumberOfBytesWritten)
     1773        *lpNumberOfBytesWritten = cbWrite;
     1774
     1775  SetLastError(ERROR_SUCCESS);
    17661776  return TRUE;
    17671777}
  • TabularUnified tags/trunk/src/kernel32/windllbase.cpp

    r15090 r15093  
    1 /* $Id: windllbase.cpp,v 1.19 2000-10-23 13:42:42 sandervl Exp $ */
     1/* $Id: windllbase.cpp,v 1.20 2000-10-25 19:47:00 sandervl Exp $ */
    22
    33/*
     
    667667        PROFILE_SetOdinIniString(DLLRENAMEOS2_SECTION, "WNETAP32", "NETAPI32");
    668668    }
     669    if(PROFILE_GetOdinIniString(DLLRENAMEWIN_SECTION, "WINSPOOL", "", renameddll,
     670                                sizeof(renameddll)-1) <= 1)
     671    {
     672        PROFILE_SetOdinIniString(DLLRENAMEWIN_SECTION, "WINSPOOL", "WINSPOOL.DLL");
     673        PROFILE_SetOdinIniString(DLLRENAMEOS2_SECTION, "WINSPOOL", "WINSPOOL.DRV");
     674    }
    669675}
    670676//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.