wine/library/libres.c
Alexandre Julliard 7ebe1a4135 Release 961222
Sun Dec 22 13:30:18 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [graphics/metafiledrv/init.c] [graphisc/metafiledrv/mapping.c]
	Added mapping functions.

	* [if1632/gdi.spec] [objects/*.c] [include/windows.h]
	Added a lot of Win32 functions.

	* [memory/heap.c]
	Added HEAP_strdupAtoW and HEAP_strdupWtoA.

	* [misc/lstr.c] [memory/string.c]
	Moved OEM<->Ansi conversion to string.c. Fixed a couple of bugs.

	* [object/font.c]
	Avoid uppercasing font names.

	* [windows/hook.c]
	Set ds = ss before calling hook procedure.

Sat Dec 21 21:44:17 1996  Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [objects/color.c]
	Use colors allocated by other clients. 

	* [windows/caret.c]
	Set default blink time to 500.

	* [windows/win.c] [windows/event.c]
	Delete X context before XDestroyWindow().

	* [windows/keyboard.c]
	Fixed GetKeyState() once more.

Fri Dec 20 08:26:33 1996  Eric Youngdale <eric@sub2304.jic.com>

	* [debugger/*.c]
	Lots of built-in debugger improvements: parse Win32 EXEs debug
 	information, display local variables, source files and line
 	numbers, get symbols directly from the Wine executable, etc.

Tue Dec 17 22:39:42 1996  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [misc/winsock_async.c]
 	Extern declaration added for h_errno.

Tue Dec 17 21:29:34 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [windows/message.c]
	Added two more CBT hook calls: HCBT_CLICKSKIPPED/HCBT_KEYSKIPPED.
1996-12-22 18:27:48 +00:00

191 lines
4.1 KiB
C

/*
* WINElib-Resources
*
* Copied and modified heavily from loader/resource.c
*/
#include <stdio.h>
#include <stdlib.h>
#include "libres.h"
#include "heap.h"
#include "windows.h"
#include "xmalloc.h"
typedef struct RLE
{
const struct resource* const * Resources; /* NULL-terminated array of pointers */
struct RLE* next;
} ResListE;
static ResListE* ResourceList=NULL;
void LIBRES_RegisterResources(const struct resource* const * Res)
{
ResListE** Curr;
ResListE* n;
for(Curr=&ResourceList; *Curr; Curr=&((*Curr)->next)) { }
n=xmalloc(sizeof(ResListE));
n->Resources=Res;
n->next=NULL;
*Curr=n;
}
/**********************************************************************
* LIBRES_FindResource16
*/
HRSRC32 LIBRES_FindResource16( HINSTANCE32 hModule, LPCSTR name, LPCSTR type )
{
int nameid=0,typeid;
ResListE* ResBlock;
const struct resource* const * Res;
if(HIWORD(name))
{
if(*name=='#')
{
nameid=atoi(name+1);
name=NULL;
}
}
else
{
nameid=LOWORD(name);
name=NULL;
}
if(HIWORD(type))
{
if(*type=='#')
typeid=atoi(type+1);
else
{
WINELIB_UNIMP("LIBRES_FindResource16(*,*,type=string)");
return 0;
}
}
else
typeid=LOWORD(type);
for(ResBlock=ResourceList; ResBlock; ResBlock=ResBlock->next)
for(Res=ResBlock->Resources; *Res; Res++)
if(name)
{
if((*Res)->type==typeid && !lstrcmpi32A((*Res)->name,name))
return (HRSRC32)*Res;
}
else
if((*Res)->type==typeid && (*Res)->id==nameid)
return (HRSRC32)*Res;
return 0;
}
/**********************************************************************
* LIBRES_FindResource32
*/
HRSRC32 LIBRES_FindResource32( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type )
{
int nameid=0,typeid;
ResListE* ResBlock;
const struct resource* const * Res;
if(HIWORD(name))
{
if(*name=='#')
{
LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
nameid = atoi(nameA+1);
HeapFree( GetProcessHeap(), 0, nameA );
name=NULL;
}
}
else
{
nameid=LOWORD(name);
name=NULL;
}
if(HIWORD(type))
{
if(*type=='#')
{
LPSTR typeA = HEAP_strdupWtoA( GetProcessHeap(), 0, type );
typeid=atoi(typeA+1);
HeapFree( GetProcessHeap(), 0, typeA );
}
else
{
WINELIB_UNIMP("LIBRES_FindResource32(*,*,type=string)");
return 0;
}
}
else
typeid=LOWORD(type);
for(ResBlock=ResourceList; ResBlock; ResBlock=ResBlock->next)
for(Res=ResBlock->Resources; *Res; Res++)
if(name)
{
if((*Res)->type==typeid && !lstrcmpi32W((*Res)->name,name))
return (HRSRC32)*Res;
}
else
if((*Res)->type==typeid && (*Res)->id==nameid)
return (HRSRC32)*Res;
return 0;
}
/**********************************************************************
* LIBRES_LoadResource
*/
HGLOBAL32 LIBRES_LoadResource( HINSTANCE32 hModule, HRSRC32 hRsrc )
{
return (HGLOBAL32)(((struct resource*)hRsrc)->bytes);
}
/**********************************************************************
* LIBRES_LockResource
*/
LPVOID LIBRES_LockResource( HGLOBAL32 handle )
{
return (LPVOID)handle;
}
/**********************************************************************
* LIBRES_FreeResource
*/
BOOL LIBRES_FreeResource( HGLOBAL32 handle )
{
return 0; /* Obsolete in Win32 */
}
/**********************************************************************
* LIBRES_AccessResource
*/
INT32 LIBRES_AccessResource( HINSTANCE32 hModule, HRSRC32 hRsrc )
{
WINELIB_UNIMP("LIBRES_AccessResource()");
return -1; /* Obsolete in Win32 */
}
/**********************************************************************
* LIBRES_SizeofResource
*/
DWORD LIBRES_SizeofResource( HINSTANCE32 hModule, HRSRC32 hRsrc )
{
return (DWORD)(((struct resource*)hRsrc)->size);
}
/**********************************************************************
* LIBRES_AllocResource
*/
HGLOBAL32 LIBRES_AllocResource( HINSTANCE32 hModule, HRSRC32 hRsrc, DWORD size)
{
WINELIB_UNIMP("LIBRES_AllocResource()");
return 0; /* Obsolete in Win32 */
}