wine/tools/wrc/dumpres.c
Alexandre Julliard a845b88ead Release 980601
Sun May 31 13:40:13 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [if1632/signal.c]
	Added display of exception name.

	* [loader/task.c]
	Yet another attempt at fixing SwitchStackTo/SwitchStackBack.

	* [memory/selector.c] [relay32/builtin32.c] [tools/build.c]
	  [win32/kernel32.c]
	Generate an assembly stub for Win32 register functions to make
	their names available at link time.

	* [programs/*/Makefile.in]
	Added hacks to support old resource compiler.

Fri May 29 16:27:14 1998  Marcus Meissner <marcus@jet.franken.de>

	* [tools/testrun]
	Merge of my testscripts at home into one single perl program
	(tested with perl5). Works only on Linux due to 'ps' and 'ipcs'
	magic.

	* [controls/menu.c]
	Added some DefaultMenuItem stubs.

	* [debugger/stabs.c]
	Fixed stabs loading, now supports (int,int) typeinfo format used
	by gcc-2.8 and egcs-1. If it still crashes, please mail me.

	* [if1632/][relay32/]
	Added msvideo.dll (stubs only)
	Replaced some ptr by str for stringcases
	Added some new stubs (VxDCall, FindCloseNotif....)

	* [misc/network.c]
	Some argument fixes.

	* [misc/registry.c][misc/cpu.c]
	Registry initialization partially rewritten and enhanced.

	* [scheduler/*.c]
	Some additions so we don't do kill(0,SIGUSR1) (kill processgroup
	instead of targeted thread)
	Added SetThreadContext.

Thu May 28 23:59:59 1998  Bertho Stultiens <bertho@akhphd.au.dk>

	* [tools/wrc/*]
	New resource compiler version 1.0.0 (28-May-1998)

	* [Make.rules.in] [Makefile.in]
	Changed and added rc rules to point to tools/wrc/wrc.

	* [configure.in] [include/config.h.in]
	Added check for function 'stricmp'.

	* [include/resource.h]
	Commented out the old resource structure to catch references.
	It also includes wrc_rsc.h.

	* [include/wrc_rsc.h]
	New file. Definitions for the resources generated with wrc.

	* [include/windows.h]
	Added #ifdef RC_INVOKED to exclude stdarg.h.
	Added SS_NOTIFY flag.

	* [include/winnls.h]
	Added SUBLANG_* definitions and corrected some defaults.

	* [loader/libres.c]
	Changed the sysres load functions to support wrc generated
	resources.

	* [resource/sysres_*.rc]
	Added #include <windows.h>

	* [resource/sysres.c]
	Changed declarations to match wrc's output

	* [resource/Makefile.in]
	Changed rules to work with wrc.

	* [tools/makedep.c]
	Changed generation of .rc file dependencies to .s target.

Thu May 28 22:28:39 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [files/file.c][include/windows.c][relay32/kernel32.spec]
	Implemented GetFileAttributesEx32A/W.

	* [misc/imagelist.h][include/commctrl.h][relay32/comctl32.spec]
	Added ImageList_Read and ImageList_Write stubs.
	Added ImageList_AddIcon function.
	Added ImageList_LoadImage. It is the same as ImageList_LoadImage32A.

	* [controls/header.c]
	Fixed bitmap drawing bug.
	Added full bitmap support.

	* [include/commctrl.h]
	Added missing header macros.

	* [controls/toolbar.c][include/toolbar.h][include/commctrl.h]
	  [controls/commctrl.c] [relay32/comctl32.spec]
	First implementation of toolbar control.
	Implemented CreateToolbar, CreateToolbarEx and CreateMappedBitmap.

	* [controls/progress.c][controls/status.c]
	Some code cleanup.

	* [controls/commctrl.c][include/commctrl.h][relay32/comctl32.spec]
	Removed CreateStatusWindow16 and DrawStatusText16.
	CreateStatusWindow is the same as CreateStatusWindow32A.
	DrawStatusText is the same as DrawStatusText32A.

Thu May 28 16:01:28 1998  Matthew J. Francis  <asbel@dial.pipex.com>

	* [objects/bitmap.c] [objects/bitmap.h] [objects/oembitmap.c]
	  [objects/dc.c] [graphics/x11drv/bitblt.c]
	Added partial implementation of CreateDIBSection, with great thanks
	to Ulrich Weigand <weigand@informatik.uni-erlangen.de> for
	contributing the bulk of the patch.

Wed May 27 19:04:31 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [win32/kernel32.c] [if1632/thunk.c] [include/flatthunk.h]
	ThunkConnect16 and related functions moved to emulator.

	* [loader/ne/segment.c]
	Call DllEntryPoint with correct arguments.

	* [relay32/builtin32.c]
	Bugfix: Relay debugging did not work for multiple processes.

	* [controls/menu.c]
	Bugfix: dwItemData was not set for MF_OWNERDRAW menus.

	* [if1632/relay.c] [relay32/relay386.c]
	Relay messages converted to use DPRINTF.

	* [controls/desktop.c] [relay32/user32.spec]
	Implemented PaintDesktop.

	* [files/profile.c] [if1632/kernel.spec] [misc/network.c]
	  [misc/printdrv.c] [relay32/winspool.spec] 
	  [win32/ordinals.c] [relay32/kernel32.spec]
	Some stubs added.

	* [relay32/mpr.spec]
	All ordinals were off by one.

Tue May 26 13:32:57 1998  Bill Hawes <whawes@star.net>

	* [misc/lstr.c] [include/casemap.h] [tools/unimap.pl]
	Added Unicode case conversion routines towupper/towlower,
	with mapping tables casemap.h created by tools/unimap.pl.

	* [misc/ntdll.c] [include/winnls.h] [relay32/ntdll.spec]
	  [relay32/advapi.spec]
	Minimal implementation of IsTextUnicode, just enough to get
	NT4 notepad to open ascii/unicode files.

	* [Make.rules.in] [resources/sysres_En.rc]
	Added include file dlgs.h for building resource files, so that
	resources can refer to defined values (e.g. pshHelp).

	* [misc/crtdll.c] [relay32/crtdll.spec]
	Use towupper/towlower for 32W case conversions.

	* [memory/string.c]
	Use towupper for 32W case conversions.

	* [ole/ole2nls.c]
	Use towupper for 32W case conversions; fix mem leak; minor cleanup

	* [controls/edit.c]
	Added soft break flag to edit state. Print unknown action values
	for WM_VSCROLL (action 190 occurs when running NT4 notepad.)

Mon May 25 22:42:40 1998  Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [files/file.c]
	Care for a pathological case in SetFilePointer.

	* [graphics/x11drv/xfont.c]
	Handle longer Font names in LFD_ComposeLFD and try to catch errors.

	* [loader/pe_image.c]
	Unload Dummymodule when PE_LoadLibraryEx32A fails with
	PE_LoadImage (makes Encarta 98 installer proceed).

	* [misc/registry.c]
	Move a check for a special case in RegCreateKeyEx32W after the
	check for existence.

Tue May 25 20:18:26 1998  Matthew Becker <mbecker@glasscity.net>

	* [misc/ntdll.c]
	Added some stubs, just guessing at the size of their param lists.

	* [misc/registry.c]
	Added stubs for RegUnLoadKey, RegSetKeySecurity, RegSaveKey,
	RegRestoreKey, and RegReplaceKey

	* [programs/regtest/regtest.c]
	Updated registry testing program.

Sun May 24 18:11:40 1998  Alex Priem <alexp@sci.kun.nl>

	* [file/profile.c]
	Added flag 'return_values' to PROFILE_GetSection.

Sun May 24 13:41:10 1998  James Juran <jrj120@psu.edu>

	* [misc/shell.c] [files/directory.c]
	Documentation/debugging info additions.

	* [*/*.c] [include/*.h]
	Moved many extern function definitions to appropriate header files.
	Cleaned up a few compile warnings.
	If #include "debug.h" is present, removed #include <stdio.h>.
	debug.h includes stdio.h, so it is not necessary to include both.

	* [graphics/*.c] [if1632/signal.c] [ipc/*.c] [scheduler/*.c]
	  [win32/*.c] [windows/*.c]
	Final patch to convert fprintf statements to new debugging interface.
	Some fprintfs are still left, especially in the debugger/ directory.
	However, IMHO, it's not worth the effort to change the rest.

Fri May 22 21:58:35 1998  Morten Welinder  <terra@diku.dk>

	* [windows/keyboard.c]
	Correct handling of keys "`-=[]\;',./".

Fri May 22 12:06:00 1998  Per Lindström <pelinstr@algonet.se>

	* [include/windows.h] [relay32/kernel32.spec] [win32/console.c]
	Added stub for ReadConsoleOutputCharacter32A.

Thu May 21 16:45:48 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [ole/ole2nls.c]
	Began better implementation of LCMapString32A.
	Not very well tested yet, and still need improvements.

	* [controls/scroll.c]
	Documented functions.

Wed May 20 21:37:56 1998  Peter Hunnisett <hunnise@nortel.ca>

	* [include/windows.h][misc/main.c]
	Change SystemParameterInfo to support SPI_GETHIGHCONTRAST. Also
	include some missing SPI_ definitions.

	* [include/dsound.h][multimedia/dsound.c][relay32/dplayx.spec]
	Added stubs for DirectPlayLobbyCreate[AW]. Not sure if these
	should go into a new files dplayx.c? Anyone care?

	* [include/winnls.h]
	Added two missing flags for the CompareString32 functions.
1998-06-01 10:44:35 +00:00

908 lines
21 KiB
C

/*
* Copyrignt 1998 Bertho A. Stultiens (BS)
*
* 16-Apr-1998 BS - Yeah, dump it to stdout.
*
*/
#include <stdio.h>
#include <ctype.h>
#include <config.h>
#include "wrc.h"
#include "dumpres.h"
/*
*****************************************************************************
* Function : get_typename
* Syntax : char *get_typename(resource_t* r)
* Input :
* r - Resource description
* Output : A pointer to a string representing the resource type
* Description :
* Remarks :
*****************************************************************************
*/
char *get_typename(resource_t* r)
{
switch(r->type){
case res_acc: return "ACCELERATOR";
case res_bmp: return "BITMAP";
case res_cur: return "CURSOR";
case res_curg: return "GROUP_CURSOR";
case res_dlg: return "DIALOG";
case res_dlgex: return "DIALOGEX";
case res_fnt: return "FONT";
case res_ico: return "ICON";
case res_icog: return "GROUP_ICON";
case res_men: return "MENU";
case res_menex: return "MENUEX";
case res_rdt: return "RCDATA";
case res_stt: return "STRINGTABLE";
case res_usr: return "UserResource";
case res_msg: return "MESSAGETABLE";
case res_ver: return "VERSIONINFO";
default: return "Unknown";
}
}
/*
*****************************************************************************
* Function : strncpyWtoA
* Syntax : char *strncpyWtoA(char *cs, short *ws, int maxlen)
* Input :
* cs - Pointer to buffer to receive result
* ws - Source wide-string
* maxlen - Max chars to copy
* Output : 'cs'
* Description : Copy a unicode string to ascii. Copying stops after the
* first occuring '\0' or when maxlen-1 chars are copied. The
* String is always nul terminated.
* Remarks : No codepage translation is done.
*****************************************************************************
*/
char *strncpyWtoA(char *cs, short *ws, int maxlen)
{
char *cptr = cs;
while(*ws && maxlen-1)
{
if(*ws < -128 || *ws > 127)
printf("***Warning: Unicode string contains non-printable chars***");
*cptr++ = (char)*ws++;
maxlen--;
}
*cptr = '\0';
return cs;
}
/*
*****************************************************************************
* Function : print_string
* Syntax : void print_string(string_t *str)
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void print_string(string_t *str)
{
char buffer[512];
if(!str)
printf("<none>");
else if(str->type == str_char)
printf("\"%s\"", str->str.cstr);
else
{
strncpyWtoA(buffer, str->str.wstr, sizeof(buffer));
printf("L\"%s\"", buffer);
}
}
/*
*****************************************************************************
* Function : get_nameid_str
* Syntax : char *get_nameid_str(name_id_t *n)
* Input :
* n - nameid to convert to text
* Output : A pointer to the name.
* Description :
* Remarks : Not reentrant because of static buffer
*****************************************************************************
*/
char *get_nameid_str(name_id_t *n)
{
static char buffer[256];
if(!n)
return "<none>";
if(n->type == name_ord)
{
sprintf(buffer, "%d", n->name.i_name);
return buffer;
}
else if(n->type == name_str)
{
if(n->name.s_name->type == str_char)
return n->name.s_name->str.cstr;
else
{
strncpyWtoA(buffer, n->name.s_name->str.wstr, sizeof(buffer));
return buffer;
}
}
else
return "Hoooo, report this: wrong type in nameid";
}
/*
*****************************************************************************
* Function : dump_memopt
* Syntax : void dump_memopt(DWORD memopt)
* Input :
* memopt - flag bits of the options set
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_memopt(DWORD memopt)
{
printf("Memory/load options: ");
if(memopt & 0x0040)
printf("PRELOAD ");
else
printf("LOADONCALL ");
if(memopt & 0x0010)
printf("MOVEABLE ");
else
printf("FIXED ");
if(memopt & 0x0020)
printf("PURE ");
else
printf("IMPURE ");
if(memopt & 0x1000)
printf("DISCARDABLE");
printf("\n");
}
/*
*****************************************************************************
* Function : dump_lvc
* Syntax : void dump_lvc(lvc_t *l)
* Input :
* l - pointer to lvc structure
* Output :
* Description : Dump language, version and characteristics
* Remarks :
*****************************************************************************
*/
void dump_lvc(lvc_t *l)
{
if(l->language)
printf("LANGUAGE %04x, %04x\n", l->language->id, l->language->sub);
else
printf("LANGUAGE <not set>\n");
if(l->version)
printf("VERSION %08lx\n", *(l->version));
else
printf("VERSION <not set>\n");
if(l->characts)
printf("CHARACTERISTICS %08lx\n", *(l->characts));
else
printf("CHARACTERISTICS <not set>\n");
}
/*
*****************************************************************************
* Function : dump_raw_data
* Syntax : void dump_raw_data(raw_data_t *d)
* Input :
* d - Raw data descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_raw_data(raw_data_t *d)
{
int n;
int i;
int j;
if(!d)
{
printf("<none>");
return;
}
printf("Rawdata size: %d\n", d->size);
if(debuglevel < 2)
return;
for(n = 0; n < d->size; n++)
{
if((n % 16) == 0)
if(n)
{
printf("- ");
for(i = 0; i < 16; i++)
printf("%c", isprint(d->data[n-16+i]) ? d->data[n-16+i] : '.');
printf("\n%08x: ", n);
}
else
printf("%08x: ", n);
printf("%02x ", d->data[n] & 0xff);
}
printf("- ");
j = d->size % 16;
if(!j)
j = 16;
for(i = 0; i < j; i++)
printf("%c", isprint(d->data[n-j+i]) ? d->data[n-j+i] : '.');
printf("\n");
}
/*
*****************************************************************************
* Function : dump_accelerator
* Syntax : void dump_accelerator(resource_t *acc)
* Input :
* acc - Accelerator resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_accelerator(accelerator_t *acc)
{
event_t *ev = acc->events;
dump_memopt(acc->memopt);
dump_lvc(&(acc->lvc));
printf("Events: %s\n", ev ? "" : "<none>");
while(ev)
{
printf("Key=");
if(isprint(ev->key))
printf("\"%c\"", ev->key);
else if(iscntrl(ev->key))
printf("\"^%c\"", ev->key +'@');
else
printf("\\x%02x", ev->key & 0xff);
printf(" Id=%d flags=%04x\n", ev->id, ev->flags);
ev = ev->next;
}
}
/*
*****************************************************************************
* Function : dump_cursor
* Syntax : void dump_cursor(cursor_t *cur)
* Input :
* cur - Cursor resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_cursor(cursor_t *cur)
{
printf("Id: %d\n", cur->id);
printf("Width: %d\n", cur->width);
printf("Height: %d\n", cur->height);
printf("X Hotspot: %d\n", cur->xhot);
printf("Y Hotspot: %d\n", cur->yhot);
dump_raw_data(cur->data);
}
/*
*****************************************************************************
* Function : dump_cursor_group
* Syntax : void dump_cursor_group(cursor_group_t *cur)
* Input :
* cur - Cursor group resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_cursor_group(cursor_group_t *curg)
{
dump_memopt(curg->memopt);
printf("There are %d cursors in this group\n", curg->ncursor);
}
/*
*****************************************************************************
* Function : dump_icon
* Syntax : void dump_icon(icon_t *ico)
* Input :
* ico - Icon resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_icon(icon_t *ico)
{
printf("Id: %d\n", ico->id);
printf("Width: %d\n", ico->width);
printf("Height: %d\n", ico->height);
printf("NColor: %d\n", ico->nclr);
printf("NPlanes: %d\n", ico->planes);
printf("NBits: %d\n", ico->bits);
dump_raw_data(ico->data);
}
/*
*****************************************************************************
* Function : dump_icon_group
* Syntax : void dump_icon_group(icon_group_t *ico)
* Input :
* ico - Icon group resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_icon_group(icon_group_t *icog)
{
dump_memopt(icog->memopt);
printf("There are %d icons in this group\n", icog->nicon);
}
/*
*****************************************************************************
* Function : dump_font
* Syntax : void dump_font(font_t *fnt)
* Input :
* fnt - Font resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_font(font_t *fnt)
{
dump_memopt(fnt->memopt);
dump_raw_data(fnt->data);
}
/*
*****************************************************************************
* Function : dump_bitmap
* Syntax : void dump_bitmap(bitmap_t *bmp)
* Input :
* bmp - Bitmap resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_bitmap(bitmap_t *bmp)
{
dump_memopt(bmp->memopt);
dump_raw_data(bmp->data);
}
/*
*****************************************************************************
* Function : dump_rcdata
* Syntax : void dump_rcdata(rcdata_t *rdt)
* Input :
* rdt - RCData resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_rcdata(rcdata_t *rdt)
{
dump_memopt(rdt->memopt);
dump_raw_data(rdt->data);
}
/*
*****************************************************************************
* Function : dump_user
* Syntax : void dump_user(user_t *usr)
* Input :
* usr - User resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_user(user_t *usr)
{
dump_memopt(usr->memopt);
printf("Class %s\n", get_nameid_str(usr->type));
dump_raw_data(usr->data);
}
/*
*****************************************************************************
* Function : dump_messagetable
* Syntax : void dump_messagetable(messagetable_t *msg)
* Input :
* msg - Messagetable resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_messagetable(messagetable_t *msg)
{
dump_raw_data(msg->data);
}
/*
*****************************************************************************
* Function : dump_stringtable
* Syntax : void dump_stringtable(stringtable_t *stt)
* Input :
* stt - Stringtable resource descriptor
* Output : nop
* Description :
* Remarks :
*****************************************************************************
*/
void dump_stringtable(stringtable_t *stt)
{
int i;
for(; stt; stt = stt->next)
{
printf("{\n");
dump_memopt(stt->memopt);
dump_lvc(&(stt->lvc));
for(i = 0; i < stt->nentries; i++)
{
printf("Id=%-5d (%d) ", stt->idbase+i, stt->entries[i].id);
if(stt->entries[i].str)
print_string(stt->entries[i].str);
else
printf("<none>");
printf("\n");
}
printf("}\n");
}
}
/*
*****************************************************************************
* Function : dump_control
* Syntax : void dump_control(control_t *ctrl)
* Input :
* ctrl - Control resource descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_control(control_t *ctrl)
{
printf("Control {\n\tClass: %s\n", get_nameid_str(ctrl->ctlclass));
printf("\tText: "); print_string(ctrl->title); printf("\n");
printf("\tId: %d\n", ctrl->id);
printf("\tx, y, w, h: %d, %d, %d, %d\n", ctrl->x, ctrl->y, ctrl->width, ctrl->height);
if(ctrl->gotstyle)
printf("\tStyle: %08lx\n", ctrl->style);
if(ctrl->gotexstyle)
printf("\tExStyle: %08lx\n", ctrl->exstyle);
if(ctrl->gothelpid)
printf("\tHelpid: %ld\n", ctrl->helpid);
if(ctrl->extra)
{
printf("\t");
dump_raw_data(ctrl->extra);
}
printf("}\n");
}
/*
*****************************************************************************
* Function : dump_dialog
* Syntax : void dump_dialog(dialog_t *dlg)
* Input :
* dlg - Dialog resource descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_dialog(dialog_t *dlg)
{
control_t *c = dlg->controls;
dump_memopt(dlg->memopt);
dump_lvc(&(dlg->lvc));
printf("x, y, w, h: %d, %d, %d, %d\n", dlg->x, dlg->y, dlg->width, dlg->height);
if(dlg->gotstyle)
printf("Style: %08lx\n", dlg->style);
if(dlg->gotexstyle)
printf("ExStyle: %08lx\n", dlg->exstyle);
printf("Menu: %s\n", get_nameid_str(dlg->menu));
printf("Class: %s\n", get_nameid_str(dlg->dlgclass));
printf("Title: "); print_string(dlg->title); printf("\n");
printf("Font: ");
if(!dlg->font)
printf("<none>\n");
else
{
printf("%d, ", dlg->font->size);
print_string(dlg->font->name);
printf("\n");
}
while(c)
{
dump_control(c);
c = c->next;
}
}
/*
*****************************************************************************
* Function : dump_dialogex
* Syntax : void dump_dialogex(dialogex_t *dlgex)
* Input :
* dlgex - DialogEx resource descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_dialogex(dialogex_t *dlgex)
{
control_t *c = dlgex->controls;
dump_memopt(dlgex->memopt);
dump_lvc(&(dlgex->lvc));
printf("x, y, w, h: %d, %d, %d, %d\n", dlgex->x, dlgex->y, dlgex->width, dlgex->height);
if(dlgex->gotstyle)
printf("Style: %08lx\n", dlgex->style);
if(dlgex->gotexstyle)
printf("ExStyle: %08lx\n", dlgex->exstyle);
if(dlgex->gothelpid)
printf("Helpid: %ld\n", dlgex->helpid);
printf("Menu: %s\n", get_nameid_str(dlgex->menu));
printf("Class: %s\n", get_nameid_str(dlgex->dlgclass));
printf("Title: "); print_string(dlgex->title); printf("\n");
printf("Font: ");
if(!dlgex->font)
printf("<none>\n");
else
{
printf("%d, ", dlgex->font->size);
print_string(dlgex->font->name);
printf(", %d, %d\n", dlgex->font->weight, dlgex->font->italic);
}
while(c)
{
dump_control(c);
c = c->next;
}
}
/*
*****************************************************************************
* Function : dump_menu_item
* Syntax : void dump_menu_item(menu_item_t *item)
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_menu_item(menu_item_t *item)
{
while(item)
{
if(item->popup)
{
printf("POPUP ");
print_string(item->name);
printf("\n");
dump_menu_item(item->popup);
}
else
{
printf("MENUITEM ");
if(item->name)
{
print_string(item->name);
printf(", %d, %08lx", item->id, item->state);
}
else
printf("SEPARATOR");
printf("\n");
}
item = item->next;
}
}
/*
*****************************************************************************
* Function : dump_menu
* Syntax : void dump_menu(menu_t *men)
* Input :
* men - Menu resource descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_menu(menu_t *men)
{
dump_memopt(men->memopt);
dump_lvc(&(men->lvc));
dump_menu_item(men->items);
}
/*
*****************************************************************************
* Function : dump_menuex_item
* Syntax : void dump_menuex_item(menuex_item_t *item)
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_menuex_item(menuex_item_t *item)
{
while(item)
{
if(item->popup)
{
printf("POPUP ");
print_string(item->name);
if(item->gotid)
printf(", Id=%d", item->id);
if(item->gottype)
printf(", Type=%ld", item->type);
if(item->gotstate)
printf(", State=%08lx", item->state);
if(item->gothelpid)
printf(", HelpId=%d", item->helpid);
printf("\n");
dump_menuex_item(item->popup);
}
else
{
printf("MENUITEM ");
if(item->name)
{
print_string(item->name);
if(item->gotid)
printf(", Id=%d", item->id);
if(item->gottype)
printf(", Type=%ld", item->type);
if(item->gotstate)
printf(", State=%08lx", item->state);
if(item->gothelpid)
printf(", HelpId=%d", item->helpid);
}
else
printf("SEPARATOR");
printf("\n");
}
item = item->next;
}
}
/*
*****************************************************************************
* Function : dump_menuex
* Syntax : void dump_menuex(dialogex_t *menex)
* Input :
* menex - MenuEx resource descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_menuex(menuex_t *menex)
{
dump_memopt(menex->memopt);
dump_lvc(&(menex->lvc));
dump_menuex_item(menex->items);
}
/*
*****************************************************************************
* Function : dump_ver_value
* Syntax : void dump_ver_value(ver_value_t *val)
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_ver_value(ver_value_t *val)
{
extern void dump_ver_block(ver_block_t *);
if(val->type == val_str)
{
printf("VALUE ");
print_string(val->key);
printf(" ");
print_string(val->value.str);
printf("\n");
}
else if(val->type == val_words)
{
int i;
printf("VALUE");
print_string(val->key);
for(i = 0; i < val->value.words->nwords; i++)
printf(" %04x", val->value.words->words[i]);
printf("\n");
}
else if(val->type == val_block)
{
dump_ver_block(val->value.block);
}
}
/*
*****************************************************************************
* Function : dump_ver_block
* Syntax : void dump_ver_block(ver_block_t *blk)
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_ver_block(ver_block_t *blk)
{
ver_value_t *val = blk->values;
printf("BLOCK ");
print_string(blk->name);
printf("\n{\n");
while(val)
{
dump_ver_value(val);
val = val->next;
}
printf("}\n");
}
/*
*****************************************************************************
* Function : dump_versioninfo
* Syntax : void dump_versioninfo(versioninfo_t *ver)
* Input :
* ver - Versioninfo resource descriptor
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
void dump_versioninfo(versioninfo_t *ver)
{
ver_block_t *blk = ver->blocks;
if(ver->gotit.fv)
printf("FILEVERSION %04x, %04x, %04x, %04x\n",
ver->filever_maj1,
ver->filever_maj2,
ver->filever_min1,
ver->filever_min2);
if(ver->gotit.pv)
printf("PRODUCTVERSION %04x, %04x, %04x, %04x\n",
ver->prodver_maj1,
ver->prodver_maj2,
ver->prodver_min1,
ver->prodver_min2);
if(ver->gotit.fo)
printf("FILEOS %08x\n", ver->fileos);
if(ver->gotit.ff)
printf("FILEFLAGS %08x\n", ver->fileflags);
if(ver->gotit.ffm)
printf("FILEFLAGSMASK %08x\n", ver->fileflagsmask);
if(ver->gotit.ft)
printf("FILETYPE %08x\n", ver->filetype);
if(ver->gotit.fst)
printf("FILESUBTYPE %08x\n", ver->filesubtype);
while(blk)
{
dump_ver_block(blk);
blk = blk->next;
}
}
/*
*****************************************************************************
* Function :
* Syntax :
* Input :
* Output :
* Description :
* Remarks :
*****************************************************************************
*/
/*
*****************************************************************************
* Function : dump_resources
* Syntax : void dump_resources(resource_t *top)
* Input :
* top - Top of the resource tree
* Output :
* nop
* Description : Dump the parsed resource-tree to stdout
* Remarks :
*****************************************************************************
*/
void dump_resources(resource_t *top)
{
printf("Internal resource-tree dump:\n");
while(top)
{
printf("Resource: %s\nId: %s\n",
get_typename(top),
get_nameid_str(top->name));
switch(top->type)
{
case res_acc:
dump_accelerator(top->res.acc);
break;
case res_bmp:
dump_bitmap(top->res.bmp);
break;
case res_cur:
dump_cursor(top->res.cur);
break;
case res_curg:
dump_cursor_group(top->res.curg);
break;
case res_dlg:
dump_dialog(top->res.dlg);
break;
case res_dlgex:
dump_dialogex(top->res.dlgex);
break;
case res_fnt:
dump_font(top->res.fnt);
break;
case res_icog:
dump_icon_group(top->res.icog);
break;
case res_ico:
dump_icon(top->res.ico);
break;
case res_men:
dump_menu(top->res.men);
break;
case res_menex:
dump_menuex(top->res.menex);
break;
case res_rdt:
dump_rcdata(top->res.rdt);
break;
case res_stt:
dump_stringtable(top->res.stt);
break;
case res_usr:
dump_user(top->res.usr);
break;
case res_msg:
dump_messagetable(top->res.msg);
break;
case res_ver:
dump_versioninfo(top->res.ver);
break;
default:
printf("Report this: Unknown resource type parsed %08x\n", top->type);
}
printf("\n");
top = top->next;
}
}