Changeset 9743 for trunk/src/kernel32/wprocess.cpp
- Timestamp:
- Jan 30, 2003, 3:00:47 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/wprocess.cpp
r9693 r9743 1 /* $Id: wprocess.cpp,v 1.17 6 2003-01-20 10:46:28sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.177 2003-01-30 14:00:47 sandervl Exp $ */ 2 2 3 3 /* … … 1857 1857 } 1858 1858 1859 // open32 does not support DEBUG_ONLY_THIS_PROCESS1860 if(dwCreationFlags & DEBUG_ONLY_THIS_PROCESS)1861 dwCreationFlags |= DEBUG_PROCESS;1862 1863 if(O32_CreateProcess(lpApplicationName, lpCommandLine, lpProcessAttributes,1864 lpThreadAttributes, bInheritHandles, dwCreationFlags,1865 lpEnvironment, lpCurrentDirectory, lpStartupInfo,1866 lpProcessInfo) == TRUE)1867 {1868 if (dwCreationFlags & DEBUG_PROCESS && pThreadDB != NULL)1869 {1870 if(pThreadDB->o.odin.pidDebuggee != 0)1871 {1872 // TODO: handle this1873 dprintf(("KERNEL32: CreateProcess ERROR: This thread is already a debugger\n"));1874 }1875 else1876 {1877 pThreadDB->o.odin.pidDebuggee = lpProcessInfo->dwProcessId;1878 OSLibStartDebugger((ULONG*)&pThreadDB->o.odin.pidDebuggee);1879 }1880 }1881 else pThreadDB->o.odin.pidDebuggee = 0;1882 1883 if(lpProcessInfo)1884 {1885 lpProcessInfo->dwThreadId = MAKE_THREADID(lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId);1886 }1887 1888 return(TRUE);1889 }1890 1891 // PH 2001-05-071892 // verify why O32_CreateProcess actually failed.1893 // If GetLastError() == 191 (ERROR_INVALID_EXE_SIGNATURE)1894 // we can continue to call "PE.EXE".1895 // Note: Open32 does not translate ERROR_INVALID_EXE_SIGNATURE,1896 // it is also valid in Win32.1897 DWORD dwError = GetLastError();1898 if (ERROR_INVALID_EXE_SIGNATURE != dwError && ERROR_FILE_NOT_FOUND != dwError && ERROR_ACCESS_DENIED != dwError)1899 {1900 dprintf(("CreateProcess: O32_CreateProcess failed with rc=%d, not PE-executable !",1901 dwError));1902 1903 // the current value of GetLastError() is still valid.1904 1905 return FALSE;1906 }1907 1908 // else ...1909 1910 //probably a win32 exe, so run it in the pe loader1911 1859 if(lpApplicationName) { 1912 1860 if(lpCommandLine) { … … 1921 1869 cmdline = (char *)malloc(strlen(lpApplicationName)+strlen(lpCommandLine) + 16); 1922 1870 sprintf(cmdline, "%s %s", lpApplicationName, lpCommandLine); 1923 1924 1871 } 1872 else { 1925 1873 cmdline = (char *)malloc(strlen(lpApplicationName) + 16); 1926 1874 sprintf(cmdline, "%s", lpApplicationName); … … 1936 1884 DWORD fileAttr; 1937 1885 char *exename = buffer; 1938 strncpy(buffer, cmdline, sizeof( szAppName));1886 strncpy(buffer, cmdline, sizeof(buffer)); 1939 1887 buffer[MAX_PATH-1] = 0; 1940 1888 if(*exename == '"') { … … 1985 1933 if(fileAttr == -1 || (fileAttr & FILE_ATTRIBUTE_DIRECTORY)) { 1986 1934 dprintf(("CreateProcess: can't find executable!")); 1935 1936 if(cmdline) 1937 free(cmdline); 1938 1987 1939 SetLastError(ERROR_FILE_NOT_FOUND); 1988 1940 return FALSE; 1989 1941 } 1990 1942 1943 // open32 does not support DEBUG_ONLY_THIS_PROCESS 1944 if(dwCreationFlags & DEBUG_ONLY_THIS_PROCESS) 1945 dwCreationFlags |= DEBUG_PROCESS; 1946 1947 if(O32_CreateProcess(szAppName, lpCommandLine, lpProcessAttributes, 1948 lpThreadAttributes, bInheritHandles, dwCreationFlags, 1949 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 1950 lpProcessInfo) == TRUE) 1951 { 1952 if (dwCreationFlags & DEBUG_PROCESS && pThreadDB != NULL) 1953 { 1954 if(pThreadDB->o.odin.pidDebuggee != 0) 1955 { 1956 // TODO: handle this 1957 dprintf(("KERNEL32: CreateProcess ERROR: This thread is already a debugger\n")); 1958 } 1959 else 1960 { 1961 pThreadDB->o.odin.pidDebuggee = lpProcessInfo->dwProcessId; 1962 OSLibStartDebugger((ULONG*)&pThreadDB->o.odin.pidDebuggee); 1963 } 1964 } 1965 else pThreadDB->o.odin.pidDebuggee = 0; 1966 1967 if(lpProcessInfo) 1968 { 1969 lpProcessInfo->dwThreadId = MAKE_THREADID(lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId); 1970 } 1971 1972 if(cmdline) 1973 free(cmdline); 1974 return(TRUE); 1975 } 1976 1977 // PH 2001-05-07 1978 // verify why O32_CreateProcess actually failed. 1979 // If GetLastError() == 191 (ERROR_INVALID_EXE_SIGNATURE) 1980 // we can continue to call "PE.EXE". 1981 // Note: Open32 does not translate ERROR_INVALID_EXE_SIGNATURE, 1982 // it is also valid in Win32. 1983 DWORD dwError = GetLastError(); 1984 if (ERROR_INVALID_EXE_SIGNATURE != dwError && ERROR_FILE_NOT_FOUND != dwError && ERROR_ACCESS_DENIED != dwError) 1985 { 1986 dprintf(("CreateProcess: O32_CreateProcess failed with rc=%d, not PE-executable !", 1987 dwError)); 1988 1989 // the current value of GetLastError() is still valid. 1990 1991 if(cmdline) 1992 free(cmdline); 1993 1994 return FALSE; 1995 } 1996 1997 // else ... 1998 1999 //probably a win32 exe, so run it in the pe loader 1991 2000 dprintf(("KERNEL32: CreateProcess %s %s", szAppName, lpCommandLine)); 1992 2001
Note:
See TracChangeset
for help on using the changeset viewer.