Changeset 4946 for trunk/src


Ignore:
Timestamp:
Jan 14, 2001, 6:16:55 PM (25 years ago)
Author:
sandervl
Message:

odininst update, CreateProcess fix & workaround for PM hang in WaitForSingleObject (process handle)

Location:
trunk/src/kernel32
Files:
4 edited

Legend:

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

    r4739 r4946  
    1 /* $Id: HandleManager.cpp,v 1.56 2000-12-03 10:12:32 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.57 2001-01-14 17:16:54 sandervl Exp $ */
    22
    33/*
     
    6262#include "HMNPipe.h"
    6363#include <vmutex.h>
     64#include <win\thread.h>
    6465
    6566#define DBG_LOCALLOG  DBG_handlemanager
     
    18511852  if (-1 == iIndex)                                               /* error ? */
    18521853  {
    1853     dprintf(("KERNEL32: HandleManager:HMWaitForSingleObject(%08xh) passed on to Open32.\n",
    1854              hObject));
    1855 
     1854       dprintf(("KERNEL32: HandleManager:HMWaitForSingleObject(%08xh) passed on to Open32.\n",
     1855                 hObject));
     1856
     1857#if 1
     1858       //Workaround for applications that block the PM input queue
     1859       //while waiting for a child process to terminate.
     1860       //(WaitSingleObject now calls MsgWaitMultipleObjects and
     1861       // processes messages while waiting for the process to die)
     1862       //(Napster install now doesn't block PM anymore (forcing a reboot))
     1863
     1864       HMODULE hUser32 = LoadLibraryA("USER32.DLL");
     1865
     1866       BOOL (* WINAPI pfnPeekMessageA)(LPMSG,HWND,UINT,UINT,UINT);
     1867       LONG (* WINAPI pfnDispatchMessageA)(const MSG*);
     1868
     1869       *(FARPROC *)&pfnPeekMessageA = GetProcAddress(hUser32,"PeekMessageA");
     1870       *(FARPROC *)&pfnDispatchMessageA = GetProcAddress(hUser32,"DispatchMessageA");
     1871
     1872       TEB *teb = GetThreadTEB();
     1873
     1874       if(!teb || !pfnPeekMessageA || !pfnDispatchMessageA) {
     1875           dprintf(("ERROR: !teb || !pfnPeekMessageA || !pfnDispatchMessageA"));
     1876           DebugInt3();
     1877           return WAIT_FAILED;
     1878       }
     1879
     1880       //TODO: Ignoring all messages could be dangerous. But processing them,
     1881       //while the app doesn't expect any, isn't safe either.
     1882//-> must active check in pmwindow.cpp if this is enabled again!
     1883//       teb->o.odin.fIgnoreMsgs = TRUE;
     1884
     1885       while(TRUE) {
     1886           dwResult =  (O32_MsgWaitForMultipleObjects(1, &hObject, FALSE,
     1887                                                      INFINITE, QS_ALLINPUT));
     1888           if(dwResult == WAIT_OBJECT_0 + 1) {
     1889               MSG msg ;
     1890
     1891               while (pfnPeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
     1892               {
     1893                  if (msg.message == WM_QUIT)  return 1;
     1894
     1895                  /* otherwise dispatch it */
     1896                  pfnDispatchMessageA(&msg);
     1897
     1898               } // end of PeekMessage while loop
     1899           }
     1900           else {
     1901               dprintf(("WaitForSingleObject: Process %x terminated", hObject));
     1902               break;
     1903           }
     1904       }
     1905//       teb->o.odin.fIgnoreMsgs = FALSE;
     1906       FreeLibrary(hUser32);
     1907       return dwResult;
     1908  }
     1909  else {
     1910#else
    18561911    // maybe handles from CreateProcess() ...
    18571912    dwResult = O32_WaitForSingleObject(hObject, dwTimeout);
     1913#endif
    18581914    return (dwResult);
    18591915  }
  • trunk/src/kernel32/initsystem.cpp

    r4850 r4946  
    1 /* $Id: initsystem.cpp,v 1.24 2000-12-30 10:17:00 sandervl Exp $ */
     1/* $Id: initsystem.cpp,v 1.25 2001-01-14 17:16:54 sandervl Exp $ */
    22/*
    33 * Odin system initialization (registry, directories & environment)
     
    7171#define CLASS_SHORTCUT          "Shortcut"
    7272#define CLASS_SHELL32DLL    "shell32.dll"
     73#define CLASS_SHDOCVW       "shdocvw.dll"
    7374#define COM_CLASS_ID        "CLSID"
    7475#define COM_INPROCSERVER        "InprocServer32"
     
    335336   }
    336337   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 0);
     338   RegCloseKey(hkey);
     339
     340   //# Entries for IWebBrowser
     341   //# Used by Internet Explorer HTML-rendering control
     342   //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}]
     343   //@="Shortcut"
     344   //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\InProcServer32]
     345   //@="shdocvw.dll"
     346   //"ThreadingModel"="Apartment"
     347   //[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\shellex\MayChangeDefaultMenu]
     348   //@=""
     349
     350   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}",&hkey)!=ERROR_SUCCESS) {
     351    goto initreg_error;
     352   }
     353   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHORTCUT, sizeof(CLASS_SHORTCUT));
     354   RegCloseKey(hkey);
     355
     356   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\InProcServer32",&hkey)!=ERROR_SUCCESS) {
     357    goto initreg_error;
     358   }
     359   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)CLASS_SHDOCVW, sizeof(CLASS_SHDOCVW));
     360   RegSetValueExA(hkey, COM_THREADMODEL, 0, REG_SZ, (LPBYTE)COM_THREAD_APARTMENT, sizeof(COM_THREAD_APARTMENT));
     361   RegCloseKey(hkey);
     362
     363   if(RegCreateKeyA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\CLSID\\{8856f961-340a-11d0-a96b-00c04fd705a2}\\shellex\\MayChangeDefaultMenu",&hkey)!=ERROR_SUCCESS) {
     364    goto initreg_error;
     365   }
     366   RegSetValueExA(hkey, "", 0, REG_SZ, (LPBYTE)"", 1);
    337367   RegCloseKey(hkey);
    338368
  • trunk/src/kernel32/mmap.cpp

    r4802 r4946  
    1 /* $Id: mmap.cpp,v 1.47 2000-12-16 18:37:26 sandervl Exp $ */
     1/* $Id: mmap.cpp,v 1.48 2001-01-14 17:16:55 sandervl Exp $ */
    22
    33/*
     
    1919 * TODO: Suspend all threads when a page is committed (possible that another thread
    2020 *       accesses the same memory before the page is read from disk
     21 * TODO: File maps for new files (must select an initial size)!
    2122 *
    2223 * Project Odin Software License can be found in LICENSE.TXT
  • trunk/src/kernel32/wprocess.cpp

    r4682 r4946  
    1 /* $Id: wprocess.cpp,v 1.110 2000-11-23 19:23:51 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.111 2001-01-14 17:16:55 sandervl Exp $ */
    22
    33/*
     
    15681568        sprintf(cmdline, "%s", lpCommandLine);
    15691569    }
     1570
    15701571    char szAppName[255];
     1572    DWORD fileAttr;
    15711573    char *exename = szAppName;
    15721574    strncpy(szAppName, cmdline, sizeof(szAppName));
     
    15761578        while(*exename != 0 && *exename != '"')
    15771579             exename++;
     1580
     1581        if(*exename != 0) {
     1582             *exename = 0;
     1583        }
     1584        exename = &szAppName[1];
    15781585    }
    15791586    else {
     1587        BOOL fTerminate = FALSE;
     1588        DWORD fileAttr;
     1589
    15801590        //TODO: doesn't work for directories with spaces!
    1581         while(*exename != 0 && *exename != ' ' && *exename != '"')
    1582              exename++;
    1583     }
    1584     if(*exename != 0) {
    1585          *exename = 0;
    1586     }
    1587     if(szAppName[0] == '"') {
    1588         exename = &szAppName[1];
    1589     }
    1590     else exename = szAppName;
    1591 
    1592     if(GetFileAttributesA(exename) == -1) {
     1591        while(*exename != 0) {
     1592             while(*exename != 0 && *exename != ' ')
     1593                  exename++;
     1594
     1595             if(*exename != 0) {
     1596                  *exename = 0;
     1597                  fTerminate = TRUE;
     1598             }
     1599
     1600             fileAttr = GetFileAttributesA(szAppName);
     1601             if(fileAttr != -1 && !(fileAttr & FILE_ATTRIBUTE_DIRECTORY)) {
     1602                  break;
     1603             }
     1604             if(fTerminate) {
     1605                  *exename = ' ';
     1606                  exename++;
     1607                  fTerminate = FALSE;
     1608             }
     1609        }
     1610        exename = szAppName;
     1611    }
     1612    fileAttr = GetFileAttributesA(exename);
     1613    if(fileAttr == -1 || (fileAttr & FILE_ATTRIBUTE_DIRECTORY)) {
    15931614        dprintf(("CreateProcess: can't find executable!"));
    15941615        SetLastError(ERROR_FILE_NOT_FOUND);
    15951616        return FALSE;
    15961617    }
     1618
    15971619    dprintf(("KERNEL32:  CreateProcess %s\n", cmdline));
    15981620
Note: See TracChangeset for help on using the changeset viewer.