2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
19 /* The global error value
23 /*********************************************************************
24 * CloseHandle (KERNEL32.23)
26 BOOL
CloseHandle(KERNEL_OBJECT
*handle
)
28 if(ValidateKernelObject(handle
) != 0)
30 SetLastError(ERROR_INVALID_HANDLE
);
34 if (handle
<0x1000) /* FIXME: hack */
35 return CloseFileHandle(handle
);
38 case KERNEL_OBJECT_UNUSED
:
39 SetLastError(ERROR_INVALID_HANDLE
);
42 case KERNEL_OBJECT_FILE:
43 rc = CloseFileHandle((FILE_OBJECT *)handle);
48 dprintf_win32(stddeb
, "CloseHandle: type %ld not implemented yet.\n",
53 ReleaseKernelObject(handle
);
57 /***********************************************************************
58 * GetModuleFileNameA (KERNEL32.235)
60 DWORD
GetModuleFileNameA(HMODULE32 hModule
, LPSTR lpFilename
, DWORD nSize
)
62 strcpy(lpFilename
, "c:\\dummy");
66 /***********************************************************************
67 * GetModuleHandle (KERNEL32.237)
69 HMODULE32
WIN32_GetModuleHandle(char *module
)
73 dprintf_win32(stddeb
, "GetModuleHandle: %s\n", module
? module
: "NULL");
74 /* Freecell uses the result of GetModuleHandleA(0) as the hInstance in
75 all calls to e.g. CreateWindowEx. */
77 TDB
*pTask
= (TDB
*)GlobalLock16( GetCurrentTask() );
78 hModule
= pTask
->hInstance
;
80 hModule
= GetModuleHandle(module
);
81 dprintf_win32(stddeb
, "GetModuleHandle: returning %d\n", hModule
);
85 /***********************************************************************
86 * GetStartupInfoA (KERNEL32.273)
88 VOID
GetStartupInfoA(LPSTARTUPINFO lpStartupInfo
)
90 lpStartupInfo
->cb
= sizeof(STARTUPINFO
);
91 lpStartupInfo
->lpReserved
= NULL
;
92 lpStartupInfo
->lpDesktop
= "Desktop";
93 lpStartupInfo
->lpTitle
= "Title";
95 lpStartupInfo
->cbReserved2
= 0;
96 lpStartupInfo
->lpReserved2
= NULL
; /* must be NULL for VC runtime */
97 lpStartupInfo
->hStdInput
= (HANDLE32
)0;
98 lpStartupInfo
->hStdOutput
= (HANDLE32
)1;
99 lpStartupInfo
->hStdError
= (HANDLE32
)2;
102 /* Initialize whatever internal data structures we need.
104 * Returns 1 on success, 0 on failure.
106 int KERN32_Init(void)
109 /* Initialize exception handling */