Changeset 21462 for trunk/src/kernel32/wprocess.cpp
- Timestamp:
- Sep 29, 2010, 12:04:46 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/wprocess.cpp
r21445 r21462 1918 1918 //****************************************************************************** 1919 1919 //****************************************************************************** 1920 static BOOL WINAPI O32_CreateProcessA(LPCSTR lpApplicationName, LPCSTR lpCommandLine, 1921 LPSECURITY_ATTRIBUTES lpProcessAttributes, 1922 LPSECURITY_ATTRIBUTES lpThreadAttributes, 1923 BOOL bInheritHandles, DWORD dwCreationFlags, 1924 LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, 1925 LPSTARTUPINFOA lpStartupInfo, 1926 LPPROCESS_INFORMATION lpProcessInfo) 1927 { 1928 LPSTR lpstr; 1929 DWORD cb; 1930 BOOL rc; 1931 1932 #define ALLOC_OEM(v) \ 1933 if (v) { \ 1934 lpstr = (LPSTR)_smalloc(strlen(v) + 1); \ 1935 CharToOemA(v, lpstr); \ 1936 v = lpstr; \ 1937 } 1938 #define FREE_OEM(v) \ 1939 if (v) \ 1940 _sfree((void*)v); \ 1941 1942 1943 // this converts all string arguments from ANSI to OEM expected by 1944 // O32_CreateProcess() 1945 1946 ALLOC_OEM(lpApplicationName) 1947 ALLOC_OEM(lpCommandLine) 1948 ALLOC_OEM(lpCurrentDirectory) 1949 1950 if (lpEnvironment) { 1951 cb = 0; 1952 lpstr = (LPSTR)lpEnvironment; 1953 while (lpstr[cb]) { 1954 cb += strlen(&lpstr[cb]) + 1; 1955 } 1956 ++cb; 1957 lpstr = (LPSTR)_smalloc(cb); 1958 CharToOemBuffA((LPSTR)lpEnvironment, lpstr, cb); 1959 lpEnvironment = lpstr; 1960 } 1961 1962 ALLOC_OEM(lpStartupInfo->lpReserved) 1963 ALLOC_OEM(lpStartupInfo->lpDesktop) 1964 ALLOC_OEM(lpStartupInfo->lpTitle) 1965 1966 rc = O32_CreateProcess(lpApplicationName, lpCommandLine, 1967 lpProcessAttributes, lpThreadAttributes, 1968 bInheritHandles, dwCreationFlags, 1969 lpEnvironment, lpCurrentDirectory, 1970 lpStartupInfo, lpProcessInfo); 1971 1972 FREE_OEM(lpStartupInfo->lpTitle) 1973 FREE_OEM(lpStartupInfo->lpDesktop) 1974 FREE_OEM(lpStartupInfo->lpReserved) 1975 1976 FREE_OEM(lpEnvironment) 1977 1978 FREE_OEM(lpCurrentDirectory) 1979 FREE_OEM(lpCommandLine) 1980 FREE_OEM(lpApplicationName) 1981 1982 return rc; 1983 } 1984 //****************************************************************************** 1985 //****************************************************************************** 1920 1986 BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine, 1921 1987 LPSECURITY_ATTRIBUTES lpProcessAttributes, … … 1926 1992 LPPROCESS_INFORMATION lpProcessInfo ) 1927 1993 { 1928 STARTUPINFOA startinfo; 1929 TEB *pThreadDB = (TEB*)GetThreadTEB(); 1930 char *cmdline = NULL, *newenv = NULL, *oldlibpath = NULL; 1931 BOOL rc; 1994 STARTUPINFOA startinfo; 1995 TEB *pThreadDB = (TEB*)GetThreadTEB(); 1996 char *cmdline = NULL, *newenv = NULL, *oldlibpath = NULL; 1997 BOOL rc; 1998 LPSTR lpstr; 1932 1999 1933 2000 dprintf(("KERNEL32: CreateProcessA %s cline:%s inherit:%d cFlags:%x Env:%x CurDir:%s StartupFlags:%x\n", … … 2097 2164 2098 2165 trylaunchagain: 2099 if (O32_CreateProcess(szAppName, lpCommandLine, lpProcessAttributes,2100 lpThreadAttributes, bInheritHandles, dwCreationFlags,2101 lpEnvironment, lpCurrentDirectory, lpStartupInfo,2102 lpProcessInfo) == TRUE)2166 if (O32_CreateProcessA(szAppName, lpCommandLine, lpProcessAttributes, 2167 lpThreadAttributes, bInheritHandles, dwCreationFlags, 2168 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 2169 lpProcessInfo) == TRUE) 2103 2170 { 2104 2171 if (dwCreationFlags & DEBUG_PROCESS && pThreadDB != NULL) … … 2224 2291 cmdline)); 2225 2292 2226 rc = O32_CreateProcess (lpszExecutable, (LPCSTR)cmdline,lpProcessAttributes,2227 lpThreadAttributes, bInheritHandles, dwCreationFlags,2228 lpEnvironment, lpCurrentDirectory, lpStartupInfo,2229 lpProcessInfo);2293 rc = O32_CreateProcessA(lpszExecutable, (LPCSTR)cmdline,lpProcessAttributes, 2294 lpThreadAttributes, bInheritHandles, dwCreationFlags, 2295 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 2296 lpProcessInfo); 2230 2297 } 2231 2298 else … … 2244 2311 szNELoader, 2245 2312 cmdline)); 2246 rc = O32_CreateProcess (szNELoader, (LPCSTR)cmdline, lpProcessAttributes,2247 lpThreadAttributes, bInheritHandles, dwCreationFlags,2248 lpEnvironment, lpCurrentDirectory, lpStartupInfo,2249 lpProcessInfo);2313 rc = O32_CreateProcessA(szNELoader, (LPCSTR)cmdline, lpProcessAttributes, 2314 lpThreadAttributes, bInheritHandles, dwCreationFlags, 2315 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 2316 lpProcessInfo); 2250 2317 } 2251 2318 else {//os/2 app?? 2252 rc = O32_CreateProcess (szAppName, (LPCSTR)lpCommandLine, lpProcessAttributes,2253 lpThreadAttributes, bInheritHandles, dwCreationFlags,2254 lpEnvironment, lpCurrentDirectory, lpStartupInfo,2255 lpProcessInfo);2319 rc = O32_CreateProcessA(szAppName, (LPCSTR)lpCommandLine, lpProcessAttributes, 2320 lpThreadAttributes, bInheritHandles, dwCreationFlags, 2321 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 2322 lpProcessInfo); 2256 2323 } 2257 2324 if(!lpEnvironment) {
Note:
See TracChangeset
for help on using the changeset viewer.