1993-07-08 17:37:25 +00:00
|
|
|
|
static char RCSId[] = "$Id: resource.c,v 1.4 1993/07/04 04:04:21 root Exp root $";
|
1993-07-01 10:58:21 +00:00
|
|
|
|
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
1993-09-29 12:21:49 +00:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <unistd.h>
|
1993-07-01 10:58:21 +00:00
|
|
|
|
#include "prototypes.h"
|
|
|
|
|
#include "neexe.h"
|
1993-07-08 17:37:25 +00:00
|
|
|
|
#include "windows.h"
|
1993-09-04 10:09:32 +00:00
|
|
|
|
#include "gdi.h"
|
1993-09-29 12:21:49 +00:00
|
|
|
|
#include "wine.h"
|
1993-07-01 10:58:21 +00:00
|
|
|
|
|
|
|
|
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
1993-09-29 12:21:49 +00:00
|
|
|
|
|
|
|
|
|
static int ResourceFd = -1;
|
|
|
|
|
static HANDLE ResourceInst = 0;
|
|
|
|
|
static struct w_files *ResourceFileInfo = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* OpenResourceFile
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
OpenResourceFile(HANDLE instance)
|
|
|
|
|
{
|
|
|
|
|
struct w_files *w;
|
|
|
|
|
|
|
|
|
|
if (ResourceInst == instance)
|
|
|
|
|
return ResourceFd;
|
|
|
|
|
|
|
|
|
|
w = GetFileInfo(instance);
|
|
|
|
|
if (w == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (ResourceFd >= 0)
|
|
|
|
|
close(ResourceFd);
|
|
|
|
|
|
|
|
|
|
ResourceInst = instance;
|
|
|
|
|
ResourceFileInfo = w;
|
|
|
|
|
ResourceFd = open(w->filename, O_RDONLY);
|
|
|
|
|
|
|
|
|
|
return ResourceFd;
|
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
1993-07-08 17:37:25 +00:00
|
|
|
|
/**********************************************************************
|
|
|
|
|
* ConvertCoreBitmap
|
|
|
|
|
*/
|
1993-09-04 10:09:32 +00:00
|
|
|
|
HBITMAP
|
|
|
|
|
ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image )
|
1993-07-08 17:37:25 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
BITMAPINFO * bmpInfo;
|
|
|
|
|
HBITMAP hbitmap;
|
|
|
|
|
char * bits;
|
|
|
|
|
int i, size, n_colors;
|
1993-07-08 17:37:25 +00:00
|
|
|
|
|
|
|
|
|
n_colors = 1 << image->bcBitCount;
|
|
|
|
|
|
|
|
|
|
if (image->bcBitCount < 24)
|
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
size = sizeof(BITMAPINFOHEADER) + n_colors * sizeof(RGBQUAD);
|
|
|
|
|
bits = (char *) (image + 1) + (n_colors * sizeof(RGBTRIPLE));
|
1993-07-08 17:37:25 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
size = sizeof(BITMAPINFOHEADER);
|
|
|
|
|
bits = (char *) (image + 1);
|
1993-07-08 17:37:25 +00:00
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
bmpInfo = (BITMAPINFO *) malloc( size );
|
|
|
|
|
|
|
|
|
|
bmpInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
|
|
|
|
bmpInfo->bmiHeader.biWidth = image->bcWidth;
|
|
|
|
|
bmpInfo->bmiHeader.biHeight = image->bcHeight;
|
|
|
|
|
bmpInfo->bmiHeader.biPlanes = image->bcPlanes;
|
|
|
|
|
bmpInfo->bmiHeader.biBitCount = image->bcBitCount;
|
|
|
|
|
bmpInfo->bmiHeader.biCompression = 0;
|
|
|
|
|
bmpInfo->bmiHeader.biSizeImage = 0;
|
|
|
|
|
bmpInfo->bmiHeader.biXPelsPerMeter = 0;
|
|
|
|
|
bmpInfo->bmiHeader.biYPelsPerMeter = 0;
|
|
|
|
|
bmpInfo->bmiHeader.biClrUsed = 0;
|
|
|
|
|
bmpInfo->bmiHeader.biClrImportant = 0;
|
1993-07-08 17:37:25 +00:00
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
if (image->bcBitCount < 24)
|
1993-07-08 17:37:25 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
RGBTRIPLE * oldMap = (RGBTRIPLE *)(image + 1);
|
|
|
|
|
RGBQUAD * newMap = bmpInfo->bmiColors;
|
|
|
|
|
for (i = 0; i < n_colors; i++, oldMap++, newMap++)
|
|
|
|
|
{
|
|
|
|
|
newMap->rgbRed = oldMap->rgbtRed;
|
|
|
|
|
newMap->rgbGreen = oldMap->rgbtGreen;
|
|
|
|
|
newMap->rgbBlue = oldMap->rgbtBlue;
|
|
|
|
|
newMap->rgbReserved = 0;
|
|
|
|
|
}
|
1993-07-08 17:37:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
hbitmap = CreateDIBitmap( hdc, &bmpInfo->bmiHeader, CBM_INIT,
|
|
|
|
|
bits, bmpInfo, DIB_RGB_COLORS );
|
|
|
|
|
free( bmpInfo );
|
|
|
|
|
return hbitmap;
|
1993-07-08 17:37:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* ConvertInfoBitmap
|
|
|
|
|
*/
|
1993-09-04 10:09:32 +00:00
|
|
|
|
HBITMAP
|
|
|
|
|
ConvertInfoBitmap( HDC hdc, BITMAPINFO * image )
|
1993-07-08 17:37:25 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
char * bits = ((char *)image) + DIB_BitmapInfoSize(image, DIB_RGB_COLORS);
|
|
|
|
|
return CreateDIBitmap( hdc, &image->bmiHeader, CBM_INIT,
|
|
|
|
|
bits, image, DIB_RGB_COLORS );
|
|
|
|
|
}
|
|
|
|
|
|
1993-07-01 10:58:21 +00:00
|
|
|
|
/**********************************************************************
|
1993-09-04 10:09:32 +00:00
|
|
|
|
* FindResourceByNumber
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
|
|
|
|
int
|
1993-09-04 10:09:32 +00:00
|
|
|
|
FindResourceByNumber(struct resource_nameinfo_s *result_p,
|
|
|
|
|
int type_id, int resource_id)
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
struct resource_typeinfo_s typeinfo;
|
|
|
|
|
struct resource_nameinfo_s nameinfo;
|
|
|
|
|
unsigned short size_shift;
|
1993-07-01 10:58:21 +00:00
|
|
|
|
int i;
|
1993-09-29 12:21:49 +00:00
|
|
|
|
off_t rtoff;
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
1993-07-01 10:58:21 +00:00
|
|
|
|
/*
|
1993-09-04 10:09:32 +00:00
|
|
|
|
* Move to beginning of resource table.
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
1993-09-29 12:21:49 +00:00
|
|
|
|
rtoff = (ResourceFileInfo->mz_header->ne_offset +
|
|
|
|
|
ResourceFileInfo->ne_header->resource_tab_offset);
|
|
|
|
|
lseek(ResourceFd, rtoff, SEEK_SET);
|
1993-07-01 10:58:21 +00:00
|
|
|
|
|
|
|
|
|
/*
|
1993-09-04 10:09:32 +00:00
|
|
|
|
* Read block size.
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
|
1993-09-04 10:09:32 +00:00
|
|
|
|
sizeof(size_shift))
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
return -1;
|
1993-07-01 10:58:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
1993-09-04 10:09:32 +00:00
|
|
|
|
* Find resource.
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
1993-09-04 10:09:32 +00:00
|
|
|
|
typeinfo.type_id = 0xffff;
|
|
|
|
|
while (typeinfo.type_id != 0)
|
|
|
|
|
{
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
|
1993-09-04 10:09:32 +00:00
|
|
|
|
sizeof(typeinfo))
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (typeinfo.type_id != 0)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < typeinfo.count; i++)
|
|
|
|
|
{
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
|
1993-09-04 10:09:32 +00:00
|
|
|
|
sizeof(nameinfo))
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
1993-07-01 10:58:21 +00:00
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
#if defined(DEBUG_RESOURCE) && defined(VERBOSE_DEBUG)
|
|
|
|
|
if (type_id == typeinfo.type_id)
|
|
|
|
|
{
|
|
|
|
|
printf("FindResource: type id = %d, resource id = %x\n",
|
|
|
|
|
type_id, nameinfo.id);
|
|
|
|
|
}
|
Release 0.2.0
Tue Jul 13 20:31:31 1993 Bob Amstadt (bob at pooh)
* [global.c]
Completed global memory pool API
Sun Jul 11 16:59:52 1993 Alexandre Julliard
* [message.c] [user.c] [user.spec] [windows.h]
Added emulation of Windows message queue.
Thu Jul 8 19:29:27 1993 Bob Amstadt (bob at pooh)
* [build.c] Original by Bob Amstadt
* [callback.c] Original by Bob Amstadt, updates by
Alexandre Julliard
* [dump.c] Original by Bob Amstadt
* [global.c] Original by Bob Amstadt
* [heap.c] Original by Bob Amstadt
* [kernel.c] Original by Bob Amstadt
* [ldt.c] Original by Bob Amstadt
* [ldtlib.c] Original by Bob Amstadt
* [relay.c] Original by Bob Amstadt
* [resource.c] Original by Bob Amstadt, updates by
Alexandre Juliard
* [selector.c] Original by Bob Amstadt, updates by Eric Youngdale
* [user.c] Original by Bob Amstadt
* [wine.c] Original by Bob Amstadt, updates by Eric Youngdale and
Alexandre Julliard
* [wintcl.c] Original by Regents of the University of California,
updates by Peter MacDonald and Alexandre Julliard
* [callback.h] Original by Bob Amstadt
* [dlls.h] Original by Bob Amstadt
* [heap.h] Original by Bob Amstadt
* [neexe.h] Original by Bob Amstadt
* [prototypes.h] Original by Bob Amstadt, updates by
Eric Youngdale
* [segmem.h] Original by Bob Amstadt
* [tkInt.h] Original by Regents of the University of California
* [windows.h] Original by Peter MacDonald, updates by
Alexandre Julliard and Bob Amstadt
* [wine.h] Original by Eric Youngdale
* [kernel.spec] Original by Bob Amstadt, updates by
Alexandre Julliard
* [gdi.spec] Original by Bob Amstadt, updates by
Alexandre Julliard
* [shell.spec] Original by Bob Amstadt
* [unixlib.spec] Original by Bob Amstadt
* [user.spec] Original by Bob Amstadt, updates by Alexandre Julliard
* [win87em.spec] Original by Bob Amstadt
* [Windows.tcl] Original by Peter MacDonald, updates by
Alexandre Julliard
* [build-spec.txt] Original by Bob Amstadt
* [if1632.S] Original by Bob Amstadt, updates by Eric Youngdale
1993-07-15 11:13:45 +00:00
|
|
|
|
#endif
|
1993-09-04 10:09:32 +00:00
|
|
|
|
if ((type_id == -1 || typeinfo.type_id == type_id) &&
|
|
|
|
|
nameinfo.id == resource_id)
|
|
|
|
|
{
|
|
|
|
|
memcpy(result_p, &nameinfo, sizeof(nameinfo));
|
|
|
|
|
return size_shift;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
1993-07-01 10:58:21 +00:00
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
1993-07-01 10:58:21 +00:00
|
|
|
|
/**********************************************************************
|
1993-09-04 10:09:32 +00:00
|
|
|
|
* FindResourceByName
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
|
|
|
|
int
|
1993-09-04 10:09:32 +00:00
|
|
|
|
FindResourceByName(struct resource_nameinfo_s *result_p,
|
|
|
|
|
int type_id, char *resource_name)
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
|
|
|
|
struct resource_typeinfo_s typeinfo;
|
|
|
|
|
struct resource_nameinfo_s nameinfo;
|
|
|
|
|
unsigned short size_shift;
|
1993-09-04 10:09:32 +00:00
|
|
|
|
off_t old_pos, new_pos;
|
|
|
|
|
unsigned char nbytes;
|
|
|
|
|
char name[256];
|
1993-07-01 10:58:21 +00:00
|
|
|
|
int i;
|
1993-09-29 12:21:49 +00:00
|
|
|
|
off_t rtoff;
|
1993-07-01 10:58:21 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Move to beginning of resource table.
|
|
|
|
|
*/
|
1993-09-29 12:21:49 +00:00
|
|
|
|
rtoff = (ResourceFileInfo->mz_header->ne_offset +
|
|
|
|
|
ResourceFileInfo->ne_header->resource_tab_offset);
|
|
|
|
|
lseek(ResourceFd, rtoff, SEEK_SET);
|
1993-07-01 10:58:21 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Read block size.
|
|
|
|
|
*/
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
|
1993-07-01 10:58:21 +00:00
|
|
|
|
sizeof(size_shift))
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Find resource.
|
|
|
|
|
*/
|
|
|
|
|
typeinfo.type_id = 0xffff;
|
|
|
|
|
while (typeinfo.type_id != 0)
|
|
|
|
|
{
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
|
1993-07-01 10:58:21 +00:00
|
|
|
|
sizeof(typeinfo))
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
if (typeinfo.type_id == type_id || type_id == -1)
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < typeinfo.count; i++)
|
|
|
|
|
{
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
|
1993-07-01 10:58:21 +00:00
|
|
|
|
sizeof(nameinfo))
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
if (nameinfo.id & 0x8000)
|
|
|
|
|
continue;
|
|
|
|
|
|
1993-09-29 12:21:49 +00:00
|
|
|
|
old_pos = lseek(ResourceFd, 0, SEEK_CUR);
|
|
|
|
|
new_pos = rtoff + nameinfo.id;
|
|
|
|
|
lseek(ResourceFd, new_pos, SEEK_SET);
|
|
|
|
|
read(ResourceFd, &nbytes, 1);
|
|
|
|
|
read(ResourceFd, name, nbytes);
|
|
|
|
|
lseek(ResourceFd, old_pos, SEEK_SET);
|
1993-09-04 10:09:32 +00:00
|
|
|
|
name[nbytes] = '\0';
|
|
|
|
|
|
|
|
|
|
if (strcasecmp(name, resource_name) == 0)
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
|
|
|
|
memcpy(result_p, &nameinfo, sizeof(nameinfo));
|
|
|
|
|
return size_shift;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* LoadIcon
|
|
|
|
|
*/
|
|
|
|
|
HICON
|
|
|
|
|
LoadIcon(HANDLE instance, LPSTR icon_name)
|
|
|
|
|
{
|
Release 0.4.0
Mon Sep 13 05:00:11 1993 Eric Youngdale
* [Makefile] [if1632/relay.c] [include/dlls.h] [selector.c]
[loader/wine.c] [tools/build.c]
Added ability to generate missing functions statistics.
Mon Sep 13 12:09:47 1993 Scott A. Laird (scott@curly)
* [WIN31-APPLETS]
Added new file.
* [if1632/kernel.spec]
Added definitions for GetProfile{Int,String} and SetHandleCount.
* [if1632/keyboard.spec]
Created interface specification for Keyboard driver DLL.
* [if1632/relay.c]
Added keyboard.dll to list of included DLLs.
* [if1632/user.spec]
Added LoadAccelerators definition.
* [loader/resource.c]
Added LoadAccelerators stub.
* [misc/file.c]
Changed OpenFile, and added SetHandleCount (for winfile.exe)
* [misc/keyboard.c]
Added keyboard code.
* [misc/profile.c] [misc/xt.c]
Moved GetPrivateProfile* commands here, and added GetProfile*
commands.
Mon Sep 13 10:24:37 1993 Andrew Bulhak
* [windows/utility.c]
Implemented MulDiv(), OutputDebugString() and wvsprintf()
Fri Sep 10 09:13:30 1993 John Brezak
* [*/Makefile]
Created patch to allow BSD make to build wine.
* [windows/win.c]
Fixed NULL pointer reference.
* [windows/message.c] [misc/xt.c]
Defined HZ to handle system specific timing.
* [windows/graphics.c]
Use M_PI is PI
* [objects/pallete.c]
NetBSD does not have /usr/include/values.h and MAXINT is INT_MAX.
* [dump.c] [ldt.c] [wine.c]
ifdef'ed linux headers for linux compile.
* [loader/ldtlib.c]
Add NetBSD system calls when compiled on that system.
* [loader/selector.c]
Use mmap(MAP_ANON, ...) for NetBSD.
* [if1632/call.S]
Fixed selector assumptions.
Thu Sep 9 20:01:37 1993 David Metcalfe
* [controls/WinButton*] [controls/button.c] [controls/widget.c]
[windows/win.c] [windows/class.c]
Added 3D button control and tied into CreateWindow()
Thu Sep 9 07:35:24 1993 Scott Laird
* [if1632/sound.spec]
Created interface specification for SOUND DLL.
* [if1632/win87em.spec]
Added more functions to the WIN87EM DLL interface specification
* [misc/emulate.c]
Created stubs for the new math emulation functions.
* [misc/sound.c]
Created stubs for the SOUND DLL.
Sun Sep 5 21:02:10 1993 John Burton
* [if1632/kernel.spec]
Added interface specifications for OpenFile, _lclose, _lread, _lopen,
and _lwrite.
* [include/windows.h]
Added OF_ macros
* [misc/file.c]
Implemented OpenFile, _lclose, _lread, _lopen and _lwrite.
Fri Sep 3 18:47:03 1993 Alexandre Julliard
* [windows/dc.c]
Bug fix
* [objects/text.c]
Bug fix
Fri Sep 3 18:47:03 1993 Bob Amstadt
* [objects/linedda.c]
Finished LineDDA().
1993-09-14 16:47:10 +00:00
|
|
|
|
fprintf(stderr,"LoadIcon: (%d),%d\n",instance,icon_name);
|
1993-09-04 10:09:32 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
1993-07-01 10:58:21 +00:00
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
/**********************************************************************
|
|
|
|
|
* LoadCursor
|
|
|
|
|
*/
|
|
|
|
|
HCURSOR
|
|
|
|
|
LoadCursor(HANDLE instance, LPSTR cursor_name)
|
|
|
|
|
{
|
Release 0.4.0
Mon Sep 13 05:00:11 1993 Eric Youngdale
* [Makefile] [if1632/relay.c] [include/dlls.h] [selector.c]
[loader/wine.c] [tools/build.c]
Added ability to generate missing functions statistics.
Mon Sep 13 12:09:47 1993 Scott A. Laird (scott@curly)
* [WIN31-APPLETS]
Added new file.
* [if1632/kernel.spec]
Added definitions for GetProfile{Int,String} and SetHandleCount.
* [if1632/keyboard.spec]
Created interface specification for Keyboard driver DLL.
* [if1632/relay.c]
Added keyboard.dll to list of included DLLs.
* [if1632/user.spec]
Added LoadAccelerators definition.
* [loader/resource.c]
Added LoadAccelerators stub.
* [misc/file.c]
Changed OpenFile, and added SetHandleCount (for winfile.exe)
* [misc/keyboard.c]
Added keyboard code.
* [misc/profile.c] [misc/xt.c]
Moved GetPrivateProfile* commands here, and added GetProfile*
commands.
Mon Sep 13 10:24:37 1993 Andrew Bulhak
* [windows/utility.c]
Implemented MulDiv(), OutputDebugString() and wvsprintf()
Fri Sep 10 09:13:30 1993 John Brezak
* [*/Makefile]
Created patch to allow BSD make to build wine.
* [windows/win.c]
Fixed NULL pointer reference.
* [windows/message.c] [misc/xt.c]
Defined HZ to handle system specific timing.
* [windows/graphics.c]
Use M_PI is PI
* [objects/pallete.c]
NetBSD does not have /usr/include/values.h and MAXINT is INT_MAX.
* [dump.c] [ldt.c] [wine.c]
ifdef'ed linux headers for linux compile.
* [loader/ldtlib.c]
Add NetBSD system calls when compiled on that system.
* [loader/selector.c]
Use mmap(MAP_ANON, ...) for NetBSD.
* [if1632/call.S]
Fixed selector assumptions.
Thu Sep 9 20:01:37 1993 David Metcalfe
* [controls/WinButton*] [controls/button.c] [controls/widget.c]
[windows/win.c] [windows/class.c]
Added 3D button control and tied into CreateWindow()
Thu Sep 9 07:35:24 1993 Scott Laird
* [if1632/sound.spec]
Created interface specification for SOUND DLL.
* [if1632/win87em.spec]
Added more functions to the WIN87EM DLL interface specification
* [misc/emulate.c]
Created stubs for the new math emulation functions.
* [misc/sound.c]
Created stubs for the SOUND DLL.
Sun Sep 5 21:02:10 1993 John Burton
* [if1632/kernel.spec]
Added interface specifications for OpenFile, _lclose, _lread, _lopen,
and _lwrite.
* [include/windows.h]
Added OF_ macros
* [misc/file.c]
Implemented OpenFile, _lclose, _lread, _lopen and _lwrite.
Fri Sep 3 18:47:03 1993 Alexandre Julliard
* [windows/dc.c]
Bug fix
* [objects/text.c]
Bug fix
Fri Sep 3 18:47:03 1993 Bob Amstadt
* [objects/linedda.c]
Finished LineDDA().
1993-09-14 16:47:10 +00:00
|
|
|
|
fprintf(stderr,"LoadCursor: (%d),%d\n",instance,cursor_name);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* LoadAccelerators
|
|
|
|
|
*/
|
|
|
|
|
HANDLE
|
|
|
|
|
LoadAccelerators(HANDLE instance, LPSTR lpTableName)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr,"LoadAccelerators: (%d),%d\n",instance,lpTableName);
|
1993-09-04 10:09:32 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
1993-09-29 12:21:49 +00:00
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* FindResource [KERNEL.60]
|
|
|
|
|
*/
|
|
|
|
|
HANDLE FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr,"FindResource: (%d),%d\n",instance, resource_name, type_name);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* LoadResource [KERNEL.61]
|
|
|
|
|
*/
|
|
|
|
|
HANDLE LoadResource(HANDLE instance, HANDLE hResInfo)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr,"LoadResource: (%d),%d\n",instance, hResInfo);
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* LockResource [KERNEL.62]
|
|
|
|
|
*/
|
|
|
|
|
LPSTR LockResource(HANDLE hResData)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr,"LockResource: %d\n", hResData);
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
|
* FreeResource [KERNEL.63]
|
|
|
|
|
*/
|
|
|
|
|
BOOL FreeResource(HANDLE hResData)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr,"FreeResource: %d\n", hResData);
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
1993-07-01 10:58:21 +00:00
|
|
|
|
/**********************************************************************
|
1993-07-08 17:37:25 +00:00
|
|
|
|
* RSC_LoadResource
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
1993-09-04 10:09:32 +00:00
|
|
|
|
HANDLE
|
|
|
|
|
RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
|
|
|
|
struct resource_nameinfo_s nameinfo;
|
1993-09-04 10:09:32 +00:00
|
|
|
|
HANDLE hmem;
|
1993-07-01 10:58:21 +00:00
|
|
|
|
void *image;
|
|
|
|
|
int image_size;
|
|
|
|
|
int size_shift;
|
|
|
|
|
|
|
|
|
|
/*
|
1993-07-08 17:37:25 +00:00
|
|
|
|
* Built-in resources
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
|
|
|
|
if (instance == 0)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
1993-09-29 12:21:49 +00:00
|
|
|
|
else if (OpenResourceFile(instance) < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
1993-07-01 10:58:21 +00:00
|
|
|
|
/*
|
1993-07-08 17:37:25 +00:00
|
|
|
|
* Get resource by ordinal
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (((int) rsc_name & 0xffff0000) == 0)
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
1993-07-08 17:37:25 +00:00
|
|
|
|
size_shift = FindResourceByNumber(&nameinfo, type,
|
|
|
|
|
(int) rsc_name | 0x8000);
|
1993-07-01 10:58:21 +00:00
|
|
|
|
}
|
|
|
|
|
/*
|
1993-07-08 17:37:25 +00:00
|
|
|
|
* Get resource by name
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
|
|
|
|
else
|
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
size_shift = FindResourceByName(&nameinfo, type, rsc_name);
|
1993-07-01 10:58:21 +00:00
|
|
|
|
}
|
|
|
|
|
if (size_shift == -1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/*
|
1993-07-08 17:37:25 +00:00
|
|
|
|
* Read resource.
|
1993-07-01 10:58:21 +00:00
|
|
|
|
*/
|
1993-09-29 12:21:49 +00:00
|
|
|
|
lseek(ResourceFd, ((int) nameinfo.offset << size_shift), SEEK_SET);
|
1993-07-01 10:58:21 +00:00
|
|
|
|
|
|
|
|
|
image_size = nameinfo.length << size_shift;
|
1993-09-04 10:09:32 +00:00
|
|
|
|
if (image_size_ret != NULL)
|
|
|
|
|
*image_size_ret = image_size;
|
|
|
|
|
|
|
|
|
|
hmem = GlobalAlloc(GMEM_MOVEABLE, image_size);
|
|
|
|
|
image = GlobalLock(hmem);
|
1993-09-29 12:21:49 +00:00
|
|
|
|
if (image == NULL || read(ResourceFd, image, image_size) != image_size)
|
1993-07-01 10:58:21 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
GlobalFree(hmem);
|
1993-07-01 10:58:21 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
GlobalUnlock(hmem);
|
|
|
|
|
return hmem;
|
1993-07-08 17:37:25 +00:00
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
1993-09-29 12:21:49 +00:00
|
|
|
|
/**********************************************************************
|
|
|
|
|
* LoadString
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
|
|
|
|
|
{
|
|
|
|
|
HANDLE hmem;
|
|
|
|
|
int rsc_size;
|
|
|
|
|
unsigned char *p;
|
|
|
|
|
int string_num;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_RESOURCE
|
|
|
|
|
printf("LoadString: instance = %04x, id = %d, "
|
|
|
|
|
"buffer = %08x, length = %d\n",
|
|
|
|
|
instance, resource_id, buffer, buflen);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
hmem = RSC_LoadResource(instance, (char *) (resource_id >> 4),
|
|
|
|
|
NE_RSCTYPE_STRING, &rsc_size);
|
|
|
|
|
if (hmem == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
p = GlobalLock(hmem);
|
|
|
|
|
string_num = resource_id & 0x000f;
|
|
|
|
|
for (i = 0; i < resource_id; i++)
|
|
|
|
|
p += *p;
|
|
|
|
|
|
|
|
|
|
i = MIN(buflen - 1, *p);
|
|
|
|
|
memcpy(buffer, p + 1, i);
|
|
|
|
|
buffer[i] = '\0';
|
|
|
|
|
|
|
|
|
|
GlobalFree(hmem);
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_RESOURCE
|
|
|
|
|
printf(" '%s'\n", buffer);
|
|
|
|
|
#endif
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
|
1993-07-08 17:37:25 +00:00
|
|
|
|
/**********************************************************************
|
1993-09-04 10:09:32 +00:00
|
|
|
|
* RSC_LoadMenu
|
1993-07-08 17:37:25 +00:00
|
|
|
|
*/
|
1993-09-04 10:09:32 +00:00
|
|
|
|
HANDLE
|
|
|
|
|
RSC_LoadMenu(HANDLE instance, LPSTR menu_name)
|
1993-07-08 17:37:25 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
return RSC_LoadResource(instance, menu_name, NE_RSCTYPE_MENU, NULL);
|
1993-07-08 17:37:25 +00:00
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
1993-07-08 17:37:25 +00:00
|
|
|
|
/**********************************************************************
|
1993-09-04 10:09:32 +00:00
|
|
|
|
* LoadBitmap
|
1993-07-08 17:37:25 +00:00
|
|
|
|
*/
|
1993-09-04 10:09:32 +00:00
|
|
|
|
HBITMAP
|
|
|
|
|
LoadBitmap(HANDLE instance, LPSTR bmp_name)
|
1993-07-08 17:37:25 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
HBITMAP hbitmap;
|
|
|
|
|
HANDLE rsc_mem;
|
|
|
|
|
HDC hdc;
|
|
|
|
|
long *lp;
|
|
|
|
|
int image_size;
|
|
|
|
|
|
1993-07-08 17:37:25 +00:00
|
|
|
|
#ifdef DEBUG_RESOURCE
|
|
|
|
|
printf("LoadBitmap: instance = %04x, name = %08x\n",
|
|
|
|
|
instance, bmp_name);
|
|
|
|
|
#endif
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
|
|
|
|
if (!(hdc = GetDC( 0 ))) return 0;
|
1993-07-08 17:37:25 +00:00
|
|
|
|
|
1993-09-04 10:09:32 +00:00
|
|
|
|
rsc_mem = RSC_LoadResource(instance, bmp_name, NE_RSCTYPE_BITMAP,
|
|
|
|
|
&image_size);
|
|
|
|
|
lp = (long *) GlobalLock(rsc_mem);
|
|
|
|
|
if (lp == NULL)
|
1993-07-08 17:37:25 +00:00
|
|
|
|
{
|
1993-09-04 10:09:32 +00:00
|
|
|
|
GlobalFree(rsc_mem);
|
|
|
|
|
return 0;
|
1993-07-08 17:37:25 +00:00
|
|
|
|
}
|
1993-09-04 10:09:32 +00:00
|
|
|
|
|
|
|
|
|
if (*lp == sizeof(BITMAPCOREHEADER))
|
|
|
|
|
hbitmap = ConvertCoreBitmap( hdc, (BITMAPCOREHEADER *) lp );
|
|
|
|
|
else if (*lp == sizeof(BITMAPINFOHEADER))
|
|
|
|
|
hbitmap = ConvertInfoBitmap( hdc, (BITMAPINFO *) lp );
|
|
|
|
|
else hbitmap = 0;
|
|
|
|
|
|
|
|
|
|
GlobalFree(rsc_mem);
|
|
|
|
|
ReleaseDC( 0, hdc );
|
|
|
|
|
return hbitmap;
|
1993-07-01 10:58:21 +00:00
|
|
|
|
}
|
1993-09-29 12:21:49 +00:00
|
|
|
|
|
|
|
|
|
|