wine/win32/init.c
Alexandre Julliard 8cc3a5e4d4 Release 960811
Sun Aug 11 13:00:20 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure.in] [include/acconfig.h] [tools/build.c]
	Added check for underscore on external symbols.

	* [memory/selector.c] [memory/global.c]
	Fixed FreeSelector() to free only one selector.
	Added SELECTOR_FreeBlock() to free an array of selectors.

	* [objects/color.c]
	Fixed a bug in COLOR_ToLogical() that caused GetPixel() to fail on
	hi-color displays.

	* [tools/build.c] [if1632/crtdll.spec]
	Added 'extern' type, used for external variables or functions.

	* [windows/winpos.c]
	Allow de-activating a window in WINPOS_ChangeActiveWindow().

	* [windows/winproc.c]
	Added 32-to-16 translation for button messages.
	Fixed WINPROC_GetPtr() to avoid crashes on 32-bit procedures that
	happen to be valid SEGPTRs.

Sat Aug 10 18:22:25 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [windows/message.c]
	Removed a FIXME in MSG_PeekHardwareMsg(): produces correct 
	data for the JOURNALRECORD-hook (using EVENTMSG16 structure).

	* [if1632/gdi.spec] [include/windows.h] [objects/metafile.c]
	Introduced undocumented API function IsValidMetaFile(), plus a
 	minor fix in last patch of CopyMetaFile().

	* [objects/gdiobj.c]
	Removed a FIXME in IsGDIObject(): added magic word check.

Sun Aug 10 18:10:10 1996  Bruce Milner <Bruce.Milner@genetics.utah.edu>

	* [controls/statuswin.c]
	First pass at implementing the StatusWindow class.

	* [include/commctrl.h]
	Header file for common controls.

	* [controls/widgets.c]
	Added InitCommonControls().

	* [if1632/comctl32.spec]
	Add DrawStatusTextA, CreateStatusWindowA, InitCommonControls.

	* [win32/findfile.c] [if1632/kernel32.spec]
	Add FindNextFile32A, FindClose.
	Modified FindFirstFile32A so it works with FindNextFile32A.

	* [include/winbase.h]
	Fixed WIN32_FIND_DATA structure member names.

Sat Aug 10 09:00:00 1996  Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [windows/scroll.c]
	Changed scrolling routines to benefit from DCE code update.

Thu Aug  8 18:05:09 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/file.c]
	SearchPath* could get NULL for lastpart argument.

	* [if1632/build-spec.txt] [documentation/debugging]
	Varargs documentation added, debugging hints updated.

	* [if1632/crtdll.spec][misc/crtdll.c][misc/Makefile.in]
	Started to implement CRTDLL.

	* [if1632/wsock32.spec]
	Some thunks to standard libc functions (structures have the same
 	elements, but perhaps wrong offset due to packing).

	* [include/kernel32.h][include/windows.h][win32/*.c][loader/main.c]
	Merged kernel32.h into windows.h.

	* [misc/lstr.c]
	Enhanced FormatMessage().

	* [misc/main.c] [if1632/kernel.spec] [include/windows.h]
	GetVersion() updated to new naming standard.
	Changed language handling to support language ids.

	* [misc/shell.c]
	Enhanced FindExecutable, so it finds files in the search path too.

	* [win32/environment.c]
	GetCommandLine* updated.

	* [loader/resource.c] [loader/pe_resource.c]
	FindResourceEx32* added.
	Loading of messagetables added.
	Language handling now uses Wine default language id.
1996-08-11 15:49:51 +00:00

168 lines
4.3 KiB
C

/*
* Win32 kernel functions
*
* Copyright 1995 Martin von Loewis and Cameron Heide
*/
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
#include "handle32.h"
#include "except.h"
#include "task.h"
#include "stddebug.h"
#define DEBUG_WIN32
#include "debug.h"
/* The global error value
*/
int WIN32_LastError;
/* Standard system handles for stdin, stdout, and stderr.
*/
FILE_OBJECT *hstdin, *hstdout, *hstderr;
static int CreateStdHandles(void);
/*********************************************************************
* CloseHandle (KERNEL32.23)
*/
BOOL CloseHandle(KERNEL_OBJECT *handle)
{
int rc;
if(ValidateKernelObject(handle) != 0)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
switch(handle->magic)
{
case KERNEL_OBJECT_UNUSED:
SetLastError(ERROR_INVALID_HANDLE);
return 0;
case KERNEL_OBJECT_FILE:
rc = CloseFileHandle((FILE_OBJECT *)handle);
break;
default:
dprintf_win32(stddeb, "CloseHandle: type %ld not implemented yet.\n",
handle->magic);
break;
}
ReleaseKernelObject(handle);
return 0;
}
/***********************************************************************
* GetModuleFileNameA (KERNEL32.235)
*/
DWORD GetModuleFileNameA(HMODULE32 hModule, LPSTR lpFilename, DWORD nSize)
{
strcpy(lpFilename, "c:\\dummy");
return 8;
}
/***********************************************************************
* GetModuleHandle (KERNEL32.237)
*/
HMODULE32 WIN32_GetModuleHandle(char *module)
{
HMODULE32 hModule;
dprintf_win32(stddeb, "GetModuleHandle: %s\n", module ? module : "NULL");
/* Freecell uses the result of GetModuleHandleA(0) as the hInstance in
all calls to e.g. CreateWindowEx. */
if (module == NULL) {
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
hModule = pTask->hInstance;
} else
hModule = GetModuleHandle(module);
dprintf_win32(stddeb, "GetModuleHandle: returning %d\n", hModule );
return hModule;
}
/***********************************************************************
* GetStartupInfoA (KERNEL32.273)
*/
VOID GetStartupInfoA(LPSTARTUPINFO lpStartupInfo)
{
lpStartupInfo->cb = sizeof(STARTUPINFO);
lpStartupInfo->lpReserved = NULL;
lpStartupInfo->lpDesktop = "Desktop";
lpStartupInfo->lpTitle = "Title";
lpStartupInfo->cbReserved2 = 0;
lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */
lpStartupInfo->hStdInput = (HANDLE)0;
lpStartupInfo->hStdOutput = (HANDLE)1;
lpStartupInfo->hStdError = (HANDLE)2;
}
/* Initialize whatever internal data structures we need.
*
* Returns 1 on success, 0 on failure.
*/
int KERN32_Init(void)
{
#ifndef WINELIB
/* Initialize exception handling */
EXC_Init();
#endif
/* Create the standard system handles
*/
if(CreateStdHandles() != 0)
return 0;
return 1;
}
/* CreateStdHandles creates the standard input, output, and error handles.
* These handles aren't likely to be used since they're generally used for
* console output, but startup code still likes to mess with them. They're
* also useful for debugging since apps and runtime libraries might write
* errors to stderr.
*
* Returns 0 on success, nonzero on failure.
*/
static int CreateStdHandles(void)
{
/* Create the standard input handle.
*/
hstdin = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(hstdin == NULL)
return 1;
hstdin->common.magic = KERNEL_OBJECT_FILE;
hstdin->fd = 0;
hstdin->type = FILE_TYPE_CHAR;
hstdin->misc_flags = 0;
/* Create the standard output handle
*/
hstdout = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(hstdout == NULL)
return 1;
hstdout->common.magic = KERNEL_OBJECT_FILE;
hstdout->fd = 1;
hstdout->type = FILE_TYPE_CHAR;
hstdout->misc_flags = 0;
/* Create the standard error handle
*/
hstderr = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(hstderr == NULL)
return 1;
hstderr->common.magic = KERNEL_OBJECT_FILE;
hstderr->fd = 2;
hstderr->type = FILE_TYPE_CHAR;
hstderr->misc_flags = 0;
return 0;
}