blob: 6b49c54d0dac181160fba0fb90c1dfc9860d18c3 [file] [log] [blame]
Alexandre Julliardcdcdede1996-04-21 14:57:41 +00001/*
2 * W32SYS
3 * helper DLL for Win32s
4 *
5 * Copyright (c) 1996 Anand Kumria
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00006 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000020 */
21
Patrik Stridvalld016f812002-08-17 00:43:16 +000022#include "config.h"
23
24#ifdef HAVE_UNISTD_H
25# include <unistd.h>
26#endif
Alexandre Julliard2682bc22000-11-27 22:03:23 +000027
Jim Aston2e1cafa1999-03-14 16:35:05 +000028#include "windef.h"
Alexandre Julliard83f52d12000-09-26 22:20:14 +000029#include "wine/windef16.h"
Alexandre Julliard2682bc22000-11-27 22:03:23 +000030#include "wine/winbase16.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000031#include "wine/debug.h"
Marcus Meissner2f521d31999-09-10 13:51:11 +000032
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000033WINE_DEFAULT_DEBUG_CHANNEL(dll);
Alexandre Julliarda007f332000-08-09 00:54:58 +000034
35typedef struct
36{
37 BYTE bMajor;
38 BYTE bMinor;
39 WORD wBuildNumber;
40 BOOL16 fDebug;
41} WIN32SINFO, *LPWIN32SINFO;
Marcus Meissner2f521d31999-09-10 13:51:11 +000042
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000043/***********************************************************************
44 * GetWin32sInfo (W32SYS.12)
Alexandre Julliard54c27111998-03-29 19:44:57 +000045 * RETURNS
46 * 0 on success, 1 on failure
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000047 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000048WORD WINAPI GetWin32sInfo16(
Alexandre Julliard54c27111998-03-29 19:44:57 +000049 LPWIN32SINFO lpInfo /* [out] Win32S special information */
50) {
Alexandre Julliardcdcdede1996-04-21 14:57:41 +000051 lpInfo->bMajor = 1;
52 lpInfo->bMinor = 3;
53 lpInfo->wBuildNumber = 0;
54 lpInfo->fDebug = FALSE;
55
56 return 0;
57}
Alexandre Julliard54c27111998-03-29 19:44:57 +000058
59/***********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +000060 * GetW32SysVersion (W32SYS.5)
Alexandre Julliard4220b291999-07-11 17:20:01 +000061 */
Alexandre Julliarde02a5401999-07-24 10:28:37 +000062WORD WINAPI GetW32SysVersion16(void)
Alexandre Julliard4220b291999-07-11 17:20:01 +000063{
64 return 0x100;
65}
66
67/***********************************************************************
Alexandre Julliard54c27111998-03-29 19:44:57 +000068 * GetPEResourceTable (W32SYS.7)
69 * retrieves the resourcetable from the passed filedescriptor
70 * RETURNS
71 * dunno what.
72 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000073WORD WINAPI GetPEResourceTable16(
Alexandre Julliard54c27111998-03-29 19:44:57 +000074 HFILE16 hf /* [in] filedescriptor to opened executeable */
75) {
76 return 0;
77}
Marcus Meissner2f521d31999-09-10 13:51:11 +000078
Patrik Stridvall54fe8382000-04-06 20:21:16 +000079/***********************************************************************
Patrik Stridvall044855c2001-07-11 18:56:41 +000080 * LoadPeResource (W32SYS.11)
Patrik Stridvall54fe8382000-04-06 20:21:16 +000081 */
Marcus Meissner2f521d31999-09-10 13:51:11 +000082DWORD WINAPI LoadPeResource16(WORD x,SEGPTR y) {
83 FIXME("(0x%04x,0x%08lx),stub!\n",x,y);
84 return 0;
85}
Alexandre Julliard2682bc22000-11-27 22:03:23 +000086
87
88/**********************************************************************
Patrik Stridvall01d5e5b2001-07-02 19:59:40 +000089 * IsPeFormat (W32SYS.2)
Alexandre Julliard2682bc22000-11-27 22:03:23 +000090 * Checks the passed filename if it is a PE format executeable
91 * RETURNS
92 * TRUE, if it is.
93 * FALSE if not.
94 */
95BOOL16 WINAPI IsPeFormat16( LPSTR fn, /* [in] filename to executeable */
96 HFILE16 hf16 ) /* [in] open file, if filename is NULL */
97{
98 BOOL16 ret = FALSE;
99 IMAGE_DOS_HEADER mzh;
100 OFSTRUCT ofs;
101 DWORD xmagic;
102 HFILE hf;
103
104 if (fn) hf = OpenFile(fn,&ofs,OF_READ);
105 else hf = DosFileHandleToWin32Handle( hf16 );
106 if (hf == HFILE_ERROR) return FALSE;
107 _llseek(hf,0,SEEK_SET);
108 if (sizeof(mzh)!=_lread(hf,&mzh,sizeof(mzh))) goto done;
109 if (mzh.e_magic!=IMAGE_DOS_SIGNATURE) goto done;
110 _llseek(hf,mzh.e_lfanew,SEEK_SET);
111 if (sizeof(DWORD)!=_lread(hf,&xmagic,sizeof(DWORD))) goto done;
112 ret = (xmagic == IMAGE_NT_SIGNATURE);
113 done:
114 if (fn) _lclose(hf);
115 return ret;
116}