* autoload.cc (GetNativeSystemInfo): Add.
(IsWow64Process): Add. * init.cc (respawn_wow64_process): New function. (dll_entry): If process has been started from a 64 bit process, call respawn_wow64_process. * uname.cc (uname): On 64 bit systems, use GetNativeSystemInfo. Show actual CPU type.
This commit is contained in:
parent
61e6420f32
commit
65c5aa77fb
@ -1,3 +1,14 @@
|
|||||||
|
2004-07-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* autoload.cc (GetNativeSystemInfo): Add.
|
||||||
|
(IsWow64Process): Add.
|
||||||
|
* init.cc (respawn_wow64_process): New function.
|
||||||
|
(dll_entry): If process has been started from a 64 bit
|
||||||
|
process, call respawn_wow64_process.
|
||||||
|
* uname.cc (uname): On 64 bit systems, use GetNativeSystemInfo.
|
||||||
|
Show actual CPU type.
|
||||||
|
|
||||||
2004-07-23 Corinna Vinschen <corinna@vinschen.de>
|
2004-07-23 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* dtable.cc (dtable::get_debugger_info): Make stderr r/w according
|
* dtable.cc (dtable::get_debugger_info): Make stderr r/w according
|
||||||
|
@ -501,9 +501,11 @@ LoadDLLfuncEx (CreateToolhelp32Snapshot, 8, kernel32, 1)
|
|||||||
LoadDLLfuncEx2 (GetCompressedFileSizeA, 8, kernel32, 1, 0xffffffff)
|
LoadDLLfuncEx2 (GetCompressedFileSizeA, 8, kernel32, 1, 0xffffffff)
|
||||||
LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1)
|
LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1)
|
||||||
LoadDLLfuncEx (GetDiskFreeSpaceEx, 16, kernel32, 1)
|
LoadDLLfuncEx (GetDiskFreeSpaceEx, 16, kernel32, 1)
|
||||||
|
LoadDLLfuncEx (GetNativeSystemInfo, 4, kernel32, 1)
|
||||||
LoadDLLfuncEx (GetSystemTimes, 12, kernel32, 1)
|
LoadDLLfuncEx (GetSystemTimes, 12, kernel32, 1)
|
||||||
LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1)
|
LoadDLLfuncEx2 (IsDebuggerPresent, 0, kernel32, 1, 1)
|
||||||
LoadDLLfunc (IsProcessorFeaturePresent, 4, kernel32);
|
LoadDLLfunc (IsProcessorFeaturePresent, 4, kernel32);
|
||||||
|
LoadDLLfuncEx (IsWow64Process, 8, kernel32, 1);
|
||||||
LoadDLLfuncEx (Process32First, 8, kernel32, 1)
|
LoadDLLfuncEx (Process32First, 8, kernel32, 1)
|
||||||
LoadDLLfuncEx (Process32Next, 8, kernel32, 1)
|
LoadDLLfuncEx (Process32Next, 8, kernel32, 1)
|
||||||
LoadDLLfuncEx (RegisterServiceProcess, 8, kernel32, 1)
|
LoadDLLfuncEx (RegisterServiceProcess, 8, kernel32, 1)
|
||||||
|
@ -87,14 +87,41 @@ munge_threadfunc ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __attribute__ ((noreturn))
|
||||||
|
respawn_wow64_process ()
|
||||||
|
{
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
STARTUPINFO si;
|
||||||
|
GetStartupInfo (&si);
|
||||||
|
if (!CreateProcessA (NULL, GetCommandLineA (), NULL, NULL, TRUE,
|
||||||
|
CREATE_DEFAULT_ERROR_MODE
|
||||||
|
| GetPriorityClass (GetCurrentProcess ()),
|
||||||
|
NULL, NULL, &si, &pi))
|
||||||
|
api_fatal ("Failed to create process <%s>: %E", GetCommandLineA ());
|
||||||
|
CloseHandle (pi.hThread);
|
||||||
|
if (WaitForSingleObject (pi.hProcess, INFINITE) == WAIT_FAILED)
|
||||||
|
api_fatal ("Waiting for process %d failed: %E", pi.dwProcessId);
|
||||||
|
CloseHandle (pi.hProcess);
|
||||||
|
ExitProcess (0);
|
||||||
|
}
|
||||||
|
|
||||||
extern void __stdcall dll_crt0_0 ();
|
extern void __stdcall dll_crt0_0 ();
|
||||||
|
|
||||||
extern "C" int WINAPI
|
extern "C" int WINAPI
|
||||||
dll_entry (HANDLE h, DWORD reason, void *static_load)
|
dll_entry (HANDLE h, DWORD reason, void *static_load)
|
||||||
{
|
{
|
||||||
|
BOOL is_64bit_machine = FALSE;
|
||||||
|
|
||||||
switch (reason)
|
switch (reason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
|
/* Is the stack at an unusual high address? Check if we're running on
|
||||||
|
a 64 bit machine. If so, respawn. */
|
||||||
|
if (&is_64bit_machine >= (PBOOL) 0x400000
|
||||||
|
&& IsWow64Process (hMainProc, &is_64bit_machine)
|
||||||
|
&& is_64bit_machine)
|
||||||
|
respawn_wow64_process ();
|
||||||
|
|
||||||
prime_threads ();
|
prime_threads ();
|
||||||
dynamically_loaded = (static_load == NULL);
|
dynamically_loaded = (static_load == NULL);
|
||||||
dll_crt0_0 ();
|
dll_crt0_0 ();
|
||||||
|
@ -29,6 +29,10 @@ uname (struct utsname *name)
|
|||||||
memset (name, 0, sizeof (*name));
|
memset (name, 0, sizeof (*name));
|
||||||
__small_sprintf (name->sysname, "CYGWIN_%s", wincap.osname ());
|
__small_sprintf (name->sysname, "CYGWIN_%s", wincap.osname ());
|
||||||
|
|
||||||
|
BOOL is_64bit_machine = FALSE;
|
||||||
|
if (IsWow64Process (hMainProc, &is_64bit_machine) && is_64bit_machine)
|
||||||
|
GetNativeSystemInfo (&sysinfo);
|
||||||
|
else
|
||||||
GetSystemInfo (&sysinfo);
|
GetSystemInfo (&sysinfo);
|
||||||
|
|
||||||
/* Computer name */
|
/* Computer name */
|
||||||
@ -74,6 +78,14 @@ uname (struct utsname *name)
|
|||||||
}
|
}
|
||||||
__small_sprintf (name->machine, "i%d86", ptype);
|
__small_sprintf (name->machine, "i%d86", ptype);
|
||||||
break;
|
break;
|
||||||
|
case PROCESSOR_ARCHITECTURE_IA64:
|
||||||
|
strcpy (name->machine, "ia64");
|
||||||
|
break;
|
||||||
|
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||||
|
strcpy (name->machine, "amd64");
|
||||||
|
break;
|
||||||
|
case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
|
||||||
|
strcpy (name->machine, "ia32-win64");
|
||||||
case PROCESSOR_ARCHITECTURE_ALPHA:
|
case PROCESSOR_ARCHITECTURE_ALPHA:
|
||||||
strcpy (name->machine, "alpha");
|
strcpy (name->machine, "alpha");
|
||||||
break;
|
break;
|
||||||
|
@ -37,7 +37,7 @@ details. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32_WINNT
|
#ifndef _WIN32_WINNT
|
||||||
#define _WIN32_WINNT 0x0500
|
#define _WIN32_WINNT 0x0501
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user