Sweden-Number/toolkit/sup.c

113 lines
2.6 KiB
C

#include <stdio.h>
#include "prototypes.h"
#include "windows.h"
#include "callback.h"
#include "wine.h"
#include "arch.h"
/* HANDLE hSysRes = 1; */
LONG CallWindowProc (FARPROC func, HWND hwnd, WORD message,
WORD wParam, LONG lParam)
{
(*func)(hwnd, message, wParam, lParam);
}
CallLineDDAProc (FARPROC back, int x, int y, long lParam)
{
(*back)(x, y, lParam);
}
DWORD CallHookProc (HOOKPROC func, short code, WPARAM wParam, LPARAM lParam)
{
(*func)(code, wParam, lParam);
}
BOOL CallGrayStringProc (FARPROC func, HDC hdc, LPARAM lParam, INT cch)
{
return (*func) (hdc, lParam, cch);
}
/*
* Header loading routines for WineLib.
*/
/* LOADSHORT Calls LOAD and swaps the high and the low bytes */
#define LOAD(x) read (fd, &TAB->x, sizeof (TAB->x))
#define LOADSHORT(x) LOAD(x); TAB->x = CONV_SHORT (TAB->x);
#define LOADLONG(x) LOAD(x); TAB->x = CONV_LONG (TAB->x);
void load_mz_header (int fd, struct mz_header_s *mz_header)
{
#define TAB mz_header
LOAD (dont_care1);
LOAD (must_be_0x40);
LOAD (dont_care2);
LOADSHORT (ne_offset);
}
void load_ne_header (int fd, struct ne_header_s *ne_header)
{
#undef TAB
#define TAB ne_header
LOAD (header_type);
LOADSHORT (linker_version);
LOADSHORT (linker_revision);
LOADSHORT (entry_tab_offset);
LOADSHORT (entry_tab_length);
LOAD (reserved1);
LOADSHORT (format_flags);
LOADSHORT (auto_data_seg);
LOADSHORT (local_heap_length);
LOADSHORT (stack_length);
LOADSHORT (ip);
LOADSHORT (cs);
LOADSHORT (sp);
LOADSHORT (ss);
LOADSHORT (n_segment_tab);
LOADSHORT (n_mod_ref_tab);
LOADSHORT (nrname_tab_length);
LOADSHORT (segment_tab_offset);
LOADSHORT (resource_tab_offset);
LOADSHORT (rname_tab_offset);
LOADSHORT (moduleref_tab_offset);
LOADSHORT (iname_tab_offset);
LOADLONG (nrname_tab_offset);
LOADSHORT (n_mov_entry_points);
LOADSHORT (align_shift_count);
LOADSHORT (n_resource_seg);
LOAD (operating_system);
LOAD (additional_flags);
LOADSHORT (fastload_offset);
LOADSHORT (fastload_length);
LOADSHORT (reserved2);
LOADSHORT (expect_version);
}
/*
* Typeinfo loading routines for non PC-architectures.
*/
int load_typeinfo (int fd, struct resource_typeinfo_s *typeinfo)
{
#undef TAB
#define TAB typeinfo
LOADSHORT (type_id);
LOADSHORT (count);
LOADLONG (reserved);
return 1;
}
int load_nameinfo (int fd, struct resource_nameinfo_s *nameinfo)
{
#undef TAB
#define TAB nameinfo
LOADSHORT (offset);
LOADSHORT (length);
LOADSHORT (flags);
LOADSHORT (id);
LOADSHORT (handle);
LOADSHORT (usage);
}