Commit aaf3503e authored by Alexandre Julliard's avatar Alexandre Julliard

Moved almost all remaining process, thread, fiber and exception

functions to dlls/kernel.
parent 1479aebd
EXTRADEFS = -D_KERNEL32_
EXTRADEFS = -D_KERNEL32_ -DBINDIR="\"$(bindir)\""
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
......@@ -27,6 +27,8 @@ C_SRCS = \
console.c \
debugger.c \
editline.c \
except.c \
fiber.c \
file.c \
file16.c \
format_msg.c \
......
......@@ -37,7 +37,6 @@ C_SRCS = \
$(TOPOBJDIR)/relay32/relay386.c \
$(TOPOBJDIR)/relay32/snoop.c \
$(TOPOBJDIR)/scheduler/client.c \
$(TOPOBJDIR)/scheduler/fiber.c \
$(TOPOBJDIR)/scheduler/handle.c \
$(TOPOBJDIR)/scheduler/process.c \
$(TOPOBJDIR)/scheduler/pthread.c \
......@@ -45,7 +44,6 @@ C_SRCS = \
$(TOPOBJDIR)/scheduler/syslevel.c \
$(TOPOBJDIR)/scheduler/thread.c \
$(TOPOBJDIR)/win32/device.c \
$(TOPOBJDIR)/win32/except.c \
$(TOPOBJDIR)/win32/newfns.c \
cdrom.c \
critsection.c \
......
......@@ -418,13 +418,13 @@ void *wine_dll_load_main_exe( const char *name, char *error, int errorsize,
void wine_init( int argc, char *argv[], char *error, int error_size )
{
int file_exists;
void *ntdll;
void *kernel;
void (*init_func)(int, char **);
if (!(ntdll = dlopen_dll( "ntdll.dll", error, error_size, 0, &file_exists ))) return;
if (!dlopen_dll( "ntdll.dll", error, error_size, 0, &file_exists )) return;
/* make sure kernel32 is loaded too */
if (!dlopen_dll( "kernel32.dll", error, error_size, 0, &file_exists )) return;
if (!(init_func = wine_dlsym( ntdll, "__wine_process_init", error, error_size ))) return;
if (!(kernel = dlopen_dll( "kernel32.dll", error, error_size, 0, &file_exists ))) return;
if (!(init_func = wine_dlsym( kernel, "__wine_process_init", error, error_size ))) return;
init_func( argc, argv );
}
......
......@@ -52,25 +52,6 @@ WINE_DECLARE_DEBUG_CHANNEL(win32);
WINE_DECLARE_DEBUG_CHANNEL(loaddll);
/***********************************************************************
* wait_input_idle
*
* Wrapper to call WaitForInputIdle USER function
*/
typedef DWORD (WINAPI *WaitForInputIdle_ptr)( HANDLE hProcess, DWORD dwTimeOut );
static DWORD wait_input_idle( HANDLE process, DWORD timeout )
{
HMODULE mod = GetModuleHandleA( "user32.dll" );
if (mod)
{
WaitForInputIdle_ptr ptr = (WaitForInputIdle_ptr)GetProcAddress( mod, "WaitForInputIdle" );
if (ptr) return ptr( process, timeout );
}
return 0;
}
/****************************************************************************
* DisableThreadLibraryCalls (KERNEL32.@)
*
......@@ -388,104 +369,6 @@ BOOL WINAPI GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType )
/***********************************************************************
* WinExec (KERNEL32.@)
*/
UINT WINAPI WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
{
PROCESS_INFORMATION info;
STARTUPINFOA startup;
char *cmdline;
UINT ret;
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = nCmdShow;
/* cmdline needs to be writeable for CreateProcess */
if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(lpCmdLine)+1 ))) return 0;
strcpy( cmdline, lpCmdLine );
if (CreateProcessA( NULL, cmdline, NULL, NULL, FALSE,
0, NULL, NULL, &startup, &info ))
{
/* Give 30 seconds to the app to come up */
if (wait_input_idle( info.hProcess, 30000 ) == 0xFFFFFFFF)
WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
ret = 33;
/* Close off the handles */
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
}
else if ((ret = GetLastError()) >= 32)
{
FIXME("Strange error set by CreateProcess: %d\n", ret );
ret = 11;
}
HeapFree( GetProcessHeap(), 0, cmdline );
return ret;
}
/**********************************************************************
* LoadModule (KERNEL32.@)
*/
HINSTANCE WINAPI LoadModule( LPCSTR name, LPVOID paramBlock )
{
LOADPARAMS *params = (LOADPARAMS *)paramBlock;
PROCESS_INFORMATION info;
STARTUPINFOA startup;
HINSTANCE hInstance;
LPSTR cmdline, p;
char filename[MAX_PATH];
BYTE len;
if (!name) return (HINSTANCE)ERROR_FILE_NOT_FOUND;
if (!SearchPathA( NULL, name, ".exe", sizeof(filename), filename, NULL ) &&
!SearchPathA( NULL, name, NULL, sizeof(filename), filename, NULL ))
return (HINSTANCE)GetLastError();
len = (BYTE)params->lpCmdLine[0];
if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(filename) + len + 2 )))
return (HINSTANCE)ERROR_NOT_ENOUGH_MEMORY;
strcpy( cmdline, filename );
p = cmdline + strlen(cmdline);
*p++ = ' ';
memcpy( p, params->lpCmdLine + 1, len );
p[len] = 0;
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
if (params->lpCmdShow)
{
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = params->lpCmdShow[1];
}
if (CreateProcessA( filename, cmdline, NULL, NULL, FALSE, 0,
params->lpEnvAddress, NULL, &startup, &info ))
{
/* Give 30 seconds to the app to come up */
if (wait_input_idle( info.hProcess, 30000 ) == 0xFFFFFFFF )
WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
hInstance = (HINSTANCE)33;
/* Close off the handles */
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
}
else if ((hInstance = (HINSTANCE)GetLastError()) >= (HINSTANCE)32)
{
FIXME("Strange error set by CreateProcess: %p\n", hInstance );
hInstance = (HINSTANCE)11;
}
HeapFree( GetProcessHeap(), 0, cmdline );
return hInstance;
}
/***********************************************************************
* GetModuleHandleA (KERNEL32.@)
* GetModuleHandle32 (KERNEL.488)
*/
......@@ -779,15 +662,6 @@ BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
}
/***********************************************************************
* FreeLibraryAndExitThread (KERNEL32.@)
*/
VOID WINAPI FreeLibraryAndExitThread(HINSTANCE hLibModule, DWORD dwExitCode)
{
FreeLibrary(hLibModule);
ExitThread(dwExitCode);
}
/***********************************************************************
* GetProcAddress (KERNEL32.@)
*/
FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment