1996-04-21 14:57:41 +00:00
|
|
|
/*
|
|
|
|
* W32SYS
|
|
|
|
* helper DLL for Win32s
|
|
|
|
*
|
|
|
|
* Copyright (c) 1996 Anand Kumria
|
2002-03-09 23:29:33 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1996-04-21 14:57:41 +00:00
|
|
|
*/
|
|
|
|
|
2002-08-17 00:43:16 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
2003-11-27 00:59:36 +00:00
|
|
|
#include <stdio.h>
|
2002-08-17 00:43:16 +00:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2000-11-27 22:03:23 +00:00
|
|
|
|
1999-03-14 16:35:05 +00:00
|
|
|
#include "windef.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "winbase.h"
|
2000-09-26 22:20:14 +00:00
|
|
|
#include "wine/windef16.h"
|
2000-11-27 22:03:23 +00:00
|
|
|
#include "wine/winbase16.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
1999-09-10 13:51:11 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dll);
|
2000-08-09 00:54:58 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
BYTE bMajor;
|
|
|
|
BYTE bMinor;
|
|
|
|
WORD wBuildNumber;
|
|
|
|
BOOL16 fDebug;
|
|
|
|
} WIN32SINFO, *LPWIN32SINFO;
|
1999-09-10 13:51:11 +00:00
|
|
|
|
1996-04-21 14:57:41 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* GetWin32sInfo (W32SYS.12)
|
1998-03-29 19:44:57 +00:00
|
|
|
* RETURNS
|
|
|
|
* 0 on success, 1 on failure
|
1996-04-21 14:57:41 +00:00
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
WORD WINAPI GetWin32sInfo16(
|
1998-03-29 19:44:57 +00:00
|
|
|
LPWIN32SINFO lpInfo /* [out] Win32S special information */
|
|
|
|
) {
|
1996-04-21 14:57:41 +00:00
|
|
|
lpInfo->bMajor = 1;
|
|
|
|
lpInfo->bMinor = 3;
|
|
|
|
lpInfo->wBuildNumber = 0;
|
|
|
|
lpInfo->fDebug = FALSE;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
1998-03-29 19:44:57 +00:00
|
|
|
|
1999-07-11 17:20:01 +00:00
|
|
|
/***********************************************************************
|
2001-07-02 19:59:40 +00:00
|
|
|
* GetW32SysVersion (W32SYS.5)
|
1999-07-11 17:20:01 +00:00
|
|
|
*/
|
1999-07-24 10:28:37 +00:00
|
|
|
WORD WINAPI GetW32SysVersion16(void)
|
1999-07-11 17:20:01 +00:00
|
|
|
{
|
|
|
|
return 0x100;
|
|
|
|
}
|
|
|
|
|
1998-03-29 19:44:57 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* GetPEResourceTable (W32SYS.7)
|
|
|
|
* retrieves the resourcetable from the passed filedescriptor
|
|
|
|
* RETURNS
|
|
|
|
* dunno what.
|
|
|
|
*/
|
1999-02-26 11:11:13 +00:00
|
|
|
WORD WINAPI GetPEResourceTable16(
|
2005-02-25 14:07:56 +00:00
|
|
|
HFILE16 hf /* [in] Handle of executable file */
|
1998-03-29 19:44:57 +00:00
|
|
|
) {
|
|
|
|
return 0;
|
|
|
|
}
|
1999-09-10 13:51:11 +00:00
|
|
|
|
2000-04-06 20:21:16 +00:00
|
|
|
/***********************************************************************
|
2001-07-11 18:56:41 +00:00
|
|
|
* LoadPeResource (W32SYS.11)
|
2000-04-06 20:21:16 +00:00
|
|
|
*/
|
1999-09-10 13:51:11 +00:00
|
|
|
DWORD WINAPI LoadPeResource16(WORD x,SEGPTR y) {
|
|
|
|
FIXME("(0x%04x,0x%08lx),stub!\n",x,y);
|
|
|
|
return 0;
|
|
|
|
}
|
2000-11-27 22:03:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2001-07-02 19:59:40 +00:00
|
|
|
* IsPeFormat (W32SYS.2)
|
2005-02-25 14:07:56 +00:00
|
|
|
* Check if a file is a PE format executable.
|
2000-11-27 22:03:23 +00:00
|
|
|
* RETURNS
|
|
|
|
* TRUE, if it is.
|
|
|
|
* FALSE if not.
|
|
|
|
*/
|
2005-02-25 14:07:56 +00:00
|
|
|
BOOL16 WINAPI IsPeFormat16( LPSTR fn, /* [in] filename of executable */
|
2000-11-27 22:03:23 +00:00
|
|
|
HFILE16 hf16 ) /* [in] open file, if filename is NULL */
|
|
|
|
{
|
|
|
|
BOOL16 ret = FALSE;
|
|
|
|
IMAGE_DOS_HEADER mzh;
|
|
|
|
OFSTRUCT ofs;
|
|
|
|
DWORD xmagic;
|
|
|
|
HFILE hf;
|
|
|
|
|
|
|
|
if (fn) hf = OpenFile(fn,&ofs,OF_READ);
|
2002-10-18 23:48:57 +00:00
|
|
|
else hf = (HFILE)DosFileHandleToWin32Handle( hf16 );
|
2000-11-27 22:03:23 +00:00
|
|
|
if (hf == HFILE_ERROR) return FALSE;
|
|
|
|
_llseek(hf,0,SEEK_SET);
|
|
|
|
if (sizeof(mzh)!=_lread(hf,&mzh,sizeof(mzh))) goto done;
|
|
|
|
if (mzh.e_magic!=IMAGE_DOS_SIGNATURE) goto done;
|
|
|
|
_llseek(hf,mzh.e_lfanew,SEEK_SET);
|
|
|
|
if (sizeof(DWORD)!=_lread(hf,&xmagic,sizeof(DWORD))) goto done;
|
|
|
|
ret = (xmagic == IMAGE_NT_SIGNATURE);
|
|
|
|
done:
|
|
|
|
if (fn) _lclose(hf);
|
|
|
|
return ret;
|
|
|
|
}
|