summaryrefslogtreecommitdiff
path: root/libs/winloader
diff options
context:
space:
mode:
Diffstat (limited to 'libs/winloader')
-rw-r--r--libs/winloader/Makefile.am6
-rw-r--r--libs/winloader/afl.c1
-rw-r--r--libs/winloader/avifmt.h242
-rw-r--r--libs/winloader/driver.c51
-rw-r--r--libs/winloader/elfdll.c3
-rw-r--r--libs/winloader/module.c27
-rw-r--r--libs/winloader/pe_image.c2
-rw-r--r--libs/winloader/registry.h25
-rw-r--r--libs/winloader/vfl.c7
-rw-r--r--libs/winloader/win32.c (renamed from libs/winloader/externals.c)88
-rw-r--r--libs/winloader/win32.h (renamed from libs/winloader/externals.h)0
11 files changed, 412 insertions, 40 deletions
diff --git a/libs/winloader/Makefile.am b/libs/winloader/Makefile.am
index 75d0f2b16f..ececec29c8 100644
--- a/libs/winloader/Makefile.am
+++ b/libs/winloader/Makefile.am
@@ -3,12 +3,12 @@ filterdir = $(libdir)/gst
filter_LTLIBRARIES = libwinloader.la
# compiler manages to screw something up here... must reduce optimizations
-CFLAGS += -O2
+CFLAGS += -O0 -funroll-loops
-libwinloader_la_SOURCES = driver.c elfdll.c ext.c externals.c module.c \
+libwinloader_la_SOURCES = win32.c driver.c elfdll.c ext.c module.c \
pe_image.c pe_resource.c registry.c resource.c stubs.s vfl.c afl.c
-noinst_HEADERS = externals.h wineacm.h
+noinst_HEADERS = wineacm.h win32.h registry.h avifmt.h
DEFINES=-rdynamic -fPIC -D__WINE__ -Ddbg_printf=__vprintf -DTRACE=__vprintf
CFLAGS += $(DEFINES)
diff --git a/libs/winloader/afl.c b/libs/winloader/afl.c
index 72546f3b49..df4187f6d8 100644
--- a/libs/winloader/afl.c
+++ b/libs/winloader/afl.c
@@ -304,6 +304,7 @@ void MSACM_RegisterAllDrivers(void)
MSACM_RegisterDriver("divxa32", (LPSTR)0x161, 0);
MSACM_RegisterDriver("msadp32", (LPSTR)0x2, 0);
+ MSACM_RegisterDriver("l3codeca", (LPSTR)0x55, 0);
}
/***********************************************************************
diff --git a/libs/winloader/avifmt.h b/libs/winloader/avifmt.h
new file mode 100644
index 0000000000..d11a663a85
--- /dev/null
+++ b/libs/winloader/avifmt.h
@@ -0,0 +1,242 @@
+/****************************************************************************
+ *
+ * AVIFMT - AVI file format definitions
+ *
+ ****************************************************************************/
+#ifndef AVIFMT
+#define AVIFMT
+
+#ifndef NOAVIFMT
+
+#ifndef __WINE_WINDEF_H
+#include <wine/windef.h>
+#endif
+
+#ifndef __WINE_MMSYSTEM_H
+typedef DWORD FOURCC;
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4200)
+#endif
+
+/* The following is a short description of the AVI file format. Please
+ * see the accompanying documentation for a full explanation.
+ *
+ * An AVI file is the following RIFF form:
+ *
+ * RIFF('AVI'
+ * LIST('hdrl'
+ * avih(<MainAVIHeader>)
+ * LIST ('strl'
+ * strh(<Stream header>)
+ * strf(<Stream format>)
+ * ... additional header data
+ * LIST('movi'
+ * { LIST('rec'
+ * SubChunk...
+ * )
+ * | SubChunk } ....
+ * )
+ * [ <AVIIndex> ]
+ * )
+ *
+ * The main file header specifies how many streams are present. For
+ * each one, there must be a stream header chunk and a stream format
+ * chunk, enlosed in a 'strl' LIST chunk. The 'strf' chunk contains
+ * type-specific format information; for a video stream, this should
+ * be a BITMAPINFO structure, including palette. For an audio stream,
+ * this should be a WAVEFORMAT (or PCMWAVEFORMAT) structure.
+ *
+ * The actual data is contained in subchunks within the 'movi' LIST
+ * chunk. The first two characters of each data chunk are the
+ * stream number with which that data is associated.
+ *
+ * Some defined chunk types:
+ * Video Streams:
+ * ##db: RGB DIB bits
+ * ##dc: RLE8 compressed DIB bits
+ * ##pc: Palette Change
+ *
+ * Audio Streams:
+ * ##wb: waveform audio bytes
+ *
+ * The grouping into LIST 'rec' chunks implies only that the contents of
+ * the chunk should be read into memory at the same time. This
+ * grouping is used for files specifically intended to be played from
+ * CD-ROM.
+ *
+ * The index chunk at the end of the file should contain one entry for
+ * each data chunk in the file.
+ *
+ * Limitations for the current software:
+ * Only one video stream and one audio stream are allowed.
+ * The streams must start at the beginning of the file.
+ *
+ *
+ * To register codec types please obtain a copy of the Multimedia
+ * Developer Registration Kit from:
+ *
+ * Microsoft Corporation
+ * Multimedia Systems Group
+ * Product Marketing
+ * One Microsoft Way
+ * Redmond, WA 98052-6399
+ *
+ */
+
+#ifndef mmioFOURCC
+#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) | \
+ ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )
+#endif
+
+/* Macro to make a TWOCC out of two characters */
+#ifndef aviTWOCC
+#define aviTWOCC(ch0, ch1) ((WORD)(BYTE)(ch0) | ((WORD)(BYTE)(ch1) << 8))
+#endif
+
+typedef WORD TWOCC;
+
+/* form types, list types, and chunk types */
+#define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ')
+#define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l')
+#define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h')
+#define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l')
+#define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h')
+#define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f')
+#define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd')
+#define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n')
+
+#define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i')
+#define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ')
+
+#define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
+
+/*
+** Stream types for the <fccType> field of the stream header.
+*/
+#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
+#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
+#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
+#define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's')
+
+/* Basic chunk types */
+#define cktypeDIBbits aviTWOCC('d', 'b')
+#define cktypeDIBcompressed aviTWOCC('d', 'c')
+#define cktypePALchange aviTWOCC('p', 'c')
+#define cktypeWAVEbytes aviTWOCC('w', 'b')
+
+/* Chunk id to use for extra chunks for padding. */
+#define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K')
+
+/*
+** Useful macros
+**
+** Warning: These are nasty macro, and MS C 6.0 compiles some of them
+** incorrectly if optimizations are on. Ack.
+*/
+
+/* Macro to get stream number out of a FOURCC ckid */
+#define FromHex(n) (((n) >= 'A') ? ((n) + 10 - 'A') : ((n) - '0'))
+#define StreamFromFOURCC(fcc) ((WORD) ((FromHex(LOBYTE(LOWORD(fcc))) << 4) + \
+ (FromHex(HIBYTE(LOWORD(fcc))))))
+
+/* Macro to get TWOCC chunk type out of a FOURCC ckid */
+#define TWOCCFromFOURCC(fcc) HIWORD(fcc)
+
+/* Macro to make a ckid for a chunk out of a TWOCC and a stream number
+** from 0-255.
+*/
+#define ToHex(n) ((BYTE) (((n) > 9) ? ((n) - 10 + 'A') : ((n) + '0')))
+#define MAKEAVICKID(tcc, stream) \
+ MAKELONG((ToHex((stream) & 0x0f) << 8) | \
+ (ToHex(((stream) & 0xf0) >> 4)), tcc)
+
+/*
+** Main AVI File Header
+*/
+
+/* flags for use in <dwFlags> in AVIFileHdr */
+#define AVIF_HASINDEX 0x00000010 // Index at end of file?
+#define AVIF_MUSTUSEINDEX 0x00000020
+#define AVIF_ISINTERLEAVED 0x00000100
+#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames?
+#define AVIF_WASCAPTUREFILE 0x00010000
+#define AVIF_COPYRIGHTED 0x00020000
+
+/* The AVI File Header LIST chunk should be padded to this size */
+#define AVI_HEADERSIZE 2048 // size of AVI header list
+
+typedef struct
+{
+ DWORD dwMicroSecPerFrame; // frame display rate (or 0L)
+ DWORD dwMaxBytesPerSec; // max. transfer rate
+ DWORD dwPaddingGranularity; // pad to multiples of this
+ // size; normally 2K.
+ DWORD dwFlags; // the ever-present flags
+ DWORD dwTotalFrames; // # frames in file
+ DWORD dwInitialFrames;
+ DWORD dwStreams;
+ DWORD dwSuggestedBufferSize;
+
+ DWORD dwWidth;
+ DWORD dwHeight;
+
+ DWORD dwReserved[4];
+} MainAVIHeader;
+
+/*
+** Stream header
+*/
+
+#define AVISF_DISABLED 0x00000001
+
+#define AVISF_VIDEO_PALCHANGES 0x00010000
+
+
+typedef struct {
+ FOURCC fccType;
+ FOURCC fccHandler;
+ DWORD dwFlags; /* Contains AVITF_* flags */
+ WORD wPriority;
+ WORD wLanguage;
+ DWORD dwInitialFrames;
+ DWORD dwScale;
+ DWORD dwRate; /* dwRate / dwScale == samples/second */
+ DWORD dwStart;
+ DWORD dwLength; /* In units above... */
+ DWORD dwSuggestedBufferSize;
+ DWORD dwQuality;
+ DWORD dwSampleSize;
+ RECT rcFrame;
+} AVIStreamHeader;
+
+/* Flags for index */
+#define AVIIF_LIST 0x00000001L // chunk is a 'LIST'
+#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
+
+#define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time
+#define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use
+
+#define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F')
+#define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T')
+
+typedef struct
+{
+ DWORD ckid;
+ DWORD dwFlags;
+ DWORD dwChunkOffset; // Position of chunk
+ DWORD dwChunkLength; // Length of chunk
+} AVIINDEXENTRY;
+
+#define AVISTREAMREAD_CONVENIENT (-1L)
+
+/*
+** Palette change chunk
+**
+** Used in video streams.
+*/
+#endif /* NOAVIFMT */
+#endif
diff --git a/libs/winloader/driver.c b/libs/winloader/driver.c
index 8fdb435e42..3dfd0ffa8e 100644
--- a/libs/winloader/driver.c
+++ b/libs/winloader/driver.c
@@ -6,7 +6,7 @@
#include <wine/vfw.h>
#include <registry.h>
-#include <config.h>
+#include "config.h"
#define STORE_ALL \
__asm__ ( \
@@ -25,6 +25,7 @@
"pop %%ebx\n\t"::)
+#define WIN32_PATH GST_WIN32_LIBDIR
typedef struct {
UINT uDriverSignature;
@@ -86,18 +87,21 @@ typedef struct
int usage;
}codec_t;
-//#define Win32Path "/usr/lib/win32/"
-#define Win32Path GST_WIN32_LIBDIR
static codec_t avi_codecs[]={
- {0, Win32Path"/divxc32.dll", 0}, //0
- {0, Win32Path"/ir50_32.dll", 0},
- {0, Win32Path"/ir41_32.dll", 0},
- {0, Win32Path"/ir32_32.dll", 0},
- {0, Win32Path"/mpg4c32.dll", 0},
- {0, Win32Path"/iccvid.dll", 0}, //5
- {0, Win32Path"/libvideodll.so", 0},
- {0, Win32Path"/divxa32.acm", 0}, //7
- {0, Win32Path"/msadp32.acm", 0},
+ {0, WIN32_PATH"/divxc32.dll", 0}, //0
+ {0, WIN32_PATH"/ir50_32.dll", 0},
+ {0, WIN32_PATH"/ir41_32.dll", 0},
+ {0, WIN32_PATH"/ir32_32.dll", 0},
+ {0, WIN32_PATH"/mpg4c32.dll", 0},
+ {0, WIN32_PATH"/iccvid.dll", 0}, //5
+ {0, WIN32_PATH"/libvideodll.so", 0},
+ {0, WIN32_PATH"/divxa32.acm", 0},
+ {0, WIN32_PATH"/msadp32.acm", 0},
+ {0, WIN32_PATH"/ativcr1.dll", 0},
+ {0, WIN32_PATH"/ativcr2.dll", 0}, //10
+ {0, WIN32_PATH"/i263_32.drv", 0},
+ {0, WIN32_PATH"/l3codeca.acm", 0},
+// {0, WIN32_PATH"/atiyvu9.dll", 0},
};
@@ -155,6 +159,9 @@ DrvOpen(LPARAM lParam2)
case mmioFOURCC('D', 'I', 'V', '4'):
case mmioFOURCC('d', 'i', 'v', '3'):
case mmioFOURCC('d', 'i', 'v', '4'):
+ case mmioFOURCC('M', 'P', '4', '1'):
+ case mmioFOURCC('M', 'P', '4', '2'):
+ case mmioFOURCC('M', 'P', '4', '3'):
printf("Video in DivX ;-) format\n");
drv_id=0;
break;
@@ -178,9 +185,6 @@ DrvOpen(LPARAM lParam2)
case mmioFOURCC('m', 'p', '4', '2'):
case mmioFOURCC('m', 'p', '4', '3'):
case mmioFOURCC('M', 'P', 'G', '4'):
- case mmioFOURCC('M', 'P', '4', '1'):
- case mmioFOURCC('M', 'P', '4', '2'):
- case mmioFOURCC('M', 'P', '4', '3'):
printf("Video in Microsoft MPEG-4 format\n");
drv_id=4;
break;
@@ -188,6 +192,19 @@ DrvOpen(LPARAM lParam2)
printf("Video in Cinepak format\n");
drv_id=5;
break;
+ case mmioFOURCC('V', 'C', 'R', '1'):
+ drv_id=9;
+ break;
+ case mmioFOURCC('V', 'C', 'R', '2'):
+ drv_id=10;
+ break;
+ case mmioFOURCC('i', '2', '6', '3'):
+ case mmioFOURCC('I', '2', '6', '3'):
+ drv_id=11;
+ break;
+// case mmioFOURCC('Y', 'V', 'U', '9'):
+// drv_id=12;
+// break;
default:
printf("Unknown codec %X='%c%c%c%c'\n", fccHandler,
fccHandler&0xFF, (fccHandler&0xFF00)>>8,
@@ -204,6 +221,10 @@ DrvOpen(LPARAM lParam2)
case 0x2://MS ADPCM
drv_id=8;
break;
+ case 0x55://MPEG Layer 3
+ printf("MPEG Layer 3 ( 0x55 )\n");
+ drv_id=12;
+ break;
default:
printf("Unknown ACM codec 0x%X\n", fccHandler);
return (HDRVR)0;
diff --git a/libs/winloader/elfdll.c b/libs/winloader/elfdll.c
index f78ad8ca36..b65e2287c2 100644
--- a/libs/winloader/elfdll.c
+++ b/libs/winloader/elfdll.c
@@ -45,8 +45,7 @@ extern DWORD fixup_imports(WINE_MODREF *wm);
extern void dump_exports(HMODULE hModule);
/*---------------- END HACKS ---------------*/
-//char *extra_ld_library_path = "/usr/lib/win32";
-char *extra_ld_library_path = GST_WIN32_LIBDIR;
+char *extra_ld_library_path = "/usr/lib/win32";
struct elfdll_image
{
diff --git a/libs/winloader/module.c b/libs/winloader/module.c
index eda45d13ea..945c5b5083 100644
--- a/libs/winloader/module.c
+++ b/libs/winloader/module.c
@@ -14,7 +14,7 @@
#include <sys/mman.h>
#include <sys/types.h>
-
+/*
#ifdef __linux__
#include <asm/unistd.h>
#include <asm/ldt.h>
@@ -40,7 +40,7 @@ struct modify_ldt_ldt_s {
#define __NR_modify_ldt 123
#endif
-
+*/
#include <wine/windef.h>
#include <wine/winerror.h>
#include <wine/heap.h>
@@ -64,7 +64,7 @@ modref_list;
*
* Convert an ldt_entry structure to the raw bytes of the descriptor.
*/
-static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
+/*static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt_s *content )
{
*buffer++ = ((content->base_addr & 0x0000ffff) << 16) |
(content->limit & 0x0ffff);
@@ -77,7 +77,7 @@ static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt
((content->limit_in_pages != 0) << 23) |
0xf000;
}
-
+*/
//
// funcs:
@@ -86,6 +86,7 @@ static void LDT_EntryToBytes( unsigned long *buffer, const struct modify_ldt_ldt
// 1 write old mode
// 0x11 write
//
+/*
static int modify_ldt( int func, struct modify_ldt_ldt_s *ptr,
unsigned long count )
{
@@ -107,7 +108,7 @@ static int modify_ldt( int func, struct modify_ldt_ldt_s *ptr,
"b" (func),
"c" (ptr),
"d" (sizeof(struct modify_ldt_ldt_s)*count) );
-#endif /* __PIC__ */
+#endif
if (res >= 0) return res;
errno = -res;
return -1;
@@ -147,7 +148,7 @@ static int install_fs()
perror("install_fs");
MESSAGE("Couldn't install fs segment, expect segfault\n");
}
-#endif /*linux*/
+#endif
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
{
@@ -161,11 +162,11 @@ static int install_fs()
MESSAGE("Did you reconfigure the kernel with \"options USER_LDT\"?\n");
}
}
-#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */
+#endif
__asm__
(
"movl $0xf,%eax\n\t"
- "pushw %ax\n\t"
+// "pushw %ax\n\t"
"movw %ax, %fs\n\t"
);
prev_struct=malloc(8);
@@ -178,13 +179,15 @@ static int install_fs()
};
static int uninstall_fs()
{
+ printf("Uninstalling FS segment\n");
if(fs_seg==0)
return -1;
munmap(fs_seg, 0x30000);
+ fs_installed=0;
return 0;
}
-
+*/
//WINE_MODREF *local_wm=NULL;
modref_list* local_wm=NULL;
@@ -216,7 +219,7 @@ void MODULE_RemoveFromList(WINE_MODREF *mod)
{
free(list);
local_wm=NULL;
- uninstall_fs();
+// uninstall_fs();
return;
}
for(;list;list=list->prev)
@@ -412,8 +415,8 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags)
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- if(fs_installed==0)
- install_fs();
+// if(fs_installed==0)
+// install_fs();
wm = MODULE_LoadLibraryExA( libname, hfile, flags );
diff --git a/libs/winloader/pe_image.c b/libs/winloader/pe_image.c
index a98529a2cc..6342d1f15e 100644
--- a/libs/winloader/pe_image.c
+++ b/libs/winloader/pe_image.c
@@ -55,7 +55,7 @@
#include <wine/module.h>
#include <wine/debugtools.h>
-#include "externals.h"
+#include "win32.h"
#define RVA(x) ((void *)((char *)load_addr+(unsigned int)(x)))
diff --git a/libs/winloader/registry.h b/libs/winloader/registry.h
new file mode 100644
index 0000000000..94f45fc64a
--- /dev/null
+++ b/libs/winloader/registry.h
@@ -0,0 +1,25 @@
+/********************************************************
+
+ Declaration of registry access functions
+ Copyright 2000 Eugene Smith (divx@euro.ru)
+ Last modified: 18.06.2000
+
+*********************************************************/
+
+
+#ifndef REGISTRY_H
+#define REGISTRY_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+long RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey);
+long RegCloseKey(long key);
+long RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count);
+long RegCreateKeyExA(long key, const char* name, long reserved,
+ void* classs, long options, long security,
+ void* sec_attr, int* newkey, int* status) ;
+long RegSetValueExA(long key, const char* name, long v1, long v2, void* data, long size);
+#ifdef __cplusplus
+};
+#endif
+#endif \ No newline at end of file
diff --git a/libs/winloader/vfl.c b/libs/winloader/vfl.c
index b6e26a4d8b..c0b17d107a 100644
--- a/libs/winloader/vfl.c
+++ b/libs/winloader/vfl.c
@@ -338,6 +338,13 @@ ICSendMessage(HIC hic,unsigned int msg,long lParam1,long lParam2) {
// printf("private=%x\n", whic->private);
__asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));
STORE_ALL;
+ /*__asm__
+ (
+ "pushl %eax\n\t"
+ "movl $0xf,%eax\n\t"
+ "movw %ax, %fs\n\t"
+ "popl %eax\n\t"
+ );*/
ret = whic->driverproc(whic->private,1,msg,lParam1,lParam2);
REST_ALL;
__asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw));
diff --git a/libs/winloader/externals.c b/libs/winloader/win32.c
index 00b8c60a31..0c23b932c9 100644
--- a/libs/winloader/externals.c
+++ b/libs/winloader/win32.c
@@ -1,4 +1,14 @@
-#include "externals.h"
+/***********************************************************
+
+ Win32 emulation code. Functions that emulate
+ responses from corresponding Win32 API calls.
+ Since we are not going to be able to load
+ virtually any DLL, we can only implement this
+ much, adding needed functions with each new codec.
+
+************************************************************/
+
+#include "win32.h"
#include <stdio.h>
#include <pthread.h>
#include <malloc.h>
@@ -120,16 +130,24 @@ int my_release(char* memory)
#else
void* my_mreq(int size, int to_zero)
{
+ void* answer;
if(to_zero)
- return calloc(size, 1);
- else
- return malloc(size);
+ answer=calloc(size+4, 1);
+ else
+ answer=malloc(size+4);
+ *(int*)answer=size;
+ return (int*)answer+1;
}
int my_release(char* memory)
{
- free(memory);
+ if(memory==0)return 0;
+ free(memory-4);
return 0;
}
+int my_size(char* memory)
+{
+ return *(int*)(memory-4);
+}
#endif
extern int unk_exp1;
@@ -526,7 +544,14 @@ long WINAPI expHeapFree(int arg1, int arg2, void* ptr)
my_release(ptr);
return 1;
}
-
+long WINAPI expHeapSize(int heap, int flags, void* pointer)
+{
+ return my_size(pointer);
+}
+long WINAPI expGetProcessHeap(void)
+{
+ return 1;
+}
void* WINAPI expVirtualAlloc(void* v1, long v2, long v3, long v4)
{
void* z;
@@ -972,8 +997,11 @@ LPCSTR WINAPI expGetEnvironmentStrings()
int WINAPI expGetStartupInfoA(STARTUPINFOA *s)
{
+ int i;
dbgprintf("GetStartupInfoA\n");
- return 1;
+ for(i=0; i<sizeof(STARTUPINFOA)/4; i++)
+ ((int*)s)[i]=i+0x200;
+ return 1;
}
int WINAPI expGetStdHandle(int z)
@@ -1123,6 +1151,25 @@ int WINAPI expGetPrivateProfileIntA(char* appname, char* keyname, int default_va
free(fullname);
return default_value;
}
+int WINAPI expGetPrivateProfileStringA(const char* appname, const char* keyname,
+ const char* hz1, char* hz2, int default_value, const char* filename)
+{
+ int size=4;
+ char* fullname;
+ dbgprintf("GetPrivateProfileStringA(%s, %s, %s, %X, %X, %s)\n", appname, keyname, hz1, hz2, default_value, filename );
+ if(!(appname && keyname && filename) ) return default_value;
+ fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
+ strcpy(fullname, "Software\\IniFileMapping\\");
+ strcat(fullname, appname);
+ strcat(fullname, "\\");
+ strcat(fullname, keyname);
+ strcat(fullname, "\\");
+ strcat(fullname, filename);
+// RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, &default_value, &size);
+ printf("GetPrivateProfileStringA(%s, %s, %s, %X, %X, %s)\n", appname, keyname, hz1, hz2, default_value, filename );
+ free(fullname);
+ return default_value;
+}
int WINAPI expDefDriverProc(int _private, int id, int msg, int arg1, int arg2)
{
@@ -1191,6 +1238,26 @@ extern void WINAPI expOutputDebugStringA( const char* string )
fprintf(stderr, "DEBUG: %s\n", string);
}
+int WINAPI expGetDC(int hwnd)
+{
+ return 0;
+}
+
+int WINAPI expGetDesktopWindow()
+{
+ return 0;
+}
+
+int WINAPI expReleaseDC(int hwnd, int hdc)
+{
+ return 0;
+}
+
+int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe)
+{
+ return 0;
+}
+
struct exports
{
char name[64];
@@ -1223,6 +1290,8 @@ FF(HeapCreate, 461)
FF(HeapAlloc, -1)
FF(HeapDestroy, -1)
FF(HeapFree, -1)
+FF(HeapSize, -1)
+FF(GetProcessHeap, -1)
FF(VirtualAlloc, -1)
FF(VirtualFree, -1)
FF(InitializeCriticalSection, -1)
@@ -1278,6 +1347,7 @@ FF(UnmapViewOfFile, -1)
FF(Sleep, -1)
FF(GetModuleHandleA, -1)
FF(GetPrivateProfileIntA, -1)
+FF(GetPrivateProfileStringA, -1)
FF(GetLastError, -1)
FF(SetLastError, -1)
FF(InterlockedIncrement, -1)
@@ -1302,6 +1372,9 @@ FF(DefDriverProc, -1)
struct exports exp_user32[]={
FF(LoadStringA, -1)
FF(wsprintfA, -1)
+FF(GetDC, -1)
+FF(GetDesktopWindow, -1)
+FF(ReleaseDC, -1)
};
struct exports exp_advapi32[]={
FF(RegOpenKeyA, -1)
@@ -1315,6 +1388,7 @@ struct exports exp_gdi32[]={
FF(CreateCompatibleDC, -1)
FF(GetDeviceCaps, -1)
FF(DeleteDC, -1)
+FF(GetSystemPaletteEntries, -1)
};
struct exports exp_version[]={
FF(GetFileVersionInfoSizeA, -1)
diff --git a/libs/winloader/externals.h b/libs/winloader/win32.h
index 327cfb2989..327cfb2989 100644
--- a/libs/winloader/externals.h
+++ b/libs/winloader/win32.h