From 05611e265885383c767b53e89c7c3f07589ccc2d Mon Sep 17 00:00:00 2001 From: d0p1 Date: Thu, 6 Feb 2025 11:42:10 +0100 Subject: [PATCH] Strip down TCC source code by removing useless targets --- .gitignore | 9 + Makefile | 522 --- Makefile.am | 12 + arm-asm.c | 3071 -------------- arm-gen.c | 2391 ----------- arm-link.c | 444 -- arm-tok.h | 383 -- arm64-asm.c | 94 - arm64-gen.c | 2172 ---------- arm64-link.c | 322 -- bootstrap | 3 + c67-gen.c | 2543 ------------ c67-link.c | 125 - coff.h | 241 +- configure | 750 ---- configure.ac | 24 + conftest.c | 308 -- i386-asm.c | 332 +- i386-tok.h | 61 +- il-gen.c | 657 --- il-opcodes.h | 251 -- libtcc.c | 321 +- riscv64-asm.c | 2437 ----------- riscv64-gen.c | 1447 ------- riscv64-link.c | 380 -- riscv64-tok.h | 477 --- tcc.c | 99 +- tcc.h | 207 +- tccasm.c | 49 - tcccoff.c | 994 +---- tccdbg.c | 2 +- tccelf.c | 11 - tccpp.c | 28 +- tccrun.c | 1536 ------- tcctools.c | 126 - win32/build-tcc.bat | 210 - win32/examples/dll.c | 13 - win32/examples/fib.c | 24 - win32/examples/hello_dll.c | 20 - win32/examples/hello_win.c | 163 - win32/include/_mingw.h | 168 - win32/include/assert.h | 62 - win32/include/conio.h | 409 -- win32/include/ctype.h | 281 -- win32/include/dir.h | 31 - win32/include/direct.h | 68 - win32/include/dirent.h | 135 - win32/include/dos.h | 55 - win32/include/errno.h | 75 - win32/include/excpt.h | 123 - win32/include/fcntl.h | 52 - win32/include/fenv.h | 108 - win32/include/inttypes.h | 297 -- win32/include/io.h | 418 -- win32/include/iso646.h | 36 - win32/include/limits.h | 116 - win32/include/locale.h | 91 - win32/include/malloc.h | 181 - win32/include/math.h | 497 --- win32/include/mem.h | 13 - win32/include/memory.h | 40 - win32/include/process.h | 176 - win32/include/sec_api/conio_s.h | 42 - win32/include/sec_api/crtdbg_s.h | 19 - win32/include/sec_api/io_s.h | 33 - win32/include/sec_api/mbstring_s.h | 52 - win32/include/sec_api/search_s.h | 25 - win32/include/sec_api/stdio_s.h | 145 - win32/include/sec_api/stdlib_s.h | 67 - win32/include/sec_api/stralign_s.h | 30 - win32/include/sec_api/string_s.h | 41 - win32/include/sec_api/sys/timeb_s.h | 34 - win32/include/sec_api/tchar_s.h | 266 -- win32/include/sec_api/time_s.h | 61 - win32/include/sec_api/wchar_s.h | 128 - win32/include/setjmp.h | 160 - win32/include/share.h | 28 - win32/include/signal.h | 63 - win32/include/stdint.h | 212 - win32/include/stdio.h | 429 -- win32/include/stdlib.h | 585 --- win32/include/string.h | 164 - win32/include/sys/fcntl.h | 13 - win32/include/sys/file.h | 14 - win32/include/sys/locking.h | 30 - win32/include/sys/stat.h | 290 -- win32/include/sys/time.h | 69 - win32/include/sys/timeb.h | 133 - win32/include/sys/types.h | 123 - win32/include/sys/unistd.h | 14 - win32/include/sys/utime.h | 146 - win32/include/tcc/tcc_libm.h | 618 --- win32/include/tchar.h | 1102 ----- win32/include/time.h | 287 -- win32/include/uchar.h | 33 - win32/include/unistd.h | 1 - win32/include/vadefs.h | 11 - win32/include/values.h | 4 - win32/include/wchar.h | 873 ---- win32/include/wctype.h | 172 - win32/include/winapi/basetsd.h | 149 - win32/include/winapi/basetyps.h | 85 - win32/include/winapi/guiddef.h | 156 - win32/include/winapi/poppack.h | 8 - win32/include/winapi/pshpack1.h | 8 - win32/include/winapi/pshpack2.h | 8 - win32/include/winapi/pshpack4.h | 8 - win32/include/winapi/pshpack8.h | 8 - win32/include/winapi/qos.h | 72 - win32/include/winapi/shellapi.h | 59 - win32/include/winapi/winbase.h | 2958 -------------- win32/include/winapi/wincon.h | 309 -- win32/include/winapi/windef.h | 293 -- win32/include/winapi/windows.h | 127 - win32/include/winapi/winerror.h | 3166 --------------- win32/include/winapi/wingdi.h | 4080 ------------------- win32/include/winapi/winnls.h | 778 ---- win32/include/winapi/winnt.h | 5837 --------------------------- win32/include/winapi/winreg.h | 272 -- win32/include/winapi/winsock2.h | 1474 ------- win32/include/winapi/winuser.h | 5651 -------------------------- win32/include/winapi/winver.h | 160 - win32/include/winapi/ws2ipdef.h | 21 - win32/include/winapi/ws2tcpip.h | 391 -- win32/lib/chkstk.S | 73 - win32/lib/crt1.c | 101 - win32/lib/crt1w.c | 3 - win32/lib/crtinit.c | 26 - win32/lib/dllcrt1.c | 18 - win32/lib/dllmain.c | 9 - win32/lib/gdi32.def | 337 -- win32/lib/kernel32.def | 775 ---- win32/lib/msvcrt.def | 1320 ------ win32/lib/user32.def | 658 --- win32/lib/wincrt1.c | 86 - win32/lib/wincrt1w.c | 3 - win32/lib/ws2_32.def | 198 - win32/tcc-win32.txt | 192 - x86_64-asm.h | 549 --- x86_64-gen.c | 2322 ----------- x86_64-link.c | 403 -- 141 files changed, 241 insertions(+), 66118 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am delete mode 100644 arm-asm.c delete mode 100644 arm-gen.c delete mode 100644 arm-link.c delete mode 100644 arm-tok.h delete mode 100644 arm64-asm.c delete mode 100644 arm64-gen.c delete mode 100644 arm64-link.c create mode 100644 bootstrap delete mode 100644 c67-gen.c delete mode 100644 c67-link.c delete mode 100755 configure create mode 100644 configure.ac delete mode 100644 conftest.c delete mode 100644 il-gen.c delete mode 100644 il-opcodes.h delete mode 100644 riscv64-asm.c delete mode 100644 riscv64-gen.c delete mode 100644 riscv64-link.c delete mode 100644 riscv64-tok.h delete mode 100644 tccrun.c delete mode 100644 win32/build-tcc.bat delete mode 100644 win32/examples/dll.c delete mode 100644 win32/examples/fib.c delete mode 100644 win32/examples/hello_dll.c delete mode 100644 win32/examples/hello_win.c delete mode 100644 win32/include/_mingw.h delete mode 100644 win32/include/assert.h delete mode 100644 win32/include/conio.h delete mode 100644 win32/include/ctype.h delete mode 100644 win32/include/dir.h delete mode 100644 win32/include/direct.h delete mode 100644 win32/include/dirent.h delete mode 100644 win32/include/dos.h delete mode 100644 win32/include/errno.h delete mode 100644 win32/include/excpt.h delete mode 100644 win32/include/fcntl.h delete mode 100644 win32/include/fenv.h delete mode 100644 win32/include/inttypes.h delete mode 100644 win32/include/io.h delete mode 100644 win32/include/iso646.h delete mode 100644 win32/include/limits.h delete mode 100644 win32/include/locale.h delete mode 100644 win32/include/malloc.h delete mode 100644 win32/include/math.h delete mode 100644 win32/include/mem.h delete mode 100644 win32/include/memory.h delete mode 100644 win32/include/process.h delete mode 100644 win32/include/sec_api/conio_s.h delete mode 100644 win32/include/sec_api/crtdbg_s.h delete mode 100644 win32/include/sec_api/io_s.h delete mode 100644 win32/include/sec_api/mbstring_s.h delete mode 100644 win32/include/sec_api/search_s.h delete mode 100644 win32/include/sec_api/stdio_s.h delete mode 100644 win32/include/sec_api/stdlib_s.h delete mode 100644 win32/include/sec_api/stralign_s.h delete mode 100644 win32/include/sec_api/string_s.h delete mode 100644 win32/include/sec_api/sys/timeb_s.h delete mode 100644 win32/include/sec_api/tchar_s.h delete mode 100644 win32/include/sec_api/time_s.h delete mode 100644 win32/include/sec_api/wchar_s.h delete mode 100644 win32/include/setjmp.h delete mode 100644 win32/include/share.h delete mode 100644 win32/include/signal.h delete mode 100644 win32/include/stdint.h delete mode 100644 win32/include/stdio.h delete mode 100644 win32/include/stdlib.h delete mode 100644 win32/include/string.h delete mode 100644 win32/include/sys/fcntl.h delete mode 100644 win32/include/sys/file.h delete mode 100644 win32/include/sys/locking.h delete mode 100644 win32/include/sys/stat.h delete mode 100644 win32/include/sys/time.h delete mode 100644 win32/include/sys/timeb.h delete mode 100644 win32/include/sys/types.h delete mode 100644 win32/include/sys/unistd.h delete mode 100644 win32/include/sys/utime.h delete mode 100644 win32/include/tcc/tcc_libm.h delete mode 100644 win32/include/tchar.h delete mode 100644 win32/include/time.h delete mode 100644 win32/include/uchar.h delete mode 100644 win32/include/unistd.h delete mode 100644 win32/include/vadefs.h delete mode 100644 win32/include/values.h delete mode 100644 win32/include/wchar.h delete mode 100644 win32/include/wctype.h delete mode 100644 win32/include/winapi/basetsd.h delete mode 100644 win32/include/winapi/basetyps.h delete mode 100644 win32/include/winapi/guiddef.h delete mode 100644 win32/include/winapi/poppack.h delete mode 100644 win32/include/winapi/pshpack1.h delete mode 100644 win32/include/winapi/pshpack2.h delete mode 100644 win32/include/winapi/pshpack4.h delete mode 100644 win32/include/winapi/pshpack8.h delete mode 100644 win32/include/winapi/qos.h delete mode 100644 win32/include/winapi/shellapi.h delete mode 100644 win32/include/winapi/winbase.h delete mode 100644 win32/include/winapi/wincon.h delete mode 100644 win32/include/winapi/windef.h delete mode 100644 win32/include/winapi/windows.h delete mode 100644 win32/include/winapi/winerror.h delete mode 100644 win32/include/winapi/wingdi.h delete mode 100644 win32/include/winapi/winnls.h delete mode 100644 win32/include/winapi/winnt.h delete mode 100644 win32/include/winapi/winreg.h delete mode 100644 win32/include/winapi/winsock2.h delete mode 100644 win32/include/winapi/winuser.h delete mode 100644 win32/include/winapi/winver.h delete mode 100644 win32/include/winapi/ws2ipdef.h delete mode 100644 win32/include/winapi/ws2tcpip.h delete mode 100644 win32/lib/chkstk.S delete mode 100644 win32/lib/crt1.c delete mode 100644 win32/lib/crt1w.c delete mode 100644 win32/lib/crtinit.c delete mode 100644 win32/lib/dllcrt1.c delete mode 100644 win32/lib/dllmain.c delete mode 100644 win32/lib/gdi32.def delete mode 100644 win32/lib/kernel32.def delete mode 100644 win32/lib/msvcrt.def delete mode 100644 win32/lib/user32.def delete mode 100644 win32/lib/wincrt1.c delete mode 100644 win32/lib/wincrt1w.c delete mode 100644 win32/lib/ws2_32.def delete mode 100644 win32/tcc-win32.txt delete mode 100644 x86_64-asm.h delete mode 100644 x86_64-gen.c delete mode 100644 x86_64-link.c diff --git a/.gitignore b/.gitignore index 6870b8d3..902348ce 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,12 @@ tests/vla_test tests/hello tests/tests2/fred.txt libtcc.dylib +Makefile +*.in +*.status +aclocal.m4 +stamp-h1 +*_old +*.cache +.deps +build-aux \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 2a7b774b..00000000 --- a/Makefile +++ /dev/null @@ -1,522 +0,0 @@ -# -------------------------------------------------------------------------- -# -# Tiny C Compiler Makefile -# - -ifndef TOP - TOP = . - INCLUDED = no -endif - -ifeq ($(findstring $(MAKECMDGOALS),clean distclean),) - include $(TOP)/config.mak -endif - -ifeq (-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-4--) - CFLAGS += -D_FORTIFY_SOURCE=0 -endif - -LIBTCC = libtcc.a -LIBTCC1 = libtcc1.a -LINK_LIBTCC = -LIBS = -CFLAGS += $(CPPFLAGS) -VPATH = $(TOPSRC) --LTCC = $(TOP)/$(LIBTCC) - -ifdef CONFIG_WIN32 - CFG = -win - ifneq ($(CONFIG_static),yes) - LIBTCC = libtcc$(DLLSUF) - LIBTCCDEF = libtcc.def - endif - ifneq ($(CONFIG_debug),yes) - LDFLAGS += -s - endif - NATIVE_TARGET = $(ARCH)-win$(if $(findstring arm,$(ARCH)),ce,32) -else - CFG = -unx - LIBS+=-lm - ifneq ($(CONFIG_ldl),no) - LIBS+=-ldl - endif - ifneq ($(CONFIG_pthread),no) - LIBS+=-lpthread - endif - # make libtcc as static or dynamic library? - ifeq ($(CONFIG_static),no) - LIBTCC=libtcc$(DLLSUF) - export LD_LIBRARY_PATH := $(CURDIR)/$(TOP) - ifneq ($(CONFIG_rpath),no) - ifndef CONFIG_OSX - LINK_LIBTCC += -Wl,-rpath,"$(libdir)" - else - # macOS doesn't support env-vars libdir out of the box - which we need for - # `make test' when libtcc.dylib is used (configure --disable-static), so - # we bake a relative path into the binary. $libdir is used after install. - LINK_LIBTCC += -Wl,-rpath,"@executable_path/$(TOP)" -Wl,-rpath,"$(libdir)" - # -current/compatibility_version must not contain letters. - MACOS_DYLIB_VERSION := $(firstword $(subst rc, ,$(VERSION))) - DYLIBVER += -current_version $(MACOS_DYLIB_VERSION) - DYLIBVER += -compatibility_version $(MACOS_DYLIB_VERSION) - endif - endif - endif - NATIVE_TARGET = $(ARCH) - ifdef CONFIG_OSX - NATIVE_TARGET = $(ARCH)-osx - ifneq ($(CC_NAME),tcc) - LDFLAGS += -flat_namespace - ifneq (1,$(shell expr $(GCC_MAJOR) ">=" 15)) - LDFLAGS += -undefined warning # depreciated in clang >= 15.0 - endif - endif - export MACOSX_DEPLOYMENT_TARGET := 10.6 - endif -endif - -# run local version of tcc with local libraries and includes -TCCFLAGS-unx = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP) -TCCFLAGS = $(TCCFLAGS$(CFG)) -TCC_LOCAL = $(TOP)/tcc$(EXESUF) -TCC = $(TCC_LOCAL) $(TCCFLAGS) - -# run tests with the installed tcc instead -ifdef TESTINSTALL - TCC_LOCAL = $(bindir)/tcc - TCCFLAGS-unx = -I$(TOP) - TCCFLAGS-win = -B$(bindir) -I$(TOP) - -LTCC = $(libdir)/$(LIBTCC) $(LINK_LIBTCC) -endif - -CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE -LIBS_P = $(LIBS) -LDFLAGS_P = $(LDFLAGS) - -DEF-i386 = -DTCC_TARGET_I386 -DEF-i386-win32 = -DTCC_TARGET_I386 -DTCC_TARGET_PE -DEF-i386-OpenBSD = $(DEF-i386) -DTARGETOS_OpenBSD -DEF-x86_64 = -DTCC_TARGET_X86_64 -DEF-x86_64-win32 = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE -DEF-x86_64-osx = -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DEF-arm-fpa = -DTCC_TARGET_ARM -DEF-arm-fpa-ld = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12 -DEF-arm-vfp = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI -DEF-arm-eabihf = $(DEF-arm-eabi) -DTCC_ARM_HARDFLOAT -DEF-arm = $(DEF-arm-eabihf) -DEF-arm-NetBSD = $(DEF-arm-eabihf) -DTARGETOS_NetBSD -DEF-arm-wince = $(DEF-arm-eabihf) -DTCC_TARGET_PE -DEF-arm64 = -DTCC_TARGET_ARM64 -DEF-arm64-osx = $(DEF-arm64) -DTCC_TARGET_MACHO -DEF-arm64-FreeBSD = $(DEF-arm64) -DTARGETOS_FreeBSD -DEF-arm64-NetBSD = $(DEF-arm64) -DTARGETOS_NetBSD -DEF-arm64-OpenBSD = $(DEF-arm64) -DTARGETOS_OpenBSD -DEF-riscv64 = -DTCC_TARGET_RISCV64 -DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs -DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD -DEF-x86_64-NetBSD = $(DEF-x86_64) -DTARGETOS_NetBSD -DEF-x86_64-OpenBSD = $(DEF-x86_64) -DTARGETOS_OpenBSD - -ifeq ($(INCLUDED),no) -# -------------------------------------------------------------------------- -# running top Makefile - -PROGS = tcc$(EXESUF) -TCCLIBS = $(LIBTCCDEF) $(LIBTCC) $(LIBTCC1) -TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info - -all: $(PROGS) $(TCCLIBS) $(TCCDOCS) - -# cross compiler targets to build -TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67 -TCC_X += riscv64 arm64-osx -# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi - -# cross libtcc1.a targets to build -LIBTCC1_X = $(filter-out c67,$(TCC_X)) - -PROGS_CROSS = $(foreach X,$(TCC_X),$X-tcc$(EXESUF)) -LIBTCC1_CROSS = $(foreach X,$(LIBTCC1_X),$X-libtcc1.a) - -# build cross compilers & libs -cross: $(LIBTCC1_CROSS) $(PROGS_CROSS) - -# build specific cross compiler & lib -cross-%: %-tcc$(EXESUF) %-libtcc1.a ; - -install: ; @$(MAKE) --no-print-directory install$(CFG) -install-strip: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=yes -uninstall: ; @$(MAKE) --no-print-directory uninstall$(CFG) - -ifdef CONFIG_cross -all : cross -endif - -# -------------------------------------------- - -T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown) -X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-) - -DEFINES += $(DEF-$T) -DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"") -DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"") -DEFINES += $(if $(LIB-$T),-DCONFIG_TCC_LIBPATHS="\"$(LIB-$T)\"") -DEFINES += $(if $(INC-$T),-DCONFIG_TCC_SYSINCLUDEPATHS="\"$(INC-$T)\"") -DEFINES += $(if $(ELF-$T),-DCONFIG_TCC_ELFINTERP="\"$(ELF-$T)\"") -DEFINES += $(DEF-$(or $(findstring win,$T),unx)) - -ifneq ($(X),) -$(if $(DEF-$T),,$(error error: unknown target: '$T')) -DEF-$(NATIVE_TARGET) = -DEF-$T += -DCONFIG_TCC_CROSSPREFIX="\"$X\"" -ifneq ($(CONFIG_WIN32),yes) -DEF-win += -DCONFIG_TCCDIR="\"$(tccdir)/win32\"" -endif -else -# using values from config.h -DEF-$(NATIVE_TARGET) = -endif - -# include custom configuration (see make help) --include config-extra.mak - -ifneq ($(T),$(NATIVE_TARGET)) -# assume support files for cross-targets in "/usr/" by default -TRIPLET-i386 ?= i686-linux-gnu -TRIPLET-x86_64 ?= x86_64-linux-gnu -TRIPLET-arm ?= arm-linux-gnueabi -TRIPLET-arm64 ?= aarch64-linux-gnu -TRIPLET-riscv64 ?= riscv64-linux-gnu -MARCH-i386 ?= i386-linux-gnu -MARCH-$T ?= $(TRIPLET-$T) -TR = $(if $(TRIPLET-$T),$T,ignored) -CRT-$(TR) ?= /usr/$(TRIPLET-$T)/lib -LIB-$(TR) ?= {B}:/usr/$(TRIPLET-$T)/lib:/usr/lib/$(MARCH-$T) -INC-$(TR) ?= {B}/include:/usr/$(TRIPLET-$T)/include:/usr/include -endif - -CORE_FILES = tcc.c tcctools.c libtcc.c tccpp.c tccgen.c tccdbg.c tccelf.c tccasm.c tccrun.c -CORE_FILES += tcc.h config.h libtcc.h tcctok.h -i386_FILES = $(CORE_FILES) i386-gen.c i386-link.c i386-asm.c i386-asm.h i386-tok.h -i386-win32_FILES = $(i386_FILES) tccpe.c -x86_64_FILES = $(CORE_FILES) x86_64-gen.c x86_64-link.c i386-asm.c x86_64-asm.h -x86_64-win32_FILES = $(x86_64_FILES) tccpe.c -x86_64-osx_FILES = $(x86_64_FILES) tccmacho.c -arm_FILES = $(CORE_FILES) arm-gen.c arm-link.c arm-asm.c arm-tok.h -arm-wince_FILES = $(arm_FILES) tccpe.c -arm-eabihf_FILES = $(arm_FILES) -arm-fpa_FILES = $(arm_FILES) -arm-fpa-ld_FILES = $(arm_FILES) -arm-vfp_FILES = $(arm_FILES) -arm-eabi_FILES = $(arm_FILES) -arm-eabihf_FILES = $(arm_FILES) -arm64_FILES = $(CORE_FILES) arm64-gen.c arm64-link.c arm64-asm.c -arm64-osx_FILES = $(arm64_FILES) tccmacho.c -c67_FILES = $(CORE_FILES) c67-gen.c c67-link.c tcccoff.c -riscv64_FILES = $(CORE_FILES) riscv64-gen.c riscv64-link.c riscv64-asm.c - -TCCDEFS_H$(subst yes,,$(CONFIG_predefs)) = tccdefs_.h - -# libtcc sources -LIBTCC_SRC = $(filter-out tcc.c tcctools.c,$(filter %.c,$($T_FILES))) - -ifeq ($(ONE_SOURCE),yes) -LIBTCC_OBJ = $(X)libtcc.o -LIBTCC_INC = $($T_FILES) -TCC_FILES = $(X)tcc.o -$(X)tcc.o $(X)libtcc.o : $(TCCDEFS_H) -else -LIBTCC_OBJ = $(patsubst %.c,$(X)%.o,$(LIBTCC_SRC)) -LIBTCC_INC = $(filter %.h %-gen.c %-link.c,$($T_FILES)) -TCC_FILES = $(X)tcc.o $(LIBTCC_OBJ) -$(X)tccpp.o : $(TCCDEFS_H) -$(X)libtcc.o : DEFINES += -DONE_SOURCE=0 -$(CROSS_TARGET)-tcc.o : DEFINES += -DONE_SOURCE=0 -endif -# native tcc always made from tcc.o and libtcc.[so|a] -tcc.o : DEFINES += -DONE_SOURCE=0 -DEFINES += -I$(TOP) - -GITHASH:=$(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo no) -ifneq ($(GITHASH),no) -GITHASH:=$(shell git log -1 --date=short --pretty='format:%cd $(GITHASH)@%h') -GITMODF:=$(shell git diff --quiet || echo '*') -DEF_GITHASH:= -DTCC_GITHASH="\"$(GITHASH)$(GITMODF)\"" -endif - -ifeq ($(CONFIG_debug),yes) -CFLAGS += -g -LDFLAGS += -g -endif - -# convert "include/tccdefs.h" to "tccdefs_.h" -%_.h : include/%.h conftest.c - $S$(CC) -DC2STR $(filter %.c,$^) -o c2str.exe && ./c2str.exe $< $@ - -# target specific object rule -$(X)%.o : %.c $(LIBTCC_INC) - $S$(CC) -o $@ -c $< $(addsuffix ,$(DEFINES) $(CFLAGS)) - -# additional dependencies -$(X)tcc.o : tcctools.c -$(X)tcc.o : DEFINES += $(DEF_GITHASH) - -# Host Tiny C Compiler -tcc$(EXESUF): tcc.o $(LIBTCC) - $S$(CC) -o $@ $^ $(addsuffix ,$(LIBS) $(LDFLAGS) $(LINK_LIBTCC)) - -# Cross Tiny C Compilers -# (the TCCDEFS_H dependency is only necessary for parallel makes, -# ala 'make -j x86_64-tcc i386-tcc tcc', which would create multiple -# c2str.exe and tccdefs_.h files in parallel, leading to access errors. -# This forces it to be made only once. Make normally tracks multiple paths -# to the same goals and only remakes it once, but that doesn't work over -# sub-makes like in this target) -%-tcc$(EXESUF): $(TCCDEFS_H) FORCE - @$(MAKE) --no-print-directory $@ CROSS_TARGET=$* ONE_SOURCE=$(or $(ONE_SOURCE),yes) - -$(CROSS_TARGET)-tcc$(EXESUF): $(TCC_FILES) - $S$(CC) -o $@ $^ $(LIBS) $(LDFLAGS) - -# profiling version -tcc_p$(EXESUF): $($T_FILES) - $S$(CC) -o $@ $< $(DEFINES) $(CFLAGS_P) $(LIBS_P) $(LDFLAGS_P) - -# static libtcc library -libtcc.a: $(LIBTCC_OBJ) - $S$(AR) rcs $@ $^ - -# dynamic libtcc library -libtcc.so: $(LIBTCC_OBJ) - $S$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LIBS) $(LDFLAGS) - -libtcc.so: override CFLAGS += -fPIC -libtcc.so: override LDFLAGS += -fPIC - -# OSX dynamic libtcc library -libtcc.dylib: $(LIBTCC_OBJ) - $S$(CC) -dynamiclib $(DYLIBVER) -install_name @rpath/$@ -o $@ $^ $(LDFLAGS) - -# OSX libtcc.dylib (without rpath/ prefix) -libtcc.osx: $(LIBTCC_OBJ) - $S$(CC) -shared -install_name libtcc.dylib -o libtcc.dylib $^ $(LDFLAGS) - -# windows dynamic libtcc library -libtcc.dll : $(LIBTCC_OBJ) - $S$(CC) -shared -o $@ $^ $(LDFLAGS) -libtcc.dll : DEFINES += -DLIBTCC_AS_DLL - -# import file for windows libtcc.dll -libtcc.def : libtcc.dll tcc$(EXESUF) - $S$(XTCC) -impdef $< -o $@ -XTCC ?= ./tcc$(EXESUF) - -# TinyCC runtime libraries -libtcc1.a : tcc$(EXESUF) FORCE - @$(MAKE) -C lib - -# Cross libtcc1.a -%-libtcc1.a : %-tcc$(EXESUF) FORCE - @$(MAKE) -C lib CROSS_TARGET=$* - -.PRECIOUS: %-libtcc1.a -FORCE: - -# WHICH = which $1 2>/dev/null -# some versions of gnu-make do not recognize 'command' as a shell builtin -WHICH = sh -c 'command -v $1' - -run-if = $(if $(shell $(call WHICH,$1)),$S $1 $2) -S = $(if $(findstring yes,$(SILENT)),@$(info * $@)) - -# -------------------------------------------------------------------------- -# documentation and man page -tcc-doc.html: tcc-doc.texi - $(call run-if,makeinfo,--no-split --html --number-sections -o $@ $<) - -tcc-doc.info: tcc-doc.texi - $(call run-if,makeinfo,$< || true) - -tcc.1 : tcc-doc.pod - $(call run-if,pod2man,--section=1 --center="Tiny C Compiler" \ - --release="$(VERSION)" $< >$@) -%.pod : %.texi - $(call run-if,perl,$(TOPSRC)/texi2pod.pl $< $@) - -doc : $(TCCDOCS) - -# -------------------------------------------------------------------------- -# install - -INSTALL = install -m644 -INSTALLBIN = install -m755 $(STRIP_$(CONFIG_strip)) -STRIP_yes = -s - -LIBTCC1_W = $(filter %-win32-libtcc1.a %-wince-libtcc1.a,$(LIBTCC1_CROSS)) -LIBTCC1_U = $(filter-out $(LIBTCC1_W),$(wildcard *-libtcc1.a)) -IB = $(if $1,$(IM) mkdir -p $2 && $(INSTALLBIN) $1 $2) -IBw = $(call IB,$(wildcard $1),$2) -IF = $(if $1,$(IM) mkdir -p $2 && $(INSTALL) $1 $2) -IFw = $(call IF,$(wildcard $1),$2) -IR = $(IM) mkdir -p $2 && cp -r $1/. $2 -IM = @echo "-> $2 : $1" ; -BINCHECK = $(if $(wildcard $(PROGS) *-tcc$(EXESUF)),,@echo "Makefile: nothing found to install" && exit 1) - -EXTRA_O = runmain.o bt-exe.o bt-dll.o bt-log.o bcheck.o - -# install progs & libs -install-unx: - $(call BINCHECK) - $(call IBw,$(PROGS) *-tcc,"$(bindir)") - $(call IFw,$(LIBTCC1) $(EXTRA_O) $(LIBTCC1_U),"$(tccdir)") - $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include") - $(call $(if $(findstring .so,$(LIBTCC)),IBw,IFw),$(LIBTCC),"$(libdir)") - $(call IF,$(TOPSRC)/libtcc.h,"$(includedir)") - $(call IFw,tcc.1,"$(mandir)/man1") - $(call IFw,tcc-doc.info,"$(infodir)") - $(call IFw,tcc-doc.html,"$(docdir)") -ifneq "$(wildcard $(LIBTCC1_W))" "" - $(call IFw,$(TOPSRC)/win32/lib/*.def $(LIBTCC1_W),"$(tccdir)/win32/lib") - $(call IR,$(TOPSRC)/win32/include,"$(tccdir)/win32/include") - $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/win32/include") -endif - -# uninstall -uninstall-unx: - @rm -fv $(addprefix "$(bindir)/",$(PROGS) $(PROGS_CROSS)) - @rm -fv $(addprefix "$(libdir)/", libtcc*.a libtcc*.so libtcc.dylib,$P) - @rm -fv $(addprefix "$(includedir)/", libtcc.h) - @rm -fv "$(mandir)/man1/tcc.1" "$(infodir)/tcc-doc.info" - @rm -fv "$(docdir)/tcc-doc.html" - @rm -frv "$(tccdir)" - -# install progs & libs on windows -install-win: - $(call BINCHECK) - $(call IBw,$(PROGS) *-tcc.exe libtcc.dll,"$(bindir)") - $(call IF,$(TOPSRC)/win32/lib/*.def,"$(tccdir)/lib") - $(call IFw,libtcc1.a $(EXTRA_O) $(LIBTCC1_W),"$(tccdir)/lib") - $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include") - $(call IR,$(TOPSRC)/win32/include,"$(tccdir)/include") - $(call IR,$(TOPSRC)/win32/examples,"$(tccdir)/examples") - $(call IF,$(TOPSRC)/tests/libtcc_test.c,"$(tccdir)/examples") - $(call IFw,$(TOPSRC)/libtcc.h libtcc.def libtcc.a,"$(libdir)") - $(call IFw,$(TOPSRC)/win32/tcc-win32.txt tcc-doc.html,"$(docdir)") -ifneq "$(wildcard $(LIBTCC1_U))" "" - $(call IFw,$(LIBTCC1_U),"$(tccdir)/lib") - $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/lib/include") -endif - -# uninstall on windows -uninstall-win: - @rm -fv $(foreach P,libtcc*.dll $(PROGS) *-tcc.exe,"$(bindir)"/$P) - @rm -fr $(foreach P,doc examples include lib libtcc,"$(tccdir)"/$P/*) - @rm -frv $(foreach P,doc examples include lib libtcc,"$(tccdir)"/$P) - -# the msys-git shell works to configure && make except it does not have install -ifeq ($(OS),Windows_NT) -ifeq ($(shell $(call WHICH,install) || echo no),no) -INSTALL = cp -INSTALLBIN = cp -endif -endif - -# -------------------------------------------------------------------------- -# other stuff - -TAGFILES = *.[ch] include/*.h lib/*.[chS] -tags : ; ctags $(TAGFILES) -# cannot have both tags and TAGS on windows -ETAGS : ; etags $(TAGFILES) - -# create release tarball from *current* git branch (including tcc-doc.html -# and converting two files to CRLF) -TCC-VERSION = tcc-$(VERSION) -TCC-VERSION = tinycc-mob-$(shell git rev-parse --short=7 HEAD) -tar: tcc-doc.html - mkdir -p $(TCC-VERSION) - ( cd $(TCC-VERSION) && git --git-dir ../.git checkout -f ) - cp tcc-doc.html $(TCC-VERSION) - for f in tcc-win32.txt build-tcc.bat ; do \ - cat win32/$$f | sed 's,\(.*\),\1\r,g' > $(TCC-VERSION)/win32/$$f ; \ - done - tar cjf $(TCC-VERSION).tar.bz2 $(TCC-VERSION) - rm -rf $(TCC-VERSION) - git reset - -config.mak: - $(if $(wildcard $@),,@echo "Please run ./configure." && exit 1) - -# run all tests -test: - @$(MAKE) -C tests -# run test(s) from tests2 subdir (see make help) -tests2.%: - @$(MAKE) -C tests/tests2 $@ -# run test(s) from testspp subdir (see make help) -testspp.%: - @$(MAKE) -C tests/pp $@ -# run tests with code coverage -tcov-tes% : tcc_c$(EXESUF) - @rm -f $<.tcov - @$(MAKE) --no-print-directory TCC_LOCAL=$(CURDIR)/$< tes$* -tcc_c$(EXESUF): $($T_FILES) - $S$(TCC) tcc.c -o $@ -ftest-coverage $(DEFINES) $(LIBS) -# test the installed tcc instead -test-install: $(TCCDEFS_H) - @$(MAKE) -C tests TESTINSTALL=yes #_all - -clean: - @rm -f tcc *-tcc tcc_p tcc_c - @rm -f tags ETAGS *.o *.a *.so* *.out *.log lib*.def *.exe *.dll - @rm -f a.out *.dylib *_.h *.pod *.tcov - @$(MAKE) -s -C lib $@ - @$(MAKE) -s -C tests $@ - -distclean: clean - @rm -vf config.h config.mak config.texi - @rm -vf $(TCCDOCS) - -.PHONY: all clean test tar tags ETAGS doc distclean install uninstall FORCE - -help: - @echo "make" - @echo " build native compiler (from separate objects)" - @echo "make cross" - @echo " build cross compilers (from one source)" - @echo "make ONE_SOURCE=no/yes SILENT=no/yes" - @echo " force building from separate/one object(s), less/more silently" - @echo "make cross-TARGET" - @echo " build one specific cross compiler for 'TARGET'. Currently supported:" - @echo " $(wordlist 1,8,$(TCC_X))" - @echo " $(wordlist 9,99,$(TCC_X))" - @echo "make test" - @echo " run all tests" - @echo "make tests2.all / make tests2.37 / make tests2.37+" - @echo " run all/single test(s) from tests2, optionally update .expect" - @echo "make testspp.all / make testspp.17" - @echo " run all/single test(s) from tests/pp" - @echo "make tcov-test / tcov-tests2... / tcov-testspp..." - @echo " run tests as above with code coverage. After test(s) see tcc_c$(EXESUF).tcov" - @echo "make test-install" - @echo " run tests with the installed tcc" - @echo "Other supported make targets:" - @echo " install install-strip uninstall doc [dist]clean tags ETAGS tar help" - @echo "Custom configuration:" - @echo " The makefile includes a file 'config-extra.mak' if it is present." - @echo " This file may contain some custom configuration. For example to" - @echo " configure the search paths for a cross-compiler, assuming the" - @echo " support files in /usr/i686-linux-gnu:" - @echo " ROOT-i386 = /usr/i686-linux-gnu" - @echo " CRT-i386 = {R}/lib" - @echo " LIB-i386 = {B}:{R}/lib" - @echo " INC-i386 = {B}/include:{R}/include (*)" - @echo " DEF-i386 += -D__linux__" - @echo " Or also, for the cross platform files in /usr/" - @echo " TRIPLET-i386 = i686-linux-gnu" - @echo " (*) tcc replaces {B} by 'tccdir' and {R} by 'CONFIG_SYSROOT'" - -# -------------------------------------------------------------------------- -endif # ($(INCLUDED),no) diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..bc67671e --- /dev/null +++ b/Makefile.am @@ -0,0 +1,12 @@ +AM_CFLAGS = + + +noinst_LIBRARIES = libtcc.a +libtcc_a_SOURCES = libtcc.c tccpp.c tccgen.c tccdbg.c tccasm.c tccelf.c i386-gen.c i386-link.c i386-asm.c +libtcc_a_CPPFLAGS = -I$(top_srcdir) + +bin_PROGRAMS = tcc + +tcc_SOURCES = tcc.c +tcc_LDADD = libtcc.a +tcc_CPPFLAGS = -I$(top_srcdir) diff --git a/arm-asm.c b/arm-asm.c deleted file mode 100644 index 54c063ae..00000000 --- a/arm-asm.c +++ /dev/null @@ -1,3071 +0,0 @@ -/* - * ARM specific functions for TCC assembler - * - * Copyright (c) 2001, 2002 Fabrice Bellard - * Copyright (c) 2020 Danny Milosavljevic - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef TARGET_DEFS_ONLY - -#define CONFIG_TCC_ASM -#define NB_ASM_REGS 16 - -ST_FUNC void g(int c); -ST_FUNC void gen_le16(int c); -ST_FUNC void gen_le32(int c); - -/*************************************************************/ -#else -/*************************************************************/ - -#define USING_GLOBALS -#include "tcc.h" - -enum { - OPT_REG32, - OPT_REGSET32, - OPT_IM8, - OPT_IM8N, - OPT_IM32, - OPT_VREG32, - OPT_VREG64, -}; -#define OP_REG32 (1 << OPT_REG32) -#define OP_VREG32 (1 << OPT_VREG32) -#define OP_VREG64 (1 << OPT_VREG64) -#define OP_REG (OP_REG32 | OP_VREG32 | OP_VREG64) -#define OP_IM32 (1 << OPT_IM32) -#define OP_IM8 (1 << OPT_IM8) -#define OP_IM8N (1 << OPT_IM8N) -#define OP_REGSET32 (1 << OPT_REGSET32) - -typedef struct Operand { - uint32_t type; - union { - uint8_t reg; - uint16_t regset; - ExprValue e; - }; -} Operand; - -/* Read the VFP register referred to by token T. - If OK, returns its number. - If not OK, returns -1. */ -static int asm_parse_vfp_regvar(int t, int double_precision) -{ - if (double_precision) { - if (t >= TOK_ASM_d0 && t <= TOK_ASM_d15) - return t - TOK_ASM_d0; - } else { - if (t >= TOK_ASM_s0 && t <= TOK_ASM_s31) - return t - TOK_ASM_s0; - } - return -1; -} - -/* Parse a text containing operand and store the result in OP */ -static void parse_operand(TCCState *s1, Operand *op) -{ - ExprValue e; - int8_t reg; - uint16_t regset = 0; - - op->type = 0; - - if (tok == '{') { // regset literal - next(); // skip '{' - while (tok != '}' && tok != TOK_EOF) { - reg = asm_parse_regvar(tok); - if (reg == -1) { - expect("register"); - } else - next(); // skip register name - - if ((1 << reg) < regset) - tcc_warning("registers will be processed in ascending order by hardware--but are not specified in ascending order here"); - regset |= 1 << reg; - if (tok != ',') - break; - next(); // skip ',' - } - skip('}'); - if (regset == 0) { - // ARM instructions don't support empty regset. - tcc_error("empty register list is not supported"); - } else { - op->type = OP_REGSET32; - op->regset = regset; - } - return; - } else if ((reg = asm_parse_regvar(tok)) != -1) { - next(); // skip register name - op->type = OP_REG32; - op->reg = (uint8_t) reg; - return; - } else if ((reg = asm_parse_vfp_regvar(tok, 0)) != -1) { - next(); // skip register name - op->type = OP_VREG32; - op->reg = (uint8_t) reg; - return; - } else if ((reg = asm_parse_vfp_regvar(tok, 1)) != -1) { - next(); // skip register name - op->type = OP_VREG64; - op->reg = (uint8_t) reg; - return; - } else if (tok == '#' || tok == '$') { - /* constant value */ - next(); // skip '#' or '$' - } - asm_expr(s1, &e); - op->type = OP_IM32; - op->e = e; - if (!op->e.sym) { - if ((int) op->e.v < 0 && (int) op->e.v >= -255) - op->type = OP_IM8N; - else if (op->e.v == (uint8_t)op->e.v) - op->type = OP_IM8; - } else - expect("operand"); -} - -/* XXX: make it faster ? */ -ST_FUNC void g(int c) -{ - int ind1; - if (nocode_wanted) - return; - ind1 = ind + 1; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind] = c; - ind = ind1; -} - -ST_FUNC void gen_le16 (int i) -{ - g(i); - g(i>>8); -} - -ST_FUNC void gen_le32 (int i) -{ - int ind1; - if (nocode_wanted) - return; - ind1 = ind + 4; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind++] = i & 0xFF; - cur_text_section->data[ind++] = (i >> 8) & 0xFF; - cur_text_section->data[ind++] = (i >> 16) & 0xFF; - cur_text_section->data[ind++] = (i >> 24) & 0xFF; -} - -ST_FUNC void gen_expr32(ExprValue *pe) -{ - gen_le32(pe->v); -} - -static uint32_t condition_code_of_token(int token) { - if (token < TOK_ASM_nopeq) { - expect("condition-enabled instruction"); - } else - return (token - TOK_ASM_nopeq) & 15; -} - -static void asm_emit_opcode(int token, uint32_t opcode) { - gen_le32((condition_code_of_token(token) << 28) | opcode); -} - -static void asm_emit_unconditional_opcode(uint32_t opcode) { - gen_le32(opcode); -} - -static void asm_emit_coprocessor_opcode(uint32_t high_nibble, uint8_t cp_number, uint8_t cp_opcode, uint8_t cp_destination_register, uint8_t cp_n_operand_register, uint8_t cp_m_operand_register, uint8_t cp_opcode2, int inter_processor_transfer) -{ - uint32_t opcode = 0xe000000; - if (inter_processor_transfer) - opcode |= 1 << 4; - //assert(cp_opcode < 16); - opcode |= cp_opcode << 20; - //assert(cp_n_operand_register < 16); - opcode |= cp_n_operand_register << 16; - //assert(cp_destination_register < 16); - opcode |= cp_destination_register << 12; - //assert(cp_number < 16); - opcode |= cp_number << 8; - //assert(cp_information < 8); - opcode |= cp_opcode2 << 5; - //assert(cp_m_operand_register < 16); - opcode |= cp_m_operand_register; - asm_emit_unconditional_opcode((high_nibble << 28) | opcode); -} - -static void asm_nullary_opcode(int token) -{ - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_nopeq: - asm_emit_opcode(token, 0xd << 21); // mov r0, r0 - break; - case TOK_ASM_wfeeq: - asm_emit_opcode(token, 0x320f002); - case TOK_ASM_wfieq: - asm_emit_opcode(token, 0x320f003); - break; - default: - expect("nullary instruction"); - } -} - -static void asm_unary_opcode(TCCState *s1, int token) -{ - Operand op; - parse_operand(s1, &op); - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_swieq: - case TOK_ASM_svceq: - if (op.type != OP_IM8) - expect("immediate 8-bit unsigned integer"); - else { - /* Note: Dummy operand (ignored by processor): ARM ref documented 0...255, ARM instruction set documented 24 bit */ - asm_emit_opcode(token, (0xf << 24) | op.e.v); - } - break; - default: - expect("unary instruction"); - } -} - -static void asm_binary_opcode(TCCState *s1, int token) -{ - Operand ops[2]; - Operand rotation; - uint32_t encoded_rotation = 0; - uint64_t amount; - parse_operand(s1, &ops[0]); - skip(','); - parse_operand(s1, &ops[1]); - if (ops[0].type != OP_REG32) { - expect("(destination operand) register"); - } - - if (ops[0].reg == 15) { - tcc_error("'%s' does not support 'pc' as operand", get_tok_str(token, NULL)); - } - - if (ops[0].reg == 13) - tcc_warning("Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(token, NULL)); - - if (ops[1].type != OP_REG32) { - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_movteq: - case TOK_ASM_movweq: - if (ops[1].type == OP_IM8 || ops[1].type == OP_IM8N || ops[1].type == OP_IM32) { - if (ops[1].e.v >= 0 && ops[1].e.v <= 0xFFFF) { - uint16_t immediate_value = ops[1].e.v; - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_movteq: - asm_emit_opcode(token, 0x3400000 | (ops[0].reg << 12) | (immediate_value & 0xF000) << 4 | (immediate_value & 0xFFF)); - break; - case TOK_ASM_movweq: - asm_emit_opcode(token, 0x3000000 | (ops[0].reg << 12) | (immediate_value & 0xF000) << 4 | (immediate_value & 0xFFF)); - break; - } - } else - expect("(source operand) immediate 16 bit value"); - } else - expect("(source operand) immediate"); - break; - default: - expect("(source operand) register"); - } - return; - } - - if (ops[1].reg == 15) { - tcc_error("'%s' does not support 'pc' as operand", get_tok_str(token, NULL)); - } - - if (ops[1].reg == 13) - tcc_warning("Using 'sp' as operand with '%s' is deprecated by ARM", get_tok_str(token, NULL)); - - if (tok == ',') { - next(); // skip ',' - if (tok == TOK_ASM_ror) { - next(); // skip 'ror' - parse_operand(s1, &rotation); - if (rotation.type != OP_IM8) { - expect("immediate value for rotation"); - } else { - amount = rotation.e.v; - switch (amount) { - case 8: - encoded_rotation = 1 << 10; - break; - case 16: - encoded_rotation = 2 << 10; - break; - case 24: - encoded_rotation = 3 << 10; - break; - default: - expect("'8' or '16' or '24'"); - } - } - } - } - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_clzeq: - if (encoded_rotation) - tcc_error("clz does not support rotation"); - asm_emit_opcode(token, 0x16f0f10 | (ops[0].reg << 12) | ops[1].reg); - break; - case TOK_ASM_sxtbeq: - asm_emit_opcode(token, 0x6af0070 | (ops[0].reg << 12) | ops[1].reg | encoded_rotation); - break; - case TOK_ASM_sxtheq: - asm_emit_opcode(token, 0x6bf0070 | (ops[0].reg << 12) | ops[1].reg | encoded_rotation); - break; - case TOK_ASM_uxtbeq: - asm_emit_opcode(token, 0x6ef0070 | (ops[0].reg << 12) | ops[1].reg | encoded_rotation); - break; - case TOK_ASM_uxtheq: - asm_emit_opcode(token, 0x6ff0070 | (ops[0].reg << 12) | ops[1].reg | encoded_rotation); - break; - default: - expect("binary instruction"); - } -} - -static void asm_coprocessor_opcode(TCCState *s1, int token) { - uint8_t coprocessor; - Operand opcode1; - Operand opcode2; - uint8_t registers[3]; - unsigned int i; - uint8_t high_nibble; - uint8_t mrc = 0; - - if (tok >= TOK_ASM_p0 && tok <= TOK_ASM_p15) { - coprocessor = tok - TOK_ASM_p0; - next(); - } else { - expect("'p'"); - } - skip(','); - parse_operand(s1, &opcode1); - if (opcode1.type != OP_IM8 || opcode1.e.v > 15) { - tcc_error("opcode1 of instruction '%s' must be an immediate value between 0 and 15", get_tok_str(token, NULL)); - } - - for (i = 0; i < 3; ++i) { - skip(','); - if (i == 0 && token != TOK_ASM_cdp2 && (ARM_INSTRUCTION_GROUP(token) == TOK_ASM_mrceq || ARM_INSTRUCTION_GROUP(token) == TOK_ASM_mcreq)) { - if (tok >= TOK_ASM_r0 && tok <= TOK_ASM_r15) { - registers[i] = tok - TOK_ASM_r0; - next(); - } else { - expect("'r'"); - } - } else { - if (tok >= TOK_ASM_c0 && tok <= TOK_ASM_c15) { - registers[i] = tok - TOK_ASM_c0; - next(); - } else { - expect("'c'"); - } - } - } - if (tok == ',') { - next(); - parse_operand(s1, &opcode2); - } else { - opcode2.type = OP_IM8; - opcode2.e.v = 0; - } - if (opcode2.type != OP_IM8 || opcode2.e.v > 15) { - tcc_error("opcode2 of instruction '%s' must be an immediate value between 0 and 15", get_tok_str(token, NULL)); - } - - if (token == TOK_ASM_cdp2) { - high_nibble = 0xF; - asm_emit_coprocessor_opcode(high_nibble, coprocessor, opcode1.e.v, registers[0], registers[1], registers[2], opcode2.e.v, 0); - return; - } else - high_nibble = condition_code_of_token(token); - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_cdpeq: - asm_emit_coprocessor_opcode(high_nibble, coprocessor, opcode1.e.v, registers[0], registers[1], registers[2], opcode2.e.v, 0); - break; - case TOK_ASM_mrceq: - // opcode1 encoding changes! highest and lowest bit gone. - mrc = 1; - /* fallthrough */ - case TOK_ASM_mcreq: - // opcode1 encoding changes! highest and lowest bit gone. - if (opcode1.e.v > 7) { - tcc_error("opcode1 of instruction '%s' must be an immediate value between 0 and 7", get_tok_str(token, NULL)); - } - asm_emit_coprocessor_opcode(high_nibble, coprocessor, (opcode1.e.v << 1) | mrc, registers[0], registers[1], registers[2], opcode2.e.v, 1); - break; - default: - expect("known instruction"); - } -} - -/* data processing and single data transfer instructions only */ -#define ENCODE_RN(register_index) ((register_index) << 16) -#define ENCODE_RD(register_index) ((register_index) << 12) -#define ENCODE_SET_CONDITION_CODES (1 << 20) - -/* Note: For data processing instructions, "1" means immediate. - Note: For single data transfer instructions, "0" means immediate. */ -#define ENCODE_IMMEDIATE_FLAG (1 << 25) - -#define ENCODE_BARREL_SHIFTER_SHIFT_BY_REGISTER (1 << 4) -#define ENCODE_BARREL_SHIFTER_MODE_LSL (0 << 5) -#define ENCODE_BARREL_SHIFTER_MODE_LSR (1 << 5) -#define ENCODE_BARREL_SHIFTER_MODE_ASR (2 << 5) -#define ENCODE_BARREL_SHIFTER_MODE_ROR (3 << 5) -#define ENCODE_BARREL_SHIFTER_REGISTER(register_index) ((register_index) << 8) -#define ENCODE_BARREL_SHIFTER_IMMEDIATE(value) ((value) << 7) - -static void asm_block_data_transfer_opcode(TCCState *s1, int token) -{ - uint32_t opcode; - int op0_exclam = 0; - Operand ops[2]; - int nb_ops = 1; - parse_operand(s1, &ops[0]); - if (tok == '!') { - op0_exclam = 1; - next(); // skip '!' - } - if (tok == ',') { - next(); // skip comma - parse_operand(s1, &ops[1]); - ++nb_ops; - } - if (nb_ops < 1) { - expect("at least one operand"); - } else if (ops[nb_ops - 1].type != OP_REGSET32) { - expect("(last operand) register list"); - } - - // block data transfer: 1 0 0 P U S W L << 20 (general case): - // operands: - // Rn: bits 19...16 base register - // Register List: bits 15...0 - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_pusheq: // TODO: Optimize 1-register case to: str ?, [sp, #-4]! - // Instruction: 1 I=0 P=1 U=0 S=0 W=1 L=0 << 20, op 1101 - // operands: - // Rn: base register - // Register List: bits 15...0 - if (nb_ops != 1) - expect("exactly one operand"); - else - asm_emit_opcode(token, (0x92d << 16) | ops[0].regset); // TODO: base register ? - break; - case TOK_ASM_popeq: // TODO: Optimize 1-register case to: ldr ?, [sp], #4 - // Instruction: 1 I=0 P=0 U=1 S=0 W=0 L=1 << 20, op 1101 - // operands: - // Rn: base register - // Register List: bits 15...0 - if (nb_ops != 1) - expect("exactly one operand"); - else - asm_emit_opcode(token, (0x8bd << 16) | ops[0].regset); // TODO: base register ? - break; - case TOK_ASM_stmdaeq: - case TOK_ASM_ldmdaeq: - case TOK_ASM_stmeq: - case TOK_ASM_ldmeq: - case TOK_ASM_stmiaeq: - case TOK_ASM_ldmiaeq: - case TOK_ASM_stmdbeq: - case TOK_ASM_ldmdbeq: - case TOK_ASM_stmibeq: - case TOK_ASM_ldmibeq: - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_stmdaeq: // post-decrement store - opcode = 0x80 << 20; - break; - case TOK_ASM_ldmdaeq: // post-decrement load - opcode = 0x81 << 20; - break; - case TOK_ASM_stmeq: // post-increment store - case TOK_ASM_stmiaeq: // post-increment store - opcode = 0x88 << 20; - break; - case TOK_ASM_ldmeq: // post-increment load - case TOK_ASM_ldmiaeq: // post-increment load - opcode = 0x89 << 20; - break; - case TOK_ASM_stmdbeq: // pre-decrement store - opcode = 0x90 << 20; - break; - case TOK_ASM_ldmdbeq: // pre-decrement load - opcode = 0x91 << 20; - break; - case TOK_ASM_stmibeq: // pre-increment store - opcode = 0x98 << 20; - break; - case TOK_ASM_ldmibeq: // pre-increment load - opcode = 0x99 << 20; - break; - default: - tcc_error("internal error: This place should not be reached (fallback in asm_block_data_transfer_opcode)"); - } - // operands: - // Rn: first operand - // Register List: lower bits - if (nb_ops != 2) - expect("exactly two operands"); - else if (ops[0].type != OP_REG32) - expect("(first operand) register"); - else { - if (op0_exclam) - opcode |= 1 << 21; // writeback - asm_emit_opcode(token, opcode | ENCODE_RN(ops[0].reg) | ops[1].regset); - } - break; - default: - expect("block data transfer instruction"); - } -} - -/* Parses shift directive and returns the parts that would have to be set in the opcode because of it. - Does not encode the actual shift amount. - It's not an error if there is no shift directive. - - NB_SHIFT: will be set to 1 iff SHIFT is filled. Note that for rrx, there's no need to fill SHIFT. - SHIFT: will be filled in with the shift operand to use, if any. */ -static uint32_t asm_parse_optional_shift(TCCState* s1, int* nb_shift, Operand* shift) -{ - uint32_t opcode = 0; - *nb_shift = 0; - switch (tok) { - case TOK_ASM_asl: - case TOK_ASM_lsl: - case TOK_ASM_asr: - case TOK_ASM_lsr: - case TOK_ASM_ror: - switch (tok) { - case TOK_ASM_asl: - /* fallthrough */ - case TOK_ASM_lsl: - opcode = ENCODE_BARREL_SHIFTER_MODE_LSL; - break; - case TOK_ASM_asr: - opcode = ENCODE_BARREL_SHIFTER_MODE_ASR; - break; - case TOK_ASM_lsr: - opcode = ENCODE_BARREL_SHIFTER_MODE_LSR; - break; - case TOK_ASM_ror: - opcode = ENCODE_BARREL_SHIFTER_MODE_ROR; - break; - } - next(); - parse_operand(s1, shift); - *nb_shift = 1; - break; - case TOK_ASM_rrx: - next(); - opcode = ENCODE_BARREL_SHIFTER_MODE_ROR; - break; - } - return opcode; -} - -static uint32_t asm_encode_shift(Operand* shift) -{ - uint64_t amount; - uint32_t operands = 0; - switch (shift->type) { - case OP_REG32: - if (shift->reg == 15) - tcc_error("r15 cannot be used as a shift count"); - else { - operands = ENCODE_BARREL_SHIFTER_SHIFT_BY_REGISTER; - operands |= ENCODE_BARREL_SHIFTER_REGISTER(shift->reg); - } - break; - case OP_IM8: - amount = shift->e.v; - if (amount > 0 && amount < 32) - operands = ENCODE_BARREL_SHIFTER_IMMEDIATE(amount); - else - tcc_error("shift count out of range"); - break; - default: - tcc_error("unknown shift amount"); - } - return operands; -} - -static void asm_data_processing_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - int nb_ops; - Operand shift = {0}; - int nb_shift = 0; - uint32_t operands = 0; - - /* modulo 16 entries per instruction for the different condition codes */ - uint32_t opcode_idx = (ARM_INSTRUCTION_GROUP(token) - TOK_ASM_andeq) >> 4; - uint32_t opcode_nos = opcode_idx >> 1; // without "s"; "OpCode" in ARM docs - - for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ) { - if (tok == TOK_ASM_asl || tok == TOK_ASM_lsl || tok == TOK_ASM_lsr || tok == TOK_ASM_asr || tok == TOK_ASM_ror || tok == TOK_ASM_rrx) - break; - parse_operand(s1, &ops[nb_ops]); - ++nb_ops; - if (tok != ',') - break; - next(); // skip ',' - } - if (tok == ',') - next(); - operands |= asm_parse_optional_shift(s1, &nb_shift, &shift); - if (nb_ops < 2) - expect("at least two operands"); - else if (nb_ops == 2) { - memcpy(&ops[2], &ops[1], sizeof(ops[1])); // move ops[2] - memcpy(&ops[1], &ops[0], sizeof(ops[0])); // ops[1] was implicit - nb_ops = 3; - } else if (nb_ops == 3) { - if (opcode_nos == 0xd || opcode_nos == 0xf || opcode_nos == 0xa || opcode_nos == 0xb || opcode_nos == 0x8 || opcode_nos == 0x9) { // mov, mvn, cmp, cmn, tst, teq - tcc_error("'%s' cannot be used with three operands", get_tok_str(token, NULL)); - } - } - if (nb_ops != 3) { - expect("two or three operands"); - } else { - uint32_t opcode = 0; - uint32_t immediate_value; - uint8_t half_immediate_rotation; - if (nb_shift && shift.type == OP_REG32) { - if ((ops[0].type == OP_REG32 && ops[0].reg == 15) || - (ops[1].type == OP_REG32 && ops[1].reg == 15)) { - tcc_error("Using the 'pc' register in data processing instructions that have a register-controlled shift is not implemented by ARM"); - } - } - - // data processing (general case): - // operands: - // Rn: bits 19...16 (first operand) - // Rd: bits 15...12 (destination) - // Operand2: bits 11...0 (second operand); depending on I that's either a register or an immediate - // operator: - // bits 24...21: "OpCode"--see below - - /* operations in the token list are ordered by opcode */ - opcode = opcode_nos << 21; // drop "s" - if (ops[0].type != OP_REG32) - expect("(destination operand) register"); - else if (opcode_nos == 0xa || opcode_nos == 0xb || opcode_nos == 0x8 || opcode_nos == 0x9) // cmp, cmn, tst, teq - operands |= ENCODE_SET_CONDITION_CODES; // force S set, otherwise it's a completely different instruction. - else - operands |= ENCODE_RD(ops[0].reg); - if (ops[1].type != OP_REG32) - expect("(first source operand) register"); - else if (!(opcode_nos == 0xd || opcode_nos == 0xf)) // not: mov, mvn (those have only one source operand) - operands |= ENCODE_RN(ops[1].reg); - switch (ops[2].type) { - case OP_REG32: - operands |= ops[2].reg; - break; - case OP_IM8: - case OP_IM32: - operands |= ENCODE_IMMEDIATE_FLAG; - immediate_value = ops[2].e.v; - for (half_immediate_rotation = 0; half_immediate_rotation < 16; ++half_immediate_rotation) { - if (immediate_value >= 0x00 && immediate_value < 0x100) - break; - // rotate left by two - immediate_value = ((immediate_value & 0x3FFFFFFF) << 2) | ((immediate_value & 0xC0000000) >> 30); - } - if (half_immediate_rotation >= 16) { - /* fallthrough */ - } else { - operands |= immediate_value; - operands |= half_immediate_rotation << 8; - break; - } - case OP_IM8N: // immediate negative value - operands |= ENCODE_IMMEDIATE_FLAG; - immediate_value = ops[2].e.v; - /* Instruction swapping: - 0001 = EOR - Rd:= Op1 EOR Op2 -> difficult - 0011 = RSB - Rd:= Op2 - Op1 -> difficult - 0111 = RSC - Rd:= Op2 - Op1 + C -> difficult - 1000 = TST - CC on: Op1 AND Op2 -> difficult - 1001 = TEQ - CC on: Op1 EOR Op2 -> difficult - 1100 = ORR - Rd:= Op1 OR Op2 -> difficult - */ - switch (opcode_nos) { - case 0x0: // AND - Rd:= Op1 AND Op2 - opcode = 0xe << 21; // BIC - immediate_value = ~immediate_value; - break; - case 0x2: // SUB - Rd:= Op1 - Op2 - opcode = 0x4 << 21; // ADD - immediate_value = -immediate_value; - break; - case 0x4: // ADD - Rd:= Op1 + Op2 - opcode = 0x2 << 21; // SUB - immediate_value = -immediate_value; - break; - case 0x5: // ADC - Rd:= Op1 + Op2 + C - opcode = 0x6 << 21; // SBC - immediate_value = ~immediate_value; - break; - case 0x6: // SBC - Rd:= Op1 - Op2 + C - opcode = 0x5 << 21; // ADC - immediate_value = ~immediate_value; - break; - case 0xa: // CMP - CC on: Op1 - Op2 - opcode = 0xb << 21; // CMN - immediate_value = -immediate_value; - break; - case 0xb: // CMN - CC on: Op1 + Op2 - opcode = 0xa << 21; // CMP - immediate_value = -immediate_value; - break; - case 0xd: // MOV - Rd:= Op2 - opcode = 0xf << 21; // MVN - immediate_value = ~immediate_value; - break; - case 0xe: // BIC - Rd:= Op1 AND NOT Op2 - opcode = 0x0 << 21; // AND - immediate_value = ~immediate_value; - break; - case 0xf: // MVN - Rd:= NOT Op2 - opcode = 0xd << 21; // MOV - immediate_value = ~immediate_value; - break; - default: - tcc_error("cannot use '%s' with a negative immediate value", get_tok_str(token, NULL)); - } - for (half_immediate_rotation = 0; half_immediate_rotation < 16; ++half_immediate_rotation) { - if (immediate_value >= 0x00 && immediate_value < 0x100) - break; - // rotate left by two - immediate_value = ((immediate_value & 0x3FFFFFFF) << 2) | ((immediate_value & 0xC0000000) >> 30); - } - if (half_immediate_rotation >= 16) { - immediate_value = ops[2].e.v; - tcc_error("immediate value 0x%X cannot be encoded into ARM immediate", (unsigned) immediate_value); - } - operands |= immediate_value; - operands |= half_immediate_rotation << 8; - break; - default: - expect("(second source operand) register or immediate value"); - } - - if (nb_shift) { - if (operands & ENCODE_IMMEDIATE_FLAG) - tcc_error("immediate rotation not implemented"); - else - operands |= asm_encode_shift(&shift); - } - - /* S=0 and S=1 entries alternate one after another, in that order */ - opcode |= (opcode_idx & 1) ? ENCODE_SET_CONDITION_CODES : 0; - asm_emit_opcode(token, opcode | operands); - } -} - -static void asm_shift_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - int nb_ops; - int definitely_neutral = 0; - uint32_t opcode = 0xd << 21; // MOV - uint32_t operands = 0; - - for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ++nb_ops) { - parse_operand(s1, &ops[nb_ops]); - if (tok != ',') { - ++nb_ops; - break; - } - next(); // skip ',' - } - if (nb_ops < 2) { - expect("at least two operands"); - } - - if (ops[0].type != OP_REG32) { - expect("(destination operand) register"); - } else - operands |= ENCODE_RD(ops[0].reg); - - if (nb_ops == 2) { - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_rrxseq: - opcode |= ENCODE_SET_CONDITION_CODES; - /* fallthrough */ - case TOK_ASM_rrxeq: - if (ops[1].type == OP_REG32) { - operands |= ops[1].reg; - operands |= ENCODE_BARREL_SHIFTER_MODE_ROR; - asm_emit_opcode(token, opcode | operands); - } else - tcc_error("(first source operand) register"); - return; - default: - memcpy(&ops[2], &ops[1], sizeof(ops[1])); // move ops[2] - memcpy(&ops[1], &ops[0], sizeof(ops[0])); // ops[1] was implicit - nb_ops = 3; - } - } - if (nb_ops != 3) { - expect("two or three operands"); - } - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_lslseq: - case TOK_ASM_lsrseq: - case TOK_ASM_asrseq: - case TOK_ASM_rorseq: - opcode |= ENCODE_SET_CONDITION_CODES; - break; - } - - switch (ops[1].type) { - case OP_REG32: - operands |= ops[1].reg; - break; - case OP_IM8: - operands |= ENCODE_IMMEDIATE_FLAG; - operands |= ops[1].e.v; - tcc_error("Using an immediate value as the source operand is not possible with '%s' instruction on ARM", get_tok_str(token, NULL)); - } - - switch (ops[2].type) { - case OP_REG32: - if ((ops[0].type == OP_REG32 && ops[0].reg == 15) || - (ops[1].type == OP_REG32 && ops[1].reg == 15)) { - tcc_error("Using the 'pc' register in data processing instructions that have a register-controlled shift is not implemented by ARM"); - } - operands |= asm_encode_shift(&ops[2]); - break; - case OP_IM8: - if (ops[2].e.v) - operands |= asm_encode_shift(&ops[2]); - else - definitely_neutral = 1; - break; - } - - if (!definitely_neutral) switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_lslseq: - case TOK_ASM_lsleq: - operands |= ENCODE_BARREL_SHIFTER_MODE_LSL; - break; - case TOK_ASM_lsrseq: - case TOK_ASM_lsreq: - operands |= ENCODE_BARREL_SHIFTER_MODE_LSR; - break; - case TOK_ASM_asrseq: - case TOK_ASM_asreq: - operands |= ENCODE_BARREL_SHIFTER_MODE_ASR; - break; - case TOK_ASM_rorseq: - case TOK_ASM_roreq: - operands |= ENCODE_BARREL_SHIFTER_MODE_ROR; - break; - default: - expect("shift instruction"); - } - asm_emit_opcode(token, opcode | operands); -} - -static void asm_multiplication_opcode(TCCState *s1, int token) -{ - Operand ops[4]; - int nb_ops = 0; - uint32_t opcode = 0x90; - - for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ++nb_ops) { - parse_operand(s1, &ops[nb_ops]); - if (tok != ',') { - ++nb_ops; - break; - } - next(); // skip ',' - } - if (nb_ops < 2) - expect("at least two operands"); - else if (nb_ops == 2) { - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_mulseq: - case TOK_ASM_muleq: - memcpy(&ops[2], &ops[0], sizeof(ops[1])); // ARM is actually like this! - break; - default: - expect("at least three operands"); - } - nb_ops = 3; - } - - // multiply (special case): - // operands: - // Rd: bits 19...16 - // Rm: bits 3...0 - // Rs: bits 11...8 - // Rn: bits 15...12 - - if (ops[0].type == OP_REG32) - opcode |= ops[0].reg << 16; - else - expect("(destination operand) register"); - if (ops[1].type == OP_REG32) - opcode |= ops[1].reg; - else - expect("(first source operand) register"); - if (ops[2].type == OP_REG32) - opcode |= ops[2].reg << 8; - else - expect("(second source operand) register"); - if (nb_ops > 3) { - if (ops[3].type == OP_REG32) - opcode |= ops[3].reg << 12; - else - expect("(third source operand) register"); - } - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_mulseq: - opcode |= 1 << 20; // Status - /* fallthrough */ - case TOK_ASM_muleq: - if (nb_ops != 3) - expect("three operands"); - else { - asm_emit_opcode(token, opcode); - } - break; - case TOK_ASM_mlaseq: - opcode |= 1 << 20; // Status - /* fallthrough */ - case TOK_ASM_mlaeq: - if (nb_ops != 4) - expect("four operands"); - else { - opcode |= 1 << 21; // Accumulate - asm_emit_opcode(token, opcode); - } - break; - default: - expect("known multiplication instruction"); - } -} - -static void asm_long_multiplication_opcode(TCCState *s1, int token) -{ - Operand ops[4]; - int nb_ops = 0; - uint32_t opcode = 0x90 | (1 << 23); - - for (nb_ops = 0; nb_ops < sizeof(ops)/sizeof(ops[0]); ++nb_ops) { - parse_operand(s1, &ops[nb_ops]); - if (tok != ',') { - ++nb_ops; - break; - } - next(); // skip ',' - } - if (nb_ops != 4) { - expect("four operands"); - } - - // long multiply (special case): - // operands: - // RdLo: bits 15...12 - // RdHi: bits 19...16 - // Rs: bits 11...8 - // Rm: bits 3...0 - - if (ops[0].type == OP_REG32) - opcode |= ops[0].reg << 12; - else - expect("(destination lo accumulator) register"); - if (ops[1].type == OP_REG32) - opcode |= ops[1].reg << 16; - else - expect("(destination hi accumulator) register"); - if (ops[2].type == OP_REG32) - opcode |= ops[2].reg; - else - expect("(first source operand) register"); - if (ops[3].type == OP_REG32) - opcode |= ops[3].reg << 8; - else - expect("(second source operand) register"); - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_smullseq: - opcode |= 1 << 20; // Status - /* fallthrough */ - case TOK_ASM_smulleq: - opcode |= 1 << 22; // signed - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_umullseq: - opcode |= 1 << 20; // Status - /* fallthrough */ - case TOK_ASM_umulleq: - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_smlalseq: - opcode |= 1 << 20; // Status - /* fallthrough */ - case TOK_ASM_smlaleq: - opcode |= 1 << 22; // signed - opcode |= 1 << 21; // Accumulate - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_umlalseq: - opcode |= 1 << 20; // Status - /* fallthrough */ - case TOK_ASM_umlaleq: - opcode |= 1 << 21; // Accumulate - asm_emit_opcode(token, opcode); - break; - default: - expect("known long multiplication instruction"); - } -} - -static void asm_single_data_transfer_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - Operand strex_operand; - Operand shift; - int nb_shift = 0; - int exclam = 0; - int closed_bracket = 0; - int op2_minus = 0; - uint32_t opcode = 0; - // Note: ldr r0, [r4, #4] ; simple offset: r0 = *(int*)(r4+4); r4 unchanged - // Note: ldr r0, [r4, #4]! ; pre-indexed: r0 = *(int*)(r4+4); r4 = r4+4 - // Note: ldr r0, [r4], #4 ; post-indexed: r0 = *(int*)(r4+0); r4 = r4+4 - - parse_operand(s1, &ops[0]); - if (ops[0].type == OP_REG32) - opcode |= ENCODE_RD(ops[0].reg); - else { - expect("(destination operand) register"); - } - if (tok != ',') - expect("at least two arguments"); - next(); // skip ',' - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_strexbeq: - case TOK_ASM_strexeq: - parse_operand(s1, &strex_operand); - if (strex_operand.type != OP_REG32) { - expect("register"); - } - if (tok != ',') - expect("at least three arguments"); - else - next(); // skip ',' - break; - } - - skip('['); - parse_operand(s1, &ops[1]); - if (ops[1].type == OP_REG32) - opcode |= ENCODE_RN(ops[1].reg); - else { - expect("(first source operand) register"); - } - if (tok == ']') { - next(); - closed_bracket = 1; - // exclam = 1; // implicit in hardware; don't do it in software - } - if (tok == ',') { - next(); // skip ',' - if (tok == '-') { - op2_minus = 1; - next(); - } - parse_operand(s1, &ops[2]); - if (ops[2].type == OP_REG32) { - if (ops[2].reg == 15) { - tcc_error("Using 'pc' for register offset in '%s' is not implemented by ARM", get_tok_str(token, NULL)); - } - if (tok == ',') { - next(); - opcode |= asm_parse_optional_shift(s1, &nb_shift, &shift); - if (opcode == 0) - expect("shift directive, or no comma"); - } - } - } else { - // end of input expression in brackets--assume 0 offset - ops[2].type = OP_IM8; - ops[2].e.v = 0; - opcode |= 1 << 24; // add offset before transfer - } - if (!closed_bracket) { - skip(']'); - opcode |= 1 << 24; // add offset before transfer - if (tok == '!') { - exclam = 1; - next(); // skip '!' - } - } - - // single data transfer: 0 1 I P U B W L << 20 (general case): - // operands: - // Rd: destination operand [ok] - // Rn: first source operand [ok] - // Operand2: bits 11...0 [ok] - // I: immediate operand? [ok] - // P: Pre/post indexing is PRE: Add offset before transfer [ok] - // U: Up/down is up? (*adds* offset to base) [ok] - // B: Byte/word is byte? [ok] - // W: Write address back into base? [ok] - // L: Load/store is load? [ok] - if (exclam) - opcode |= 1 << 21; // write offset back into register - - if (ops[2].type == OP_IM32 || ops[2].type == OP_IM8 || ops[2].type == OP_IM8N) { - int v = ops[2].e.v; - if (op2_minus) - tcc_error("minus before '#' not supported for immediate values"); - if (v >= 0) { - opcode |= 1 << 23; // up - if (v >= 0x1000) - tcc_error("offset out of range for '%s'", get_tok_str(token, NULL)); - else - opcode |= v; - } else { // down - if (v <= -0x1000) - tcc_error("offset out of range for '%s'", get_tok_str(token, NULL)); - else - opcode |= -v; - } - } else if (ops[2].type == OP_REG32) { - if (!op2_minus) - opcode |= 1 << 23; // up - opcode |= ENCODE_IMMEDIATE_FLAG; /* if set, it means it's NOT immediate */ - opcode |= ops[2].reg; - } else - expect("register"); - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_strbeq: - opcode |= 1 << 22; // B - /* fallthrough */ - case TOK_ASM_streq: - opcode |= 1 << 26; // Load/Store - if (nb_shift) - opcode |= asm_encode_shift(&shift); - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_ldrbeq: - opcode |= 1 << 22; // B - /* fallthrough */ - case TOK_ASM_ldreq: - opcode |= 1 << 20; // L - opcode |= 1 << 26; // Load/Store - if (nb_shift) - opcode |= asm_encode_shift(&shift); - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_strexbeq: - opcode |= 1 << 22; // B - /* fallthrough */ - case TOK_ASM_strexeq: - if ((opcode & 0xFFF) || nb_shift) { - tcc_error("neither offset nor shift allowed with 'strex'"); - } else if (opcode & ENCODE_IMMEDIATE_FLAG) { // if set, it means it's NOT immediate - tcc_error("offset not allowed with 'strex'"); - } - if ((opcode & (1 << 24)) == 0) { // add offset after transfer - tcc_error("adding offset after transfer not allowed with 'strex'"); - } - - opcode |= 0xf90; // Used to mean: barrel shifter is enabled, barrel shift register is r15, mode is LSL - opcode |= strex_operand.reg; - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_ldrexbeq: - opcode |= 1 << 22; // B - /* fallthrough */ - case TOK_ASM_ldrexeq: - if ((opcode & 0xFFF) || nb_shift) { - tcc_error("neither offset nor shift allowed with 'ldrex'"); - } else if (opcode & ENCODE_IMMEDIATE_FLAG) { // if set, it means it's NOT immediate - tcc_error("offset not allowed with 'ldrex'"); - } - if ((opcode & (1 << 24)) == 0) { // add offset after transfer - tcc_error("adding offset after transfer not allowed with 'ldrex'"); - } - opcode |= 1 << 20; // L - opcode |= 0x00f; - opcode |= 0xf90; // Used to mean: barrel shifter is enabled, barrel shift register is r15, mode is LSL - asm_emit_opcode(token, opcode); - break; - default: - expect("data transfer instruction"); - } -} - -// Note: Only call this using a VFP register if you know exactly what you are doing (i.e. cp_number is 10 or 11 and you are doing a vmov) -static void asm_emit_coprocessor_data_transfer(uint32_t high_nibble, uint8_t cp_number, uint8_t CRd, const Operand* Rn, const Operand* offset, int offset_minus, int preincrement, int writeback, int long_transfer, int load) { - uint32_t opcode = 0x0; - opcode |= 1 << 26; // Load/Store - opcode |= 1 << 27; // coprocessor - - if (long_transfer) - opcode |= 1 << 22; // long transfer - - if (load) - opcode |= 1 << 20; // L - - opcode |= cp_number << 8; - - //assert(CRd < 16); - opcode |= ENCODE_RD(CRd); - - if (Rn->type != OP_REG32) - expect("register"); - - //assert(Rn->reg < 16); - opcode |= ENCODE_RN(Rn->reg); - if (preincrement) - opcode |= 1 << 24; // add offset before transfer - - if (writeback) - opcode |= 1 << 21; // write offset back into register - - if (offset->type == OP_IM8 || offset->type == OP_IM8N || offset->type == OP_IM32) { - int v = offset->e.v; - if (offset_minus) - tcc_error("minus before '#' not supported for immediate values"); - if (offset->type == OP_IM8N || v < 0) - v = -v; - else - opcode |= 1 << 23; // up - if (v & 3) { - tcc_error("immediate offset must be a multiple of 4"); - } - v >>= 2; - if (v > 255) { - tcc_error("immediate offset must be between -1020 and 1020"); - } - opcode |= v; - } else if (offset->type == OP_REG32) { - if (!offset_minus) - opcode |= 1 << 23; // up - opcode |= ENCODE_IMMEDIATE_FLAG; /* if set, it means it's NOT immediate */ - opcode |= offset->reg; - tcc_error("Using register offset to register address is not possible here"); - } else if (offset->type == OP_VREG64) { - opcode |= 16; - opcode |= offset->reg; - } else - expect("immediate or register"); - - asm_emit_unconditional_opcode((high_nibble << 28) | opcode); -} - -// Almost exactly the same as asm_single_data_transfer_opcode. -// Difference: Offsets are smaller and multiples of 4; no shifts, no STREX, ENCODE_IMMEDIATE_FLAG is inverted again. -static void asm_coprocessor_data_transfer_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - uint8_t coprocessor; - uint8_t coprocessor_destination_register; - int preincrement = 0; - int exclam = 0; - int closed_bracket = 0; - int op2_minus = 0; - int long_transfer = 0; - // Note: ldc p1, c0, [r4, #4] ; simple offset: r0 = *(int*)(r4+4); r4 unchanged - // Note: ldc p2, c0, [r4, #4]! ; pre-indexed: r0 = *(int*)(r4+4); r4 = r4+4 - // Note: ldc p3, c0, [r4], #4 ; post-indexed: r0 = *(int*)(r4+0); r4 = r4+4 - - if (tok >= TOK_ASM_p0 && tok <= TOK_ASM_p15) { - coprocessor = tok - TOK_ASM_p0; - next(); - } else { - expect("'c'"); - } - - skip(','); - - if (tok >= TOK_ASM_c0 && tok <= TOK_ASM_c15) { - coprocessor_destination_register = tok - TOK_ASM_c0; - next(); - } else { - expect("'c'"); - } - - skip(','); - skip('['); - parse_operand(s1, &ops[1]); - if (ops[1].type != OP_REG32) { - expect("(first source operand) register"); - } - if (tok == ']') { - next(); - closed_bracket = 1; - // exclam = 1; // implicit in hardware; don't do it in software - } - if (tok == ',') { - next(); // skip ',' - if (tok == '-') { - op2_minus = 1; - next(); - } - parse_operand(s1, &ops[2]); - if (ops[2].type == OP_REG32) { - if (ops[2].reg == 15) { - tcc_error("Using 'pc' for register offset in '%s' is not implemented by ARM", get_tok_str(token, NULL)); - } - } else if (ops[2].type == OP_VREG64) { - tcc_error("'%s' does not support VFP register operand", get_tok_str(token, NULL)); - } - } else { - // end of input expression in brackets--assume 0 offset - ops[2].type = OP_IM8; - ops[2].e.v = 0; - preincrement = 1; // add offset before transfer - } - if (!closed_bracket) { - skip(']'); - preincrement = 1; // add offset before transfer - if (tok == '!') { - exclam = 1; - next(); // skip '!' - } - } - - // TODO: Support options. - - if (token == TOK_ASM_ldc2 || token == TOK_ASM_stc2 || token == TOK_ASM_ldc2l || token == TOK_ASM_stc2l) { - switch (token) { - case TOK_ASM_ldc2l: - long_transfer = 1; // long transfer - /* fallthrough */ - case TOK_ASM_ldc2: - asm_emit_coprocessor_data_transfer(0xF, coprocessor, coprocessor_destination_register, &ops[1], &ops[2], op2_minus, preincrement, exclam, long_transfer, 1); - break; - case TOK_ASM_stc2l: - long_transfer = 1; // long transfer - /* fallthrough */ - case TOK_ASM_stc2: - asm_emit_coprocessor_data_transfer(0xF, coprocessor, coprocessor_destination_register, &ops[1], &ops[2], op2_minus, preincrement, exclam, long_transfer, 0); - break; - } - } else switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_stcleq: - long_transfer = 1; - /* fallthrough */ - case TOK_ASM_stceq: - asm_emit_coprocessor_data_transfer(condition_code_of_token(token), coprocessor, coprocessor_destination_register, &ops[1], &ops[2], op2_minus, preincrement, exclam, long_transfer, 0); - break; - case TOK_ASM_ldcleq: - long_transfer = 1; - /* fallthrough */ - case TOK_ASM_ldceq: - asm_emit_coprocessor_data_transfer(condition_code_of_token(token), coprocessor, coprocessor_destination_register, &ops[1], &ops[2], op2_minus, preincrement, exclam, long_transfer, 1); - break; - default: - expect("coprocessor data transfer instruction"); - } -} - -#if defined(TCC_ARM_VFP) -#define CP_SINGLE_PRECISION_FLOAT 10 -#define CP_DOUBLE_PRECISION_FLOAT 11 - -static void asm_floating_point_single_data_transfer_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - uint8_t coprocessor = 0; - uint8_t coprocessor_destination_register = 0; - int long_transfer = 0; - // Note: vldr p1, c0, [r4, #4] ; simple offset: r0 = *(int*)(r4+4); r4 unchanged - // Note: Not allowed: vldr p2, c0, [r4, #4]! ; pre-indexed: r0 = *(int*)(r4+4); r4 = r4+4 - // Note: Not allowed: vldr p3, c0, [r4], #4 ; post-indexed: r0 = *(int*)(r4+0); r4 = r4+4 - - parse_operand(s1, &ops[0]); - if (ops[0].type == OP_VREG32) { - coprocessor = CP_SINGLE_PRECISION_FLOAT; - coprocessor_destination_register = ops[0].reg; - long_transfer = coprocessor_destination_register & 1; - coprocessor_destination_register >>= 1; - } else if (ops[0].type == OP_VREG64) { - coprocessor = CP_DOUBLE_PRECISION_FLOAT; - coprocessor_destination_register = ops[0].reg; - next(); - } else { - expect("floating point register"); - } - - skip(','); - skip('['); - parse_operand(s1, &ops[1]); - if (ops[1].type != OP_REG32) { - expect("(first source operand) register"); - } - if (tok == ',') { - next(); // skip ',' - parse_operand(s1, &ops[2]); - if (ops[2].type != OP_IM8 && ops[2].type != OP_IM8N) { - expect("immediate offset"); - } - } else { - // end of input expression in brackets--assume 0 offset - ops[2].type = OP_IM8; - ops[2].e.v = 0; - } - skip(']'); - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vldreq: - asm_emit_coprocessor_data_transfer(condition_code_of_token(token), coprocessor, coprocessor_destination_register, &ops[1], &ops[2], 0, 1, 0, long_transfer, 1); - break; - case TOK_ASM_vstreq: - asm_emit_coprocessor_data_transfer(condition_code_of_token(token), coprocessor, coprocessor_destination_register, &ops[1], &ops[2], 0, 1, 0, long_transfer, 0); - break; - default: - expect("floating point data transfer instruction"); - } -} - -static void asm_floating_point_block_data_transfer_opcode(TCCState *s1, int token) -{ - uint8_t coprocessor = 0; - int first_regset_register; - int last_regset_register; - uint8_t regset_item_count; - uint8_t extra_register_bit = 0; - int op0_exclam = 0; - int load = 0; - int preincrement = 0; - Operand ops[1]; - Operand offset; - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vpusheq: - case TOK_ASM_vpopeq: - ops[0].type = OP_REG32; - ops[0].reg = 13; // sp - op0_exclam = 1; - break; - default: - parse_operand(s1, &ops[0]); - if (tok == '!') { - op0_exclam = 1; - next(); // skip '!' - } - skip(','); - } - - skip('{'); - first_regset_register = asm_parse_vfp_regvar(tok, 1); - if ((first_regset_register = asm_parse_vfp_regvar(tok, 1)) != -1) { - coprocessor = CP_DOUBLE_PRECISION_FLOAT; - next(); - } else if ((first_regset_register = asm_parse_vfp_regvar(tok, 0)) != -1) { - coprocessor = CP_SINGLE_PRECISION_FLOAT; - next(); - } else { - expect("floating-point register"); - } - - if (tok == '-') { - next(); - if ((last_regset_register = asm_parse_vfp_regvar(tok, coprocessor == CP_DOUBLE_PRECISION_FLOAT)) != -1) - next(); - else { - expect("floating-point register"); - } - } else - last_regset_register = first_regset_register; - - if (last_regset_register < first_regset_register) { - tcc_error("registers will be processed in ascending order by hardware--but are not specified in ascending order here"); - } - skip('}'); - // Note: 0 (one down) is not implemented by us regardless. - regset_item_count = last_regset_register - first_regset_register + 1; - if (coprocessor == CP_DOUBLE_PRECISION_FLOAT) - regset_item_count <<= 1; - else { - extra_register_bit = first_regset_register & 1; - first_regset_register >>= 1; - } - offset.type = OP_IM8; - offset.e.v = regset_item_count << 2; - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vstmeq: // post-increment store - case TOK_ASM_vstmiaeq: // post-increment store - break; - case TOK_ASM_vpopeq: - case TOK_ASM_vldmeq: // post-increment load - case TOK_ASM_vldmiaeq: // post-increment load - load = 1; - break; - case TOK_ASM_vldmdbeq: // pre-decrement load - load = 1; - /* fallthrough */ - case TOK_ASM_vpusheq: - case TOK_ASM_vstmdbeq: // pre-decrement store - offset.type = OP_IM8N; - offset.e.v = -offset.e.v; - preincrement = 1; - break; - default: - expect("floating point block data transfer instruction"); - } - if (ops[0].type != OP_REG32) - expect("(first operand) register"); - else if (ops[0].reg == 15) - tcc_error("'%s' does not support 'pc' as operand", get_tok_str(token, NULL)); - else if (!op0_exclam && ARM_INSTRUCTION_GROUP(token) != TOK_ASM_vldmeq && ARM_INSTRUCTION_GROUP(token) != TOK_ASM_vldmiaeq && ARM_INSTRUCTION_GROUP(token) != TOK_ASM_vstmeq && ARM_INSTRUCTION_GROUP(token) != TOK_ASM_vstmiaeq) - tcc_error("first operand of '%s' should have an exclamation mark", get_tok_str(token, NULL)); - else - asm_emit_coprocessor_data_transfer(condition_code_of_token(token), coprocessor, first_regset_register, &ops[0], &offset, 0, preincrement, op0_exclam, extra_register_bit, load); -} - -#define VMOV_FRACTIONAL_DIGITS 7 -#define VMOV_ONE 10000000 /* pow(10, VMOV_FRACTIONAL_DIGITS) */ - -static uint32_t vmov_parse_fractional_part(const char* s) -{ - uint32_t result = 0; - int i; - for (i = 0; i < VMOV_FRACTIONAL_DIGITS; ++i) { - char c = *s; - result *= 10; - if (c >= '0' && c <= '9') { - result += (c - '0'); - ++s; - } - } - if (*s) - expect("decimal numeral"); - return result; -} - -static int vmov_linear_approx_index(uint32_t beginning, uint32_t end, uint32_t value) -{ - int i; - uint32_t k; - uint32_t xvalue; - - k = (end - beginning)/16; - for (xvalue = beginning, i = 0; i < 16; ++i, xvalue += k) { - if (value == xvalue) - return i; - } - //assert(0); - return -1; -} - -static uint32_t vmov_parse_immediate_value() { - uint32_t value; - unsigned long integral_value; - const char *p; - - if (tok != TOK_PPNUM) { - expect("immediate value"); - } - p = tokc.str.data; - errno = 0; - integral_value = strtoul(p, (char **)&p, 0); - - if (errno || integral_value >= 32) { - tcc_error("invalid floating-point immediate value"); - } - - value = (uint32_t) integral_value * VMOV_ONE; - if (*p == '.') { - ++p; - value += vmov_parse_fractional_part(p); - } - next(); - return value; -} - -static uint8_t vmov_encode_immediate_value(uint32_t value) -{ - uint32_t limit; - uint32_t end = 0; - uint32_t beginning = 0; - int r = -1; - int n; - int i; - - limit = 32 * VMOV_ONE; - for (i = 0; i < 8; ++i) { - if (value < limit) { - end = limit; - limit >>= 1; - beginning = limit; - r = i; - } else - limit >>= 1; - } - if (r == -1 || value < beginning || value > end) { - tcc_error("invalid decimal number for vmov: %d", value); - } - n = vmov_linear_approx_index(beginning, end, value); - return n | (((3 - r) & 0x7) << 4); -} - -// Not standalone. -static void asm_floating_point_immediate_data_processing_opcode_tail(TCCState *s1, int token, uint8_t coprocessor, uint8_t CRd) { - uint8_t opcode1 = 0; - uint8_t opcode2 = 0; - uint8_t operands[3] = {0, 0, 0}; - uint32_t immediate_value = 0; - int op_minus = 0; - uint8_t code; - - operands[0] = CRd; - - if (tok == '#' || tok == '$') { - next(); - } - if (tok == '-') { - op_minus = 1; - next(); - } - immediate_value = vmov_parse_immediate_value(); - - opcode1 = 11; // "Other" instruction - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vcmpeq_f32: - case TOK_ASM_vcmpeq_f64: - opcode2 = 2; - operands[1] = 5; - if (immediate_value) { - expect("Immediate value 0"); - } - break; - case TOK_ASM_vcmpeeq_f32: - case TOK_ASM_vcmpeeq_f64: - opcode2 = 6; - operands[1] = 5; - if (immediate_value) { - expect("Immediate value 0"); - } - break; - case TOK_ASM_vmoveq_f32: - case TOK_ASM_vmoveq_f64: - opcode2 = 0; - if (op_minus) - operands[1] = 0x8; - else - operands[1] = 0x0; - code = vmov_encode_immediate_value(immediate_value); - operands[1] |= code >> 4; - operands[2] = code & 0xF; - break; - default: - expect("known floating point with immediate instruction"); - } - - if (coprocessor == CP_SINGLE_PRECISION_FLOAT) { - if (operands[0] & 1) - opcode1 |= 4; - operands[0] >>= 1; - } - - asm_emit_coprocessor_opcode(condition_code_of_token(token), coprocessor, opcode1, operands[0], operands[1], operands[2], opcode2, 0); -} - -static void asm_floating_point_reg_arm_reg_transfer_opcode_tail(TCCState *s1, int token, int coprocessor, int nb_arm_regs, int nb_ops, Operand ops[3]) { - uint8_t opcode1 = 0; - uint8_t opcode2 = 0; - switch (coprocessor) { - case CP_SINGLE_PRECISION_FLOAT: - // "vmov.f32 r2, s3" or "vmov.f32 s3, r2" - if (nb_ops != 2 || nb_arm_regs != 1) { - tcc_error("vmov.f32 only implemented for one VFP register operand and one ARM register operands"); - } - if (ops[0].type != OP_REG32) { // determine mode: load or store - // need to swap operands 0 and 1 - memcpy(&ops[2], &ops[1], sizeof(ops[2])); - memcpy(&ops[1], &ops[0], sizeof(ops[1])); - memcpy(&ops[0], &ops[2], sizeof(ops[0])); - } else - opcode1 |= 1; - - if (ops[1].type == OP_VREG32) { - if (ops[1].reg & 1) - opcode2 |= 4; - ops[1].reg >>= 1; - } - - if (ops[0].type == OP_VREG32) { - if (ops[0].reg & 1) - opcode1 |= 4; - ops[0].reg >>= 1; - } - - asm_emit_coprocessor_opcode(condition_code_of_token(token), coprocessor, opcode1, ops[0].reg, (ops[1].type == OP_IM8) ? ops[1].e.v : ops[1].reg, 0x10, opcode2, 0); - break; - case CP_DOUBLE_PRECISION_FLOAT: - if (nb_ops != 3 || nb_arm_regs != 2) { - tcc_error("vmov.f32 only implemented for one VFP register operand and two ARM register operands"); - } - // Determine whether it's a store into a VFP register (vmov "d1, r2, r3") rather than "vmov r2, r3, d1" - if (ops[0].type == OP_VREG64) { - if (ops[2].type == OP_REG32) { - Operand temp; - // need to rotate operand list to the left - memcpy(&temp, &ops[0], sizeof(temp)); - memcpy(&ops[0], &ops[1], sizeof(ops[0])); - memcpy(&ops[1], &ops[2], sizeof(ops[1])); - memcpy(&ops[2], &temp, sizeof(ops[2])); - } else { - tcc_error("vmov.f64 only implemented for one VFP register operand and two ARM register operands"); - } - } else if (ops[0].type != OP_REG32 || ops[1].type != OP_REG32 || ops[2].type != OP_VREG64) { - tcc_error("vmov.f64 only implemented for one VFP register operand and two ARM register operands"); - } else { - opcode1 |= 1; - } - asm_emit_coprocessor_data_transfer(condition_code_of_token(token), coprocessor, ops[0].reg, &ops[1], &ops[2], 0, 0, 0, 1, opcode1); - break; - default: - tcc_internal_error("unknown coprocessor"); - } -} - -static void asm_floating_point_vcvt_data_processing_opcode(TCCState *s1, int token) { - uint8_t coprocessor = 0; - Operand ops[3]; - uint8_t opcode1 = 11; - uint8_t opcode2 = 2; - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vcvtreq_s32_f64: - case TOK_ASM_vcvtreq_u32_f64: - case TOK_ASM_vcvteq_s32_f64: - case TOK_ASM_vcvteq_u32_f64: - case TOK_ASM_vcvteq_f64_s32: - case TOK_ASM_vcvteq_f64_u32: - case TOK_ASM_vcvteq_f32_f64: - coprocessor = CP_DOUBLE_PRECISION_FLOAT; - break; - case TOK_ASM_vcvtreq_s32_f32: - case TOK_ASM_vcvtreq_u32_f32: - case TOK_ASM_vcvteq_s32_f32: - case TOK_ASM_vcvteq_u32_f32: - case TOK_ASM_vcvteq_f32_s32: - case TOK_ASM_vcvteq_f32_u32: - case TOK_ASM_vcvteq_f64_f32: - coprocessor = CP_SINGLE_PRECISION_FLOAT; - break; - default: - tcc_error("Unknown coprocessor for instruction '%s'", get_tok_str(token, NULL)); - } - - parse_operand(s1, &ops[0]); - ops[1].type = OP_IM8; - ops[1].e.v = 8; - /* floating-point -> integer */ - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vcvtreq_s32_f32: - case TOK_ASM_vcvtreq_s32_f64: - case TOK_ASM_vcvteq_s32_f32: - case TOK_ASM_vcvteq_s32_f64: - ops[1].e.v |= 1; // signed - /* fall through */ - case TOK_ASM_vcvteq_u32_f32: - case TOK_ASM_vcvteq_u32_f64: - case TOK_ASM_vcvtreq_u32_f32: - case TOK_ASM_vcvtreq_u32_f64: - ops[1].e.v |= 4; // to_integer (opc2) - break; - /* floating-point size conversion */ - case TOK_ASM_vcvteq_f64_f32: - case TOK_ASM_vcvteq_f32_f64: - ops[1].e.v = 7; - break; - } - - skip(','); - parse_operand(s1, &ops[2]); - - switch (ARM_INSTRUCTION_GROUP(token)) { - /* floating-point -> integer */ - case TOK_ASM_vcvteq_s32_f32: - case TOK_ASM_vcvteq_s32_f64: - case TOK_ASM_vcvteq_u32_f32: - case TOK_ASM_vcvteq_u32_f64: - opcode2 |= 4; // round_zero - break; - - /* integer -> floating-point */ - case TOK_ASM_vcvteq_f64_s32: - case TOK_ASM_vcvteq_f32_s32: - opcode2 |= 4; // signed--special - break; - - /* floating-point size conversion */ - case TOK_ASM_vcvteq_f64_f32: - case TOK_ASM_vcvteq_f32_f64: - opcode2 |= 4; // always set - break; - } - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vcvteq_f64_u32: - case TOK_ASM_vcvteq_f64_s32: - case TOK_ASM_vcvteq_f64_f32: - if (ops[0].type == OP_VREG64 && ops[2].type == OP_VREG32) { - } else { - expect("d, s"); - } - break; - default: - if (coprocessor == CP_SINGLE_PRECISION_FLOAT) { - if (ops[0].type == OP_VREG32 && ops[2].type == OP_VREG32) { - } else { - expect("s, s"); - } - } else if (coprocessor == CP_DOUBLE_PRECISION_FLOAT) { - if (ops[0].type == OP_VREG32 && ops[2].type == OP_VREG64) { - } else { - expect("s, d"); - } - } - } - - if (ops[2].type == OP_VREG32) { - if (ops[2].reg & 1) - opcode2 |= 1; - ops[2].reg >>= 1; - } - if (ops[0].type == OP_VREG32) { - if (ops[0].reg & 1) - opcode1 |= 4; - ops[0].reg >>= 1; - } - asm_emit_coprocessor_opcode(condition_code_of_token(token), coprocessor, opcode1, ops[0].reg, (ops[1].type == OP_IM8) ? ops[1].e.v : ops[1].reg, (ops[2].type == OP_IM8) ? ops[2].e.v : ops[2].reg, opcode2, 0); -} - -static void asm_floating_point_data_processing_opcode(TCCState *s1, int token) { - uint8_t coprocessor = CP_SINGLE_PRECISION_FLOAT; - uint8_t opcode1 = 0; - uint8_t opcode2 = 0; // (0 || 2) | register selection - Operand ops[3]; - uint8_t nb_ops = 0; - int vmov = 0; - int nb_arm_regs = 0; - -/* TODO: - Instruction opcode opcode2 Reason - ============================================================= - - 1?00 ?1? Undefined - VFNMS 1?01 ?0? Must be unconditional - VFNMA 1?01 ?1? Must be unconditional - VFMA 1?10 ?0? Must be unconditional - VFMS 1?10 ?1? Must be unconditional - - VMOV Fd, Fm - VMOV Sn, Sm, Rd, Rn - VMOV Rd, Rn, Sn, Sm - VMOV Dn[0], Rd - VMOV Rd, Dn[0] - VMOV Dn[1], Rd - VMOV Rd, Dn[1] -*/ - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vmlaeq_f64: - case TOK_ASM_vmlseq_f64: - case TOK_ASM_vnmlseq_f64: - case TOK_ASM_vnmlaeq_f64: - case TOK_ASM_vmuleq_f64: - case TOK_ASM_vnmuleq_f64: - case TOK_ASM_vaddeq_f64: - case TOK_ASM_vsubeq_f64: - case TOK_ASM_vdiveq_f64: - case TOK_ASM_vnegeq_f64: - case TOK_ASM_vabseq_f64: - case TOK_ASM_vsqrteq_f64: - case TOK_ASM_vcmpeq_f64: - case TOK_ASM_vcmpeeq_f64: - case TOK_ASM_vmoveq_f64: - coprocessor = CP_DOUBLE_PRECISION_FLOAT; - } - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vmoveq_f32: - case TOK_ASM_vmoveq_f64: - vmov = 1; - break; - } - - for (nb_ops = 0; nb_ops < 3; ) { - // Note: Necessary because parse_operand can't parse decimal numerals. - if (nb_ops == 1 && (tok == '#' || tok == '$' || tok == TOK_PPNUM || tok == '-')) { - asm_floating_point_immediate_data_processing_opcode_tail(s1, token, coprocessor, ops[0].reg); - return; - } - parse_operand(s1, &ops[nb_ops]); - if (vmov && ops[nb_ops].type == OP_REG32) { - ++nb_arm_regs; - } else if (ops[nb_ops].type == OP_VREG32) { - if (coprocessor != CP_SINGLE_PRECISION_FLOAT) { - expect("'s'"); - } - } else if (ops[nb_ops].type == OP_VREG64) { - if (coprocessor != CP_DOUBLE_PRECISION_FLOAT) { - expect("'d'"); - } - } else { - expect("floating point register"); - } - ++nb_ops; - if (tok == ',') - next(); - else - break; - } - - if (nb_arm_regs == 0) { - if (nb_ops == 2) { // implicit - memcpy(&ops[2], &ops[1], sizeof(ops[1])); // move ops[2] - memcpy(&ops[1], &ops[0], sizeof(ops[0])); // ops[1] was implicit - nb_ops = 3; - } - if (nb_ops < 3) { - tcc_error("Not enough operands for '%s' (%u)", get_tok_str(token, NULL), nb_ops); - } - } - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vmlaeq_f32: - case TOK_ASM_vmlaeq_f64: - opcode1 = 0; - opcode2 = 0; - break; - case TOK_ASM_vmlseq_f32: - case TOK_ASM_vmlseq_f64: - opcode1 = 0; - opcode2 = 2; - break; - case TOK_ASM_vnmlseq_f32: - case TOK_ASM_vnmlseq_f64: - opcode1 = 1; - opcode2 = 0; - break; - case TOK_ASM_vnmlaeq_f32: - case TOK_ASM_vnmlaeq_f64: - opcode1 = 1; - opcode2 = 2; - break; - case TOK_ASM_vmuleq_f32: - case TOK_ASM_vmuleq_f64: - opcode1 = 2; - opcode2 = 0; - break; - case TOK_ASM_vnmuleq_f32: - case TOK_ASM_vnmuleq_f64: - opcode1 = 2; - opcode2 = 2; - break; - case TOK_ASM_vaddeq_f32: - case TOK_ASM_vaddeq_f64: - opcode1 = 3; - opcode2 = 0; - break; - case TOK_ASM_vsubeq_f32: - case TOK_ASM_vsubeq_f64: - opcode1 = 3; - opcode2 = 2; - break; - case TOK_ASM_vdiveq_f32: - case TOK_ASM_vdiveq_f64: - opcode1 = 8; - opcode2 = 0; - break; - case TOK_ASM_vnegeq_f32: - case TOK_ASM_vnegeq_f64: - opcode1 = 11; // Other" instruction - opcode2 = 2; - ops[1].type = OP_IM8; - ops[1].e.v = 1; - break; - case TOK_ASM_vabseq_f32: - case TOK_ASM_vabseq_f64: - opcode1 = 11; // "Other" instruction - opcode2 = 6; - ops[1].type = OP_IM8; - ops[1].e.v = 0; - break; - case TOK_ASM_vsqrteq_f32: - case TOK_ASM_vsqrteq_f64: - opcode1 = 11; // "Other" instruction - opcode2 = 6; - ops[1].type = OP_IM8; - ops[1].e.v = 1; - break; - case TOK_ASM_vcmpeq_f32: - case TOK_ASM_vcmpeq_f64: - opcode1 = 11; // "Other" instruction - opcode2 = 2; - ops[1].type = OP_IM8; - ops[1].e.v = 4; - break; - case TOK_ASM_vcmpeeq_f32: - case TOK_ASM_vcmpeeq_f64: - opcode1 = 11; // "Other" instruction - opcode2 = 6; - ops[1].type = OP_IM8; - ops[1].e.v = 4; - break; - case TOK_ASM_vmoveq_f32: - case TOK_ASM_vmoveq_f64: - if (nb_arm_regs > 0) { // vmov.f32 r2, s3 or similar - asm_floating_point_reg_arm_reg_transfer_opcode_tail(s1, token, coprocessor, nb_arm_regs, nb_ops, ops); - return; - } else { - opcode1 = 11; // "Other" instruction - opcode2 = 2; - ops[1].type = OP_IM8; - ops[1].e.v = 0; - } - break; - default: - expect("known floating point instruction"); - } - - if (coprocessor == CP_SINGLE_PRECISION_FLOAT) { - if (ops[2].type == OP_VREG32) { - if (ops[2].reg & 1) - opcode2 |= 1; - ops[2].reg >>= 1; - } - - if (ops[1].type == OP_VREG32) { - if (ops[1].reg & 1) - opcode2 |= 4; - ops[1].reg >>= 1; - } - - if (ops[0].type == OP_VREG32) { - if (ops[0].reg & 1) - opcode1 |= 4; - ops[0].reg >>= 1; - } - } - - asm_emit_coprocessor_opcode(condition_code_of_token(token), coprocessor, opcode1, ops[0].reg, (ops[1].type == OP_IM8) ? ops[1].e.v : ops[1].reg, (ops[2].type == OP_IM8) ? ops[2].e.v : ops[2].reg, opcode2, 0); -} - -static int asm_parse_vfp_status_regvar(int t) -{ - switch (t) { - case TOK_ASM_fpsid: - return 0; - case TOK_ASM_fpscr: - return 1; - case TOK_ASM_fpexc: - return 8; - default: - return -1; - } -} - -static void asm_floating_point_status_register_opcode(TCCState* s1, int token) -{ - uint8_t coprocessor = CP_SINGLE_PRECISION_FLOAT; - uint8_t opcode; - int vfp_sys_reg = -1; - Operand arm_operand; - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_vmrseq: - opcode = 0xf; - if (tok == TOK_ASM_apsr_nzcv) { - arm_operand.type = OP_REG32; - arm_operand.reg = 15; // not PC - next(); // skip apsr_nzcv - } else { - parse_operand(s1, &arm_operand); - if (arm_operand.type == OP_REG32 && arm_operand.reg == 15) { - tcc_error("'%s' does not support 'pc' as operand", get_tok_str(token, NULL)); - } - } - - skip(','); - vfp_sys_reg = asm_parse_vfp_status_regvar(tok); - next(); // skip vfp sys reg - if (arm_operand.type == OP_REG32 && arm_operand.reg == 15 && vfp_sys_reg != 1) { - tcc_error("'%s' only supports the variant 'vmrs apsr_nzcv, fpscr' here", get_tok_str(token, NULL)); - } - break; - case TOK_ASM_vmsreq: - opcode = 0xe; - vfp_sys_reg = asm_parse_vfp_status_regvar(tok); - next(); // skip vfp sys reg - skip(','); - parse_operand(s1, &arm_operand); - if (arm_operand.type == OP_REG32 && arm_operand.reg == 15) { - tcc_error("'%s' does not support 'pc' as operand", get_tok_str(token, NULL)); - } - break; - default: - expect("floating point status register instruction"); - } - if (vfp_sys_reg == -1) { - expect("VFP system register"); - } - if (arm_operand.type != OP_REG32) { - expect("ARM register"); - } - asm_emit_coprocessor_opcode(condition_code_of_token(token), coprocessor, opcode, arm_operand.reg, vfp_sys_reg, 0x10, 0, 0); -} - -#endif - -static void asm_misc_single_data_transfer_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - int exclam = 0; - int closed_bracket = 0; - int op2_minus = 0; - uint32_t opcode = (1 << 7) | (1 << 4); - - /* Note: - The argument syntax is exactly the same as in arm_single_data_transfer_opcode, except that there's no STREX argument form. - The main difference between this function and asm_misc_single_data_transfer_opcode is that the immediate values here must be smaller. - Also, the combination (P=0, W=1) is unpredictable here. - The immediate flag has moved to bit index 22--and its meaning has flipped. - The immediate value itself has been split into two parts: one at bits 11...8, one at bits 3...0 - bit 26 (Load/Store instruction) is unset here. - bits 7 and 4 are set here. */ - - // Here: 0 0 0 P U I W L << 20 - // [compare single data transfer: 0 1 I P U B W L << 20] - - parse_operand(s1, &ops[0]); - if (ops[0].type == OP_REG32) - opcode |= ENCODE_RD(ops[0].reg); - else { - expect("(destination operand) register"); - } - if (tok != ',') - expect("at least two arguments"); - else - next(); // skip ',' - skip('['); - parse_operand(s1, &ops[1]); - if (ops[1].type == OP_REG32) - opcode |= ENCODE_RN(ops[1].reg); - else { - expect("(first source operand) register"); - } - if (tok == ']') { - next(); - closed_bracket = 1; - // exclam = 1; // implicit in hardware; don't do it in software - } - if (tok == ',') { - next(); // skip ',' - if (tok == '-') { - op2_minus = 1; - next(); - } - parse_operand(s1, &ops[2]); - } else { - // end of input expression in brackets--assume 0 offset - ops[2].type = OP_IM8; - ops[2].e.v = 0; - opcode |= 1 << 24; // add offset before transfer - } - if (!closed_bracket) { - skip(']'); - opcode |= 1 << 24; // add offset before transfer - if (tok == '!') { - exclam = 1; - next(); // skip '!' - } - } - - if (exclam) { - if ((opcode & (1 << 24)) == 0) { - tcc_error("result of '%s' would be unpredictable here", get_tok_str(token, NULL)); - } - opcode |= 1 << 21; // write offset back into register - } - - if (ops[2].type == OP_IM32 || ops[2].type == OP_IM8 || ops[2].type == OP_IM8N) { - int v = ops[2].e.v; - if (op2_minus) - tcc_error("minus before '#' not supported for immediate values"); - if (v >= 0) { - opcode |= 1 << 23; // up - if (v >= 0x100) - tcc_error("offset out of range for '%s'", get_tok_str(token, NULL)); - else { - // bits 11...8: immediate hi nibble - // bits 3...0: immediate lo nibble - opcode |= (v & 0xF0) << 4; - opcode |= v & 0xF; - } - } else { // down - if (v <= -0x100) - tcc_error("offset out of range for '%s'", get_tok_str(token, NULL)); - else { - v = -v; - // bits 11...8: immediate hi nibble - // bits 3...0: immediate lo nibble - opcode |= (v & 0xF0) << 4; - opcode |= v & 0xF; - } - } - opcode |= 1 << 22; // not ENCODE_IMMEDIATE_FLAG; - } else if (ops[2].type == OP_REG32) { - if (!op2_minus) - opcode |= 1 << 23; // up - opcode |= ops[2].reg; - } else - expect("register"); - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_ldrsheq: - opcode |= 1 << 5; // halfword, not byte - /* fallthrough */ - case TOK_ASM_ldrsbeq: - opcode |= 1 << 6; // sign extend - opcode |= 1 << 20; // L - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_ldrheq: - opcode |= 1 << 5; // halfword, not byte - opcode |= 1 << 20; // L - asm_emit_opcode(token, opcode); - break; - case TOK_ASM_strheq: - opcode |= 1 << 5; // halfword, not byte - asm_emit_opcode(token, opcode); - break; - } -} - -/* Note: almost dupe of encbranch in arm-gen.c */ -static uint32_t encbranchoffset(int pos, int addr, int fail) -{ - addr-=pos+8; - addr/=4; - if(addr>=0x7fffff || addr<-0x800000) { - if(fail) - tcc_error("branch offset is too far"); - return 0; - } - return /*not 0x0A000000|*/(addr&0xffffff); -} - -static void asm_branch_opcode(TCCState *s1, int token) -{ - int jmp_disp = 0; - Operand op; - ExprValue e; - ElfSym *esym; - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_beq: - case TOK_ASM_bleq: - asm_expr(s1, &e); - esym = elfsym(e.sym); - if (!esym || esym->st_shndx != cur_text_section->sh_num) { - tcc_error("invalid branch target"); - } - jmp_disp = encbranchoffset(ind, e.v + esym->st_value, 1); - break; - default: - parse_operand(s1, &op); - break; - } - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_beq: - asm_emit_opcode(token, (0xa << 24) | (jmp_disp & 0xffffff)); - break; - case TOK_ASM_bleq: - asm_emit_opcode(token, (0xb << 24) | (jmp_disp & 0xffffff)); - break; - case TOK_ASM_bxeq: - if (op.type != OP_REG32) - expect("register"); - else - asm_emit_opcode(token, (0x12fff1 << 4) | op.reg); - break; - case TOK_ASM_blxeq: - if (op.type != OP_REG32) - expect("register"); - else - asm_emit_opcode(token, (0x12fff3 << 4) | op.reg); - break; - default: - expect("branch instruction"); - } -} - -ST_FUNC void asm_opcode(TCCState *s1, int token) -{ - while (token == TOK_LINEFEED) { - next(); - token = tok; - } - if (token == TOK_EOF) - return; - if (token < TOK_ASM_nopeq) { // no condition code - switch (token) { - case TOK_ASM_cdp2: - asm_coprocessor_opcode(s1, token); - return; - case TOK_ASM_ldc2: - case TOK_ASM_ldc2l: - case TOK_ASM_stc2: - case TOK_ASM_stc2l: - asm_coprocessor_data_transfer_opcode(s1, token); - return; - default: - expect("instruction"); - } - } - - switch (ARM_INSTRUCTION_GROUP(token)) { - case TOK_ASM_pusheq: - case TOK_ASM_popeq: - case TOK_ASM_stmdaeq: - case TOK_ASM_ldmdaeq: - case TOK_ASM_stmeq: - case TOK_ASM_ldmeq: - case TOK_ASM_stmiaeq: - case TOK_ASM_ldmiaeq: - case TOK_ASM_stmdbeq: - case TOK_ASM_ldmdbeq: - case TOK_ASM_stmibeq: - case TOK_ASM_ldmibeq: - asm_block_data_transfer_opcode(s1, token); - return; - case TOK_ASM_nopeq: - case TOK_ASM_wfeeq: - case TOK_ASM_wfieq: - asm_nullary_opcode(token); - return; - case TOK_ASM_swieq: - case TOK_ASM_svceq: - asm_unary_opcode(s1, token); - return; - case TOK_ASM_beq: - case TOK_ASM_bleq: - case TOK_ASM_bxeq: - case TOK_ASM_blxeq: - asm_branch_opcode(s1, token); - return; - case TOK_ASM_clzeq: - case TOK_ASM_sxtbeq: - case TOK_ASM_sxtheq: - case TOK_ASM_uxtbeq: - case TOK_ASM_uxtheq: - case TOK_ASM_movteq: - case TOK_ASM_movweq: - asm_binary_opcode(s1, token); - return; - - case TOK_ASM_ldreq: - case TOK_ASM_ldrbeq: - case TOK_ASM_streq: - case TOK_ASM_strbeq: - case TOK_ASM_ldrexeq: - case TOK_ASM_ldrexbeq: - case TOK_ASM_strexeq: - case TOK_ASM_strexbeq: - asm_single_data_transfer_opcode(s1, token); - return; - - case TOK_ASM_ldrheq: - case TOK_ASM_ldrsheq: - case TOK_ASM_ldrsbeq: - case TOK_ASM_strheq: - asm_misc_single_data_transfer_opcode(s1, token); - return; - - case TOK_ASM_andeq: - case TOK_ASM_eoreq: - case TOK_ASM_subeq: - case TOK_ASM_rsbeq: - case TOK_ASM_addeq: - case TOK_ASM_adceq: - case TOK_ASM_sbceq: - case TOK_ASM_rsceq: - case TOK_ASM_tsteq: - case TOK_ASM_teqeq: - case TOK_ASM_cmpeq: - case TOK_ASM_cmneq: - case TOK_ASM_orreq: - case TOK_ASM_moveq: - case TOK_ASM_biceq: - case TOK_ASM_mvneq: - case TOK_ASM_andseq: - case TOK_ASM_eorseq: - case TOK_ASM_subseq: - case TOK_ASM_rsbseq: - case TOK_ASM_addseq: - case TOK_ASM_adcseq: - case TOK_ASM_sbcseq: - case TOK_ASM_rscseq: -// case TOK_ASM_tstseq: -// case TOK_ASM_teqseq: -// case TOK_ASM_cmpseq: -// case TOK_ASM_cmnseq: - case TOK_ASM_orrseq: - case TOK_ASM_movseq: - case TOK_ASM_bicseq: - case TOK_ASM_mvnseq: - asm_data_processing_opcode(s1, token); - return; - - case TOK_ASM_lsleq: - case TOK_ASM_lslseq: - case TOK_ASM_lsreq: - case TOK_ASM_lsrseq: - case TOK_ASM_asreq: - case TOK_ASM_asrseq: - case TOK_ASM_roreq: - case TOK_ASM_rorseq: - case TOK_ASM_rrxseq: - case TOK_ASM_rrxeq: - asm_shift_opcode(s1, token); - return; - - case TOK_ASM_muleq: - case TOK_ASM_mulseq: - case TOK_ASM_mlaeq: - case TOK_ASM_mlaseq: - asm_multiplication_opcode(s1, token); - return; - - case TOK_ASM_smulleq: - case TOK_ASM_smullseq: - case TOK_ASM_umulleq: - case TOK_ASM_umullseq: - case TOK_ASM_smlaleq: - case TOK_ASM_smlalseq: - case TOK_ASM_umlaleq: - case TOK_ASM_umlalseq: - asm_long_multiplication_opcode(s1, token); - return; - - case TOK_ASM_cdpeq: - case TOK_ASM_mcreq: - case TOK_ASM_mrceq: - asm_coprocessor_opcode(s1, token); - return; - - case TOK_ASM_ldceq: - case TOK_ASM_ldcleq: - case TOK_ASM_stceq: - case TOK_ASM_stcleq: - asm_coprocessor_data_transfer_opcode(s1, token); - return; - -#if defined(TCC_ARM_VFP) - case TOK_ASM_vldreq: - case TOK_ASM_vstreq: - asm_floating_point_single_data_transfer_opcode(s1, token); - return; - - case TOK_ASM_vmlaeq_f32: - case TOK_ASM_vmlseq_f32: - case TOK_ASM_vnmlseq_f32: - case TOK_ASM_vnmlaeq_f32: - case TOK_ASM_vmuleq_f32: - case TOK_ASM_vnmuleq_f32: - case TOK_ASM_vaddeq_f32: - case TOK_ASM_vsubeq_f32: - case TOK_ASM_vdiveq_f32: - case TOK_ASM_vnegeq_f32: - case TOK_ASM_vabseq_f32: - case TOK_ASM_vsqrteq_f32: - case TOK_ASM_vcmpeq_f32: - case TOK_ASM_vcmpeeq_f32: - case TOK_ASM_vmoveq_f32: - case TOK_ASM_vmlaeq_f64: - case TOK_ASM_vmlseq_f64: - case TOK_ASM_vnmlseq_f64: - case TOK_ASM_vnmlaeq_f64: - case TOK_ASM_vmuleq_f64: - case TOK_ASM_vnmuleq_f64: - case TOK_ASM_vaddeq_f64: - case TOK_ASM_vsubeq_f64: - case TOK_ASM_vdiveq_f64: - case TOK_ASM_vnegeq_f64: - case TOK_ASM_vabseq_f64: - case TOK_ASM_vsqrteq_f64: - case TOK_ASM_vcmpeq_f64: - case TOK_ASM_vcmpeeq_f64: - case TOK_ASM_vmoveq_f64: - asm_floating_point_data_processing_opcode(s1, token); - return; - - case TOK_ASM_vcvtreq_s32_f32: - case TOK_ASM_vcvtreq_s32_f64: - case TOK_ASM_vcvteq_s32_f32: - case TOK_ASM_vcvteq_s32_f64: - case TOK_ASM_vcvtreq_u32_f32: - case TOK_ASM_vcvtreq_u32_f64: - case TOK_ASM_vcvteq_u32_f32: - case TOK_ASM_vcvteq_u32_f64: - case TOK_ASM_vcvteq_f64_s32: - case TOK_ASM_vcvteq_f32_s32: - case TOK_ASM_vcvteq_f64_u32: - case TOK_ASM_vcvteq_f32_u32: - case TOK_ASM_vcvteq_f64_f32: - case TOK_ASM_vcvteq_f32_f64: - asm_floating_point_vcvt_data_processing_opcode(s1, token); - return; - - case TOK_ASM_vpusheq: - case TOK_ASM_vpopeq: - case TOK_ASM_vldmeq: - case TOK_ASM_vldmiaeq: - case TOK_ASM_vldmdbeq: - case TOK_ASM_vstmeq: - case TOK_ASM_vstmiaeq: - case TOK_ASM_vstmdbeq: - asm_floating_point_block_data_transfer_opcode(s1, token); - return; - - case TOK_ASM_vmsreq: - case TOK_ASM_vmrseq: - asm_floating_point_status_register_opcode(s1, token); - return; -#endif - - default: - expect("known instruction"); - } -} - -ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier) -{ - int r, reg, size, val; - - r = sv->r; - if ((r & VT_VALMASK) == VT_CONST) { - if (!(r & VT_LVAL) && modifier != 'c' && modifier != 'n' && - modifier != 'P') - cstr_ccat(add_str, '#'); - if (r & VT_SYM) { - const char *name = get_tok_str(sv->sym->v, NULL); - if (sv->sym->v >= SYM_FIRST_ANOM) { - /* In case of anonymous symbols ("L.42", used - for static data labels) we can't find them - in the C symbol table when later looking up - this name. So enter them now into the asm label - list when we still know the symbol. */ - get_asm_sym(tok_alloc(name, strlen(name))->tok, sv->sym); - } - if (tcc_state->leading_underscore) - cstr_ccat(add_str, '_'); - cstr_cat(add_str, name, -1); - if ((uint32_t) sv->c.i == 0) - goto no_offset; - cstr_ccat(add_str, '+'); - } - val = sv->c.i; - if (modifier == 'n') - val = -val; - cstr_printf(add_str, "%d", (int) sv->c.i); - no_offset:; - } else if ((r & VT_VALMASK) == VT_LOCAL) { - cstr_printf(add_str, "[fp,#%d]", (int) sv->c.i); - } else if (r & VT_LVAL) { - reg = r & VT_VALMASK; - if (reg >= VT_CONST) - tcc_internal_error(""); - cstr_printf(add_str, "[%s]", - get_tok_str(TOK_ASM_r0 + reg, NULL)); - } else { - /* register case */ - reg = r & VT_VALMASK; - if (reg >= VT_CONST) - tcc_internal_error(""); - - /* choose register operand size */ - if ((sv->type.t & VT_BTYPE) == VT_BYTE || - (sv->type.t & VT_BTYPE) == VT_BOOL) - size = 1; - else if ((sv->type.t & VT_BTYPE) == VT_SHORT) - size = 2; - else - size = 4; - - if (modifier == 'b') { - size = 1; - } else if (modifier == 'w') { - size = 2; - } else if (modifier == 'k') { - size = 4; - } - - switch (size) { - default: - reg = TOK_ASM_r0 + reg; - break; - } - cstr_printf(add_str, "%s", get_tok_str(reg, NULL)); - } -} - -/* generate prolog and epilog code for asm statement */ -ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, - int nb_outputs, int is_output, - uint8_t *clobber_regs, - int out_reg) -{ - uint8_t regs_allocated[NB_ASM_REGS]; - ASMOperand *op; - int i, reg; - uint32_t saved_regset = 0; - - // TODO: Check non-E ABI. - // Note: Technically, r13 (sp) is also callee-saved--but that does not matter yet - static const uint8_t reg_saved[] = { 4, 5, 6, 7, 8, 9 /* Note: sometimes special reg "sb" */ , 10, 11 }; - - /* mark all used registers */ - memcpy(regs_allocated, clobber_regs, sizeof(regs_allocated)); - for(i = 0; i < nb_operands;i++) { - op = &operands[i]; - if (op->reg >= 0) - regs_allocated[op->reg] = 1; - } - for(i = 0; i < sizeof(reg_saved)/sizeof(reg_saved[0]); i++) { - reg = reg_saved[i]; - if (regs_allocated[reg]) - saved_regset |= 1 << reg; - } - - if (!is_output) { // prolog - /* generate reg save code */ - if (saved_regset) - gen_le32(0xe92d0000 | saved_regset); // push {...} - - /* generate load code */ - for(i = 0; i < nb_operands; i++) { - op = &operands[i]; - if (op->reg >= 0) { - if ((op->vt->r & VT_VALMASK) == VT_LLOCAL && - op->is_memory) { - /* memory reference case (for both input and - output cases) */ - SValue sv; - sv = *op->vt; - sv.r = (sv.r & ~VT_VALMASK) | VT_LOCAL | VT_LVAL; - sv.type.t = VT_PTR; - load(op->reg, &sv); - } else if (i >= nb_outputs || op->is_rw) { // not write-only - /* load value in register */ - load(op->reg, op->vt); - if (op->is_llong) - tcc_error("long long not implemented"); - } - } - } - } else { // epilog - /* generate save code */ - for(i = 0 ; i < nb_outputs; i++) { - op = &operands[i]; - if (op->reg >= 0) { - if ((op->vt->r & VT_VALMASK) == VT_LLOCAL) { - if (!op->is_memory) { - SValue sv; - sv = *op->vt; - sv.r = (sv.r & ~VT_VALMASK) | VT_LOCAL; - sv.type.t = VT_PTR; - load(out_reg, &sv); - - sv = *op->vt; - sv.r = (sv.r & ~VT_VALMASK) | out_reg; - store(op->reg, &sv); - } - } else { - store(op->reg, op->vt); - if (op->is_llong) - tcc_error("long long not implemented"); - } - } - } - - /* generate reg restore code */ - if (saved_regset) - gen_le32(0xe8bd0000 | saved_regset); // pop {...} - } -} - -/* return the constraint priority (we allocate first the lowest - numbered constraints) */ -static inline int constraint_priority(const char *str) -{ - int priority, c, pr; - - /* we take the lowest priority */ - priority = 0; - for(;;) { - c = *str; - if (c == '\0') - break; - str++; - switch(c) { - case 'l': // in ARM mode, that's an alias for 'r' [ARM]. - case 'r': // register [general] - case 'p': // valid memory address for load,store [general] - pr = 3; - break; - case 'M': // integer constant for shifts [ARM] - case 'I': // integer valid for data processing instruction immediate - case 'J': // integer in range -4095...4095 - - case 'i': // immediate integer operand, including symbolic constants [general] - case 'm': // memory operand [general] - case 'g': // general-purpose-register, memory, immediate integer [general] - pr = 4; - break; - default: - tcc_error("unknown constraint '%c'", c); - } - if (pr > priority) - priority = pr; - } - return priority; -} - -static const char *skip_constraint_modifiers(const char *p) -{ - /* Constraint modifier: - = Operand is written to by this instruction - + Operand is both read and written to by this instruction - % Instruction is commutative for this operand and the following operand. - - Per-alternative constraint modifier: - & Operand is clobbered before the instruction is done using the input operands - */ - while (*p == '=' || *p == '&' || *p == '+' || *p == '%') - p++; - return p; -} - -#define REG_OUT_MASK 0x01 -#define REG_IN_MASK 0x02 - -#define is_reg_allocated(reg) (regs_allocated[reg] & reg_mask) - -ST_FUNC void asm_compute_constraints(ASMOperand *operands, - int nb_operands, int nb_outputs, - const uint8_t *clobber_regs, - int *pout_reg) -{ - /* overall format: modifier, then ,-seperated list of alternatives; all operands for a single instruction must have the same number of alternatives */ - /* TODO: Simple constraints - whitespace ignored - o memory operand that is offsetable - V memory but not offsetable - < memory operand with autodecrement addressing is allowed. Restrictions apply. - > memory operand with autoincrement addressing is allowed. Restrictions apply. - n immediate integer operand with a known numeric value - E immediate floating operand (const_double) is allowed, but only if target=host - F immediate floating operand (const_double or const_vector) is allowed - s immediate integer operand whose value is not an explicit integer - X any operand whatsoever - 0...9 (postfix); (can also be more than 1 digit number); an operand that matches the specified operand number is allowed - */ - - /* TODO: ARM constraints: - k the stack pointer register - G the floating-point constant 0.0 - Q memory reference where the exact address is in a single register ("m" is preferable for asm statements) - R an item in the constant pool - S symbol in the text segment of the current file -[ Uv memory reference suitable for VFP load/store insns (reg+constant offset)] -[ Uy memory reference suitable for iWMMXt load/store instructions] - Uq memory reference suitable for the ARMv4 ldrsb instruction - */ - ASMOperand *op; - int sorted_op[MAX_ASM_OPERANDS]; - int i, j, k, p1, p2, tmp, reg, c, reg_mask; - const char *str; - uint8_t regs_allocated[NB_ASM_REGS]; - - /* init fields */ - for (i = 0; i < nb_operands; i++) { - op = &operands[i]; - op->input_index = -1; - op->ref_index = -1; - op->reg = -1; - op->is_memory = 0; - op->is_rw = 0; - } - /* compute constraint priority and evaluate references to output - constraints if input constraints */ - for (i = 0; i < nb_operands; i++) { - op = &operands[i]; - str = op->constraint; - str = skip_constraint_modifiers(str); - if (isnum(*str) || *str == '[') { - /* this is a reference to another constraint */ - k = find_constraint(operands, nb_operands, str, NULL); - if ((unsigned) k >= i || i < nb_outputs) - tcc_error("invalid reference in constraint %d ('%s')", - i, str); - op->ref_index = k; - if (operands[k].input_index >= 0) - tcc_error("cannot reference twice the same operand"); - operands[k].input_index = i; - op->priority = 5; - } else if ((op->vt->r & VT_VALMASK) == VT_LOCAL - && op->vt->sym - && (reg = op->vt->sym->r & VT_VALMASK) < VT_CONST) { - op->priority = 1; - op->reg = reg; - } else { - op->priority = constraint_priority(str); - } - } - - /* sort operands according to their priority */ - for (i = 0; i < nb_operands; i++) - sorted_op[i] = i; - for (i = 0; i < nb_operands - 1; i++) { - for (j = i + 1; j < nb_operands; j++) { - p1 = operands[sorted_op[i]].priority; - p2 = operands[sorted_op[j]].priority; - if (p2 < p1) { - tmp = sorted_op[i]; - sorted_op[i] = sorted_op[j]; - sorted_op[j] = tmp; - } - } - } - - for (i = 0; i < NB_ASM_REGS; i++) { - if (clobber_regs[i]) - regs_allocated[i] = REG_IN_MASK | REG_OUT_MASK; - else - regs_allocated[i] = 0; - } - /* sp cannot be used */ - regs_allocated[13] = REG_IN_MASK | REG_OUT_MASK; - /* fp cannot be used yet */ - regs_allocated[11] = REG_IN_MASK | REG_OUT_MASK; - - /* allocate registers and generate corresponding asm moves */ - for (i = 0; i < nb_operands; i++) { - j = sorted_op[i]; - op = &operands[j]; - str = op->constraint; - /* no need to allocate references */ - if (op->ref_index >= 0) - continue; - /* select if register is used for output, input or both */ - if (op->input_index >= 0) { - reg_mask = REG_IN_MASK | REG_OUT_MASK; - } else if (j < nb_outputs) { - reg_mask = REG_OUT_MASK; - } else { - reg_mask = REG_IN_MASK; - } - if (op->reg >= 0) { - if (is_reg_allocated(op->reg)) - tcc_error - ("asm regvar requests register that's taken already"); - reg = op->reg; - } - try_next: - c = *str++; - switch (c) { - case '=': // Operand is written-to - goto try_next; - case '+': // Operand is both READ and written-to - op->is_rw = 1; - /* FALL THRU */ - case '&': // Operand is clobbered before the instruction is done using the input operands - if (j >= nb_outputs) - tcc_error("'%c' modifier can only be applied to outputs", - c); - reg_mask = REG_IN_MASK | REG_OUT_MASK; - goto try_next; - case 'l': // In non-thumb mode, alias for 'r'--otherwise r0-r7 [ARM] - case 'r': // general-purpose register - case 'p': // loadable/storable address - /* any general register */ - if ((reg = op->reg) >= 0) - goto reg_found; - else for (reg = 0; reg <= 8; reg++) { - if (!is_reg_allocated(reg)) - goto reg_found; - } - goto try_next; - reg_found: - /* now we can reload in the register */ - op->is_llong = 0; - op->reg = reg; - regs_allocated[reg] |= reg_mask; - break; - case 'I': // integer that is valid as an data processing instruction immediate (0...255, rotated by a multiple of two) - case 'J': // integer in the range -4095 to 4095 [ARM] - case 'K': // integer that satisfies constraint I when inverted (one's complement) - case 'L': // integer that satisfies constraint I when inverted (two's complement) - case 'i': // immediate integer operand, including symbolic constants - if (!((op->vt->r & (VT_VALMASK | VT_LVAL)) == VT_CONST)) - goto try_next; - break; - case 'M': // integer in the range 0 to 32 - if (! - ((op->vt->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == - VT_CONST)) - goto try_next; - break; - case 'm': // memory operand - case 'g': - /* nothing special to do because the operand is already in - memory, except if the pointer itself is stored in a - memory variable (VT_LLOCAL case) */ - /* XXX: fix constant case */ - /* if it is a reference to a memory zone, it must lie - in a register, so we reserve the register in the - input registers and a load will be generated - later */ - if (j < nb_outputs || c == 'm') { - if ((op->vt->r & VT_VALMASK) == VT_LLOCAL) { - /* any general register */ - for (reg = 0; reg <= 8; reg++) { - if (!(regs_allocated[reg] & REG_IN_MASK)) - goto reg_found1; - } - goto try_next; - reg_found1: - /* now we can reload in the register */ - regs_allocated[reg] |= REG_IN_MASK; - op->reg = reg; - op->is_memory = 1; - } - } - break; - default: - tcc_error("asm constraint %d ('%s') could not be satisfied", - j, op->constraint); - break; - } - /* if a reference is present for that operand, we assign it too */ - if (op->input_index >= 0) { - operands[op->input_index].reg = op->reg; - operands[op->input_index].is_llong = op->is_llong; - } - } - - /* compute out_reg. It is used to store outputs registers to memory - locations references by pointers (VT_LLOCAL case) */ - *pout_reg = -1; - for (i = 0; i < nb_operands; i++) { - op = &operands[i]; - if (op->reg >= 0 && - (op->vt->r & VT_VALMASK) == VT_LLOCAL && !op->is_memory) { - for (reg = 0; reg <= 8; reg++) { - if (!(regs_allocated[reg] & REG_OUT_MASK)) - goto reg_found2; - } - tcc_error("could not find free output register for reloading"); - reg_found2: - *pout_reg = reg; - break; - } - } - - /* print sorted constraints */ -#ifdef ASM_DEBUG - for (i = 0; i < nb_operands; i++) { - j = sorted_op[i]; - op = &operands[j]; - printf("%%%d [%s]: \"%s\" r=0x%04x reg=%d\n", - j, - op->id ? get_tok_str(op->id, NULL) : "", - op->constraint, op->vt->r, op->reg); - } - if (*pout_reg >= 0) - printf("out_reg=%d\n", *pout_reg); -#endif -} - -ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) -{ - int reg; - TokenSym *ts; - - if (!strcmp(str, "memory") || - !strcmp(str, "cc") || - !strcmp(str, "flags")) - return; - ts = tok_alloc(str, strlen(str)); - reg = asm_parse_regvar(ts->tok); - if (reg == -1) { - tcc_error("invalid clobber register '%s'", str); - } - clobber_regs[reg] = 1; -} - -/* If T refers to a register then return the register number and type. - Otherwise return -1. */ -ST_FUNC int asm_parse_regvar (int t) -{ - if (t >= TOK_ASM_r0 && t <= TOK_ASM_pc) { /* register name */ - switch (t) { - case TOK_ASM_fp: - return TOK_ASM_r11 - TOK_ASM_r0; - case TOK_ASM_ip: - return TOK_ASM_r12 - TOK_ASM_r0; - case TOK_ASM_sp: - return TOK_ASM_r13 - TOK_ASM_r0; - case TOK_ASM_lr: - return TOK_ASM_r14 - TOK_ASM_r0; - case TOK_ASM_pc: - return TOK_ASM_r15 - TOK_ASM_r0; - default: - return t - TOK_ASM_r0; - } - } else - return -1; -} - -/*************************************************************/ -#endif /* ndef TARGET_DEFS_ONLY */ diff --git a/arm-gen.c b/arm-gen.c deleted file mode 100644 index fcde7dcb..00000000 --- a/arm-gen.c +++ /dev/null @@ -1,2391 +0,0 @@ -/* - * ARMv4 code generator for TCC - * - * Copyright (c) 2003 Daniel Glöckner - * Copyright (c) 2012 Thomas Preud'homme - * - * Based on i386-gen.c by Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef TARGET_DEFS_ONLY - -#if defined(TCC_ARM_EABI) && !defined(TCC_ARM_VFP) -#error "Currently TinyCC only supports float computation with VFP instructions" -#endif - -/* number of available registers */ -#ifdef TCC_ARM_VFP -#define NB_REGS 13 -#else -#define NB_REGS 9 -#endif - -#ifndef CONFIG_TCC_CPUVER -# define CONFIG_TCC_CPUVER 5 -#endif - -/* a register can belong to several classes. The classes must be - sorted from more general to more precise (see gv2() code which does - assumptions on it). */ -#define RC_INT 0x0001 /* generic integer register */ -#define RC_FLOAT 0x0002 /* generic float register */ -#define RC_R0 0x0004 -#define RC_R1 0x0008 -#define RC_R2 0x0010 -#define RC_R3 0x0020 -#define RC_R12 0x0040 -#define RC_F0 0x0080 -#define RC_F1 0x0100 -#define RC_F2 0x0200 -#define RC_F3 0x0400 -#ifdef TCC_ARM_VFP -#define RC_F4 0x0800 -#define RC_F5 0x1000 -#define RC_F6 0x2000 -#define RC_F7 0x4000 -#endif -#define RC_IRET RC_R0 /* function return: integer register */ -#define RC_IRE2 RC_R1 /* function return: second integer register */ -#define RC_FRET RC_F0 /* function return: float register */ - -/* pretty names for the registers */ -enum { - TREG_R0 = 0, - TREG_R1, - TREG_R2, - TREG_R3, - TREG_R12, - TREG_F0, - TREG_F1, - TREG_F2, - TREG_F3, -#ifdef TCC_ARM_VFP - TREG_F4, - TREG_F5, - TREG_F6, - TREG_F7, -#endif - TREG_SP = 13, - TREG_LR, -}; - -#ifdef TCC_ARM_VFP -#define T2CPR(t) (((t) & VT_BTYPE) != VT_FLOAT ? 0x100 : 0) -#endif - -/* return registers for function */ -#define REG_IRET TREG_R0 /* single word int return register */ -#define REG_IRE2 TREG_R1 /* second word return register (for long long) */ -#define REG_FRET TREG_F0 /* float return register */ - -#ifdef TCC_ARM_EABI -#define TOK___divdi3 TOK___aeabi_ldivmod -#define TOK___moddi3 TOK___aeabi_ldivmod -#define TOK___udivdi3 TOK___aeabi_uldivmod -#define TOK___umoddi3 TOK___aeabi_uldivmod -#endif - -/* defined if function parameters must be evaluated in reverse order */ -#define INVERT_FUNC_PARAMS - -/* defined if structures are passed as pointers. Otherwise structures - are directly pushed on stack. */ -/* #define FUNC_STRUCT_PARAM_AS_PTR */ - -/* pointer size, in bytes */ -#define PTR_SIZE 4 - -/* long double size and alignment, in bytes */ -#ifdef TCC_ARM_VFP -#define LDOUBLE_SIZE 8 -#endif - -#ifndef LDOUBLE_SIZE -#define LDOUBLE_SIZE 8 -#endif - -#ifdef TCC_ARM_EABI -#define LDOUBLE_ALIGN 8 -#else -#define LDOUBLE_ALIGN 4 -#endif - -/* maximum alignment (for aligned attribute support) */ -#define MAX_ALIGN 8 - -#define CHAR_IS_UNSIGNED - -#ifdef TCC_ARM_HARDFLOAT -# define ARM_FLOAT_ABI ARM_HARD_FLOAT -#else -# define ARM_FLOAT_ABI ARM_SOFTFP_FLOAT -#endif - -/******************************************************/ -#else /* ! TARGET_DEFS_ONLY */ -/******************************************************/ -#define USING_GLOBALS -#include "tcc.h" - -ST_DATA const char * const target_machine_defs = - "__arm__\0" - "__arm\0" - "arm\0" - "__arm_elf__\0" - "__arm_elf\0" - "arm_elf\0" - "__ARM_ARCH_4__\0" - "__ARMEL__\0" - "__APCS_32__\0" -#if defined TCC_ARM_EABI - "__ARM_EABI__\0" -#endif - ; - -enum float_abi float_abi; - -ST_DATA const int reg_classes[NB_REGS] = { - /* r0 */ RC_INT | RC_R0, - /* r1 */ RC_INT | RC_R1, - /* r2 */ RC_INT | RC_R2, - /* r3 */ RC_INT | RC_R3, - /* r12 */ RC_INT | RC_R12, - /* f0 */ RC_FLOAT | RC_F0, - /* f1 */ RC_FLOAT | RC_F1, - /* f2 */ RC_FLOAT | RC_F2, - /* f3 */ RC_FLOAT | RC_F3, -#ifdef TCC_ARM_VFP - /* d4/s8 */ RC_FLOAT | RC_F4, -/* d5/s10 */ RC_FLOAT | RC_F5, -/* d6/s12 */ RC_FLOAT | RC_F6, -/* d7/s14 */ RC_FLOAT | RC_F7, -#endif -}; - -static int func_sub_sp_offset, last_itod_magic; -static int leaffunc; - -#if defined(CONFIG_TCC_BCHECK) -static addr_t func_bound_offset; -static unsigned long func_bound_ind; -ST_DATA int func_bound_add_epilog; -#endif - -#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP) -static CType float_type, double_type, func_float_type, func_double_type; -ST_FUNC void arm_init(struct TCCState *s) -{ - float_type.t = VT_FLOAT; - double_type.t = VT_DOUBLE; - func_float_type.t = VT_FUNC; - func_float_type.ref = sym_push(SYM_FIELD, &float_type, FUNC_CDECL, FUNC_OLD); - func_double_type.t = VT_FUNC; - func_double_type.ref = sym_push(SYM_FIELD, &double_type, FUNC_CDECL, FUNC_OLD); - - float_abi = s->float_abi; -#ifndef TCC_ARM_HARDFLOAT -// XXX: Works on OpenBSD -// # warning "soft float ABI currently not supported: default to softfp" -#endif -} -#else -#define func_float_type func_old_type -#define func_double_type func_old_type -#define func_ldouble_type func_old_type -ST_FUNC void arm_init(struct TCCState *s) -{ -#if 0 -#if !defined (TCC_ARM_VFP) - tcc_warning("Support for FPA is deprecated and will be removed in next" - " release"); -#endif -#if !defined (TCC_ARM_EABI) - tcc_warning("Support for OABI is deprecated and will be removed in next" - " release"); -#endif -#endif -} -#endif - -#define CHECK_R(r) ((r) >= TREG_R0 && (r) <= TREG_LR) - -static int two2mask(int a,int b) { - if (!CHECK_R(a) || !CHECK_R(b)) - tcc_error("compiler error! registers %i,%i is not valid",a,b); - return (reg_classes[a]|reg_classes[b])&~(RC_INT|RC_FLOAT); -} - -static int regmask(int r) { - if (!CHECK_R(r)) - tcc_error("compiler error! register %i is not valid",r); - return reg_classes[r]&~(RC_INT|RC_FLOAT); -} - -/******************************************************/ - -#if defined(TCC_ARM_EABI) && !defined(CONFIG_TCC_ELFINTERP) -const char *default_elfinterp(struct TCCState *s) -{ - if (s->float_abi == ARM_HARD_FLOAT) - return "/lib/ld-linux-armhf.so.3"; - else - return "/lib/ld-linux.so.3"; -} -#endif - -void o(uint32_t i) -{ - /* this is a good place to start adding big-endian support*/ - int ind1; - if (nocode_wanted) - return; - ind1 = ind + 4; - if (!cur_text_section) - tcc_error("compiler error! This happens f.ex. if the compiler\n" - "can't evaluate constant expressions outside of a function."); - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind++] = i&255; - i>>=8; - cur_text_section->data[ind++] = i&255; - i>>=8; - cur_text_section->data[ind++] = i&255; - i>>=8; - cur_text_section->data[ind++] = i; -} - -static uint32_t stuff_const(uint32_t op, uint32_t c) -{ - int try_neg=0; - uint32_t nc = 0, negop = 0; - - switch(op&0x1F00000) - { - case 0x800000: //add - case 0x400000: //sub - try_neg=1; - negop=op^0xC00000; - nc=-c; - break; - case 0x1A00000: //mov - case 0x1E00000: //mvn - try_neg=1; - negop=op^0x400000; - nc=~c; - break; - case 0x200000: //xor - if(c==~0) - return (op&0xF010F000)|((op>>16)&0xF)|0x1E00000; - break; - case 0x0: //and - if(c==~0) - return (op&0xF010F000)|((op>>16)&0xF)|0x1A00000; - case 0x1C00000: //bic - try_neg=1; - negop=op^0x1C00000; - nc=~c; - break; - case 0x1800000: //orr - if(c==~0) - return (op&0xFFF0FFFF)|0x1E00000; - break; - } - do { - uint32_t m; - int i; - if(c<256) /* catch undefined <<32 */ - return op|c; - for(i=2;i<32;i+=2) { - m=(0xff>>i)|(0xff<<(32-i)); - if(!(c&~m)) - return op|(i<<7)|(c<>(32-i)); - } - op=negop; - c=nc; - } while(try_neg--); - return 0; -} - - -//only add,sub -void stuff_const_harder(uint32_t op, uint32_t v) { - uint32_t x; - x=stuff_const(op,v); - if(x) - o(x); - else { - uint32_t a[16], nv, no, o2, n2; - int i,j,k; - a[0]=0xff; - o2=(op&0xfff0ffff)|((op&0xf000)<<4);; - for(i=1;i<16;i++) - a[i]=(a[i-1]>>2)|(a[i-1]<<30); - for(i=0;i<12;i++) - for(j=i<4?i+12:15;j>=i+4;j--) - if((v&(a[i]|a[j]))==v) { - o(stuff_const(op,v&a[i])); - o(stuff_const(o2,v&a[j])); - return; - } - no=op^0xC00000; - n2=o2^0xC00000; - nv=-v; - for(i=0;i<12;i++) - for(j=i<4?i+12:15;j>=i+4;j--) - if((nv&(a[i]|a[j]))==nv) { - o(stuff_const(no,nv&a[i])); - o(stuff_const(n2,nv&a[j])); - return; - } - for(i=0;i<8;i++) - for(j=i+4;j<12;j++) - for(k=i<4?i+12:15;k>=j+4;k--) - if((v&(a[i]|a[j]|a[k]))==v) { - o(stuff_const(op,v&a[i])); - o(stuff_const(o2,v&a[j])); - o(stuff_const(o2,v&a[k])); - return; - } - no=op^0xC00000; - nv=-v; - for(i=0;i<8;i++) - for(j=i+4;j<12;j++) - for(k=i<4?i+12:15;k>=j+4;k--) - if((nv&(a[i]|a[j]|a[k]))==nv) { - o(stuff_const(no,nv&a[i])); - o(stuff_const(n2,nv&a[j])); - o(stuff_const(n2,nv&a[k])); - return; - } - o(stuff_const(op,v&a[0])); - o(stuff_const(o2,v&a[4])); - o(stuff_const(o2,v&a[8])); - o(stuff_const(o2,v&a[12])); - } -} - -uint32_t encbranch(int pos, int addr, int fail) -{ - addr-=pos+8; - addr/=4; - if(addr>=0x1000000 || addr<-0x1000000) { - if(fail) - tcc_error("FIXME: function bigger than 32MB"); - return 0; - } - return 0x0A000000|(addr&0xffffff); -} - -int decbranch(int pos) -{ - int x; - x=*(uint32_t *)(cur_text_section->data + pos); - x&=0x00ffffff; - if(x&0x800000) - x-=0x1000000; - return x*4+pos+8; -} - -/* output a symbol and patch all calls to it */ -void gsym_addr(int t, int a) -{ - uint32_t *x; - int lt; - while(t) { - x=(uint32_t *)(cur_text_section->data + t); - t=decbranch(lt=t); - if(a==lt+4) - *x=0xE1A00000; // nop - else { - *x &= 0xff000000; - *x |= encbranch(lt,a,1); - } - } -} - -#ifdef TCC_ARM_VFP -static uint32_t vfpr(int r) -{ - if(rTREG_F7) - tcc_error("compiler error! register %i is no vfp register",r); - return r - TREG_F0; -} -#else -static uint32_t fpr(int r) -{ - if(rTREG_F3) - tcc_error("compiler error! register %i is no fpa register",r); - return r - TREG_F0; -} -#endif - -static uint32_t intr(int r) -{ - if(r == TREG_R12) - return 12; - if(r >= TREG_R0 && r <= TREG_R3) - return r - TREG_R0; - if (!(r >= TREG_SP && r <= TREG_LR)) - tcc_error("compiler error! register %i is no int register",r); - return r + (13 - TREG_SP); -} - -static void calcaddr(uint32_t *base, int *off, int *sgn, int maxoff, unsigned shift) -{ - if(*off>maxoff || *off&((1<r & VT_SYM) - greloc(cur_text_section, sv->sym, ind, R_ARM_ABS32); - o(sv->c.i); -#else - if(sv->r & VT_SYM) { - if (sv->sym->type.t & VT_STATIC) { - greloc(cur_text_section, sv->sym, ind, R_ARM_REL32); - o(sv->c.i - 12); - o(0xe080000f | (intr(r)<<12) | (intr(r)<<16)); // add rx,rx,pc - } - else { - greloc(cur_text_section, sv->sym, ind, R_ARM_GOT_PREL); - o(-12); - o(0xe080000f | (intr(r)<<12) | (intr(r)<<16)); // add rx,rx,pc - o(0xe5900000 | (intr(r)<<12) | (intr(r)<<16)); // ldr rx,[rx] - if (sv->c.i) - stuff_const_harder(0xe2800000 | (intr(r)<<12) | (intr(r)<<16), - sv->c.i); - } - } - else - o(sv->c.i); -#endif -} - -/* load 'r' from value 'sv' */ -void load(int r, SValue *sv) -{ - int v, ft, fc, fr, sign; - uint32_t op; - SValue v1; - - fr = sv->r; - ft = sv->type.t; - fc = sv->c.i; - - if(fc>=0) - sign=0; - else { - sign=1; - fc=-fc; - } - - v = fr & VT_VALMASK; - if (fr & VT_LVAL) { - uint32_t base = 0xB; // fp - if(v == VT_LLOCAL) { - v1.type.t = VT_PTR; - v1.r = VT_LOCAL | VT_LVAL; - v1.c.i = sv->c.i; - load(TREG_LR, &v1); - base = 14; /* lr */ - fc=sign=0; - v=VT_LOCAL; - } else if(v == VT_CONST) { - v1.type.t = VT_PTR; - v1.r = fr&~VT_LVAL; - v1.c.i = sv->c.i; - v1.sym=sv->sym; - load(TREG_LR, &v1); - base = 14; /* lr */ - fc=sign=0; - v=VT_LOCAL; - } else if(v < VT_CONST) { - base=intr(v); - fc=sign=0; - v=VT_LOCAL; - } - if(v == VT_LOCAL) { - if(is_float(ft)) { - calcaddr(&base,&fc,&sign,1020,2); -#ifdef TCC_ARM_VFP - op=0xED100A00; /* flds */ - if(!sign) - op|=0x800000; - if ((ft & VT_BTYPE) != VT_FLOAT) - op|=0x100; /* flds -> fldd */ - o(op|(vfpr(r)<<12)|(fc>>2)|(base<<16)); -#else - op=0xED100100; - if(!sign) - op|=0x800000; -#if LDOUBLE_SIZE == 8 - if ((ft & VT_BTYPE) != VT_FLOAT) - op|=0x8000; -#else - if ((ft & VT_BTYPE) == VT_DOUBLE) - op|=0x8000; - else if ((ft & VT_BTYPE) == VT_LDOUBLE) - op|=0x400000; -#endif - o(op|(fpr(r)<<12)|(fc>>2)|(base<<16)); -#endif - } else if((ft & (VT_BTYPE|VT_UNSIGNED)) == VT_BYTE - || (ft & VT_BTYPE) == VT_SHORT) { - calcaddr(&base,&fc,&sign,255,0); - op=0xE1500090; - if ((ft & VT_BTYPE) == VT_SHORT) - op|=0x20; - if ((ft & VT_UNSIGNED) == 0) - op|=0x40; - if(!sign) - op|=0x800000; - o(op|(intr(r)<<12)|(base<<16)|((fc&0xf0)<<4)|(fc&0xf)); - } else { - calcaddr(&base,&fc,&sign,4095,0); - op=0xE5100000; - if(!sign) - op|=0x800000; - if ((ft & VT_BTYPE) == VT_BYTE || (ft & VT_BTYPE) == VT_BOOL) - op|=0x400000; - o(op|(intr(r)<<12)|fc|(base<<16)); - } - return; - } - } else { - if (v == VT_CONST) { - op=stuff_const(0xE3A00000|(intr(r)<<12),sv->c.i); - if (fr & VT_SYM || !op) - load_value(sv, r); - else - o(op); - return; - } else if (v == VT_LOCAL) { - op=stuff_const(0xE28B0000|(intr(r)<<12),sv->c.i); - if (fr & VT_SYM || !op) { - load_value(sv, r); - o(0xE08B0000|(intr(r)<<12)|intr(r)); - } else - o(op); - return; - } else if(v == VT_CMP) { - o(mapcc(sv->c.i)|0x3A00001|(intr(r)<<12)); - o(mapcc(negcc(sv->c.i))|0x3A00000|(intr(r)<<12)); - return; - } else if (v == VT_JMP || v == VT_JMPI) { - int t; - t = v & 1; - o(0xE3A00000|(intr(r)<<12)|t); - o(0xEA000000); - gsym(sv->c.i); - o(0xE3A00000|(intr(r)<<12)|(t^1)); - return; - } else if (v < VT_CONST) { - if(is_float(ft)) -#ifdef TCC_ARM_VFP - o(0xEEB00A40|(vfpr(r)<<12)|vfpr(v)|T2CPR(ft)); /* fcpyX */ -#else - o(0xEE008180|(fpr(r)<<12)|fpr(v)); -#endif - else - o(0xE1A00000|(intr(r)<<12)|intr(v)); - return; - } - } - tcc_error("load unimplemented!"); -} - -/* store register 'r' in lvalue 'v' */ -void store(int r, SValue *sv) -{ - SValue v1; - int v, ft, fc, fr, sign; - uint32_t op; - - fr = sv->r; - ft = sv->type.t; - fc = sv->c.i; - - if(fc>=0) - sign=0; - else { - sign=1; - fc=-fc; - } - - v = fr & VT_VALMASK; - if (fr & VT_LVAL || fr == VT_LOCAL) { - uint32_t base = 0xb; /* fp */ - if(v < VT_CONST) { - base=intr(v); - v=VT_LOCAL; - fc=sign=0; - } else if(v == VT_CONST) { - v1.type.t = ft; - v1.r = fr&~VT_LVAL; - v1.c.i = sv->c.i; - v1.sym=sv->sym; - load(TREG_LR, &v1); - base = 14; /* lr */ - fc=sign=0; - v=VT_LOCAL; - } - if(v == VT_LOCAL) { - if(is_float(ft)) { - calcaddr(&base,&fc,&sign,1020,2); -#ifdef TCC_ARM_VFP - op=0xED000A00; /* fsts */ - if(!sign) - op|=0x800000; - if ((ft & VT_BTYPE) != VT_FLOAT) - op|=0x100; /* fsts -> fstd */ - o(op|(vfpr(r)<<12)|(fc>>2)|(base<<16)); -#else - op=0xED000100; - if(!sign) - op|=0x800000; -#if LDOUBLE_SIZE == 8 - if ((ft & VT_BTYPE) != VT_FLOAT) - op|=0x8000; -#else - if ((ft & VT_BTYPE) == VT_DOUBLE) - op|=0x8000; - if ((ft & VT_BTYPE) == VT_LDOUBLE) - op|=0x400000; -#endif - o(op|(fpr(r)<<12)|(fc>>2)|(base<<16)); -#endif - return; - } else if((ft & VT_BTYPE) == VT_SHORT) { - calcaddr(&base,&fc,&sign,255,0); - op=0xE14000B0; - if(!sign) - op|=0x800000; - o(op|(intr(r)<<12)|(base<<16)|((fc&0xf0)<<4)|(fc&0xf)); - } else { - calcaddr(&base,&fc,&sign,4095,0); - op=0xE5000000; - if(!sign) - op|=0x800000; - if ((ft & VT_BTYPE) == VT_BYTE || (ft & VT_BTYPE) == VT_BOOL) - op|=0x400000; - o(op|(intr(r)<<12)|fc|(base<<16)); - } - return; - } - } - tcc_error("store unimplemented"); -} - -static void gadd_sp(int val) -{ - stuff_const_harder(0xE28DD000,val); -} - -/* 'is_jmp' is '1' if it is a jump */ -static void gcall_or_jmp(int is_jmp) -{ - int r; - uint32_t x; - if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { - /* constant case */ - if(vtop->r & VT_SYM){ - x=encbranch(ind,ind+vtop->c.i,0); - if(x) { - /* relocation case */ - greloc(cur_text_section, vtop->sym, ind, R_ARM_PC24); - o(x|(is_jmp?0xE0000000:0xE1000000)); - } else { - r = TREG_LR; - load_value(vtop, r); - if(is_jmp) - o(0xE1A0F000 | intr(r)); // mov pc, r - else - o(0xe12fff30 | intr(r)); // blx r - } - }else{ - if(!is_jmp) - o(0xE28FE004); // add lr,pc,#4 - o(0xE51FF004); // ldr pc,[pc,#-4] - o(vtop->c.i); - } - } else { - /* otherwise, indirect call */ -#ifdef CONFIG_TCC_BCHECK - vtop->r &= ~VT_MUSTBOUND; -#endif - r = gv(RC_INT); - if(!is_jmp) - o(0xE1A0E00F); // mov lr,pc - o(0xE1A0F000|intr(r)); // mov pc,r - } -} - -#if defined(CONFIG_TCC_BCHECK) - -static void gen_bounds_call(int v) -{ - Sym *sym = external_helper_sym(v); - - greloc(cur_text_section, sym, ind, R_ARM_PC24); - o(0xebfffffe); -} - -static void gen_bounds_prolog(void) -{ - /* leave some room for bound checking code */ - func_bound_offset = lbounds_section->data_offset; - func_bound_ind = ind; - func_bound_add_epilog = 0; - o(0xe1a00000); /* ld r0,lbounds_section->data_offset */ - o(0xe1a00000); - o(0xe1a00000); - o(0xe1a00000); - o(0xe1a00000); /* call __bound_local_new */ -} - -static void gen_bounds_epilog(void) -{ - addr_t saved_ind; - addr_t *bounds_ptr; - Sym *sym_data; - int offset_modified = func_bound_offset != lbounds_section->data_offset; - - if (!offset_modified && !func_bound_add_epilog) - return; - - /* add end of table info */ - bounds_ptr = section_ptr_add(lbounds_section, sizeof(addr_t)); - *bounds_ptr = 0; - - sym_data = get_sym_ref(&char_pointer_type, lbounds_section, - func_bound_offset, PTR_SIZE); - - /* generate bound local allocation */ - if (offset_modified) { - saved_ind = ind; - ind = func_bound_ind; - o(0xe59f0000); /* ldr r0, [pc] */ - o(0xea000000); /* b $+4 */ - greloc(cur_text_section, sym_data, ind, R_ARM_REL32); - o(-12); /* lbounds_section->data_offset */ - o(0xe080000f); /* add r0,r0,pc */ - gen_bounds_call(TOK___bound_local_new); - ind = saved_ind; - } - - /* generate bound check local freeing */ - o(0xe92d0003); /* push {r0,r1} */ - o(0xed2d0b04); /* vpush {d0,d1} */ - o(0xe59f0000); /* ldr r0, [pc] */ - o(0xea000000); /* b $+4 */ - greloc(cur_text_section, sym_data, ind, R_ARM_REL32); - o(-12); /* lbounds_section->data_offset */ - o(0xe080000f); /* add r0,r0,pc */ - gen_bounds_call(TOK___bound_local_delete); - o(0xecbd0b04); /* vpop {d0,d1} */ - o(0xe8bd0003); /* pop {r0,r1} */ -} -#endif - -static int unalias_ldbl(int btype) -{ -#if LDOUBLE_SIZE == 8 - if (btype == VT_LDOUBLE) - btype = VT_DOUBLE; -#endif - return btype; -} - -/* Return whether a structure is an homogeneous float aggregate or not. - The answer is true if all the elements of the structure are of the same - primitive float type and there is less than 4 elements. - - type: the type corresponding to the structure to be tested */ -static int is_hgen_float_aggr(CType *type) -{ - if ((type->t & VT_BTYPE) == VT_STRUCT) { - struct Sym *ref; - int btype, nb_fields = 0; - - ref = type->ref->next; - if (ref) { - btype = unalias_ldbl(ref->type.t & VT_BTYPE); - if (btype == VT_FLOAT || btype == VT_DOUBLE) { - for(; ref && btype == unalias_ldbl(ref->type.t & VT_BTYPE); ref = ref->next, nb_fields++); - return !ref && nb_fields <= 4; - } - } - } - return 0; -} - -struct avail_regs { - signed char avail[3]; /* 3 holes max with only float and double alignments */ - int first_hole; /* first available hole */ - int last_hole; /* last available hole (none if equal to first_hole) */ - int first_free_reg; /* next free register in the sequence, hole excluded */ -}; - -/* Find suitable registers for a VFP Co-Processor Register Candidate (VFP CPRC - param) according to the rules described in the procedure call standard for - the ARM architecture (AAPCS). If found, the registers are assigned to this - VFP CPRC parameter. Registers are allocated in sequence unless a hole exists - and the parameter is a single float. - - avregs: opaque structure to keep track of available VFP co-processor regs - align: alignment constraints for the param, as returned by type_size() - size: size of the parameter, as returned by type_size() */ -int assign_vfpreg(struct avail_regs *avregs, int align, int size) -{ - int first_reg = 0; - - if (avregs->first_free_reg == -1) - return -1; - if (align >> 3) { /* double alignment */ - first_reg = avregs->first_free_reg; - /* alignment constraint not respected so use next reg and record hole */ - if (first_reg & 1) - avregs->avail[avregs->last_hole++] = first_reg++; - } else { /* no special alignment (float or array of float) */ - /* if single float and a hole is available, assign the param to it */ - if (size == 4 && avregs->first_hole != avregs->last_hole) - return avregs->avail[avregs->first_hole++]; - else - first_reg = avregs->first_free_reg; - } - if (first_reg + size / 4 <= 16) { - avregs->first_free_reg = first_reg + size / 4; - return first_reg; - } - avregs->first_free_reg = -1; - return -1; -} - -/* Returns whether all params need to be passed in core registers or not. - This is the case for function part of the runtime ABI. */ -int floats_in_core_regs(SValue *sval) -{ - if (!sval->sym) - return 0; - - switch (sval->sym->v) { - case TOK___floatundisf: - case TOK___floatundidf: - case TOK___fixunssfdi: - case TOK___fixunsdfdi: -#ifndef TCC_ARM_VFP - case TOK___fixunsxfdi: -#endif - case TOK___floatdisf: - case TOK___floatdidf: - case TOK___fixsfdi: - case TOK___fixdfdi: - return 1; - - default: - return 0; - } -} - -/* Return the number of registers needed to return the struct, or 0 if - returning via struct pointer. */ -ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize) { -#ifdef TCC_ARM_EABI - int size, align; - size = type_size(vt, &align); - if (float_abi == ARM_HARD_FLOAT && !variadic && - (is_float(vt->t) || is_hgen_float_aggr(vt))) { - *ret_align = 8; - *regsize = 8; - ret->ref = NULL; - ret->t = VT_DOUBLE; - return (size + 7) >> 3; - } else if (size > 0 && size <= 4) { - *ret_align = 4; - *regsize = 4; - ret->ref = NULL; - ret->t = VT_INT; - return 1; - } else - return 0; -#else - return 0; -#endif -} - -/* Parameters are classified according to how they are copied to their final - destination for the function call. Because the copying is performed class - after class according to the order in the union below, it is important that - some constraints about the order of the members of this union are respected: - - CORE_STRUCT_CLASS must come after STACK_CLASS; - - CORE_CLASS must come after STACK_CLASS, CORE_STRUCT_CLASS and - VFP_STRUCT_CLASS; - - VFP_STRUCT_CLASS must come after VFP_CLASS. - See the comment for the main loop in copy_params() for the reason. */ -enum reg_class { - STACK_CLASS = 0, - CORE_STRUCT_CLASS, - VFP_CLASS, - VFP_STRUCT_CLASS, - CORE_CLASS, - NB_CLASSES -}; - -struct param_plan { - int start; /* first reg or addr used depending on the class */ - int end; /* last reg used or next free addr depending on the class */ - SValue *sval; /* pointer to SValue on the value stack */ - struct param_plan *prev; /* previous element in this class */ -}; - -struct plan { - struct param_plan *pplans; /* array of all the param plans */ - struct param_plan *clsplans[NB_CLASSES]; /* per class lists of param plans */ - int nb_plans; -}; - -static void add_param_plan(struct plan* plan, int cls, int start, int end, SValue *v) -{ - struct param_plan *p = &plan->pplans[plan->nb_plans++]; - p->prev = plan->clsplans[cls]; - plan->clsplans[cls] = p; - p->start = start, p->end = end, p->sval = v; -} - -/* Assign parameters to registers and stack with alignment according to the - rules in the procedure call standard for the ARM architecture (AAPCS). - The overall assignment is recorded in an array of per parameter structures - called parameter plans. The parameter plans are also further organized in a - number of linked lists, one per class of parameter (see the comment for the - definition of union reg_class). - - nb_args: number of parameters of the function for which a call is generated - float_abi: float ABI in use for this function call - plan: the structure where the overall assignment is recorded - todo: a bitmap that record which core registers hold a parameter - - Returns the amount of stack space needed for parameter passing - - Note: this function allocated an array in plan->pplans with tcc_malloc. It - is the responsibility of the caller to free this array once used (ie not - before copy_params). */ -static int assign_regs(int nb_args, int float_abi, struct plan *plan, int *todo) -{ - int i, size, align; - int ncrn /* next core register number */, nsaa /* next stacked argument address*/; - struct avail_regs avregs = {{0}}; - - ncrn = nsaa = 0; - *todo = 0; - - for(i = nb_args; i-- ;) { - int j, start_vfpreg = 0; - CType type = vtop[-i].type; - type.t &= ~VT_ARRAY; - size = type_size(&type, &align); - size = (size + 3) & ~3; - align = (align + 3) & ~3; - switch(vtop[-i].type.t & VT_BTYPE) { - case VT_STRUCT: - case VT_FLOAT: - case VT_DOUBLE: - case VT_LDOUBLE: - if (float_abi == ARM_HARD_FLOAT) { - int is_hfa = 0; /* Homogeneous float aggregate */ - - if (is_float(vtop[-i].type.t) - || (is_hfa = is_hgen_float_aggr(&vtop[-i].type))) { - int end_vfpreg; - - start_vfpreg = assign_vfpreg(&avregs, align, size); - end_vfpreg = start_vfpreg + ((size - 1) >> 2); - if (start_vfpreg >= 0) { - add_param_plan(plan, is_hfa ? VFP_STRUCT_CLASS : VFP_CLASS, - start_vfpreg, end_vfpreg, &vtop[-i]); - continue; - } else - break; - } - } - ncrn = (ncrn + (align-1)/4) & ~((align/4) - 1); - if (ncrn + size/4 <= 4 || (ncrn < 4 && start_vfpreg != -1)) { - /* The parameter is allocated both in core register and on stack. As - * such, it can be of either class: it would either be the last of - * CORE_STRUCT_CLASS or the first of STACK_CLASS. */ - for (j = ncrn; j < 4 && j < ncrn + size / 4; j++) - *todo|=(1< 4) - nsaa = (ncrn - 4) * 4; - } else { - ncrn = 4; - break; - } - continue; - default: - if (ncrn < 4) { - int is_long = (vtop[-i].type.t & VT_BTYPE) == VT_LLONG; - - if (is_long) { - ncrn = (ncrn + 1) & -2; - if (ncrn == 4) - break; - } - add_param_plan(plan, CORE_CLASS, ncrn, ncrn + is_long, &vtop[-i]); - ncrn += 1 + is_long; - continue; - } - } - nsaa = (nsaa + (align - 1)) & ~(align - 1); - add_param_plan(plan, STACK_CLASS, nsaa, nsaa + size, &vtop[-i]); - nsaa += size; /* size already rounded up before */ - } - return nsaa; -} - -/* Copy parameters to their final destination (core reg, VFP reg or stack) for - function call. - - nb_args: number of parameters the function take - plan: the overall assignment plan for parameters - todo: a bitmap indicating what core reg will hold a parameter - - Returns the number of SValue added by this function on the value stack */ -static int copy_params(int nb_args, struct plan *plan, int todo) -{ - int size, align, r, i, nb_extra_sval = 0; - struct param_plan *pplan; - int pass = 0; - - /* Several constraints require parameters to be copied in a specific order: - - structures are copied to the stack before being loaded in a reg; - - floats loaded to an odd numbered VFP reg are first copied to the - preceding even numbered VFP reg and then moved to the next VFP reg. - - It is thus important that: - - structures assigned to core regs must be copied after parameters - assigned to the stack but before structures assigned to VFP regs because - a structure can lie partly in core registers and partly on the stack; - - parameters assigned to the stack and all structures be copied before - parameters assigned to a core reg since copying a parameter to the stack - require using a core reg; - - parameters assigned to VFP regs be copied before structures assigned to - VFP regs as the copy might use an even numbered VFP reg that already - holds part of a structure. */ -again: - for(i = 0; i < NB_CLASSES; i++) { - for(pplan = plan->clsplans[i]; pplan; pplan = pplan->prev) { - - if (pass - && (i != CORE_CLASS || pplan->sval->r < VT_CONST)) - continue; - - vpushv(pplan->sval); - pplan->sval->r = pplan->sval->r2 = VT_CONST; /* disable entry */ - switch(i) { - case STACK_CLASS: - case CORE_STRUCT_CLASS: - case VFP_STRUCT_CLASS: - if ((pplan->sval->type.t & VT_BTYPE) == VT_STRUCT) { - int padding = 0; - size = type_size(&pplan->sval->type, &align); - /* align to stack align size */ - size = (size + 3) & ~3; - if (i == STACK_CLASS && pplan->prev) - padding = pplan->start - pplan->prev->end; - size += padding; /* Add padding if any */ - /* allocate the necessary size on stack */ - gadd_sp(-size); - /* generate structure store */ - r = get_reg(RC_INT); - o(0xE28D0000|(intr(r)<<12)|padding); /* add r, sp, padding */ - vset(&vtop->type, r | VT_LVAL, 0); - vswap(); - /* XXX: optimize. Save all register because memcpy can use them */ - o(0xED2D0A00|(0&1)<<22|(0>>1)<<12|16); /* vpush {s0-s15} */ - vstore(); /* memcpy to current sp + potential padding */ - o(0xECBD0A00|(0&1)<<22|(0>>1)<<12|16); /* vpop {s0-s15} */ - - /* Homogeneous float aggregate are loaded to VFP registers - immediately since there is no way of loading data in multiple - non consecutive VFP registers as what is done for other - structures (see the use of todo). */ - if (i == VFP_STRUCT_CLASS) { - int first = pplan->start, nb = pplan->end - first + 1; - /* vpop.32 {pplan->start, ..., pplan->end} */ - o(0xECBD0A00|(first&1)<<22|(first>>1)<<12|nb); - /* No need to write the register used to a SValue since VFP regs - cannot be used for gcall_or_jmp */ - } - } else { - if (is_float(pplan->sval->type.t)) { -#ifdef TCC_ARM_VFP - r = vfpr(gv(RC_FLOAT)) << 12; - if ((pplan->sval->type.t & VT_BTYPE) == VT_FLOAT) - size = 4; - else { - size = 8; - r |= 0x101; /* vpush.32 -> vpush.64 */ - } - o(0xED2D0A01 + r); /* vpush */ -#else - r = fpr(gv(RC_FLOAT)) << 12; - if ((pplan->sval->type.t & VT_BTYPE) == VT_FLOAT) - size = 4; - else if ((pplan->sval->type.t & VT_BTYPE) == VT_DOUBLE) - size = 8; - else - size = LDOUBLE_SIZE; - - if (size == 12) - r |= 0x400000; - else if(size == 8) - r|=0x8000; - - o(0xED2D0100|r|(size>>2)); /* some kind of vpush for FPA */ -#endif - } else { - /* simple type (currently always same size) */ - /* XXX: implicit cast ? */ - size=4; - if ((pplan->sval->type.t & VT_BTYPE) == VT_LLONG) { - lexpand(); - size = 8; - r = gv(RC_INT); - o(0xE52D0004|(intr(r)<<12)); /* push r */ - vtop--; - } - r = gv(RC_INT); - o(0xE52D0004|(intr(r)<<12)); /* push r */ - } - if (i == STACK_CLASS && pplan->prev) - gadd_sp(pplan->prev->end - pplan->start); /* Add padding if any */ - } - break; - - case VFP_CLASS: - gv(regmask(TREG_F0 + (pplan->start >> 1))); - if (pplan->start & 1) { /* Must be in upper part of double register */ - o(0xEEF00A40|((pplan->start>>1)<<12)|(pplan->start>>1)); /* vmov.f32 s(n+1), sn */ - vtop->r = VT_CONST; /* avoid being saved on stack by gv for next float */ - } - break; - - case CORE_CLASS: - if ((pplan->sval->type.t & VT_BTYPE) == VT_LLONG) { - lexpand(); - gv(regmask(pplan->end)); - pplan->sval->r2 = vtop->r; - vtop--; - } - gv(regmask(pplan->start)); - /* Mark register as used so that gcall_or_jmp use another one - (regs >=4 are free as never used to pass parameters) */ - pplan->sval->r = vtop->r; - break; - } - vtop--; - } - } - - /* second pass to restore registers that were saved on stack by accident. - Maybe redundant after the "lvalue_save" patch in tccgen.c:gv() */ - if (++pass < 2) - goto again; - - /* Manually free remaining registers since next parameters are loaded - * manually, without the help of gv(int). */ - save_regs(nb_args); - - if(todo) { - o(0xE8BD0000|todo); /* pop {todo} */ - for(pplan = plan->clsplans[CORE_STRUCT_CLASS]; pplan; pplan = pplan->prev) { - int r; - pplan->sval->r = pplan->start; - /* An SValue can only pin 2 registers at best (r and r2) but a structure - can occupy more than 2 registers. Thus, we need to push on the value - stack some fake parameter to have on SValue for each registers used - by a structure (r2 is not used). */ - for (r = pplan->start + 1; r <= pplan->end; r++) { - if (todo & (1 << r)) { - nb_extra_sval++; - vpushi(0); - vtop->r = r; - } - } - } - } - return nb_extra_sval; -} - -/* Generate function call. The function address is pushed first, then - all the parameters in call order. This functions pops all the - parameters and the function address. */ -void gfunc_call(int nb_args) -{ - int r, args_size; - int def_float_abi = float_abi; - int todo; - struct plan plan; -#ifdef TCC_ARM_EABI - int variadic; -#endif - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gbound_args(nb_args); -#endif - -#ifdef TCC_ARM_EABI - if (float_abi == ARM_HARD_FLOAT) { - variadic = (vtop[-nb_args].type.ref->f.func_type == FUNC_ELLIPSIS); - if (variadic || floats_in_core_regs(&vtop[-nb_args])) - float_abi = ARM_SOFTFP_FLOAT; - } -#endif - /* cannot let cpu flags if other instruction are generated. Also avoid leaving - VT_JMP anywhere except on the top of the stack because it would complicate - the code generator. */ - r = vtop->r & VT_VALMASK; - if (r == VT_CMP || (r & ~1) == VT_JMP) - gv(RC_INT); - - memset(&plan, 0, sizeof plan); - if (nb_args) - plan.pplans = tcc_malloc(nb_args * sizeof(*plan.pplans)); - - args_size = assign_regs(nb_args, float_abi, &plan, &todo); - -#ifdef TCC_ARM_EABI - if (args_size & 7) { /* Stack must be 8 byte aligned at fct call for EABI */ - args_size = (args_size + 7) & ~7; - o(0xE24DD004); /* sub sp, sp, #4 */ - } -#endif - - nb_args += copy_params(nb_args, &plan, todo); - tcc_free(plan.pplans); - - /* Move fct SValue on top as required by gcall_or_jmp */ - vrotb(nb_args + 1); - gcall_or_jmp(0); - if (args_size) - gadd_sp(args_size); /* pop all parameters passed on the stack */ -#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP) - if(float_abi == ARM_SOFTFP_FLOAT && is_float(vtop->type.ref->type.t)) { - if((vtop->type.ref->type.t & VT_BTYPE) == VT_FLOAT) { - o(0xEE000A10); /*vmov s0, r0 */ - } else { - o(0xEE000B10); /* vmov.32 d0[0], r0 */ - o(0xEE201B10); /* vmov.32 d0[1], r1 */ - } - } -#endif - vtop -= nb_args + 1; /* Pop all params and fct address from value stack */ - leaffunc = 0; /* we are calling a function, so we aren't in a leaf function */ - float_abi = def_float_abi; -} - -/* generate function prolog of type 't' */ -void gfunc_prolog(Sym *func_sym) -{ - CType *func_type = &func_sym->type; - Sym *sym,*sym2; - int n, nf, size, align, rs, struct_ret = 0; - int addr, pn, sn; /* pn=core, sn=stack */ - CType ret_type; - -#ifdef TCC_ARM_EABI - struct avail_regs avregs = {{0}}; -#endif - - sym = func_type->ref; - - n = nf = 0; - if ((func_vt.t & VT_BTYPE) == VT_STRUCT && - !gfunc_sret(&func_vt, func_var, &ret_type, &align, &rs)) - { - n++; - struct_ret = 1; - func_vc = 12; /* Offset from fp of the place to store the result */ - } - for(sym2 = sym->next; sym2 && (n < 4 || nf < 16); sym2 = sym2->next) { - size = type_size(&sym2->type, &align); -#ifdef TCC_ARM_EABI - if (float_abi == ARM_HARD_FLOAT && !func_var && - (is_float(sym2->type.t) || is_hgen_float_aggr(&sym2->type))) { - int tmpnf = assign_vfpreg(&avregs, align, size); - tmpnf += (size + 3) / 4; - nf = (tmpnf > nf) ? tmpnf : nf; - } else -#endif - if (n < 4) - n += (size + 3) / 4; - } - o(0xE1A0C00D); /* mov ip,sp */ - if (func_var) - n=4; - if (n) { - if(n>4) - n=4; -#ifdef TCC_ARM_EABI - n=(n+1)&-2; -#endif - o(0xE92D0000|((1<16) - nf=16; - nf=(nf+1)&-2; /* nf => HARDFLOAT => EABI */ - o(0xED2D0A00|nf); /* save s0-s15 on stack if needed */ - } - o(0xE92D5800); /* save fp, ip, lr */ - o(0xE1A0B00D); /* mov fp, sp */ - func_sub_sp_offset = ind; - o(0xE1A00000); /* nop, leave space for stack adjustment in epilog */ - -#ifdef TCC_ARM_EABI - if (float_abi == ARM_HARD_FLOAT) { - func_vc += nf * 4; - memset(&avregs, 0, sizeof avregs); - } -#endif - pn = struct_ret, sn = 0; - while ((sym = sym->next)) { - CType *type; - type = &sym->type; - size = type_size(type, &align); - size = (size + 3) >> 2; - align = (align + 3) & ~3; -#ifdef TCC_ARM_EABI - if (float_abi == ARM_HARD_FLOAT && !func_var && (is_float(sym->type.t) - || is_hgen_float_aggr(&sym->type))) { - int fpn = assign_vfpreg(&avregs, align, size << 2); - if (fpn >= 0) - addr = fpn * 4; - else - goto from_stack; - } else -#endif - if (pn < 4) { -#ifdef TCC_ARM_EABI - pn = (pn + (align-1)/4) & -(align/4); -#endif - addr = (nf + pn) * 4; - pn += size; - if (!sn && pn > 4) - sn = (pn - 4); - } else { -#ifdef TCC_ARM_EABI -from_stack: - sn = (sn + (align-1)/4) & -(align/4); -#endif - addr = (n + nf + sn) * 4; - sn += size; - } - sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL, - addr + 12); - } - last_itod_magic=0; - leaffunc = 1; - loc = 0; -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_prolog(); -#endif -} - -/* generate function epilog */ -void gfunc_epilog(void) -{ - uint32_t x; - int diff; - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_epilog(); -#endif - /* Copy float return value to core register if base standard is used and - float computation is made with VFP */ -#if defined(TCC_ARM_EABI) && defined(TCC_ARM_VFP) - if ((float_abi == ARM_SOFTFP_FLOAT || func_var) && is_float(func_vt.t)) { - if((func_vt.t & VT_BTYPE) == VT_FLOAT) - o(0xEE100A10); /* fmrs r0, s0 */ - else { - o(0xEE100B10); /* fmrdl r0, d0 */ - o(0xEE301B10); /* fmrdh r1, d0 */ - } - } -#endif - o(0xE89BA800); /* restore fp, sp, pc */ - diff = (-loc + 3) & -4; -#ifdef TCC_ARM_EABI - if(!leaffunc) - diff = ((diff + 11) & -8) - 4; -#endif - if(diff > 0) { - x=stuff_const(0xE24BD000, diff); /* sub sp,fp,# */ - if(x) - *(uint32_t *)(cur_text_section->data + func_sub_sp_offset) = x; - else { - int addr; - addr=ind; - o(0xE59FC004); /* ldr ip,[pc+4] */ - o(0xE04BD00C); /* sub sp,fp,ip */ - o(0xE1A0F00E); /* mov pc,lr */ - o(diff); - *(uint32_t *)(cur_text_section->data + func_sub_sp_offset) = 0xE1000000|encbranch(func_sub_sp_offset,addr,1); - } - } -} - -ST_FUNC void gen_fill_nops(int bytes) -{ - if ((bytes & 3)) - tcc_error("alignment of code section not multiple of 4"); - while (bytes > 0) { - o(0xE1A00000); - bytes -= 4; - } -} - -/* generate a jump to a label */ -ST_FUNC int gjmp(int t) -{ - int r; - if (nocode_wanted) - return t; - r=ind; - o(0xE0000000|encbranch(r,t,1)); - return r; -} - -/* generate a jump to a fixed address */ -ST_FUNC void gjmp_addr(int a) -{ - gjmp(a); -} - -ST_FUNC int gjmp_cond(int op, int t) -{ - int r; - if (nocode_wanted) - return t; - r=ind; - op=mapcc(op); - op|=encbranch(r,t,1); - o(op); - return r; -} - -ST_FUNC int gjmp_append(int n, int t) -{ - uint32_t *x; - int p,lp; - if(n) { - p = n; - do { - p = decbranch(lp=p); - } while(p); - x = (uint32_t *)(cur_text_section->data + lp); - *x &= 0xff000000; - *x |= encbranch(lp,t,1); - t = n; - } - return t; -} - -/* generate an integer binary operation */ -void gen_opi(int op) -{ - int c, func = 0; - uint32_t opc = 0, r, fr; - unsigned short retreg = REG_IRET; - - c=0; - switch(op) { - case '+': - opc = 0x8; - c=1; - break; - case TOK_ADDC1: /* add with carry generation */ - opc = 0x9; - c=1; - break; - case '-': - opc = 0x4; - c=1; - break; - case TOK_SUBC1: /* sub with carry generation */ - opc = 0x5; - c=1; - break; - case TOK_ADDC2: /* add with carry use */ - opc = 0xA; - c=1; - break; - case TOK_SUBC2: /* sub with carry use */ - opc = 0xC; - c=1; - break; - case '&': - opc = 0x0; - c=1; - break; - case '^': - opc = 0x2; - c=1; - break; - case '|': - opc = 0x18; - c=1; - break; - case '*': - gv2(RC_INT, RC_INT); - r = vtop[-1].r; - fr = vtop[0].r; - vtop--; - o(0xE0000090|(intr(r)<<16)|(intr(r)<<8)|intr(fr)); - return; - case TOK_SHL: - opc = 0; - c=2; - break; - case TOK_SHR: - opc = 1; - c=2; - break; - case TOK_SAR: - opc = 2; - c=2; - break; - case '/': - case TOK_PDIV: - func=TOK___divsi3; - c=3; - break; - case TOK_UDIV: - func=TOK___udivsi3; - c=3; - break; - case '%': -#ifdef TCC_ARM_EABI - func=TOK___aeabi_idivmod; - retreg=REG_IRE2; -#else - func=TOK___modsi3; -#endif - c=3; - break; - case TOK_UMOD: -#ifdef TCC_ARM_EABI - func=TOK___aeabi_uidivmod; - retreg=REG_IRE2; -#else - func=TOK___umodsi3; -#endif - c=3; - break; - case TOK_UMULL: - gv2(RC_INT, RC_INT); - r=intr(vtop[-1].r2=get_reg(RC_INT)); - c=vtop[-1].r; - vtop[-1].r=get_reg_ex(RC_INT,regmask(c)); - vtop--; - o(0xE0800090|(r<<16)|(intr(vtop->r)<<12)|(intr(c)<<8)|intr(vtop[1].r)); - return; - default: - opc = 0x15; - c=1; - break; - } - switch(c) { - case 1: - if((vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { - if(opc == 4 || opc == 5 || opc == 0xc) { - vswap(); - opc|=2; // sub -> rsb - } - } - if ((vtop->r & VT_VALMASK) == VT_CMP || - (vtop->r & (VT_VALMASK & ~1)) == VT_JMP) - gv(RC_INT); - vswap(); - c=intr(gv(RC_INT)); - vswap(); - opc=0xE0000000|(opc<<20); - if((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { - uint32_t x; - x=stuff_const(opc|0x2000000|(c<<16),vtop->c.i); - if(x) { - if ((x & 0xfff00000) == 0xe3500000) // cmp rx,#c - o(x); - else { - r=intr(vtop[-1].r=get_reg_ex(RC_INT,regmask(vtop[-1].r))); - o(x|(r<<12)); - } - goto done; - } - } - fr=intr(gv(RC_INT)); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - c=intr(gv(RC_INT)); - vswap(); - } -#endif - if ((opc & 0xfff00000) == 0xe1500000) // cmp rx,ry - o(opc|(c<<16)|fr); - else { - r=intr(vtop[-1].r=get_reg_ex(RC_INT,two2mask(vtop->r,vtop[-1].r))); - o(opc|(c<<16)|(r<<12)|fr); - } -done: - vtop--; - if (op >= TOK_ULT && op <= TOK_GT) - vset_VT_CMP(op); - break; - case 2: - opc=0xE1A00000|(opc<<5); - if ((vtop->r & VT_VALMASK) == VT_CMP || - (vtop->r & (VT_VALMASK & ~1)) == VT_JMP) - gv(RC_INT); - vswap(); - r=intr(gv(RC_INT)); - vswap(); - if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { - fr=intr(vtop[-1].r=get_reg_ex(RC_INT,regmask(vtop[-1].r))); - c = vtop->c.i & 0x1f; - o(opc|r|(c<<7)|(fr<<12)); - } else { - fr=intr(gv(RC_INT)); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - r=intr(gv(RC_INT)); - vswap(); - } -#endif - c=intr(vtop[-1].r=get_reg_ex(RC_INT,two2mask(vtop->r,vtop[-1].r))); - o(opc|r|(c<<12)|(fr<<8)|0x10); - } - vtop--; - break; - case 3: - vpush_helper_func(func); - vrott(3); - gfunc_call(2); - vpushi(0); - vtop->r = retreg; - break; - default: - tcc_error("gen_opi %i unimplemented!",op); - } -} - -#ifdef TCC_ARM_VFP -static int is_zero(int i) -{ - if((vtop[i].r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST) - return 0; - if (vtop[i].type.t == VT_FLOAT) - return (vtop[i].c.f == 0.f); - else if (vtop[i].type.t == VT_DOUBLE) - return (vtop[i].c.d == 0.0); - return (vtop[i].c.ld == 0.l); -} - -/* generate a floating point operation 'v = t1 op t2' instruction. The - * two operands are guaranteed to have the same floating point type */ -void gen_opf(int op) -{ - uint32_t x; - int fneg=0,r; - x=0xEE000A00|T2CPR(vtop->type.t); - switch(op) { - case '+': - if(is_zero(-1)) - vswap(); - if(is_zero(0)) { - vtop--; - return; - } - x|=0x300000; - break; - case '-': - x|=0x300040; - if(is_zero(0)) { - vtop--; - return; - } - if(is_zero(-1)) { - x|=0x810000; /* fsubX -> fnegX */ - vswap(); - vtop--; - fneg=1; - } - break; - case '*': - x|=0x200000; - break; - case '/': - x|=0x800000; - break; - default: - if(op < TOK_ULT || op > TOK_GT) { - tcc_error("unknown fp op %x!",op); - return; - } - if(is_zero(-1)) { - vswap(); - switch(op) { - case TOK_LT: op=TOK_GT; break; - case TOK_GE: op=TOK_ULE; break; - case TOK_LE: op=TOK_GE; break; - case TOK_GT: op=TOK_ULT; break; - } - } - x|=0xB40040; /* fcmpX */ - if(op!=TOK_EQ && op!=TOK_NE) - x|=0x80; /* fcmpX -> fcmpeX */ - if(is_zero(0)) { - vtop--; - o(x|0x10000|(vfpr(gv(RC_FLOAT))<<12)); /* fcmp(e)X -> fcmp(e)zX */ - } else { - gv2(RC_FLOAT,RC_FLOAT); - x|=vfpr(vtop[0].r); - o(x|(vfpr(vtop[-1].r) << 12)); - vtop--; - } - o(0xEEF1FA10); /* fmstat */ - - switch(op) { - case TOK_LE: op=TOK_ULE; break; - case TOK_LT: op=TOK_ULT; break; - case TOK_UGE: op=TOK_GE; break; - case TOK_UGT: op=TOK_GT; break; - } - vset_VT_CMP(op); - return; - } - r=gv(RC_FLOAT); - x|=vfpr(r); - r=regmask(r); - if(!fneg) { - int r2; - vswap(); - r2=gv(RC_FLOAT); - x|=vfpr(r2)<<16; - r|=regmask(r2); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - r=gv(RC_FLOAT); - vswap(); - x=(x&~0xf)|vfpr(r); - } -#endif - } - vtop->r=get_reg_ex(RC_FLOAT,r); - if(!fneg) - vtop--; - o(x|(vfpr(vtop->r)<<12)); -} - -#else -static uint32_t is_fconst() -{ - long double f; - uint32_t r; - if((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST) - return 0; - if (vtop->type.t == VT_FLOAT) - f = vtop->c.f; - else if (vtop->type.t == VT_DOUBLE) - f = vtop->c.d; - else - f = vtop->c.ld; - if(!ieee_finite(f)) - return 0; - r=0x8; - if(f<0.0) { - r=0x18; - f=-f; - } - if(f==0.0) - return r; - if(f==1.0) - return r|1; - if(f==2.0) - return r|2; - if(f==3.0) - return r|3; - if(f==4.0) - return r|4; - if(f==5.0) - return r|5; - if(f==0.5) - return r|6; - if(f==10.0) - return r|7; - return 0; -} - -/* generate a floating point operation 'v = t1 op t2' instruction. The - two operands are guaranteed to have the same floating point type */ -void gen_opf(int op) -{ - uint32_t x, r, r2, c1, c2; - //fputs("gen_opf\n",stderr); - vswap(); - c1 = is_fconst(); - vswap(); - c2 = is_fconst(); - x=0xEE000100; -#if LDOUBLE_SIZE == 8 - if ((vtop->type.t & VT_BTYPE) != VT_FLOAT) - x|=0x80; -#else - if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) - x|=0x80; - else if ((vtop->type.t & VT_BTYPE) == VT_LDOUBLE) - x|=0x80000; -#endif - switch(op) - { - case '+': - if(!c2) { - vswap(); - c2=c1; - } - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - if(c2) { - if(c2>0xf) - x|=0x200000; // suf - r2=c2&0xf; - } else { - r2=fpr(gv(RC_FLOAT)); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - } -#endif - } - break; - case '-': - if(c2) { - if(c2<=0xf) - x|=0x200000; // suf - r2=c2&0xf; - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - } else if(c1 && c1<=0xf) { - x|=0x300000; // rsf - r2=c1; - r=fpr(gv(RC_FLOAT)); - vswap(); - } else { - x|=0x200000; // suf - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - r2=fpr(gv(RC_FLOAT)); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - } -#endif - } - break; - case '*': - if(!c2 || c2>0xf) { - vswap(); - c2=c1; - } - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - if(c2 && c2<=0xf) - r2=c2; - else { - r2=fpr(gv(RC_FLOAT)); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - } -#endif - } - x|=0x100000; // muf - break; - case '/': - if(c2 && c2<=0xf) { - x|=0x400000; // dvf - r2=c2; - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - } else if(c1 && c1<=0xf) { - x|=0x500000; // rdf - r2=c1; - r=fpr(gv(RC_FLOAT)); - vswap(); - } else { - x|=0x400000; // dvf - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - r2=fpr(gv(RC_FLOAT)); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - } -#endif - } - break; - default: - if(op >= TOK_ULT && op <= TOK_GT) { - x|=0xd0f110; // cmfe -/* bug (intention?) in Linux FPU emulator - doesn't set carry if equal */ - switch(op) { - case TOK_ULT: - case TOK_UGE: - case TOK_ULE: - case TOK_UGT: - tcc_error("unsigned comparison on floats?"); - break; - case TOK_LT: - op=TOK_Nset; - break; - case TOK_LE: - op=TOK_ULE; /* correct in unordered case only if AC bit in FPSR set */ - break; - case TOK_EQ: - case TOK_NE: - x&=~0x400000; // cmfe -> cmf - break; - } - if(c1 && !c2) { - c2=c1; - vswap(); - switch(op) { - case TOK_Nset: - op=TOK_GT; - break; - case TOK_GE: - op=TOK_ULE; - break; - case TOK_ULE: - op=TOK_GE; - break; - case TOK_GT: - op=TOK_Nset; - break; - } - } - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - if(c2) { - if(c2>0xf) - x|=0x200000; - r2=c2&0xf; - } else { - r2=fpr(gv(RC_FLOAT)); -#ifdef CONFIG_TCC_BCHECK - if ((vtop[-1].r & VT_VALMASK) >= VT_CONST) { - vswap(); - r=fpr(gv(RC_FLOAT)); - vswap(); - } -#endif - } - --vtop; - vset_VT_CMP(op); - ++vtop; - } else { - tcc_error("unknown fp op %x!",op); - return; - } - } - if(vtop[-1].r == VT_CMP) - c1=15; - else { - c1=vtop->r; - if(r2&0x8) - c1=vtop[-1].r; - vtop[-1].r=get_reg_ex(RC_FLOAT,two2mask(vtop[-1].r,c1)); - c1=fpr(vtop[-1].r); - } - vtop--; - o(x|(r<<16)|(c1<<12)|r2); -} -#endif - -/* convert integers to fp 't' type. Must handle 'int', 'unsigned int' - and 'long long' cases. */ -ST_FUNC void gen_cvt_itof(int t) -{ - uint32_t r, r2; - int bt; - bt=vtop->type.t & VT_BTYPE; - if(bt == VT_INT || bt == VT_SHORT || bt == VT_BYTE) { -#ifndef TCC_ARM_VFP - uint32_t dsize = 0; -#endif - r=intr(gv(RC_INT)); -#ifdef TCC_ARM_VFP - r2=vfpr(vtop->r=get_reg(RC_FLOAT)); - o(0xEE000A10|(r<<12)|(r2<<16)); /* fmsr */ - r2|=r2<<12; - if(!(vtop->type.t & VT_UNSIGNED)) - r2|=0x80; /* fuitoX -> fsituX */ - o(0xEEB80A40|r2|T2CPR(t)); /* fYitoX*/ -#else - r2=fpr(vtop->r=get_reg(RC_FLOAT)); - if((t & VT_BTYPE) != VT_FLOAT) - dsize=0x80; /* flts -> fltd */ - o(0xEE000110|dsize|(r2<<16)|(r<<12)); /* flts */ - if((vtop->type.t & (VT_UNSIGNED|VT_BTYPE)) == (VT_UNSIGNED|VT_INT)) { - uint32_t off = 0; - o(0xE3500000|(r<<12)); /* cmp */ - r=fpr(get_reg(RC_FLOAT)); - if(last_itod_magic) { - off=ind+8-last_itod_magic; - off/=4; - if(off>255) - off=0; - } - o(0xBD1F0100|(r<<12)|off); /* ldflts */ - if(!off) { - o(0xEA000000); /* b */ - last_itod_magic=ind; - o(0x4F800000); /* 4294967296.0f */ - } - o(0xBE000100|dsize|(r2<<16)|(r2<<12)|r); /* adflt */ - } -#endif - return; - } else if(bt == VT_LLONG) { - int func; - CType *func_type = 0; - if((t & VT_BTYPE) == VT_FLOAT) { - func_type = &func_float_type; - if(vtop->type.t & VT_UNSIGNED) - func=TOK___floatundisf; - else - func=TOK___floatdisf; -#if LDOUBLE_SIZE != 8 - } else if((t & VT_BTYPE) == VT_LDOUBLE) { - func_type = &func_ldouble_type; - if(vtop->type.t & VT_UNSIGNED) - func=TOK___floatundixf; - else - func=TOK___floatdixf; - } else if((t & VT_BTYPE) == VT_DOUBLE) { -#else - } else if((t & VT_BTYPE) == VT_DOUBLE || (t & VT_BTYPE) == VT_LDOUBLE) { -#endif - func_type = &func_double_type; - if(vtop->type.t & VT_UNSIGNED) - func=TOK___floatundidf; - else - func=TOK___floatdidf; - } - if(func_type) { - vpushsym(func_type, external_helper_sym(func)); - vswap(); - gfunc_call(1); - vpushi(0); - vtop->r=TREG_F0; - return; - } - } - tcc_error("unimplemented gen_cvt_itof %x!",vtop->type.t); -} - -/* convert fp to int 't' type */ -void gen_cvt_ftoi(int t) -{ - uint32_t r, r2; - int u, func = 0; - u=t&VT_UNSIGNED; - t&=VT_BTYPE; - r2=vtop->type.t & VT_BTYPE; - if(t==VT_INT) { -#ifdef TCC_ARM_VFP - r=vfpr(gv(RC_FLOAT)); - u=u?0:0x10000; - o(0xEEBC0AC0|(r<<12)|r|T2CPR(r2)|u); /* ftoXizY */ - r2=intr(vtop->r=get_reg(RC_INT)); - o(0xEE100A10|(r<<16)|(r2<<12)); - return; -#else - if(u) { - if(r2 == VT_FLOAT) - func=TOK___fixunssfsi; -#if LDOUBLE_SIZE != 8 - else if(r2 == VT_LDOUBLE) - func=TOK___fixunsxfsi; - else if(r2 == VT_DOUBLE) -#else - else if(r2 == VT_LDOUBLE || r2 == VT_DOUBLE) -#endif - func=TOK___fixunsdfsi; - } else { - r=fpr(gv(RC_FLOAT)); - r2=intr(vtop->r=get_reg(RC_INT)); - o(0xEE100170|(r2<<12)|r); - return; - } -#endif - } else if(t == VT_LLONG) { // unsigned handled in gen_cvt_ftoi1 - if(r2 == VT_FLOAT) - func=TOK___fixsfdi; -#if LDOUBLE_SIZE != 8 - else if(r2 == VT_LDOUBLE) - func=TOK___fixxfdi; - else if(r2 == VT_DOUBLE) -#else - else if(r2 == VT_LDOUBLE || r2 == VT_DOUBLE) -#endif - func=TOK___fixdfdi; - } - if(func) { - vpush_helper_func(func); - vswap(); - gfunc_call(1); - vpushi(0); - if(t == VT_LLONG) - vtop->r2 = REG_IRE2; - vtop->r = REG_IRET; - return; - } - tcc_error("unimplemented gen_cvt_ftoi!"); -} - -/* convert from one floating point type to another */ -void gen_cvt_ftof(int t) -{ -#ifdef TCC_ARM_VFP - if(((vtop->type.t & VT_BTYPE) == VT_FLOAT) != ((t & VT_BTYPE) == VT_FLOAT)) { - uint32_t r = vfpr(gv(RC_FLOAT)); - o(0xEEB70AC0|(r<<12)|r|T2CPR(vtop->type.t)); - } -#else - /* all we have to do on i386 and FPA ARM is to put the float in a register */ - gv(RC_FLOAT); -#endif -} - -/* increment tcov counter */ -ST_FUNC void gen_increment_tcov (SValue *sv) -{ - int r1, r2; - - vpushv(sv); - vtop->r = r1 = get_reg(RC_INT); - r2 = get_reg(RC_INT); - o(0xE59F0000 | (intr(r1)<<12)); // ldr r1,[pc] - o(0xEA000000); // b $+4 - greloc(cur_text_section, sv->sym, ind, R_ARM_REL32); - o(-12); - o(0xe080000f | (intr(r1)<<16) | (intr(r1)<<12)); // add r1,r1,pc - o(0xe5900000 | (intr(r1)<<16) | (intr(r2)<<12)); // ldr r2, [r1] - o(0xe2900001 | (intr(r2)<<16) | (intr(r2)<<12)); // adds r2, r2, #1 - o(0xe5800000 | (intr(r1)<<16) | (intr(r2)<<12)); // str r2, [r1] - o(0xe2800004 | (intr(r1)<<16) | (intr(r1)<<12)); // add r1, r1, #4 - o(0xe5900000 | (intr(r1)<<16) | (intr(r2)<<12)); // ldr r2, [r1] - o(0xe2a00000 | (intr(r2)<<16) | (intr(r2)<<12)); // adc r2, r2, #0 - o(0xe5800000 | (intr(r1)<<16) | (intr(r2)<<12)); // str r2, [r1] - vpop(); -} - -/* computed goto support */ -void ggoto(void) -{ - gcall_or_jmp(1); - vtop--; -} - -/* Save the stack pointer onto the stack and return the location of its address */ -ST_FUNC void gen_vla_sp_save(int addr) { - SValue v; - v.type.t = VT_PTR; - v.r = VT_LOCAL | VT_LVAL; - v.c.i = addr; - store(TREG_SP, &v); -} - -/* Restore the SP from a location on the stack */ -ST_FUNC void gen_vla_sp_restore(int addr) { - SValue v; - v.type.t = VT_PTR; - v.r = VT_LOCAL | VT_LVAL; - v.c.i = addr; - load(TREG_SP, &v); -} - -/* Subtract from the stack pointer, and push the resulting value onto the stack */ -ST_FUNC void gen_vla_alloc(CType *type, int align) { - int r; -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) - vpushv(vtop); -#endif - r = intr(gv(RC_INT)); -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) - o(0xe2800001 | (r<<16)|(r<<12)); /* add r,r,#1 */ -#endif - o(0xE04D0000|(r<<12)|r); /* sub r, sp, r */ -#ifdef TCC_ARM_EABI - if (align < 8) - align = 8; -#else - if (align < 4) - align = 4; -#endif - if (align & (align - 1)) - tcc_error("alignment is not a power of 2: %i", align); - o(stuff_const(0xE3C0D000|(r<<16), align - 1)); /* bic sp, r, #align-1 */ - vpop(); -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) { - vpushi(0); - vtop->r = TREG_R0; - o(0xe1a0000d | (vtop->r << 12)); // mov r0,sp - vswap(); - vpush_helper_func(TOK___bound_new_region); - vrott(3); - gfunc_call(2); - func_bound_add_epilog = 1; - } -#endif -} - -/* end of ARM code generator */ -/*************************************************************/ -#endif -/*************************************************************/ diff --git a/arm-link.c b/arm-link.c deleted file mode 100644 index a7910f0f..00000000 --- a/arm-link.c +++ /dev/null @@ -1,444 +0,0 @@ -#ifdef TARGET_DEFS_ONLY - -#define EM_TCC_TARGET EM_ARM - -/* relocation type for 32 bit data relocation */ -#define R_DATA_32 R_ARM_ABS32 -#define R_DATA_PTR R_ARM_ABS32 -#define R_JMP_SLOT R_ARM_JUMP_SLOT -#define R_GLOB_DAT R_ARM_GLOB_DAT -#define R_COPY R_ARM_COPY -#define R_RELATIVE R_ARM_RELATIVE - -#define R_NUM R_ARM_NUM - -#define ELF_START_ADDR 0x00010000 -#define ELF_PAGE_SIZE 0x10000 - -#define PCRELATIVE_DLLPLT 1 -#define RELOCATE_DLLPLT 1 - -enum float_abi { - ARM_SOFTFP_FLOAT, - ARM_HARD_FLOAT, -}; - -#else /* !TARGET_DEFS_ONLY */ - -#include "tcc.h" - -#ifdef NEED_RELOC_TYPE -/* Returns 1 for a code relocation, 0 for a data relocation. For unknown - relocations, returns -1. */ -ST_FUNC int code_reloc (int reloc_type) -{ - switch (reloc_type) { - case R_ARM_MOVT_ABS: - case R_ARM_MOVW_ABS_NC: - case R_ARM_THM_MOVT_ABS: - case R_ARM_THM_MOVW_ABS_NC: - case R_ARM_ABS32: - case R_ARM_REL32: - case R_ARM_GOTPC: - case R_ARM_GOTOFF: - case R_ARM_GOT32: - case R_ARM_GOT_PREL: - case R_ARM_COPY: - case R_ARM_GLOB_DAT: - case R_ARM_NONE: - case R_ARM_TARGET1: - case R_ARM_MOVT_PREL: - case R_ARM_MOVW_PREL_NC: - return 0; - - case R_ARM_PC24: - case R_ARM_CALL: - case R_ARM_JUMP24: - case R_ARM_PLT32: - case R_ARM_THM_PC22: - case R_ARM_THM_JUMP24: - case R_ARM_PREL31: - case R_ARM_V4BX: - case R_ARM_JUMP_SLOT: - return 1; - } - return -1; -} - -/* Returns an enumerator to describe whether and when the relocation needs a - GOT and/or PLT entry to be created. See tcc.h for a description of the - different values. */ -ST_FUNC int gotplt_entry_type (int reloc_type) -{ - switch (reloc_type) { - case R_ARM_NONE: - case R_ARM_COPY: - case R_ARM_GLOB_DAT: - case R_ARM_JUMP_SLOT: - return NO_GOTPLT_ENTRY; - - case R_ARM_PC24: - case R_ARM_CALL: - case R_ARM_JUMP24: - case R_ARM_PLT32: - case R_ARM_THM_PC22: - case R_ARM_THM_JUMP24: - case R_ARM_MOVT_ABS: - case R_ARM_MOVW_ABS_NC: - case R_ARM_THM_MOVT_ABS: - case R_ARM_THM_MOVW_ABS_NC: - case R_ARM_PREL31: - case R_ARM_ABS32: - case R_ARM_REL32: - case R_ARM_V4BX: - case R_ARM_TARGET1: - case R_ARM_MOVT_PREL: - case R_ARM_MOVW_PREL_NC: - return AUTO_GOTPLT_ENTRY; - - case R_ARM_GOTPC: - case R_ARM_GOTOFF: - return BUILD_GOT_ONLY; - - case R_ARM_GOT32: - case R_ARM_GOT_PREL: - return ALWAYS_GOTPLT_ENTRY; - } - return -1; -} - -#ifdef NEED_BUILD_GOT -ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr) -{ - Section *plt = s1->plt; - uint8_t *p; - unsigned plt_offset; - - /* when building a DLL, GOT entry accesses must be done relative to - start of GOT (see x86_64 example above) */ - - /* empty PLT: create PLT0 entry that push address of call site and - jump to ld.so resolution routine (GOT + 8) */ - if (plt->data_offset == 0) { - p = section_ptr_add(plt, 20); - write32le(p, 0xe52de004); /* push {lr} */ - write32le(p+4, 0xe59fe004); /* ldr lr, [pc, #4] */ - write32le(p+8, 0xe08fe00e); /* add lr, pc, lr */ - write32le(p+12, 0xe5bef008); /* ldr pc, [lr, #8]! */ - /* p+16 is set in relocate_plt */ - } - plt_offset = plt->data_offset; - - if (attr->plt_thumb_stub) { - p = section_ptr_add(plt, 4); - write32le(p, 0x4778); /* bx pc */ - write32le(p+2, 0x46c0); /* nop */ - } - p = section_ptr_add(plt, 16); - /* save GOT offset for relocate_plt */ - write32le(p + 4, got_offset); - return plt_offset; -} - -/* relocate the PLT: compute addresses and offsets in the PLT now that final - address for PLT and GOT are known (see fill_program_header) */ -ST_FUNC void relocate_plt(TCCState *s1) -{ - uint8_t *p, *p_end; - - if (!s1->plt) - return; - - p = s1->plt->data; - p_end = p + s1->plt->data_offset; - - if (p < p_end) { - int x = s1->got->sh_addr - s1->plt->sh_addr - 12; - write32le(s1->plt->data + 16, x - 4); - p += 20; - while (p < p_end) { - unsigned off = x + read32le(p + 4) + (s1->plt->data - p) + 4; - if (read32le(p) == 0x46c04778) /* PLT Thumb stub present */ - p += 4; - write32le(p, 0xe28fc200 | ((off >> 28) & 0xf)); // add ip, pc, #0xN0000000 - write32le(p + 4, 0xe28cc600 | ((off >> 20) & 0xff)); // add ip, pc, #0xNN00000 - write32le(p + 8, 0xe28cca00 | ((off >> 12) & 0xff)); // add ip, ip, #0xNN000 - write32le(p + 12, 0xe5bcf000 | (off & 0xfff)); // ldr pc, [ip, #0xNNN]! - p += 16; - } - } - - if (s1->plt->reloc) { - ElfW_Rel *rel; - p = s1->got->data; - for_each_elem(s1->plt->reloc, 0, rel, ElfW_Rel) { - write32le(p + rel->r_offset, s1->plt->sh_addr); - } - } -} -#endif -#endif - -ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t addr, addr_t val) -{ - ElfW(Sym) *sym; - int sym_index, esym_index; - - sym_index = ELFW(R_SYM)(rel->r_info); - sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; - - switch(type) { - case R_ARM_PC24: - case R_ARM_CALL: - case R_ARM_JUMP24: - case R_ARM_PLT32: - { - int x, is_thumb, is_call, h, blx_avail, is_bl, th_ko; - x = (*(int *) ptr) & 0xffffff; -#ifdef DEBUG_RELOC - printf ("reloc %d: x=0x%x val=0x%x ", type, x, val); -#endif - (*(int *)ptr) &= 0xff000000; - if (x & 0x800000) - x -= 0x1000000; - x <<= 2; - blx_avail = (CONFIG_TCC_CPUVER >= 5); - is_thumb = val & 1; - is_bl = (*(unsigned *) ptr) >> 24 == 0xeb; - is_call = (type == R_ARM_CALL || (type == R_ARM_PC24 && is_bl)); - x += val - addr; -#ifdef DEBUG_RELOC - printf (" newx=0x%x name=%s\n", x, - (char *) symtab_section->link->data + sym->st_name); -#endif - h = x & 2; - th_ko = (x & 3) && (!blx_avail || !is_call); - if (th_ko || x >= 0x2000000 || x < -0x2000000) - tcc_error_noabort("can't relocate value at %x,%d",addr, type); - x >>= 2; - x &= 0xffffff; - /* Only reached if blx is avail and it is a call */ - if (is_thumb) { - x |= h << 24; - (*(int *)ptr) = 0xfa << 24; /* bl -> blx */ - } - (*(int *) ptr) |= x; - } - return; - /* Since these relocations only concern Thumb-2 and blx instruction was - introduced before Thumb-2, we can assume blx is available and not - guard its use */ - case R_ARM_THM_PC22: - case R_ARM_THM_JUMP24: - { - int x, hi, lo, s, j1, j2, i1, i2, imm10, imm11; - int to_thumb, is_call, to_plt, blx_bit = 1 << 12; - Section *plt; - - /* weak reference */ - if (sym->st_shndx == SHN_UNDEF && - ELFW(ST_BIND)(sym->st_info) == STB_WEAK) - return; - - /* Get initial offset */ - hi = (*(uint16_t *)ptr); - lo = (*(uint16_t *)(ptr+2)); - s = (hi >> 10) & 1; - j1 = (lo >> 13) & 1; - j2 = (lo >> 11) & 1; - i1 = (j1 ^ s) ^ 1; - i2 = (j2 ^ s) ^ 1; - imm10 = hi & 0x3ff; - imm11 = lo & 0x7ff; - x = (s << 24) | (i1 << 23) | (i2 << 22) | - (imm10 << 12) | (imm11 << 1); - if (x & 0x01000000) - x -= 0x02000000; - - /* Relocation infos */ - to_thumb = val & 1; - plt = s1->plt; - to_plt = (val >= plt->sh_addr) && - (val < plt->sh_addr + plt->data_offset); - is_call = (type == R_ARM_THM_PC22); - - if (!to_thumb && !to_plt && !is_call) { - int index; - uint8_t *p; - char *name, buf[1024]; - Section *text; - - name = (char *) symtab_section->link->data + sym->st_name; - text = s1->sections[sym->st_shndx]; - /* Modify reloc to target a thumb stub to switch to ARM */ - snprintf(buf, sizeof(buf), "%s_from_thumb", name); - index = put_elf_sym(symtab_section, - text->data_offset + 1, - sym->st_size, sym->st_info, 0, - sym->st_shndx, buf); - to_thumb = 1; - val = text->data_offset + 1; - rel->r_info = ELFW(R_INFO)(index, type); - /* Create a thumb stub function to switch to ARM mode */ - put_elf_reloc(symtab_section, text, - text->data_offset + 4, R_ARM_JUMP24, - sym_index); - p = section_ptr_add(text, 8); - write32le(p, 0x4778); /* bx pc */ - write32le(p+2, 0x46c0); /* nop */ - write32le(p+4, 0xeafffffe); /* b $sym */ - } - - /* Compute final offset */ - x += val - addr; - if (!to_thumb && is_call) { - blx_bit = 0; /* bl -> blx */ - x = (x + 3) & -4; /* Compute offset from aligned PC */ - } - - /* Check that relocation is possible - * offset must not be out of range - * if target is to be entered in arm mode: - - bit 1 must not set - - instruction must be a call (bl) or a jump to PLT */ - if (!to_thumb || x >= 0x1000000 || x < -0x1000000) - if (to_thumb || (val & 2) || (!is_call && !to_plt)) - tcc_error_noabort("can't relocate value at %x,%d",addr, type); - - /* Compute and store final offset */ - s = (x >> 24) & 1; - i1 = (x >> 23) & 1; - i2 = (x >> 22) & 1; - j1 = s ^ (i1 ^ 1); - j2 = s ^ (i2 ^ 1); - imm10 = (x >> 12) & 0x3ff; - imm11 = (x >> 1) & 0x7ff; - (*(uint16_t *)ptr) = (uint16_t) ((hi & 0xf800) | - (s << 10) | imm10); - (*(uint16_t *)(ptr+2)) = (uint16_t) ((lo & 0xc000) | - (j1 << 13) | blx_bit | (j2 << 11) | - imm11); - } - return; - case R_ARM_MOVT_ABS: - case R_ARM_MOVW_ABS_NC: - { - int x, imm4, imm12; - if (type == R_ARM_MOVT_ABS) - val >>= 16; - imm12 = val & 0xfff; - imm4 = (val >> 12) & 0xf; - x = (imm4 << 16) | imm12; - if (type == R_ARM_THM_MOVT_ABS) - *(int *)ptr |= x; - else - *(int *)ptr += x; - } - return; - case R_ARM_MOVT_PREL: - case R_ARM_MOVW_PREL_NC: - { - int insn = *(int *)ptr; - int addend = ((insn >> 4) & 0xf000) | (insn & 0xfff); - - addend = (addend ^ 0x8000) - 0x8000; - val += addend - addr; - if (type == R_ARM_MOVT_PREL) - val >>= 16; - *(int *)ptr = (insn & 0xfff0f000) | - ((val & 0xf000) << 4) | (val & 0xfff); - } - return; - case R_ARM_THM_MOVT_ABS: - case R_ARM_THM_MOVW_ABS_NC: - { - int x, i, imm4, imm3, imm8; - if (type == R_ARM_THM_MOVT_ABS) - val >>= 16; - imm8 = val & 0xff; - imm3 = (val >> 8) & 0x7; - i = (val >> 11) & 1; - imm4 = (val >> 12) & 0xf; - x = (imm3 << 28) | (imm8 << 16) | (i << 10) | imm4; - if (type == R_ARM_THM_MOVT_ABS) - *(int *)ptr |= x; - else - *(int *)ptr += x; - } - return; - case R_ARM_PREL31: - { - int x; - x = (*(int *)ptr) & 0x7fffffff; - (*(int *)ptr) &= 0x80000000; - x = (x * 2) / 2; - x += val - addr; - if((x^(x>>1))&0x40000000) - tcc_error_noabort("can't relocate value at %x,%d",addr, type); - (*(int *)ptr) |= x & 0x7fffffff; - } - return; - case R_ARM_ABS32: - case R_ARM_TARGET1: - if (s1->output_type & TCC_OUTPUT_DYN) { - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - qrel->r_offset = rel->r_offset; - if (esym_index) { - qrel->r_info = ELFW(R_INFO)(esym_index, R_ARM_ABS32); - qrel++; - return; - } else { - qrel->r_info = ELFW(R_INFO)(0, R_ARM_RELATIVE); - qrel++; - } - } - *(int *)ptr += val; - return; - case R_ARM_REL32: - *(int *)ptr += val - addr; - return; - case R_ARM_GOTPC: - *(int *)ptr += s1->got->sh_addr - addr; - return; - case R_ARM_GOTOFF: - *(int *)ptr += val - s1->got->sh_addr; - return; - case R_ARM_GOT32: - /* we load the got offset */ - *(int *)ptr += get_sym_attr(s1, sym_index, 0)->got_offset; - return; - case R_ARM_GOT_PREL: - /* we load the pc relative got offset */ - *(int *)ptr += s1->got->sh_addr + - get_sym_attr(s1, sym_index, 0)->got_offset - - addr; - return; - case R_ARM_COPY: - return; - case R_ARM_V4BX: - /* trade Thumb support for ARMv4 support */ - if ((0x0ffffff0 & *(int*)ptr) == 0x012FFF10) - *(int*)ptr ^= 0xE12FFF10 ^ 0xE1A0F000; /* BX Rm -> MOV PC, Rm */ - return; - case R_ARM_GLOB_DAT: - case R_ARM_JUMP_SLOT: - *(addr_t *)ptr = val; - return; - case R_ARM_NONE: - /* Nothing to do. Normally used to indicate a dependency - on a certain symbol (like for exception handling under EABI). */ - return; - case R_ARM_RELATIVE: -#ifdef TCC_TARGET_PE - add32le(ptr, val - s1->pe_imagebase); -#endif - /* do nothing */ - return; - default: - fprintf(stderr,"FIXME: handle reloc type %d at %x [%p] to %x\n", - type, (unsigned)addr, ptr, (unsigned)val); - return; - } -} - -#endif /* !TARGET_DEFS_ONLY */ diff --git a/arm-tok.h b/arm-tok.h deleted file mode 100644 index 297b1055..00000000 --- a/arm-tok.h +++ /dev/null @@ -1,383 +0,0 @@ -/* ------------------------------------------------------------------ */ -/* WARNING: relative order of tokens is important. */ - -/* register */ - - DEF_ASM(r0) - DEF_ASM(r1) - DEF_ASM(r2) - DEF_ASM(r3) - DEF_ASM(r4) - DEF_ASM(r5) - DEF_ASM(r6) - DEF_ASM(r7) - DEF_ASM(r8) - DEF_ASM(r9) - DEF_ASM(r10) - DEF_ASM(r11) /* fp */ - DEF_ASM(r12) /* ip[c] */ - DEF_ASM(r13) /* sp */ - DEF_ASM(r14) /* lr */ - DEF_ASM(r15) /* pc */ - -/* register macros */ - - DEF_ASM(fp) /* alias for r11 */ - DEF_ASM(ip) /* alias for r12 */ - DEF_ASM(sp) /* alias for r13 */ - DEF_ASM(lr) /* alias for r14 */ - DEF_ASM(pc) /* alias for r15 */ - - /* coprocessors */ - - DEF_ASM(p0) - DEF_ASM(p1) - DEF_ASM(p2) - DEF_ASM(p3) - DEF_ASM(p4) - DEF_ASM(p5) - DEF_ASM(p6) - DEF_ASM(p7) - DEF_ASM(p8) - DEF_ASM(p9) - DEF_ASM(p10) - DEF_ASM(p11) - DEF_ASM(p12) - DEF_ASM(p13) - DEF_ASM(p14) - DEF_ASM(p15) - - /* coprocessor registers */ - - DEF_ASM(c0) - DEF_ASM(c1) - DEF_ASM(c2) - DEF_ASM(c3) - DEF_ASM(c4) - DEF_ASM(c5) - DEF_ASM(c6) - DEF_ASM(c7) - DEF_ASM(c8) - DEF_ASM(c9) - DEF_ASM(c10) - DEF_ASM(c11) - DEF_ASM(c12) - DEF_ASM(c13) - DEF_ASM(c14) - DEF_ASM(c15) - - /* single-precision VFP registers */ - - DEF_ASM(s0) - DEF_ASM(s1) - DEF_ASM(s2) - DEF_ASM(s3) - DEF_ASM(s4) - DEF_ASM(s5) - DEF_ASM(s6) - DEF_ASM(s7) - DEF_ASM(s8) - DEF_ASM(s9) - DEF_ASM(s10) - DEF_ASM(s11) - DEF_ASM(s12) - DEF_ASM(s13) - DEF_ASM(s14) - DEF_ASM(s15) - DEF_ASM(s16) - DEF_ASM(s17) - DEF_ASM(s18) - DEF_ASM(s19) - DEF_ASM(s20) - DEF_ASM(s21) - DEF_ASM(s22) - DEF_ASM(s23) - DEF_ASM(s24) - DEF_ASM(s25) - DEF_ASM(s26) - DEF_ASM(s27) - DEF_ASM(s28) - DEF_ASM(s29) - DEF_ASM(s30) - DEF_ASM(s31) - - /* double-precision VFP registers */ - - DEF_ASM(d0) - DEF_ASM(d1) - DEF_ASM(d2) - DEF_ASM(d3) - DEF_ASM(d4) - DEF_ASM(d5) - DEF_ASM(d6) - DEF_ASM(d7) - DEF_ASM(d8) - DEF_ASM(d9) - DEF_ASM(d10) - DEF_ASM(d11) - DEF_ASM(d12) - DEF_ASM(d13) - DEF_ASM(d14) - DEF_ASM(d15) - - /* VFP status registers */ - - DEF_ASM(fpsid) - DEF_ASM(fpscr) - DEF_ASM(fpexc) - - /* VFP magical ARM register */ - - DEF_ASM(apsr_nzcv) - - /* data processing directives */ - - DEF_ASM(asl) - - /* instructions that have no condition code */ - - DEF_ASM(cdp2) - DEF_ASM(ldc2) - DEF_ASM(ldc2l) - DEF_ASM(stc2) - DEF_ASM(stc2l) - -#define ARM_INSTRUCTION_GROUP(tok) ((((tok) - TOK_ASM_nopeq) & 0xFFFFFFF0) + TOK_ASM_nopeq) - -/* Note: condition code is 4 bits */ -#define DEF_ASM_CONDED(x) \ - DEF(TOK_ASM_ ## x ## eq, #x "eq") \ - DEF(TOK_ASM_ ## x ## ne, #x "ne") \ - DEF(TOK_ASM_ ## x ## cs, #x "cs") \ - DEF(TOK_ASM_ ## x ## cc, #x "cc") \ - DEF(TOK_ASM_ ## x ## mi, #x "mi") \ - DEF(TOK_ASM_ ## x ## pl, #x "pl") \ - DEF(TOK_ASM_ ## x ## vs, #x "vs") \ - DEF(TOK_ASM_ ## x ## vc, #x "vc") \ - DEF(TOK_ASM_ ## x ## hi, #x "hi") \ - DEF(TOK_ASM_ ## x ## ls, #x "ls") \ - DEF(TOK_ASM_ ## x ## ge, #x "ge") \ - DEF(TOK_ASM_ ## x ## lt, #x "lt") \ - DEF(TOK_ASM_ ## x ## gt, #x "gt") \ - DEF(TOK_ASM_ ## x ## le, #x "le") \ - DEF(TOK_ASM_ ## x, #x) \ - DEF(TOK_ASM_ ## x ## rsvd, #x "rsvd") - -/* Note: condition code is 4 bits */ -#define DEF_ASM_CONDED_WITH_SUFFIX(x, y) \ - DEF(TOK_ASM_ ## x ## eq ## _ ## y, #x "eq." #y) \ - DEF(TOK_ASM_ ## x ## ne ## _ ## y, #x "ne." #y) \ - DEF(TOK_ASM_ ## x ## cs ## _ ## y, #x "cs." #y) \ - DEF(TOK_ASM_ ## x ## cc ## _ ## y, #x "cc." #y) \ - DEF(TOK_ASM_ ## x ## mi ## _ ## y, #x "mi." #y) \ - DEF(TOK_ASM_ ## x ## pl ## _ ## y, #x "pl." #y) \ - DEF(TOK_ASM_ ## x ## vs ## _ ## y, #x "vs." #y) \ - DEF(TOK_ASM_ ## x ## vc ## _ ## y, #x "vc." #y) \ - DEF(TOK_ASM_ ## x ## hi ## _ ## y, #x "hi." #y) \ - DEF(TOK_ASM_ ## x ## ls ## _ ## y, #x "ls." #y) \ - DEF(TOK_ASM_ ## x ## ge ## _ ## y, #x "ge." #y) \ - DEF(TOK_ASM_ ## x ## lt ## _ ## y, #x "lt." #y) \ - DEF(TOK_ASM_ ## x ## gt ## _ ## y, #x "gt." #y) \ - DEF(TOK_ASM_ ## x ## le ## _ ## y, #x "le." #y) \ - DEF(TOK_ASM_ ## x ## _ ## y, #x "." #y) \ - DEF(TOK_ASM_ ## x ## rsvd ## _ ## y, #x "rsvd." #y) - -#define DEF_ASM_CONDED_VFP_F32_F64(x) \ - DEF_ASM_CONDED_WITH_SUFFIX(x, f32) \ - DEF_ASM_CONDED_WITH_SUFFIX(x, f64) - -#define DEF_ASM_CONDED_WITH_TWO_SUFFIXES(x, y, z) \ - DEF(TOK_ASM_ ## x ## eq ## _ ## y ## _ ## z, #x "eq." #y "." #z) \ - DEF(TOK_ASM_ ## x ## ne ## _ ## y ## _ ## z, #x "ne." #y "." #z) \ - DEF(TOK_ASM_ ## x ## cs ## _ ## y ## _ ## z, #x "cs." #y "." #z) \ - DEF(TOK_ASM_ ## x ## cc ## _ ## y ## _ ## z, #x "cc." #y "." #z) \ - DEF(TOK_ASM_ ## x ## mi ## _ ## y ## _ ## z, #x "mi." #y "." #z) \ - DEF(TOK_ASM_ ## x ## pl ## _ ## y ## _ ## z, #x "pl." #y "." #z) \ - DEF(TOK_ASM_ ## x ## vs ## _ ## y ## _ ## z, #x "vs." #y "." #z) \ - DEF(TOK_ASM_ ## x ## vc ## _ ## y ## _ ## z, #x "vc." #y "." #z) \ - DEF(TOK_ASM_ ## x ## hi ## _ ## y ## _ ## z, #x "hi." #y "." #z) \ - DEF(TOK_ASM_ ## x ## ls ## _ ## y ## _ ## z, #x "ls." #y "." #z) \ - DEF(TOK_ASM_ ## x ## ge ## _ ## y ## _ ## z, #x "ge." #y "." #z) \ - DEF(TOK_ASM_ ## x ## lt ## _ ## y ## _ ## z, #x "lt." #y "." #z) \ - DEF(TOK_ASM_ ## x ## gt ## _ ## y ## _ ## z, #x "gt." #y "." #z) \ - DEF(TOK_ASM_ ## x ## le ## _ ## y ## _ ## z, #x "le." #y "." #z) \ - DEF(TOK_ASM_ ## x ## _ ## y ## _ ## z, #x "." #y "." #z) \ - DEF(TOK_ASM_ ## x ## rsvd ## _ ## y ## _ ## z, #x "rsvd." #y "." #z) - -/* Note: add new tokens after nop (MUST always use DEF_ASM_CONDED) */ - - DEF_ASM_CONDED(nop) - DEF_ASM_CONDED(wfe) - DEF_ASM_CONDED(wfi) - DEF_ASM_CONDED(swi) - DEF_ASM_CONDED(svc) - - /* misc */ - DEF_ASM_CONDED(clz) - - /* size conversion */ - - DEF_ASM_CONDED(sxtb) - DEF_ASM_CONDED(sxth) - DEF_ASM_CONDED(uxtb) - DEF_ASM_CONDED(uxth) - DEF_ASM_CONDED(movt) - DEF_ASM_CONDED(movw) - - /* multiplication */ - - DEF_ASM_CONDED(mul) - DEF_ASM_CONDED(muls) - DEF_ASM_CONDED(mla) - DEF_ASM_CONDED(mlas) - DEF_ASM_CONDED(smull) - DEF_ASM_CONDED(smulls) - DEF_ASM_CONDED(umull) - DEF_ASM_CONDED(umulls) - DEF_ASM_CONDED(smlal) - DEF_ASM_CONDED(smlals) - DEF_ASM_CONDED(umlal) - DEF_ASM_CONDED(umlals) - - /* load/store */ - - DEF_ASM_CONDED(ldr) - DEF_ASM_CONDED(ldrb) - DEF_ASM_CONDED(str) - DEF_ASM_CONDED(strb) - DEF_ASM_CONDED(ldrex) - DEF_ASM_CONDED(ldrexb) - DEF_ASM_CONDED(strex) - DEF_ASM_CONDED(strexb) - DEF_ASM_CONDED(ldrh) - DEF_ASM_CONDED(ldrsh) - DEF_ASM_CONDED(ldrsb) - DEF_ASM_CONDED(strh) - - DEF_ASM_CONDED(stmda) - DEF_ASM_CONDED(ldmda) - DEF_ASM_CONDED(stm) - DEF_ASM_CONDED(ldm) - DEF_ASM_CONDED(stmia) - DEF_ASM_CONDED(ldmia) - DEF_ASM_CONDED(stmdb) - DEF_ASM_CONDED(ldmdb) - DEF_ASM_CONDED(stmib) - DEF_ASM_CONDED(ldmib) - - DEF_ASM_CONDED(ldc) - DEF_ASM_CONDED(ldcl) - DEF_ASM_CONDED(stc) - DEF_ASM_CONDED(stcl) - - /* instruction macros */ - - DEF_ASM_CONDED(push) - DEF_ASM_CONDED(pop) - - /* branches */ - - DEF_ASM_CONDED(b) - DEF_ASM_CONDED(bl) - DEF_ASM_CONDED(bx) - DEF_ASM_CONDED(blx) - - /* data processing instructions; order is important */ - - DEF_ASM_CONDED(and) - DEF_ASM_CONDED(ands) - DEF_ASM_CONDED(eor) - DEF_ASM_CONDED(eors) - DEF_ASM_CONDED(sub) - DEF_ASM_CONDED(subs) - DEF_ASM_CONDED(rsb) - DEF_ASM_CONDED(rsbs) - DEF_ASM_CONDED(add) - DEF_ASM_CONDED(adds) - DEF_ASM_CONDED(adc) - DEF_ASM_CONDED(adcs) - DEF_ASM_CONDED(sbc) - DEF_ASM_CONDED(sbcs) - DEF_ASM_CONDED(rsc) - DEF_ASM_CONDED(rscs) - DEF_ASM_CONDED(tst) - DEF_ASM_CONDED(tsts) // necessary here--but not useful to the user - DEF_ASM_CONDED(teq) - DEF_ASM_CONDED(teqs) // necessary here--but not useful to the user - DEF_ASM_CONDED(cmp) - DEF_ASM_CONDED(cmps) // necessary here--but not useful to the user - DEF_ASM_CONDED(cmn) - DEF_ASM_CONDED(cmns) // necessary here--but not useful to the user - DEF_ASM_CONDED(orr) - DEF_ASM_CONDED(orrs) - DEF_ASM_CONDED(mov) - DEF_ASM_CONDED(movs) - DEF_ASM_CONDED(bic) - DEF_ASM_CONDED(bics) - DEF_ASM_CONDED(mvn) - DEF_ASM_CONDED(mvns) - - DEF_ASM_CONDED(lsl) - DEF_ASM_CONDED(lsls) - DEF_ASM_CONDED(lsr) - DEF_ASM_CONDED(lsrs) - DEF_ASM_CONDED(asr) - DEF_ASM_CONDED(asrs) - DEF_ASM_CONDED(ror) - DEF_ASM_CONDED(rors) - DEF_ASM_CONDED(rrx) - DEF_ASM_CONDED(rrxs) - - DEF_ASM_CONDED(cdp) - DEF_ASM_CONDED(mcr) - DEF_ASM_CONDED(mrc) - - // Floating point high-level instructions - - DEF_ASM_CONDED(vldr) - DEF_ASM_CONDED(vstr) - - DEF_ASM_CONDED_VFP_F32_F64(vmla) - DEF_ASM_CONDED_VFP_F32_F64(vmls) - DEF_ASM_CONDED_VFP_F32_F64(vnmls) - DEF_ASM_CONDED_VFP_F32_F64(vnmla) - DEF_ASM_CONDED_VFP_F32_F64(vmul) - DEF_ASM_CONDED_VFP_F32_F64(vnmul) - DEF_ASM_CONDED_VFP_F32_F64(vadd) - DEF_ASM_CONDED_VFP_F32_F64(vsub) - DEF_ASM_CONDED_VFP_F32_F64(vdiv) - DEF_ASM_CONDED_VFP_F32_F64(vneg) - DEF_ASM_CONDED_VFP_F32_F64(vabs) - DEF_ASM_CONDED_VFP_F32_F64(vsqrt) - DEF_ASM_CONDED_VFP_F32_F64(vcmp) - DEF_ASM_CONDED_VFP_F32_F64(vcmpe) - DEF_ASM_CONDED_VFP_F32_F64(vmov) - - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvtr, s32, f64) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvtr, s32, f32) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvtr, u32, f64) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvtr, u32, f32) - - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, s32, f64) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, s32, f32) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, u32, f64) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, u32, f32) - - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, f64, s32) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, f32, s32) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, f64, u32) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, f32, u32) - - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, f64, f32) - DEF_ASM_CONDED_WITH_TWO_SUFFIXES(vcvt, f32, f64) - - DEF_ASM_CONDED(vpush) - DEF_ASM_CONDED(vpop) - DEF_ASM_CONDED(vldm) - DEF_ASM_CONDED(vldmia) - DEF_ASM_CONDED(vldmdb) - DEF_ASM_CONDED(vstm) - DEF_ASM_CONDED(vstmia) - DEF_ASM_CONDED(vstmdb) - DEF_ASM_CONDED(vmsr) - DEF_ASM_CONDED(vmrs) diff --git a/arm64-asm.c b/arm64-asm.c deleted file mode 100644 index a97fd642..00000000 --- a/arm64-asm.c +++ /dev/null @@ -1,94 +0,0 @@ -/*************************************************************/ -/* - * ARM64 dummy assembler for TCC - * - */ - -#ifdef TARGET_DEFS_ONLY - -#define CONFIG_TCC_ASM -#define NB_ASM_REGS 16 - -ST_FUNC void g(int c); -ST_FUNC void gen_le16(int c); -ST_FUNC void gen_le32(int c); - -/*************************************************************/ -#else -/*************************************************************/ -#define USING_GLOBALS -#include "tcc.h" - -static void asm_error(void) -{ - tcc_error("ARM asm not implemented."); -} - -/* XXX: make it faster ? */ -ST_FUNC void g(int c) -{ - int ind1; - if (nocode_wanted) - return; - ind1 = ind + 1; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind] = c; - ind = ind1; -} - -ST_FUNC void gen_le16 (int i) -{ - g(i); - g(i>>8); -} - -ST_FUNC void gen_le32 (int i) -{ - gen_le16(i); - gen_le16(i>>16); -} - -ST_FUNC void gen_expr32(ExprValue *pe) -{ - gen_le32(pe->v); -} - -ST_FUNC void asm_opcode(TCCState *s1, int opcode) -{ - asm_error(); -} - -ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier) -{ - asm_error(); -} - -/* generate prolog and epilog code for asm statement */ -ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, - int nb_outputs, int is_output, - uint8_t *clobber_regs, - int out_reg) -{ -} - -ST_FUNC void asm_compute_constraints(ASMOperand *operands, - int nb_operands, int nb_outputs, - const uint8_t *clobber_regs, - int *pout_reg) -{ -} - -ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) -{ - asm_error(); -} - -ST_FUNC int asm_parse_regvar (int t) -{ - asm_error(); - return -1; -} - -/*************************************************************/ -#endif /* ndef TARGET_DEFS_ONLY */ diff --git a/arm64-gen.c b/arm64-gen.c deleted file mode 100644 index e314de58..00000000 --- a/arm64-gen.c +++ /dev/null @@ -1,2172 +0,0 @@ -/* - * A64 code generator for TCC - * - * Copyright (c) 2014-2015 Edmund Grimley Evans - * - * Copying and distribution of this file, with or without modification, - * are permitted in any medium without royalty provided the copyright - * notice and this notice are preserved. This file is offered as-is, - * without any warranty. - */ - -#ifdef TARGET_DEFS_ONLY - -// Number of registers available to allocator: -#define NB_REGS 28 // x0-x18, x30, v0-v7 - -#define TREG_R(x) (x) // x = 0..18 -#define TREG_R30 19 -#define TREG_F(x) (x + 20) // x = 0..7 - -// Register classes sorted from more general to more precise: -#define RC_INT (1 << 0) -#define RC_FLOAT (1 << 1) -#define RC_R(x) (1 << (2 + (x))) // x = 0..18 -#define RC_R30 (1 << 21) -#define RC_F(x) (1 << (22 + (x))) // x = 0..7 - -#define RC_IRET (RC_R(0)) // int return register class -#define RC_FRET (RC_F(0)) // float return register class - -#define REG_IRET (TREG_R(0)) // int return register number -#define REG_FRET (TREG_F(0)) // float return register number - -#define PTR_SIZE 8 - -#define LDOUBLE_SIZE 16 -#define LDOUBLE_ALIGN 16 - -#define MAX_ALIGN 16 - -#ifndef TCC_TARGET_MACHO -#define CHAR_IS_UNSIGNED -#endif - -/* define if return values need to be extended explicitely - at caller side (for interfacing with non-TCC compilers) */ -#define PROMOTE_RET -/******************************************************/ -#else /* ! TARGET_DEFS_ONLY */ -/******************************************************/ -#define USING_GLOBALS -#include "tcc.h" -#include - -ST_DATA const char * const target_machine_defs = - "__aarch64__\0" -#if defined(TCC_TARGET_MACHO) - "__arm64__\0" -#endif - "__AARCH64EL__\0" - ; - -ST_DATA const int reg_classes[NB_REGS] = { - RC_INT | RC_R(0), - RC_INT | RC_R(1), - RC_INT | RC_R(2), - RC_INT | RC_R(3), - RC_INT | RC_R(4), - RC_INT | RC_R(5), - RC_INT | RC_R(6), - RC_INT | RC_R(7), - RC_INT | RC_R(8), - RC_INT | RC_R(9), - RC_INT | RC_R(10), - RC_INT | RC_R(11), - RC_INT | RC_R(12), - RC_INT | RC_R(13), - RC_INT | RC_R(14), - RC_INT | RC_R(15), - RC_INT | RC_R(16), - RC_INT | RC_R(17), - RC_INT | RC_R(18), - RC_R30, // not in RC_INT as we make special use of x30 - RC_FLOAT | RC_F(0), - RC_FLOAT | RC_F(1), - RC_FLOAT | RC_F(2), - RC_FLOAT | RC_F(3), - RC_FLOAT | RC_F(4), - RC_FLOAT | RC_F(5), - RC_FLOAT | RC_F(6), - RC_FLOAT | RC_F(7) -}; - -#if defined(CONFIG_TCC_BCHECK) -static addr_t func_bound_offset; -static unsigned long func_bound_ind; -ST_DATA int func_bound_add_epilog; -#endif - -#define IS_FREG(x) ((x) >= TREG_F(0)) - -static uint32_t intr(int r) -{ - assert(TREG_R(0) <= r && r <= TREG_R30); - return r < TREG_R30 ? r : 30; -} - -static uint32_t fltr(int r) -{ - assert(TREG_F(0) <= r && r <= TREG_F(7)); - return r - TREG_F(0); -} - -// Add an instruction to text section: -ST_FUNC void o(unsigned int c) -{ - int ind1 = ind + 4; - if (nocode_wanted) - return; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - write32le(cur_text_section->data + ind, c); - ind = ind1; -} - -static int arm64_encode_bimm64(uint64_t x) -{ - int neg = x & 1; - int rep, pos, len; - - if (neg) - x = ~x; - if (!x) - return -1; - - if (x >> 2 == (x & (((uint64_t)1 << (64 - 2)) - 1))) - rep = 2, x &= ((uint64_t)1 << 2) - 1; - else if (x >> 4 == (x & (((uint64_t)1 << (64 - 4)) - 1))) - rep = 4, x &= ((uint64_t)1 << 4) - 1; - else if (x >> 8 == (x & (((uint64_t)1 << (64 - 8)) - 1))) - rep = 8, x &= ((uint64_t)1 << 8) - 1; - else if (x >> 16 == (x & (((uint64_t)1 << (64 - 16)) - 1))) - rep = 16, x &= ((uint64_t)1 << 16) - 1; - else if (x >> 32 == (x & (((uint64_t)1 << (64 - 32)) - 1))) - rep = 32, x &= ((uint64_t)1 << 32) - 1; - else - rep = 64; - - pos = 0; - if (!(x & (((uint64_t)1 << 32) - 1))) x >>= 32, pos += 32; - if (!(x & (((uint64_t)1 << 16) - 1))) x >>= 16, pos += 16; - if (!(x & (((uint64_t)1 << 8) - 1))) x >>= 8, pos += 8; - if (!(x & (((uint64_t)1 << 4) - 1))) x >>= 4, pos += 4; - if (!(x & (((uint64_t)1 << 2) - 1))) x >>= 2, pos += 2; - if (!(x & (((uint64_t)1 << 1) - 1))) x >>= 1, pos += 1; - - len = 0; - if (!(~x & (((uint64_t)1 << 32) - 1))) x >>= 32, len += 32; - if (!(~x & (((uint64_t)1 << 16) - 1))) x >>= 16, len += 16; - if (!(~x & (((uint64_t)1 << 8) - 1))) x >>= 8, len += 8; - if (!(~x & (((uint64_t)1 << 4) - 1))) x >>= 4, len += 4; - if (!(~x & (((uint64_t)1 << 2) - 1))) x >>= 2, len += 2; - if (!(~x & (((uint64_t)1 << 1) - 1))) x >>= 1, len += 1; - - if (x) - return -1; - if (neg) { - pos = (pos + len) & (rep - 1); - len = rep - len; - } - return ((0x1000 & rep << 6) | (((rep - 1) ^ 31) << 1 & 63) | - ((rep - pos) & (rep - 1)) << 6 | (len - 1)); -} - -static uint32_t arm64_movi(int r, uint64_t x) -{ - uint64_t m = 0xffff; - int e; - if (!(x & ~m)) - return 0x52800000 | r | x << 5; // movz w(r),#(x) - if (!(x & ~(m << 16))) - return 0x52a00000 | r | x >> 11; // movz w(r),#(x >> 16),lsl #16 - if (!(x & ~(m << 32))) - return 0xd2c00000 | r | x >> 27; // movz x(r),#(x >> 32),lsl #32 - if (!(x & ~(m << 48))) - return 0xd2e00000 | r | x >> 43; // movz x(r),#(x >> 48),lsl #48 - if ((x & ~m) == m << 16) - return (0x12800000 | r | - (~x << 5 & 0x1fffe0)); // movn w(r),#(~x) - if ((x & ~(m << 16)) == m) - return (0x12a00000 | r | - (~x >> 11 & 0x1fffe0)); // movn w(r),#(~x >> 16),lsl #16 - if (!~(x | m)) - return (0x92800000 | r | - (~x << 5 & 0x1fffe0)); // movn x(r),#(~x) - if (!~(x | m << 16)) - return (0x92a00000 | r | - (~x >> 11 & 0x1fffe0)); // movn x(r),#(~x >> 16),lsl #16 - if (!~(x | m << 32)) - return (0x92c00000 | r | - (~x >> 27 & 0x1fffe0)); // movn x(r),#(~x >> 32),lsl #32 - if (!~(x | m << 48)) - return (0x92e00000 | r | - (~x >> 43 & 0x1fffe0)); // movn x(r),#(~x >> 32),lsl #32 - if (!(x >> 32) && (e = arm64_encode_bimm64(x | x << 32)) >= 0) - return 0x320003e0 | r | (uint32_t)e << 10; // movi w(r),#(x) - if ((e = arm64_encode_bimm64(x)) >= 0) - return 0xb20003e0 | r | (uint32_t)e << 10; // movi x(r),#(x) - return 0; -} - -static void arm64_movimm(int r, uint64_t x) -{ - uint32_t i; - if ((i = arm64_movi(r, x))) - o(i); // a single MOV - else { - // MOVZ/MOVN and 1-3 MOVKs - int z = 0, m = 0; - uint32_t mov1 = 0xd2800000; // movz - uint64_t x1 = x; - for (i = 0; i < 64; i += 16) { - z += !(x >> i & 0xffff); - m += !(~x >> i & 0xffff); - } - if (m > z) { - x1 = ~x; - mov1 = 0x92800000; // movn - } - for (i = 0; i < 64; i += 16) - if (x1 >> i & 0xffff) { - o(mov1 | r | (x1 >> i & 0xffff) << 5 | i << 17); - // movz/movn x(r),#(*),lsl #(i) - break; - } - for (i += 16; i < 64; i += 16) - if (x1 >> i & 0xffff) - o(0xf2800000 | r | (x >> i & 0xffff) << 5 | i << 17); - // movk x(r),#(*),lsl #(i) - } -} - -// Patch all branches in list pointed to by t to branch to a: -ST_FUNC void gsym_addr(int t_, int a_) -{ - uint32_t t = t_; - uint32_t a = a_; - while (t) { - unsigned char *ptr = cur_text_section->data + t; - uint32_t next = read32le(ptr); - if (a - t + 0x8000000 >= 0x10000000) - tcc_error("branch out of range"); - write32le(ptr, (a - t == 4 ? 0xd503201f : // nop - 0x14000000 | ((a - t) >> 2 & 0x3ffffff))); // b - t = next; - } -} - -static int arm64_type_size(int t) -{ - /* - * case values are in increasing order (from 1 to 11). - * which 'may' help compiler optimizers. See tcc.h - */ - switch (t & VT_BTYPE) { - case VT_BYTE: return 0; - case VT_SHORT: return 1; - case VT_INT: return 2; - case VT_LLONG: return 3; - case VT_PTR: return 3; - case VT_FUNC: return 3; - case VT_STRUCT: return 3; - case VT_FLOAT: return 2; - case VT_DOUBLE: return 3; - case VT_LDOUBLE: return 4; - case VT_BOOL: return 0; - } - assert(0); - return 0; -} - -static void arm64_spoff(int reg, uint64_t off) -{ - uint32_t sub = off >> 63; - if (sub) - off = -off; - if (off < 4096) - o(0x910003e0 | sub << 30 | reg | off << 10); - // (add|sub) x(reg),sp,#(off) - else { - arm64_movimm(30, off); // use x30 for offset - o(0x8b3e63e0 | sub << 30 | reg); // (add|sub) x(reg),sp,x30 - } -} - -/* invert 0: return value to use for store/load */ -/* invert 1: return value to use for arm64_sym */ -static uint64_t arm64_check_offset(int invert, int sz_, uint64_t off) -{ - uint32_t sz = sz_; - if (!(off & ~((uint32_t)0xfff << sz)) || - (off < 256 || -off <= 256)) - return invert ? off : 0ul; - else if ((off & ((uint32_t)0xfff << sz))) - return invert ? off & ((uint32_t)0xfff << sz) - : off & ~((uint32_t)0xfff << sz); - else if (off & 0x1ff) - return invert ? off & 0x1ff : off & ~0x1ff; - else - return invert ? 0ul : off; -} - -static void arm64_ldrx(int sg, int sz_, int dst, int bas, uint64_t off) -{ - uint32_t sz = sz_; - if (sz >= 2) - sg = 0; - if (!(off & ~((uint32_t)0xfff << sz))) - o(0x39400000 | dst | bas << 5 | off << (10 - sz) | - (uint32_t)!!sg << 23 | sz << 30); // ldr(*) x(dst),[x(bas),#(off)] - else if (off < 256 || -off <= 256) - o(0x38400000 | dst | bas << 5 | (off & 511) << 12 | - (uint32_t)!!sg << 23 | sz << 30); // ldur(*) x(dst),[x(bas),#(off)] - else { - arm64_movimm(30, off); // use x30 for offset - o(0x38206800 | dst | bas << 5 | (uint32_t)30 << 16 | - (uint32_t)(!!sg + 1) << 22 | sz << 30); // ldr(*) x(dst),[x(bas),x30] - } -} - -static void arm64_ldrv(int sz_, int dst, int bas, uint64_t off) -{ - uint32_t sz = sz_; - if (!(off & ~((uint32_t)0xfff << sz))) - o(0x3d400000 | dst | bas << 5 | off << (10 - sz) | - (sz & 4) << 21 | (sz & 3) << 30); // ldr (s|d|q)(dst),[x(bas),#(off)] - else if (off < 256 || -off <= 256) - o(0x3c400000 | dst | bas << 5 | (off & 511) << 12 | - (sz & 4) << 21 | (sz & 3) << 30); // ldur (s|d|q)(dst),[x(bas),#(off)] - else { - arm64_movimm(30, off); // use x30 for offset - o(0x3c606800 | dst | bas << 5 | (uint32_t)30 << 16 | - sz << 30 | (sz & 4) << 21); // ldr (s|d|q)(dst),[x(bas),x30] - } -} - -static void arm64_ldrs(int reg_, int size) -{ - uint32_t reg = reg_; - // Use x30 for intermediate value in some cases. - switch (size) { - default: assert(0); break; - case 0: - /* Can happen with zero size structs */ - break; - case 1: - arm64_ldrx(0, 0, reg, reg, 0); - break; - case 2: - arm64_ldrx(0, 1, reg, reg, 0); - break; - case 3: - arm64_ldrx(0, 1, 30, reg, 0); - arm64_ldrx(0, 0, reg, reg, 2); - o(0x2a0043c0 | reg | reg << 16); // orr x(reg),x30,x(reg),lsl #16 - break; - case 4: - arm64_ldrx(0, 2, reg, reg, 0); - break; - case 5: - arm64_ldrx(0, 2, 30, reg, 0); - arm64_ldrx(0, 0, reg, reg, 4); - o(0xaa0083c0 | reg | reg << 16); // orr x(reg),x30,x(reg),lsl #32 - break; - case 6: - arm64_ldrx(0, 2, 30, reg, 0); - arm64_ldrx(0, 1, reg, reg, 4); - o(0xaa0083c0 | reg | reg << 16); // orr x(reg),x30,x(reg),lsl #32 - break; - case 7: - arm64_ldrx(0, 2, 30, reg, 0); - arm64_ldrx(0, 2, reg, reg, 3); - o(0x53087c00 | reg | reg << 5); // lsr w(reg), w(reg), #8 - o(0xaa0083c0 | reg | reg << 16); // orr x(reg),x30,x(reg),lsl #32 - break; - case 8: - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 9: - arm64_ldrx(0, 0, reg + 1, reg, 8); - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 10: - arm64_ldrx(0, 1, reg + 1, reg, 8); - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 11: - arm64_ldrx(0, 2, reg + 1, reg, 7); - o(0x53087c00 | (reg+1) | (reg+1) << 5); // lsr w(reg+1), w(reg+1), #8 - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 12: - arm64_ldrx(0, 2, reg + 1, reg, 8); - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 13: - arm64_ldrx(0, 3, reg + 1, reg, 5); - o(0xd358fc00 | (reg+1) | (reg+1) << 5); // lsr x(reg+1), x(reg+1), #24 - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 14: - arm64_ldrx(0, 3, reg + 1, reg, 6); - o(0xd350fc00 | (reg+1) | (reg+1) << 5); // lsr x(reg+1), x(reg+1), #16 - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 15: - arm64_ldrx(0, 3, reg + 1, reg, 7); - o(0xd348fc00 | (reg+1) | (reg+1) << 5); // lsr x(reg+1), x(reg+1), #8 - arm64_ldrx(0, 3, reg, reg, 0); - break; - case 16: - o(0xa9400000 | reg | (reg+1) << 10 | reg << 5); - // ldp x(reg),x(reg+1),[x(reg)] - break; - } -} - -static void arm64_strx(int sz_, int dst, int bas, uint64_t off) -{ - uint32_t sz = sz_; - if (!(off & ~((uint32_t)0xfff << sz))) - o(0x39000000 | dst | bas << 5 | off << (10 - sz) | sz << 30); - // str(*) x(dst),[x(bas],#(off)] - else if (off < 256 || -off <= 256) - o(0x38000000 | dst | bas << 5 | (off & 511) << 12 | sz << 30); - // stur(*) x(dst),[x(bas],#(off)] - else { - arm64_movimm(30, off); // use x30 for offset - o(0x38206800 | dst | bas << 5 | (uint32_t)30 << 16 | sz << 30); - // str(*) x(dst),[x(bas),x30] - } -} - -static void arm64_strv(int sz_, int dst, int bas, uint64_t off) -{ - uint32_t sz = sz_; - if (!(off & ~((uint32_t)0xfff << sz))) - o(0x3d000000 | dst | bas << 5 | off << (10 - sz) | - (sz & 4) << 21 | (sz & 3) << 30); // str (s|d|q)(dst),[x(bas),#(off)] - else if (off < 256 || -off <= 256) - o(0x3c000000 | dst | bas << 5 | (off & 511) << 12 | - (sz & 4) << 21 | (sz & 3) << 30); // stur (s|d|q)(dst),[x(bas),#(off)] - else { - arm64_movimm(30, off); // use x30 for offset - o(0x3c206800 | dst | bas << 5 | (uint32_t)30 << 16 | - sz << 30 | (sz & 4) << 21); // str (s|d|q)(dst),[x(bas),x30] - } -} - -static void arm64_sym(int r, Sym *sym, unsigned long addend) -{ - greloca(cur_text_section, sym, ind, R_AARCH64_ADR_GOT_PAGE, 0); - o(0x90000000 | r); // adrp xr, #sym - greloca(cur_text_section, sym, ind, R_AARCH64_LD64_GOT_LO12_NC, 0); - o(0xf9400000 | r | (r << 5)); // ld xr,[xr, #sym] - if (addend) { - // add xr, xr, #addend - if (addend & 0xffful) - o(0x91000000 | r | r << 5 | (addend & 0xfff) << 10); - if (addend > 0xffful) { - // add xr, xr, #addend, lsl #12 - if (addend & 0xfff000ul) - o(0x91400000 | r | r << 5 | ((addend >> 12) & 0xfff) << 10); - if (addend > 0xfffffful) { - /* very unlikely */ - int t = r ? 0 : 1; - o(0xf81f0fe0 | t); /* str xt, [sp, #-16]! */ - arm64_movimm(t, addend & ~0xfffffful); // use xt for addent - o(0x91000000 | r | (t << 5)); /* add xr, xt, #0 */ - o(0xf84107e0 | t); /* ldr xt, [sp], #16 */ - } - } - } -} - -static void arm64_load_cmp(int r, SValue *sv); - -ST_FUNC void load(int r, SValue *sv) -{ - int svtt = sv->type.t; - int svr = sv->r & ~(VT_BOUNDED | VT_NONCONST); - int svrv = svr & VT_VALMASK; - uint64_t svcul = (uint32_t)sv->c.i; - svcul = svcul >> 31 & 1 ? svcul - ((uint64_t)1 << 32) : svcul; - - if (svr == (VT_LOCAL | VT_LVAL)) { - if (IS_FREG(r)) - arm64_ldrv(arm64_type_size(svtt), fltr(r), 29, svcul); - else - arm64_ldrx(!(svtt & VT_UNSIGNED), arm64_type_size(svtt), - intr(r), 29, svcul); - return; - } - - if (svr == (VT_CONST | VT_LVAL)) { - if (sv->sym) - arm64_sym(30, sv->sym, // use x30 for address - arm64_check_offset(0, arm64_type_size(svtt), sv->c.i)); - else - arm64_movimm (30, sv->c.i); - if (IS_FREG(r)) - arm64_ldrv(arm64_type_size(svtt), fltr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), sv->c.i)); - else - arm64_ldrx(!(svtt&VT_UNSIGNED), arm64_type_size(svtt), intr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), sv->c.i)); - return; - } - - if ((svr & ~VT_VALMASK) == VT_LVAL && svrv < VT_CONST) { - if ((svtt & VT_BTYPE) != VT_VOID) { - if (IS_FREG(r)) - arm64_ldrv(arm64_type_size(svtt), fltr(r), intr(svrv), 0); - else - arm64_ldrx(!(svtt & VT_UNSIGNED), arm64_type_size(svtt), - intr(r), intr(svrv), 0); - } - return; - } - - if (svr == (VT_CONST | VT_LVAL | VT_SYM)) { - arm64_sym(30, sv->sym, // use x30 for address - arm64_check_offset(0, arm64_type_size(svtt), svcul)); - if (IS_FREG(r)) - arm64_ldrv(arm64_type_size(svtt), fltr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), svcul)); - else - arm64_ldrx(!(svtt&VT_UNSIGNED), arm64_type_size(svtt), intr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), svcul)); - return; - } - - if (svr == (VT_CONST | VT_SYM)) { - arm64_sym(intr(r), sv->sym, svcul); - return; - } - - if (svr == VT_CONST) { - if ((svtt & VT_BTYPE) != VT_VOID) - arm64_movimm(intr(r), arm64_type_size(svtt) == 3 ? - sv->c.i : (uint32_t)svcul); - return; - } - - if (svr < VT_CONST) { - if (IS_FREG(r) && IS_FREG(svr)) - if (svtt == VT_LDOUBLE) - o(0x4ea01c00 | fltr(r) | fltr(svr) << 5); - // mov v(r).16b,v(svr).16b - else - o(0x1e604000 | fltr(r) | fltr(svr) << 5); // fmov d(r),d(svr) - else if (!IS_FREG(r) && !IS_FREG(svr)) - o(0xaa0003e0 | intr(r) | intr(svr) << 16); // mov x(r),x(svr) - else - assert(0); - return; - } - - if (svr == VT_LOCAL) { - if (-svcul < 0x1000) - o(0xd10003a0 | intr(r) | -svcul << 10); // sub x(r),x29,#... - else { - arm64_movimm(30, -svcul); // use x30 for offset - o(0xcb0003a0 | intr(r) | (uint32_t)30 << 16); // sub x(r),x29,x30 - } - return; - } - - if (svr == VT_JMP || svr == VT_JMPI) { - int t = (svr == VT_JMPI); - arm64_movimm(intr(r), t); - o(0x14000002); // b .+8 - gsym(svcul); - arm64_movimm(intr(r), t ^ 1); - return; - } - - if (svr == (VT_LLOCAL | VT_LVAL)) { - arm64_ldrx(0, 3, 30, 29, svcul); // use x30 for offset - if (IS_FREG(r)) - arm64_ldrv(arm64_type_size(svtt), fltr(r), 30, 0); - else - arm64_ldrx(!(svtt & VT_UNSIGNED), arm64_type_size(svtt), - intr(r), 30, 0); - return; - } - - if (svr == VT_CMP) { - arm64_load_cmp(r, sv); - return; - } - - printf("load(%x, (%x, %x, %lx))\n", r, svtt, sv->r, (long)svcul); - assert(0); -} - -ST_FUNC void store(int r, SValue *sv) -{ - int svtt = sv->type.t; - int svr = sv->r & ~VT_BOUNDED; - int svrv = svr & VT_VALMASK; - uint64_t svcul = (uint32_t)sv->c.i; - svcul = svcul >> 31 & 1 ? svcul - ((uint64_t)1 << 32) : svcul; - - if (svr == (VT_LOCAL | VT_LVAL)) { - if (IS_FREG(r)) - arm64_strv(arm64_type_size(svtt), fltr(r), 29, svcul); - else - arm64_strx(arm64_type_size(svtt), intr(r), 29, svcul); - return; - } - - if (svr == (VT_CONST | VT_LVAL)) { - if (sv->sym) - arm64_sym(30, sv->sym, // use x30 for address - arm64_check_offset(0, arm64_type_size(svtt), sv->c.i)); - else - arm64_movimm (30, sv->c.i); - if (IS_FREG(r)) - arm64_strv(arm64_type_size(svtt), fltr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), sv->c.i)); - else - arm64_strx(arm64_type_size(svtt), intr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), sv->c.i)); - return; - } - - if ((svr & ~VT_VALMASK) == VT_LVAL && svrv < VT_CONST) { - if (IS_FREG(r)) - arm64_strv(arm64_type_size(svtt), fltr(r), intr(svrv), 0); - else - arm64_strx(arm64_type_size(svtt), intr(r), intr(svrv), 0); - return; - } - - if (svr == (VT_CONST | VT_LVAL | VT_SYM)) { - arm64_sym(30, sv->sym, // use x30 for address - arm64_check_offset(0, arm64_type_size(svtt), svcul)); - if (IS_FREG(r)) - arm64_strv(arm64_type_size(svtt), fltr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), svcul)); - else - arm64_strx(arm64_type_size(svtt), intr(r), 30, - arm64_check_offset(1, arm64_type_size(svtt), svcul)); - return; - } - - printf("store(%x, (%x, %x, %lx))\n", r, svtt, sv->r, (long)svcul); - assert(0); -} - -static void arm64_gen_bl_or_b(int b) -{ - if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST && (vtop->r & VT_SYM)) { - greloca(cur_text_section, vtop->sym, ind, - b ? R_AARCH64_JUMP26 : R_AARCH64_CALL26, 0); - o(0x14000000 | (uint32_t)!b << 31); // b/bl . - } - else { -#ifdef CONFIG_TCC_BCHECK - vtop->r &= ~VT_MUSTBOUND; -#endif - o(0xd61f0000 | (uint32_t)!b << 21 | intr(gv(RC_R30)) << 5); // br/blr - } -} - -#if defined(CONFIG_TCC_BCHECK) - -static void gen_bounds_call(int v) -{ - Sym *sym = external_helper_sym(v); - - greloca(cur_text_section, sym, ind, R_AARCH64_CALL26, 0); - o(0x94000000); // bl -} - -static void gen_bounds_prolog(void) -{ - /* leave some room for bound checking code */ - func_bound_offset = lbounds_section->data_offset; - func_bound_ind = ind; - func_bound_add_epilog = 0; - o(0xd503201f); /* nop -> mov x0, lbound section pointer */ - o(0xd503201f); - o(0xd503201f); - o(0xd503201f); /* nop -> call __bound_local_new */ -} - -static void gen_bounds_epilog(void) -{ - addr_t saved_ind; - addr_t *bounds_ptr; - Sym *sym_data; - int offset_modified = func_bound_offset != lbounds_section->data_offset; - - if (!offset_modified && !func_bound_add_epilog) - return; - - /* add end of table info */ - bounds_ptr = section_ptr_add(lbounds_section, sizeof(addr_t)); - *bounds_ptr = 0; - - sym_data = get_sym_ref(&char_pointer_type, lbounds_section, - func_bound_offset, PTR_SIZE); - - /* generate bound local allocation */ - if (offset_modified) { - saved_ind = ind; - ind = func_bound_ind; - greloca(cur_text_section, sym_data, ind, R_AARCH64_ADR_GOT_PAGE, 0); - o(0x90000000 | 0); // adrp x0, #sym_data - greloca(cur_text_section, sym_data, ind, R_AARCH64_LD64_GOT_LO12_NC, 0); - o(0xf9400000 | 0 | (0 << 5)); // ld x0,[x0, #sym_data] - gen_bounds_call(TOK___bound_local_new); - ind = saved_ind; - } - - /* generate bound check local freeing */ - o(0xa9bf07e0); /* stp x0, x1, [sp, #-16]! */ - o(0x3c9f0fe0); /* str q0, [sp, #-16]! */ - greloca(cur_text_section, sym_data, ind, R_AARCH64_ADR_GOT_PAGE, 0); - o(0x90000000 | 0); // adrp x0, #sym_data - greloca(cur_text_section, sym_data, ind, R_AARCH64_LD64_GOT_LO12_NC, 0); - o(0xf9400000 | 0 | (0 << 5)); // ld x0,[x0, #sym_data] - gen_bounds_call(TOK___bound_local_delete); - o(0x3cc107e0); /* ldr q0, [sp], #16 */ - o(0xa8c107e0); /* ldp x0, x1, [sp], #16 */ -} -#endif - -static int arm64_hfa_aux(CType *type, int *fsize, int num) -{ - if (is_float(type->t)) { - int a, n = type_size(type, &a); - if (num >= 4 || (*fsize && *fsize != n)) - return -1; - *fsize = n; - return num + 1; - } - else if ((type->t & VT_BTYPE) == VT_STRUCT) { - int is_struct = 0; // rather than union - Sym *field; - for (field = type->ref->next; field; field = field->next) - if (field->c) { - is_struct = 1; - break; - } - if (is_struct) { - int num0 = num; - for (field = type->ref->next; field; field = field->next) { - if (field->c != (num - num0) * *fsize) - return -1; - num = arm64_hfa_aux(&field->type, fsize, num); - if (num == -1) - return -1; - } - if (type->ref->c != (num - num0) * *fsize) - return -1; - return num; - } - else { // union - int num0 = num; - for (field = type->ref->next; field; field = field->next) { - int num1 = arm64_hfa_aux(&field->type, fsize, num0); - if (num1 == -1) - return -1; - num = num1 < num ? num : num1; - } - if (type->ref->c != (num - num0) * *fsize) - return -1; - return num; - } - } - else if ((type->t & VT_ARRAY) && ((type->t & VT_BTYPE) != VT_PTR)) { - int num1; - if (!type->ref->c) - return num; - num1 = arm64_hfa_aux(&type->ref->type, fsize, num); - if (num1 == -1 || (num1 != num && type->ref->c > 4)) - return -1; - num1 = num + type->ref->c * (num1 - num); - if (num1 > 4) - return -1; - return num1; - } - return -1; -} - -static int arm64_hfa(CType *type, unsigned *fsize) -{ - if ((type->t & VT_BTYPE) == VT_STRUCT || - ((type->t & VT_ARRAY) && ((type->t & VT_BTYPE) != VT_PTR))) { - int sz = 0; - int n = arm64_hfa_aux(type, &sz, 0); - if (0 < n && n <= 4) { - if (fsize) - *fsize = sz; - return n; - } - } - return 0; -} - -static unsigned long arm64_pcs_aux(int variadic, int n, CType **type, unsigned long *a) -{ - int nx = 0; // next integer register - int nv = 0; // next vector register - unsigned long ns = 32; // next stack offset - int i; - - for (i = 0; i < n; i++) { - int hfa = arm64_hfa(type[i], 0); - int size, align; - - if ((type[i]->t & VT_ARRAY) || - (type[i]->t & VT_BTYPE) == VT_FUNC) - size = align = 8; - else - size = type_size(type[i], &align); - -#if defined(TCC_TARGET_MACHO) - if (variadic && i == variadic) { - nx = 8; - nv = 8; - } -#endif - if (hfa) - // B.2 - ; - else if (size > 16) { - // B.3: replace with pointer - if (nx < 8) - a[i] = nx++ << 1 | 1; - else { - ns = (ns + 7) & ~7; - a[i] = ns | 1; - ns += 8; - } - continue; - } - else if ((type[i]->t & VT_BTYPE) == VT_STRUCT) - // B.4 - size = (size + 7) & ~7; - - // C.1 - if (is_float(type[i]->t) && nv < 8) { - a[i] = 16 + (nv++ << 1); - continue; - } - - // C.2 - if (hfa && nv + hfa <= 8) { - a[i] = 16 + (nv << 1); - nv += hfa; - continue; - } - - // C.3 - if (hfa) { - nv = 8; - size = (size + 7) & ~7; - } - - // C.4 - if (hfa || (type[i]->t & VT_BTYPE) == VT_LDOUBLE) { - ns = (ns + 7) & ~7; - ns = (ns + align - 1) & -align; - } - - // C.5 - if ((type[i]->t & VT_BTYPE) == VT_FLOAT) - size = 8; - - // C.6 - if (hfa || is_float(type[i]->t)) { - a[i] = ns; - ns += size; - continue; - } - - // C.7 - if ((type[i]->t & VT_BTYPE) != VT_STRUCT && size <= 8 && nx < 8) { - a[i] = nx++ << 1; - continue; - } - - // C.8 - if (align == 16) - nx = (nx + 1) & ~1; - - // C.9 - if ((type[i]->t & VT_BTYPE) != VT_STRUCT && size == 16 && nx < 7) { - a[i] = nx << 1; - nx += 2; - continue; - } - - // C.10 - if ((type[i]->t & VT_BTYPE) == VT_STRUCT && size <= (8 - nx) * 8) { - a[i] = nx << 1; - nx += (size + 7) >> 3; - continue; - } - - // C.11 - nx = 8; - - // C.12 - ns = (ns + 7) & ~7; - ns = (ns + align - 1) & -align; - - // C.13 - if ((type[i]->t & VT_BTYPE) == VT_STRUCT) { - a[i] = ns; - ns += size; - continue; - } - - // C.14 - if (size < 8) - size = 8; - - // C.15 - a[i] = ns; - ns += size; - } - - return ns - 32; -} - -static unsigned long arm64_pcs(int variadic, int n, CType **type, unsigned long *a) -{ - unsigned long stack; - - // Return type: - if ((type[0]->t & VT_BTYPE) == VT_VOID) - a[0] = -1; - else { - arm64_pcs_aux(0, 1, type, a); - assert(a[0] == 0 || a[0] == 1 || a[0] == 16); - } - - // Argument types: - stack = arm64_pcs_aux(variadic, n, type + 1, a + 1); - - if (0) { - int i; - for (i = 0; i <= n; i++) { - if (!i) - printf("arm64_pcs return: "); - else - printf("arm64_pcs arg %d: ", i); - if (a[i] == (unsigned long)-1) - printf("void\n"); - else if (a[i] == 1 && !i) - printf("X8 pointer\n"); - else if (a[i] < 16) - printf("X%lu%s\n", a[i] / 2, a[i] & 1 ? " pointer" : ""); - else if (a[i] < 32) - printf("V%lu\n", a[i] / 2 - 8); - else - printf("stack %lu%s\n", - (a[i] - 32) & ~1, a[i] & 1 ? " pointer" : ""); - } - } - - return stack; -} - -static int n_func_args(CType *type) -{ - int n_args = 0; - Sym *arg; - - for (arg = type->ref->next; arg; arg = arg->next) - n_args++; - return n_args; -} - -ST_FUNC void gfunc_call(int nb_args) -{ - CType *return_type; - CType **t; - unsigned long *a, *a1; - unsigned long stack; - int i; - int variadic = (vtop[-nb_args].type.ref->f.func_type == FUNC_ELLIPSIS); - int var_nb_arg = n_func_args(&vtop[-nb_args].type); - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gbound_args(nb_args); -#endif - - return_type = &vtop[-nb_args].type.ref->type; - if ((return_type->t & VT_BTYPE) == VT_STRUCT) - --nb_args; - - t = tcc_malloc((nb_args + 1) * sizeof(*t)); - a = tcc_malloc((nb_args + 1) * sizeof(*a)); - a1 = tcc_malloc((nb_args + 1) * sizeof(*a1)); - - t[0] = return_type; - for (i = 0; i < nb_args; i++) - t[nb_args - i] = &vtop[-i].type; - - stack = arm64_pcs(variadic ? var_nb_arg : 0, nb_args, t, a); - - // Allocate space for structs replaced by pointer: - for (i = nb_args; i; i--) - if (a[i] & 1) { - SValue *arg = &vtop[i - nb_args]; - int align, size = type_size(&arg->type, &align); - assert((arg->type.t & VT_BTYPE) == VT_STRUCT); - stack = (stack + align - 1) & -align; - a1[i] = stack; - stack += size; - } - - stack = (stack + 15) >> 4 << 4; - - /* fetch cpu flag before generating any code */ - if ((vtop->r & VT_VALMASK) == VT_CMP) - gv(RC_INT); - - if (stack >= 0x1000000) // 16Mb - tcc_error("stack size too big %lu", stack); - if (stack & 0xfff) - o(0xd10003ff | (stack & 0xfff) << 10); // sub sp,sp,#(n) - if (stack >> 12) - o(0xd14003ff | (stack >> 12) << 10); - - // First pass: set all values on stack - for (i = nb_args; i; i--) { - vpushv(vtop - nb_args + i); - - if (a[i] & 1) { - // struct replaced by pointer - int r = get_reg(RC_INT); - arm64_spoff(intr(r), a1[i]); - vset(&vtop->type, r | VT_LVAL, 0); - vswap(); - vstore(); - if (a[i] >= 32) { - // pointer on stack - r = get_reg(RC_INT); - arm64_spoff(intr(r), a1[i]); - arm64_strx(3, intr(r), 31, (a[i] - 32) >> 1 << 1); - } - } - else if (a[i] >= 32) { - // value on stack - if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) { - int r = get_reg(RC_INT); - arm64_spoff(intr(r), a[i] - 32); - vset(&vtop->type, r | VT_LVAL, 0); - vswap(); - vstore(); - } - else if (is_float(vtop->type.t)) { - gv(RC_FLOAT); - arm64_strv(arm64_type_size(vtop[0].type.t), - fltr(vtop[0].r), 31, a[i] - 32); - } - else { - gv(RC_INT); - arm64_strx(3, // arm64_type_size(vtop[0].type.t), - intr(vtop[0].r), 31, a[i] - 32); - } - } - - --vtop; - } - - // Second pass: assign values to registers - for (i = nb_args; i; i--, vtop--) { - if (a[i] < 16 && !(a[i] & 1)) { - // value in general-purpose registers - if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) { - int align, size = type_size(&vtop->type, &align); - if (size) { - vtop->type.t = VT_PTR; - gaddrof(); - gv(RC_R(a[i] / 2)); - arm64_ldrs(a[i] / 2, size); - } - } - else - gv(RC_R(a[i] / 2)); - } - else if (a[i] < 16) - // struct replaced by pointer in register - arm64_spoff(a[i] / 2, a1[i]); - else if (a[i] < 32) { - // value in floating-point registers - if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) { - uint32_t j, sz, n = arm64_hfa(&vtop->type, &sz); - vtop->type.t = VT_PTR; - gaddrof(); - gv(RC_R30); - for (j = 0; j < n; j++) - o(0x3d4003c0 | - (sz & 16) << 19 | -(sz & 8) << 27 | (sz & 4) << 29 | - (a[i] / 2 - 8 + j) | - j << 10); // ldr ([sdq])(*),[x30,#(j * sz)] - } - else - gv(RC_F(a[i] / 2 - 8)); - } - } - - if ((return_type->t & VT_BTYPE) == VT_STRUCT) { - if (a[0] == 1) { - // indirect return: set x8 and discard the stack value - gv(RC_R(8)); - --vtop; - } - else - // return in registers: keep the address for after the call - vswap(); - } - - save_regs(0); - arm64_gen_bl_or_b(0); - --vtop; - if (stack & 0xfff) - o(0x910003ff | (stack & 0xfff) << 10); // add sp,sp,#(n) - if (stack >> 12) - o(0x914003ff | (stack >> 12) << 10); - - { - int rt = return_type->t; - int bt = rt & VT_BTYPE; - if (bt == VT_STRUCT && !(a[0] & 1)) { - // A struct was returned in registers, so write it out: - gv(RC_R(8)); - --vtop; - if (a[0] == 0) { - int align, size = type_size(return_type, &align); - assert(size <= 16); - if (size > 8) - o(0xa9000500); // stp x0,x1,[x8] - else if (size) - arm64_strx(size > 4 ? 3 : size > 2 ? 2 : size > 1, 0, 8, 0); - - } - else if (a[0] == 16) { - uint32_t j, sz, n = arm64_hfa(return_type, &sz); - for (j = 0; j < n; j++) - o(0x3d000100 | - (sz & 16) << 19 | -(sz & 8) << 27 | (sz & 4) << 29 | - (a[i] / 2 - 8 + j) | - j << 10); // str ([sdq])(*),[x8,#(j * sz)] - } - } - } - - tcc_free(a1); - tcc_free(a); - tcc_free(t); -} - -static unsigned long arm64_func_va_list_stack; -static int arm64_func_va_list_gr_offs; -static int arm64_func_va_list_vr_offs; -static int arm64_func_sub_sp_offset; - -ST_FUNC void gfunc_prolog(Sym *func_sym) -{ - CType *func_type = &func_sym->type; - int n = 0; - int i = 0; - Sym *sym; - CType **t; - unsigned long *a; - int use_x8 = 0; - int last_int = 0; - int last_float = 0; - int variadic = func_sym->type.ref->f.func_type == FUNC_ELLIPSIS; - int var_nb_arg = n_func_args(&func_sym->type); - - func_vc = 144; // offset of where x8 is stored - - for (sym = func_type->ref; sym; sym = sym->next) - ++n; - t = n ? tcc_malloc(n * sizeof(*t)) : NULL; - a = n ? tcc_malloc(n * sizeof(*a)) : NULL; - - for (sym = func_type->ref; sym; sym = sym->next) - t[i++] = &sym->type; - - arm64_func_va_list_stack = arm64_pcs(variadic ? var_nb_arg : 0, n - 1, t, a); - -#if !defined(TCC_TARGET_MACHO) - if (variadic) { - use_x8 = 1; - last_int = 4; - last_float = 4; - } -#endif - if (a && a[0] == 1) - use_x8 = 1; - for (i = 1, sym = func_type->ref->next; sym; i++, sym = sym->next) { - if (a[i] < 16) { - int last, align, size = type_size(&sym->type, &align); - last = a[i] / 4 + 1 + (size - 1) / 8; - last_int = last > last_int ? last : last_int; - } - else if (a[i] < 32) { - int last, hfa = arm64_hfa(&sym->type, 0); - last = a[i] / 4 - 3 + (hfa ? hfa - 1 : 0); - last_float = last > last_float ? last : last_float; - } - } - - last_int = last_int > 4 ? 4 : last_int; - last_float = last_float > 4 ? 4 : last_float; - - o(0xa9b27bfd); // stp x29,x30,[sp,#-224]! - for (i = 0; i < last_float; i++) - // stp q0,q1,[sp,#16], stp q2,q3,[sp,#48] - // stp q4,q5,[sp,#80], stp q6,q7,[sp,#112] - o(0xad0087e0 + i * 0x10000 + (i << 11) + (i << 1)); - if (use_x8) - o(0xa90923e8); // stp x8,x8,[sp,#144] - for (i = 0; i < last_int; i++) - // stp x0,x1,[sp,#160], stp x2,x3,[sp,#176] - // stp x4,x5,[sp,#192], stp x6,x7,[sp,#208] - o(0xa90a07e0 + i * 0x10000 + (i << 11) + (i << 1)); - - arm64_func_va_list_gr_offs = -64; - arm64_func_va_list_vr_offs = -128; - - for (i = 1, sym = func_type->ref->next; sym; i++, sym = sym->next) { - int off = (a[i] < 16 ? 160 + a[i] / 2 * 8 : - a[i] < 32 ? 16 + (a[i] - 16) / 2 * 16 : - 224 + ((a[i] - 32) >> 1 << 1)); - sym_push(sym->v & ~SYM_FIELD, &sym->type, - (a[i] & 1 ? VT_LLOCAL : VT_LOCAL) | VT_LVAL, - off); - - if (a[i] < 16) { - int align, size = type_size(&sym->type, &align); - arm64_func_va_list_gr_offs = (a[i] / 2 - 7 + - (!(a[i] & 1) && size > 8)) * 8; - } - else if (a[i] < 32) { - uint32_t hfa = arm64_hfa(&sym->type, 0); - arm64_func_va_list_vr_offs = (a[i] / 2 - 16 + - (hfa ? hfa : 1)) * 16; - } - - // HFAs of float and double need to be written differently: - if (16 <= a[i] && a[i] < 32 && (sym->type.t & VT_BTYPE) == VT_STRUCT) { - uint32_t j, sz, k = arm64_hfa(&sym->type, &sz); - if (sz < 16) - for (j = 0; j < k; j++) { - o(0x3d0003e0 | -(sz & 8) << 27 | (sz & 4) << 29 | - ((a[i] - 16) / 2 + j) | (off / sz + j) << 10); - // str ([sdq])(*),[sp,#(j * sz)] - } - } - } - - tcc_free(a); - tcc_free(t); - - o(0x910003fd); // mov x29,sp - arm64_func_sub_sp_offset = ind; - // In gfunc_epilog these will be replaced with code to decrement SP: - o(0xd503201f); // nop - o(0xd503201f); // nop - loc = 0; -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_prolog(); -#endif -} - -ST_FUNC void gen_va_start(void) -{ - int r; - --vtop; // we don't need the "arg" - gaddrof(); - r = intr(gv(RC_INT)); - - if (arm64_func_va_list_stack) { - //xx could use add (immediate) here - arm64_movimm(30, arm64_func_va_list_stack + 224); - o(0x8b1e03be); // add x30,x29,x30 - } - else - o(0x910383be); // add x30,x29,#224 - o(0xf900001e | r << 5); // str x30,[x(r)] - -#if !defined(TCC_TARGET_MACHO) - if (arm64_func_va_list_gr_offs) { - if (arm64_func_va_list_stack) - o(0x910383be); // add x30,x29,#224 - o(0xf900041e | r << 5); // str x30,[x(r),#8] - } - - if (arm64_func_va_list_vr_offs) { - o(0x910243be); // add x30,x29,#144 - o(0xf900081e | r << 5); // str x30,[x(r),#16] - } - - arm64_movimm(30, arm64_func_va_list_gr_offs); - o(0xb900181e | r << 5); // str w30,[x(r),#24] - - arm64_movimm(30, arm64_func_va_list_vr_offs); - o(0xb9001c1e | r << 5); // str w30,[x(r),#28] -#endif - - --vtop; -} - -ST_FUNC void gen_va_arg(CType *t) -{ - int align, size = type_size(t, &align); - unsigned fsize, hfa = arm64_hfa(t, &fsize); - uint32_t r0, r1; - - if (is_float(t->t)) { - hfa = 1; - fsize = size; - } - - gaddrof(); - r0 = intr(gv(RC_INT)); - r1 = get_reg(RC_INT); - vtop[0].r = r1 | VT_LVAL; - r1 = intr(r1); - - if (!hfa) { - uint32_t n = size > 16 ? 8 : (size + 7) & -8; -#if !defined(TCC_TARGET_MACHO) - o(0xb940181e | r0 << 5); // ldr w30,[x(r0),#24] // __gr_offs - if (align == 16) { - assert(0); // this path untested but needed for __uint128_t - o(0x11003fde); // add w30,w30,#15 - o(0x121c6fde); // and w30,w30,#-16 - } - o(0x310003c0 | r1 | n << 10); // adds w(r1),w30,#(n) - o(0x540000ad); // b.le .+20 -#endif - o(0xf9400000 | r1 | r0 << 5); // ldr x(r1),[x(r0)] // __stack - o(0x9100001e | r1 << 5 | n << 10); // add x30,x(r1),#(n) - o(0xf900001e | r0 << 5); // str x30,[x(r0)] // __stack -#if !defined(TCC_TARGET_MACHO) - o(0x14000004); // b .+16 - o(0xb9001800 | r1 | r0 << 5); // str w(r1),[x(r0),#24] // __gr_offs - o(0xf9400400 | r1 | r0 << 5); // ldr x(r1),[x(r0),#8] // __gr_top - o(0x8b3ec000 | r1 | r1 << 5); // add x(r1),x(r1),w30,sxtw -#endif - if (size > 16) - o(0xf9400000 | r1 | r1 << 5); // ldr x(r1),[x(r1)] - } - else { - uint32_t ssz = (size + 7) & -(uint32_t)8; -#if !defined(TCC_TARGET_MACHO) - uint32_t rsz = hfa << 4; - uint32_t b1, b2; - o(0xb9401c1e | r0 << 5); // ldr w30,[x(r0),#28] // __vr_offs - o(0x310003c0 | r1 | rsz << 10); // adds w(r1),w30,#(rsz) - b1 = ind; o(0x5400000d); // b.le lab1 -#endif - o(0xf9400000 | r1 | r0 << 5); // ldr x(r1),[x(r0)] // __stack - if (fsize == 16) { - o(0x91003c00 | r1 | r1 << 5); // add x(r1),x(r1),#15 - o(0x927cec00 | r1 | r1 << 5); // and x(r1),x(r1),#-16 - } - o(0x9100001e | r1 << 5 | ssz << 10); // add x30,x(r1),#(ssz) - o(0xf900001e | r0 << 5); // str x30,[x(r0)] // __stack -#if !defined(TCC_TARGET_MACHO) - b2 = ind; o(0x14000000); // b lab2 - // lab1: - write32le(cur_text_section->data + b1, 0x5400000d | (ind - b1) << 3); - o(0xb9001c00 | r1 | r0 << 5); // str w(r1),[x(r0),#28] // __vr_offs - o(0xf9400800 | r1 | r0 << 5); // ldr x(r1),[x(r0),#16] // __vr_top - if (hfa == 1 || fsize == 16) - o(0x8b3ec000 | r1 | r1 << 5); // add x(r1),x(r1),w30,sxtw - else { - // We need to change the layout of this HFA. - // Get some space on the stack using global variable "loc": - loc = (loc - size) & -(uint32_t)align; - o(0x8b3ec000 | 30 | r1 << 5); // add x30,x(r1),w30,sxtw - arm64_movimm(r1, loc); - o(0x8b0003a0 | r1 | r1 << 16); // add x(r1),x29,x(r1) - o(0x4c402bdc | (uint32_t)fsize << 7 | - (uint32_t)(hfa == 2) << 15 | - (uint32_t)(hfa == 3) << 14); // ld1 {v28.(4s|2d),...},[x30] - o(0x0d00801c | r1 << 5 | (fsize == 8) << 10 | - (uint32_t)(hfa != 2) << 13 | - (uint32_t)(hfa != 3) << 21); // st(hfa) {v28.(s|d),...}[0],[x(r1)] - } - // lab2: - write32le(cur_text_section->data + b2, 0x14000000 | (ind - b2) >> 2); -#endif - } -} - -ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, - int *align, int *regsize) -{ - return 0; -} - -ST_FUNC void gfunc_return(CType *func_type) -{ - CType *t = func_type; - unsigned long a; - - arm64_pcs(0, 0, &t, &a); - switch (a) { - case -1: - break; - case 0: - if ((func_type->t & VT_BTYPE) == VT_STRUCT) { - int align, size = type_size(func_type, &align); - gaddrof(); - gv(RC_R(0)); - arm64_ldrs(0, size); - } - else - gv(RC_IRET); - break; - case 1: { - CType type = *func_type; - mk_pointer(&type); - vset(&type, VT_LOCAL | VT_LVAL, func_vc); - indir(); - vswap(); - vstore(); - break; - } - case 16: - if ((func_type->t & VT_BTYPE) == VT_STRUCT) { - uint32_t j, sz, n = arm64_hfa(&vtop->type, &sz); - gaddrof(); - gv(RC_R(0)); - for (j = 0; j < n; j++) - o(0x3d400000 | - (sz & 16) << 19 | -(sz & 8) << 27 | (sz & 4) << 29 | - j | j << 10); // ldr ([sdq])(*),[x0,#(j * sz)] - } - else - gv(RC_FRET); - break; - default: - assert(0); - } - vtop--; -} - -ST_FUNC void gfunc_epilog(void) -{ -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_epilog(); -#endif - - if (loc) { - // Insert instructions to subtract size of stack frame from SP. - unsigned char *ptr = cur_text_section->data + arm64_func_sub_sp_offset; - uint64_t diff = (-loc + 15) & ~15; - if (!(diff >> 24)) { - if (diff & 0xfff) // sub sp,sp,#(diff & 0xfff) - write32le(ptr, 0xd10003ff | (diff & 0xfff) << 10); - if (diff >> 12) // sub sp,sp,#(diff >> 12),lsl #12 - write32le(ptr + 4, 0xd14003ff | (diff >> 12) << 10); - } - else { - // In this case we may subtract more than necessary, - // but always less than 17/16 of what we were aiming for. - int i = 0; - int j = 0; - while (diff >> 20) { - diff = (diff + 0xffff) >> 16; - ++i; - } - while (diff >> 16) { - diff = (diff + 1) >> 1; - ++j; - } - write32le(ptr, 0xd2800010 | diff << 5 | i << 21); - // mov x16,#(diff),lsl #(16 * i) - write32le(ptr + 4, 0xcb3063ff | j << 10); - // sub sp,sp,x16,lsl #(j) - } - } - o(0x910003bf); // mov sp,x29 - o(0xa8ce7bfd); // ldp x29,x30,[sp],#224 - - o(0xd65f03c0); // ret -} - -ST_FUNC void gen_fill_nops(int bytes) -{ - if ((bytes & 3)) - tcc_error("alignment of code section not multiple of 4"); - while (bytes > 0) { - o(0xd503201f); // nop - bytes -= 4; - } -} - -// Generate forward branch to label: -ST_FUNC int gjmp(int t) -{ - int r = ind; - if (nocode_wanted) - return t; - o(t); - return r; -} - -// Generate branch to known address: -ST_FUNC void gjmp_addr(int a) -{ - assert(a - ind + 0x8000000 < 0x10000000); - o(0x14000000 | ((a - ind) >> 2 & 0x3ffffff)); -} - -ST_FUNC int gjmp_append(int n, int t) -{ - void *p; - /* insert vtop->c jump list in t */ - if (n) { - uint32_t n1 = n, n2; - while ((n2 = read32le(p = cur_text_section->data + n1))) - n1 = n2; - write32le(p, t); - t = n; - } - return t; -} - -void arm64_vset_VT_CMP(int op) -{ - if (op >= TOK_ULT && op <= TOK_GT) { - vtop->cmp_r = vtop->r; - vset_VT_CMP(0x80); - } -} - -static void arm64_gen_opil(int op, uint32_t l); - -static void arm64_load_cmp(int r, SValue *sv) -{ - sv->r = sv->cmp_r; - if (sv->c.i & 1) { - vpushi(1); - arm64_gen_opil('^', 0); - } - if (r != sv->r) { - load(r, sv); - sv->r = r; - } -} - -ST_FUNC int gjmp_cond(int op, int t) -{ - int bt = vtop->type.t & VT_BTYPE; - - int inv = op & 1; - vtop->r = vtop->cmp_r; - - if (bt == VT_LDOUBLE) { - uint32_t a, b, f = fltr(gv(RC_FLOAT)); - a = get_reg(RC_INT); - vpushi(0); - vtop[0].r = a; - b = get_reg(RC_INT); - a = intr(a); - b = intr(b); - o(0x4e083c00 | a | f << 5); // mov x(a),v(f).d[0] - o(0x4e183c00 | b | f << 5); // mov x(b),v(f).d[1] - o(0xaa000400 | a | a << 5 | b << 16); // orr x(a),x(a),x(b),lsl #1 - o(0xb4000040 | a | !!inv << 24); // cbz/cbnz x(a),.+8 - --vtop; - } - else if (bt == VT_FLOAT || bt == VT_DOUBLE) { - uint32_t a = fltr(gv(RC_FLOAT)); - o(0x1e202008 | a << 5 | (bt != VT_FLOAT) << 22); // fcmp - o(0x54000040 | !!inv); // b.eq/b.ne .+8 - } - else { - uint32_t ll = (bt == VT_PTR || bt == VT_LLONG); - uint32_t a = intr(gv(RC_INT)); - o(0x34000040 | a | !!inv << 24 | ll << 31); // cbz/cbnz wA,.+8 - } - return gjmp(t); -} - -static int arm64_iconst(uint64_t *val, SValue *sv) -{ - if ((sv->r & (VT_VALMASK | VT_LVAL | VT_SYM)) != VT_CONST) - return 0; - if (val) { - int t = sv->type.t; - int bt = t & VT_BTYPE; - *val = ((bt == VT_LLONG || bt == VT_PTR) ? sv->c.i : - (uint32_t)sv->c.i | - (t & VT_UNSIGNED ? 0 : -(sv->c.i & 0x80000000))); - } - return 1; -} - -static int arm64_gen_opic(int op, uint32_t l, int rev, uint64_t val, - uint32_t x, uint32_t a) -{ - if (op == '-' && !rev) { - val = -val; - op = '+'; - } - val = l ? val : (uint32_t)val; - - switch (op) { - - case '+': { - uint32_t s = l ? val >> 63 : val >> 31; - val = s ? -val : val; - val = l ? val : (uint32_t)val; - if (!(val & ~(uint64_t)0xfff)) - o(0x11000000 | l << 31 | s << 30 | x | a << 5 | val << 10); - else if (!(val & ~(uint64_t)0xfff000)) - o(0x11400000 | l << 31 | s << 30 | x | a << 5 | val >> 12 << 10); - else { - arm64_movimm(30, val); // use x30 - o(0x0b1e0000 | l << 31 | s << 30 | x | a << 5); - } - return 1; - } - - case '-': - if (!val) - o(0x4b0003e0 | l << 31 | x | a << 16); // neg - else if (val == (l ? (uint64_t)-1 : (uint32_t)-1)) - o(0x2a2003e0 | l << 31 | x | a << 16); // mvn - else { - arm64_movimm(30, val); // use x30 - o(0x4b0003c0 | l << 31 | x | a << 16); // sub - } - return 1; - - case '^': - if (val == -1 || (val == 0xffffffff && !l)) { - o(0x2a2003e0 | l << 31 | x | a << 16); // mvn - return 1; - } - // fall through - case '&': - case '|': { - int e = arm64_encode_bimm64(l ? val : val | val << 32); - if (e < 0) - return 0; - o((op == '&' ? 0x12000000 : - op == '|' ? 0x32000000 : 0x52000000) | - l << 31 | x | a << 5 | (uint32_t)e << 10); - return 1; - } - - case TOK_SAR: - case TOK_SHL: - case TOK_SHR: { - uint32_t n = 32 << l; - val = val & (n - 1); - if (rev) - return 0; - if (!val) { - // tcc_warning("shift count >= width of type"); - o(0x2a0003e0 | l << 31 | a << 16); - return 1; - } - else if (op == TOK_SHL) - o(0x53000000 | l << 31 | l << 22 | x | a << 5 | - (n - val) << 16 | (n - 1 - val) << 10); // lsl - else - o(0x13000000 | (op == TOK_SHR) << 30 | l << 31 | l << 22 | - x | a << 5 | val << 16 | (n - 1) << 10); // lsr/asr - return 1; - } - - } - return 0; -} - -static void arm64_gen_opil(int op, uint32_t l) -{ - uint32_t x, a, b; - - // Special treatment for operations with a constant operand: - { - uint64_t val; - int rev = 1; - - if (arm64_iconst(0, &vtop[0])) { - vswap(); - rev = 0; - } - if (arm64_iconst(&val, &vtop[-1])) { - gv(RC_INT); - a = intr(vtop[0].r); - --vtop; - x = get_reg(RC_INT); - ++vtop; - if (arm64_gen_opic(op, l, rev, val, intr(x), a)) { - vtop[0].r = x; - vswap(); - --vtop; - return; - } - } - if (!rev) - vswap(); - } - - gv2(RC_INT, RC_INT); - assert(vtop[-1].r < VT_CONST && vtop[0].r < VT_CONST); - a = intr(vtop[-1].r); - b = intr(vtop[0].r); - vtop -= 2; - x = get_reg(RC_INT); - ++vtop; - vtop[0].r = x; - x = intr(x); - - switch (op) { - case '%': - // Use x30 for quotient: - o(0x1ac00c00 | l << 31 | 30 | a << 5 | b << 16); // sdiv - o(0x1b008000 | l << 31 | x | (uint32_t)30 << 5 | - b << 16 | a << 10); // msub - break; - case '&': - o(0x0a000000 | l << 31 | x | a << 5 | b << 16); // and - break; - case '*': - o(0x1b007c00 | l << 31 | x | a << 5 | b << 16); // mul - break; - case '+': - o(0x0b000000 | l << 31 | x | a << 5 | b << 16); // add - break; - case '-': - o(0x4b000000 | l << 31 | x | a << 5 | b << 16); // sub - break; - case '/': - o(0x1ac00c00 | l << 31 | x | a << 5 | b << 16); // sdiv - break; - case '^': - o(0x4a000000 | l << 31 | x | a << 5 | b << 16); // eor - break; - case '|': - o(0x2a000000 | l << 31 | x | a << 5 | b << 16); // orr - break; - case TOK_EQ: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9f17e0 | x); // cset wA,eq - break; - case TOK_GE: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9fb7e0 | x); // cset wA,ge - break; - case TOK_GT: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9fd7e0 | x); // cset wA,gt - break; - case TOK_LE: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9fc7e0 | x); // cset wA,le - break; - case TOK_LT: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9fa7e0 | x); // cset wA,lt - break; - case TOK_NE: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9f07e0 | x); // cset wA,ne - break; - case TOK_SAR: - o(0x1ac02800 | l << 31 | x | a << 5 | b << 16); // asr - break; - case TOK_SHL: - o(0x1ac02000 | l << 31 | x | a << 5 | b << 16); // lsl - break; - case TOK_SHR: - o(0x1ac02400 | l << 31 | x | a << 5 | b << 16); // lsr - break; - case TOK_UDIV: - case TOK_PDIV: - o(0x1ac00800 | l << 31 | x | a << 5 | b << 16); // udiv - break; - case TOK_UGE: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9f37e0 | x); // cset wA,cs - break; - case TOK_UGT: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9f97e0 | x); // cset wA,hi - break; - case TOK_ULT: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9f27e0 | x); // cset wA,cc - break; - case TOK_ULE: - o(0x6b00001f | l << 31 | a << 5 | b << 16); // cmp - o(0x1a9f87e0 | x); // cset wA,ls - break; - case TOK_UMOD: - // Use x30 for quotient: - o(0x1ac00800 | l << 31 | 30 | a << 5 | b << 16); // udiv - o(0x1b008000 | l << 31 | x | (uint32_t)30 << 5 | - b << 16 | a << 10); // msub - break; - default: - assert(0); - } -} - -ST_FUNC void gen_opi(int op) -{ - arm64_gen_opil(op, 0); - arm64_vset_VT_CMP(op); -} - -ST_FUNC void gen_opl(int op) -{ - arm64_gen_opil(op, 1); - arm64_vset_VT_CMP(op); -} - -ST_FUNC void gen_opf(int op) -{ - uint32_t x, a, b, dbl; - - if (vtop[0].type.t == VT_LDOUBLE) { - CType type = vtop[0].type; - int func = 0; - int cond = -1; - switch (op) { - case '*': func = TOK___multf3; break; - case '+': func = TOK___addtf3; break; - case '-': func = TOK___subtf3; break; - case '/': func = TOK___divtf3; break; - case TOK_EQ: func = TOK___eqtf2; cond = 1; break; - case TOK_NE: func = TOK___netf2; cond = 0; break; - case TOK_LT: func = TOK___lttf2; cond = 10; break; - case TOK_GE: func = TOK___getf2; cond = 11; break; - case TOK_LE: func = TOK___letf2; cond = 12; break; - case TOK_GT: func = TOK___gttf2; cond = 13; break; - default: assert(0); break; - } - vpush_helper_func(func); - vrott(3); - gfunc_call(2); - vpushi(0); - vtop->r = cond < 0 ? REG_FRET : REG_IRET; - if (cond < 0) - vtop->type = type; - else { - o(0x7100001f); // cmp w0,#0 - o(0x1a9f07e0 | (uint32_t)cond << 12); // cset w0,(cond) - } - return; - } - - dbl = vtop[0].type.t != VT_FLOAT; - gv2(RC_FLOAT, RC_FLOAT); - assert(vtop[-1].r < VT_CONST && vtop[0].r < VT_CONST); - a = fltr(vtop[-1].r); - b = fltr(vtop[0].r); - vtop -= 2; - switch (op) { - case TOK_EQ: case TOK_NE: - case TOK_LT: case TOK_GE: case TOK_LE: case TOK_GT: - x = get_reg(RC_INT); - ++vtop; - vtop[0].r = x; - x = intr(x); - break; - default: - x = get_reg(RC_FLOAT); - ++vtop; - vtop[0].r = x; - x = fltr(x); - break; - } - - switch (op) { - case '*': - o(0x1e200800 | dbl << 22 | x | a << 5 | b << 16); // fmul - break; - case '+': - o(0x1e202800 | dbl << 22 | x | a << 5 | b << 16); // fadd - break; - case '-': - o(0x1e203800 | dbl << 22 | x | a << 5 | b << 16); // fsub - break; - case '/': - o(0x1e201800 | dbl << 22 | x | a << 5 | b << 16); // fdiv - break; - case TOK_EQ: - o(0x1e202000 | dbl << 22 | a << 5 | b << 16); // fcmp - o(0x1a9f17e0 | x); // cset w(x),eq - break; - case TOK_GE: - o(0x1e202000 | dbl << 22 | a << 5 | b << 16); // fcmp - o(0x1a9fb7e0 | x); // cset w(x),ge - break; - case TOK_GT: - o(0x1e202000 | dbl << 22 | a << 5 | b << 16); // fcmp - o(0x1a9fd7e0 | x); // cset w(x),gt - break; - case TOK_LE: - o(0x1e202000 | dbl << 22 | a << 5 | b << 16); // fcmp - o(0x1a9f87e0 | x); // cset w(x),ls - break; - case TOK_LT: - o(0x1e202000 | dbl << 22 | a << 5 | b << 16); // fcmp - o(0x1a9f57e0 | x); // cset w(x),mi - break; - case TOK_NE: - o(0x1e202000 | dbl << 22 | a << 5 | b << 16); // fcmp - o(0x1a9f07e0 | x); // cset w(x),ne - break; - default: - assert(0); - } - arm64_vset_VT_CMP(op); -} - -// Generate sign extension from 32 to 64 bits: -ST_FUNC void gen_cvt_sxtw(void) -{ - uint32_t r = intr(gv(RC_INT)); - o(0x93407c00 | r | r << 5); // sxtw x(r),w(r) -} - -/* char/short to int conversion */ -ST_FUNC void gen_cvt_csti(int t) -{ - int r = intr(gv(RC_INT)); - o(0x13001c00 - | ((t & VT_BTYPE) == VT_SHORT) << 13 - | (uint32_t)!!(t & VT_UNSIGNED) << 30 - | r | r << 5); // [su]xt[bh] w(r),w(r) -} - -ST_FUNC void gen_cvt_itof(int t) -{ - if (t == VT_LDOUBLE) { - int f = vtop->type.t; - int func = (f & VT_BTYPE) == VT_LLONG ? - (f & VT_UNSIGNED ? TOK___floatunditf : TOK___floatditf) : - (f & VT_UNSIGNED ? TOK___floatunsitf : TOK___floatsitf); - vpush_helper_func(func); - vrott(2); - gfunc_call(1); - vpushi(0); - vtop->type.t = t; - vtop->r = REG_FRET; - return; - } - else { - int d, n = intr(gv(RC_INT)); - int s = !(vtop->type.t & VT_UNSIGNED); - uint32_t l = ((vtop->type.t & VT_BTYPE) == VT_LLONG); - --vtop; - d = get_reg(RC_FLOAT); - ++vtop; - vtop[0].r = d; - o(0x1e220000 | (uint32_t)!s << 16 | - (uint32_t)(t != VT_FLOAT) << 22 | fltr(d) | - l << 31 | n << 5); // [us]cvtf [sd](d),[wx](n) - } -} - -ST_FUNC void gen_cvt_ftoi(int t) -{ - if ((vtop->type.t & VT_BTYPE) == VT_LDOUBLE) { - int func = (t & VT_BTYPE) == VT_LLONG ? - (t & VT_UNSIGNED ? TOK___fixunstfdi : TOK___fixtfdi) : - (t & VT_UNSIGNED ? TOK___fixunstfsi : TOK___fixtfsi); - vpush_helper_func(func); - vrott(2); - gfunc_call(1); - vpushi(0); - vtop->type.t = t; - vtop->r = REG_IRET; - return; - } - else { - int d, n = fltr(gv(RC_FLOAT)); - uint32_t l = ((vtop->type.t & VT_BTYPE) != VT_FLOAT); - --vtop; - d = get_reg(RC_INT); - ++vtop; - vtop[0].r = d; - o(0x1e380000 | - (uint32_t)!!(t & VT_UNSIGNED) << 16 | - (uint32_t)((t & VT_BTYPE) == VT_LLONG) << 31 | intr(d) | - l << 22 | n << 5); // fcvtz[su] [wx](d),[sd](n) - } -} - -ST_FUNC void gen_cvt_ftof(int t) -{ - int f = vtop[0].type.t & VT_BTYPE; - assert(t == VT_FLOAT || t == VT_DOUBLE || t == VT_LDOUBLE); - assert(f == VT_FLOAT || f == VT_DOUBLE || f == VT_LDOUBLE); - if (t == f) - return; - - if (t == VT_LDOUBLE || f == VT_LDOUBLE) { - int func = (t == VT_LDOUBLE) ? - (f == VT_FLOAT ? TOK___extendsftf2 : TOK___extenddftf2) : - (t == VT_FLOAT ? TOK___trunctfsf2 : TOK___trunctfdf2); - vpush_helper_func(func); - vrott(2); - gfunc_call(1); - vpushi(0); - vtop->type.t = t; - vtop->r = REG_FRET; - } - else { - int x, a; - gv(RC_FLOAT); - assert(vtop[0].r < VT_CONST); - a = fltr(vtop[0].r); - --vtop; - x = get_reg(RC_FLOAT); - ++vtop; - vtop[0].r = x; - x = fltr(x); - - if (f == VT_FLOAT) - o(0x1e22c000 | x | a << 5); // fcvt d(x),s(a) - else - o(0x1e624000 | x | a << 5); // fcvt s(x),d(a) - } -} - -/* increment tcov counter */ -ST_FUNC void gen_increment_tcov (SValue *sv) -{ - int r1, r2; - - vpushv(sv); - vtop->r = r1 = get_reg(RC_INT); - r2 = get_reg(RC_INT); - greloca(cur_text_section, sv->sym, ind, R_AARCH64_ADR_GOT_PAGE, 0); - o(0x90000000 | r1); // adrp r1, #sym - greloca(cur_text_section, sv->sym, ind, R_AARCH64_LD64_GOT_LO12_NC, 0); - o(0xf9400000 | r1 | (r1 << 5)); // ld xr,[xr, #sym] - o(0xf9400000 | (intr(r1)<<5) | intr(r2)); // ldr r2, [r1] - o(0x91000400 | (intr(r2)<<5) | intr(r2)); // add r2, r2, #1 - o(0xf9000000 | (intr(r1)<<5) | intr(r2)); // str r2, [r1] - vpop(); -} - -ST_FUNC void ggoto(void) -{ - arm64_gen_bl_or_b(1); - --vtop; -} - -ST_FUNC void gen_clear_cache(void) -{ - uint32_t beg, end, dsz, isz, p, lab1, b1; - gv2(RC_INT, RC_INT); - vpushi(0); - vtop->r = get_reg(RC_INT); - vpushi(0); - vtop->r = get_reg(RC_INT); - vpushi(0); - vtop->r = get_reg(RC_INT); - beg = intr(vtop[-4].r); // x0 - end = intr(vtop[-3].r); // x1 - dsz = intr(vtop[-2].r); // x2 - isz = intr(vtop[-1].r); // x3 - p = intr(vtop[0].r); // x4 - vtop -= 5; - - o(0xd53b0020 | isz); // mrs x(isz),ctr_el0 - o(0x52800080 | p); // mov w(p),#4 - o(0x53104c00 | dsz | isz << 5); // ubfx w(dsz),w(isz),#16,#4 - o(0x1ac02000 | dsz | p << 5 | dsz << 16); // lsl w(dsz),w(p),w(dsz) - o(0x12000c00 | isz | isz << 5); // and w(isz),w(isz),#15 - o(0x1ac02000 | isz | p << 5 | isz << 16); // lsl w(isz),w(p),w(isz) - o(0x51000400 | p | dsz << 5); // sub w(p),w(dsz),#1 - o(0x8a240004 | p | beg << 5 | p << 16); // bic x(p),x(beg),x(p) - b1 = ind; o(0x14000000); // b - lab1 = ind; - o(0xd50b7b20 | p); // dc cvau,x(p) - o(0x8b000000 | p | p << 5 | dsz << 16); // add x(p),x(p),x(dsz) - write32le(cur_text_section->data + b1, 0x14000000 | (ind - b1) >> 2); - o(0xeb00001f | p << 5 | end << 16); // cmp x(p),x(end) - o(0x54ffffa3 | ((lab1 - ind) << 3 & 0xffffe0)); // b.cc lab1 - o(0xd5033b9f); // dsb ish - o(0x51000400 | p | isz << 5); // sub w(p),w(isz),#1 - o(0x8a240004 | p | beg << 5 | p << 16); // bic x(p),x(beg),x(p) - b1 = ind; o(0x14000000); // b - lab1 = ind; - o(0xd50b7520 | p); // ic ivau,x(p) - o(0x8b000000 | p | p << 5 | isz << 16); // add x(p),x(p),x(isz) - write32le(cur_text_section->data + b1, 0x14000000 | (ind - b1) >> 2); - o(0xeb00001f | p << 5 | end << 16); // cmp x(p),x(end) - o(0x54ffffa3 | ((lab1 - ind) << 3 & 0xffffe0)); // b.cc lab1 - o(0xd5033b9f); // dsb ish - o(0xd5033fdf); // isb -} - -ST_FUNC void gen_vla_sp_save(int addr) { - uint32_t r = intr(get_reg(RC_INT)); - o(0x910003e0 | r); // mov x(r),sp - arm64_strx(3, r, 29, addr); -} - -ST_FUNC void gen_vla_sp_restore(int addr) { - // Use x30 because this function can be called when there - // is a live return value in x0 but there is nothing on - // the value stack to prevent get_reg from returning x0. - uint32_t r = 30; - arm64_ldrx(0, 3, r, 29, addr); - o(0x9100001f | r << 5); // mov sp,x(r) -} - -ST_FUNC void gen_vla_alloc(CType *type, int align) { - uint32_t r; -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) - vpushv(vtop); -#endif - r = intr(gv(RC_INT)); -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) - o(0x91004000 | r | r << 5); // add x(r),x(r),#15+1 - else -#endif - o(0x91003c00 | r | r << 5); // add x(r),x(r),#15 - o(0x927cec00 | r | r << 5); // bic x(r),x(r),#15 - o(0xcb2063ff | r << 16); // sub sp,sp,x(r) - vpop(); -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) { - vpushi(0); - vtop->r = TREG_R(0); - o(0x910003e0 | vtop->r); // mov r0,sp - vswap(); - vpush_helper_func(TOK___bound_new_region); - vrott(3); - gfunc_call(2); - func_bound_add_epilog = 1; - } -#endif -} - -/* end of A64 code generator */ -/*************************************************************/ -#endif -/*************************************************************/ diff --git a/arm64-link.c b/arm64-link.c deleted file mode 100644 index cfdd95ea..00000000 --- a/arm64-link.c +++ /dev/null @@ -1,322 +0,0 @@ -#ifdef TARGET_DEFS_ONLY - -#define EM_TCC_TARGET EM_AARCH64 - -#define R_DATA_32 R_AARCH64_ABS32 -#define R_DATA_PTR R_AARCH64_ABS64 -#define R_JMP_SLOT R_AARCH64_JUMP_SLOT -#define R_GLOB_DAT R_AARCH64_GLOB_DAT -#define R_COPY R_AARCH64_COPY -#define R_RELATIVE R_AARCH64_RELATIVE - -#define R_NUM R_AARCH64_NUM - -#define ELF_START_ADDR 0x00400000 -#define ELF_PAGE_SIZE 0x10000 - -#define PCRELATIVE_DLLPLT 1 -#define RELOCATE_DLLPLT 1 - -#else /* !TARGET_DEFS_ONLY */ - -#include "tcc.h" - -#ifdef NEED_RELOC_TYPE -/* Returns 1 for a code relocation, 0 for a data relocation. For unknown - relocations, returns -1. */ -ST_FUNC int code_reloc (int reloc_type) -{ - switch (reloc_type) { - case R_AARCH64_ABS32: - case R_AARCH64_ABS64: - case R_AARCH64_PREL32: - case R_AARCH64_MOVW_UABS_G0_NC: - case R_AARCH64_MOVW_UABS_G1_NC: - case R_AARCH64_MOVW_UABS_G2_NC: - case R_AARCH64_MOVW_UABS_G3: - case R_AARCH64_ADR_PREL_PG_HI21: - case R_AARCH64_ADD_ABS_LO12_NC: - case R_AARCH64_ADR_GOT_PAGE: - case R_AARCH64_LD64_GOT_LO12_NC: - case R_AARCH64_LDST128_ABS_LO12_NC: - case R_AARCH64_LDST64_ABS_LO12_NC: - case R_AARCH64_LDST32_ABS_LO12_NC: - case R_AARCH64_LDST16_ABS_LO12_NC: - case R_AARCH64_LDST8_ABS_LO12_NC: - case R_AARCH64_GLOB_DAT: - case R_AARCH64_COPY: - return 0; - - case R_AARCH64_JUMP26: - case R_AARCH64_CALL26: - case R_AARCH64_JUMP_SLOT: - return 1; - } - return -1; -} - -/* Returns an enumerator to describe whether and when the relocation needs a - GOT and/or PLT entry to be created. See tcc.h for a description of the - different values. */ -ST_FUNC int gotplt_entry_type (int reloc_type) -{ - switch (reloc_type) { - case R_AARCH64_PREL32: - case R_AARCH64_MOVW_UABS_G0_NC: - case R_AARCH64_MOVW_UABS_G1_NC: - case R_AARCH64_MOVW_UABS_G2_NC: - case R_AARCH64_MOVW_UABS_G3: - case R_AARCH64_ADR_PREL_PG_HI21: - case R_AARCH64_ADD_ABS_LO12_NC: - case R_AARCH64_LDST128_ABS_LO12_NC: - case R_AARCH64_LDST64_ABS_LO12_NC: - case R_AARCH64_LDST32_ABS_LO12_NC: - case R_AARCH64_LDST16_ABS_LO12_NC: - case R_AARCH64_LDST8_ABS_LO12_NC: - case R_AARCH64_GLOB_DAT: - case R_AARCH64_JUMP_SLOT: - case R_AARCH64_COPY: - return NO_GOTPLT_ENTRY; - - case R_AARCH64_ABS32: - case R_AARCH64_ABS64: - case R_AARCH64_JUMP26: - case R_AARCH64_CALL26: - return AUTO_GOTPLT_ENTRY; - - case R_AARCH64_ADR_GOT_PAGE: - case R_AARCH64_LD64_GOT_LO12_NC: - return ALWAYS_GOTPLT_ENTRY; - } - return -1; -} - -#ifdef NEED_BUILD_GOT -ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr) -{ - Section *plt = s1->plt; - uint8_t *p; - unsigned plt_offset; - - if (plt->data_offset == 0) { - section_ptr_add(plt, 32); - } - plt_offset = plt->data_offset; - - p = section_ptr_add(plt, 16); - write32le(p, got_offset); - write32le(p + 4, (uint64_t) got_offset >> 32); - return plt_offset; -} - -/* relocate the PLT: compute addresses and offsets in the PLT now that final - address for PLT and GOT are known (see fill_program_header) */ -ST_FUNC void relocate_plt(TCCState *s1) -{ - uint8_t *p, *p_end; - - if (!s1->plt) - return; - - p = s1->plt->data; - p_end = p + s1->plt->data_offset; - - if (p < p_end) { - uint64_t plt = s1->plt->sh_addr; - uint64_t got = s1->got->sh_addr + 16; - uint64_t off = (got >> 12) - (plt >> 12); - if ((off + ((uint32_t)1 << 20)) >> 21) - tcc_error_noabort("Failed relocating PLT (off=0x%lx, got=0x%lx, plt=0x%lx)", (long)off, (long)got, (long)plt); - write32le(p, 0xa9bf7bf0); // stp x16,x30,[sp,#-16]! - write32le(p + 4, (0x90000010 | // adrp x16,... - (off & 0x1ffffc) << 3 | (off & 3) << 29)); - write32le(p + 8, (0xf9400211 | // ldr x17,[x16,#...] - (got & 0xff8) << 7)); - write32le(p + 12, (0x91000210 | // add x16,x16,#... - (got & 0xfff) << 10)); - write32le(p + 16, 0xd61f0220); // br x17 - write32le(p + 20, 0xd503201f); // nop - write32le(p + 24, 0xd503201f); // nop - write32le(p + 28, 0xd503201f); // nop - p += 32; - got = s1->got->sh_addr; - while (p < p_end) { - uint64_t pc = plt + (p - s1->plt->data); - uint64_t addr = got + read64le(p); - uint64_t off = (addr >> 12) - (pc >> 12); - if ((off + ((uint32_t)1 << 20)) >> 21) - tcc_error_noabort("Failed relocating PLT (off=0x%lx, addr=0x%lx, pc=0x%lx)", (long)off, (long)addr, (long)pc); - write32le(p, (0x90000010 | // adrp x16,... - (off & 0x1ffffc) << 3 | (off & 3) << 29)); - write32le(p + 4, (0xf9400211 | // ldr x17,[x16,#...] - (addr & 0xff8) << 7)); - write32le(p + 8, (0x91000210 | // add x16,x16,#... - (addr & 0xfff) << 10)); - write32le(p + 12, 0xd61f0220); // br x17 - p += 16; - } - } - - if (s1->plt->reloc) { - ElfW_Rel *rel; - p = s1->got->data; - for_each_elem(s1->plt->reloc, 0, rel, ElfW_Rel) { - write64le(p + rel->r_offset, s1->plt->sh_addr); - } - } -} -#endif -#endif - -ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t addr, addr_t val) -{ - int sym_index = ELFW(R_SYM)(rel->r_info), esym_index; -#ifdef DEBUG_RELOC - ElfW(Sym) *sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; -#endif - - switch(type) { - case R_AARCH64_ABS64: - if ((s1->output_type & TCC_OUTPUT_DYN)) { - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - qrel->r_offset = rel->r_offset; - if (esym_index) { - qrel->r_info = ELFW(R_INFO)(esym_index, R_AARCH64_ABS64); - qrel->r_addend = rel->r_addend; - qrel++; - break; - } else { - qrel->r_info = ELFW(R_INFO)(0, R_AARCH64_RELATIVE); - qrel->r_addend = read64le(ptr) + val; - qrel++; - } - } - add64le(ptr, val); - return; - case R_AARCH64_ABS32: - if (s1->output_type & TCC_OUTPUT_DYN) { - /* XXX: this logic may depend on TCC's codegen - now TCC uses R_AARCH64_RELATIVE even for a 64bit pointer */ - qrel->r_offset = rel->r_offset; - qrel->r_info = ELFW(R_INFO)(0, R_AARCH64_RELATIVE); - /* Use sign extension! */ - qrel->r_addend = (int)read32le(ptr) + val; - qrel++; - } - add32le(ptr, val); - return; - case R_AARCH64_PREL32: - if (s1->output_type == TCC_OUTPUT_DLL) { - /* DLL relocation */ - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - if (esym_index) { - qrel->r_offset = rel->r_offset; - qrel->r_info = ELFW(R_INFO)(esym_index, R_AARCH64_PREL32); - /* Use sign extension! */ - qrel->r_addend = (int)read32le(ptr) + rel->r_addend; - qrel++; - break; - } - } - add32le(ptr, val - addr); - return; - case R_AARCH64_MOVW_UABS_G0_NC: - write32le(ptr, ((read32le(ptr) & 0xffe0001f) | - (val & 0xffff) << 5)); - return; - case R_AARCH64_MOVW_UABS_G1_NC: - write32le(ptr, ((read32le(ptr) & 0xffe0001f) | - (val >> 16 & 0xffff) << 5)); - return; - case R_AARCH64_MOVW_UABS_G2_NC: - write32le(ptr, ((read32le(ptr) & 0xffe0001f) | - (val >> 32 & 0xffff) << 5)); - return; - case R_AARCH64_MOVW_UABS_G3: - write32le(ptr, ((read32le(ptr) & 0xffe0001f) | - (val >> 48 & 0xffff) << 5)); - return; - case R_AARCH64_ADR_PREL_PG_HI21: { - uint64_t off = (val >> 12) - (addr >> 12); - if ((off + ((uint64_t)1 << 20)) >> 21) - tcc_error_noabort("R_AARCH64_ADR_PREL_PG_HI21 relocation failed"); - write32le(ptr, ((read32le(ptr) & 0x9f00001f) | - (off & 0x1ffffc) << 3 | (off & 3) << 29)); - return; - } - case R_AARCH64_ADD_ABS_LO12_NC: - case R_AARCH64_LDST8_ABS_LO12_NC: - write32le(ptr, ((read32le(ptr) & 0xffc003ff) | - (val & 0xfff) << 10)); - return; - case R_AARCH64_LDST16_ABS_LO12_NC: - write32le(ptr, ((read32le(ptr) & 0xffc003ff) | - (val & 0xffe) << 9)); - return; - case R_AARCH64_LDST32_ABS_LO12_NC: - write32le(ptr, ((read32le(ptr) & 0xffc003ff) | - (val & 0xffc) << 8)); - return; - case R_AARCH64_LDST64_ABS_LO12_NC: - write32le(ptr, ((read32le(ptr) & 0xffc003ff) | - (val & 0xff8) << 7)); - return; - case R_AARCH64_LDST128_ABS_LO12_NC: - write32le(ptr, ((read32le(ptr) & 0xffc003ff) | - (val & 0xff0) << 6)); - return; - case R_AARCH64_JUMP26: - case R_AARCH64_CALL26: -#ifdef DEBUG_RELOC - printf ("reloc %d @ 0x%lx: val=0x%lx name=%s\n", type, addr, val, - (char *) symtab_section->link->data + sym->st_name); -#endif - if (((val - addr) + ((uint64_t)1 << 27)) & ~(uint64_t)0xffffffc) - tcc_error_noabort("R_AARCH64_(JUMP|CALL)26 relocation failed" - " (val=%lx, addr=%lx)", (long)val, (long)addr); - write32le(ptr, (0x14000000 | - (uint32_t)(type == R_AARCH64_CALL26) << 31 | - ((val - addr) >> 2 & 0x3ffffff))); - return; - case R_AARCH64_ADR_GOT_PAGE: { - uint64_t off = - (((s1->got->sh_addr + - get_sym_attr(s1, sym_index, 0)->got_offset) >> 12) - (addr >> 12)); - if ((off + ((uint64_t)1 << 20)) >> 21) - tcc_error_noabort("R_AARCH64_ADR_GOT_PAGE relocation failed"); - write32le(ptr, ((read32le(ptr) & 0x9f00001f) | - (off & 0x1ffffc) << 3 | (off & 3) << 29)); - return; - } - case R_AARCH64_LD64_GOT_LO12_NC: - write32le(ptr, - ((read32le(ptr) & 0xfff803ff) | - ((s1->got->sh_addr + - get_sym_attr(s1, sym_index, 0)->got_offset) & 0xff8) << 7)); - return; - case R_AARCH64_COPY: - return; - case R_AARCH64_GLOB_DAT: - case R_AARCH64_JUMP_SLOT: - /* They don't need addend */ -#ifdef DEBUG_RELOC - printf ("reloc %d @ 0x%lx: val=0x%lx name=%s\n", type, addr, - val - rel->r_addend, - (char *) symtab_section->link->data + sym->st_name); -#endif - write64le(ptr, val - rel->r_addend); - return; - case R_AARCH64_RELATIVE: -#ifdef TCC_TARGET_PE - add32le(ptr, val - s1->pe_imagebase); -#endif - /* do nothing */ - return; - default: - fprintf(stderr, "FIXME: handle reloc type %x at %x [%p] to %x\n", - type, (unsigned)addr, ptr, (unsigned)val); - return; - } -} - -#endif /* !TARGET_DEFS_ONLY */ diff --git a/bootstrap b/bootstrap new file mode 100644 index 00000000..82b611c3 --- /dev/null +++ b/bootstrap @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +autoreconf -i -f diff --git a/c67-gen.c b/c67-gen.c deleted file mode 100644 index 9490a27f..00000000 --- a/c67-gen.c +++ /dev/null @@ -1,2543 +0,0 @@ -/* - * TMS320C67xx code generator for TCC - * - * Copyright (c) 2001, 2002 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef TARGET_DEFS_ONLY - -/* #define ASSEMBLY_LISTING_C67 */ - -/* number of available registers */ -#define NB_REGS 24 - -/* a register can belong to several classes. The classes must be - sorted from more general to more precise (see gv2() code which does - assumptions on it). */ -#define RC_INT 0x0001 /* generic integer register */ -#define RC_FLOAT 0x0002 /* generic float register */ -#define RC_EAX 0x0004 -#define RC_ST0 0x0008 -#define RC_ECX 0x0010 -#define RC_EDX 0x0020 -#define RC_INT_BSIDE 0x00000040 /* generic integer register on b side */ -#define RC_C67_A4 0x00000100 -#define RC_C67_A5 0x00000200 -#define RC_C67_B4 0x00000400 -#define RC_C67_B5 0x00000800 -#define RC_C67_A6 0x00001000 -#define RC_C67_A7 0x00002000 -#define RC_C67_B6 0x00004000 -#define RC_C67_B7 0x00008000 -#define RC_C67_A8 0x00010000 -#define RC_C67_A9 0x00020000 -#define RC_C67_B8 0x00040000 -#define RC_C67_B9 0x00080000 -#define RC_C67_A10 0x00100000 -#define RC_C67_A11 0x00200000 -#define RC_C67_B10 0x00400000 -#define RC_C67_B11 0x00800000 -#define RC_C67_A12 0x01000000 -#define RC_C67_A13 0x02000000 -#define RC_C67_B12 0x04000000 -#define RC_C67_B13 0x08000000 -#define RC_IRET RC_C67_A4 /* function return: integer register */ -#define RC_IRE2 RC_C67_A5 /* function return: second integer register */ -#define RC_FRET RC_C67_A4 /* function return: float register */ - -/* pretty names for the registers */ -enum { - TREG_EAX = 0, // really A2 - TREG_ECX, // really A3 - TREG_EDX, // really B0 - TREG_ST0, // really B1 - TREG_C67_A4, - TREG_C67_A5, - TREG_C67_B4, - TREG_C67_B5, - TREG_C67_A6, - TREG_C67_A7, - TREG_C67_B6, - TREG_C67_B7, - TREG_C67_A8, - TREG_C67_A9, - TREG_C67_B8, - TREG_C67_B9, - TREG_C67_A10, - TREG_C67_A11, - TREG_C67_B10, - TREG_C67_B11, - TREG_C67_A12, - TREG_C67_A13, - TREG_C67_B12, - TREG_C67_B13, -}; - -/* return registers for function */ -#define REG_IRET TREG_C67_A4 /* single word int return register */ -#define REG_IRE2 TREG_C67_A5 /* second word return register (for long long) */ -#define REG_FRET TREG_C67_A4 /* float return register */ - -/* defined if function parameters must be evaluated in reverse order */ -/* #define INVERT_FUNC_PARAMS */ - -/* defined if structures are passed as pointers. Otherwise structures - are directly pushed on stack. */ -/* #define FUNC_STRUCT_PARAM_AS_PTR */ - -/* pointer size, in bytes */ -#define PTR_SIZE 4 - -/* long double size and alignment, in bytes */ -#define LDOUBLE_SIZE 12 -#define LDOUBLE_ALIGN 4 -/* maximum alignment (for aligned attribute support) */ -#define MAX_ALIGN 8 - -#undef CONFIG_TCC_BCHECK - -/******************************************************/ -#else /* ! TARGET_DEFS_ONLY */ -/******************************************************/ -#define USING_GLOBALS -#include "tcc.h" - -ST_DATA const char * const target_machine_defs = - "__C67__\0" - ; - -ST_DATA const int reg_classes[NB_REGS] = { - /* eax */ RC_INT | RC_FLOAT | RC_EAX, - // only allow even regs for floats (allow for doubles) - /* ecx */ RC_INT | RC_ECX, - /* edx */ RC_INT | RC_INT_BSIDE | RC_FLOAT | RC_EDX, - // only allow even regs for floats (allow for doubles) - /* st0 */ RC_INT | RC_INT_BSIDE | RC_ST0, - /* A4 */ RC_C67_A4, - /* A5 */ RC_C67_A5, - /* B4 */ RC_C67_B4, - /* B5 */ RC_C67_B5, - /* A6 */ RC_C67_A6, - /* A7 */ RC_C67_A7, - /* B6 */ RC_C67_B6, - /* B7 */ RC_C67_B7, - /* A8 */ RC_C67_A8, - /* A9 */ RC_C67_A9, - /* B8 */ RC_C67_B8, - /* B9 */ RC_C67_B9, - /* A10 */ RC_C67_A10, - /* A11 */ RC_C67_A11, - /* B10 */ RC_C67_B10, - /* B11 */ RC_C67_B11, - /* A12 */ RC_C67_A10, - /* A13 */ RC_C67_A11, - /* B12 */ RC_C67_B10, - /* B13 */ RC_C67_B11 -}; - -// although tcc thinks it is passing parameters on the stack, -// the C67 really passes up to the first 10 params in special -// regs or regs pairs (for 64 bit params). So keep track of -// the stack offsets so we can translate to the appropriate -// reg (pair) - -#define NoCallArgsPassedOnStack 10 -int NoOfCurFuncArgs; -int TranslateStackToReg[NoCallArgsPassedOnStack]; -int ParamLocOnStack[NoCallArgsPassedOnStack]; -int TotalBytesPushedOnStack; - -#ifndef FALSE -# define FALSE 0 -# define TRUE 1 -#endif - -#undef BOOL -#define BOOL int - -#define ALWAYS_ASSERT(x) \ -do {\ - if (!(x))\ - tcc_error("internal compiler error file at %s:%d", __FILE__, __LINE__);\ -} while (0) - -/******************************************************/ -static unsigned long func_sub_sp_offset; -static int func_ret_sub; - -static BOOL C67_invert_test; -static int C67_compare_reg; - -#ifdef ASSEMBLY_LISTING_C67 -FILE *f = NULL; -#endif - -void C67_g(int c) -{ - int ind1; - if (nocode_wanted) - return; -#ifdef ASSEMBLY_LISTING_C67 - fprintf(f, " %08X", c); -#endif - ind1 = ind + 4; - if (ind1 > (int) cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind] = c & 0xff; - cur_text_section->data[ind + 1] = (c >> 8) & 0xff; - cur_text_section->data[ind + 2] = (c >> 16) & 0xff; - cur_text_section->data[ind + 3] = (c >> 24) & 0xff; - ind = ind1; -} - - -/* output a symbol and patch all calls to it */ -void gsym_addr(int t, int a) -{ - int n, *ptr; - while (t) { - ptr = (int *) (cur_text_section->data + t); - { - Sym *sym; - - // extract 32 bit address from MVKH/MVKL - n = ((*ptr >> 7) & 0xffff); - n |= ((*(ptr + 1) >> 7) & 0xffff) << 16; - - // define a label that will be relocated - - sym = get_sym_ref(&char_pointer_type, cur_text_section, a, 0); - greloc(cur_text_section, sym, t, R_C60LO16); - greloc(cur_text_section, sym, t + 4, R_C60HI16); - - // clear out where the pointer was - - *ptr &= ~(0xffff << 7); - *(ptr + 1) &= ~(0xffff << 7); - } - t = n; - } -} - -// these are regs that tcc doesn't really know about, -// but assign them unique values so the mapping routines -// can distinguish them - -#define C67_A0 105 -#define C67_SP 106 -#define C67_B3 107 -#define C67_FP 108 -#define C67_B2 109 -#define C67_CREG_ZERO -1 /* Special code for no condition reg test */ - - -int ConvertRegToRegClass(int r) -{ - // only works for A4-B13 - - return RC_C67_A4 << (r - TREG_C67_A4); -} - - -// map TCC reg to C67 reg number - -int C67_map_regn(int r) -{ - if (r == 0) // normal tcc regs - return 0x2; // A2 - else if (r == 1) // normal tcc regs - return 3; // A3 - else if (r == 2) // normal tcc regs - return 0; // B0 - else if (r == 3) // normal tcc regs - return 1; // B1 - else if (r >= TREG_C67_A4 && r <= TREG_C67_B13) // these form a pattern of alt pairs - return (((r & 0xfffffffc) >> 1) | (r & 1)) + 2; - else if (r == C67_A0) - return 0; // set to A0 (offset reg) - else if (r == C67_B2) - return 2; // set to B2 (offset reg) - else if (r == C67_B3) - return 3; // set to B3 (return address reg) - else if (r == C67_SP) - return 15; // set to SP (B15) (offset reg) - else if (r == C67_FP) - return 15; // set to FP (A15) (offset reg) - else if (r == C67_CREG_ZERO) - return 0; // Special code for no condition reg test - else - ALWAYS_ASSERT(FALSE); - - return 0; -} - -// mapping from tcc reg number to -// C67 register to condition code field -// -// valid condition code regs are: -// -// tcc reg 2 ->B0 -> 1 -// tcc reg 3 ->B1 -> 2 -// tcc reg 0 -> A2 -> 5 -// tcc reg 1 -> A3 -> X -// tcc reg B2 -> 3 - -int C67_map_regc(int r) -{ - if (r == 0) // normal tcc regs - return 0x5; - else if (r == 2) // normal tcc regs - return 0x1; - else if (r == 3) // normal tcc regs - return 0x2; - else if (r == C67_B2) // normal tcc regs - return 0x3; - else if (r == C67_CREG_ZERO) - return 0; // Special code for no condition reg test - else - ALWAYS_ASSERT(FALSE); - - return 0; -} - - -// map TCC reg to C67 reg side A or B - -int C67_map_regs(int r) -{ - if (r == 0) // normal tcc regs - return 0x0; - else if (r == 1) // normal tcc regs - return 0x0; - else if (r == 2) // normal tcc regs - return 0x1; - else if (r == 3) // normal tcc regs - return 0x1; - else if (r >= TREG_C67_A4 && r <= TREG_C67_B13) // these form a pattern of alt pairs - return (r & 2) >> 1; - else if (r == C67_A0) - return 0; // set to A side - else if (r == C67_B2) - return 1; // set to B side - else if (r == C67_B3) - return 1; // set to B side - else if (r == C67_SP) - return 0x1; // set to SP (B15) B side - else if (r == C67_FP) - return 0x0; // set to FP (A15) A side - else - ALWAYS_ASSERT(FALSE); - - return 0; -} - -int C67_map_S12(char *s) -{ - if (strstr(s, ".S1") != NULL) - return 0; - else if (strcmp(s, ".S2")) - return 1; - else - ALWAYS_ASSERT(FALSE); - - return 0; -} - -int C67_map_D12(char *s) -{ - if (strstr(s, ".D1") != NULL) - return 0; - else if (strcmp(s, ".D2")) - return 1; - else - ALWAYS_ASSERT(FALSE); - - return 0; -} - - - -void C67_asm(const char *s, int a, int b, int c) -{ - BOOL xpath; - -#ifdef ASSEMBLY_LISTING_C67 - if (!f) { - f = fopen("TCC67_out.txt", "wt"); - } - fprintf(f, "%04X ", ind); -#endif - - if (strstr(s, "MVKL") == s) { - C67_g((C67_map_regn(b) << 23) | - ((a & 0xffff) << 7) | (0x0a << 2) | (C67_map_regs(b) << 1)); - } else if (strstr(s, "MVKH") == s) { - C67_g((C67_map_regn(b) << 23) | - (((a >> 16) & 0xffff) << 7) | - (0x1a << 2) | (C67_map_regs(b) << 1)); - } else if (strstr(s, "STW.D SP POST DEC") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (15 << 18) | //SP B15 - (2 << 13) | //ucst5 (must keep 8 byte boundary !!) - (0xa << 9) | //mode a = post dec ucst - (0 << 8) | //r (LDDW bit 0) - (1 << 7) | //y D1/D2 use B side - (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STB.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STH.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (5 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STB.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STH.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (5 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STW.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STW.D *") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (C67_map_regn(b) << 18) | //base reg A0 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(b) << 7) | //y D1/D2 base reg side - (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STH.D *") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (C67_map_regn(b) << 18) | //base reg A0 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(b) << 7) | //y D1/D2 base reg side - (5 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STB.D *") == s) { - C67_g((C67_map_regn(a) << 23) | //src - (C67_map_regn(b) << 18) | //base reg A0 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(b) << 7) | //y D1/D2 base reg side - (3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "STW.D +*") == s) { - ALWAYS_ASSERT(c < 32); - C67_g((C67_map_regn(a) << 23) | //src - (C67_map_regn(b) << 18) | //base reg A0 - (c << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(b) << 7) | //y D1/D2 base reg side - (7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of src - (0 << 0)); //parallel - } else if (strstr(s, "LDW.D SP PRE INC") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg B15 - (2 << 13) | //ucst5 (must keep 8 byte boundary) - (9 << 9) | //mode 9 = pre inc ucst5 - (0 << 8) | //r (LDDW bit 0) - (1 << 7) | //y D1/D2 B side - (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDDW.D SP PRE INC") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg B15 - (1 << 13) | //ucst5 (must keep 8 byte boundary) - (9 << 9) | //mode 9 = pre inc ucst5 - (1 << 8) | //r (LDDW bit 1) - (1 << 7) | //y D1/D2 B side - (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDW.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDDW.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (1 << 8) | //r (LDDW bit 1) - (0 << 7) | //y D1/D2 A side - (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDH.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (4 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDB.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (2 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDHU.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (0 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDBU.D *+SP[A0]") == s) { - C67_g((C67_map_regn(a) << 23) | //dst - (15 << 18) | //base reg A15 - (0 << 13) | //offset reg A0 - (5 << 9) | //mode 5 = pos offset, base reg + off reg - (0 << 8) | //r (LDDW bit 0) - (0 << 7) | //y D1/D2 A side - (1 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(a) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDW.D *") == s) { - C67_g((C67_map_regn(b) << 23) | //dst - (C67_map_regn(a) << 18) | //base reg A15 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(a) << 7) | //y D1/D2 src side - (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDDW.D *") == s) { - C67_g((C67_map_regn(b) << 23) | //dst - (C67_map_regn(a) << 18) | //base reg A15 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (1 << 8) | //r (LDDW bit 1) - (C67_map_regs(a) << 7) | //y D1/D2 src side - (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDH.D *") == s) { - C67_g((C67_map_regn(b) << 23) | //dst - (C67_map_regn(a) << 18) | //base reg A15 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(a) << 7) | //y D1/D2 src side - (4 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDB.D *") == s) { - C67_g((C67_map_regn(b) << 23) | //dst - (C67_map_regn(a) << 18) | //base reg A15 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(a) << 7) | //y D1/D2 src side - (2 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDHU.D *") == s) { - C67_g((C67_map_regn(b) << 23) | //dst - (C67_map_regn(a) << 18) | //base reg A15 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(a) << 7) | //y D1/D2 src side - (0 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDBU.D *") == s) { - C67_g((C67_map_regn(b) << 23) | //dst - (C67_map_regn(a) << 18) | //base reg A15 - (0 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(a) << 7) | //y D1/D2 src side - (1 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "LDW.D +*") == s) { - C67_g((C67_map_regn(b) << 23) | //dst - (C67_map_regn(a) << 18) | //base reg A15 - (1 << 13) | //cst5 - (1 << 9) | //mode 1 = pos cst offset - (0 << 8) | //r (LDDW bit 0) - (C67_map_regs(a) << 7) | //y D1/D2 src side - (6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU - (1 << 2) | //opcode - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "CMPLTSP") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x3a << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPGTSP") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x39 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPEQSP") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x38 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } - - else if (strstr(s, "CMPLTDP") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x2a << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPGTDP") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x29 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPEQDP") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x28 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPLT") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x57 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPGT") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x47 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPEQ") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x53 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPLTU") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x5f << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "CMPGTU") == s) { - xpath = C67_map_regs(a) ^ C67_map_regs(b); - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x use cross path for src2 - (0x4f << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side for reg c - (0 << 0)); //parallel - } else if (strstr(s, "B DISP") == s) { - C67_g((0 << 29) | //creg - (0 << 28) | //z - (a << 7) | //cnst - (0x4 << 2) | //opcode fixed - (0 << 1) | //S0/S1 - (0 << 0)); //parallel - } else if (strstr(s, "B.") == s) { - xpath = C67_map_regs(c) ^ 1; - - C67_g((C67_map_regc(b) << 29) | //creg - (a << 28) | //inv - (0 << 23) | //dst - (C67_map_regn(c) << 18) | //src2 - (0 << 13) | // - (xpath << 12) | //x cross path if !B side - (0xd << 6) | //opcode - (0x8 << 2) | //opcode fixed - (1 << 1) | //must be S2 - (0 << 0)); //parallel - } else if (strstr(s, "MV.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (0 << 13) | //src1 (cst5) - (xpath << 12) | //x cross path if opposite sides - (0x2 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SPTRUNC.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (0 << 13) | //src1 NA - (xpath << 12) | //x cross path if opposite sides - (0xb << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "DPTRUNC.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - ((C67_map_regn(b) + 1) << 18) | //src2 WEIRD CPU must specify odd reg for some reason - (0 << 13) | //src1 NA - (xpath << 12) | //x cross path if opposite sides - (0x1 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "INTSP.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (0 << 13) | //src1 NA - (xpath << 12) | //x cross path if opposite sides - (0x4a << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "INTSPU.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (0 << 13) | //src1 NA - (xpath << 12) | //x cross path if opposite sides - (0x49 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "INTDP.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (0 << 13) | //src1 NA - (xpath << 12) | //x cross path if opposite sides - (0x39 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "INTDPU.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - ((C67_map_regn(b) + 1) << 18) | //src2 WEIRD CPU must specify odd reg for some reason - (0 << 13) | //src1 NA - (xpath << 12) | //x cross path if opposite sides - (0x3b << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SPDP.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (0 << 13) | //src1 NA - (xpath << 12) | //x cross path if opposite sides - (0x2 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "DPSP.L") == s) { - ALWAYS_ASSERT(C67_map_regs(b) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - ((C67_map_regn(b) + 1) << 18) | //src2 WEIRD CPU must specify odd reg for some reason - (0 << 13) | //src1 NA - (0 << 12) | //x cross path if opposite sides - (0x9 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "ADD.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x3 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SUB.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x7 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "OR.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x7f << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "AND.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x7b << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "XOR.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x6f << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "ADDSP.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x10 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "ADDDP.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x18 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SUBSP.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x11 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SUBDP.L") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x19 << 5) | //opcode - (0x6 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "MPYSP.M") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x1c << 7) | //opcode - (0x0 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "MPYDP.M") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 (possible x path) - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x0e << 7) | //opcode - (0x0 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "MPYI.M") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(a) == C67_map_regs(c)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 (cst5) - (xpath << 12) | //x cross path if opposite sides - (0x4 << 7) | //opcode - (0x0 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SHR.S") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x37 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SHRU.S") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x27 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "SHL.S") == s) { - xpath = C67_map_regs(b) ^ C67_map_regs(c); - - ALWAYS_ASSERT(C67_map_regs(c) == C67_map_regs(a)); - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(c) << 23) | //dst - (C67_map_regn(b) << 18) | //src2 - (C67_map_regn(a) << 13) | //src1 - (xpath << 12) | //x cross path if opposite sides - (0x33 << 6) | //opcode - (0x8 << 2) | //opcode fixed - (C67_map_regs(c) << 1) | //side of dest - (0 << 0)); //parallel - } else if (strstr(s, "||ADDK") == s) { - xpath = 0; // no xpath required just use the side of the src/dst - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(b) << 23) | //dst - (a << 07) | //scst16 - (0x14 << 2) | //opcode fixed - (C67_map_regs(b) << 1) | //side of dst - (1 << 0)); //parallel - } else if (strstr(s, "ADDK") == s) { - xpath = 0; // no xpath required just use the side of the src/dst - - C67_g((0 << 29) | //creg - (0 << 28) | //inv - (C67_map_regn(b) << 23) | //dst - (a << 07) | //scst16 - (0x14 << 2) | //opcode fixed - (C67_map_regs(b) << 1) | //side of dst - (0 << 0)); //parallel - } else if (strstr(s, "NOP") == s) { - C67_g(((a - 1) << 13) | //no of cycles - (0 << 0)); //parallel - } else - ALWAYS_ASSERT(FALSE); - -#ifdef ASSEMBLY_LISTING_C67 - fprintf(f, " %s %d %d %d\n", s, a, b, c); -#endif - -} - -//r=reg to load, fr=from reg, symbol for relocation, constant - -void C67_MVKL(int r, int fc) -{ - C67_asm("MVKL.", fc, r, 0); -} - -void C67_MVKH(int r, int fc) -{ - C67_asm("MVKH.", fc, r, 0); -} - -void C67_STB_SP_A0(int r) -{ - C67_asm("STB.D *+SP[A0]", r, 0, 0); // STB r,*+SP[A0] -} - -void C67_STH_SP_A0(int r) -{ - C67_asm("STH.D *+SP[A0]", r, 0, 0); // STH r,*+SP[A0] -} - -void C67_STW_SP_A0(int r) -{ - C67_asm("STW.D *+SP[A0]", r, 0, 0); // STW r,*+SP[A0] -} - -void C67_STB_PTR(int r, int r2) -{ - C67_asm("STB.D *", r, r2, 0); // STB r, *r2 -} - -void C67_STH_PTR(int r, int r2) -{ - C67_asm("STH.D *", r, r2, 0); // STH r, *r2 -} - -void C67_STW_PTR(int r, int r2) -{ - C67_asm("STW.D *", r, r2, 0); // STW r, *r2 -} - -void C67_STW_PTR_PRE_INC(int r, int r2, int n) -{ - C67_asm("STW.D +*", r, r2, n); // STW r, *+r2 -} - -void C67_PUSH(int r) -{ - C67_asm("STW.D SP POST DEC", r, 0, 0); // STW r,*SP-- -} - -void C67_LDW_SP_A0(int r) -{ - C67_asm("LDW.D *+SP[A0]", r, 0, 0); // LDW *+SP[A0],r -} - -void C67_LDDW_SP_A0(int r) -{ - C67_asm("LDDW.D *+SP[A0]", r, 0, 0); // LDDW *+SP[A0],r -} - -void C67_LDH_SP_A0(int r) -{ - C67_asm("LDH.D *+SP[A0]", r, 0, 0); // LDH *+SP[A0],r -} - -void C67_LDB_SP_A0(int r) -{ - C67_asm("LDB.D *+SP[A0]", r, 0, 0); // LDB *+SP[A0],r -} - -void C67_LDHU_SP_A0(int r) -{ - C67_asm("LDHU.D *+SP[A0]", r, 0, 0); // LDHU *+SP[A0],r -} - -void C67_LDBU_SP_A0(int r) -{ - C67_asm("LDBU.D *+SP[A0]", r, 0, 0); // LDBU *+SP[A0],r -} - -void C67_LDW_PTR(int r, int r2) -{ - C67_asm("LDW.D *", r, r2, 0); // LDW *r,r2 -} - -void C67_LDDW_PTR(int r, int r2) -{ - C67_asm("LDDW.D *", r, r2, 0); // LDDW *r,r2 -} - -void C67_LDH_PTR(int r, int r2) -{ - C67_asm("LDH.D *", r, r2, 0); // LDH *r,r2 -} - -void C67_LDB_PTR(int r, int r2) -{ - C67_asm("LDB.D *", r, r2, 0); // LDB *r,r2 -} - -void C67_LDHU_PTR(int r, int r2) -{ - C67_asm("LDHU.D *", r, r2, 0); // LDHU *r,r2 -} - -void C67_LDBU_PTR(int r, int r2) -{ - C67_asm("LDBU.D *", r, r2, 0); // LDBU *r,r2 -} - -void C67_LDW_PTR_PRE_INC(int r, int r2) -{ - C67_asm("LDW.D +*", r, r2, 0); // LDW *+r,r2 -} - -void C67_POP(int r) -{ - C67_asm("LDW.D SP PRE INC", r, 0, 0); // LDW *++SP,r -} - -void C67_POP_DW(int r) -{ - C67_asm("LDDW.D SP PRE INC", r, 0, 0); // LDDW *++SP,r -} - -void C67_CMPLT(int s1, int s2, int dst) -{ - C67_asm("CMPLT.L1", s1, s2, dst); -} - -void C67_CMPGT(int s1, int s2, int dst) -{ - C67_asm("CMPGT.L1", s1, s2, dst); -} - -void C67_CMPEQ(int s1, int s2, int dst) -{ - C67_asm("CMPEQ.L1", s1, s2, dst); -} - -void C67_CMPLTU(int s1, int s2, int dst) -{ - C67_asm("CMPLTU.L1", s1, s2, dst); -} - -void C67_CMPGTU(int s1, int s2, int dst) -{ - C67_asm("CMPGTU.L1", s1, s2, dst); -} - - -void C67_CMPLTSP(int s1, int s2, int dst) -{ - C67_asm("CMPLTSP.S1", s1, s2, dst); -} - -void C67_CMPGTSP(int s1, int s2, int dst) -{ - C67_asm("CMPGTSP.S1", s1, s2, dst); -} - -void C67_CMPEQSP(int s1, int s2, int dst) -{ - C67_asm("CMPEQSP.S1", s1, s2, dst); -} - -void C67_CMPLTDP(int s1, int s2, int dst) -{ - C67_asm("CMPLTDP.S1", s1, s2, dst); -} - -void C67_CMPGTDP(int s1, int s2, int dst) -{ - C67_asm("CMPGTDP.S1", s1, s2, dst); -} - -void C67_CMPEQDP(int s1, int s2, int dst) -{ - C67_asm("CMPEQDP.S1", s1, s2, dst); -} - - -void C67_IREG_B_REG(int inv, int r1, int r2) // [!R] B r2 -{ - C67_asm("B.S2", inv, r1, r2); -} - - -// call with how many 32 bit words to skip -// (0 would branch to the branch instruction) - -void C67_B_DISP(int disp) // B +2 Branch with constant displacement -{ - // Branch point is relative to the 8 word fetch packet - // - // we will assume the text section always starts on an 8 word (32 byte boundary) - // - // so add in how many words into the fetch packet the branch is - - - C67_asm("B DISP", disp + ((ind & 31) >> 2), 0, 0); -} - -void C67_NOP(int n) -{ - C67_asm("NOP", n, 0, 0); -} - -void C67_ADDK(int n, int r) -{ - ALWAYS_ASSERT(abs(n) < 32767); - - C67_asm("ADDK", n, r, 0); -} - -void C67_ADDK_PARALLEL(int n, int r) -{ - ALWAYS_ASSERT(abs(n) < 32767); - - C67_asm("||ADDK", n, r, 0); -} - -void C67_Adjust_ADDK(int *inst, int n) -{ - ALWAYS_ASSERT(abs(n) < 32767); - - *inst = (*inst & (~(0xffff << 7))) | ((n & 0xffff) << 7); -} - -void C67_MV(int r, int v) -{ - C67_asm("MV.L", 0, r, v); -} - - -void C67_DPTRUNC(int r, int v) -{ - C67_asm("DPTRUNC.L", 0, r, v); -} - -void C67_SPTRUNC(int r, int v) -{ - C67_asm("SPTRUNC.L", 0, r, v); -} - -void C67_INTSP(int r, int v) -{ - C67_asm("INTSP.L", 0, r, v); -} - -void C67_INTDP(int r, int v) -{ - C67_asm("INTDP.L", 0, r, v); -} - -void C67_INTSPU(int r, int v) -{ - C67_asm("INTSPU.L", 0, r, v); -} - -void C67_INTDPU(int r, int v) -{ - C67_asm("INTDPU.L", 0, r, v); -} - -void C67_SPDP(int r, int v) -{ - C67_asm("SPDP.L", 0, r, v); -} - -void C67_DPSP(int r, int v) // note regs must be on the same side -{ - C67_asm("DPSP.L", 0, r, v); -} - -void C67_ADD(int r, int v) -{ - C67_asm("ADD.L", v, r, v); -} - -void C67_SUB(int r, int v) -{ - C67_asm("SUB.L", v, r, v); -} - -void C67_AND(int r, int v) -{ - C67_asm("AND.L", v, r, v); -} - -void C67_OR(int r, int v) -{ - C67_asm("OR.L", v, r, v); -} - -void C67_XOR(int r, int v) -{ - C67_asm("XOR.L", v, r, v); -} - -void C67_ADDSP(int r, int v) -{ - C67_asm("ADDSP.L", v, r, v); -} - -void C67_SUBSP(int r, int v) -{ - C67_asm("SUBSP.L", v, r, v); -} - -void C67_MPYSP(int r, int v) -{ - C67_asm("MPYSP.M", v, r, v); -} - -void C67_ADDDP(int r, int v) -{ - C67_asm("ADDDP.L", v, r, v); -} - -void C67_SUBDP(int r, int v) -{ - C67_asm("SUBDP.L", v, r, v); -} - -void C67_MPYDP(int r, int v) -{ - C67_asm("MPYDP.M", v, r, v); -} - -void C67_MPYI(int r, int v) -{ - C67_asm("MPYI.M", v, r, v); -} - -void C67_SHL(int r, int v) -{ - C67_asm("SHL.S", r, v, v); -} - -void C67_SHRU(int r, int v) -{ - C67_asm("SHRU.S", r, v, v); -} - -void C67_SHR(int r, int v) -{ - C67_asm("SHR.S", r, v, v); -} - - - -/* load 'r' from value 'sv' */ -void load(int r, SValue * sv) -{ - int v, t, ft, fc, fr, size = 0, element; - BOOL Unsigned = FALSE; - SValue v1; - - fr = sv->r; - ft = sv->type.t; - fc = sv->c.i; - - v = fr & VT_VALMASK; - if (fr & VT_LVAL) { - if (v == VT_LLOCAL) { - v1.type.t = VT_INT; - v1.r = VT_LOCAL | VT_LVAL; - v1.c.i = fc; - load(r, &v1); - fr = r; - } else if ((ft & VT_BTYPE) == VT_LDOUBLE) { - tcc_error("long double not supported"); - } else if ((ft & VT_TYPE) == VT_BYTE) { - size = 1; - } else if ((ft & VT_TYPE) == (VT_BYTE | VT_UNSIGNED)) { - size = 1; - Unsigned = TRUE; - } else if ((ft & VT_TYPE) == VT_SHORT) { - size = 2; - } else if ((ft & VT_TYPE) == (VT_SHORT | VT_UNSIGNED)) { - size = 2; - Unsigned = TRUE; - } else if ((ft & VT_BTYPE) == VT_DOUBLE) { - size = 8; - } else { - size = 4; - } - - // check if fc is a positive reference on the stack, - // if it is tcc is referencing what it thinks is a parameter - // on the stack, so check if it is really in a register. - - - if (v == VT_LOCAL && fc > 0) { - int stack_pos = 8; - - for (t = 0; t < NoCallArgsPassedOnStack; t++) { - if (fc == stack_pos) - break; - - stack_pos += TranslateStackToReg[t]; - } - - // param has been pushed on stack, get it like a local var - - fc = ParamLocOnStack[t] - 8; - } - - if ((fr & VT_VALMASK) < VT_CONST) // check for pure indirect - { - if (size == 1) { - if (Unsigned) - C67_LDBU_PTR(v, r); // LDBU *v,r - else - C67_LDB_PTR(v, r); // LDB *v,r - } else if (size == 2) { - if (Unsigned) - C67_LDHU_PTR(v, r); // LDHU *v,r - else - C67_LDH_PTR(v, r); // LDH *v,r - } else if (size == 4) { - C67_LDW_PTR(v, r); // LDW *v,r - } else if (size == 8) { - C67_LDDW_PTR(v, r); // LDDW *v,r - } - - C67_NOP(4); // NOP 4 - return; - } else if (fr & VT_SYM) { - greloc(cur_text_section, sv->sym, ind, R_C60LO16); // rem the inst need to be patched - greloc(cur_text_section, sv->sym, ind + 4, R_C60HI16); - - - C67_MVKL(C67_A0, fc); //r=reg to load, constant - C67_MVKH(C67_A0, fc); //r=reg to load, constant - - - if (size == 1) { - if (Unsigned) - C67_LDBU_PTR(C67_A0, r); // LDBU *A0,r - else - C67_LDB_PTR(C67_A0, r); // LDB *A0,r - } else if (size == 2) { - if (Unsigned) - C67_LDHU_PTR(C67_A0, r); // LDHU *A0,r - else - C67_LDH_PTR(C67_A0, r); // LDH *A0,r - } else if (size == 4) { - C67_LDW_PTR(C67_A0, r); // LDW *A0,r - } else if (size == 8) { - C67_LDDW_PTR(C67_A0, r); // LDDW *A0,r - } - - C67_NOP(4); // NOP 4 - return; - } else { - element = size; - - // divide offset in bytes to create element index - C67_MVKL(C67_A0, (fc / element) + 8 / element); //r=reg to load, constant - C67_MVKH(C67_A0, (fc / element) + 8 / element); //r=reg to load, constant - - if (size == 1) { - if (Unsigned) - C67_LDBU_SP_A0(r); // LDBU r, SP[A0] - else - C67_LDB_SP_A0(r); // LDB r, SP[A0] - } else if (size == 2) { - if (Unsigned) - C67_LDHU_SP_A0(r); // LDHU r, SP[A0] - else - C67_LDH_SP_A0(r); // LDH r, SP[A0] - } else if (size == 4) { - C67_LDW_SP_A0(r); // LDW r, SP[A0] - } else if (size == 8) { - C67_LDDW_SP_A0(r); // LDDW r, SP[A0] - } - - - C67_NOP(4); // NOP 4 - return; - } - } else { - if (v == VT_CONST) { - if (fr & VT_SYM) { - greloc(cur_text_section, sv->sym, ind, R_C60LO16); // rem the inst need to be patched - greloc(cur_text_section, sv->sym, ind + 4, R_C60HI16); - } - C67_MVKL(r, fc); //r=reg to load, constant - C67_MVKH(r, fc); //r=reg to load, constant - } else if (v == VT_LOCAL) { - C67_MVKL(r, fc + 8); //r=reg to load, constant C67 stack points to next free - C67_MVKH(r, fc + 8); //r=reg to load, constant - C67_ADD(C67_FP, r); // MV v,r v -> r - } else if (v == VT_CMP) { - C67_MV(C67_compare_reg, r); // MV v,r v -> r - } else if (v == VT_JMP || v == VT_JMPI) { - t = v & 1; - C67_B_DISP(4); // Branch with constant displacement, skip over this branch, load, nop, load - C67_MVKL(r, t); // r=reg to load, 0 or 1 (do this while branching) - C67_NOP(4); // NOP 4 - gsym(fc); // modifies other branches to branch here - C67_MVKL(r, t ^ 1); // r=reg to load, 0 or 1 - } else if (v != r) { - C67_MV(v, r); // MV v,r v -> r - - if ((ft & VT_BTYPE) == VT_DOUBLE) - C67_MV(v + 1, r + 1); // MV v,r v -> r - } - } -} - - -/* store register 'r' in lvalue 'v' */ -void store(int r, SValue * v) -{ - int fr, bt, ft, fc, size, t, element; - - ft = v->type.t; - fc = v->c.i; - fr = v->r & VT_VALMASK; - bt = ft & VT_BTYPE; - /* XXX: incorrect if float reg to reg */ - - if (bt == VT_LDOUBLE) { - tcc_error("long double not supported"); - } else { - if (bt == VT_SHORT) - size = 2; - else if (bt == VT_BYTE) - size = 1; - else if (bt == VT_DOUBLE) - size = 8; - else - size = 4; - - if ((v->r & VT_VALMASK) == VT_CONST) { - /* constant memory reference */ - - if (v->r & VT_SYM) { - greloc(cur_text_section, v->sym, ind, R_C60LO16); // rem the inst need to be patched - greloc(cur_text_section, v->sym, ind + 4, R_C60HI16); - } - C67_MVKL(C67_A0, fc); //r=reg to load, constant - C67_MVKH(C67_A0, fc); //r=reg to load, constant - - if (size == 1) - C67_STB_PTR(r, C67_A0); // STB r, *A0 - else if (size == 2) - C67_STH_PTR(r, C67_A0); // STH r, *A0 - else if (size == 4 || size == 8) - C67_STW_PTR(r, C67_A0); // STW r, *A0 - - if (size == 8) - C67_STW_PTR_PRE_INC(r + 1, C67_A0, 1); // STW r, *+A0[1] - } else if ((v->r & VT_VALMASK) == VT_LOCAL) { - // check case of storing to passed argument that - // tcc thinks is on the stack but for C67 is - // passed as a reg. However it may have been - // saved to the stack, if that reg was required - // for a call to a child function - - if (fc > 0) // argument ?? - { - // walk through sizes and figure which param - - int stack_pos = 8; - - for (t = 0; t < NoCallArgsPassedOnStack; t++) { - if (fc == stack_pos) - break; - - stack_pos += TranslateStackToReg[t]; - } - - // param has been pushed on stack, get it like a local var - fc = ParamLocOnStack[t] - 8; - } - - if (size == 8) - element = 4; - else - element = size; - - // divide offset in bytes to create word index - C67_MVKL(C67_A0, (fc / element) + 8 / element); //r=reg to load, constant - C67_MVKH(C67_A0, (fc / element) + 8 / element); //r=reg to load, constant - - - - if (size == 1) - C67_STB_SP_A0(r); // STB r, SP[A0] - else if (size == 2) - C67_STH_SP_A0(r); // STH r, SP[A0] - else if (size == 4 || size == 8) - C67_STW_SP_A0(r); // STW r, SP[A0] - - if (size == 8) { - C67_ADDK(1, C67_A0); // ADDK 1,A0 - C67_STW_SP_A0(r + 1); // STW r, SP[A0] - } - } else { - if (size == 1) - C67_STB_PTR(r, fr); // STB r, *fr - else if (size == 2) - C67_STH_PTR(r, fr); // STH r, *fr - else if (size == 4 || size == 8) - C67_STW_PTR(r, fr); // STW r, *fr - - if (size == 8) { - C67_STW_PTR_PRE_INC(r + 1, fr, 1); // STW r, *+fr[1] - } - } - } -} - -/* 'is_jmp' is '1' if it is a jump */ -static void gcall_or_jmp(int is_jmp) -{ - int r; - Sym *sym; - - if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { - /* constant case */ - if (vtop->r & VT_SYM) { - /* relocation case */ - - // get add into A0, then start the jump B3 - - greloc(cur_text_section, vtop->sym, ind, R_C60LO16); // rem the inst need to be patched - greloc(cur_text_section, vtop->sym, ind + 4, R_C60HI16); - - C67_MVKL(C67_A0, 0); //r=reg to load, constant - C67_MVKH(C67_A0, 0); //r=reg to load, constant - C67_IREG_B_REG(0, C67_CREG_ZERO, C67_A0); // B.S2x A0 - - if (is_jmp) { - C67_NOP(5); // simple jump, just put NOP - } else { - // Call, must load return address into B3 during delay slots - - sym = get_sym_ref(&char_pointer_type, cur_text_section, ind + 12, 0); // symbol for return address - greloc(cur_text_section, sym, ind, R_C60LO16); // rem the inst need to be patched - greloc(cur_text_section, sym, ind + 4, R_C60HI16); - C67_MVKL(C67_B3, 0); //r=reg to load, constant - C67_MVKH(C67_B3, 0); //r=reg to load, constant - C67_NOP(3); // put remaining NOPs - } - } else { - /* put an empty PC32 relocation */ - ALWAYS_ASSERT(FALSE); - } - } else { - /* otherwise, indirect call */ - r = gv(RC_INT); - C67_IREG_B_REG(0, C67_CREG_ZERO, r); // B.S2x r - - if (is_jmp) { - C67_NOP(5); // simple jump, just put NOP - } else { - // Call, must load return address into B3 during delay slots - - sym = get_sym_ref(&char_pointer_type, cur_text_section, ind + 12, 0); // symbol for return address - greloc(cur_text_section, sym, ind, R_C60LO16); // rem the inst need to be patched - greloc(cur_text_section, sym, ind + 4, R_C60HI16); - C67_MVKL(C67_B3, 0); //r=reg to load, constant - C67_MVKH(C67_B3, 0); //r=reg to load, constant - C67_NOP(3); // put remaining NOPs - } - } -} - -/* Return the number of registers needed to return the struct, or 0 if - returning via struct pointer. */ -ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize) { - *ret_align = 1; // Never have to re-align return values for x86-64 - return 0; -} - -/* generate function call with address in (vtop->t, vtop->c) and free function - context. Stack entry is popped */ -void gfunc_call(int nb_args) -{ - int i, r, size = 0; - int args_sizes[NoCallArgsPassedOnStack]; - - if (nb_args > NoCallArgsPassedOnStack) { - tcc_error("more than 10 function params not currently supported"); - // handle more than 10, put some on the stack - } - - for (i = 0; i < nb_args; i++) { - if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) { - ALWAYS_ASSERT(FALSE); - } else { - /* simple type (currently always same size) */ - /* XXX: implicit cast ? */ - - - if ((vtop->type.t & VT_BTYPE) == VT_LLONG) { - tcc_error("long long not supported"); - } else if ((vtop->type.t & VT_BTYPE) == VT_LDOUBLE) { - tcc_error("long double not supported"); - } else if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) { - size = 8; - } else { - size = 4; - } - - // put the parameter into the corresponding reg (pair) - - r = gv(RC_C67_A4 << (2 * i)); - - // must put on stack because with 1 pass compiler , no way to tell - // if an up coming nested call might overwrite these regs - - C67_PUSH(r); - - if (size == 8) { - C67_STW_PTR_PRE_INC(r + 1, C67_SP, 3); // STW r, *+SP[3] (go back and put the other) - } - args_sizes[i] = size; - } - vtop--; - } - // POP all the params on the stack into registers for the - // immediate call (in reverse order) - - for (i = nb_args - 1; i >= 0; i--) { - - if (args_sizes[i] == 8) - C67_POP_DW(TREG_C67_A4 + i * 2); - else - C67_POP(TREG_C67_A4 + i * 2); - } - gcall_or_jmp(0); - vtop--; -} - - -// to be compatible with Code Composer for the C67 -// the first 10 parameters must be passed in registers -// (pairs for 64 bits) starting wit; A4:A5, then B4:B5 and -// ending with B12:B13. -// -// When a call is made, if the caller has its parameters -// in regs A4-B13 these must be saved before/as the call -// parameters are loaded and restored upon return (or if/when needed). - -/* generate function prolog of type 't' */ -void gfunc_prolog(Sym *func_sym) -{ - CType *func_type = &func_sym->type; - int addr, align, size, func_call, i; - Sym *sym; - CType *type; - - sym = func_type->ref; - func_call = sym->f.func_call; - addr = 8; - /* if the function returns a structure, then add an - implicit pointer parameter */ - if ((func_vt.t & VT_BTYPE) == VT_STRUCT) { - func_vc = addr; - addr += 4; - } - - NoOfCurFuncArgs = 0; - - /* define parameters */ - while ((sym = sym->next) != NULL) { - type = &sym->type; - sym_push(sym->v & ~SYM_FIELD, type, VT_LOCAL | VT_LVAL, addr); - size = type_size(type, &align); - size = (size + 3) & ~3; - - // keep track of size of arguments so - // we can translate where tcc thinks they - // are on the stack into the appropriate reg - - TranslateStackToReg[NoOfCurFuncArgs] = size; - NoOfCurFuncArgs++; - -#ifdef FUNC_STRUCT_PARAM_AS_PTR - /* structs are passed as pointer */ - if ((type->t & VT_BTYPE) == VT_STRUCT) { - size = 4; - } -#endif - addr += size; - } - func_ret_sub = 0; - /* pascal type call ? */ - if (func_call == FUNC_STDCALL) - func_ret_sub = addr - 8; - - C67_MV(C67_FP, C67_A0); // move FP -> A0 - C67_MV(C67_SP, C67_FP); // move SP -> FP - - // place all the args passed in regs onto the stack - - loc = 0; - for (i = 0; i < NoOfCurFuncArgs; i++) { - - ParamLocOnStack[i] = loc; // remember where the param is - loc += -8; - - C67_PUSH(TREG_C67_A4 + i * 2); - - if (TranslateStackToReg[i] == 8) { - C67_STW_PTR_PRE_INC(TREG_C67_A4 + i * 2 + 1, C67_SP, 3); // STW r, *+SP[1] (go back and put the other) - } - } - - TotalBytesPushedOnStack = -loc; - - func_sub_sp_offset = ind; // remember where we put the stack instruction - C67_ADDK(0, C67_SP); // ADDK.L2 loc,SP (just put zero temporarily) - - C67_PUSH(C67_A0); - C67_PUSH(C67_B3); -} - -/* generate function epilog */ -void gfunc_epilog(void) -{ - { - int local = (-loc + 7) & -8; // stack must stay aligned to 8 bytes for LDDW instr - C67_POP(C67_B3); - C67_NOP(4); // NOP wait for load - C67_IREG_B_REG(0, C67_CREG_ZERO, C67_B3); // B.S2 B3 - C67_POP(C67_FP); - C67_ADDK(local, C67_SP); // ADDK.L2 loc,SP - C67_Adjust_ADDK((int *) (cur_text_section->data + - func_sub_sp_offset), - -local + TotalBytesPushedOnStack); - C67_NOP(3); // NOP - } -} - -ST_FUNC void gen_fill_nops(int bytes) -{ - if ((bytes & 3)) - tcc_error("alignment of code section not multiple of 4"); - while (bytes > 0) { - C67_NOP(4); - bytes -= 4; - } -} - -/* generate a jump to a label */ -int gjmp(int t) -{ - int ind1 = ind; - if (nocode_wanted) - return t; - - C67_MVKL(C67_A0, t); //r=reg to load, constant - C67_MVKH(C67_A0, t); //r=reg to load, constant - C67_IREG_B_REG(0, C67_CREG_ZERO, C67_A0); // [!R] B.S2x A0 - C67_NOP(5); - return ind1; -} - -/* generate a jump to a fixed address */ -void gjmp_addr(int a) -{ - Sym *sym; - // I guess this routine is used for relative short - // local jumps, for now just handle it as the general - // case - - // define a label that will be relocated - - sym = get_sym_ref(&char_pointer_type, cur_text_section, a, 0); - greloc(cur_text_section, sym, ind, R_C60LO16); - greloc(cur_text_section, sym, ind + 4, R_C60HI16); - - gjmp(0); // place a zero there later the symbol will be added to it -} - -/* generate a test. set 'inv' to invert test. Stack entry is popped */ -ST_FUNC int gjmp_cond(int op, int t) -{ - int ind1; - int inv = op & 1; - if (nocode_wanted) - return t; - - /* fast case : can jump directly since flags are set */ - // C67 uses B2 sort of as flags register - ind1 = ind; - C67_MVKL(C67_A0, t); //r=reg to load, constant - C67_MVKH(C67_A0, t); //r=reg to load, constant - - if (C67_compare_reg != TREG_EAX && // check if not already in a conditional test reg - C67_compare_reg != TREG_EDX && - C67_compare_reg != TREG_ST0 && C67_compare_reg != C67_B2) { - C67_MV(C67_compare_reg, C67_B2); - C67_compare_reg = C67_B2; - } - - C67_IREG_B_REG(C67_invert_test ^ inv, C67_compare_reg, C67_A0); // [!R] B.S2x A0 - C67_NOP(5); - t = ind1; //return where we need to patch - - return t; -} - -ST_FUNC int gjmp_append(int n0, int t) -{ - if (n0) { - int n = n0, *p; - /* insert vtop->c jump list in t */ - - // I guess the idea is to traverse to the - // null at the end of the list and store t - // there - while (n != 0) { - p = (int *) (cur_text_section->data + n); - - // extract 32 bit address from MVKH/MVKL - n = ((*p >> 7) & 0xffff); - n |= ((*(p + 1) >> 7) & 0xffff) << 16; - } - *p |= (t & 0xffff) << 7; - *(p + 1) |= ((t >> 16) & 0xffff) << 7; - t = n0; - } - return t; -} - -/* generate an integer binary operation */ -void gen_opi(int op) -{ - int r, fr, opc, t; - - switch (op) { - case '+': - case TOK_ADDC1: /* add with carry generation */ - opc = 0; - gen_op8: - - -// C67 can't do const compares, must load into a reg -// so just go to gv2 directly - tktk - - - - if (op >= TOK_ULT && op <= TOK_GT) - gv2(RC_INT_BSIDE, RC_INT); // make sure r (src1) is on the B Side of CPU - else - gv2(RC_INT, RC_INT); - - r = vtop[-1].r; - fr = vtop[0].r; - - C67_compare_reg = C67_B2; - - - if (op == TOK_LT) { - C67_CMPLT(r, fr, C67_B2); - C67_invert_test = FALSE; - } else if (op == TOK_GE) { - C67_CMPLT(r, fr, C67_B2); - C67_invert_test = TRUE; - } else if (op == TOK_GT) { - C67_CMPGT(r, fr, C67_B2); - C67_invert_test = FALSE; - } else if (op == TOK_LE) { - C67_CMPGT(r, fr, C67_B2); - C67_invert_test = TRUE; - } else if (op == TOK_EQ) { - C67_CMPEQ(r, fr, C67_B2); - C67_invert_test = FALSE; - } else if (op == TOK_NE) { - C67_CMPEQ(r, fr, C67_B2); - C67_invert_test = TRUE; - } else if (op == TOK_ULT) { - C67_CMPLTU(r, fr, C67_B2); - C67_invert_test = FALSE; - } else if (op == TOK_UGE) { - C67_CMPLTU(r, fr, C67_B2); - C67_invert_test = TRUE; - } else if (op == TOK_UGT) { - C67_CMPGTU(r, fr, C67_B2); - C67_invert_test = FALSE; - } else if (op == TOK_ULE) { - C67_CMPGTU(r, fr, C67_B2); - C67_invert_test = TRUE; - } else if (op == '+') - C67_ADD(fr, r); // ADD r,fr,r - else if (op == '-') - C67_SUB(fr, r); // SUB r,fr,r - else if (op == '&') - C67_AND(fr, r); // AND r,fr,r - else if (op == '|') - C67_OR(fr, r); // OR r,fr,r - else if (op == '^') - C67_XOR(fr, r); // XOR r,fr,r - else - ALWAYS_ASSERT(FALSE); - - vtop--; - if (op >= TOK_ULT && op <= TOK_GT) - vset_VT_CMP(0x80); - break; - case '-': - case TOK_SUBC1: /* sub with carry generation */ - opc = 5; - goto gen_op8; - case TOK_ADDC2: /* add with carry use */ - opc = 2; - goto gen_op8; - case TOK_SUBC2: /* sub with carry use */ - opc = 3; - goto gen_op8; - case '&': - opc = 4; - goto gen_op8; - case '^': - opc = 6; - goto gen_op8; - case '|': - opc = 1; - goto gen_op8; - case '*': - case TOK_UMULL: - gv2(RC_INT, RC_INT); - r = vtop[-1].r; - fr = vtop[0].r; - vtop--; - C67_MPYI(fr, r); // 32 bit multiply fr,r,fr - C67_NOP(8); // NOP 8 for worst case - break; - case TOK_SHL: - gv2(RC_INT_BSIDE, RC_INT_BSIDE); // shift amount must be on same side as dst - r = vtop[-1].r; - fr = vtop[0].r; - vtop--; - C67_SHL(fr, r); // arithmetic/logical shift - break; - - case TOK_SHR: - gv2(RC_INT_BSIDE, RC_INT_BSIDE); // shift amount must be on same side as dst - r = vtop[-1].r; - fr = vtop[0].r; - vtop--; - C67_SHRU(fr, r); // logical shift - break; - - case TOK_SAR: - gv2(RC_INT_BSIDE, RC_INT_BSIDE); // shift amount must be on same side as dst - r = vtop[-1].r; - fr = vtop[0].r; - vtop--; - C67_SHR(fr, r); // arithmetic shift - break; - - case '/': - t = TOK__divi; - call_func: - vswap(); - /* call generic idiv function */ - vpush_helper_func(t); - vrott(3); - gfunc_call(2); - vpushi(0); - vtop->r = REG_IRET; - vtop->r2 = VT_CONST; - break; - case TOK_UDIV: - case TOK_PDIV: - t = TOK__divu; - goto call_func; - case '%': - t = TOK__remi; - goto call_func; - case TOK_UMOD: - t = TOK__remu; - goto call_func; - - default: - opc = 7; - goto gen_op8; - } -} - -/* generate a floating point operation 'v = t1 op t2' instruction. The - two operands are guaranteed to have the same floating point type */ -/* XXX: need to use ST1 too */ -void gen_opf(int op) -{ - int ft, fc, fr, r; - - if (op >= TOK_ULT && op <= TOK_GT) - gv2(RC_EDX, RC_EAX); // make sure src2 is on b side - else - gv2(RC_FLOAT, RC_FLOAT); // make sure src2 is on b side - - ft = vtop->type.t; - fc = vtop->c.i; - r = vtop->r; - fr = vtop[-1].r; - - - if ((ft & VT_BTYPE) == VT_LDOUBLE) - tcc_error("long doubles not supported"); - - if (op >= TOK_ULT && op <= TOK_GT) { - - r = vtop[-1].r; - fr = vtop[0].r; - - C67_compare_reg = C67_B2; - - if (op == TOK_LT) { - if ((ft & VT_BTYPE) == VT_DOUBLE) - C67_CMPLTDP(r, fr, C67_B2); - else - C67_CMPLTSP(r, fr, C67_B2); - - C67_invert_test = FALSE; - } else if (op == TOK_GE) { - if ((ft & VT_BTYPE) == VT_DOUBLE) - C67_CMPLTDP(r, fr, C67_B2); - else - C67_CMPLTSP(r, fr, C67_B2); - - C67_invert_test = TRUE; - } else if (op == TOK_GT) { - if ((ft & VT_BTYPE) == VT_DOUBLE) - C67_CMPGTDP(r, fr, C67_B2); - else - C67_CMPGTSP(r, fr, C67_B2); - - C67_invert_test = FALSE; - } else if (op == TOK_LE) { - if ((ft & VT_BTYPE) == VT_DOUBLE) - C67_CMPGTDP(r, fr, C67_B2); - else - C67_CMPGTSP(r, fr, C67_B2); - - C67_invert_test = TRUE; - } else if (op == TOK_EQ) { - if ((ft & VT_BTYPE) == VT_DOUBLE) - C67_CMPEQDP(r, fr, C67_B2); - else - C67_CMPEQSP(r, fr, C67_B2); - - C67_invert_test = FALSE; - } else if (op == TOK_NE) { - if ((ft & VT_BTYPE) == VT_DOUBLE) - C67_CMPEQDP(r, fr, C67_B2); - else - C67_CMPEQSP(r, fr, C67_B2); - - C67_invert_test = TRUE; - } else { - ALWAYS_ASSERT(FALSE); - } - vset_VT_CMP(0x80); - } else { - if (op == '+') { - if ((ft & VT_BTYPE) == VT_DOUBLE) { - C67_ADDDP(r, fr); // ADD fr,r,fr - C67_NOP(6); - } else { - C67_ADDSP(r, fr); // ADD fr,r,fr - C67_NOP(3); - } - vtop--; - } else if (op == '-') { - if ((ft & VT_BTYPE) == VT_DOUBLE) { - C67_SUBDP(r, fr); // SUB fr,r,fr - C67_NOP(6); - } else { - C67_SUBSP(r, fr); // SUB fr,r,fr - C67_NOP(3); - } - vtop--; - } else if (op == '*') { - if ((ft & VT_BTYPE) == VT_DOUBLE) { - C67_MPYDP(r, fr); // MPY fr,r,fr - C67_NOP(9); - } else { - C67_MPYSP(r, fr); // MPY fr,r,fr - C67_NOP(3); - } - vtop--; - } else if (op == '/') { - if ((ft & VT_BTYPE) == VT_DOUBLE) { - // must call intrinsic DP floating point divide - vswap(); - /* call generic idiv function */ - vpush_helper_func(TOK__divd); - vrott(3); - gfunc_call(2); - vpushi(0); - vtop->r = REG_FRET; - vtop->r2 = REG_IRE2; - - } else { - // must call intrinsic SP floating point divide - vswap(); - /* call generic idiv function */ - vpush_helper_func(TOK__divf); - vrott(3); - gfunc_call(2); - vpushi(0); - vtop->r = REG_FRET; - vtop->r2 = VT_CONST; - } - } else - ALWAYS_ASSERT(FALSE); - - - } -} - - -/* convert integers to fp 't' type. Must handle 'int', 'unsigned int' - and 'long long' cases. */ -void gen_cvt_itof(int t) -{ - int r; - - gv(RC_INT); - r = vtop->r; - - if ((t & VT_BTYPE) == VT_DOUBLE) { - if (t & VT_UNSIGNED) - C67_INTDPU(r, r); - else - C67_INTDP(r, r); - - C67_NOP(4); - vtop->type.t = VT_DOUBLE; - } else { - if (t & VT_UNSIGNED) - C67_INTSPU(r, r); - else - C67_INTSP(r, r); - C67_NOP(3); - vtop->type.t = VT_FLOAT; - } - -} - -/* convert fp to int 't' type */ -/* XXX: handle long long case */ -void gen_cvt_ftoi(int t) -{ - int r; - - gv(RC_FLOAT); - r = vtop->r; - - if (t != VT_INT) - tcc_error("long long not supported"); - else { - if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) { - C67_DPTRUNC(r, r); - C67_NOP(3); - } else { - C67_SPTRUNC(r, r); - C67_NOP(3); - } - - vtop->type.t = VT_INT; - - } -} - -/* convert from one floating point type to another */ -void gen_cvt_ftof(int t) -{ - int r, r2; - - if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE && - (t & VT_BTYPE) == VT_FLOAT) { - // convert double to float - - gv(RC_FLOAT); // get it in a register pair - - r = vtop->r; - - C67_DPSP(r, r); // convert it to SP same register - C67_NOP(3); - - vtop->type.t = VT_FLOAT; - vtop->r2 = VT_CONST; // set this as unused - } else if ((vtop->type.t & VT_BTYPE) == VT_FLOAT && - (t & VT_BTYPE) == VT_DOUBLE) { - // convert float to double - - gv(RC_FLOAT); // get it in a register - - r = vtop->r; - - if (r == TREG_EAX) { // make sure the paired reg is avail - r2 = get_reg(RC_ECX); - } else if (r == TREG_EDX) { - r2 = get_reg(RC_ST0); - } else { - ALWAYS_ASSERT(FALSE); - r2 = 0; /* avoid warning */ - } - - C67_SPDP(r, r); // convert it to DP same register - C67_NOP(1); - - vtop->type.t = VT_DOUBLE; - vtop->r2 = r2; // set this as unused - } else { - ALWAYS_ASSERT(FALSE); - } -} - -/* computed goto support */ -void ggoto(void) -{ - gcall_or_jmp(1); - vtop--; -} - -/* Save the stack pointer onto the stack and return the location of its address */ -ST_FUNC void gen_vla_sp_save(int addr) { - tcc_error("variable length arrays unsupported for this target"); -} - -/* Restore the SP from a location on the stack */ -ST_FUNC void gen_vla_sp_restore(int addr) { - tcc_error("variable length arrays unsupported for this target"); -} - -/* Subtract from the stack pointer, and push the resulting value onto the stack */ -ST_FUNC void gen_vla_alloc(CType *type, int align) { - tcc_error("variable length arrays unsupported for this target"); -} - -/* end of C67 code generator */ -/*************************************************************/ -#endif -/*************************************************************/ diff --git a/c67-link.c b/c67-link.c deleted file mode 100644 index 187c13dc..00000000 --- a/c67-link.c +++ /dev/null @@ -1,125 +0,0 @@ -#ifdef TARGET_DEFS_ONLY - -#define EM_TCC_TARGET EM_C60 - -/* relocation type for 32 bit data relocation */ -#define R_DATA_32 R_C60_32 -#define R_DATA_PTR R_C60_32 -#define R_JMP_SLOT R_C60_JMP_SLOT -#define R_GLOB_DAT R_C60_GLOB_DAT -#define R_COPY R_C60_COPY -#define R_RELATIVE R_C60_RELATIVE - -#define R_NUM R_C60_NUM - -#define ELF_START_ADDR 0x00000400 -#define ELF_PAGE_SIZE 0x1000 - -#define PCRELATIVE_DLLPLT 0 -#define RELOCATE_DLLPLT 0 - -#else /* !TARGET_DEFS_ONLY */ - -#include "tcc.h" - -/* Returns 1 for a code relocation, 0 for a data relocation. For unknown - relocations, returns -1. */ -ST_FUNC int code_reloc (int reloc_type) -{ - switch (reloc_type) { - case R_C60_32: - case R_C60LO16: - case R_C60HI16: - case R_C60_GOT32: - case R_C60_GOTOFF: - case R_C60_GOTPC: - case R_C60_COPY: - return 0; - - case R_C60_PLT32: - return 1; - } - return -1; -} - -/* Returns an enumerator to describe whether and when the relocation needs a - GOT and/or PLT entry to be created. See tcc.h for a description of the - different values. */ -ST_FUNC int gotplt_entry_type (int reloc_type) -{ - switch (reloc_type) { - case R_C60_32: - case R_C60LO16: - case R_C60HI16: - case R_C60_COPY: - return NO_GOTPLT_ENTRY; - - case R_C60_GOTOFF: - case R_C60_GOTPC: - return BUILD_GOT_ONLY; - - case R_C60_PLT32: - case R_C60_GOT32: - return ALWAYS_GOTPLT_ENTRY; - } - return -1; -} - -ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr) -{ - tcc_error_noabort("C67 got not implemented"); - return 0; -} - -/* relocate the PLT: compute addresses and offsets in the PLT now that final - address for PLT and GOT are known (see fill_program_header) */ -ST_FUNC void relocate_plt(TCCState *s1) -{ - uint8_t *p, *p_end; - - if (!s1->plt) - return; - - p = s1->plt->data; - p_end = p + s1->plt->data_offset; - - if (p < p_end) { - /* XXX: TODO */ - while (p < p_end) { - /* XXX: TODO */ - } - } -} - -ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t addr, addr_t val) -{ - switch(type) { - case R_C60_32: - *(int *)ptr += val; - break; - case R_C60LO16: - { - uint32_t orig; - - /* put the low 16 bits of the absolute address add to what is - already there */ - orig = ((*(int *)(ptr )) >> 7) & 0xffff; - orig |= (((*(int *)(ptr+4)) >> 7) & 0xffff) << 16; - - /* patch both at once - assumes always in pairs Low - High */ - *(int *) ptr = (*(int *) ptr & (~(0xffff << 7)) ) | - (((val+orig) & 0xffff) << 7); - *(int *)(ptr+4) = (*(int *)(ptr+4) & (~(0xffff << 7)) ) | - ((((val+orig)>>16) & 0xffff) << 7); - } - break; - case R_C60HI16: - break; - default: - fprintf(stderr,"FIXME: handle reloc type %x at %x [%p] to %x\n", - type, (unsigned) addr, ptr, (unsigned) val); - break; - } -} - -#endif /* !TARGET_DEFS_ONLY */ diff --git a/coff.h b/coff.h index e8e6185a..1fb43fc2 100644 --- a/coff.h +++ b/coff.h @@ -3,82 +3,58 @@ /* COFF data structures and related definitions used by the linker */ /**************************************************************************/ +# include + /*------------------------------------------------------------------------*/ /* COFF FILE HEADER */ /*------------------------------------------------------------------------*/ -struct filehdr { - unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ - long f_timdat; /* time & date stamp */ - long f_symptr; /* file pointer to symtab */ - long f_nsyms; /* number of symtab entries */ - unsigned short f_opthdr; /* sizeof(optional hdr) */ - unsigned short f_flags; /* flags */ - unsigned short f_TargetID; /* for C6x = 0x0099 */ - }; -/*------------------------------------------------------------------------*/ -/* File header flags */ -/*------------------------------------------------------------------------*/ -#define F_RELFLG 0x01 /* relocation info stripped from file */ -#define F_EXEC 0x02 /* file is executable (no unresolved refs) */ -#define F_LNNO 0x04 /* line numbers stripped from file */ -#define F_LSYMS 0x08 /* local symbols stripped from file */ -#define F_GSP10 0x10 /* 34010 version */ -#define F_GSP20 0x20 /* 34020 version */ -#define F_SWABD 0x40 /* bytes swabbed (in names) */ -#define F_AR16WR 0x80 /* byte ordering of an AR16WR (PDP-11) */ -#define F_LITTLE 0x100 /* byte ordering of an AR32WR (vax) */ -#define F_BIG 0x200 /* byte ordering of an AR32W (3B, maxi) */ -#define F_PATCH 0x400 /* contains "patch" list in optional header */ -#define F_NODF 0x400 +typedef struct filehdr +{ + uint16_t f_magic; + uint16_t f_nscns; + int32_t f_timdat; + int32_t f_symptr; + int32_t f_nsyms; + uint16_t f_opthdr; + uint16_t f_flags; +} FILHDR; -#define F_VERSION (F_GSP10 | F_GSP20) -#define F_BYTE_ORDER (F_LITTLE | F_BIG) -#define FILHDR struct filehdr +# define FILHSZ sizeof(FILHDR) -/* #define FILHSZ sizeof(FILHDR) */ -#define FILHSZ 22 /* above rounds to align on 4 bytes which causes problems */ +# define F_MACH_I386 0x14c -#define COFF_C67_MAGIC 0x00c2 +# define F_RELFLG 0x0001 +# define F_EXEC 0x0002 +# define F_LNNO 0x0004 +# define F_LSYMS 0x0008 +# define F_LITTLE 0x0100 +# define F_BIG 0x0200 +# define F_SYMMERGE 0x1000 -/*------------------------------------------------------------------------*/ -/* Macros to recognize magic numbers */ -/*------------------------------------------------------------------------*/ -#define ISMAGIC(x) (((unsigned short)(x))==(unsigned short)magic) -#define ISARCHIVE(x) ((((unsigned short)(x))==(unsigned short)ARTYPE)) -#define BADMAGIC(x) (((unsigned short)(x) & 0x8080) && !ISMAGIC(x)) - - /*------------------------------------------------------------------------*/ /* OPTIONAL FILE HEADER */ /*------------------------------------------------------------------------*/ -typedef struct aouthdr { - short magic; /* see magic.h */ - short vstamp; /* version stamp */ - long tsize; /* text size in bytes, padded to FW bdry*/ - long dsize; /* initialized data " " */ - long bsize; /* uninitialized data " " */ - long entrypt; /* entry pt. */ - long text_start; /* base of text used for this file */ - long data_start; /* base of data used for this file */ +typedef struct aouthdr +{ + int16_t magic; + int16_t vstamp; + int32_t tsize; + int32_t dsize; + int32_t bsize; + int32_t entry; + int32_t text_start; + int32_t data_start; } AOUTHDR; -#define AOUTSZ sizeof(AOUTHDR) +# define AOUTHSZ sizeof(AOUTHDR) -/*----------------------------------------------------------------------*/ -/* When a UNIX aout header is to be built in the optional header, */ -/* the following magic numbers can appear in that header: */ -/* */ -/* AOUT1MAGIC : default : readonly sharable text segment */ -/* AOUT2MAGIC: : writable text segment */ -/* PAGEMAGIC : : configured for paging */ -/*----------------------------------------------------------------------*/ -#define AOUT1MAGIC 0410 -#define AOUT2MAGIC 0407 -#define PAGEMAGIC 0413 +# define OMAGIC 0404 +# define NMAGIC 0410 +# define ZMAGIC 0413 +# define STMAGIC 0401 +# define SHMAGIC 0443 - /*------------------------------------------------------------------------*/ /* COMMON ARCHIVE FILE STRUCTURES */ /* */ @@ -125,27 +101,41 @@ struct ar_hdr /* archive file member header - printable ascii */ char ar_fmag[2]; /* ARFMAG - string to end header */ }; - /*------------------------------------------------------------------------*/ /* SECTION HEADER */ /*------------------------------------------------------------------------*/ -struct scnhdr { - char s_name[8]; /* section name */ - long s_paddr; /* physical address */ - long s_vaddr; /* virtual address */ - long s_size; /* section size */ - long s_scnptr; /* file ptr to raw data for section */ - long s_relptr; /* file ptr to relocation */ - long s_lnnoptr; /* file ptr to line numbers */ - unsigned int s_nreloc; /* number of relocation entries */ - unsigned int s_nlnno; /* number of line number entries */ - unsigned int s_flags; /* flags */ - unsigned short s_reserved; /* reserved byte */ - unsigned short s_page; /* memory page id */ - }; -#define SCNHDR struct scnhdr -#define SCNHSZ sizeof(SCNHDR) +typedef struct scnhdr +{ + int8_t s_name[8]; + int32_t s_paddr; + int32_t s_vaddr; + int32_t s_size; + int32_t s_scnptr; + int32_t s_relptr; + int32_t s_lnnoptr; + uint16_t s_nreloc; + uint16_t s_nlnno; + int32_t s_flags; +} __attribute__((packed)) SCNHDR; + +# define SCNHSZ sizeof(SCNHDR) + +/*------------------------------------------------------------------------*/ +/* The low 4 bits of s_flags is used as a section "type" */ +/*------------------------------------------------------------------------*/ +# define STYP_REG 0x000 /* "regular" : allocated, relocated, loaded */ +# define STYP_DSECT 0x001 /* "dummy" : not allocated, relocated, not loaded */ +# define STYP_NOLOAD 0x002 /* "noload" : allocated, relocated, not loaded */ +# define STYP_GROUP 0x004 /* "grouped" : formed of input sections */ +# define STYP_PAD 0x008 /* "padding" : not allocated, not relocated, loaded */ +# define STYP_COPY 0x010 /* "copy" : used for C init tables */ +# define STYP_TEXT 0x020 /* section contains text only */ +# define STYP_DATA 0x040 /* section contains data only */ +# define STYP_BSS 0x080 /* section contains bss only */ +# define STYP_INFO 0x200 +# define STYP_OVER 0x400 +# define STYP_LIB 0x800 /*------------------------------------------------------------------------*/ /* Define constants for names of "special" sections */ @@ -156,67 +146,28 @@ struct scnhdr { #define _CINIT ".cinit" #define _TV ".tv" -/*------------------------------------------------------------------------*/ -/* The low 4 bits of s_flags is used as a section "type" */ -/*------------------------------------------------------------------------*/ -#define STYP_REG 0x00 /* "regular" : allocated, relocated, loaded */ -#define STYP_DSECT 0x01 /* "dummy" : not allocated, relocated, not loaded */ -#define STYP_NOLOAD 0x02 /* "noload" : allocated, relocated, not loaded */ -#define STYP_GROUP 0x04 /* "grouped" : formed of input sections */ -#define STYP_PAD 0x08 /* "padding" : not allocated, not relocated, loaded */ -#define STYP_COPY 0x10 /* "copy" : used for C init tables - - not allocated, relocated, - loaded; reloc & lineno - entries processed normally */ -#define STYP_TEXT 0x20 /* section contains text only */ -#define STYP_DATA 0x40 /* section contains data only */ -#define STYP_BSS 0x80 /* section contains bss only */ -#define STYP_ALIGN 0x100 /* align flag passed by old version assemblers */ -#define ALIGN_MASK 0x0F00 /* part of s_flags that is used for align vals */ -#define ALIGNSIZE(x) (1 << ((x & ALIGN_MASK) >> 8)) - - /*------------------------------------------------------------------------*/ /* RELOCATION ENTRIES */ /*------------------------------------------------------------------------*/ -struct reloc +typedef struct reloc { - long r_vaddr; /* (virtual) address of reference */ - short r_symndx; /* index into symbol table */ - unsigned short r_disp; /* additional bits for address calculation */ - unsigned short r_type; /* relocation type */ -}; - -#define RELOC struct reloc -#define RELSZ 10 /* sizeof(RELOC) */ + uint32_t r_vaddr; /* address of reference */ + uint32_t r_symndx; /* symbol address */ + uint16_t r_type; /* relocation type */ +} __attribute__((packed)) RELOC; +# define RELSZ 10 /*--------------------------------------------------------------------------*/ /* define all relocation types */ /*--------------------------------------------------------------------------*/ -#define R_ABS 0 /* absolute address - no relocation */ -#define R_DIR16 01 /* UNUSED */ -#define R_REL16 02 /* UNUSED */ -#define R_DIR24 04 /* UNUSED */ -#define R_REL24 05 /* 24 bits, direct */ -#define R_DIR32 06 /* UNUSED */ -#define R_RELBYTE 017 /* 8 bits, direct */ -#define R_RELWORD 020 /* 16 bits, direct */ -#define R_RELLONG 021 /* 32 bits, direct */ -#define R_PCRBYTE 022 /* 8 bits, PC-relative */ -#define R_PCRWORD 023 /* 16 bits, PC-relative */ -#define R_PCRLONG 024 /* 32 bits, PC-relative */ -#define R_OCRLONG 030 /* GSP: 32 bits, one's complement direct */ -#define R_GSPPCR16 031 /* GSP: 16 bits, PC relative (in words) */ -#define R_GSPOPR32 032 /* GSP: 32 bits, direct big-endian */ -#define R_PARTLS16 040 /* Brahma: 16 bit offset of 24 bit address*/ -#define R_PARTMS8 041 /* Brahma: 8 bit page of 24 bit address */ -#define R_PARTLS7 050 /* DSP: 7 bit offset of 16 bit address */ -#define R_PARTMS9 051 /* DSP: 9 bit page of 16 bit address */ -#define R_REL13 052 /* DSP: 13 bits, direct */ +# define R_ABS 0x00 /* absolute address - no relocation */ +# define R_DIR32 0x06 /* */ +# define R_DIR32NB 0x07 /* */ +# define R_SECREL 0x0B +# define R_REL32 0x24 /* 32 bits, PC-relative */ - /*------------------------------------------------------------------------*/ /* LINE NUMBER ENTRIES */ /*------------------------------------------------------------------------*/ @@ -234,7 +185,6 @@ struct lineno #define LINENO struct lineno #define LINESZ 6 /* sizeof(LINENO) */ - /*------------------------------------------------------------------------*/ /* STORAGE CLASSES */ /*------------------------------------------------------------------------*/ @@ -266,8 +216,7 @@ struct lineno #define C_LINE 104 /* dummy sclass for line number entry */ #define C_ALIAS 105 /* duplicate tag */ #define C_HIDDEN 106 /* special storage class for external */ - /* symbols in dmert public libraries */ - + /*------------------------------------------------------------------------*/ /* SYMBOL TABLE ENTRIES */ /*------------------------------------------------------------------------*/ @@ -276,25 +225,26 @@ struct lineno #define FILNMLEN 14 /* Number of characters in a file name */ #define DIMNUM 4 /* Number of array dimensions in auxiliary entry */ - -struct syment +typedef struct syment { union { - char _n_name[SYMNMLEN]; /* old COFF version */ + char _n_name[SYMNMLEN]; /* symbol name */ struct { - long _n_zeroes; /* new == 0 */ - long _n_offset; /* offset into string table */ + int32_t _n_zeroes; /* symbol name */ + int32_t _n_offset; /* loc in str table */ } _n_n; - char *_n_nptr[2]; /* allows for overlaying */ + uint32_t _n_nptr[2]; } _n; - long n_value; /* value of symbol */ - short n_scnum; /* section number */ - unsigned short n_type; /* type and derived type */ - char n_sclass; /* storage class */ - char n_numaux; /* number of aux. entries */ -}; + uint32_t n_value; + int16_t n_scnum; + uint16_t n_type; + int8_t n_sclass; + int8_t n_numaux; +} __attribute__((packed)) SYMENT; + +# define SYMESZ 18 #define n_name _n._n_name #define n_nptr _n._n_nptr[1] @@ -312,7 +262,6 @@ struct syment #define N_TV (unsigned short)-3 /* needs transfer vector (preload) */ #define P_TV (unsigned short)-4 /* needs transfer vector (postload) */ - /*------------------------------------------------------------------------*/ /* The fundamental type of a symbol packed into the low */ /* 4 bits of the word. */ @@ -370,7 +319,6 @@ struct syment #define INCREF_COFF(x) ((((x)&~N_BTMASK_COFF)<>N_TSHIFT_COFF)&~N_BTMASK_COFF)|((x)&N_BTMASK_COFF)) - /*------------------------------------------------------------------------*/ /* AUXILIARY SYMBOL ENTRY */ /*------------------------------------------------------------------------*/ @@ -414,9 +362,6 @@ union auxent } x_scn; }; -#define SYMENT struct syment -#define SYMESZ 18 /* sizeof(SYMENT) */ - #define AUXENT union auxent #define AUXESZ 18 /* sizeof(AUXENT) */ diff --git a/configure b/configure deleted file mode 100755 index 8be3d9fd..00000000 --- a/configure +++ /dev/null @@ -1,750 +0,0 @@ -#!/bin/sh -# -# tcc configure script (c) 2003 Fabrice Bellard - -# set temporary file name -# if test ! -z "$TMPDIR" ; then -# TMPDIR1="${TMPDIR}" -# elif test ! -z "$TEMPDIR" ; then -# TMPDIR1="${TEMPDIR}" -# else -# TMPDIR1="/tmp" -# fi -# -# bashism: TMPN="${TMPDIR1}/tcc-conf-${RANDOM}-$$-${RANDOM}.c" - -TMPN="./conftest-$$" -TMPH=$TMPN.h - -# default parameters -prefix="" -execprefix="" -bindir="" -libdir="" -tccdir="" -includedir="" -mandir="" -infodir="" -sysroot="" -cross_prefix="" -cc="gcc" -ar="ar" -bigendian="no" -mingw32="no" -LIBSUF=".a" -EXESUF="" -DLLSUF=".so" -tcc_usrinclude="" -tcc_sysincludepaths="" -tcc_libpaths="" -tcc_crtprefix="" -tcc_elfinterp="" -triplet= -tcc_lddir= -confvars= -suggest="yes" -gcc_major=0 -gcc_minor=0 -cc_name="gcc" -ar_set= -cpu= -cpuver= -dwarf= -targetos= -build_cross= - -# use CC/AR from environment when set -test -n "$CC" && cc="$CC" -test -n "$AR" && ar="$AR" - -# set default CFLAGS if unset in environment -test -z "$CFLAGS" && CFLAGS="-Wall -O2" - -# find source path -source_path=${0%configure} -source_path=${source_path%/} - -# $1: --OPTNAME=VALUE [, $2: NAME to assign-to instead of OPTNAME] -assign_opt() { - set -- "${2:-${1%%=*}}" "${1#*=}" # [--OPT]NAME VALUE - eval ${1#--}=\$2 # no risk of IFS/glob in [OPT]NAME -} - -# succeed if $1 doesn't IFS-split funny (globs, spaces, ...) -good_split() { - set -- "$1" $1 - test $# = 2 && test "$1" = "$2" -} - -# $1: NAME[=VALUE] succeed if confvars has NAME or NAME=* element -confvars_has() { - ! case " $confvars " in *" ${1%%=*} "* | *" ${1%%=*}="*) - false - esac -} - -# [multiple] NAME or NAME=VAL -confvars_set() { - for cv; do - good_split "$cv" || { echo "configure: ERROR: bad config '$cv'"; exit 1; } - confvars_has "$cv" && echo "configure: WARNING: duplicate config '$cv'" - confvars="$confvars $cv" - done -} - -for opt do - eval opt=\"$opt\" - case "$opt" in - --prefix=*) assign_opt "$opt" - ;; - --exec-prefix=*) assign_opt "$opt" execprefix - ;; - --tccdir=*) assign_opt "$opt" - ;; - --bindir=*) assign_opt "$opt" - ;; - --libdir=*) assign_opt "$opt" - ;; - --includedir=*) assign_opt "$opt" - ;; - --sharedir=*) assign_opt "$opt" - ;; - --mandir=*) assign_opt "$opt" - ;; - --infodir=*) assign_opt "$opt" - ;; - --docdir=*) assign_opt "$opt" - ;; - --sysroot=*) assign_opt "$opt" - ;; - --targetos=*) assign_opt "$opt" - ;; - --source-path=*) assign_opt "$opt" source_path - ;; - --cross-prefix=*) assign_opt "$opt" cross_prefix - ;; - --cc=*) assign_opt "$opt" - ;; - --ar=*) assign_opt "$opt" ; ar_set="yes" - ;; - --extra-cflags=*) assign_opt "$opt" CFLAGS - ;; - --extra-ldflags=*) assign_opt "$opt" LDFLAGS - ;; - --extra-libs=*) assign_opt "$opt" extralibs - ;; - --sysincludepaths=*) assign_opt "$opt" tcc_sysincludepaths - ;; - --libpaths=*) assign_opt "$opt" tcc_libpaths - ;; - --crtprefix=*) assign_opt "$opt" tcc_crtprefix - ;; - --elfinterp=*) assign_opt "$opt" tcc_elfinterp - ;; - --triplet=*) assign_opt "$opt" - ;; - --cpu=*) assign_opt "$opt" - ;; - --dwarf=*) confvars_set "dwarf=${opt#*=}" - ;; - --enable-cross) confvars_set cross - ;; - --disable-static) confvars_set static=no - ;; - --enable-static) confvars_set static - ;; - --disable-rpath) confvars_set rpath=no - ;; - --debug) confvars_set debug - ;; - --with-libgcc) confvars_set libgcc - ;; - --with-selinux) confvars_set selinux - ;; - --tcc-switches=*) assign_opt "$opt" tcc_switches - ;; - --config-mingw32) mingw32=yes - ;; - --config-mingw32=*) assign_opt "$opt" mingw32 - ;; - --config-*) confvars_set "${opt#--config-}"; suggest="no" - ;; - --help|-h) show_help="yes" - ;; - *) echo "configure: WARNING: unrecognized option $opt" - ;; - esac -done - -show_help() { -cat << EOF -Usage: configure [options] -Options: [defaults in brackets after descriptions] - -Standard options: - --help print this message - --prefix=PREFIX install in PREFIX [$prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --tccdir=DIR installation directory [EPREFIX/lib/tcc] - --includedir=DIR C header files in DIR [PREFIX/include] - --sharedir=DIR documentation root DIR [PREFIX/share] - --docdir=DIR documentation in DIR [SHAREDIR/doc/tcc] - --mandir=DIR man documentation in DIR [SHAREDIR/man] - --infodir=DIR info documentation in DIR [SHAREDIR/info] - -Advanced options (experts only): - --source-path=PATH path of source code [$source_path] - --sysroot=PREFIX prepend PREFIX to library/include paths [$sysroot] - --cc=CC use C compiler CC [$cc] - --ar=AR create archives using AR [$ar] - --extra-cflags= specify compiler flags [$CFLAGS] - --extra-ldflags= specify linker options [$LDFLAGS] - - --debug include debug info with resulting binaries - --disable-static make libtcc.so instead of libtcc.a - --enable-static make libtcc.a instead of libtcc.dll (win32) - --disable-rpath disable use of -rpath with libtcc.so - --with-libgcc use libgcc_s.so.1 instead of libtcc1.a - --with-selinux use mmap for executable memory (tcc -run) - --enable-cross build cross compilers (see also 'make help') - - --sysincludepaths=... specify system include paths, colon separated - --libpaths=... specify system library paths, colon separated - --crtprefix=... specify locations of crt?.o, colon separated - --elfinterp=... specify elf interpreter - --triplet=... specify system library/include directory triplet - --tcc-switches=... specify implicit switches passed to tcc - - --config-uClibc,-musl enable system specific configurations - --config-mingw32[=yes|no] build on windows using msys, busybox, etc. - --config-backtrace=no disable stack backtraces (with -run or -bt) - --config-bcheck=no disable bounds checker (-b) - --config-predefs=no do not compile tccdefs.h, instead just include - --config-new_macho=no|yes force apple object format (autodetect osx <= 10) - --config-new_dtags=yes use new ELF DTAGs (DT_RUNPATH instead of DT_RPATH) - --config-codesign=no do not use codesign on apple to sign executables - --config-dwarf=x use dwarf debug info instead of stabs (x=2..5) - -Cross build options (experimental): - --cpu=CPU target CPU [$cpu] - --targetos=... target OS (Darwin,WIN32,Android/Termux) [$targetos] - --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix] -EOF -exit 1 -} - -default() # set variable unless already set and not empty -{ - test -n "$2" && eval : \${$1:=\$2} # ': ${foo:=$2}' -} - -default_conf() # add one config to confvars unless already present -{ - confvars_has "$1" || confvars_set "$1" -} - -if test -z "${source_path#.}" ; then - source_path=$(pwd) - source_path_used="no" -else - source_path_used="yes" -fi - -# OS specific -buildos=$(uname) -cpu_sys=$(uname -m) - -case $buildos in - Windows_NT|MINGW*|MSYS*|CYGWIN*) - buildos="WIN32" - test "$MSYSTEM" = "MINGW32" && cpu_sys=i386 - ;; - Linux) - if test "$(uname -o)" = "Android"; then - buildos=Android - if test -n "$TERMUX_VERSION"; then - buildos=Termux - fi - fi - ;; -esac - -if test "$mingw32" = "yes"; then - default targetos WIN32 -else - default targetos "$buildos" -fi - -default cpu "$cpu_sys" - -# check for crpss build -if test "$cpu" != "$cpu_sys" || - test "$targetos" != "$buildos" || - test -n "$cross_prefix" -then - build_cross="yes" - cc="${cross_prefix}${cc}" - ar="${cross_prefix}${ar}" -fi - -case "$cpu" in - x86|i386|i486|i586|i686|i86pc|BePC|i686-AT386) - cpu="i386" - ;; - x86_64|amd64|x86-64) - cpu="x86_64" - ;; - evbarm) - case "`uname -p`" in - aarch64|arm64) - cpu="arm64" - ;; - earmv*) - cpu="arm" - ;; - esac - ;; - aarch64|arm64|evbarm) - cpu="arm64" - ;; - arm*) - case "$cpu" in - arm|armv4l) - cpuver=4 - ;; - armv5tel|armv5tejl) - cpuver=5 - ;; - armv6j|armv6l) - cpuver=6 - ;; - armv7|armv7a|armv7l) - cpuver=7 - ;; - esac - cpu="arm" - ;; - alpha) - cpu="alpha" - ;; - "Power Macintosh"|ppc|ppc64) - cpu="ppc" - ;; - mips) - cpu="mips" - ;; - s390) - cpu="s390" - ;; - riscv64) - cpu="riscv64" - ;; - *) - echo "Unsupported CPU" - exit 1 - ;; -esac - -case $targetos in - Darwin) - confvars_set OSX dwarf=4 - default_conf "codesign" - DLLSUF=".dylib" - if test -z "$build_cross"; then - cc=`command -v cc` - cc=`readlink $cc || echo clang` - tcc_usrinclude="`xcrun --show-sdk-path`/usr/include" - if test "${confvars%new_macho*}" = "${confvars}"; then - # if new_macho was not specified and (known) ver <= 10, use old (=no) - osxver=$(sw_vers -productVersion 2>/dev/null) # X.Y.Z - osxver=${osxver%%.*} # major version (or empty on sw_vers error) - [ "${osxver:-11}" -ge 11 ] || confvars_set new_macho=no - fi - fi - # on OSX M1 with --cpu=x86_64, build a tcc to run under rosetta entirely - if test "$cpu" = x86_64 && test "$cpu_sys" = arm64; then - CFLAGS="$CFLAGS -arch $cpu" - LDFLAGS="$LDFLAGS -arch $cpu" - fi - ;; - DragonFly|OpenBSD|FreeBSD|NetBSD) - confvars_set BSD ldl=no - ;; - Android|Termux) - if test "$targetos" = "Termux"; then - targetos=Android - default sysroot "/data/data/com.termux/files/usr" - else - default sysroot "/usr" - fi - default prefix "${sysroot}" - confvars_set Android new_dtags rpath=no - test "${cpu}" != "i386" && confvars_set pie - default_conf "static=no" - case "$cpu" in - arm) default triplet "arm-linux-androideabi"; cpuver=7 ;; - arm64) default triplet "aarch64-linux-android" ;; - x86_64) default triplet "x86_64-linux-android" ;; - i386) default triplet "i686-linux-android" ;; - esac - test "${cpu%64}" != "${cpu}" && S="64" || S="" - default tcc_sysincludepaths "{B}/include:{R}/include:{R}/include/${triplet}" - default tcc_libpaths "{B}:{R}/lib:/system/lib${S}" - default tcc_crtprefix "{R}/lib" - default tcc_elfinterp "/system/bin/linker${S}" - default tcc_switches "-Wl,-rpath=$sysroot/lib" - ;; - WIN32) - mingw32="yes" - confvars="WIN32 $confvars" # WIN32 intentionally first (commit 729918ef) - default prefix "C:/Program Files/tcc" - default tccdir "${prefix}" - default bindir "${tccdir}" - default docdir "${tccdir}/doc" - default libdir "${tccdir}/libtcc" - # set tccdir at runtime from executable path - test "$tccdir" = "$bindir" && tccdir_auto="yes" - # chech $cc to avoid mingw gcc dependencies such as 'libgcc_s_dw2-1.dll' - # (no confirmed $cc_name yet, and also will never have if cross compiling) - test "${cc%gcc*}" = "$cc" || default LDFLAGS "-static" - LIBSUF=".lib" - EXESUF=".exe" - DLLSUF=".dll" - if test "$source_path_used" = "no"; then - source_path="." - fi - ;; - *) - ;; -esac - -if test "$mingw32" = "no"; then - default prefix "/usr/local" - default execprefix "${prefix}" - default libdir "${execprefix}/lib" - default bindir "${execprefix}/bin" - default tccdir "${libdir}/tcc" - default includedir "${prefix}/include" - default sharedir "${prefix}/share" - default docdir "${sharedir}/doc" - default mandir "${sharedir}/man" - default infodir "${sharedir}/info" -fi - -if test x"$show_help" = "xyes" ; then - show_help -fi - -CONFTEST=./conftest$EXESUF -if test -z "$cross_prefix" \ - && $cc -o $CONFTEST "$source_path/conftest.c" \ - && $CONFTEST 2>/dev/null; then - cc_name="$($CONFTEST compiler)" - gcc_major="$($CONFTEST version)" - gcc_minor="$($CONFTEST minor)" -else - if test -z "$build_cross"; then - echo "configure: error: '$cc' failed to compile conftest.c." - fi - if test "${cc%tcc*}" != "$cc"; then - cc_name="tcc" - elif test "${cc%clang*}" != "$cc"; then - cc_name="clang" - fi -fi - -if test -z "$build_cross"; then - bigendian="$($CONFTEST bigendian)" - _triplet="$($CONFTEST triplet)" - if test "$mingw32" = "no" ; then - if test -z "$triplet" && test -n "$_triplet"; then - if test -f "/usr/lib/$_triplet/crti.o"; then - triplet="$_triplet" - fi - fi - if test -z "$triplet"; then - case $cpu in x86_64|arm64|riscv64) - if test -f "/usr/lib64/crti.o" ; then - tcc_lddir="lib64" - fi - esac - fi - if test "$suggest" = "yes"; then - if test -f "/lib/ld-uClibc.so.0" ; then - echo "Perhaps you want ./configure --config-uClibc" - fi - if test -f "/lib/ld-musl-${cpu}.so.1"; then - echo "Perhaps you want ./configure --config-musl" - fi - fi - fi -else - # can only make guesses about compiler and target - case $cpu in - ppc|mips|s390) bigendian=yes;; - esac - case $targetos in - Linux) - default triplet "${cpu}-linux-gnu" - esac -fi - -if test "$bigendian" = "yes" ; then - confvars_set BIGENDIAN -fi - -if test "$cpu" = "arm"; then - if test "${triplet%eabihf}" != "$triplet" ; then - confvars_set arm_eabihf arm_vfp - elif test "${triplet%eabi}" != "$triplet" ; then - confvars_set arm_eabi arm_vfp - elif test -z "$build_cross"; then - if test "${_triplet%eabihf}" != "$_triplet" ; then - confvars_set arm_eabihf arm_vfp - elif test "${_triplet%eabi}" != "$_triplet" ; then - confvars_set arm_eabi arm_vfp - elif grep -s -q "^Features.* \(vfp\|iwmmxt\) " /proc/cpuinfo ; then - confvars_set arm_vfp - fi - fi -fi - -# a final configuration tuning -if test "$cc_name" != "tcc"; then - OPT1="-Wdeclaration-after-statement" #-fno-strict-aliasing - # we want -Wno- but gcc does not always reject unknown -Wno- options - if test "$cc_name" = "clang"; then - OPT2= #"-Wstring-plus-int" - else - OPT2="-Wunused-result" - fi - $cc $OPT1 $OPT2 -o a.out -c -xc - < /dev/null > cc_msg.txt 2>&1 - for o in $OPT1; do # enable these options - if ! grep -q -- $o cc_msg.txt; then CFLAGS="$CFLAGS $o"; fi - done - for o in $OPT2; do # disable these options - if ! grep -q -- $o cc_msg.txt; then CFLAGS="$CFLAGS -Wno-${o#-W*}"; fi - done - # cat cc_msg.txt - # echo $CFLAGS - rm -f cc_msg.txt a.out -else # cc is tcc - test "$ar_set" || ar="$cc -ar" -fi - -fcho() { if test -n "$2"; then echo "$1$2"; fi } - -fcho "Binary directory " "$bindir" -fcho "TinyCC directory " "$tccdir" -fcho "Library directory " "$libdir" -fcho "Include directory " "$includedir" -fcho "Manual directory " "$mandir" -fcho "Info directory " "$infodir" -fcho "Doc directory " "$docdir" -fcho "Target root prefix " "$sysroot" -fcho "/usr/include dir " "$tcc_usrinclude" -echo "Source path $source_path" -echo "Build OS $(uname -m -s)" -echo "C compiler $cc ($gcc_major.$gcc_minor)" -echo "Target OS $targetos" -echo "CPU $cpu" -fcho "Triplet " "$triplet" -fcho "Libs " "$tcc_libpaths" -fcho "Sysinclude " "$tcc_sysincludepaths" -fcho "Crt " "$tcc_crtprefix" -fcho "Elfinterp " "$tcc_elfinterp" -fcho "Switches " "$tcc_switches" -fcho "Config " "${confvars# }" -echo "Creating config.mak and config.h" - -version=$(head "$source_path/VERSION") - -cat >config.mak <>config.mak -else - echo 'TOPSRC=$(TOP)' >>config.mak -fi - -# $1: macro name, $2: val to set - quoted [, $3: non-empty for #ifndef] -print_str() { - if test -n "$2"; then - test -n "$3" && echo "#ifndef $1" >> $TMPH - echo "#define $1 \"$2\"" >> $TMPH - test -n "$3" && echo "#endif" >> $TMPH - fi -} - -# $1: macro name, $2: val to set [, $3: non-empty for #ifndef] -print_num() { - if test -n "$2"; then - test -n "$3" && echo "#ifndef $1" >> $TMPH - echo "#define $1 $2" >> $TMPH - test -n "$3" && echo "#endif" >> $TMPH - fi -} - -cat >$TMPH <> config.mak - case "$R" in - # CPU - CONFIG_i386=yes) print_num TCC_TARGET_I386 1 ;; - CONFIG_x86_64=yes) print_num TCC_TARGET_X86_64 1 ;; - CONFIG_arm64=yes) print_num TCC_TARGET_ARM64 1 ;; - CONFIG_riscv64=yes) print_num TCC_TARGET_RISCV64 1 ;; - CONFIG_arm=yes) print_num TCC_TARGET_ARM 1 - print_num CONFIG_TCC_CPUVER "$cpuver" ;; - CONFIG_arm_eabihf=yes) print_num TCC_ARM_EABI 1 - print_num TCC_ARM_HARDFLOAT 1 ;; - CONFIG_arm_eabi=yes) print_num TCC_ARM_EABI 1 ;; - CONFIG_arm_vfp=yes) print_num TCC_ARM_VFP 1 ;; - # OS - CONFIG_WIN32=yes) print_num TCC_TARGET_PE 1 ;; - CONFIG_OSX=yes) print_num TCC_TARGET_MACHO 1 ;; - CONFIG_Android=yes) print_num TARGETOS_ANDROID 1 ;; - CONFIG_BSD=yes) print_num TARGETOS_$targetos 1 - case "$targetos" in - FreeBSD) default tcc_elfinterp "/libexec/ld-elf.so.1";; - FreeBSD_kernel) - case "$cpu" in - x86_64) default tcc_elfinterp "/lib/ld-kfreebsd-x86-64.so.1";; - *) default tcc_elfinterp "/lib/ld.so.1";; - esac ;; - DragonFly) default tcc_elfinterp "/usr/libexec/ld-elf.so.2";; - NetBSD) default tcc_elfinterp "/usr/libexec/ld.elf_so";; - OpenBSD) default tcc_elfinterp "/usr/libexec/ld.so";; - esac - ;; - CONFIG_uClibc=yes) print_num CONFIG_TCC_UCLIBC 1 - default tcc_elfinterp "/lib/ld-uClibc.so.0" - ;; - CONFIG_musl=yes) print_num CONFIG_TCC_MUSL 1 - case "$cpu" in - arm64) default tcc_elfinterp "/lib/ld-musl-aarch64.so.1";; - *) default tcc_elfinterp "/lib/ld-musl-${cpu}.so.1";; - esac - ;; - # other - CONFIG_libgcc=yes) print_num CONFIG_USE_LIBGCC 1 ;; - CONFIG_selinux=yes) print_num CONFIG_SELINUX 1 ;; - CONFIG_pie=yes) print_num CONFIG_TCC_PIE 1 ;; - CONFIG_pic=yes) print_num CONFIG_TCC_PIC 1 ;; - CONFIG_new_dtags=yes) print_num CONFIG_NEW_DTAGS 1 ;; - CONFIG_codesign=yes) print_num CONFIG_CODESIGN 1 ;; - CONFIG_new_macho=no) print_num CONFIG_NEW_MACHO 0 ;; - CONFIG_bcheck=no) print_num CONFIG_TCC_BCHECK 0 ;; - CONFIG_backtrace=no) print_num CONFIG_TCC_BACKTRACE 0 ;; - CONFIG_dwarf=*) print_num CONFIG_DWARF_VERSION ${R#*=} ;; - CONFIG_semlock=*) print_num CONFIG_TCC_SEMLOCK ${R#*=} ;; - CONFIG_predefs=no) predefs=0 ;; - esac -done - -print_str CONFIG_USR_INCLUDE "$tcc_usrinclude" -print_str CONFIG_TCC_SYSINCLUDEPATHS "$tcc_sysincludepaths" -print_str CONFIG_TCC_LIBPATHS "$tcc_libpaths" -print_str CONFIG_TCC_CRTPREFIX "$tcc_crtprefix" -print_str CONFIG_TCC_ELFINTERP "$tcc_elfinterp" -print_str CONFIG_TCC_SWITCHES "$tcc_switches" -print_str CONFIG_LDDIR "$tcc_lddir" -print_str CONFIG_TRIPLET "$triplet" -echo "#endif" >> $TMPH && echo >> $TMPH - -print_str CONFIG_SYSROOT "$sysroot" x -test "$tccdir_auto" = "yes" || print_str CONFIG_TCCDIR "$tccdir" x -print_num CONFIG_TCC_PREDEFS "$predefs" - -diff $TMPH config.h >/dev/null 2>&1 -if test $? -ne 0 ; then - mv -f $TMPH config.h -else - echo "config.h is unchanged" -fi - -echo "@set VERSION $version" > config.texi - -rm -f $TMPN* $CONFTEST - -# --------------------------------------------------------------------------- -# build tree in object directory if source path is different from current one - -use_cp= -fn_makelink() -{ - tgt=$1/$2 - case $2 in - */*) dn=${2%/*} - test -d $dn || mkdir -p $dn - case $1 in - /*) ;; - *) while test $dn ; do - tgt=../$tgt; dn=${dn#${dn%%/*}}; dn=${dn#/} - done - ;; - esac - ;; - esac - - test -n "$use_cp" || ln -sfn "$tgt" $2 || - { use_cp=yes; echo "ln failed. Using cp instead."; } - test -z "$use_cp" || cp -f "$1/$2" $2 -} - -if test "$source_path_used" = "yes" ; then - FILES="Makefile lib/Makefile tests/Makefile tests/tests2/Makefile tests/pp/Makefile" - for f in $FILES ; do - fn_makelink "$source_path" $f - done -fi - -# --------------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..05657655 --- /dev/null +++ b/configure.ac @@ -0,0 +1,24 @@ +m4_define([tcc_VERSION], m4_normalize(m4_include([VERSION]))) +m4_append([tcc_VERSION], [-stupidos]) + +AC_INIT([tcc], tcc_VERSION) + +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([foreign subdir-objects -Werror -Wall]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile]) + +AC_LANG([C]) +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CC_C_O +AC_PROG_RANLIB +AM_PROG_AR + +AC_CHECK_INCLUDES_DEFAULT +AC_C_CONST +AC_C_INLINE +AC_C_BIGENDIAN + +AC_OUTPUT diff --git a/conftest.c b/conftest.c deleted file mode 100644 index a4450d51..00000000 --- a/conftest.c +++ /dev/null @@ -1,308 +0,0 @@ -/* ----------------------------------------------------------------------- */ -/* with -D C2STR: convert tccdefs.h to C-strings */ - -#if C2STR - -#include -#include - -/* replace native host macros by compile-time versions */ -const char *platform_macros[] = { - "__i386__", "TCC_TARGET_I386", - "__x86_64__", "TCC_TARGET_X86_64", - "_WIN32", "TCC_TARGET_PE", - "__arm__", "TCC_TARGET_ARM", - "__ARM_EABI__", "TCC_ARM_EABI", - "__aarch64__", "TCC_TARGET_ARM64", - "__riscv", "TCC_TARGET_RISCV64", - "__APPLE__", "TCC_TARGET_MACHO", - "__FreeBSD__", "TARGETOS_FreeBSD", - "__FreeBSD_kernel__", "TARGETOS_FreeBSD_kernel", - "__OpenBSD__", "TARGETOS_OpenBSD", - "__NetBSD__", "TARGETOS_NetBSD", - "__linux__", "TARGETOS_Linux", - "__ANDROID__", "TARGETOS_ANDROID", - - "__SIZEOF_POINTER__", "PTR_SIZE", - "__SIZEOF_LONG__", "LONG_SIZE", - 0 -}; - -int isid(int c) -{ - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') - || (c >= '0' && c <= '9') || c == '_'; -} - -int isspc(int c) -{ - return (unsigned char)c <= ' ' && c != 0; -} - -int main(int argc, char **argv) -{ - char l[1000], l2[1000], *p, *q, *p0; - FILE *fp, *op; - int c, e, f, s, cmt, cmt_n; - const char *r; - - if (argc < 3) - return 1; - - fp = fopen(argv[1], "rb"); - op = fopen(argv[2], "wb"); - if (!fp || !op) { - fprintf(stderr, "c2str: file error\n"); - return 1; - } - - cmt = cmt_n = 0; - for (;;) { - p = l; - append: - if (fgets(p, sizeof l - (p - l), fp)) { - p = strchr(p, 0); - while (p > l && isspc(p[-1])) - --p; - *p = 0; - } else if (p == l) - break; - - /* check for continuation */ - if (p > l && p[-1] == '\\') { - p[-1] = ' '; - goto append; - } - - /* count & skip leading spaces */ - p = l, q = l2, f = 0; - while (*p && isspc(*p)) - ++p, ++f; - - /* handle comments */ - if (p[0] == '/' && cmt == 0) { - if (p[1] == '*') - cmt = 2; - if (p[1] == '/') - cmt = 1; - } - if (cmt) { - fprintf(op, "%s", l); - if (++cmt_n == 1) - fprintf(op, " (converted, do not edit this file)"); - fprintf(op, "\n"); - if (cmt == 1) - cmt = 0; - if (cmt == 2) { - p = strchr(l, 0); - if (p >= l + 2 && p[-1] == '/' && p[-2] == '*') - cmt = 0; - } - continue; - } - - if (f < 4) { - do { - /* replace machine/os macros by compile-time counterparts */ - for (e = f = 0; (r = platform_macros[f]); f += 2) { - c = strlen(r); - /* remove 'defined' */ - //e = memcmp(p, "defined ", 8) ? 0 : 8; - if (0 == memcmp(p + e, r, c)) { - p += e + c; - q = strchr(strcpy(q, platform_macros[f + 1]), 0); - break; - } - - } - if (r) - continue; - } while (!!(*q++ = *p++)); - /* output as is */ - fprintf(op, "%s\n", l2); - continue; - - } else { - s = e = f = 0, p0 = p; - for (;;) { - c = *p++; - - if (isspc(c)) { - s = 1; - continue; - } - if (c == '/' && (p[0] == '/' || p[0] == '*')) - c = 0; /* trailing comment detected */ - else if (s && q > l2 - && ((isid(q[-1]) && isid(c)) - // keep space after macro name - || (q >= l2 + 2 - && l2[0] == '#' - && l2[1] == 'd' - && f < 2 && !e - ))) - *q++ = ' ', ++f; - s = 0; - - if (c == '(') - ++e; - if (c == ')') - --e; - if (c == '\\' || c == '\"') - *q++ = '\\'; - *q++ = c; - if (c == 0) - break; - p0 = p; - } - /* output with quotes */ - fprintf(op, " \"%s\\n\"%s\n", l2, p0); - } - } - - fclose(fp); - fclose(op); - return 0; -} - -/* ----------------------------------------------------------------------- */ -/* get some information from the host compiler for configure */ - -#elif 1 - -#include - -#if defined(_WIN32) -#include -#include -int _CRT_glob = 0; -#endif - -/* Define architecture */ -#if defined(__i386__) || defined _M_IX86 -# define TRIPLET_ARCH "i386" -#elif defined(__x86_64__) || defined _M_AMD64 -# define TRIPLET_ARCH "x86_64" -#elif defined(__arm__) -# define TRIPLET_ARCH "arm" -#elif defined(__aarch64__) -# define TRIPLET_ARCH "aarch64" -#elif defined(__riscv) && defined(__LP64__) -# define TRIPLET_ARCH "riscv64" -#else -# define TRIPLET_ARCH "unknown" -#endif - -/* Define OS */ -#if defined (__linux__) -# define TRIPLET_OS "linux" -#elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__) -# define TRIPLET_OS "kfreebsd" -#elif defined(__NetBSD__) -# define TRIPLET_OS "netbsd" -#elif defined(__OpenBSD__) -# define TRIPLET_OS "openbsd" -#elif defined(_WIN32) -# define TRIPLET_OS "win32" -#elif defined(__APPLE__) -# define TRIPLET_OS "darwin" -#elif !defined (__GNU__) -# define TRIPLET_OS "unknown" -#endif - -#if defined __ANDROID__ -# define ABI_PREFIX "android" -#else -# define ABI_PREFIX "gnu" -#endif - -/* Define calling convention and ABI */ -#if defined (__ARM_EABI__) -# if defined (__ARM_PCS_VFP) -# define TRIPLET_ABI ABI_PREFIX"eabihf" -# else -# define TRIPLET_ABI ABI_PREFIX"eabi" -# endif -#else -# define TRIPLET_ABI ABI_PREFIX -#endif - -#if defined _WIN32 -# define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS -#elif defined __GNU__ -# define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI -#else -# define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI -#endif - -int main(int argc, char *argv[]) -{ -#if defined(_WIN32) - _setmode(_fileno(stdout), _O_BINARY); /* don't translate \n to \r\n */ -#endif - switch(argc == 2 ? argv[1][0] : 0) { - case 'b'://igendian - { - volatile unsigned foo = 0x01234567; - puts(*(unsigned char*)&foo == 0x67 ? "no" : "yes"); - break; - } -#if defined(__clang__) - case 'm'://inor - printf("%d\n", __clang_minor__); - break; - case 'v'://ersion - printf("%d\n", __clang_major__); - break; -#elif defined(__TINYC__) - case 'v'://ersion - puts("0"); - break; - case 'm'://inor - printf("%d\n", __TINYC__); - break; -#elif defined(_MSC_VER) - case 'v'://ersion - puts("0"); - break; - case 'm'://inor - printf("%d\n", _MSC_VER); - break; -#elif defined(__GNUC__) && defined(__GNUC_MINOR__) - /* GNU comes last as other compilers may add 'GNU' compatibility */ - case 'm'://inor - printf("%d\n", __GNUC_MINOR__); - break; - case 'v'://ersion - printf("%d\n", __GNUC__); - break; -#else - case 'm'://inor - case 'v'://ersion - puts("0"); - break; -#endif - case 't'://riplet - puts(TRIPLET); - break; - case 'c'://ompiler -#if defined(__clang__) - puts("clang"); -#elif defined(__TINYC__) - puts("tcc"); -#elif defined(_MSC_VER) - puts("msvc"); -#elif defined(__GNUC__) - puts("gcc"); -#else - puts("unknown"); -#endif - break; - default: - break; - } - return 0; -} - -/* ----------------------------------------------------------------------- */ -#endif diff --git a/i386-asm.c b/i386-asm.c index 470b20e7..d1038128 100644 --- a/i386-asm.c +++ b/i386-asm.c @@ -46,15 +46,8 @@ #define OPC_0F 0x100 /* Is secondary map (0x0f prefix) */ #define OPC_48 0x200 /* Always has REX prefix */ -#ifdef TCC_TARGET_X86_64 -# define OPC_WLQ 0x1000 /* accepts w, l, q or no suffix */ -# define OPC_BWLQ (OPC_B | OPC_WLQ) /* accepts b, w, l, q or no suffix */ -# define OPC_WLX OPC_WLQ -# define OPC_BWLX OPC_BWLQ -#else -# define OPC_WLX OPC_WL -# define OPC_BWLX OPC_BWL -#endif +#define OPC_WLX OPC_WL +#define OPC_BWLX OPC_BWL #define OPC_GROUP_SHIFT 13 @@ -64,9 +57,6 @@ enum { OPT_REG8=0, /* warning: value is hardcoded from TOK_ASM_xxx */ OPT_REG16, /* warning: value is hardcoded from TOK_ASM_xxx */ OPT_REG32, /* warning: value is hardcoded from TOK_ASM_xxx */ -#ifdef TCC_TARGET_X86_64 - OPT_REG64, /* warning: value is hardcoded from TOK_ASM_xxx */ -#endif OPT_MMX, /* warning: value is hardcoded from TOK_ASM_xxx */ OPT_SSE, /* warning: value is hardcoded from TOK_ASM_xxx */ OPT_CR, /* warning: value is hardcoded from TOK_ASM_xxx */ @@ -74,17 +64,10 @@ enum { OPT_DB, /* warning: value is hardcoded from TOK_ASM_xxx */ OPT_SEG, OPT_ST, -#ifdef TCC_TARGET_X86_64 - OPT_REG8_LOW, /* %spl,%bpl,%sil,%dil, encoded like ah,ch,dh,bh, but - with REX prefix, not used in insn templates */ -#endif OPT_IM8, OPT_IM8S, OPT_IM16, OPT_IM32, -#ifdef TCC_TARGET_X86_64 - OPT_IM64, -#endif OPT_EAX, /* %al, %ax, %eax or %rax register */ OPT_ST0, /* %st(0) register */ OPT_CL, /* %cl register */ @@ -124,32 +107,18 @@ enum { #define OP_DX (1 << OPT_DX) #define OP_ADDR (1 << OPT_ADDR) #define OP_INDIR (1 << OPT_INDIR) -#ifdef TCC_TARGET_X86_64 -# define OP_REG64 (1 << OPT_REG64) -# define OP_REG8_LOW (1 << OPT_REG8_LOW) -# define OP_IM64 (1 << OPT_IM64) -# define OP_EA32 (OP_EA << 1) -#else -# define OP_REG64 0 -# define OP_REG8_LOW 0 -# define OP_IM64 0 -# define OP_EA32 0 -#endif +#define OP_REG64 0 +#define OP_REG8_LOW 0 +#define OP_IM64 0 +#define OP_EA32 0 #define OP_EA 0x40000000 #define OP_REG (OP_REG8 | OP_REG16 | OP_REG32 | OP_REG64) -#ifdef TCC_TARGET_X86_64 -# define TREG_XAX TREG_RAX -# define TREG_XCX TREG_RCX -# define TREG_XDX TREG_RDX -# define TOK_ASM_xax TOK_ASM_rax -#else -# define TREG_XAX TREG_EAX -# define TREG_XCX TREG_ECX -# define TREG_XDX TREG_EDX -# define TOK_ASM_xax TOK_ASM_eax -#endif +#define TREG_XAX TREG_EAX +#define TREG_XCX TREG_ECX +#define TREG_XDX TREG_EDX +#define TOK_ASM_xax TOK_ASM_eax typedef struct ASMInstr { uint16_t sym; @@ -234,11 +203,8 @@ static const ASMInstr asm_instrs[] = { #define DEF_ASM_OP1(name, opcode, group, instr_type, op0) { TOK_ASM_ ## name, O(opcode), T(opcode, instr_type, group), 1, { op0 }}, #define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1) { TOK_ASM_ ## name, O(opcode), T(opcode, instr_type, group), 2, { op0, op1 }}, #define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2) { TOK_ASM_ ## name, O(opcode), T(opcode, instr_type, group), 3, { op0, op1, op2 }}, -#ifdef TCC_TARGET_X86_64 -# include "x86_64-asm.h" -#else -# include "i386-asm.h" -#endif + +#include "i386-asm.h" /* last operation */ { 0, }, }; @@ -250,11 +216,7 @@ static const uint16_t op0_codes[] = { #define DEF_ASM_OP1(name, opcode, group, instr_type, op0) #define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1) #define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2) -#ifdef TCC_TARGET_X86_64 -# include "x86_64-asm.h" -#else -# include "i386-asm.h" -#endif +#include "i386-asm.h" }; static inline int get_reg_shift(TCCState *s1) @@ -282,45 +244,6 @@ static inline int get_reg_shift(TCCState *s1) return shift; } -#ifdef TCC_TARGET_X86_64 -static int asm_parse_numeric_reg(int t, unsigned int *type) -{ - int reg = -1; - if (t >= TOK_IDENT && t < tok_ident) { - const char *s = table_ident[t - TOK_IDENT]->str; - char c; - *type = OP_REG64; - if (*s == 'c') { - s++; - *type = OP_CR; - } - if (*s++ != 'r') - return -1; - /* Don't allow leading '0'. */ - if ((c = *s++) >= '1' && c <= '9') - reg = c - '0'; - else - return -1; - if ((c = *s) >= '0' && c <= '5') - s++, reg = reg * 10 + c - '0'; - if (reg > 15) - return -1; - if ((c = *s) == 0) - ; - else if (*type != OP_REG64) - return -1; - else if (c == 'b' && !s[1]) - *type = OP_REG8; - else if (c == 'w' && !s[1]) - *type = OP_REG16; - else if (c == 'd' && !s[1]) - *type = OP_REG32; - else - return -1; - } - return reg; -} -#endif static int asm_parse_reg(unsigned int *type) { @@ -332,17 +255,6 @@ static int asm_parse_reg(unsigned int *type) if (tok >= TOK_ASM_eax && tok <= TOK_ASM_edi) { reg = tok - TOK_ASM_eax; *type = OP_REG32; -#ifdef TCC_TARGET_X86_64 - } else if (tok >= TOK_ASM_rax && tok <= TOK_ASM_rdi) { - reg = tok - TOK_ASM_rax; - *type = OP_REG64; - } else if (tok == TOK_ASM_rip) { - reg = -2; /* Probably should use different escape code. */ - *type = OP_REG64; - } else if ((reg = asm_parse_numeric_reg(tok, type)) >= 0 - && (*type == OP_REG32 || *type == OP_REG64)) { - ; -#endif } else { error_32: expect("register"); @@ -400,13 +312,6 @@ static void parse_operand(TCCState *s1, Operand *op) if (op->reg == 0) op->type |= OP_ST0; goto no_skip; -#ifdef TCC_TARGET_X86_64 - } else if (tok >= TOK_ASM_spl && tok <= TOK_ASM_dil) { - op->type = OP_REG8 | OP_REG8_LOW; - op->reg = 4 + tok - TOK_ASM_spl; - } else if ((op->reg = asm_parse_numeric_reg(tok, &op->type)) >= 0) { - ; -#endif } else { reg_error: tcc_error("unknown register %%%s", get_tok_str(tok, &tokc)); @@ -426,10 +331,6 @@ static void parse_operand(TCCState *s1, Operand *op) op->type |= OP_IM8S; if (op->e.v == (uint16_t)op->e.v) op->type |= OP_IM16; -#ifdef TCC_TARGET_X86_64 - if (op->e.v != (int32_t)op->e.v && op->e.v != (uint32_t)op->e.v) - op->type = OP_IM64; -#endif } } else { /* address(reg,reg2,shift) with all variants */ @@ -494,13 +395,6 @@ ST_FUNC void gen_expr32(ExprValue *pe) gen_addr32(pe->sym ? VT_SYM : 0, pe->sym, pe->v); } -#ifdef TCC_TARGET_X86_64 -ST_FUNC void gen_expr64(ExprValue *pe) -{ - gen_addr64(pe->sym ? VT_SYM : 0, pe->sym, pe->v); -} -#endif - /* XXX: unify with C code output ? */ static void gen_disp32(ExprValue *pe) { @@ -517,13 +411,7 @@ static void gen_disp32(ExprValue *pe) sym->type.t = VT_FUNC; sym->type.ref = NULL; } -#ifdef TCC_TARGET_X86_64 - greloca(cur_text_section, sym, ind, R_X86_64_PLT32, pe->v - 4); - gen_le32(0); -#else gen_addrpc32(VT_SYM, sym, pe->v); -#endif - } } @@ -536,20 +424,10 @@ static inline int asm_modrm(int reg, Operand *op) g(0xc0 + (reg << 3) + op->reg); } else if (op->reg == -1 && op->reg2 == -1) { /* displacement only */ -#ifdef TCC_TARGET_X86_64 - g(0x04 + (reg << 3)); - g(0x25); -#else g(0x05 + (reg << 3)); -#endif + gen_expr32(&op->e); -#ifdef TCC_TARGET_X86_64 - } else if (op->reg == -2) { - ExprValue *pe = &op->e; - g(0x05 + (reg << 3)); - gen_addrpc32(pe->sym ? VT_SYM : 0, pe->sym, pe->v); - return ind; -#endif + } else { sib_reg1 = op->reg; /* fist compute displacement encoding */ @@ -585,69 +463,6 @@ static inline int asm_modrm(int reg, Operand *op) return 0; } -#ifdef TCC_TARGET_X86_64 -#define REX_W 0x48 -#define REX_R 0x44 -#define REX_X 0x42 -#define REX_B 0x41 - -static void asm_rex(int width64, Operand *ops, int nb_ops, int *op_type, - int regi, int rmi) -{ - unsigned char rex = width64 ? 0x48 : 0; - int saw_high_8bit = 0; - int i; - if (rmi == -1) { - /* No mod/rm byte, but we might have a register op nevertheless - (we will add it to the opcode later). */ - for(i = 0; i < nb_ops; i++) { - if (op_type[i] & (OP_REG | OP_ST)) { - if (ops[i].reg >= 8) { - rex |= REX_B; - ops[i].reg -= 8; - } else if (ops[i].type & OP_REG8_LOW) - rex |= 0x40; - else if (ops[i].type & OP_REG8 && ops[i].reg >= 4) - /* An 8 bit reg >= 4 without REG8 is ah/ch/dh/bh */ - saw_high_8bit = ops[i].reg; - break; - } - } - } else { - if (regi != -1) { - if (ops[regi].reg >= 8) { - rex |= REX_R; - ops[regi].reg -= 8; - } else if (ops[regi].type & OP_REG8_LOW) - rex |= 0x40; - else if (ops[regi].type & OP_REG8 && ops[regi].reg >= 4) - /* An 8 bit reg >= 4 without REG8 is ah/ch/dh/bh */ - saw_high_8bit = ops[regi].reg; - } - if (ops[rmi].type & (OP_REG | OP_MMX | OP_SSE | OP_CR | OP_EA)) { - if (ops[rmi].reg >= 8) { - rex |= REX_B; - ops[rmi].reg -= 8; - } else if (ops[rmi].type & OP_REG8_LOW) - rex |= 0x40; - else if (ops[rmi].type & OP_REG8 && ops[rmi].reg >= 4) - /* An 8 bit reg >= 4 without REG8 is ah/ch/dh/bh */ - saw_high_8bit = ops[rmi].reg; - } - if (ops[rmi].type & OP_EA && ops[rmi].reg2 >= 8) { - rex |= REX_X; - ops[rmi].reg2 -= 8; - } - } - if (rex) { - if (saw_high_8bit) - tcc_error("can't encode register %%%ch when REX prefix is required", - "acdb"[saw_high_8bit-4]); - g(rex); - } -} -#endif - static void maybe_print_stats (void) { @@ -699,9 +514,6 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) int alltypes; /* OR of all operand types */ int autosize; int p66; -#ifdef TCC_TARGET_X86_64 - int rex64; -#endif maybe_print_stats(); /* force synthetic ';' after prefix instruction, so we can handle */ @@ -777,13 +589,6 @@ again: if (pa->instr_type & OPC_WLX) s = NBWLX - 1; } else if (pa->instr_type & OPC_B) { -#ifdef TCC_TARGET_X86_64 - /* Some instructions don't have the full size but only - bwl form. insb e.g. */ - if ((pa->instr_type & OPC_WLQ) != OPC_WLQ - && !(opcode >= pa->sym && opcode < pa->sym + NBWLX-1)) - continue; -#endif if (!(opcode >= pa->sym && opcode < pa->sym + NBWLX)) continue; s = opcode - pa->sym; @@ -797,15 +602,6 @@ again: } if (pa->nb_ops != nb_ops) continue; -#ifdef TCC_TARGET_X86_64 - /* Special case for moves. Selecting the IM64->REG64 form - should only be done if we really have an >32bit imm64, and that - is hardcoded. Ignore it here. */ - if (pa->opcode == 0xb0 && ops[0].type != OP_IM64 - && (ops[1].type & OP_REG) == OP_REG64 - && !(pa->instr_type & OPC_0F)) - continue; -#endif /* now decode and check each operand */ alltypes = 0; for(i = 0; i < nb_ops; i++) { @@ -874,12 +670,6 @@ again: } /* if the size is unknown, then evaluate it (OPC_B or OPC_WL case) */ autosize = NBWLX-1; -#ifdef TCC_TARGET_X86_64 - /* XXX the autosize should rather be zero, to not have to adjust this - all the time. */ - if ((pa->instr_type & OPC_BWLQ) == OPC_B) - autosize = NBWLX-2; -#endif if (s == autosize) { /* Check for register operands providing hints about the size. Start from the end, i.e. destination operands. This matters @@ -901,47 +691,13 @@ again: } } -#ifdef TCC_TARGET_X86_64 - rex64 = 0; - if (pa->instr_type & OPC_48) - rex64 = 1; - else if (s == 3 || (alltypes & OP_REG64)) { - /* generate REX prefix */ - int default64 = 0; - for(i = 0; i < nb_ops; i++) { - if (op_type[i] == OP_REG64 && pa->opcode != 0xb8) { - /* If only 64bit regs are accepted in one operand - this is a default64 instruction without need for - REX prefixes, except for movabs(0xb8). */ - default64 = 1; - break; - } - } - /* XXX find better encoding for the default64 instructions. */ - if (((opcode != TOK_ASM_push && opcode != TOK_ASM_pop - && opcode != TOK_ASM_pushw && opcode != TOK_ASM_pushl - && opcode != TOK_ASM_pushq && opcode != TOK_ASM_popw - && opcode != TOK_ASM_popl && opcode != TOK_ASM_popq - && opcode != TOK_ASM_call && opcode != TOK_ASM_jmp)) - && !default64) - rex64 = 1; - } -#endif /* now generates the operation */ if (OPCT_IS(pa->instr_type, OPC_FWAIT)) g(0x9b); if (seg_prefix) g(seg_prefix); -#ifdef TCC_TARGET_X86_64 - /* Generate addr32 prefix if needed */ - for(i = 0; i < nb_ops; i++) { - if (ops[i].type & OP_EA32) { - g(0x67); - break; - } - } -#endif + /* generate data16 prefix if needed */ p66 = 0; if (s == 1) @@ -1002,21 +758,7 @@ again: modrm_index = -1; modreg_index = -1; if (pa->instr_type & OPC_MODRM) { -#ifdef TCC_TARGET_X86_64 - if (!nb_ops) { - /* A modrm opcode without operands is a special case (e.g. mfence). - It has a group and acts as if there's an register operand 0 */ - i = 0; - ops[i].type = OP_REG; - if (pa->sym == TOK_ASM_endbr64) - ops[i].reg = 2; // dx - else if (pa->sym >= TOK_ASM_lfence && pa->sym <= TOK_ASM_sfence) - ops[i].reg = 0; // ax - else - tcc_error("bad MODR/M opcode without operands"); - goto modrm_found; - } -#endif + /* first look for an ea operand */ for(i = 0;i < nb_ops; i++) { if (op_type[i] & OP_EA) @@ -1043,9 +785,6 @@ again: } } } -#ifdef TCC_TARGET_X86_64 - asm_rex (rex64, ops, nb_ops, op_type, modreg_index, modrm_index); -#endif if (pa->instr_type & OPC_REG) { /* mov $im, %reg case */ @@ -1120,7 +859,6 @@ again: } /* emit constants */ -#ifndef TCC_TARGET_X86_64 if (!(pa->instr_type & OPC_0F) && (pa->opcode == 0x9a || pa->opcode == 0xea)) { /* ljmp or lcall kludge */ @@ -1130,7 +868,6 @@ again: gen_le16(ops[0].e.v); return; } -#endif for(i = 0;i < nb_ops; i++) { v = op_type[i]; if (v & (OP_IM8 | OP_IM16 | OP_IM32 | OP_IM64 | OP_IM8S | OP_ADDR)) { @@ -1154,10 +891,6 @@ again: g(ops[i].e.v); } else if (v & OP_IM16) { gen_le16(ops[i].e.v); -#ifdef TCC_TARGET_X86_64 - } else if (v & OP_IM64) { - gen_expr64(&ops[i].e); -#endif } else if (pa->op_type[i] == OPT_DISP || pa->op_type[i] == OPT_DISP8) { gen_disp32(&ops[i].e); } else { @@ -1541,10 +1274,6 @@ ST_FUNC void subst_asm_operand(CString *add_str, val = -val; cstr_printf(add_str, "%d", (int)sv->c.i); no_offset:; -#ifdef TCC_TARGET_X86_64 - if (r & VT_LVAL) - cstr_cat(add_str, "(%rip)", -1); -#endif } else if ((r & VT_VALMASK) == VT_LOCAL) { cstr_printf(add_str, "%d(%%%s)", (int)sv->c.i, get_tok_str(TOK_ASM_xax + 5, NULL)); } else if (r & VT_LVAL) { @@ -1586,10 +1315,6 @@ ST_FUNC void subst_asm_operand(CString *add_str, size = 2; } else if (modifier == 'k') { size = 4; -#ifdef TCC_TARGET_X86_64 - } else if (modifier == 'q') { - size = 8; -#endif } switch(size) { @@ -1605,11 +1330,6 @@ ST_FUNC void subst_asm_operand(CString *add_str, default: reg = TOK_ASM_eax + reg; break; -#ifdef TCC_TARGET_X86_64 - case 8: - reg = TOK_ASM_rax + reg; - break; -#endif } cstr_printf(add_str, "%%%s", get_tok_str(reg, NULL)); } @@ -1627,15 +1347,8 @@ ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, /* Strictly speaking %Xbp and %Xsp should be included in the call-preserved registers, but currently it doesn't matter. */ -#ifdef TCC_TARGET_X86_64 -#ifdef TCC_TARGET_PE - static const uint8_t reg_saved[] = { 3, 6, 7, 12, 13, 14, 15 }; -#else - static const uint8_t reg_saved[] = { 3, 12, 13, 14, 15 }; -#endif -#else static const uint8_t reg_saved[] = { 3, 6, 7 }; -#endif + /* mark all used registers */ memcpy(regs_allocated, clobber_regs, sizeof(regs_allocated)); @@ -1723,9 +1436,6 @@ ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) { int reg; -#ifdef TCC_TARGET_X86_64 - unsigned int type; -#endif if (!strcmp(str, "memory") || !strcmp(str, "cc") || @@ -1736,12 +1446,6 @@ ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) reg -= TOK_ASM_eax; } else if (reg >= TOK_ASM_ax && reg <= TOK_ASM_di) { reg -= TOK_ASM_ax; -#ifdef TCC_TARGET_X86_64 - } else if (reg >= TOK_ASM_rax && reg <= TOK_ASM_rdi) { - reg -= TOK_ASM_rax; - } else if ((reg = asm_parse_numeric_reg(reg, &type)) >= 0) { - ; -#endif } else { tcc_error("invalid clobber register '%s'", str); } diff --git a/i386-tok.h b/i386-tok.h index 29071059..04844d26 100644 --- a/i386-tok.h +++ b/i386-tok.h @@ -10,28 +10,11 @@ DEF(TOK_ASM_ ## x ## w, #x "w") \ DEF(TOK_ASM_ ## x ## l, #x "l") \ DEF(TOK_ASM_ ## x, #x) -#ifdef TCC_TARGET_X86_64 -# define DEF_BWLQ(x) \ - DEF(TOK_ASM_ ## x ## b, #x "b") \ - DEF(TOK_ASM_ ## x ## w, #x "w") \ - DEF(TOK_ASM_ ## x ## l, #x "l") \ - DEF(TOK_ASM_ ## x ## q, #x "q") \ - DEF(TOK_ASM_ ## x, #x) -# define DEF_WLQ(x) \ - DEF(TOK_ASM_ ## x ## w, #x "w") \ - DEF(TOK_ASM_ ## x ## l, #x "l") \ - DEF(TOK_ASM_ ## x ## q, #x "q") \ - DEF(TOK_ASM_ ## x, #x) -# define DEF_BWLX DEF_BWLQ -# define DEF_WLX DEF_WLQ -/* number of sizes + 1 */ -# define NBWLX 5 -#else # define DEF_BWLX DEF_BWL # define DEF_WLX DEF_WL /* number of sizes + 1 */ # define NBWLX 4 -#endif + #define DEF_FP1(x) \ DEF(TOK_ASM_ ## f ## x ## s, "f" #x "s") \ @@ -102,16 +85,6 @@ DEF_ASM(ebp) DEF_ASM(esi) DEF_ASM(edi) -#ifdef TCC_TARGET_X86_64 - DEF_ASM(rax) - DEF_ASM(rcx) - DEF_ASM(rdx) - DEF_ASM(rbx) - DEF_ASM(rsp) - DEF_ASM(rbp) - DEF_ASM(rsi) - DEF_ASM(rdi) -#endif DEF_ASM(mm0) DEF_ASM(mm1) DEF_ASM(mm2) @@ -169,14 +142,6 @@ DEF_ASM(st) DEF_ASM(rip) -#ifdef TCC_TARGET_X86_64 - /* The four low parts of sp/bp/si/di that exist only on - x86-64 (encoding aliased to ah,ch,dh,dh when not using REX). */ - DEF_ASM(spl) - DEF_ASM(bpl) - DEF_ASM(sil) - DEF_ASM(dil) -#endif /* generic two operands */ DEF_BWLX(mov) @@ -216,16 +181,10 @@ DEF_ASM(pushw) DEF_ASM(pushl) -#ifdef TCC_TARGET_X86_64 - DEF_ASM(pushq) -#endif DEF_ASM(push) DEF_ASM(popw) DEF_ASM(popl) -#ifdef TCC_TARGET_X86_64 - DEF_ASM(popq) -#endif DEF_ASM(pop) DEF_BWL(in) @@ -236,12 +195,6 @@ DEF_ASM(movsbw) DEF_ASM(movsbl) DEF_ASM(movswl) -#ifdef TCC_TARGET_X86_64 - DEF_ASM(movsbq) - DEF_ASM(movswq) - DEF_ASM(movzwq) - DEF_ASM(movslq) -#endif DEF_WLX(lea) @@ -313,11 +266,7 @@ #define DEF_ASM_OP1(name, opcode, group, instr_type, op0) #define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1) #define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2) -#ifdef TCC_TARGET_X86_64 -# include "x86_64-asm.h" -#else -# include "i386-asm.h" -#endif +#include "i386-asm.h" #define ALT(x) #define DEF_ASM_OP0(name, opcode) @@ -325,8 +274,4 @@ #define DEF_ASM_OP1(name, opcode, group, instr_type, op0) DEF_ASM(name) #define DEF_ASM_OP2(name, opcode, group, instr_type, op0, op1) DEF_ASM(name) #define DEF_ASM_OP3(name, opcode, group, instr_type, op0, op1, op2) DEF_ASM(name) -#ifdef TCC_TARGET_X86_64 -# include "x86_64-asm.h" -#else -# include "i386-asm.h" -#endif +#include "i386-asm.h" diff --git a/il-gen.c b/il-gen.c deleted file mode 100644 index bb670ccb..00000000 --- a/il-gen.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * CIL code generator for TCC - * - * Copyright (c) 2002 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#error this code has bit-rotted since 2003 - -/* number of available registers */ -#define NB_REGS 3 - -/* a register can belong to several classes. The classes must be - sorted from more general to more precise (see gv2() code which does - assumptions on it). */ -#define RC_ST 0x0001 /* any stack entry */ -#define RC_ST0 0x0002 /* top of stack */ -#define RC_ST1 0x0004 /* top - 1 */ - -#define RC_INT RC_ST -#define RC_FLOAT RC_ST -#define RC_IRET RC_ST0 /* function return: integer register */ -#define RC_LRET RC_ST0 /* function return: second integer register */ -#define RC_FRET RC_ST0 /* function return: float register */ - -/* pretty names for the registers */ -enum { - REG_ST0 = 0, - REG_ST1, - REG_ST2, -}; - -const int reg_classes[NB_REGS] = { - /* ST0 */ RC_ST | RC_ST0, - /* ST1 */ RC_ST | RC_ST1, - /* ST2 */ RC_ST, -}; - -/* return registers for function */ -#define REG_IRET REG_ST0 /* single word int return register */ -#define REG_LRET REG_ST0 /* second word return register (for long long) */ -#define REG_FRET REG_ST0 /* float return register */ - -/* defined if function parameters must be evaluated in reverse order */ -/* #define INVERT_FUNC_PARAMS */ - -/* defined if structures are passed as pointers. Otherwise structures - are directly pushed on stack. */ -/* #define FUNC_STRUCT_PARAM_AS_PTR */ - -/* pointer size, in bytes */ -#define PTR_SIZE 4 - -/* long double size and alignment, in bytes */ -#define LDOUBLE_SIZE 8 -#define LDOUBLE_ALIGN 8 - -/* function call context */ -typedef struct GFuncContext { - int func_call; /* func call type (FUNC_STDCALL or FUNC_CDECL) */ -} GFuncContext; - -/******************************************************/ -/* opcode definitions */ - -#define IL_OP_PREFIX 0xFE - -enum ILOPCodes { -#define OP(name, str, n) IL_OP_ ## name = n, -#include "il-opcodes.h" -#undef OP -}; - -char *il_opcodes_str[] = { -#define OP(name, str, n) [n] = str, -#include "il-opcodes.h" -#undef OP -}; - -/******************************************************/ - -/* arguments variable numbers start from there */ -#define ARG_BASE 0x70000000 - -static FILE *il_outfile; - -static void out_byte(int c) -{ - *(char *)ind++ = c; -} - -static void out_le32(int c) -{ - out_byte(c); - out_byte(c >> 8); - out_byte(c >> 16); - out_byte(c >> 24); -} - -static void init_outfile(void) -{ - if (!il_outfile) { - il_outfile = stdout; - fprintf(il_outfile, - ".assembly extern mscorlib\n" - "{\n" - ".ver 1:0:2411:0\n" - "}\n\n"); - } -} - -static void out_op1(int op) -{ - if (op & 0x100) - out_byte(IL_OP_PREFIX); - out_byte(op & 0xff); -} - -/* output an opcode with prefix */ -static void out_op(int op) -{ - out_op1(op); - fprintf(il_outfile, " %s\n", il_opcodes_str[op]); -} - -static void out_opb(int op, int c) -{ - out_op1(op); - out_byte(c); - fprintf(il_outfile, " %s %d\n", il_opcodes_str[op], c); -} - -static void out_opi(int op, int c) -{ - out_op1(op); - out_le32(c); - fprintf(il_outfile, " %s 0x%x\n", il_opcodes_str[op], c); -} - -/* XXX: not complete */ -static void il_type_to_str(char *buf, int buf_size, - int t, const char *varstr) -{ - int bt; - Sym *s, *sa; - char buf1[256]; - const char *tstr; - - t = t & VT_TYPE; - bt = t & VT_BTYPE; - buf[0] = '\0'; - if (t & VT_UNSIGNED) - pstrcat(buf, buf_size, "unsigned "); - switch(bt) { - case VT_VOID: - tstr = "void"; - goto add_tstr; - case VT_BOOL: - tstr = "bool"; - goto add_tstr; - case VT_BYTE: - tstr = "int8"; - goto add_tstr; - case VT_SHORT: - tstr = "int16"; - goto add_tstr; - case VT_ENUM: - case VT_INT: - case VT_LONG: - tstr = "int32"; - goto add_tstr; - case VT_LLONG: - tstr = "int64"; - goto add_tstr; - case VT_FLOAT: - tstr = "float32"; - goto add_tstr; - case VT_DOUBLE: - case VT_LDOUBLE: - tstr = "float64"; - add_tstr: - pstrcat(buf, buf_size, tstr); - break; - case VT_STRUCT: - tcc_error("structures not handled yet"); - break; - case VT_FUNC: - s = sym_find((unsigned)t >> VT_STRUCT_SHIFT); - il_type_to_str(buf, buf_size, s->t, varstr); - pstrcat(buf, buf_size, "("); - sa = s->next; - while (sa != NULL) { - il_type_to_str(buf1, sizeof(buf1), sa->t, NULL); - pstrcat(buf, buf_size, buf1); - sa = sa->next; - if (sa) - pstrcat(buf, buf_size, ", "); - } - pstrcat(buf, buf_size, ")"); - goto no_var; - case VT_PTR: - s = sym_find((unsigned)t >> VT_STRUCT_SHIFT); - pstrcpy(buf1, sizeof(buf1), "*"); - if (varstr) - pstrcat(buf1, sizeof(buf1), varstr); - il_type_to_str(buf, buf_size, s->t, buf1); - goto no_var; - } - if (varstr) { - pstrcat(buf, buf_size, " "); - pstrcat(buf, buf_size, varstr); - } - no_var: ; -} - - -/* patch relocation entry with value 'val' */ -void greloc_patch1(Reloc *p, int val) -{ -} - -/* output a symbol and patch all calls to it */ -void gsym_addr(t, a) -{ -} - -/* output jump and return symbol */ -static int out_opj(int op, int c) -{ - out_op1(op); - out_le32(0); - if (c == 0) { - c = ind - (int)cur_text_section->data; - } - fprintf(il_outfile, " %s L%d\n", il_opcodes_str[op], c); - return c; -} - -void gsym(int t) -{ - fprintf(il_outfile, "L%d:\n", t); -} - -/* load 'r' from value 'sv' */ -void load(int r, SValue *sv) -{ - int v, fc, ft; - - v = sv->r & VT_VALMASK; - fc = sv->c.i; - ft = sv->t; - - if (sv->r & VT_LVAL) { - if (v == VT_LOCAL) { - if (fc >= ARG_BASE) { - fc -= ARG_BASE; - if (fc >= 0 && fc <= 4) { - out_op(IL_OP_LDARG_0 + fc); - } else if (fc <= 0xff) { - out_opb(IL_OP_LDARG_S, fc); - } else { - out_opi(IL_OP_LDARG, fc); - } - } else { - if (fc >= 0 && fc <= 4) { - out_op(IL_OP_LDLOC_0 + fc); - } else if (fc <= 0xff) { - out_opb(IL_OP_LDLOC_S, fc); - } else { - out_opi(IL_OP_LDLOC, fc); - } - } - } else if (v == VT_CONST) { - /* XXX: handle globals */ - out_opi(IL_OP_LDSFLD, 0); - } else { - if ((ft & VT_BTYPE) == VT_FLOAT) { - out_op(IL_OP_LDIND_R4); - } else if ((ft & VT_BTYPE) == VT_DOUBLE) { - out_op(IL_OP_LDIND_R8); - } else if ((ft & VT_BTYPE) == VT_LDOUBLE) { - out_op(IL_OP_LDIND_R8); - } else if ((ft & VT_TYPE) == VT_BYTE) - out_op(IL_OP_LDIND_I1); - else if ((ft & VT_TYPE) == (VT_BYTE | VT_UNSIGNED)) - out_op(IL_OP_LDIND_U1); - else if ((ft & VT_TYPE) == VT_SHORT) - out_op(IL_OP_LDIND_I2); - else if ((ft & VT_TYPE) == (VT_SHORT | VT_UNSIGNED)) - out_op(IL_OP_LDIND_U2); - else - out_op(IL_OP_LDIND_I4); - } - } else { - if (v == VT_CONST) { - /* XXX: handle globals */ - if (fc >= -1 && fc <= 8) { - out_op(IL_OP_LDC_I4_M1 + fc + 1); - } else { - out_opi(IL_OP_LDC_I4, fc); - } - } else if (v == VT_LOCAL) { - if (fc >= ARG_BASE) { - fc -= ARG_BASE; - if (fc <= 0xff) { - out_opb(IL_OP_LDARGA_S, fc); - } else { - out_opi(IL_OP_LDARGA, fc); - } - } else { - if (fc <= 0xff) { - out_opb(IL_OP_LDLOCA_S, fc); - } else { - out_opi(IL_OP_LDLOCA, fc); - } - } - } else { - /* XXX: do it */ - } - } -} - -/* store register 'r' in lvalue 'v' */ -void store(int r, SValue *sv) -{ - int v, fc, ft; - - v = sv->r & VT_VALMASK; - fc = sv->c.i; - ft = sv->t; - if (v == VT_LOCAL) { - if (fc >= ARG_BASE) { - fc -= ARG_BASE; - /* XXX: check IL arg store semantics */ - if (fc <= 0xff) { - out_opb(IL_OP_STARG_S, fc); - } else { - out_opi(IL_OP_STARG, fc); - } - } else { - if (fc >= 0 && fc <= 4) { - out_op(IL_OP_STLOC_0 + fc); - } else if (fc <= 0xff) { - out_opb(IL_OP_STLOC_S, fc); - } else { - out_opi(IL_OP_STLOC, fc); - } - } - } else if (v == VT_CONST) { - /* XXX: handle globals */ - out_opi(IL_OP_STSFLD, 0); - } else { - if ((ft & VT_BTYPE) == VT_FLOAT) - out_op(IL_OP_STIND_R4); - else if ((ft & VT_BTYPE) == VT_DOUBLE) - out_op(IL_OP_STIND_R8); - else if ((ft & VT_BTYPE) == VT_LDOUBLE) - out_op(IL_OP_STIND_R8); - else if ((ft & VT_BTYPE) == VT_BYTE) - out_op(IL_OP_STIND_I1); - else if ((ft & VT_BTYPE) == VT_SHORT) - out_op(IL_OP_STIND_I2); - else - out_op(IL_OP_STIND_I4); - } -} - -/* start function call and return function call context */ -void gfunc_start(GFuncContext *c, int func_call) -{ - c->func_call = func_call; -} - -/* push function parameter which is in (vtop->t, vtop->c). Stack entry - is then popped. */ -void gfunc_param(GFuncContext *c) -{ - if ((vtop->t & VT_BTYPE) == VT_STRUCT) { - tcc_error("structures passed as value not handled yet"); - } else { - /* simply push on stack */ - gv(RC_ST0); - } - vtop--; -} - -/* generate function call with address in (vtop->t, vtop->c) and free function - context. Stack entry is popped */ -void gfunc_call(GFuncContext *c) -{ - char buf[1024]; - - if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { - /* XXX: more info needed from tcc */ - il_type_to_str(buf, sizeof(buf), vtop->t, "xxx"); - fprintf(il_outfile, " call %s\n", buf); - } else { - /* indirect call */ - gv(RC_INT); - il_type_to_str(buf, sizeof(buf), vtop->t, NULL); - fprintf(il_outfile, " calli %s\n", buf); - } - vtop--; -} - -/* generate function prolog of type 't' */ -void gfunc_prolog(int t) -{ - int addr, u, func_call; - Sym *sym; - char buf[1024]; - - init_outfile(); - - /* XXX: pass function name to gfunc_prolog */ - il_type_to_str(buf, sizeof(buf), t, funcname); - fprintf(il_outfile, ".method static %s il managed\n", buf); - fprintf(il_outfile, "{\n"); - /* XXX: cannot do better now */ - fprintf(il_outfile, " .maxstack %d\n", NB_REGS); - fprintf(il_outfile, " .locals (int32, int32, int32, int32, int32, int32, int32, int32)\n"); - - if (!strcmp(funcname, "main")) - fprintf(il_outfile, " .entrypoint\n"); - - sym = sym_find((unsigned)t >> VT_STRUCT_SHIFT); - func_call = sym->r; - - addr = ARG_BASE; - /* if the function returns a structure, then add an - implicit pointer parameter */ - func_vt = sym->t; - func_var = (sym->c == FUNC_ELLIPSIS); - if ((func_vt & VT_BTYPE) == VT_STRUCT) { - func_vc = addr; - addr++; - } - /* define parameters */ - while ((sym = sym->next) != NULL) { - u = sym->t; - sym_push(sym->v & ~SYM_FIELD, u, - VT_LOCAL | lvalue_type(sym->type.t), addr); - addr++; - } -} - -/* generate function epilog */ -void gfunc_epilog(void) -{ - out_op(IL_OP_RET); - fprintf(il_outfile, "}\n\n"); -} - -/* generate a jump to a label */ -int gjmp(int t) -{ - return out_opj(IL_OP_BR, t); -} - -/* generate a jump to a fixed address */ -void gjmp_addr(int a) -{ - /* XXX: handle syms */ - out_opi(IL_OP_BR, a); -} - -/* generate a test. set 'inv' to invert test. Stack entry is popped */ -int gtst(int inv, int t) -{ - int v, *p, c; - - v = vtop->r & VT_VALMASK; - if (v == VT_CMP) { - c = vtop->c.i ^ inv; - switch(c) { - case TOK_EQ: - c = IL_OP_BEQ; - break; - case TOK_NE: - c = IL_OP_BNE_UN; - break; - case TOK_LT: - c = IL_OP_BLT; - break; - case TOK_LE: - c = IL_OP_BLE; - break; - case TOK_GT: - c = IL_OP_BGT; - break; - case TOK_GE: - c = IL_OP_BGE; - break; - case TOK_ULT: - c = IL_OP_BLT_UN; - break; - case TOK_ULE: - c = IL_OP_BLE_UN; - break; - case TOK_UGT: - c = IL_OP_BGT_UN; - break; - case TOK_UGE: - c = IL_OP_BGE_UN; - break; - } - t = out_opj(c, t); - } else if (v == VT_JMP || v == VT_JMPI) { - /* && or || optimization */ - if ((v & 1) == inv) { - /* insert vtop->c jump list in t */ - p = &vtop->c.i; - while (*p != 0) - p = (int *)*p; - *p = t; - t = vtop->c.i; - } else { - t = gjmp(t); - gsym(vtop->c.i); - } - } - vtop--; - return t; -} - -/* generate an integer binary operation */ -void gen_opi(int op) -{ - gv2(RC_ST1, RC_ST0); - switch(op) { - case '+': - out_op(IL_OP_ADD); - goto std_op; - case '-': - out_op(IL_OP_SUB); - goto std_op; - case '&': - out_op(IL_OP_AND); - goto std_op; - case '^': - out_op(IL_OP_XOR); - goto std_op; - case '|': - out_op(IL_OP_OR); - goto std_op; - case '*': - out_op(IL_OP_MUL); - goto std_op; - case TOK_SHL: - out_op(IL_OP_SHL); - goto std_op; - case TOK_SHR: - out_op(IL_OP_SHR_UN); - goto std_op; - case TOK_SAR: - out_op(IL_OP_SHR); - goto std_op; - case '/': - case TOK_PDIV: - out_op(IL_OP_DIV); - goto std_op; - case TOK_UDIV: - out_op(IL_OP_DIV_UN); - goto std_op; - case '%': - out_op(IL_OP_REM); - goto std_op; - case TOK_UMOD: - out_op(IL_OP_REM_UN); - std_op: - vtop--; - vtop[0].r = REG_ST0; - break; - case TOK_EQ: - case TOK_NE: - case TOK_LT: - case TOK_LE: - case TOK_GT: - case TOK_GE: - case TOK_ULT: - case TOK_ULE: - case TOK_UGT: - case TOK_UGE: - vtop--; - vtop[0].r = VT_CMP; - vtop[0].c.i = op; - break; - } -} - -/* generate a floating point operation 'v = t1 op t2' instruction. The - two operands are guaranteed to have the same floating point type */ -void gen_opf(int op) -{ - /* same as integer */ - gen_opi(op); -} - -/* convert integers to fp 't' type. Must handle 'int', 'unsigned int' - and 'long long' cases. */ -void gen_cvt_itof(int t) -{ - gv(RC_ST0); - if (t == VT_FLOAT) - out_op(IL_OP_CONV_R4); - else - out_op(IL_OP_CONV_R8); -} - -/* convert fp to int 't' type */ -/* XXX: handle long long case */ -void gen_cvt_ftoi(int t) -{ - gv(RC_ST0); - switch(t) { - case VT_INT | VT_UNSIGNED: - out_op(IL_OP_CONV_U4); - break; - case VT_LLONG: - out_op(IL_OP_CONV_I8); - break; - case VT_LLONG | VT_UNSIGNED: - out_op(IL_OP_CONV_U8); - break; - default: - out_op(IL_OP_CONV_I4); - break; - } -} - -/* convert from one floating point type to another */ -void gen_cvt_ftof(int t) -{ - gv(RC_ST0); - if (t == VT_FLOAT) { - out_op(IL_OP_CONV_R4); - } else { - out_op(IL_OP_CONV_R8); - } -} - -/* end of CIL code generator */ -/*************************************************************/ - diff --git a/il-opcodes.h b/il-opcodes.h deleted file mode 100644 index d53ffb2c..00000000 --- a/il-opcodes.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * CIL opcode definition - * - * Copyright (c) 2002 Fabrice Bellard - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -OP(NOP, "nop", 0x00) -OP(BREAK, "break", 0x01) -OP(LDARG_0, "ldarg.0", 0x02) -OP(LDARG_1, "ldarg.1", 0x03) -OP(LDARG_2, "ldarg.2", 0x04) -OP(LDARG_3, "ldarg.3", 0x05) -OP(LDLOC_0, "ldloc.0", 0x06) -OP(LDLOC_1, "ldloc.1", 0x07) -OP(LDLOC_2, "ldloc.2", 0x08) -OP(LDLOC_3, "ldloc.3", 0x09) -OP(STLOC_0, "stloc.0", 0x0a) -OP(STLOC_1, "stloc.1", 0x0b) -OP(STLOC_2, "stloc.2", 0x0c) -OP(STLOC_3, "stloc.3", 0x0d) -OP(LDARG_S, "ldarg.s", 0x0e) -OP(LDARGA_S, "ldarga.s", 0x0f) -OP(STARG_S, "starg.s", 0x10) -OP(LDLOC_S, "ldloc.s", 0x11) -OP(LDLOCA_S, "ldloca.s", 0x12) -OP(STLOC_S, "stloc.s", 0x13) -OP(LDNULL, "ldnull", 0x14) -OP(LDC_I4_M1, "ldc.i4.m1", 0x15) -OP(LDC_I4_0, "ldc.i4.0", 0x16) -OP(LDC_I4_1, "ldc.i4.1", 0x17) -OP(LDC_I4_2, "ldc.i4.2", 0x18) -OP(LDC_I4_3, "ldc.i4.3", 0x19) -OP(LDC_I4_4, "ldc.i4.4", 0x1a) -OP(LDC_I4_5, "ldc.i4.5", 0x1b) -OP(LDC_I4_6, "ldc.i4.6", 0x1c) -OP(LDC_I4_7, "ldc.i4.7", 0x1d) -OP(LDC_I4_8, "ldc.i4.8", 0x1e) -OP(LDC_I4_S, "ldc.i4.s", 0x1f) -OP(LDC_I4, "ldc.i4", 0x20) -OP(LDC_I8, "ldc.i8", 0x21) -OP(LDC_R4, "ldc.r4", 0x22) -OP(LDC_R8, "ldc.r8", 0x23) -OP(LDPTR, "ldptr", 0x24) -OP(DUP, "dup", 0x25) -OP(POP, "pop", 0x26) -OP(JMP, "jmp", 0x27) -OP(CALL, "call", 0x28) -OP(CALLI, "calli", 0x29) -OP(RET, "ret", 0x2a) -OP(BR_S, "br.s", 0x2b) -OP(BRFALSE_S, "brfalse.s", 0x2c) -OP(BRTRUE_S, "brtrue.s", 0x2d) -OP(BEQ_S, "beq.s", 0x2e) -OP(BGE_S, "bge.s", 0x2f) -OP(BGT_S, "bgt.s", 0x30) -OP(BLE_S, "ble.s", 0x31) -OP(BLT_S, "blt.s", 0x32) -OP(BNE_UN_S, "bne.un.s", 0x33) -OP(BGE_UN_S, "bge.un.s", 0x34) -OP(BGT_UN_S, "bgt.un.s", 0x35) -OP(BLE_UN_S, "ble.un.s", 0x36) -OP(BLT_UN_S, "blt.un.s", 0x37) -OP(BR, "br", 0x38) -OP(BRFALSE, "brfalse", 0x39) -OP(BRTRUE, "brtrue", 0x3a) -OP(BEQ, "beq", 0x3b) -OP(BGE, "bge", 0x3c) -OP(BGT, "bgt", 0x3d) -OP(BLE, "ble", 0x3e) -OP(BLT, "blt", 0x3f) -OP(BNE_UN, "bne.un", 0x40) -OP(BGE_UN, "bge.un", 0x41) -OP(BGT_UN, "bgt.un", 0x42) -OP(BLE_UN, "ble.un", 0x43) -OP(BLT_UN, "blt.un", 0x44) -OP(SWITCH, "switch", 0x45) -OP(LDIND_I1, "ldind.i1", 0x46) -OP(LDIND_U1, "ldind.u1", 0x47) -OP(LDIND_I2, "ldind.i2", 0x48) -OP(LDIND_U2, "ldind.u2", 0x49) -OP(LDIND_I4, "ldind.i4", 0x4a) -OP(LDIND_U4, "ldind.u4", 0x4b) -OP(LDIND_I8, "ldind.i8", 0x4c) -OP(LDIND_I, "ldind.i", 0x4d) -OP(LDIND_R4, "ldind.r4", 0x4e) -OP(LDIND_R8, "ldind.r8", 0x4f) -OP(LDIND_REF, "ldind.ref", 0x50) -OP(STIND_REF, "stind.ref", 0x51) -OP(STIND_I1, "stind.i1", 0x52) -OP(STIND_I2, "stind.i2", 0x53) -OP(STIND_I4, "stind.i4", 0x54) -OP(STIND_I8, "stind.i8", 0x55) -OP(STIND_R4, "stind.r4", 0x56) -OP(STIND_R8, "stind.r8", 0x57) -OP(ADD, "add", 0x58) -OP(SUB, "sub", 0x59) -OP(MUL, "mul", 0x5a) -OP(DIV, "div", 0x5b) -OP(DIV_UN, "div.un", 0x5c) -OP(REM, "rem", 0x5d) -OP(REM_UN, "rem.un", 0x5e) -OP(AND, "and", 0x5f) -OP(OR, "or", 0x60) -OP(XOR, "xor", 0x61) -OP(SHL, "shl", 0x62) -OP(SHR, "shr", 0x63) -OP(SHR_UN, "shr.un", 0x64) -OP(NEG, "neg", 0x65) -OP(NOT, "not", 0x66) -OP(CONV_I1, "conv.i1", 0x67) -OP(CONV_I2, "conv.i2", 0x68) -OP(CONV_I4, "conv.i4", 0x69) -OP(CONV_I8, "conv.i8", 0x6a) -OP(CONV_R4, "conv.r4", 0x6b) -OP(CONV_R8, "conv.r8", 0x6c) -OP(CONV_U4, "conv.u4", 0x6d) -OP(CONV_U8, "conv.u8", 0x6e) -OP(CALLVIRT, "callvirt", 0x6f) -OP(CPOBJ, "cpobj", 0x70) -OP(LDOBJ, "ldobj", 0x71) -OP(LDSTR, "ldstr", 0x72) -OP(NEWOBJ, "newobj", 0x73) -OP(CASTCLASS, "castclass", 0x74) -OP(ISINST, "isinst", 0x75) -OP(CONV_R_UN, "conv.r.un", 0x76) -OP(ANN_DATA_S, "ann.data.s", 0x77) -OP(UNBOX, "unbox", 0x79) -OP(THROW, "throw", 0x7a) -OP(LDFLD, "ldfld", 0x7b) -OP(LDFLDA, "ldflda", 0x7c) -OP(STFLD, "stfld", 0x7d) -OP(LDSFLD, "ldsfld", 0x7e) -OP(LDSFLDA, "ldsflda", 0x7f) -OP(STSFLD, "stsfld", 0x80) -OP(STOBJ, "stobj", 0x81) -OP(CONV_OVF_I1_UN, "conv.ovf.i1.un", 0x82) -OP(CONV_OVF_I2_UN, "conv.ovf.i2.un", 0x83) -OP(CONV_OVF_I4_UN, "conv.ovf.i4.un", 0x84) -OP(CONV_OVF_I8_UN, "conv.ovf.i8.un", 0x85) -OP(CONV_OVF_U1_UN, "conv.ovf.u1.un", 0x86) -OP(CONV_OVF_U2_UN, "conv.ovf.u2.un", 0x87) -OP(CONV_OVF_U4_UN, "conv.ovf.u4.un", 0x88) -OP(CONV_OVF_U8_UN, "conv.ovf.u8.un", 0x89) -OP(CONV_OVF_I_UN, "conv.ovf.i.un", 0x8a) -OP(CONV_OVF_U_UN, "conv.ovf.u.un", 0x8b) -OP(BOX, "box", 0x8c) -OP(NEWARR, "newarr", 0x8d) -OP(LDLEN, "ldlen", 0x8e) -OP(LDELEMA, "ldelema", 0x8f) -OP(LDELEM_I1, "ldelem.i1", 0x90) -OP(LDELEM_U1, "ldelem.u1", 0x91) -OP(LDELEM_I2, "ldelem.i2", 0x92) -OP(LDELEM_U2, "ldelem.u2", 0x93) -OP(LDELEM_I4, "ldelem.i4", 0x94) -OP(LDELEM_U4, "ldelem.u4", 0x95) -OP(LDELEM_I8, "ldelem.i8", 0x96) -OP(LDELEM_I, "ldelem.i", 0x97) -OP(LDELEM_R4, "ldelem.r4", 0x98) -OP(LDELEM_R8, "ldelem.r8", 0x99) -OP(LDELEM_REF, "ldelem.ref", 0x9a) -OP(STELEM_I, "stelem.i", 0x9b) -OP(STELEM_I1, "stelem.i1", 0x9c) -OP(STELEM_I2, "stelem.i2", 0x9d) -OP(STELEM_I4, "stelem.i4", 0x9e) -OP(STELEM_I8, "stelem.i8", 0x9f) -OP(STELEM_R4, "stelem.r4", 0xa0) -OP(STELEM_R8, "stelem.r8", 0xa1) -OP(STELEM_REF, "stelem.ref", 0xa2) -OP(CONV_OVF_I1, "conv.ovf.i1", 0xb3) -OP(CONV_OVF_U1, "conv.ovf.u1", 0xb4) -OP(CONV_OVF_I2, "conv.ovf.i2", 0xb5) -OP(CONV_OVF_U2, "conv.ovf.u2", 0xb6) -OP(CONV_OVF_I4, "conv.ovf.i4", 0xb7) -OP(CONV_OVF_U4, "conv.ovf.u4", 0xb8) -OP(CONV_OVF_I8, "conv.ovf.i8", 0xb9) -OP(CONV_OVF_U8, "conv.ovf.u8", 0xba) -OP(REFANYVAL, "refanyval", 0xc2) -OP(CKFINITE, "ckfinite", 0xc3) -OP(MKREFANY, "mkrefany", 0xc6) -OP(ANN_CALL, "ann.call", 0xc7) -OP(ANN_CATCH, "ann.catch", 0xc8) -OP(ANN_DEAD, "ann.dead", 0xc9) -OP(ANN_HOISTED, "ann.hoisted", 0xca) -OP(ANN_HOISTED_CALL, "ann.hoisted.call", 0xcb) -OP(ANN_LAB, "ann.lab", 0xcc) -OP(ANN_DEF, "ann.def", 0xcd) -OP(ANN_REF_S, "ann.ref.s", 0xce) -OP(ANN_PHI, "ann.phi", 0xcf) -OP(LDTOKEN, "ldtoken", 0xd0) -OP(CONV_U2, "conv.u2", 0xd1) -OP(CONV_U1, "conv.u1", 0xd2) -OP(CONV_I, "conv.i", 0xd3) -OP(CONV_OVF_I, "conv.ovf.i", 0xd4) -OP(CONV_OVF_U, "conv.ovf.u", 0xd5) -OP(ADD_OVF, "add.ovf", 0xd6) -OP(ADD_OVF_UN, "add.ovf.un", 0xd7) -OP(MUL_OVF, "mul.ovf", 0xd8) -OP(MUL_OVF_UN, "mul.ovf.un", 0xd9) -OP(SUB_OVF, "sub.ovf", 0xda) -OP(SUB_OVF_UN, "sub.ovf.un", 0xdb) -OP(ENDFINALLY, "endfinally", 0xdc) -OP(LEAVE, "leave", 0xdd) -OP(LEAVE_S, "leave.s", 0xde) -OP(STIND_I, "stind.i", 0xdf) -OP(CONV_U, "conv.u", 0xe0) - -/* prefix instructions. we use an opcode >= 256 to ease coding */ - -OP(ARGLIST, "arglist", 0x100) -OP(CEQ, "ceq", 0x101) -OP(CGT, "cgt", 0x102) -OP(CGT_UN, "cgt.un", 0x103) -OP(CLT, "clt", 0x104) -OP(CLT_UN, "clt.un", 0x105) -OP(LDFTN, "ldftn", 0x106) -OP(LDVIRTFTN, "ldvirtftn", 0x107) -OP(JMPI, "jmpi", 0x108) -OP(LDARG, "ldarg", 0x109) -OP(LDARGA, "ldarga", 0x10a) -OP(STARG, "starg", 0x10b) -OP(LDLOC, "ldloc", 0x10c) -OP(LDLOCA, "ldloca", 0x10d) -OP(STLOC, "stloc", 0x10e) -OP(LOCALLOC, "localloc", 0x10f) -OP(ENDFILTER, "endfilter", 0x111) -OP(UNALIGNED, "unaligned", 0x112) -OP(VOLATILE, "volatile", 0x113) -OP(TAIL, "tail", 0x114) -OP(INITOBJ, "initobj", 0x115) -OP(ANN_LIVE, "ann.live", 0x116) -OP(CPBLK, "cpblk", 0x117) -OP(INITBLK, "initblk", 0x118) -OP(ANN_REF, "ann.ref", 0x119) -OP(RETHROW, "rethrow", 0x11a) -OP(SIZEOF, "sizeof", 0x11c) -OP(REFANYTYPE, "refanytype", 0x11d) -OP(ANN_DATA, "ann.data", 0x122) -OP(ANN_ARG, "ann.arg", 0x123) diff --git a/libtcc.c b/libtcc.c index 44cca386..ca31aa7e 100644 --- a/libtcc.c +++ b/libtcc.c @@ -18,52 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ONE_SOURCE -# define ONE_SOURCE 1 -#endif - -#if ONE_SOURCE -#include "tccpp.c" -#include "tccgen.c" -#include "tccdbg.c" -#include "tccasm.c" -#include "tccelf.c" -#include "tccrun.c" -#ifdef TCC_TARGET_I386 -#include "i386-gen.c" -#include "i386-link.c" -#include "i386-asm.c" -#elif defined(TCC_TARGET_ARM) -#include "arm-gen.c" -#include "arm-link.c" -#include "arm-asm.c" -#elif defined(TCC_TARGET_ARM64) -#include "arm64-gen.c" -#include "arm64-link.c" -#include "arm-asm.c" -#elif defined(TCC_TARGET_C67) -#include "c67-gen.c" -#include "c67-link.c" -#include "tcccoff.c" -#elif defined(TCC_TARGET_X86_64) -#include "x86_64-gen.c" -#include "x86_64-link.c" -#include "i386-asm.c" -#elif defined(TCC_TARGET_RISCV64) -#include "riscv64-gen.c" -#include "riscv64-link.c" -#include "riscv64-asm.c" -#else -#error unknown target -#endif -#ifdef TCC_TARGET_PE -#include "tccpe.c" -#endif -#ifdef TCC_TARGET_MACHO -#include "tccmacho.c" -#endif -#endif /* ONE_SOURCE */ - #include "tcc.h" /********************************************************/ @@ -87,17 +41,7 @@ ST_FUNC char *normalize_slashes(char *path) return path; } -#if defined LIBTCC_AS_DLL && !defined CONFIG_TCCDIR -static HMODULE tcc_module; -BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) -{ - if (DLL_PROCESS_ATTACH == dwReason) - tcc_module = hDll; - return TRUE; -} -#else #define tcc_module NULL /* NULL means executable itself */ -#endif #ifndef CONFIG_TCCDIR /* on win32, we suppose the lib and includes are at the location of 'tcc.exe' */ @@ -114,14 +58,6 @@ static inline char *config_tccdir_w32(char *path) #define CONFIG_TCCDIR config_tccdir_w32(alloca(MAX_PATH)) #endif -#ifdef TCC_IS_NATIVE -static void tcc_add_systemdir(TCCState *s) -{ - char buf[1000]; - GetSystemDirectoryA(buf, sizeof buf); - tcc_add_library_path(s, normalize_slashes(buf)); -} -#endif #endif /********************************************************/ @@ -830,16 +766,8 @@ LIBTCCAPI TCCState *tcc_new(void) #ifdef CHAR_IS_UNSIGNED s->char_is_unsigned = 1; #endif -#ifdef TCC_TARGET_I386 s->seg_size = 32; -#endif - /* enable this if you want symbols with leading underscore on windows: */ -#if defined TCC_TARGET_MACHO /* || defined TCC_TARGET_PE */ - s->leading_underscore = 1; -#endif -#ifdef TCC_TARGET_ARM - s->float_abi = ARM_FLOAT_ABI; -#endif + #ifdef CONFIG_NEW_DTAGS s->enable_new_dtags = 1; #endif @@ -873,9 +801,6 @@ LIBTCCAPI void tcc_delete(TCCState *s1) tcc_free(s1->mapfile); tcc_free(s1->outfile); tcc_free(s1->deps_outfile); -#if defined TCC_TARGET_MACHO - tcc_free(s1->install_name); -#endif dynarray_reset(&s1->files, &s1->nb_files); dynarray_reset(&s1->target_deps, &s1->nb_target_deps); dynarray_reset(&s1->pragma_libs, &s1->nb_pragma_libs); @@ -884,10 +809,6 @@ LIBTCCAPI void tcc_delete(TCCState *s1) cstr_free(&s1->cmdline_incl); cstr_free(&s1->linker_arg); tcc_free(s1->dState); -#ifdef TCC_IS_NATIVE - /* free runtime memory */ - tcc_run_free(s1); -#endif /* free loaded dlls array */ dynarray_reset(&s1->loaded_dlls, &s1->nb_loaded_dlls); tcc_free(s1); @@ -926,21 +847,10 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) tcc_add_library_path(s, CONFIG_TCC_LIBPATHS); -#ifdef TCC_TARGET_PE -# ifdef TCC_IS_NATIVE - /* allow linking with system dll's directly */ - tcc_add_systemdir(s); -# endif -#elif defined TCC_TARGET_MACHO -# ifdef TCC_IS_NATIVE - tcc_add_macos_sdkpath(s); -# endif -#else /* paths for crt objects */ tcc_split_path(s, &s->crt_paths, &s->nb_crt_paths, CONFIG_TCC_CRTPREFIX); if (output_type != TCC_OUTPUT_MEMORY && !s->nostdlib) tccelf_add_crtbegin(s); -#endif return 0; } @@ -982,43 +892,12 @@ ST_FUNC DLLReference *tcc_add_dllref(TCCState *s1, const char *dllname, int leve return ref; } -/* OpenBSD: choose latest from libxxx.so.x.y versions */ -#if defined TARGETOS_OpenBSD && !defined _WIN32 -#include -static int tcc_glob_so(TCCState *s1, const char *pattern, char *buf, int size) -{ - const char *star; - glob_t g; - char *p; - int i, v, v1, v2, v3; - - star = strchr(pattern, '*'); - if (!star || glob(pattern, 0, NULL, &g)) - return -1; - for (v = -1, i = 0; i < g.gl_pathc; ++i) { - p = g.gl_pathv[i]; - if (2 != sscanf(p + (star - pattern), "%d.%d.%d", &v1, &v2, &v3)) - continue; - if ((v1 = v1 * 1000 + v2) > v) - v = v1, pstrcpy(buf, size, p); - } - globfree(&g); - return v; -} -#endif - static int guess_filetype(const char *filename); ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) { int fd, ret = -1; -#if defined TARGETOS_OpenBSD && !defined _WIN32 - char buf[1024]; - if (tcc_glob_so(s1, filename, buf, sizeof buf) >= 0) - filename = buf; -#endif - if (0 == (flags & AFF_TYPE_MASK)) flags |= guess_filetype(filename); @@ -1094,11 +973,6 @@ ST_FUNC int tcc_add_file_internal(TCCState *s1, const char *filename, int flags) #else /* unix */ case AFF_BINTYPE_DYN: if (s1->output_type == TCC_OUTPUT_MEMORY) { -#ifdef TCC_IS_NATIVE - void* dl = dlopen(filename, RTLD_GLOBAL | RTLD_LAZY); - if (dl) - tcc_add_dllref(s1, filename, 0)->handle = dl, ret = 0; -#endif } else ret = tcc_load_dll(s1, fd, filename, (flags & AFF_REFERENCED_DLL) != 0); break; @@ -1211,19 +1085,8 @@ ST_FUNC int tcc_add_crt(TCCState *s1, const char *filename) /* the library name is the same as the argument of the '-l' option */ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname) { -#if defined TCC_TARGET_PE - static const char * const libs[] = { "%s/%s.def", "%s/lib%s.def", "%s/%s.dll", "%s/lib%s.dll", "%s/lib%s.a", NULL }; - const char * const *pp = s->static_link ? libs + 4 : libs; -#elif defined TCC_TARGET_MACHO - static const char * const libs[] = { "%s/lib%s.dylib", "%s/lib%s.tbd", "%s/lib%s.a", NULL }; - const char * const *pp = s->static_link ? libs + 2 : libs; -#elif defined TARGETOS_OpenBSD - static const char * const libs[] = { "%s/lib%s.so.*", "%s/lib%s.a", NULL }; - const char * const *pp = s->static_link ? libs + 1 : libs; -#else - static const char * const libs[] = { "%s/lib%s.so", "%s/lib%s.a", NULL }; - const char * const *pp = s->static_link ? libs + 1 : libs; -#endif + static const char * const libs[] = { "%s/lib%s.a", NULL }; + const char * const *pp = libs; int flags = s->filetype & AFF_WHOLE_ARCHIVE; while (*pp) { int ret = tcc_add_library_internal(s, *pp, @@ -1245,11 +1108,6 @@ ST_FUNC void tcc_add_pragma_libs(TCCState *s1) LIBTCCAPI int tcc_add_symbol(TCCState *s1, const char *name, const void *val) { -#ifdef TCC_TARGET_PE - /* On x86_64 'val' might not be reachable with a 32bit offset. - So it is handled here as if it were in a DLL. */ - pe_putimport(s1, 0, name, (uintptr_t)val); -#else char buf[256]; if (s1->leading_underscore) { buf[0] = '_'; @@ -1257,7 +1115,6 @@ LIBTCCAPI int tcc_add_symbol(TCCState *s1, const char *name, const void *val) name = buf; } set_global_sym(s1, name, NULL, (addr_t)(uintptr_t)val); /* NULL: SHN_ABS */ -#endif return 0; } @@ -1401,13 +1258,7 @@ static int tcc_set_linker(TCCState *s, const char *option) copy_linker_arg(&s->mapfile, p, 0); ignoring = 1; } else if (link_option(option, "oformat=", &p)) { -#if defined(TCC_TARGET_PE) - if (strstart("pe-", &p)) { -#elif PTR_SIZE == 8 - if (strstart("elf64-", &p)) { -#else if (strstart("elf32-", &p)) { -#endif s->output_format = TCC_OUTPUT_FORMAT_ELF; } else if (link_arg("binary", p)) { s->output_format = TCC_OUTPUT_FORMAT_BINARY; @@ -1436,48 +1287,6 @@ static int tcc_set_linker(TCCState *s, const char *option) copy_linker_arg(&s->soname, p, 0); } else if (link_option(option, "install_name=", &p)) { copy_linker_arg(&s->soname, p, 0); -#ifdef TCC_TARGET_PE - } else if (link_option(option, "large-address-aware", &p)) { - s->pe_characteristics |= 0x20; - } else if (link_option(option, "file-alignment=", &p)) { - s->pe_file_align = strtoul(p, &end, 16); - } else if (link_option(option, "stack=", &p)) { - s->pe_stack_size = strtoul(p, &end, 10); - } else if (link_option(option, "subsystem=", &p)) { -#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64) - if (link_arg("native", p)) { - s->pe_subsystem = 1; - } else if (link_arg("console", p)) { - s->pe_subsystem = 3; - } else if (link_arg("gui", p) || link_arg("windows", p)) { - s->pe_subsystem = 2; - } else if (link_arg("posix", p)) { - s->pe_subsystem = 7; - } else if (link_arg("efiapp", p)) { - s->pe_subsystem = 10; - } else if (link_arg("efiboot", p)) { - s->pe_subsystem = 11; - } else if (link_arg("efiruntime", p)) { - s->pe_subsystem = 12; - } else if (link_arg("efirom", p)) { - s->pe_subsystem = 13; -#elif defined(TCC_TARGET_ARM) - if (link_arg("wince", p)) { - s->pe_subsystem = 9; -#endif - } else - goto err; -#endif -#ifdef TCC_TARGET_MACHO - } else if (link_option(option, "all_load", &p)) { - s->filetype |= AFF_WHOLE_ARCHIVE; - } else if (link_option(option, "force_load", &p)) { - s->filetype |= AFF_WHOLE_ARCHIVE; - args_parser_add_file(s, p, AFF_TYPE_LIB | (s->filetype & ~AFF_TYPE_MASK)); - s->nb_libraries++; - } else if (link_option(option, "single_module", &p)) { - ignoring = 1; -#endif } else if (ret = link_option(option, "?whole-archive", &p), ret) { if (ret > 0) s->filetype |= AFF_WHOLE_ARCHIVE; @@ -1546,7 +1355,6 @@ enum { TCC_OPTION_print_search_dirs, TCC_OPTION_rdynamic, TCC_OPTION_pthread, - TCC_OPTION_run, TCC_OPTION_w, TCC_OPTION_E, TCC_OPTION_M, @@ -1592,14 +1400,7 @@ static const TCCOption tcc_options[] = { { "b", TCC_OPTION_b, 0 }, #endif { "g", TCC_OPTION_g, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, -#ifdef TCC_TARGET_MACHO - { "compatibility_version", TCC_OPTION_compatibility_version, TCC_OPTION_HAS_ARG }, - { "current_version", TCC_OPTION_current_version, TCC_OPTION_HAS_ARG }, -#endif { "c", TCC_OPTION_c, 0 }, -#ifdef TCC_TARGET_MACHO - { "dynamiclib", TCC_OPTION_dynamiclib, 0 }, -#endif { "dumpmachine", TCC_OPTION_dumpmachine, 0}, { "dumpversion", TCC_OPTION_dumpversion, 0}, { "d", TCC_OPTION_d, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, @@ -1609,20 +1410,13 @@ static const TCCOption tcc_options[] = { { "soname", TCC_OPTION_soname, TCC_OPTION_HAS_ARG }, { "o", TCC_OPTION_o, TCC_OPTION_HAS_ARG }, { "pthread", TCC_OPTION_pthread, 0}, - { "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { "rdynamic", TCC_OPTION_rdynamic, 0 }, { "r", TCC_OPTION_r, 0 }, { "Wl,", TCC_OPTION_Wl, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { "Wp,", TCC_OPTION_Wp, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { "W", TCC_OPTION_W, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { "O", TCC_OPTION_O, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, -#ifdef TCC_TARGET_ARM - { "mfloat-abi", TCC_OPTION_mfloat_abi, TCC_OPTION_HAS_ARG }, -#endif { "m", TCC_OPTION_m, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, -#ifdef TCC_TARGET_MACHO - { "flat_namespace", TCC_OPTION_flat_namespace, 0 }, -#endif { "f", TCC_OPTION_f, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP }, { "isystem", TCC_OPTION_isystem, TCC_OPTION_HAS_ARG }, { "include", TCC_OPTION_include, TCC_OPTION_HAS_ARG }, @@ -1639,14 +1433,6 @@ static const TCCOption tcc_options[] = { { "MP", TCC_OPTION_MP, 0}, { "x", TCC_OPTION_x, TCC_OPTION_HAS_ARG }, { "ar", TCC_OPTION_ar, 0}, -#ifdef TCC_TARGET_PE - { "impdef", TCC_OPTION_impdef, 0}, -#endif -#ifdef TCC_TARGET_MACHO - { "install_name", TCC_OPTION_install_name, TCC_OPTION_HAS_ARG }, - { "two_levelnamespace", TCC_OPTION_two_levelnamespace, 0 }, - { "undefined", TCC_OPTION_undefined, TCC_OPTION_HAS_ARG }, -#endif /* ignored (silently, except after -Wunsupported) */ { "arch", 0, TCC_OPTION_HAS_ARG}, { "C", 0, 0 }, @@ -1693,9 +1479,6 @@ static const FlagDef options_f[] = { static const FlagDef options_m[] = { { offsetof(TCCState, ms_bitfields), 0, "ms-bitfields" }, -#ifdef TCC_TARGET_X86_64 - { offsetof(TCCState, nosse), FD_INVERT, "sse" }, -#endif { 0, 0, NULL } }; @@ -1733,38 +1516,7 @@ static int set_flag(TCCState *s, const FlagDef *flags, const char *name) return ret; } -static const char dumpmachine_str[] = -/* this is a best guess, please refine as necessary */ -#ifdef TCC_TARGET_I386 - "i386-pc" -#elif defined TCC_TARGET_X86_64 - "x86_64-pc" -#elif defined TCC_TARGET_C67 - "c67" -#elif defined TCC_TARGET_ARM - "arm" -#elif defined TCC_TARGET_ARM64 - "aarch64" -#elif defined TCC_TARGET_RISCV64 - "riscv64" -#endif - "-" -#ifdef TCC_TARGET_PE - "mingw32" -#elif defined(TCC_TARGET_MACHO) - "apple-darwin" -#elif TARGETOS_FreeBSD || TARGETOS_FreeBSD_kernel - "freebsd" -#elif TARGETOS_OpenBSD - "openbsd" -#elif TARGETOS_NetBSD - "netbsd" -#elif CONFIG_TCC_MUSL - "linux-musl" -#else - "linux-gnu" -#endif -; +static const char dumpmachine_str[] = "i386-pc-stupidos"; static int args_parser_make_argv(const char *r, int *argc, char ***argv) { @@ -1825,26 +1577,6 @@ static int args_parser_listfile(TCCState *s, return 0; } -#if defined TCC_TARGET_MACHO -static uint32_t parse_version(TCCState *s1, const char *version) -{ - uint32_t a = 0; - uint32_t b = 0; - uint32_t c = 0; - char* last; - - a = strtoul(version, &last, 10); - if (*last == '.') { - b = strtoul(&last[1], &last, 10); - if (*last == '.') - c = strtoul(&last[1], &last, 10); - } - if (*last || a > 0xffff || b > 0xff || c > 0xff) - tcc_error_noabort("version a.b.c not correct: %s", version); - return (a << 16) | (b << 8) | c; -} -#endif - PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind) { TCCState *s1 = s; @@ -1967,10 +1699,6 @@ dorun: x = *optarg - '0'; /* -g0 = no info, -g1 = lines/functions only, -g2 = full info */ s->do_debug = x > 2 ? 2 : x == 0 && s->do_backtrace ? 1 : x; -#ifdef TCC_TARGET_PE - } else if (0 == strcmp(".pdb", optarg)) { - s->dwarf = 5, s->do_debug |= 16; -#endif } break; case TCC_OPTION_c: @@ -2029,14 +1757,6 @@ dorun: case TCC_OPTION_nostdlib: s->nostdlib = 1; break; - case TCC_OPTION_run: -#ifndef TCC_IS_NATIVE - return tcc_error_noabort("-run is not available in a cross compiler"); -#else - run = optarg; - x = TCC_OUTPUT_MEMORY; - goto set_output_type; -#endif case TCC_OPTION_v: do ++s->verbose; while (*optarg++ == 'v'); ++noaction; @@ -2045,17 +1765,6 @@ dorun: if (set_flag(s, options_f, optarg) < 0) goto unsupported_option; break; -#ifdef TCC_TARGET_ARM - case TCC_OPTION_mfloat_abi: - /* tcc doesn't support soft float yet */ - if (!strcmp(optarg, "softfp")) { - s->float_abi = ARM_SOFTFP_FLOAT; - } else if (!strcmp(optarg, "hard")) - s->float_abi = ARM_HARD_FLOAT; - else - return tcc_error_noabort("unsupported float abi '%s'", optarg); - break; -#endif case TCC_OPTION_m: if (set_flag(s, options_m, optarg) < 0) { if (x = atoi(optarg), x != 32 && x != 64) @@ -2120,7 +1829,7 @@ dorun: printf("%s\n", dumpmachine_str); exit(0); case TCC_OPTION_dumpversion: - printf ("%s\n", TCC_VERSION); + printf ("%s\n", PACKAGE_VERSION); exit(0); case TCC_OPTION_x: x = 0; @@ -2145,26 +1854,6 @@ dorun: case TCC_OPTION_impdef: x = OPT_IMPDEF; goto extra_action; -#if defined TCC_TARGET_MACHO - case TCC_OPTION_dynamiclib: - x = TCC_OUTPUT_DLL; - goto set_output_type; - case TCC_OPTION_flat_namespace: - break; - case TCC_OPTION_two_levelnamespace: - break; - case TCC_OPTION_undefined: - break; - case TCC_OPTION_install_name: - s->install_name = tcc_strdup(optarg); - break; - case TCC_OPTION_compatibility_version: - s->compatibility_version = parse_version(s, optarg); - break; - case TCC_OPTION_current_version: - s->current_version = parse_version(s, optarg);; - break; -#endif case TCC_OPTION_ar: x = OPT_AR; extra_action: diff --git a/riscv64-asm.c b/riscv64-asm.c deleted file mode 100644 index 0ced1476..00000000 --- a/riscv64-asm.c +++ /dev/null @@ -1,2437 +0,0 @@ -/*************************************************************/ -/* - * RISCV64 assembler for TCC - * - */ - -#ifdef TARGET_DEFS_ONLY - -#define CONFIG_TCC_ASM -/* 32 general purpose + 32 floating point registers */ -#define NB_ASM_REGS 64 - -ST_FUNC void g(int c); -ST_FUNC void gen_le16(int c); -ST_FUNC void gen_le32(int c); - -/*************************************************************/ -#else -/*************************************************************/ -#define USING_GLOBALS -#include "tcc.h" - -enum { - OPT_REG, - OPT_IM12S, - OPT_IM32, -}; -// Registers go from 0 to 31. We use next bit to choose general/float -#define REG_FLOAT_MASK 0x20 -#define REG_IS_FLOAT(register_index) ((register_index) & REG_FLOAT_MASK) -#define REG_VALUE(register_index) ((register_index) & (REG_FLOAT_MASK-1)) -#define C_ENCODE_RS1(register_index) (REG_VALUE(register_index) << 7) -#define C_ENCODE_RS2(register_index) (REG_VALUE(register_index) << 2) -#define ENCODE_RD(register_index) (REG_VALUE(register_index) << 7) -#define ENCODE_RS1(register_index) (REG_VALUE(register_index) << 15) -#define ENCODE_RS2(register_index) (REG_VALUE(register_index) << 20) -#define NTH_BIT(b, n) ((b >> n) & 1) -#define OP_IM12S (1 << OPT_IM12S) -#define OP_IM32 (1 << OPT_IM32) -#define OP_REG (1 << OPT_REG) - -typedef struct Operand { - uint32_t type; - union { - uint8_t reg; - uint16_t regset; - ExprValue e; - }; -} Operand; - -static const Operand zero = { OP_REG, { 0 }}; -static const Operand ra = { OP_REG, { 1 }}; -static const Operand zimm = { OP_IM12S }; - -static void asm_binary_opcode(TCCState* s1, int token); -ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str); -ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg); -static void asm_emit_a(int token, uint32_t opcode, const Operand *rs1, const Operand *rs2, const Operand *rd1, int aq, int rl); -static void asm_emit_b(int token, uint32_t opcode, const Operand *rs1, const Operand *rs2, const Operand *imm); -static void asm_emit_i(int token, uint32_t opcode, const Operand *rd, const Operand *rs1, const Operand *rs2); -static void asm_emit_j(int token, uint32_t opcode, const Operand *rd, const Operand *rs2); -static void asm_emit_opcode(uint32_t opcode); -static void asm_emit_r(int token, uint32_t opcode, const Operand *rd, const Operand *rs1, const Operand *rs2); -static void asm_emit_s(int token, uint32_t opcode, const Operand *rs1, const Operand *rs2, const Operand *imm); -static void asm_emit_u(int token, uint32_t opcode, const Operand *rd, const Operand *rs2); -ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, int nb_outputs, int is_output, uint8_t *clobber_regs, int out_reg); -static void asm_nullary_opcode(TCCState *s1, int token); -ST_FUNC void asm_opcode(TCCState *s1, int token); -static int asm_parse_csrvar(int t); -ST_FUNC int asm_parse_regvar(int t); -static void asm_ternary_opcode(TCCState *s1, int token); -static void asm_unary_opcode(TCCState *s1, int token); -static void asm_branch_opcode(TCCState *s1, int token, int argc); -ST_FUNC void gen_expr32(ExprValue *pe); -static void parse_operand(TCCState *s1, Operand *op); -static void parse_branch_offset_operand(TCCState *s1, Operand *op); -static void parse_operands(TCCState *s1, Operand *ops, int count); -static void parse_mem_access_operands(TCCState *s1, Operand* ops); -ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier); -/* C extension */ -static void asm_emit_ca(int token, uint16_t opcode, const Operand *rd, const Operand *rs2); -static void asm_emit_cb(int token, uint16_t opcode, const Operand *rs1, const Operand *imm); -static void asm_emit_ci(int token, uint16_t opcode, const Operand *rd, const Operand *imm); -static void asm_emit_ciw(int token, uint16_t opcode, const Operand *rd, const Operand *imm); -static void asm_emit_cj(int token, uint16_t opcode, const Operand *imm); -static void asm_emit_cl(int token, uint16_t opcode, const Operand *rd, const Operand *rs1, const Operand *imm); -static void asm_emit_cr(int token, uint16_t opcode, const Operand *rd, const Operand *rs2); -static void asm_emit_cs(int token, uint16_t opcode, const Operand *rs2, const Operand *rs1, const Operand *imm); -static void asm_emit_css(int token, uint16_t opcode, const Operand *rs2, const Operand *imm); - -/* XXX: make it faster ? */ -ST_FUNC void g(int c) -{ - int ind1; - if (nocode_wanted) - return; - ind1 = ind + 1; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind] = c; - ind = ind1; -} - -ST_FUNC void gen_le16 (int i) -{ - g(i); - g(i>>8); -} - -ST_FUNC void gen_le32 (int i) -{ - int ind1; - if (nocode_wanted) - return; - ind1 = ind + 4; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind++] = i & 0xFF; - cur_text_section->data[ind++] = (i >> 8) & 0xFF; - cur_text_section->data[ind++] = (i >> 16) & 0xFF; - cur_text_section->data[ind++] = (i >> 24) & 0xFF; -} - -ST_FUNC void gen_expr32(ExprValue *pe) -{ - gen_le32(pe->v); -} - -static void asm_emit_opcode(uint32_t opcode) { - gen_le32(opcode); -} - -static void asm_nullary_opcode(TCCState *s1, int token) -{ - switch (token) { - // Sync instructions - - case TOK_ASM_fence_i: // I - asm_emit_opcode((0x3 << 2) | 3| (1 << 12)); - return; - - // System calls - - case TOK_ASM_ecall: // I (pseudo) - asm_emit_opcode((0x1C << 2) | 3 | (0 << 12)); - return; - case TOK_ASM_ebreak: // I (pseudo) - asm_emit_opcode((0x1C << 2) | 3 | (0 << 12) | (1 << 20)); - return; - - // Other - - case TOK_ASM_nop: - asm_emit_i(token, (4 << 2) | 3, &zero, &zero, &zimm); - return; - - case TOK_ASM_wfi: - asm_emit_opcode((0x1C << 2) | 3 | (0x105 << 20)); - return; - - /* Pseudoinstructions */ - case TOK_ASM_ret: - /* jalr zero, x1, 0 */ - asm_emit_opcode( 0x67 | (0 << 12) | ENCODE_RS1(1) ); - return; - - /* C extension */ - case TOK_ASM_c_ebreak: - asm_emit_cr(token, 2 | (9 << 12), &zero, &zero); - return; - case TOK_ASM_c_nop: - asm_emit_ci(token, 1, &zero, &zimm); - return; - - default: - expect("nullary instruction"); - } -} - -/* Parse a text containing operand and store the result in OP */ -static void parse_operand(TCCState *s1, Operand *op) -{ - ExprValue e = {0}; - Sym label = {0}; - int8_t reg; - - op->type = 0; - - if ((reg = asm_parse_regvar(tok)) != -1) { - next(); // skip register name - op->type = OP_REG; - op->reg = (uint8_t) reg; - return; - } else if (tok == '$') { - /* constant value */ - next(); // skip '#' or '$' - } else if ((e.v = asm_parse_csrvar(tok)) != -1) { - next(); - } else { - asm_expr(s1, &e); - } - op->type = OP_IM32; - op->e = e; - /* compare against unsigned 12-bit maximum */ - if (!op->e.sym) { - if ((int) op->e.v >= -0x1000 && (int) op->e.v < 0x1000) - op->type = OP_IM12S; - } else if (op->e.sym->type.t & (VT_EXTERN | VT_STATIC)) { - label.type.t = VT_VOID | VT_STATIC; - - /* use the medium PIC model: GOT, auipc, lw */ - if (op->e.sym->type.t & VT_STATIC) - greloca(cur_text_section, op->e.sym, ind, R_RISCV_PCREL_HI20, 0); - else - greloca(cur_text_section, op->e.sym, ind, R_RISCV_GOT_HI20, 0); - put_extern_sym(&label, cur_text_section, ind, 0); - greloca(cur_text_section, &label, ind+4, R_RISCV_PCREL_LO12_I, 0); - - op->type = OP_IM12S; - op->e.v = 0; - } else { - expect("operand"); - } -} - -static void parse_branch_offset_operand(TCCState *s1, Operand *op){ - ExprValue e = {0}; - - asm_expr(s1, &e); - op->type = OP_IM32; - op->e = e; - /* compare against unsigned 12-bit maximum */ - if (!op->e.sym) { - if ((int) op->e.v >= -0x1000 && (int) op->e.v < 0x1000) - op->type = OP_IM12S; - } else if (op->e.sym->type.t & (VT_EXTERN | VT_STATIC)) { - greloca(cur_text_section, op->e.sym, ind, R_RISCV_BRANCH, 0); - - /* XXX: Implement far branches */ - - op->type = OP_IM12S; - op->e.v = 0; - } else { - expect("operand"); - } -} - -static void parse_jump_offset_operand(TCCState *s1, Operand *op){ - ExprValue e = {0}; - - asm_expr(s1, &e); - op->type = OP_IM32; - op->e = e; - /* compare against unsigned 12-bit maximum */ - if (!op->e.sym) { - if ((int) op->e.v >= -0x1000 && (int) op->e.v < 0x1000) - op->type = OP_IM12S; - } else if (op->e.sym->type.t & (VT_EXTERN | VT_STATIC)) { - greloca(cur_text_section, op->e.sym, ind, R_RISCV_JAL, 0); - op->type = OP_IM12S; - op->e.v = 0; - } else { - expect("operand"); - } -} - -static void parse_operands(TCCState *s1, Operand* ops, int count){ - int i; - for (i = 0; i < count; i++) { - if ( i != 0 ) - skip(','); - parse_operand(s1, &ops[i]); - } -} - -/* parse `X, imm(Y)` to {X, Y, imm} operands */ -static void parse_mem_access_operands(TCCState *s1, Operand* ops){ - - Operand op; - - parse_operand(s1, &ops[0]); - skip(','); - if ( tok == '(') { - /* `X, (Y)` case*/ - next(); - parse_operand(s1, &ops[1]); - skip(')'); - ops[2] = zimm; - } else { - parse_operand(s1, &ops[2]); - if ( tok == '('){ - /* `X, imm(Y)` case*/ - next(); - parse_operand(s1, &ops[1]); - skip(')'); - } else { - /* `X, Y` case*/ - /* we parsed Y thinking it was imm, swap and default imm to zero */ - op = ops[2]; - ops[1] = ops[2]; - ops[2] = op; - ops[2] = zimm; - } - } -} - -/* This is special: First operand is optional */ -static void asm_jal_opcode(TCCState *s1, int token){ - Operand ops[2]; - - if (token == TOK_ASM_j ){ - ops[0] = zero; // j offset - } else if (asm_parse_regvar(tok) == -1) { - ops[0] = ra; // jal offset - } else { - // jal reg, offset - parse_operand(s1, &ops[0]); - if ( tok == ',') next(); else expect("','"); - } - parse_jump_offset_operand(s1, &ops[1]); - asm_emit_j(token, 0x6f, &ops[0], &ops[1]); -} - -/* This is special: It can be a pseudointruction or a instruction */ -static void asm_jalr_opcode(TCCState *s1, int token){ - Operand ops[3]; - Operand op; - - parse_operand(s1, &ops[0]); - if ( tok == ',') - next(); - else { - /* no more operands, it's the pseudoinstruction: - * jalr rs - * Expand to: - * jalr ra, 0(rs) - */ - asm_emit_i(token, 0x67 | (0 << 12), &ra, &ops[0], &zimm); - return; - } - - if ( tok == '(') { - /* `X, (Y)` case*/ - next(); - parse_operand(s1, &ops[1]); - skip(')'); - ops[2] = zimm; - } else { - parse_operand(s1, &ops[2]); - if ( tok == '('){ - /* `X, imm(Y)` case*/ - next(); - parse_operand(s1, &ops[1]); - skip(')'); - } else { - /* `X, Y` case*/ - /* we parsed Y thinking it was imm, swap and default imm to zero */ - op = ops[2]; - ops[1] = ops[2]; - ops[2] = op; - ops[2] = zimm; - } - } - /* jalr(RD, RS1, IMM); I-format */ - asm_emit_i(token, 0x67 | (0 << 12), &ops[0], &ops[1], &ops[2]); -} - - -static void asm_unary_opcode(TCCState *s1, int token) -{ - uint32_t opcode = (0x1C << 2) | 3 | (2 << 12); - Operand op; - - parse_operands(s1, &op, 1); - /* Note: Those all map to CSR--so they are pseudo-instructions. */ - opcode |= ENCODE_RD(op.reg); - - switch (token) { - /* pseudoinstructions */ - case TOK_ASM_rdcycle: - asm_emit_opcode(opcode | (0xC00 << 20)); - return; - case TOK_ASM_rdcycleh: - asm_emit_opcode(opcode | (0xC80 << 20)); - return; - case TOK_ASM_rdtime: - asm_emit_opcode(opcode | (0xC01 << 20) | ENCODE_RD(op.reg)); - return; - case TOK_ASM_rdtimeh: - asm_emit_opcode(opcode | (0xC81 << 20) | ENCODE_RD(op.reg)); - return; - case TOK_ASM_rdinstret: - asm_emit_opcode(opcode | (0xC02 << 20) | ENCODE_RD(op.reg)); - return; - case TOK_ASM_rdinstreth: - asm_emit_opcode(opcode | (0xC82 << 20) | ENCODE_RD(op.reg)); - return; - - case TOK_ASM_jr: - /* jalr zero, 0(rs)*/ - asm_emit_i(token, 0x67 | (0 << 12), &zero, &op, &zimm); - return; - case TOK_ASM_call: - /* auipc ra, 0 */ - greloca(cur_text_section, op.e.sym, ind, R_RISCV_CALL, 0); - asm_emit_opcode(3 | (5 << 2) | ENCODE_RD(1)); - /* jalr zero, 0(ra) */ - asm_emit_opcode(0x67 | (0 << 12) | ENCODE_RS1(1)); - return; - case TOK_ASM_tail: - /* auipc x6, 0 */ - greloca(cur_text_section, op.e.sym, ind, R_RISCV_CALL, 0); - asm_emit_opcode(3 | (5 << 2) | ENCODE_RD(6)); - /* jalr zero, 0(x6) */ - asm_emit_opcode(0x67 | (0 << 12) | ENCODE_RS1(6)); - return; - - /* C extension */ - case TOK_ASM_c_j: - asm_emit_cj(token, 1 | (5 << 13), &op); - return; - case TOK_ASM_c_jal: /* RV32C-only */ - asm_emit_cj(token, 1 | (1 << 13), &op); - return; - case TOK_ASM_c_jalr: - asm_emit_cr(token, 2 | (9 << 12), &op, &zero); - return; - case TOK_ASM_c_jr: - asm_emit_cr(token, 2 | (8 << 12), &op, &zero); - return; - default: - expect("unary instruction"); - } -} - -static void asm_emit_u(int token, uint32_t opcode, const Operand* rd, const Operand* rs2) -{ - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - if (rs2->type != OP_IM12S && rs2->type != OP_IM32) { - tcc_error("'%s': Expected second source operand that is an immediate value", get_tok_str(token, NULL)); - } else if (rs2->e.v >= 0x100000) { - tcc_error("'%s': Expected second source operand that is an immediate value between 0 and 0xfffff", get_tok_str(token, NULL)); - } - /* U-type instruction: - 31...12 imm[31:12] - 11...7 rd - 6...0 opcode */ - gen_le32(opcode | ENCODE_RD(rd->reg) | (rs2->e.v << 12)); -} - -static int parse_fence_operand(){ - int t = tok; - if ( tok == TOK_ASM_or ){ - // we are in a fence instruction, parse as output read - t = TOK_ASM_or_fence; - } - next(); - return t - (TOK_ASM_w_fence - 1); -} - -static void asm_fence_opcode(TCCState *s1, int token){ - // `fence` is both an instruction and a pseudoinstruction: - // `fence` expands to `fence iorw, iorw` - int succ = 0xF, pred = 0xF; - if (tok != TOK_LINEFEED && tok != ';' && tok != CH_EOF){ - pred = parse_fence_operand(); - if ( pred > 0xF || pred < 0) { - tcc_error("'%s': Expected first operand that is a valid predecessor operand", get_tok_str(token, NULL)); - } - skip(','); - succ = parse_fence_operand(); - if ( succ > 0xF || succ < 0) { - tcc_error("'%s': Expected second operand that is a valid successor operand", get_tok_str(token, NULL)); - } - } - asm_emit_opcode((0x3 << 2) | 3 | (0 << 12) | succ<<20 | pred<<24); -} - -static void asm_binary_opcode(TCCState* s1, int token) -{ - Operand imm = { OP_IM12S }; - Operand ops[2]; - int32_t lo; - uint32_t hi; - - parse_operands(s1, &ops[0], 2); - switch (token) { - case TOK_ASM_lui: - asm_emit_u(token, (0xD << 2) | 3, &ops[0], &ops[1]); - return; - case TOK_ASM_auipc: - asm_emit_u(token, (0x05 << 2) | 3, &ops[0], &ops[1]); - return; - - /* C extension */ - case TOK_ASM_c_add: - asm_emit_cr(token, 2 | (9 << 12), ops, ops + 1); - return; - case TOK_ASM_c_mv: - asm_emit_cr(token, 2 | (8 << 12), ops, ops + 1); - return; - - case TOK_ASM_c_addi16sp: - asm_emit_ci(token, 1 | (3 << 13), ops, ops + 1); - return; - case TOK_ASM_c_addi: - asm_emit_ci(token, 1, ops, ops + 1); - return; - case TOK_ASM_c_addiw: - asm_emit_ci(token, 1 | (1 << 13), ops, ops + 1); - return; - case TOK_ASM_c_fldsp: - asm_emit_ci(token, 2 | (1 << 13), ops, ops + 1); - return; - case TOK_ASM_c_flwsp: /* RV32FC-only */ - asm_emit_ci(token, 2 | (3 << 13), ops, ops + 1); - return; - case TOK_ASM_c_ldsp: - asm_emit_ci(token, 2 | (3 << 13), ops, ops + 1); - return; - case TOK_ASM_c_li: - asm_emit_ci(token, 1 | (2 << 13), ops, ops + 1); - return; - case TOK_ASM_c_lui: - asm_emit_ci(token, 1 | (3 << 13), ops, ops + 1); - return; - case TOK_ASM_c_lwsp: - asm_emit_ci(token, 2 | (2 << 13), ops, ops + 1); - return; - case TOK_ASM_c_slli: - asm_emit_ci(token, 2, ops, ops + 1); - return; - - case TOK_ASM_c_addi4spn: - asm_emit_ciw(token, 0, ops, ops + 1); - return; - -#define CA (1 | (3 << 10) | (4 << 13)) - case TOK_ASM_c_addw: - asm_emit_ca(token, CA | (1 << 5) | (1 << 12), ops, ops + 1); - return; - case TOK_ASM_c_and: - asm_emit_ca(token, CA | (3 << 5), ops, ops + 1); - return; - case TOK_ASM_c_or: - asm_emit_ca(token, CA | (2 << 5), ops, ops + 1); - return; - case TOK_ASM_c_sub: - asm_emit_ca(token, CA, ops, ops + 1); - return; - case TOK_ASM_c_subw: - asm_emit_ca(token, CA | (1 << 12), ops, ops + 1); - return; - case TOK_ASM_c_xor: - asm_emit_ca(token, CA | (1 << 5), ops, ops + 1); - return; -#undef CA - - case TOK_ASM_c_andi: - asm_emit_cb(token, 1 | (2 << 10) | (4 << 13), ops, ops + 1); - return; - case TOK_ASM_c_beqz: - asm_emit_cb(token, 1 | (6 << 13), ops, ops + 1); - return; - case TOK_ASM_c_bnez: - asm_emit_cb(token, 1 | (7 << 13), ops, ops + 1); - return; - case TOK_ASM_c_srai: - asm_emit_cb(token, 1 | (1 << 10) | (4 << 13), ops, ops + 1); - return; - case TOK_ASM_c_srli: - asm_emit_cb(token, 1 | (4 << 13), ops, ops + 1); - return; - - case TOK_ASM_c_sdsp: - asm_emit_css(token, 2 | (7 << 13), ops, ops + 1); - return; - case TOK_ASM_c_swsp: - asm_emit_css(token, 2 | (6 << 13), ops, ops + 1); - return; - case TOK_ASM_c_fswsp: /* RV32FC-only */ - asm_emit_css(token, 2 | (7 << 13), ops, ops + 1); - return; - case TOK_ASM_c_fsdsp: - asm_emit_css(token, 2 | (5 << 13), ops, ops + 1); - return; - - /* pseudoinstructions */ - /* rd, sym */ - case TOK_ASM_la: - /* auipc rd, 0 */ - asm_emit_u(token, 3 | (5 << 2), ops, ops + 1); - /* lw rd, rd, 0 */ - asm_emit_i(token, 3 | (2 << 12), ops, ops, ops + 1); - return; - case TOK_ASM_lla: - /* auipc rd, 0 */ - asm_emit_u(token, 3 | (5 << 2), ops, ops + 1); - /* addi rd, rd, 0 */ - asm_emit_i(token, 3 | (4 << 2), ops, ops, ops + 1); - return; - case TOK_ASM_li: - if(ops[1].type != OP_IM32 && ops[1].type != OP_IM12S){ - tcc_error("'%s': Expected first source operand that is an immediate value between 0 and 0xFFFFFFFFFFFFFFFF", get_tok_str(token, NULL)); - } - lo = ops[1].e.v; - hi = (int64_t)ops[1].e.v >> 32; - if(lo < 0){ - hi += 1; - } - imm.e.v = ((hi + 0x800) & 0xfffff000) >> 12; - /* lui rd, HI_20(HI_32(imm)) */ - asm_emit_u(token, (0xD << 2) | 3, &ops[0], &imm); - /* addi rd, rd, LO_12(HI_32(imm)) */ - imm.e.v = (int32_t)hi<<20>>20; - asm_emit_i(token, 3 | (4 << 2), &ops[0], &ops[0], &imm); - /* slli rd, rd, 12 */ - imm.e.v = 12; - asm_emit_i(token, (4 << 2) | 3 | (1 << 12), &ops[0], &ops[0], &imm); - /* addi rd, rd, HI_12(LO_32(imm)) */ - imm.e.v = (lo + (1<<19)) >> 20; - asm_emit_i(token, 3 | (4 << 2), &ops[0], &ops[0], &imm); - /* slli rd, rd, 12 */ - imm.e.v = 12; - asm_emit_i(token, (4 << 2) | 3 | (1 << 12), &ops[0], &ops[0], &imm); - /* addi rd, rd, HI_12(LO_20(LO_32imm)) */ - lo = lo << 12 >> 12; - imm.e.v = lo >> 8; - asm_emit_i(token, 3 | (4 << 2), &ops[0], &ops[0], &imm); - /* slli rd, rd, 8 */ - imm.e.v = 8; - asm_emit_i(token, (4 << 2) | 3 | (1 << 12), &ops[0], &ops[0], &imm); - /* addi rd, rd, LO_8(LO_20(LO_32imm)) */ - lo &= 0xff; - imm.e.v = lo << 20 >> 20; - asm_emit_i(token, 3 | (4 << 2), &ops[0], &ops[0], &imm); - return; - case TOK_ASM_mv: - /* addi rd, rs, 0 */ - asm_emit_i(token, 3 | (4 << 2), &ops[0], &ops[1], &imm); - return; - case TOK_ASM_not: - /* xori rd, rs, -1 */ - imm.e.v = -1; - asm_emit_i(token, (0x4 << 2) | 3 | (4 << 12), &ops[0], &ops[1], &imm); - return; - case TOK_ASM_neg: - /* sub rd, x0, rs */ - imm.e.v = 1; - asm_emit_i(token, (0x4 << 2) | 3 | (4 << 12), &ops[0], &zero, &imm); - return; - case TOK_ASM_negw: - /* sub rd, x0, rs */ - imm.e.v = 1; - asm_emit_i(token, (0x4 << 2) | 3 | (4 << 12), &ops[0], &zero, &imm); - return; - case TOK_ASM_jump: - /* auipc x5, 0 */ - asm_emit_opcode(3 | (5 << 2) | ENCODE_RD(5)); - greloca(cur_text_section, ops->e.sym, ind, R_RISCV_CALL, 0); - /* jalr zero, 0(x5) */ - asm_emit_opcode(0x67 | (0 << 12) | ENCODE_RS1(5)); - return; - case TOK_ASM_seqz: - /* sltiu rd, rs, 1 */ - imm.e.v = 1; - asm_emit_i(token, (0x4 << 2) | 3 | (3 << 12), &ops[0], &ops[1], &imm); - return; - case TOK_ASM_snez: - /* sltu rd, zero, rs */ - imm.e.v = 1; - asm_emit_r(token, (0xC << 2) | 3 | (3 << 12), &ops[0], &zero, &ops[1]); - return; - case TOK_ASM_sltz: - /* slt rd, rs, zero */ - asm_emit_r(token, (0xC << 2) | 3 | (2 << 12), &ops[0], &ops[1], &zero); - return; - case TOK_ASM_sgtz: - /* slt rd, zero, rs */ - asm_emit_r(token, (0xC << 2) | 3 | (2 << 12), &ops[0], &zero, &ops[1]); - return; - - default: - expect("binary instruction"); - } -} - -/* caller: Add funct3, funct7 into opcode */ -static void asm_emit_r(int token, uint32_t opcode, const Operand* rd, const Operand* rs1, const Operand* rs2) -{ - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - if (rs1->type != OP_REG) { - tcc_error("'%s': Expected first source operand that is a register", get_tok_str(token, NULL)); - } - if (rs2->type != OP_REG) { - tcc_error("'%s': Expected second source operand that is a register or immediate", get_tok_str(token, NULL)); - } - /* R-type instruction: - 31...25 funct7 - 24...20 rs2 - 19...15 rs1 - 14...12 funct3 - 11...7 rd - 6...0 opcode */ - gen_le32(opcode | ENCODE_RD(rd->reg) | ENCODE_RS1(rs1->reg) | ENCODE_RS2(rs2->reg)); -} - -/* caller: Add funct3 into opcode */ -static void asm_emit_i(int token, uint32_t opcode, const Operand* rd, const Operand* rs1, const Operand* rs2) -{ - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - if (rs1->type != OP_REG) { - tcc_error("'%s': Expected first source operand that is a register", get_tok_str(token, NULL)); - } - if (rs2->type != OP_IM12S) { - tcc_error("'%s': Expected second source operand that is an immediate value between 0 and 8191", get_tok_str(token, NULL)); - } - /* I-type instruction: - 31...20 imm[11:0] - 19...15 rs1 - 14...12 funct3 - 11...7 rd - 6...0 opcode */ - - gen_le32(opcode | ENCODE_RD(rd->reg) | ENCODE_RS1(rs1->reg) | (rs2->e.v << 20)); -} - -static void asm_emit_j(int token, uint32_t opcode, const Operand* rd, const Operand* rs2) -{ - uint32_t imm; - - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - if (rs2->type != OP_IM12S && rs2->type != OP_IM32) { - tcc_error("'%s': Expected second source operand that is an immediate value", get_tok_str(token, NULL)); - } - - imm = rs2->e.v; - - /* even offsets in a +- 1 MiB range */ - if ((int)imm > (1 << 20) -1 || (int)imm <= -1 * ((1 << 20) -1)) { - tcc_error("'%s': Expected second source operand that is an immediate value between 0 and 0x1fffff", get_tok_str(token, NULL)); - } - - if (imm & 1) { - tcc_error("'%s': Expected second source operand that is an even immediate value", get_tok_str(token, NULL)); - } - /* J-type instruction: - 31 imm[20] - 30...21 imm[10:1] - 20 imm[11] - 19...12 imm[19:12] - 11...7 rd - 6...0 opcode */ - gen_le32(opcode | ENCODE_RD(rd->reg) | (((imm >> 20) & 1) << 31) | (((imm >> 1) & 0x3ff) << 21) | (((imm >> 11) & 1) << 20) | (((imm >> 12) & 0xff) << 12)); -} - -static void asm_mem_access_opcode(TCCState *s1, int token) -{ - - Operand ops[3]; - parse_mem_access_operands(s1, &ops[0]); - - /* Pseudoinstruction: inst reg, label - * expand to: - * auipc reg, 0 - * inst reg, 0(reg) - * And with the proper relocation to label - */ - if (ops[1].type == OP_IM32 && ops[1].e.sym && ops[1].e.sym->type.t & VT_STATIC){ - ops[1] = ops[0]; - /* set the offset to zero */ - ops[2].type = OP_IM12S; - ops[2].e.v = 0; - /* auipc reg, 0 */ - asm_emit_u(token, (0x05 << 2) | 3, &ops[0], &ops[2]); - } - - switch (token) { - // l{b|h|w|d}[u] rd, imm(rs1); I-format - case TOK_ASM_lb: - asm_emit_i(token, (0x0 << 2) | 3, &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_lh: - asm_emit_i(token, (0x0 << 2) | 3 | (1 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_lw: - asm_emit_i(token, (0x0 << 2) | 3 | (2 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_ld: - asm_emit_i(token, (0x0 << 2) | 3 | (3 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_lbu: - asm_emit_i(token, (0x0 << 2) | 3 | (4 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_lhu: - asm_emit_i(token, (0x0 << 2) | 3 | (5 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_lwu: - asm_emit_i(token, (0x0 << 2) | 3 | (6 << 12), &ops[0], &ops[1], &ops[2]); - return; - - // s{b|h|w|d} rs2, imm(rs1); S-format (with rsX swapped) - case TOK_ASM_sb: - asm_emit_s(token, (0x8 << 2) | 3 | (0 << 12), &ops[1], &ops[0], &ops[2]); - return; - case TOK_ASM_sh: - asm_emit_s(token, (0x8 << 2) | 3 | (1 << 12), &ops[1], &ops[0], &ops[2]); - return; - case TOK_ASM_sw: - asm_emit_s(token, (0x8 << 2) | 3 | (2 << 12), &ops[1], &ops[0], &ops[2]); - return; - case TOK_ASM_sd: - asm_emit_s(token, (0x8 << 2) | 3 | (3 << 12), &ops[1], &ops[0], &ops[2]); - return; - } -} - -static void asm_branch_opcode(TCCState *s1, int token, int argc) -{ - Operand ops[3]; - parse_operands(s1, &ops[0], argc-1); - skip(','); - parse_branch_offset_operand(s1, &ops[argc-1]); - - switch(token){ - /* branch (RS1, RS2, IMM); B-format */ - case TOK_ASM_beq: - asm_emit_b(token, 0x63 | (0 << 12), ops, ops + 1, ops + 2); - return; - case TOK_ASM_bne: - asm_emit_b(token, 0x63 | (1 << 12), ops, ops + 1, ops + 2); - return; - case TOK_ASM_blt: - asm_emit_b(token, 0x63 | (4 << 12), ops, ops + 1, ops + 2); - return; - case TOK_ASM_bge: - asm_emit_b(token, 0x63 | (5 << 12), ops, ops + 1, ops + 2); - return; - case TOK_ASM_bltu: - asm_emit_b(token, 0x63 | (6 << 12), ops, ops + 1, ops + 2); - return; - case TOK_ASM_bgeu: - asm_emit_b(token, 0x63 | (7 << 12), ops, ops + 1, ops + 2); - return; - /* related pseudoinstructions */ - case TOK_ASM_bgt: - asm_emit_b(token, 0x63 | (4 << 12), ops + 1, ops, ops + 2); - return; - case TOK_ASM_ble: - asm_emit_b(token, 0x63 | (5 << 12), ops + 1, ops, ops + 2); - return; - case TOK_ASM_bgtu: - asm_emit_b(token, 0x63 | (6 << 12), ops + 1, ops, ops + 2); - return; - case TOK_ASM_bleu: - asm_emit_b(token, 0x63 | (7 << 12), ops + 1, ops, ops + 2); - return; - /* shorter pseudoinstructions */ - case TOK_ASM_bnez: - /* bne rs, zero, offset */ - asm_emit_b(token, 0x63 | (1 << 12), &ops[0], &zero, &ops[1]); - return; - case TOK_ASM_beqz: - /* bne rs, zero, offset */ - asm_emit_b(token, 0x63 | (0 << 12), &ops[0], &zero, &ops[1]); - return; - case TOK_ASM_blez: - /* bge rs, zero, offset */ - asm_emit_b(token, 0x63 | (5 << 12), &ops[0], &zero, &ops[1]); - return; - case TOK_ASM_bgez: - /* bge zero, rs, offset */ - asm_emit_b(token, 0x63 | (5 << 12), &zero, &ops[0], &ops[1]); - return; - case TOK_ASM_bltz: - /* blt rs, zero, offset */ - asm_emit_b(token, 0x63 | (4 << 12), &ops[0], &zero, &ops[1]); - return; - case TOK_ASM_bgtz: - /* blt zero, rs, offset */ - asm_emit_b(token, 0x63 | (4 << 12), &zero, &ops[0], &ops[1]); - return; - } -} - -static void asm_ternary_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - parse_operands(s1, &ops[0], 3); - - switch (token) { - case TOK_ASM_sll: - asm_emit_r(token, (0xC << 2) | 3 | (1 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_slli: - asm_emit_i(token, (4 << 2) | 3 | (1 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_srl: - asm_emit_r(token, (0xC << 2) | 3 | (4 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_srli: - asm_emit_i(token, (0x4 << 2) | 3 | (5 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_sra: - asm_emit_r(token, (0xC << 2) | 3 | (5 << 12) | (32 << 25), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_srai: - asm_emit_i(token, (0x4 << 2) | 3 | (5 << 12) | (16 << 26), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_sllw: - asm_emit_r(token, (0xE << 2) | 3 | (1 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_slliw: - asm_emit_i(token, (6 << 2) | 3 | (1 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_srlw: - asm_emit_r(token, (0xE << 2) | 3 | (5 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_srliw: - asm_emit_i(token, (0x6 << 2) | 3 | (5 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_sraw: - asm_emit_r(token, (0xE << 2) | 3 | (5 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_sraiw: - asm_emit_i(token, (0x6 << 2) | 3 | (5 << 12), &ops[0], &ops[1], &ops[2]); - return; - - // Arithmetic (RD,RS1,(RS2|IMM)); R-format, I-format or U-format - - case TOK_ASM_add: - asm_emit_r(token, (0xC << 2) | 3, &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_addi: - asm_emit_i(token, (4 << 2) | 3, &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_sub: - asm_emit_r(token, (0xC << 2) | 3 | (32 << 25), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_addw: - asm_emit_r(token, (0xE << 2) | 3 | (0 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_addiw: // 64 bit - asm_emit_i(token, (0x6 << 2) | 3 | (0 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_subw: - asm_emit_r(token, (0xE << 2) | 3 | (0 << 12) | (32 << 25), &ops[0], &ops[1], &ops[2]); - return; - - // Logical (RD,RS1,(RS2|IMM)); R-format or I-format - - case TOK_ASM_xor: - asm_emit_r(token, (0xC << 2) | 3 | (4 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_xori: - asm_emit_i(token, (0x4 << 2) | 3 | (4 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_or: - asm_emit_r(token, (0xC << 2) | 3 | (6 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_ori: - asm_emit_i(token, (0x4 << 2) | 3 | (6 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_and: - asm_emit_r(token, (0xC << 2) | 3 | (7 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_andi: - asm_emit_i(token, (0x4 << 2) | 3 | (7 << 12), &ops[0], &ops[1], &ops[2]); - return; - - // Compare (RD,RS1,(RS2|IMM)); R-format or I-format - - case TOK_ASM_slt: - asm_emit_r(token, (0xC << 2) | 3 | (2 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_slti: - asm_emit_i(token, (0x4 << 2) | 3 | (2 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_sltu: - asm_emit_r(token, (0xC << 2) | 3 | (3 << 12), &ops[0], &ops[1], &ops[2]); - return; - case TOK_ASM_sltiu: - asm_emit_i(token, (0x4 << 2) | 3 | (3 << 12), &ops[0], &ops[1], &ops[2]); - return; - - /* M extension */ - case TOK_ASM_div: - asm_emit_r(token, 0x33 | (4 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_divu: - asm_emit_r(token, 0x33 | (5 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_divuw: - asm_emit_r(token, 0x3b | (5 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_divw: - asm_emit_r(token, 0x3b | (4 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_mul: - asm_emit_r(token, 0x33 | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_mulh: - asm_emit_r(token, 0x33 | (1 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_mulhsu: - asm_emit_r(token, 0x33 | (2 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_mulhu: - asm_emit_r(token, 0x33 | (3 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_mulw: - asm_emit_r(token, 0x3b | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_rem: - asm_emit_r(token, 0x33 | (6 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_remu: - asm_emit_r(token, 0x33 | (7 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_remuw: - asm_emit_r(token, 0x3b | (7 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - case TOK_ASM_remw: - asm_emit_r(token, 0x3b | (6 << 12) | (1 << 25), ops, ops + 1, ops + 2); - return; - - /* Zicsr extension; (rd, csr, rs/uimm) */ - case TOK_ASM_csrrc: - asm_emit_i(token, 0x73 | (3 << 12), ops, ops + 2, ops + 1); - return; - case TOK_ASM_csrrci: - /* using rs1 field for uimmm */ - ops[2].type = OP_REG; - asm_emit_i(token, 0x73 | (7 << 12), ops, ops + 2, ops + 1); - return; - case TOK_ASM_csrrs: - asm_emit_i(token, 0x73 | (2 << 12), ops, ops + 2, ops + 1); - return; - case TOK_ASM_csrrsi: - ops[2].type = OP_REG; - asm_emit_i(token, 0x73 | (6 << 12), ops, ops + 2, ops + 1); - return; - case TOK_ASM_csrrw: - asm_emit_i(token, 0x73 | (1 << 12), ops, ops + 2, ops + 1); - return; - case TOK_ASM_csrrwi: - ops[2].type = OP_REG; - asm_emit_i(token, 0x73 | (5 << 12), ops, ops + 2, ops + 1); - return; - - /* C extension */ - /* register-based loads and stores (RD, RS1, IMM); CL-format */ - case TOK_ASM_c_fld: - asm_emit_cl(token, 1 << 13, ops, ops + 1, ops + 2); - return; - case TOK_ASM_c_flw: /* RV32FC-only */ - asm_emit_cl(token, 3 << 13, ops, ops + 1, ops + 2); - return; - case TOK_ASM_c_fsd: - asm_emit_cs(token, 5 << 13, ops, ops + 1, ops + 2); - return; - case TOK_ASM_c_fsw: /* RV32FC-only */ - asm_emit_cs(token, 7 << 13, ops, ops + 1, ops + 2); - return; - case TOK_ASM_c_ld: - asm_emit_cl(token, 3 << 13, ops, ops + 1, ops + 2); - return; - case TOK_ASM_c_lw: - asm_emit_cl(token, 2 << 13, ops, ops + 1, ops + 2); - return; - case TOK_ASM_c_sd: - asm_emit_cs(token, 7 << 13, ops, ops + 1, ops + 2); - return; - case TOK_ASM_c_sw: - asm_emit_cs(token, 6 << 13, ops, ops + 1, ops + 2); - return; - - default: - expect("ternary instruction"); - } -} - -static void asm_atomic_opcode(TCCState *s1, int token) -{ - Operand ops[3]; - - parse_operand(s1, &ops[0]); - skip(','); - - if ( token <= TOK_ASM_lr_d_aqrl && token >= TOK_ASM_lr_w ) { - ops[1] = zero; - } else { - parse_operand(s1, &ops[1]); - skip(','); - } - - skip('('); - parse_operand(s1, &ops[2]); - skip(')'); - - switch(token){ - case TOK_ASM_lr_w: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 0, 0); - break; - case TOK_ASM_lr_w_aq: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 1, 0); - break; - case TOK_ASM_lr_w_rl: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 0, 1); - break; - case TOK_ASM_lr_w_aqrl: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 1, 1); - break; - - case TOK_ASM_lr_d: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 0, 0); - break; - case TOK_ASM_lr_d_aq: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 1, 0); - break; - case TOK_ASM_lr_d_rl: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 0, 1); - break; - case TOK_ASM_lr_d_aqrl: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x2<<27, &ops[0], &ops[1], &ops[2], 1, 1); - break; - - case TOK_ASM_sc_w: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 0, 0); - break; - case TOK_ASM_sc_w_aq: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 1, 0); - break; - case TOK_ASM_sc_w_rl: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 0, 1); - break; - case TOK_ASM_sc_w_aqrl: - asm_emit_a(token, 0x2F | 0x2<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 1, 1); - break; - - case TOK_ASM_sc_d: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 0, 0); - break; - case TOK_ASM_sc_d_aq: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 1, 0); - break; - case TOK_ASM_sc_d_rl: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 0, 1); - break; - case TOK_ASM_sc_d_aqrl: - asm_emit_a(token, 0x2F | 0x3<<12 | 0x3<<27, &ops[0], &ops[1], &ops[2], 1, 1); - break; - } -} - -/* caller: Add funct3 and func5 to opcode */ -static void asm_emit_a(int token, uint32_t opcode, const Operand *rd1, const Operand *rs2, const Operand *rs1, int aq, int rl) -{ - if (rd1->type != OP_REG) - tcc_error("'%s': Expected first destination operand that is a register", get_tok_str(token, NULL)); - if (rs2->type != OP_REG) - tcc_error("'%s': Expected second source operand that is a register", get_tok_str(token, NULL)); - if (rs1->type != OP_REG) - tcc_error("'%s': Expected third source operand that is a register", get_tok_str(token, NULL)); - /* A-type instruction: - 31...27 funct5 - 26 aq - 25 rl - 24...20 rs2 - 19...15 rs1 - 14...11 funct3 - 11...7 rd - 6...0 opcode - opcode always fixed pos. */ - gen_le32(opcode | ENCODE_RS1(rs1->reg) | ENCODE_RS2(rs2->reg) | ENCODE_RD(rd1->reg) | aq << 26 | rl << 25); -} - -/* caller: Add funct3 to opcode */ -static void asm_emit_s(int token, uint32_t opcode, const Operand* rs1, const Operand* rs2, const Operand* imm) -{ - if (rs1->type != OP_REG) { - tcc_error("'%s': Expected first source operand that is a register", get_tok_str(token, NULL)); - } - if (rs2->type != OP_REG) { - tcc_error("'%s': Expected second source operand that is a register", get_tok_str(token, NULL)); - } - if (imm->type != OP_IM12S) { - tcc_error("'%s': Expected third operand that is an immediate value between 0 and 8191", get_tok_str(token, NULL)); - } - { - uint16_t v = imm->e.v; - /* S-type instruction: - 31...25 imm[11:5] - 24...20 rs2 - 19...15 rs1 - 14...12 funct3 - 11...7 imm[4:0] - 6...0 opcode - opcode always fixed pos. */ - gen_le32(opcode | ENCODE_RS1(rs1->reg) | ENCODE_RS2(rs2->reg) | ((v & 0x1F) << 7) | ((v >> 5) << 25)); - } -} - -static void asm_emit_b(int token, uint32_t opcode, const Operand *rs1, const Operand *rs2, const Operand *imm) -{ - uint32_t offset; - - if (rs1->type != OP_REG) { - tcc_error("'%s': Expected first source operand that is a register", get_tok_str(token, NULL)); - } - if (rs2->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - if (imm->type != OP_IM12S) { - tcc_error("'%s': Expected second source operand that is an immediate value between 0 and 8191", get_tok_str(token, NULL)); - } - - offset = imm->e.v; - - /* B-type instruction: - 31 imm[12] - 30...25 imm[10:5] - 24...20 rs2 - 19...15 rs1 - 14...12 funct3 - 8...11 imm[4:1] - 7 imm[11] - 6...0 opcode */ - asm_emit_opcode(opcode | ENCODE_RS1(rs1->reg) | ENCODE_RS2(rs2->reg) | (((offset >> 1) & 0xF) << 8) | (((offset >> 5) & 0x1f) << 25) | (((offset >> 11) & 1) << 7) | (((offset >> 12) & 1) << 31)); -} - -ST_FUNC void asm_opcode(TCCState *s1, int token) -{ - switch (token) { - case TOK_ASM_ebreak: - case TOK_ASM_ecall: - case TOK_ASM_fence_i: - case TOK_ASM_hrts: - case TOK_ASM_mrth: - case TOK_ASM_mrts: - case TOK_ASM_wfi: - asm_nullary_opcode(s1, token); - return; - - case TOK_ASM_fence: - asm_fence_opcode(s1, token); - return; - - case TOK_ASM_rdcycle: - case TOK_ASM_rdcycleh: - case TOK_ASM_rdtime: - case TOK_ASM_rdtimeh: - case TOK_ASM_rdinstret: - case TOK_ASM_rdinstreth: - asm_unary_opcode(s1, token); - return; - - case TOK_ASM_lui: - case TOK_ASM_auipc: - asm_binary_opcode(s1, token); - return; - - case TOK_ASM_lb: - case TOK_ASM_lh: - case TOK_ASM_lw: - case TOK_ASM_ld: - case TOK_ASM_lbu: - case TOK_ASM_lhu: - case TOK_ASM_lwu: - case TOK_ASM_sb: - case TOK_ASM_sh: - case TOK_ASM_sw: - case TOK_ASM_sd: - asm_mem_access_opcode(s1, token); - break; - - case TOK_ASM_jalr: - asm_jalr_opcode(s1, token); /* it can be a pseudo instruction too*/ - break; - case TOK_ASM_j: - asm_jal_opcode(s1, token); /* jal zero, offset*/ - return; - case TOK_ASM_jal: - asm_jal_opcode(s1, token); /* it can be a pseudo instruction too*/ - break; - - case TOK_ASM_add: - case TOK_ASM_addi: - case TOK_ASM_addiw: - case TOK_ASM_addw: - case TOK_ASM_and: - case TOK_ASM_andi: - case TOK_ASM_or: - case TOK_ASM_ori: - case TOK_ASM_sll: - case TOK_ASM_slli: - case TOK_ASM_slliw: - case TOK_ASM_sllw: - case TOK_ASM_slt: - case TOK_ASM_slti: - case TOK_ASM_sltiu: - case TOK_ASM_sltu: - case TOK_ASM_sra: - case TOK_ASM_srai: - case TOK_ASM_sraiw: - case TOK_ASM_sraw: - case TOK_ASM_srl: - case TOK_ASM_srli: - case TOK_ASM_srliw: - case TOK_ASM_srlw: - case TOK_ASM_sub: - case TOK_ASM_subw: - case TOK_ASM_xor: - case TOK_ASM_xori: - /* M extension */ - case TOK_ASM_div: - case TOK_ASM_divu: - case TOK_ASM_divuw: - case TOK_ASM_divw: - case TOK_ASM_mul: - case TOK_ASM_mulh: - case TOK_ASM_mulhsu: - case TOK_ASM_mulhu: - case TOK_ASM_mulw: - case TOK_ASM_rem: - case TOK_ASM_remu: - case TOK_ASM_remuw: - case TOK_ASM_remw: - /* Zicsr extension */ - case TOK_ASM_csrrc: - case TOK_ASM_csrrci: - case TOK_ASM_csrrs: - case TOK_ASM_csrrsi: - case TOK_ASM_csrrw: - case TOK_ASM_csrrwi: - asm_ternary_opcode(s1, token); - return; - - /* Branches */ - case TOK_ASM_beq: - case TOK_ASM_bge: - case TOK_ASM_bgeu: - case TOK_ASM_blt: - case TOK_ASM_bltu: - case TOK_ASM_bne: - asm_branch_opcode(s1, token, 3); - break; - - /* C extension */ - case TOK_ASM_c_ebreak: - case TOK_ASM_c_nop: - asm_nullary_opcode(s1, token); - return; - - case TOK_ASM_c_j: - case TOK_ASM_c_jal: - case TOK_ASM_c_jalr: - case TOK_ASM_c_jr: - asm_unary_opcode(s1, token); - return; - - case TOK_ASM_c_add: - case TOK_ASM_c_addi16sp: - case TOK_ASM_c_addi4spn: - case TOK_ASM_c_addi: - case TOK_ASM_c_addiw: - case TOK_ASM_c_addw: - case TOK_ASM_c_and: - case TOK_ASM_c_andi: - case TOK_ASM_c_beqz: - case TOK_ASM_c_bnez: - case TOK_ASM_c_fldsp: - case TOK_ASM_c_flwsp: - case TOK_ASM_c_fsdsp: - case TOK_ASM_c_fswsp: - case TOK_ASM_c_ldsp: - case TOK_ASM_c_li: - case TOK_ASM_c_lui: - case TOK_ASM_c_lwsp: - case TOK_ASM_c_mv: - case TOK_ASM_c_or: - case TOK_ASM_c_sdsp: - case TOK_ASM_c_slli: - case TOK_ASM_c_srai: - case TOK_ASM_c_srli: - case TOK_ASM_c_sub: - case TOK_ASM_c_subw: - case TOK_ASM_c_swsp: - case TOK_ASM_c_xor: - asm_binary_opcode(s1, token); - return; - - case TOK_ASM_c_fld: - case TOK_ASM_c_flw: - case TOK_ASM_c_fsd: - case TOK_ASM_c_fsw: - case TOK_ASM_c_ld: - case TOK_ASM_c_lw: - case TOK_ASM_c_sd: - case TOK_ASM_c_sw: - asm_ternary_opcode(s1, token); - return; - - /* pseudoinstructions */ - case TOK_ASM_nop: - case TOK_ASM_ret: - asm_nullary_opcode(s1, token); - return; - - case TOK_ASM_jr: - case TOK_ASM_call: - case TOK_ASM_tail: - asm_unary_opcode(s1, token); - return; - - case TOK_ASM_la: - case TOK_ASM_lla: - case TOK_ASM_li: - case TOK_ASM_jump: - case TOK_ASM_seqz: - case TOK_ASM_snez: - case TOK_ASM_sltz: - case TOK_ASM_sgtz: - case TOK_ASM_mv: - case TOK_ASM_not: - case TOK_ASM_neg: - case TOK_ASM_negw: - asm_binary_opcode(s1, token); - return; - - case TOK_ASM_bnez: - case TOK_ASM_beqz: - case TOK_ASM_blez: - case TOK_ASM_bgez: - case TOK_ASM_bltz: - case TOK_ASM_bgtz: - asm_branch_opcode(s1, token, 2); - return; - - case TOK_ASM_bgt: - case TOK_ASM_bgtu: - case TOK_ASM_ble: - case TOK_ASM_bleu: - asm_branch_opcode(s1, token, 3); - return; - - /* Atomic operations */ - case TOK_ASM_lr_w: - case TOK_ASM_lr_w_aq: - case TOK_ASM_lr_w_rl: - case TOK_ASM_lr_w_aqrl: - case TOK_ASM_lr_d: - case TOK_ASM_lr_d_aq: - case TOK_ASM_lr_d_rl: - case TOK_ASM_lr_d_aqrl: - case TOK_ASM_sc_w: - case TOK_ASM_sc_w_aq: - case TOK_ASM_sc_w_rl: - case TOK_ASM_sc_w_aqrl: - case TOK_ASM_sc_d: - case TOK_ASM_sc_d_aq: - case TOK_ASM_sc_d_rl: - case TOK_ASM_sc_d_aqrl: - asm_atomic_opcode(s1, token); - break; - - default: - expect("known instruction"); - } -} - -static int asm_parse_csrvar(int t) -{ - switch (t) { - case TOK_ASM_cycle: - return 0xc00; - case TOK_ASM_fcsr: - return 3; - case TOK_ASM_fflags: - return 1; - case TOK_ASM_frm: - return 2; - case TOK_ASM_instret: - return 0xc02; - case TOK_ASM_time: - return 0xc01; - case TOK_ASM_cycleh: - return 0xc80; - case TOK_ASM_instreth: - return 0xc82; - case TOK_ASM_timeh: - return 0xc81; - default: - return -1; - } -} - -ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier) -{ - int r, reg, val; - - r = sv->r; - if ((r & VT_VALMASK) == VT_CONST) { - if (!(r & VT_LVAL) && modifier != 'c' && modifier != 'n' && - modifier != 'P') { - //cstr_ccat(add_str, '#'); - } - if (r & VT_SYM) { - const char *name = get_tok_str(sv->sym->v, NULL); - if (sv->sym->v >= SYM_FIRST_ANOM) { - /* In case of anonymous symbols ("L.42", used - for static data labels) we can't find them - in the C symbol table when later looking up - this name. So enter them now into the asm label - list when we still know the symbol. */ - get_asm_sym(tok_alloc(name, strlen(name))->tok, sv->sym); - } - if (tcc_state->leading_underscore) - cstr_ccat(add_str, '_'); - cstr_cat(add_str, name, -1); - if ((uint32_t) sv->c.i == 0) - goto no_offset; - cstr_ccat(add_str, '+'); - } - val = sv->c.i; - if (modifier == 'n') - val = -val; - if (modifier == 'z' && sv->c.i == 0) { - cstr_cat(add_str, "zero", -1); - } else { - cstr_printf(add_str, "%d", (int) sv->c.i); - } - no_offset:; - } else if ((r & VT_VALMASK) == VT_LOCAL) { - cstr_printf(add_str, "%d", (int) sv->c.i); - } else if (r & VT_LVAL) { - reg = r & VT_VALMASK; - if (reg >= VT_CONST) - tcc_internal_error(""); - if ((sv->type.t & VT_BTYPE) == VT_FLOAT || - (sv->type.t & VT_BTYPE) == VT_DOUBLE) { - /* floating point register */ - reg = TOK_ASM_f0 + reg; - } else { - /* general purpose register */ - reg = TOK_ASM_x0 + reg; - } - cstr_cat(add_str, get_tok_str(reg, NULL), -1); - } else { - /* register case */ - reg = r & VT_VALMASK; - if (reg >= VT_CONST) - tcc_internal_error(""); - if ((sv->type.t & VT_BTYPE) == VT_FLOAT || - (sv->type.t & VT_BTYPE) == VT_DOUBLE) { - /* floating point register */ - reg = TOK_ASM_f0 + reg; - } else { - /* general purpose register */ - reg = TOK_ASM_x0 + reg; - } - cstr_cat(add_str, get_tok_str(reg, NULL), -1); - } -} - -/* TCC does not use RISC-V register numbers internally, it uses 0-8 for - * integers and 8-16 for floats instead */ -static int tcc_ireg(int r){ - return REG_VALUE(r) - 10; -} -static int tcc_freg(int r){ - return REG_VALUE(r) - 10 + 8; -} - -/* generate prolog and epilog code for asm statement */ -ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, - int nb_outputs, int is_output, - uint8_t *clobber_regs, - int out_reg) -{ - uint8_t regs_allocated[NB_ASM_REGS]; - ASMOperand *op; - int i, reg; - - static const uint8_t reg_saved[] = { - // General purpose regs - 8, 9, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - // Float regs - 40, 41, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 - }; - - /* mark all used registers */ - memcpy(regs_allocated, clobber_regs, sizeof(regs_allocated)); - for(i = 0; i < nb_operands; i++) { - op = &operands[i]; - if (op->reg >= 0) { - regs_allocated[op->reg] = 1; - } - } - - if(!is_output) { - /* generate reg save code */ - for(i = 0; i < sizeof(reg_saved)/sizeof(reg_saved[0]); i++) { - reg = reg_saved[i]; - if (regs_allocated[reg]) { - /* push */ - /* addi sp, sp, -offset */ - gen_le32((4 << 2) | 3 | - ENCODE_RD(2) | ENCODE_RS1(2) | (unsigned)-8 << 20); - if (REG_IS_FLOAT(reg)){ - /* fsd reg, offset(sp) */ - gen_le32( 0x27 | (3 << 12) | - ENCODE_RS2(reg) | ENCODE_RS1(2) ); - } else { - /* sd reg, offset(sp) */ - gen_le32((0x8 << 2) | 3 | (3 << 12) | - ENCODE_RS2(reg) | ENCODE_RS1(2) ); - } - } - } - - /* generate load code */ - for(i = 0; i < nb_operands; i++) { - op = &operands[i]; - if (op->reg >= 0) { - if ((op->vt->r & VT_VALMASK) == VT_LLOCAL && - op->is_memory) { - /* memory reference case (for both input and - output cases) */ - SValue sv; - sv = *op->vt; - sv.r = (sv.r & ~VT_VALMASK) | VT_LOCAL | VT_LVAL; - sv.type.t = VT_PTR; - load(tcc_ireg(op->reg), &sv); - } else if (i >= nb_outputs || op->is_rw) { - /* load value in register */ - if ((op->vt->type.t & VT_BTYPE) == VT_FLOAT || - (op->vt->type.t & VT_BTYPE) == VT_DOUBLE) { - load(tcc_freg(op->reg), op->vt); - } else { - load(tcc_ireg(op->reg), op->vt); - } - if (op->is_llong) { - tcc_error("long long not implemented"); - } - } - } - } - } else { - /* generate save code */ - for(i = 0 ; i < nb_outputs; i++) { - op = &operands[i]; - if (op->reg >= 0) { - if ((op->vt->r & VT_VALMASK) == VT_LLOCAL) { - if (!op->is_memory) { - SValue sv; - sv = *op->vt; - sv.r = (sv.r & ~VT_VALMASK) | VT_LOCAL; - sv.type.t = VT_PTR; - load(tcc_ireg(out_reg), &sv); - - sv = *op->vt; - sv.r = (sv.r & ~VT_VALMASK) | out_reg; - store(tcc_ireg(op->reg), &sv); - } - } else { - if ((op->vt->type.t & VT_BTYPE) == VT_FLOAT || - (op->vt->type.t & VT_BTYPE) == VT_DOUBLE) { - store(tcc_freg(op->reg), op->vt); - } else { - store(tcc_ireg(op->reg), op->vt); - } - if (op->is_llong) { - tcc_error("long long not implemented"); - } - } - } - } - /* generate reg restore code for floating point registers */ - for(i = sizeof(reg_saved)/sizeof(reg_saved[0]) - 1; i >= 0; i--) { - reg = reg_saved[i]; - if (regs_allocated[reg]) { - /* pop */ - if (REG_IS_FLOAT(reg)){ - /* fld reg, offset(sp) */ - gen_le32(7 | (3 << 12) | - ENCODE_RD(reg) | ENCODE_RS1(2) | 0); - } else { - /* ld reg, offset(sp) */ - gen_le32(3 | (3 << 12) | - ENCODE_RD(reg) | ENCODE_RS1(2) | 0); - } - /* addi sp, sp, offset */ - gen_le32((4 << 2) | 3 | - ENCODE_RD(2) | ENCODE_RS1(2) | 8 << 20); - } - } - } -} - -/* return the constraint priority (we allocate first the lowest - numbered constraints) */ -static inline int constraint_priority(const char *str) -{ - // TODO: How is this chosen?? - int priority, c, pr; - - /* we take the lowest priority */ - priority = 0; - for(;;) { - c = *str; - if (c == '\0') - break; - str++; - switch(c) { - case 'A': // address that is held in a general-purpose register. - case 'S': // constraint that matches an absolute symbolic address. - case 'f': // register [float] - case 'r': // register [general] - case 'p': // valid memory address for load,store [general] - pr = 3; - break; - case 'I': // 12 bit signed immedate - case 'i': // immediate integer operand, including symbolic constants [general] - case 'm': // memory operand [general] - case 'g': // general-purpose-register, memory, immediate integer [general] - pr = 4; - break; - case 'v': - tcc_error("unimp: constraint '%c'", c); - default: - tcc_error("unknown constraint '%d'", c); - } - if (pr > priority) - priority = pr; - } - return priority; -} - -static const char *skip_constraint_modifiers(const char *p) -{ - /* Constraint modifier: - = Operand is written to by this instruction - + Operand is both read and written to by this instruction - % Instruction is commutative for this operand and the following operand. - - Per-alternative constraint modifier: - & Operand is clobbered before the instruction is done using the input operands - */ - while (*p == '=' || *p == '&' || *p == '+' || *p == '%') - p++; - return p; -} - -#define REG_OUT_MASK 0x01 -#define REG_IN_MASK 0x02 - -#define is_reg_allocated(reg) (regs_allocated[reg] & reg_mask) - -ST_FUNC void asm_compute_constraints(ASMOperand *operands, - int nb_operands, int nb_outputs, - const uint8_t *clobber_regs, - int *pout_reg) -{ - /* TODO: Simple constraints - whitespace ignored - o memory operand that is offsetable - V memory but not offsetable - < memory operand with autodecrement addressing is allowed. Restrictions apply. - > memory operand with autoincrement addressing is allowed. Restrictions apply. - n immediate integer operand with a known numeric value - E immediate floating operand (const_double) is allowed, but only if target=host - F immediate floating operand (const_double or const_vector) is allowed - s immediate integer operand whose value is not an explicit integer - X any operand whatsoever - 0...9 (postfix); (can also be more than 1 digit number); an operand that matches the specified operand number is allowed - */ - - /* TODO: RISCV constraints - J The integer 0. - K A 5-bit unsigned immediate for CSR access instructions. - A An address that is held in a general-purpose register. - S A constraint that matches an absolute symbolic address. - vr A vector register (if available).. - vd A vector register, excluding v0 (if available). - vm A vector register, only v0 (if available). - */ - ASMOperand *op; - int sorted_op[MAX_ASM_OPERANDS]; - int i, j, k, p1, p2, tmp, reg, c, reg_mask; - const char *str; - uint8_t regs_allocated[NB_ASM_REGS]; - - /* init fields */ - for (i = 0; i < nb_operands; i++) { - op = &operands[i]; - op->input_index = -1; - op->ref_index = -1; - op->reg = -1; - op->is_memory = 0; - op->is_rw = 0; - } - /* compute constraint priority and evaluate references to output - constraints if input constraints */ - for (i = 0; i < nb_operands; i++) { - op = &operands[i]; - str = op->constraint; - str = skip_constraint_modifiers(str); - if (isnum(*str) || *str == '[') { - /* this is a reference to another constraint */ - k = find_constraint(operands, nb_operands, str, NULL); - if ((unsigned) k >= i || i < nb_outputs) - tcc_error("invalid reference in constraint %d ('%s')", - i, str); - op->ref_index = k; - if (operands[k].input_index >= 0) - tcc_error("cannot reference twice the same operand"); - operands[k].input_index = i; - op->priority = 5; - } else if ((op->vt->r & VT_VALMASK) == VT_LOCAL - && op->vt->sym - && (reg = op->vt->sym->r & VT_VALMASK) < VT_CONST) { - op->priority = 1; - op->reg = reg; - } else { - op->priority = constraint_priority(str); - } - } - - /* sort operands according to their priority */ - for (i = 0; i < nb_operands; i++) - sorted_op[i] = i; - for (i = 0; i < nb_operands - 1; i++) { - for (j = i + 1; j < nb_operands; j++) { - p1 = operands[sorted_op[i]].priority; - p2 = operands[sorted_op[j]].priority; - if (p2 < p1) { - tmp = sorted_op[i]; - sorted_op[i] = sorted_op[j]; - sorted_op[j] = tmp; - } - } - } - - for (i = 0; i < NB_ASM_REGS; i++) { - if (clobber_regs[i]) - regs_allocated[i] = REG_IN_MASK | REG_OUT_MASK; - else - regs_allocated[i] = 0; - } - - /* allocate registers and generate corresponding asm moves */ - for (i = 0; i < nb_operands; i++) { - j = sorted_op[i]; - op = &operands[j]; - str = op->constraint; - /* no need to allocate references */ - if (op->ref_index >= 0) - continue; - /* select if register is used for output, input or both */ - if (op->input_index >= 0) { - reg_mask = REG_IN_MASK | REG_OUT_MASK; - } else if (j < nb_outputs) { - reg_mask = REG_OUT_MASK; - } else { - reg_mask = REG_IN_MASK; - } - if (op->reg >= 0) { - if (is_reg_allocated(op->reg)) - tcc_error - ("asm regvar requests register that's taken already"); - reg = op->reg; - } - try_next: - c = *str++; - switch (c) { - case '=': // Operand is written-to - goto try_next; - case '+': // Operand is both READ and written-to - op->is_rw = 1; - /* FALL THRU */ - case '&': // Operand is clobbered before the instruction is done using the input operands - if (j >= nb_outputs) - tcc_error("'%c' modifier can only be applied to outputs", c); - reg_mask = REG_IN_MASK | REG_OUT_MASK; - goto try_next; - case 'r': // general-purpose register - case 'p': // loadable/storable address - /* any general register */ - /* From a0 to a7 */ - if ((reg = op->reg) >= 0) - goto reg_found; - else for (reg = 10; reg <= 18; reg++) { - if (!is_reg_allocated(reg)) - goto reg_found; - } - goto try_next; - reg_found: - /* now we can reload in the register */ - op->is_llong = 0; - op->reg = reg; - regs_allocated[reg] |= reg_mask; - break; - case 'f': // floating pont register - /* floating point register */ - /* From fa0 to fa7 */ - if ((reg = op->reg) >= 0) - goto reg_found; - else for (reg = 42; reg <= 50; reg++) { - if (!is_reg_allocated(reg)) - goto reg_found; - } - goto try_next; - case 'I': // I-Type 12 bit signed immediate - case 'i': // immediate integer operand, including symbolic constants - if (!((op->vt->r & (VT_VALMASK | VT_LVAL)) == VT_CONST)) - goto try_next; - break; - case 'm': // memory operand - case 'g': // any register - /* nothing special to do because the operand is already in - memory, except if the pointer itself is stored in a - memory variable (VT_LLOCAL case) */ - /* XXX: fix constant case */ - /* if it is a reference to a memory zone, it must lie - in a register, so we reserve the register in the - input registers and a load will be generated - later */ - if (j < nb_outputs || c == 'm') { - if ((op->vt->r & VT_VALMASK) == VT_LLOCAL) { - /* any general register: from a0 to a7 */ - for (reg = 10; reg <= 18; reg++) { - if (!(regs_allocated[reg] & REG_IN_MASK)) - goto reg_found1; - } - goto try_next; - reg_found1: - /* now we can reload in the register */ - regs_allocated[reg] |= REG_IN_MASK; - op->reg = reg; - op->is_memory = 1; - } - } - break; - default: - tcc_error("asm constraint %d ('%s') could not be satisfied", - j, op->constraint); - break; - } - /* if a reference is present for that operand, we assign it too */ - if (op->input_index >= 0) { - operands[op->input_index].reg = op->reg; - operands[op->input_index].is_llong = op->is_llong; - } - } - - /* compute out_reg. It is used to store outputs registers to memory - locations references by pointers (VT_LLOCAL case) */ - *pout_reg = -1; - for (i = 0; i < nb_operands; i++) { - op = &operands[i]; - if (op->reg >= 0 && - (op->vt->r & VT_VALMASK) == VT_LLOCAL && !op->is_memory) { - if (REG_IS_FLOAT(op->reg)){ - /* From fa0 to fa7 */ - for (reg = 42; reg <= 50; reg++) { - if (!(regs_allocated[reg] & REG_OUT_MASK)) - goto reg_found2; - } - } else { - /* From a0 to a7 */ - for (reg = 10; reg <= 18; reg++) { - if (!(regs_allocated[reg] & REG_OUT_MASK)) - goto reg_found2; - } - } - tcc_error("could not find free output register for reloading"); - reg_found2: - *pout_reg = reg; - break; - } - } - - /* print sorted constraints */ -#ifdef ASM_DEBUG - for (i = 0; i < nb_operands; i++) { - j = sorted_op[i]; - op = &operands[j]; - printf("%%%d [%s]: \"%s\" r=0x%04x reg=%d\n", - j, - op->id ? get_tok_str(op->id, NULL) : "", - op->constraint, op->vt->r, op->reg); - } - if (*pout_reg >= 0) - printf("out_reg=%d\n", *pout_reg); -#endif -} - -ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) -{ - int reg; - TokenSym *ts; - - if (!strcmp(str, "memory") || - !strcmp(str, "cc") || - !strcmp(str, "flags")) - return; - ts = tok_alloc(str, strlen(str)); - reg = asm_parse_regvar(ts->tok); - if (reg == -1) { - tcc_error("invalid clobber register '%s'", str); - } - clobber_regs[reg] = 1; -} - -ST_FUNC int asm_parse_regvar (int t) -{ - /* PC register not implemented */ - if (t >= TOK_ASM_pc || t < TOK_ASM_x0) - return -1; - - if (t < TOK_ASM_f0) - return t - TOK_ASM_x0; - - if (t < TOK_ASM_zero) - return t - TOK_ASM_f0 + 32; // Use higher 32 for floating point - - /* ABI mnemonic */ - if (t < TOK_ASM_ft0) - return t - TOK_ASM_zero; - - return t - TOK_ASM_ft0 + 32; // Use higher 32 for floating point -} - -/*************************************************************/ -/* C extension */ - -/* caller: Add funct6, funct2 into opcode */ -static void asm_emit_ca(int token, uint16_t opcode, const Operand *rd, const Operand *rs2) -{ - uint8_t dst, src; - - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - - if (rs2->type != OP_REG) { - tcc_error("'%s': Expected source operand that is a register", get_tok_str(token, NULL)); - } - - /* subtract index of x8 */ - dst = rd->reg - 8; - src = rs2->reg - 8; - - /* only registers {x,f}8 to {x,f}15 are valid (3-bit) */ - if (dst > 7) { - tcc_error("'%s': Expected destination operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - if (src > 7) { - tcc_error("'%s': Expected source operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - /* CA-type instruction: - 15...10 funct6 - 9...7 rd'/rs1' - 6..5 funct2 - 4...2 rs2' - 1...0 opcode */ - - gen_le16(opcode | C_ENCODE_RS2(src) | C_ENCODE_RS1(dst)); -} - -static void asm_emit_cb(int token, uint16_t opcode, const Operand *rs1, const Operand *imm) -{ - uint32_t offset; - uint8_t src; - - if (rs1->type != OP_REG) { - tcc_error("'%s': Expected source operand that is a register", get_tok_str(token, NULL)); - } - - if (imm->type != OP_IM12S && imm->type != OP_IM32) { - tcc_error("'%s': Expected source operand that is an immediate value", get_tok_str(token, NULL)); - } - - offset = imm->e.v; - - if (offset & 1) { - tcc_error("'%s': Expected source operand that is an even immediate value", get_tok_str(token, NULL)); - } - - src = rs1->reg - 8; - - if (src > 7) { - tcc_error("'%s': Expected source operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - /* CB-type instruction: - 15...13 funct3 - 12...10 offset - 9..7 rs1' - 6...2 offset - 1...0 opcode */ - - /* non-branch also using CB: - 15...13 funct3 - 12 imm - 11..10 funct2 - 9...7 rd'/rs1' - 6..2 imm - 1...0 opcode */ - - switch (token) { - case TOK_ASM_c_beqz: - case TOK_ASM_c_bnez: - gen_le16(opcode | C_ENCODE_RS1(src) | ((NTH_BIT(offset, 5) | (((offset >> 1) & 3) << 1) | (((offset >> 6) & 3) << 3)) << 2) | ((((offset >> 3) & 3) | NTH_BIT(offset, 8)) << 10)); - return; - default: - gen_le16(opcode | C_ENCODE_RS1(src) | ((offset & 0x1f) << 2) | (NTH_BIT(offset, 5) << 12)); - return; - } -} - -static void asm_emit_ci(int token, uint16_t opcode, const Operand *rd, const Operand *imm) -{ - uint32_t immediate; - - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - - if (imm->type != OP_IM12S && imm->type != OP_IM32) { - tcc_error("'%s': Expected source operand that is an immediate value", get_tok_str(token, NULL)); - } - - immediate = imm->e.v; - - /* CI-type instruction: - 15...13 funct3 - 12 imm - 11...7 rd/rs1 - 6...2 imm - 1...0 opcode */ - - switch (token) { - case TOK_ASM_c_addi: - case TOK_ASM_c_addiw: - case TOK_ASM_c_li: - case TOK_ASM_c_slli: - gen_le16(opcode | ((immediate & 0x1f) << 2) | ENCODE_RD(rd->reg) | (NTH_BIT(immediate, 5) << 12)); - return; - case TOK_ASM_c_addi16sp: - gen_le16(opcode | NTH_BIT(immediate, 5) << 2 | (((immediate >> 7) & 3) << 3) | NTH_BIT(immediate, 6) << 5 | NTH_BIT(immediate, 4) << 6 | ENCODE_RD(rd->reg) | (NTH_BIT(immediate, 9) << 12)); - return; - case TOK_ASM_c_lui: - gen_le16(opcode | (((immediate >> 12) & 0x1f) << 2) | ENCODE_RD(rd->reg) | (NTH_BIT(immediate, 17) << 12)); - return; - case TOK_ASM_c_fldsp: - case TOK_ASM_c_ldsp: - gen_le16(opcode | (((immediate >> 6) & 7) << 2) | (((immediate >> 3) & 2) << 5) | ENCODE_RD(rd->reg) | (NTH_BIT(immediate, 5) << 12)); - return; - case TOK_ASM_c_flwsp: - case TOK_ASM_c_lwsp: - gen_le16(opcode | (((immediate >> 6) & 3) << 2) | (((immediate >> 2) & 7) << 4) | ENCODE_RD(rd->reg) | (NTH_BIT(immediate, 5) << 12)); - return; - case TOK_ASM_c_nop: - gen_le16(opcode); - return; - default: - expect("known instruction"); - } -} - -/* caller: Add funct3 into opcode */ -static void asm_emit_ciw(int token, uint16_t opcode, const Operand *rd, const Operand *imm) -{ - uint32_t nzuimm; - uint8_t dst; - - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - - if (imm->type != OP_IM12S && imm->type != OP_IM32) { - tcc_error("'%s': Expected source operand that is an immediate value", get_tok_str(token, NULL)); - } - - dst = rd->reg - 8; - - if (dst > 7) { - tcc_error("'%s': Expected destination operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - nzuimm = imm->e.v; - - if (nzuimm > 0x3fc) { - tcc_error("'%s': Expected source operand that is an immediate value between 0 and 0x3ff", get_tok_str(token, NULL)); - } - - if (nzuimm & 3) { - tcc_error("'%s': Expected source operand that is a non-zero immediate value divisible by 4", get_tok_str(token, NULL)); - } - - /* CIW-type instruction: - 15...13 funct3 - 12...5 imm - 4...2 rd' - 1...0 opcode */ - - gen_le16(opcode | ENCODE_RS2(rd->reg) | ((NTH_BIT(nzuimm, 3) | (NTH_BIT(nzuimm, 2) << 1) | (((nzuimm >> 6) & 0xf) << 2) | (((nzuimm >> 4) & 3) << 6)) << 5)); -} - -/* caller: Add funct3 into opcode */ -static void asm_emit_cj(int token, uint16_t opcode, const Operand *imm) -{ - uint32_t offset; - - /* +-2 KiB range */ - if (imm->type != OP_IM12S) { - tcc_error("'%s': Expected source operand that is a 12-bit immediate value", get_tok_str(token, NULL)); - } - - offset = imm->e.v; - - if (offset & 1) { - tcc_error("'%s': Expected source operand that is an even immediate value", get_tok_str(token, NULL)); - } - - /* CJ-type instruction: - 15...13 funct3 - 12...2 offset[11|4|9:8|10|6|7|3:1|5] - 1...0 opcode */ - - gen_le16(opcode | (NTH_BIT(offset, 5) << 2) | (((offset >> 1) & 7) << 3) | (NTH_BIT(offset, 7) << 6) | (NTH_BIT(offset, 6) << 7) | (NTH_BIT(offset, 10) << 8) | (((offset >> 8) & 3) << 9) | (NTH_BIT(offset, 4) << 11) | (NTH_BIT(offset, 11) << 12)); -} - -/* caller: Add funct3 into opcode */ -static void asm_emit_cl(int token, uint16_t opcode, const Operand *rd, const Operand *rs1, const Operand *imm) -{ - uint32_t offset; - uint8_t dst, src; - - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - - if (rs1->type != OP_REG) { - tcc_error("'%s': Expected source operand that is a register", get_tok_str(token, NULL)); - } - - if (imm->type != OP_IM12S && imm->type != OP_IM32) { - tcc_error("'%s': Expected source operand that is an immediate value", get_tok_str(token, NULL)); - } - - dst = rd->reg - 8; - src = rs1->reg - 8; - - if (dst > 7) { - tcc_error("'%s': Expected destination operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - if (src > 7) { - tcc_error("'%s': Expected source operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - offset = imm->e.v; - - if (offset > 0xff) { - tcc_error("'%s': Expected source operand that is an immediate value between 0 and 0xff", get_tok_str(token, NULL)); - } - - if (offset & 3) { - tcc_error("'%s': Expected source operand that is an immediate value divisible by 4", get_tok_str(token, NULL)); - } - - /* CL-type instruction: - 15...13 funct3 - 12...10 imm - 9...7 rs1' - 6...5 imm - 4...2 rd' - 1...0 opcode */ - - switch (token) { - /* imm variant 1 */ - case TOK_ASM_c_flw: - case TOK_ASM_c_lw: - gen_le16(opcode | C_ENCODE_RS2(dst) | C_ENCODE_RS1(src) | (NTH_BIT(offset, 6) << 5) | (NTH_BIT(offset, 2) << 6) | (((offset >> 3) & 7) << 10)); - return; - /* imm variant 2 */ - case TOK_ASM_c_fld: - case TOK_ASM_c_ld: - gen_le16(opcode | C_ENCODE_RS2(dst) | C_ENCODE_RS1(src) | (((offset >> 6) & 3) << 5) | (((offset >> 3) & 7) << 10)); - return; - default: - expect("known instruction"); - } -} - -/* caller: Add funct4 into opcode */ -static void asm_emit_cr(int token, uint16_t opcode, const Operand *rd, const Operand *rs2) -{ - if (rd->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - - if (rs2->type != OP_REG) { - tcc_error("'%s': Expected source operand that is a register", get_tok_str(token, NULL)); - } - - /* CR-type instruction: - 15...12 funct4 - 11..7 rd/rs1 - 6...2 rs2 - 1...0 opcode */ - - gen_le16(opcode | C_ENCODE_RS1(rd->reg) | C_ENCODE_RS2(rs2->reg)); -} - -/* caller: Add funct3 into opcode */ -static void asm_emit_cs(int token, uint16_t opcode, const Operand *rs2, const Operand *rs1, const Operand *imm) -{ - uint32_t offset; - uint8_t base, src; - - if (rs2->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - - if (rs1->type != OP_REG) { - tcc_error("'%s': Expected source operand that is a register", get_tok_str(token, NULL)); - } - - if (imm->type != OP_IM12S && imm->type != OP_IM32) { - tcc_error("'%s': Expected source operand that is an immediate value", get_tok_str(token, NULL)); - } - - base = rs1->reg - 8; - src = rs2->reg - 8; - - if (base > 7) { - tcc_error("'%s': Expected destination operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - if (src > 7) { - tcc_error("'%s': Expected source operand that is a valid C-extension register", get_tok_str(token, NULL)); - } - - offset = imm->e.v; - - if (offset > 0xff) { - tcc_error("'%s': Expected source operand that is an immediate value between 0 and 0xff", get_tok_str(token, NULL)); - } - - if (offset & 3) { - tcc_error("'%s': Expected source operand that is an immediate value divisible by 4", get_tok_str(token, NULL)); - } - - /* CS-type instruction: - 15...13 funct3 - 12...10 imm - 9...7 rs1' - 6...5 imm - 4...2 rs2' - 1...0 opcode */ - switch (token) { - /* imm variant 1 */ - case TOK_ASM_c_fsw: - case TOK_ASM_c_sw: - gen_le16(opcode | C_ENCODE_RS2(base) | C_ENCODE_RS1(src) | (NTH_BIT(offset, 6) << 5) | (NTH_BIT(offset, 2) << 6) | (((offset >> 3) & 7) << 10)); - return; - /* imm variant 2 */ - case TOK_ASM_c_fsd: - case TOK_ASM_c_sd: - gen_le16(opcode | C_ENCODE_RS2(base) | C_ENCODE_RS1(src) | (((offset >> 6) & 3) << 5) | (((offset >> 3) & 7) << 10)); - return; - default: - expect("known instruction"); - } -} - -/* caller: Add funct3 into opcode */ -static void asm_emit_css(int token, uint16_t opcode, const Operand *rs2, const Operand *imm) -{ - uint32_t offset; - - if (rs2->type != OP_REG) { - tcc_error("'%s': Expected destination operand that is a register", get_tok_str(token, NULL)); - } - - if (imm->type != OP_IM12S && imm->type != OP_IM32) { - tcc_error("'%s': Expected source operand that is an immediate value", get_tok_str(token, NULL)); - } - - offset = imm->e.v; - - if (offset > 0xff) { - tcc_error("'%s': Expected source operand that is an immediate value between 0 and 0xff", get_tok_str(token, NULL)); - } - - if (offset & 3) { - tcc_error("'%s': Expected source operand that is an immediate value divisible by 4", get_tok_str(token, NULL)); - } - - /* CSS-type instruction: - 15...13 funct3 - 12...7 imm - 6...2 rs2 - 1...0 opcode */ - - switch (token) { - /* imm variant 1 */ - case TOK_ASM_c_fswsp: - case TOK_ASM_c_swsp: - gen_le16(opcode | ENCODE_RS2(rs2->reg) | (((offset >> 6) & 3) << 7) | (((offset >> 2) & 0xf) << 9)); - return; - /* imm variant 2 */ - case TOK_ASM_c_fsdsp: - case TOK_ASM_c_sdsp: - gen_le16(opcode | ENCODE_RS2(rs2->reg) | (((offset >> 6) & 7) << 7) | (((offset >> 3) & 7) << 10)); - return; - default: - expect("known instruction"); - } -} - -/*************************************************************/ -#endif /* ndef TARGET_DEFS_ONLY */ diff --git a/riscv64-gen.c b/riscv64-gen.c deleted file mode 100644 index 5dea659f..00000000 --- a/riscv64-gen.c +++ /dev/null @@ -1,1447 +0,0 @@ -#ifdef TARGET_DEFS_ONLY - -// Number of registers available to allocator: -#define NB_REGS 19 // x10-x17 aka a0-a7, f10-f17 aka fa0-fa7, xxx, ra, sp -#define CONFIG_TCC_ASM - -#define TREG_R(x) (x) // x = 0..7 -#define TREG_F(x) (x + 8) // x = 0..7 - -// Register classes sorted from more general to more precise: -#define RC_INT (1 << 0) -#define RC_FLOAT (1 << 1) -#define RC_R(x) (1 << (2 + (x))) // x = 0..7 -#define RC_F(x) (1 << (10 + (x))) // x = 0..7 - -#define RC_IRET (RC_R(0)) // int return register class -#define RC_IRE2 (RC_R(1)) // int 2nd return register class -#define RC_FRET (RC_F(0)) // float return register class - -#define REG_IRET (TREG_R(0)) // int return register number -#define REG_IRE2 (TREG_R(1)) // int 2nd return register number -#define REG_FRET (TREG_F(0)) // float return register number - -#define PTR_SIZE 8 - -#define LDOUBLE_SIZE 16 -#define LDOUBLE_ALIGN 16 - -#define MAX_ALIGN 16 - -#define CHAR_IS_UNSIGNED - -#else -#define USING_GLOBALS -#include "tcc.h" -#include - -ST_DATA const char * const target_machine_defs = - "__riscv\0" - "__riscv_xlen 64\0" - "__riscv_flen 64\0" - "__riscv_div\0" - "__riscv_mul\0" - "__riscv_fdiv\0" - "__riscv_fsqrt\0" - "__riscv_float_abi_double\0" - ; - -#define XLEN 8 - -#define TREG_RA 17 -#define TREG_SP 18 - -ST_DATA const int reg_classes[NB_REGS] = { - RC_INT | RC_R(0), - RC_INT | RC_R(1), - RC_INT | RC_R(2), - RC_INT | RC_R(3), - RC_INT | RC_R(4), - RC_INT | RC_R(5), - RC_INT | RC_R(6), - RC_INT | RC_R(7), - RC_FLOAT | RC_F(0), - RC_FLOAT | RC_F(1), - RC_FLOAT | RC_F(2), - RC_FLOAT | RC_F(3), - RC_FLOAT | RC_F(4), - RC_FLOAT | RC_F(5), - RC_FLOAT | RC_F(6), - RC_FLOAT | RC_F(7), - 0, - 1 << TREG_RA, - 1 << TREG_SP -}; - -#if defined(CONFIG_TCC_BCHECK) -static addr_t func_bound_offset; -static unsigned long func_bound_ind; -ST_DATA int func_bound_add_epilog; -#endif - -static int ireg(int r) -{ - if (r == TREG_RA) - return 1; // ra - if (r == TREG_SP) - return 2; // sp - assert(r >= 0 && r < 8); - return r + 10; // tccrX --> aX == x(10+X) -} - -static int is_ireg(int r) -{ - return (unsigned)r < 8 || r == TREG_RA || r == TREG_SP; -} - -static int freg(int r) -{ - assert(r >= 8 && r < 16); - return r - 8 + 10; // tccfX --> faX == f(10+X) -} - -static int is_freg(int r) -{ - return r >= 8 && r < 16; -} - -ST_FUNC void o(unsigned int c) -{ - int ind1 = ind + 4; - if (nocode_wanted) - return; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - write32le(cur_text_section->data + ind, c); - ind = ind1; -} - -static void EIu(uint32_t opcode, uint32_t func3, - uint32_t rd, uint32_t rs1, uint32_t imm) -{ - o(opcode | (func3 << 12) | (rd << 7) | (rs1 << 15) | (imm << 20)); -} - -static void ER(uint32_t opcode, uint32_t func3, - uint32_t rd, uint32_t rs1, uint32_t rs2, uint32_t func7) -{ - o(opcode | func3 << 12 | rd << 7 | rs1 << 15 | rs2 << 20 | func7 << 25); -} - -static void EI(uint32_t opcode, uint32_t func3, - uint32_t rd, uint32_t rs1, uint32_t imm) -{ - assert(! ((imm + (1 << 11)) >> 12)); - EIu(opcode, func3, rd, rs1, imm); -} - -static void ES(uint32_t opcode, uint32_t func3, - uint32_t rs1, uint32_t rs2, uint32_t imm) -{ - assert(! ((imm + (1 << 11)) >> 12)); - o(opcode | (func3 << 12) | ((imm & 0x1f) << 7) | (rs1 << 15) - | (rs2 << 20) | ((imm >> 5) << 25)); -} - -// Patch all branches in list pointed to by t to branch to a: -ST_FUNC void gsym_addr(int t_, int a_) -{ - uint32_t t = t_; - uint32_t a = a_; - while (t) { - unsigned char *ptr = cur_text_section->data + t; - uint32_t next = read32le(ptr); - uint32_t r = a - t, imm; - if ((r + (1 << 21)) & ~((1U << 22) - 2)) - tcc_error("out-of-range branch chain"); - imm = (((r >> 12) & 0xff) << 12) - | (((r >> 11) & 1) << 20) - | (((r >> 1) & 0x3ff) << 21) - | (((r >> 20) & 1) << 31); - write32le(ptr, r == 4 ? 0x33 : 0x6f | imm); // nop || j imm - t = next; - } -} - -static int load_symofs(int r, SValue *sv, int forstore) -{ - int rr, doload = 0, large_addend = 0; - int fc = sv->c.i, v = sv->r & VT_VALMASK; - if (sv->r & VT_SYM) { - Sym label = {0}; - assert(v == VT_CONST); - if (sv->sym->type.t & VT_STATIC) { // XXX do this per linker relax - greloca(cur_text_section, sv->sym, ind, - R_RISCV_PCREL_HI20, sv->c.i); - sv->c.i = 0; - } else { - if (((unsigned)fc + (1 << 11)) >> 12){ - large_addend = 1; - } - greloca(cur_text_section, sv->sym, ind, - R_RISCV_GOT_HI20, 0); - doload = 1; - } - label.type.t = VT_VOID | VT_STATIC; - if (!nocode_wanted) - put_extern_sym(&label, cur_text_section, ind, 0); - rr = is_ireg(r) ? ireg(r) : 5; - o(0x17 | (rr << 7)); // auipc RR, 0 %pcrel_hi(sym)+addend - greloca(cur_text_section, &label, ind, - doload || !forstore - ? R_RISCV_PCREL_LO12_I : R_RISCV_PCREL_LO12_S, 0); - if (doload) { - EI(0x03, 3, rr, rr, 0); // ld RR, 0(RR) - if (large_addend) { - o(0x37 | (6 << 7) | ((0x800 + fc) & 0xfffff000)); //lui t1, high(fc) - ER(0x33, 0, rr, rr, 6, 0); // add RR, RR, t1 - sv->c.i = fc << 20 >> 20; - } - } - } else if (v == VT_LOCAL || v == VT_LLOCAL) { - rr = 8; // s0 - if (fc != sv->c.i) - tcc_error("unimp: store(giant local off) (0x%lx)", (long)sv->c.i); - if (((unsigned)fc + (1 << 11)) >> 12) { - rr = is_ireg(r) ? ireg(r) : 5; // t0 - o(0x37 | (rr << 7) | ((0x800 + fc) & 0xfffff000)); //lui RR, upper(fc) - ER(0x33, 0, rr, rr, 8, 0); // add RR, RR, s0 - sv->c.i = fc << 20 >> 20; - } - } else - tcc_error("uhh"); - return rr; -} - -static void load_large_constant(int rr, int fc, uint32_t pi) -{ - if (fc < 0) - pi++; - o(0x37 | (rr << 7) | (((pi + 0x800) & 0xfffff000))); // lui RR, up(up(fc)) - EI(0x13, 0, rr, rr, (int)pi << 20 >> 20); // addi RR, RR, lo(up(fc)) - EI(0x13, 1, rr, rr, 12); // slli RR, RR, 12 - EI(0x13, 0, rr, rr, (fc + (1 << 19)) >> 20); // addi RR, RR, up(lo(fc)) - EI(0x13, 1, rr, rr, 12); // slli RR, RR, 12 - fc = fc << 12 >> 12; - EI(0x13, 0, rr, rr, fc >> 8); // addi RR, RR, lo1(lo(fc)) - EI(0x13, 1, rr, rr, 8); // slli RR, RR, 8 -} - -ST_FUNC void load(int r, SValue *sv) -{ - int fr = sv->r; - int v = fr & VT_VALMASK; - int rr = is_ireg(r) ? ireg(r) : freg(r); - int fc = sv->c.i; - int bt = sv->type.t & VT_BTYPE; - int align, size; - if (fr & VT_LVAL) { - int func3, opcode = is_freg(r) ? 0x07 : 0x03, br; - size = type_size(&sv->type, &align); - assert (!is_freg(r) || bt == VT_FLOAT || bt == VT_DOUBLE); - if (bt == VT_PTR || bt == VT_FUNC) /* XXX should be done in generic code */ - size = PTR_SIZE; - func3 = size == 1 ? 0 : size == 2 ? 1 : size == 4 ? 2 : 3; - if (size < 4 && !is_float(sv->type.t) && (sv->type.t & VT_UNSIGNED)) - func3 |= 4; - if (v == VT_LOCAL || (fr & VT_SYM)) { - br = load_symofs(r, sv, 0); - fc = sv->c.i; - } else if (v < VT_CONST) { - br = ireg(v); - /*if (((unsigned)fc + (1 << 11)) >> 12) - tcc_error("unimp: load(large addend) (0x%x)", fc);*/ - fc = 0; // XXX store ofs in LVAL(reg) - } else if (v == VT_LLOCAL) { - br = load_symofs(r, sv, 0); - fc = sv->c.i; - EI(0x03, 3, rr, br, fc); // ld RR, fc(BR) - br = rr; - fc = 0; - } else if (v == VT_CONST) { - int64_t si = sv->c.i; - si >>= 32; - if (si != 0) { - load_large_constant(rr, fc, si); - fc &= 0xff; - } else { - o(0x37 | (rr << 7) | ((0x800 + fc) & 0xfffff000)); //lui RR, upper(fc) - fc = fc << 20 >> 20; - } - br = rr; - } else { - tcc_error("unimp: load(non-local lval)"); - } - EI(opcode, func3, rr, br, fc); // l[bhwd][u] / fl[wd] RR, fc(BR) - } else if (v == VT_CONST) { - int rb = 0, do32bit = 8, zext = 0; - assert((!is_float(sv->type.t) && is_ireg(r)) || bt == VT_LDOUBLE); - if (fr & VT_SYM) { - rb = load_symofs(r, sv, 0); - fc = sv->c.i; - do32bit = 0; - } - if (is_float(sv->type.t) && bt != VT_LDOUBLE) - tcc_error("unimp: load(float)"); - if (fc != sv->c.i) { - int64_t si = sv->c.i; - si >>= 32; - if (si != 0) { - load_large_constant(rr, fc, si); - fc &= 0xff; - rb = rr; - do32bit = 0; - } else if (bt == VT_LLONG) { - /* A 32bit unsigned constant for a 64bit type. - lui always sign extends, so we need to do an explicit zext.*/ - zext = 1; - } - } - if (((unsigned)fc + (1 << 11)) >> 12) - o(0x37 | (rr << 7) | ((0x800 + fc) & 0xfffff000)), rb = rr; //lui RR, upper(fc) - if (fc || (rr != rb) || do32bit || (fr & VT_SYM)) - EI(0x13 | do32bit, 0, rr, rb, fc << 20 >> 20); // addi[w] R, x0|R, FC - if (zext) { - EI(0x13, 1, rr, rr, 32); // slli RR, RR, 32 - EI(0x13, 5, rr, rr, 32); // srli RR, RR, 32 - } - } else if (v == VT_LOCAL) { - int br = load_symofs(r, sv, 0); - assert(is_ireg(r)); - fc = sv->c.i; - EI(0x13, 0, rr, br, fc); // addi R, s0, FC - } else if (v < VT_CONST) { /* reg-reg */ - //assert(!fc); XXX support offseted regs - if (is_freg(r) && is_freg(v)) - ER(0x53, 0, rr, freg(v), freg(v), bt == VT_DOUBLE ? 0x11 : 0x10); //fsgnj.[sd] RR, V, V == fmv.[sd] RR, V - else if (is_ireg(r) && is_ireg(v)) - EI(0x13, 0, rr, ireg(v), 0); // addi RR, V, 0 == mv RR, V - else { - int func7 = is_ireg(r) ? 0x70 : 0x78; - size = type_size(&sv->type, &align); - if (size == 8) - func7 |= 1; - assert(size == 4 || size == 8); - o(0x53 | (rr << 7) | ((is_freg(v) ? freg(v) : ireg(v)) << 15) - | (func7 << 25)); // fmv.{w.x, x.w, d.x, x.d} RR, VR - } - } else if (v == VT_CMP) { - int op = vtop->cmp_op; - int a = vtop->cmp_r & 0xff; - int b = (vtop->cmp_r >> 8) & 0xff; - int inv = 0; - switch (op) { - case TOK_ULT: - case TOK_UGE: - case TOK_ULE: - case TOK_UGT: - case TOK_LT: - case TOK_GE: - case TOK_LE: - case TOK_GT: - if (op & 1) { // remove [U]GE,GT - inv = 1; - op--; - } - if ((op & 7) == 6) { // [U]LE - int t = a; a = b; b = t; - inv ^= 1; - } - ER(0x33, (op > TOK_UGT) ? 2 : 3, rr, a, b, 0); // slt[u] d, a, b - if (inv) - EI(0x13, 4, rr, rr, 1); // xori d, d, 1 - break; - case TOK_NE: - case TOK_EQ: - if (rr != a || b) - ER(0x33, 0, rr, a, b, 0x20); // sub d, a, b - if (op == TOK_NE) - ER(0x33, 3, rr, 0, rr, 0); // sltu d, x0, d == snez d,d - else - EI(0x13, 3, rr, rr, 1); // sltiu d, d, 1 == seqz d,d - break; - } - } else if ((v & ~1) == VT_JMP) { - int t = v & 1; - assert(is_ireg(r)); - EI(0x13, 0, rr, 0, t); // addi RR, x0, t - gjmp_addr(ind + 8); - gsym(fc); - EI(0x13, 0, rr, 0, t ^ 1); // addi RR, x0, !t - } else - tcc_error("unimp: load(non-const)"); -} - -ST_FUNC void store(int r, SValue *sv) -{ - int fr = sv->r & VT_VALMASK; - int rr = is_ireg(r) ? ireg(r) : freg(r), ptrreg; - int fc = sv->c.i; - int bt = sv->type.t & VT_BTYPE; - int align, size = type_size(&sv->type, &align); - assert(!is_float(bt) || is_freg(r) || bt == VT_LDOUBLE); - /* long doubles are in two integer registers, but the load/store - primitives only deal with one, so do as if it's one reg. */ - if (bt == VT_LDOUBLE) - size = align = 8; - if (bt == VT_STRUCT) - tcc_error("unimp: store(struct)"); - if (size > 8) - tcc_error("unimp: large sized store"); - assert(sv->r & VT_LVAL); - if (fr == VT_LOCAL || (sv->r & VT_SYM)) { - ptrreg = load_symofs(-1, sv, 1); - fc = sv->c.i; - } else if (fr < VT_CONST) { - ptrreg = ireg(fr); - /*if (((unsigned)fc + (1 << 11)) >> 12) - tcc_error("unimp: store(large addend) (0x%x)", fc);*/ - fc = 0; // XXX support offsets regs - } else if (fr == VT_CONST) { - int64_t si = sv->c.i; - ptrreg = 8; // s0 - si >>= 32; - if (si != 0) { - load_large_constant(ptrreg, fc, si); - fc &= 0xff; - } else { - o(0x37 | (ptrreg << 7) | ((0x800 + fc) & 0xfffff000)); //lui RR, upper(fc) - fc = fc << 20 >> 20; - } - } else - tcc_error("implement me: %s(!local)", __FUNCTION__); - ES(is_freg(r) ? 0x27 : 0x23, // fs... | s... - size == 1 ? 0 : size == 2 ? 1 : size == 4 ? 2 : 3, // ... [wd] | [bhwd] - ptrreg, rr, fc); // RR, fc(base) -} - -static void gcall_or_jmp(int docall) -{ - int tr = docall ? 1 : 5; // ra or t0 - if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST && - ((vtop->r & VT_SYM) && vtop->c.i == (int)vtop->c.i)) { - /* constant symbolic case -> simple relocation */ - greloca(cur_text_section, vtop->sym, ind, - R_RISCV_CALL_PLT, (int)vtop->c.i); - o(0x17 | (tr << 7)); // auipc TR, 0 %call(func) - EI(0x67, 0, tr, tr, 0);// jalr TR, r(TR) - } else if (vtop->r < VT_CONST) { - int r = ireg(vtop->r); - EI(0x67, 0, tr, r, 0); // jalr TR, 0(R) - } else { - int r = TREG_RA; - load(r, vtop); - r = ireg(r); - EI(0x67, 0, tr, r, 0); // jalr TR, 0(R) - } -} - -#if defined(CONFIG_TCC_BCHECK) - -static void gen_bounds_call(int v) -{ - Sym *sym = external_helper_sym(v); - - greloca(cur_text_section, sym, ind, R_RISCV_CALL_PLT, 0); - o(0x17 | (1 << 7)); // auipc TR, 0 %call(func) - EI(0x67, 0, 1, 1, 0); // jalr TR, r(TR) -} - -static void gen_bounds_prolog(void) -{ - /* leave some room for bound checking code */ - func_bound_offset = lbounds_section->data_offset; - func_bound_ind = ind; - func_bound_add_epilog = 0; - o(0x00000013); /* ld a0,#lbound section pointer */ - o(0x00000013); - o(0x00000013); /* nop -> call __bound_local_new */ - o(0x00000013); -} - -static void gen_bounds_epilog(void) -{ - addr_t saved_ind; - addr_t *bounds_ptr; - Sym *sym_data; - Sym label = {0}; - - int offset_modified = func_bound_offset != lbounds_section->data_offset; - - if (!offset_modified && !func_bound_add_epilog) - return; - - /* add end of table info */ - bounds_ptr = section_ptr_add(lbounds_section, sizeof(addr_t)); - *bounds_ptr = 0; - - sym_data = get_sym_ref(&char_pointer_type, lbounds_section, - func_bound_offset, PTR_SIZE); - - label.type.t = VT_VOID | VT_STATIC; - /* generate bound local allocation */ - if (offset_modified) { - saved_ind = ind; - ind = func_bound_ind; - put_extern_sym(&label, cur_text_section, ind, 0); - greloca(cur_text_section, sym_data, ind, R_RISCV_GOT_HI20, 0); - o(0x17 | (10 << 7)); // auipc a0, 0 %pcrel_hi(sym)+addend - greloca(cur_text_section, &label, ind, R_RISCV_PCREL_LO12_I, 0); - EI(0x03, 3, 10, 10, 0); // ld a0, 0(a0) - gen_bounds_call(TOK___bound_local_new); - ind = saved_ind; - label.c = 0; /* force new local ELF symbol */ - } - - /* generate bound check local freeing */ - o(0xe02a1101); /* addi sp,sp,-32 sd a0,0(sp) */ - o(0xa82ae42e); /* sd a1,8(sp) fsd fa0,16(sp) */ - put_extern_sym(&label, cur_text_section, ind, 0); - greloca(cur_text_section, sym_data, ind, R_RISCV_GOT_HI20, 0); - o(0x17 | (10 << 7)); // auipc a0, 0 %pcrel_hi(sym)+addend - greloca(cur_text_section, &label, ind, R_RISCV_PCREL_LO12_I, 0); - EI(0x03, 3, 10, 10, 0); // ld a0, 0(a0) - gen_bounds_call(TOK___bound_local_delete); - o(0x65a26502); /* ld a0,0(sp) ld a1,8(sp) */ - o(0x61052542); /* fld fa0,16(sp) addi sp,sp,32 */ -} -#endif - -static void reg_pass_rec(CType *type, int *rc, int *fieldofs, int ofs) -{ - if ((type->t & VT_BTYPE) == VT_STRUCT) { - Sym *f; - if (type->ref->type.t == VT_UNION) - rc[0] = -1; - else for (f = type->ref->next; f; f = f->next) - reg_pass_rec(&f->type, rc, fieldofs, ofs + f->c); - } else if (type->t & VT_ARRAY) { - if (type->ref->c < 0 || type->ref->c > 2) - rc[0] = -1; - else { - int a, sz = type_size(&type->ref->type, &a); - reg_pass_rec(&type->ref->type, rc, fieldofs, ofs); - if (rc[0] > 2 || (rc[0] == 2 && type->ref->c > 1)) - rc[0] = -1; - else if (type->ref->c == 2 && rc[0] && rc[1] == RC_FLOAT) { - rc[++rc[0]] = RC_FLOAT; - fieldofs[rc[0]] = ((ofs + sz) << 4) - | (type->ref->type.t & VT_BTYPE); - } else if (type->ref->c == 2) - rc[0] = -1; - } - } else if (rc[0] == 2 || rc[0] < 0 || (type->t & VT_BTYPE) == VT_LDOUBLE) - rc[0] = -1; - else if (!rc[0] || rc[1] == RC_FLOAT || is_float(type->t)) { - rc[++rc[0]] = is_float(type->t) ? RC_FLOAT : RC_INT; - fieldofs[rc[0]] = (ofs << 4) | ((type->t & VT_BTYPE) == VT_PTR ? VT_LLONG : type->t & VT_BTYPE); - } else - rc[0] = -1; -} - -static void reg_pass(CType *type, int *prc, int *fieldofs, int named) -{ - prc[0] = 0; - reg_pass_rec(type, prc, fieldofs, 0); - if (prc[0] <= 0 || !named) { - int align, size = type_size(type, &align); - prc[0] = (size + 7) >> 3; - prc[1] = prc[2] = RC_INT; - fieldofs[1] = (0 << 4) | (size <= 1 ? VT_BYTE : size <= 2 ? VT_SHORT : size <= 4 ? VT_INT : VT_LLONG); - fieldofs[2] = (8 << 4) | (size <= 9 ? VT_BYTE : size <= 10 ? VT_SHORT : size <= 12 ? VT_INT : VT_LLONG); - } -} - -ST_FUNC void gfunc_call(int nb_args) -{ - int i, align, size, areg[2]; - int *info = tcc_malloc((nb_args + 1) * sizeof (int)); - int stack_adj = 0, tempspace = 0, stack_add, ofs, splitofs = 0; - SValue *sv; - Sym *sa; - -#ifdef CONFIG_TCC_BCHECK - int bc_save = tcc_state->do_bounds_check; - if (tcc_state->do_bounds_check) - gbound_args(nb_args); -#endif - - areg[0] = 0; /* int arg regs */ - areg[1] = 8; /* float arg regs */ - sa = vtop[-nb_args].type.ref->next; - for (i = 0; i < nb_args; i++) { - int nregs, byref = 0, tempofs; - int prc[3], fieldofs[3]; - sv = &vtop[1 + i - nb_args]; - sv->type.t &= ~VT_ARRAY; // XXX this should be done in tccgen.c - size = type_size(&sv->type, &align); - if (size > 16) { - if (align < XLEN) - align = XLEN; - tempspace = (tempspace + align - 1) & -align; - tempofs = tempspace; - tempspace += size; - size = align = 8; - byref = 64 | (tempofs << 7); - } - reg_pass(&sv->type, prc, fieldofs, sa != 0); - if (!sa && align == 2*XLEN && size <= 2*XLEN) - areg[0] = (areg[0] + 1) & ~1; - nregs = prc[0]; - if (size == 0) - info[i] = 0; - else if ((prc[1] == RC_INT && areg[0] >= 8) - || (prc[1] == RC_FLOAT && areg[1] >= 16) - || (nregs == 2 && prc[1] == RC_FLOAT && prc[2] == RC_FLOAT - && areg[1] >= 15) - || (nregs == 2 && prc[1] != prc[2] - && (areg[1] >= 16 || areg[0] >= 8))) { - info[i] = 32; - if (align < XLEN) - align = XLEN; - stack_adj += (size + align - 1) & -align; - if (!sa) /* one vararg on stack forces the rest on stack */ - areg[0] = 8, areg[1] = 16; - } else { - info[i] = areg[prc[1] - 1]++; - if (!byref) - info[i] |= (fieldofs[1] & VT_BTYPE) << 12; - assert(!(fieldofs[1] >> 4)); - if (nregs == 2) { - if (prc[2] == RC_FLOAT || areg[0] < 8) - info[i] |= (1 + areg[prc[2] - 1]++) << 7; - else { - info[i] |= 16; - stack_adj += 8; - } - if (!byref) { - assert((fieldofs[2] >> 4) < 2048); - info[i] |= fieldofs[2] << (12 + 4); // includes offset - } - } - } - info[i] |= byref; - if (sa) - sa = sa->next; - } - stack_adj = (stack_adj + 15) & -16; - tempspace = (tempspace + 15) & -16; - stack_add = stack_adj + tempspace; - - /* fetch cpu flag before generating any code */ - if ((vtop->r & VT_VALMASK) == VT_CMP) - gv(RC_INT); - - - if (stack_add) { - if (stack_add >= 0x800) { - unsigned int bit11 = (((unsigned int)-stack_add) >> 11) & 1; - o(0x37 | (5 << 7) | - ((-stack_add + (bit11 << 12)) & 0xfffff000)); //lui t0, upper(v) - EI(0x13, 0, 5, 5, ((-stack_add & 0xfff) - bit11 * (1 << 12))); - // addi t0, t0, lo(v) - ER(0x33, 0, 2, 2, 5, 0); // add sp, sp, t0 - } - else - EI(0x13, 0, 2, 2, -stack_add); // addi sp, sp, -adj - for (i = ofs = 0; i < nb_args; i++) { - if (info[i] & (64 | 32)) { - vrotb(nb_args - i); - size = type_size(&vtop->type, &align); - if (info[i] & 64) { - vset(&char_pointer_type, TREG_SP, 0); - vpushi(stack_adj + (info[i] >> 7)); - gen_op('+'); - vpushv(vtop); // this replaces the old argument - vrott(3); - indir(); - vtop->type = vtop[-1].type; - vswap(); - vstore(); - vpop(); - size = align = 8; - } - if (info[i] & 32) { - if (align < XLEN) - align = XLEN; - /* Once we support offseted regs we can do this: - vset(&vtop->type, TREG_SP | VT_LVAL, ofs); - to construct the lvalue for the outgoing stack slot, - until then we have to jump through hoops. */ - vset(&char_pointer_type, TREG_SP, 0); - ofs = (ofs + align - 1) & -align; - vpushi(ofs); - gen_op('+'); - indir(); - vtop->type = vtop[-1].type; - vswap(); - vstore(); - vtop->r = vtop->r2 = VT_CONST; // this arg is done - ofs += size; - } - vrott(nb_args - i); - } else if (info[i] & 16) { - assert(!splitofs); - splitofs = ofs; - ofs += 8; - } - } - } - for (i = 0; i < nb_args; i++) { - int ii = info[nb_args - 1 - i], r = ii, r2 = r; - if (!(r & 32)) { - CType origtype; - int loadt; - r &= 15; - r2 = r2 & 64 ? 0 : (r2 >> 7) & 31; - assert(r2 <= 16); - vrotb(i+1); - origtype = vtop->type; - size = type_size(&vtop->type, &align); - if (size == 0) - goto done; - loadt = vtop->type.t & VT_BTYPE; - if (loadt == VT_STRUCT) { - loadt = (ii >> 12) & VT_BTYPE; - } - if (info[nb_args - 1 - i] & 16) { - assert(!r2); - r2 = 1 + TREG_RA; - } - if (loadt == VT_LDOUBLE) { - assert(r2); - r2--; - } else if (r2) { - test_lvalue(); - vpushv(vtop); - } - vtop->type.t = loadt | (vtop->type.t & VT_UNSIGNED); - gv(r < 8 ? RC_R(r) : RC_F(r - 8)); - vtop->type = origtype; - - if (r2 && loadt != VT_LDOUBLE) { - r2--; - assert(r2 < 16 || r2 == TREG_RA); - vswap(); - gaddrof(); - vtop->type = char_pointer_type; - vpushi(ii >> 20); -#ifdef CONFIG_TCC_BCHECK - if ((origtype.t & VT_BTYPE) == VT_STRUCT) - tcc_state->do_bounds_check = 0; -#endif - gen_op('+'); -#ifdef CONFIG_TCC_BCHECK - tcc_state->do_bounds_check = bc_save; -#endif - indir(); - vtop->type = origtype; - loadt = vtop->type.t & VT_BTYPE; - if (loadt == VT_STRUCT) { - loadt = (ii >> 16) & VT_BTYPE; - } - save_reg_upstack(r2, 1); - vtop->type.t = loadt | (vtop->type.t & VT_UNSIGNED); - load(r2, vtop); - assert(r2 < VT_CONST); - vtop--; - vtop->r2 = r2; - } - if (info[nb_args - 1 - i] & 16) { - ES(0x23, 3, 2, ireg(vtop->r2), splitofs); // sd t0, ofs(sp) - vtop->r2 = VT_CONST; - } else if (loadt == VT_LDOUBLE && vtop->r2 != r2) { - assert(vtop->r2 <= 7 && r2 <= 7); - /* XXX we'd like to have 'gv' move directly into - the right class instead of us fixing it up. */ - EI(0x13, 0, ireg(r2), ireg(vtop->r2), 0); // mv Ra+1, RR2 - vtop->r2 = r2; - } -done: - vrott(i+1); - } - } - vrotb(nb_args + 1); - save_regs(nb_args + 1); - gcall_or_jmp(1); - vtop -= nb_args + 1; - if (stack_add) { - if (stack_add >= 0x800) { - unsigned int bit11 = ((unsigned int)stack_add >> 11) & 1; - o(0x37 | (5 << 7) | - ((stack_add + (bit11 << 12)) & 0xfffff000)); //lui t0, upper(v) - EI(0x13, 0, 5, 5, (stack_add & 0xfff) - bit11 * (1 << 12)); - // addi t0, t0, lo(v) - ER(0x33, 0, 2, 2, 5, 0); // add sp, sp, t0 - } - else - EI(0x13, 0, 2, 2, stack_add); // addi sp, sp, adj - } - tcc_free(info); -} - -static int func_sub_sp_offset, num_va_regs, func_va_list_ofs; - -ST_FUNC void gfunc_prolog(Sym *func_sym) -{ - CType *func_type = &func_sym->type; - int i, addr, align, size; - int param_addr = 0; - int areg[2]; - Sym *sym; - CType *type; - - sym = func_type->ref; - loc = -16; // for ra and s0 - func_sub_sp_offset = ind; - ind += 5 * 4; - - areg[0] = 0, areg[1] = 0; - addr = 0; - /* if the function returns by reference, then add an - implicit pointer parameter */ - size = type_size(&func_vt, &align); - if (size > 2 * XLEN) { - loc -= 8; - func_vc = loc; - ES(0x23, 3, 8, 10 + areg[0]++, loc); // sd a0, loc(s0) - } - /* define parameters */ - while ((sym = sym->next) != NULL) { - int byref = 0; - int regcount; - int prc[3], fieldofs[3]; - type = &sym->type; - size = type_size(type, &align); - if (size > 2 * XLEN) { - type = &char_pointer_type; - size = align = byref = 8; - } - reg_pass(type, prc, fieldofs, 1); - regcount = prc[0]; - if (areg[prc[1] - 1] >= 8 - || (regcount == 2 - && ((prc[1] == RC_FLOAT && prc[2] == RC_FLOAT && areg[1] >= 7) - || (prc[1] != prc[2] && (areg[1] >= 8 || areg[0] >= 8))))) { - if (align < XLEN) - align = XLEN; - addr = (addr + align - 1) & -align; - param_addr = addr; - addr += size; - } else { - loc -= regcount * 8; // XXX could reserve only 'size' bytes - param_addr = loc; - for (i = 0; i < regcount; i++) { - if (areg[prc[1+i] - 1] >= 8) { - assert(i == 1 && regcount == 2 && !(addr & 7)); - EI(0x03, 3, 5, 8, addr); // ld t0, addr(s0) - addr += 8; - ES(0x23, 3, 8, 5, loc + i*8); // sd t0, loc(s0) - } else if (prc[1+i] == RC_FLOAT) { - ES(0x27, (size / regcount) == 4 ? 2 : 3, 8, 10 + areg[1]++, loc + (fieldofs[i+1] >> 4)); // fs[wd] FAi, loc(s0) - } else { - ES(0x23, 3, 8, 10 + areg[0]++, loc + i*8); // sd aX, loc(s0) // XXX - } - } - } - sym_push(sym->v & ~SYM_FIELD, &sym->type, - (byref ? VT_LLOCAL : VT_LOCAL) | VT_LVAL, - param_addr); - } - func_va_list_ofs = addr; - num_va_regs = 0; - if (func_var) { - for (; areg[0] < 8; areg[0]++) { - num_va_regs++; - ES(0x23, 3, 8, 10 + areg[0], -8 + num_va_regs * 8); // sd aX, loc(s0) - } - } -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_prolog(); -#endif -} - -ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, - int *ret_align, int *regsize) -{ - int align, size = type_size(vt, &align), nregs; - int prc[3], fieldofs[3]; - *ret_align = 1; - *regsize = 8; - if (size > 16) - return 0; - reg_pass(vt, prc, fieldofs, 1); - nregs = prc[0]; - if (nregs == 2 && prc[1] != prc[2]) - return -1; /* generic code can't deal with this case */ - if (prc[1] == RC_FLOAT) { - *regsize = size / nregs; - } - ret->t = fieldofs[1] & VT_BTYPE; - ret->ref = NULL; - return nregs; -} - -ST_FUNC void arch_transfer_ret_regs(int aftercall) -{ - int prc[3], fieldofs[3]; - reg_pass(&vtop->type, prc, fieldofs, 1); - assert(prc[0] == 2 && prc[1] != prc[2] && !(fieldofs[1] >> 4)); - assert(vtop->r == (VT_LOCAL | VT_LVAL)); - vpushv(vtop); - vtop->type.t = fieldofs[1] & VT_BTYPE; - (aftercall ? store : load)(prc[1] == RC_INT ? REG_IRET : REG_FRET, vtop); - vtop->c.i += fieldofs[2] >> 4; - vtop->type.t = fieldofs[2] & VT_BTYPE; - (aftercall ? store : load)(prc[2] == RC_INT ? REG_IRET : REG_FRET, vtop); - vtop--; -} - -ST_FUNC void gfunc_epilog(void) -{ - int v, saved_ind, d, large_ofs_ind; - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_epilog(); -#endif - - loc = (loc - num_va_regs * 8); - d = v = (-loc + 15) & -16; - - if (v >= (1 << 11)) { - d = 16; - o(0x37 | (5 << 7) | ((0x800 + (v-16)) & 0xfffff000)); //lui t0, upper(v) - EI(0x13, 0, 5, 5, (v-16) << 20 >> 20); // addi t0, t0, lo(v) - ER(0x33, 0, 2, 2, 5, 0); // add sp, sp, t0 - } - EI(0x03, 3, 1, 2, d - 8 - num_va_regs * 8); // ld ra, v-8(sp) - EI(0x03, 3, 8, 2, d - 16 - num_va_regs * 8); // ld s0, v-16(sp) - EI(0x13, 0, 2, 2, d); // addi sp, sp, v - EI(0x67, 0, 0, 1, 0); // jalr x0, 0(x1), aka ret - large_ofs_ind = ind; - if (v >= (1 << 11)) { - EI(0x13, 0, 8, 2, d - num_va_regs * 8); // addi s0, sp, d - o(0x37 | (5 << 7) | ((0x800 + (v-16)) & 0xfffff000)); //lui t0, upper(v) - EI(0x13, 0, 5, 5, (v-16) << 20 >> 20); // addi t0, t0, lo(v) - ER(0x33, 0, 2, 2, 5, 0x20); // sub sp, sp, t0 - gjmp_addr(func_sub_sp_offset + 5*4); - } - saved_ind = ind; - - ind = func_sub_sp_offset; - EI(0x13, 0, 2, 2, -d); // addi sp, sp, -d - ES(0x23, 3, 2, 1, d - 8 - num_va_regs * 8); // sd ra, d-8(sp) - ES(0x23, 3, 2, 8, d - 16 - num_va_regs * 8); // sd s0, d-16(sp) - if (v < (1 << 11)) - EI(0x13, 0, 8, 2, d - num_va_regs * 8); // addi s0, sp, d - else - gjmp_addr(large_ofs_ind); - if ((ind - func_sub_sp_offset) != 5*4) - EI(0x13, 0, 0, 0, 0); // addi x0, x0, 0 == nop - ind = saved_ind; -} - -ST_FUNC void gen_va_start(void) -{ - vtop--; - vset(&char_pointer_type, VT_LOCAL, func_va_list_ofs); -} - -ST_FUNC void gen_fill_nops(int bytes) -{ - if ((bytes & 3)) - tcc_error("alignment of code section not multiple of 4"); - while (bytes > 0) { - EI(0x13, 0, 0, 0, 0); // addi x0, x0, 0 == nop - bytes -= 4; - } -} - -// Generate forward branch to label: -ST_FUNC int gjmp(int t) -{ - if (nocode_wanted) - return t; - o(t); - return ind - 4; -} - -// Generate branch to known address: -ST_FUNC void gjmp_addr(int a) -{ - uint32_t r = a - ind, imm; - if ((r + (1 << 21)) & ~((1U << 22) - 2)) { - o(0x17 | (5 << 7) | (((r + 0x800) & 0xfffff000))); // lui RR, up(r) - r = (int)r << 20 >> 20; - EI(0x67, 0, 0, 5, r); // jalr x0, r(t0) - } else { - imm = (((r >> 12) & 0xff) << 12) - | (((r >> 11) & 1) << 20) - | (((r >> 1) & 0x3ff) << 21) - | (((r >> 20) & 1) << 31); - o(0x6f | imm); // jal x0, imm == j imm - } -} - -ST_FUNC int gjmp_cond(int op, int t) -{ - int tmp; - int a = vtop->cmp_r & 0xff; - int b = (vtop->cmp_r >> 8) & 0xff; - switch (op) { - case TOK_ULT: op = 6; break; - case TOK_UGE: op = 7; break; - case TOK_ULE: op = 7; tmp = a; a = b; b = tmp; break; - case TOK_UGT: op = 6; tmp = a; a = b; b = tmp; break; - case TOK_LT: op = 4; break; - case TOK_GE: op = 5; break; - case TOK_LE: op = 5; tmp = a; a = b; b = tmp; break; - case TOK_GT: op = 4; tmp = a; a = b; b = tmp; break; - case TOK_NE: op = 1; break; - case TOK_EQ: op = 0; break; - } - o(0x63 | (op ^ 1) << 12 | a << 15 | b << 20 | 8 << 7); // bOP a,b,+4 - return gjmp(t); -} - -ST_FUNC int gjmp_append(int n, int t) -{ - void *p; - /* insert jump list n into t */ - if (n) { - uint32_t n1 = n, n2; - while ((n2 = read32le(p = cur_text_section->data + n1))) - n1 = n2; - write32le(p, t); - t = n; - } - return t; -} - -static void gen_opil(int op, int ll) -{ - int a, b, d; - int func3 = 0; - ll = ll ? 0 : 8; - if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { - int fc = vtop->c.i; - if (fc == vtop->c.i && !(((unsigned)fc + (1 << 11)) >> 12)) { - int cll = 0; - int m = ll ? 31 : 63; - vswap(); - gv(RC_INT); - a = ireg(vtop[0].r); - --vtop; - d = get_reg(RC_INT); - ++vtop; - vswap(); - switch (op) { - case '-': - if (fc <= -(1 << 11)) - break; - fc = -fc; - case '+': - func3 = 0; // addi d, a, fc - cll = ll; - do_cop: - EI(0x13 | cll, func3, ireg(d), a, fc); - --vtop; - if (op >= TOK_ULT && op <= TOK_GT) { - vset_VT_CMP(TOK_NE); - vtop->cmp_r = ireg(d) | 0 << 8; - } else - vtop[0].r = d; - return; - case TOK_LE: - if (fc >= (1 << 11) - 1) - break; - ++fc; - case TOK_LT: func3 = 2; goto do_cop; // slti d, a, fc - case TOK_ULE: - if (fc >= (1 << 11) - 1 || fc == -1) - break; - ++fc; - case TOK_ULT: func3 = 3; goto do_cop; // sltiu d, a, fc - case '^': func3 = 4; goto do_cop; // xori d, a, fc - case '|': func3 = 6; goto do_cop; // ori d, a, fc - case '&': func3 = 7; goto do_cop; // andi d, a, fc - case TOK_SHL: func3 = 1; cll = ll; fc &= m; goto do_cop; // slli d, a, fc - case TOK_SHR: func3 = 5; cll = ll; fc &= m; goto do_cop; // srli d, a, fc - case TOK_SAR: func3 = 5; cll = ll; fc = 1024 | (fc & m); goto do_cop; - - case TOK_UGE: /* -> TOK_ULT */ - case TOK_UGT: /* -> TOK_ULE */ - case TOK_GE: /* -> TOK_LT */ - case TOK_GT: /* -> TOK_LE */ - gen_opil(op - 1, !ll); - vtop->cmp_op ^= 1; - return; - - case TOK_NE: - case TOK_EQ: - if (fc) - gen_opil('-', !ll), a = ireg(vtop++->r); - --vtop; - vset_VT_CMP(op); - vtop->cmp_r = a | 0 << 8; - return; - } - } - } - gv2(RC_INT, RC_INT); - a = ireg(vtop[-1].r); - b = ireg(vtop[0].r); - vtop -= 2; - d = get_reg(RC_INT); - vtop++; - vtop[0].r = d; - d = ireg(d); - switch (op) { - default: - if (op >= TOK_ULT && op <= TOK_GT) { - vset_VT_CMP(op); - vtop->cmp_r = a | b << 8; - break; - } - tcc_error("implement me: %s(%s)", __FUNCTION__, get_tok_str(op, NULL)); - break; - - case '+': - ER(0x33 | ll, 0, d, a, b, 0); // add d, a, b - break; - case '-': - ER(0x33 | ll, 0, d, a, b, 0x20); // sub d, a, b - break; - case TOK_SAR: - ER(0x33 | ll | ll, 5, d, a, b, 0x20); // sra d, a, b - break; - case TOK_SHR: - ER(0x33 | ll | ll, 5, d, a, b, 0); // srl d, a, b - break; - case TOK_SHL: - ER(0x33 | ll, 1, d, a, b, 0); // sll d, a, b - break; - case '*': - ER(0x33 | ll, 0, d, a, b, 1); // mul d, a, b - break; - case '/': - ER(0x33 | ll, 4, d, a, b, 1); // div d, a, b - break; - case '&': - ER(0x33, 7, d, a, b, 0); // and d, a, b - break; - case '^': - ER(0x33, 4, d, a, b, 0); // xor d, a, b - break; - case '|': - ER(0x33, 6, d, a, b, 0); // or d, a, b - break; - case '%': - ER(ll ? 0x3b: 0x33, 6, d, a, b, 1); // rem d, a, b - break; - case TOK_UMOD: - ER(0x33 | ll, 7, d, a, b, 1); // remu d, a, b - break; - case TOK_PDIV: - case TOK_UDIV: - ER(0x33 | ll, 5, d, a, b, 1); // divu d, a, b - break; - } -} - -ST_FUNC void gen_opi(int op) -{ - gen_opil(op, 0); -} - -ST_FUNC void gen_opl(int op) -{ - gen_opil(op, 1); -} - -ST_FUNC void gen_opf(int op) -{ - int rs1, rs2, rd, dbl, invert; - if (vtop[0].type.t == VT_LDOUBLE) { - CType type = vtop[0].type; - int func = 0; - int cond = -1; - switch (op) { - case '*': func = TOK___multf3; break; - case '+': func = TOK___addtf3; break; - case '-': func = TOK___subtf3; break; - case '/': func = TOK___divtf3; break; - case TOK_EQ: func = TOK___eqtf2; cond = 1; break; - case TOK_NE: func = TOK___netf2; cond = 0; break; - case TOK_LT: func = TOK___lttf2; cond = 10; break; - case TOK_GE: func = TOK___getf2; cond = 11; break; - case TOK_LE: func = TOK___letf2; cond = 12; break; - case TOK_GT: func = TOK___gttf2; cond = 13; break; - default: assert(0); break; - } - vpush_helper_func(func); - vrott(3); - gfunc_call(2); - vpushi(0); - vtop->r = REG_IRET; - vtop->r2 = cond < 0 ? TREG_R(1) : VT_CONST; - if (cond < 0) - vtop->type = type; - else { - vpushi(0); - gen_opil(op, 1); - } - return; - } - - gv2(RC_FLOAT, RC_FLOAT); - assert(vtop->type.t == VT_DOUBLE || vtop->type.t == VT_FLOAT); - dbl = vtop->type.t == VT_DOUBLE; - rs1 = freg(vtop[-1].r); - rs2 = freg(vtop->r); - vtop--; - invert = 0; - switch(op) { - default: - assert(0); - case '+': - op = 0; // fadd - arithop: - rd = get_reg(RC_FLOAT); - vtop->r = rd; - rd = freg(rd); - ER(0x53, 7, rd, rs1, rs2, dbl | (op << 2)); // fop.[sd] RD, RS1, RS2 (dyn rm) - break; - case '-': - op = 1; // fsub - goto arithop; - case '*': - op = 2; // fmul - goto arithop; - case '/': - op = 3; // fdiv - goto arithop; - case TOK_EQ: - op = 2; // EQ - cmpop: - rd = get_reg(RC_INT); - vtop->r = rd; - rd = ireg(rd); - ER(0x53, op, rd, rs1, rs2, dbl | 0x50); // fcmp.[sd] RD, RS1, RS2 (op == eq/lt/le) - if (invert) - EI(0x13, 4, rd, rd, 1); // xori RD, 1 - break; - case TOK_NE: - invert = 1; - op = 2; // EQ - goto cmpop; - case TOK_LT: - op = 1; // LT - goto cmpop; - case TOK_LE: - op = 0; // LE - goto cmpop; - case TOK_GT: - op = 1; // LT - rd = rs1, rs1 = rs2, rs2 = rd; - goto cmpop; - case TOK_GE: - op = 0; // LE - rd = rs1, rs1 = rs2, rs2 = rd; - goto cmpop; - } -} - -ST_FUNC void gen_cvt_sxtw(void) -{ - /* XXX on risc-v the registers are usually sign-extended already. - Let's try to not do anything here. */ -} - -ST_FUNC void gen_cvt_itof(int t) -{ - int rr = ireg(gv(RC_INT)), dr; - int u = vtop->type.t & VT_UNSIGNED; - int l = (vtop->type.t & VT_BTYPE) == VT_LLONG; - if (t == VT_LDOUBLE) { - int func = l ? - (u ? TOK___floatunditf : TOK___floatditf) : - (u ? TOK___floatunsitf : TOK___floatsitf); - vpush_helper_func(func); - vrott(2); - gfunc_call(1); - vpushi(0); - vtop->type.t = t; - vtop->r = REG_IRET; - vtop->r2 = TREG_R(1); - } else { - vtop--; - dr = get_reg(RC_FLOAT); - vtop++; - vtop->r = dr; - dr = freg(dr); - EIu(0x53, 7, dr, rr, ((0x68 | (t == VT_DOUBLE ? 1 : 0)) << 5) | (u ? 1 : 0) | (l ? 2 : 0)); // fcvt.[sd].[wl][u] - } -} - -ST_FUNC void gen_cvt_ftoi(int t) -{ - int ft = vtop->type.t & VT_BTYPE; - int l = (t & VT_BTYPE) == VT_LLONG; - int u = t & VT_UNSIGNED; - if (ft == VT_LDOUBLE) { - int func = l ? - (u ? TOK___fixunstfdi : TOK___fixtfdi) : - (u ? TOK___fixunstfsi : TOK___fixtfsi); - vpush_helper_func(func); - vrott(2); - gfunc_call(1); - vpushi(0); - vtop->type.t = t; - vtop->r = REG_IRET; - } else { - int rr = freg(gv(RC_FLOAT)), dr; - vtop--; - dr = get_reg(RC_INT); - vtop++; - vtop->r = dr; - dr = ireg(dr); - EIu(0x53, 1, dr, rr, ((0x60 | (ft == VT_DOUBLE ? 1 : 0)) << 5) | (u ? 1 : 0) | (l ? 2 : 0)); // fcvt.[wl][u].[sd] rtz - } -} - -ST_FUNC void gen_cvt_ftof(int dt) -{ - int st = vtop->type.t & VT_BTYPE, rs, rd; - dt &= VT_BTYPE; - if (st == dt) - return; - if (dt == VT_LDOUBLE || st == VT_LDOUBLE) { - int func = (dt == VT_LDOUBLE) ? - (st == VT_FLOAT ? TOK___extendsftf2 : TOK___extenddftf2) : - (dt == VT_FLOAT ? TOK___trunctfsf2 : TOK___trunctfdf2); - /* We can't use gfunc_call, as func_old_type works like vararg - functions, and on riscv unnamed float args are passed like - integers. But we really need them in the float argument registers - for extendsftf2/extenddftf2. So, do it explicitely. */ - save_regs(1); - if (dt == VT_LDOUBLE) - gv(RC_F(0)); - else { - gv(RC_R(0)); - assert(vtop->r2 < 7); - if (vtop->r2 != 1 + vtop->r) { - EI(0x13, 0, ireg(vtop->r) + 1, ireg(vtop->r2), 0); // mv Ra+1, RR2 - vtop->r2 = 1 + vtop->r; - } - } - vpush_helper_func(func); - gcall_or_jmp(1); - vtop -= 2; - vpushi(0); - vtop->type.t = dt; - if (dt == VT_LDOUBLE) - vtop->r = REG_IRET, vtop->r2 = REG_IRET+1; - else - vtop->r = REG_FRET; - } else { - assert (dt == VT_FLOAT || dt == VT_DOUBLE); - assert (st == VT_FLOAT || st == VT_DOUBLE); - rs = gv(RC_FLOAT); - rd = get_reg(RC_FLOAT); - if (dt == VT_DOUBLE) - EI(0x53, 0, freg(rd), freg(rs), 0x21 << 5); // fcvt.d.s RD, RS (no rm) - else - EI(0x53, 7, freg(rd), freg(rs), (0x20 << 5) | 1); // fcvt.s.d RD, RS (dyn rm) - vtop->r = rd; - } -} - -/* increment tcov counter */ -ST_FUNC void gen_increment_tcov (SValue *sv) -{ - int r1, r2; - Sym label = {0}; - label.type.t = VT_VOID | VT_STATIC; - - vpushv(sv); - vtop->r = r1 = get_reg(RC_INT); - r2 = get_reg(RC_INT); - r1 = ireg(r1); - r2 = ireg(r2); - greloca(cur_text_section, sv->sym, ind, R_RISCV_PCREL_HI20, 0); - put_extern_sym(&label, cur_text_section, ind, 0); - o(0x17 | (r1 << 7)); // auipc RR, 0 %pcrel_hi(sym) - greloca(cur_text_section, &label, ind, R_RISCV_PCREL_LO12_I, 0); - EI(0x03, 3, r2, r1, 0); // ld r2, x[r1] - EI(0x13, 0, r2, r2, 1); // addi r2, r2, #1 - greloca(cur_text_section, sv->sym, ind, R_RISCV_PCREL_HI20, 0); - label.c = 0; /* force new local ELF symbol */ - put_extern_sym(&label, cur_text_section, ind, 0); - o(0x17 | (r1 << 7)); // auipc RR, 0 %pcrel_hi(sym) - greloca(cur_text_section, &label, ind, R_RISCV_PCREL_LO12_S, 0); - ES(0x23, 3, r1, r2, 0); // sd r2, [r1] - vpop(); -} - -ST_FUNC void ggoto(void) -{ - gcall_or_jmp(0); - vtop--; -} - -ST_FUNC void gen_vla_sp_save(int addr) -{ - if (((unsigned)addr + (1 << 11)) >> 12) { - o(0x37 | (5 << 7) | ((0x800 + addr) & 0xfffff000)); //lui t0,upper(addr) - ER(0x33, 0, 5, 5, 8, 0); // add t0, t0, s0 - ES(0x23, 3, 5, 2, (int)addr << 20 >> 20); // sd sp, fc(t0) - } - else - ES(0x23, 3, 8, 2, addr); // sd sp, fc(s0) -} - -ST_FUNC void gen_vla_sp_restore(int addr) -{ - if (((unsigned)addr + (1 << 11)) >> 12) { - o(0x37 | (5 << 7) | ((0x800 + addr) & 0xfffff000)); //lui t0,upper(addr) - ER(0x33, 0, 5, 5, 8, 0); // add t0, t0, s0 - EI(0x03, 3, 2, 5, (int)addr << 20 >> 20); // ld sp, fc(t0) - } - else - EI(0x03, 3, 2, 8, addr); // ld sp, fc(s0) -} - -ST_FUNC void gen_vla_alloc(CType *type, int align) -{ - int rr; -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) - vpushv(vtop); -#endif - rr = ireg(gv(RC_INT)); -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) - EI(0x13, 0, rr, rr, 15+1); // addi RR, RR, 15+1 - else -#endif - EI(0x13, 0, rr, rr, 15); // addi RR, RR, 15 - EI(0x13, 7, rr, rr, -16); // andi, RR, RR, -16 - ER(0x33, 0, 2, 2, rr, 0x20); // sub sp, sp, rr - vpop(); -#if defined(CONFIG_TCC_BCHECK) - if (tcc_state->do_bounds_check) { - vpushi(0); - vtop->r = TREG_R(0); - o(0x00010513); /* mv a0,sp */ - vswap(); - vpush_helper_func(TOK___bound_new_region); - vrott(3); - gfunc_call(2); - func_bound_add_epilog = 1; - } -#endif -} -#endif diff --git a/riscv64-link.c b/riscv64-link.c deleted file mode 100644 index 5cdbe2f7..00000000 --- a/riscv64-link.c +++ /dev/null @@ -1,380 +0,0 @@ -#ifdef TARGET_DEFS_ONLY - -#define EM_TCC_TARGET EM_RISCV - -#define R_DATA_32 R_RISCV_32 -#define R_DATA_PTR R_RISCV_64 -#define R_JMP_SLOT R_RISCV_JUMP_SLOT -#define R_GLOB_DAT R_RISCV_64 -#define R_COPY R_RISCV_COPY -#define R_RELATIVE R_RISCV_RELATIVE - -#define R_NUM R_RISCV_NUM - -#define ELF_START_ADDR 0x00010000 -#define ELF_PAGE_SIZE 0x1000 - -#define PCRELATIVE_DLLPLT 1 -#define RELOCATE_DLLPLT 1 - -#else /* !TARGET_DEFS_ONLY */ - -//#define DEBUG_RELOC -#include "tcc.h" - -/* Returns 1 for a code relocation, 0 for a data relocation. For unknown - relocations, returns -1. */ -ST_FUNC int code_reloc (int reloc_type) -{ - switch (reloc_type) { - - case R_RISCV_BRANCH: - case R_RISCV_CALL: - case R_RISCV_JAL: - return 1; - - case R_RISCV_GOT_HI20: - case R_RISCV_PCREL_HI20: - case R_RISCV_PCREL_LO12_I: - case R_RISCV_PCREL_LO12_S: - case R_RISCV_32_PCREL: - case R_RISCV_SET6: - case R_RISCV_SET8: - case R_RISCV_SET16: - case R_RISCV_SUB6: - case R_RISCV_ADD16: - case R_RISCV_ADD32: - case R_RISCV_ADD64: - case R_RISCV_SUB8: - case R_RISCV_SUB16: - case R_RISCV_SUB32: - case R_RISCV_SUB64: - case R_RISCV_32: - case R_RISCV_64: - return 0; - - case R_RISCV_CALL_PLT: - return 1; - } - return -1; -} - -/* Returns an enumerator to describe whether and when the relocation needs a - GOT and/or PLT entry to be created. See tcc.h for a description of the - different values. */ -ST_FUNC int gotplt_entry_type (int reloc_type) -{ - switch (reloc_type) { - case R_RISCV_ALIGN: - case R_RISCV_RELAX: - case R_RISCV_RVC_BRANCH: - case R_RISCV_RVC_JUMP: - case R_RISCV_JUMP_SLOT: - case R_RISCV_SET6: - case R_RISCV_SET8: - case R_RISCV_SET16: - case R_RISCV_SUB6: - case R_RISCV_ADD16: - case R_RISCV_SUB8: - case R_RISCV_SUB16: - return NO_GOTPLT_ENTRY; - - case R_RISCV_BRANCH: - case R_RISCV_CALL: - case R_RISCV_PCREL_HI20: - case R_RISCV_PCREL_LO12_I: - case R_RISCV_PCREL_LO12_S: - case R_RISCV_32_PCREL: - case R_RISCV_ADD32: - case R_RISCV_ADD64: - case R_RISCV_SUB32: - case R_RISCV_SUB64: - case R_RISCV_32: - case R_RISCV_64: - case R_RISCV_JAL: - case R_RISCV_CALL_PLT: - return AUTO_GOTPLT_ENTRY; - - case R_RISCV_GOT_HI20: - return ALWAYS_GOTPLT_ENTRY; - } - return -1; -} - -ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr) -{ - Section *plt = s1->plt; - uint8_t *p; - unsigned plt_offset; - - if (plt->data_offset == 0) - section_ptr_add(plt, 32); - plt_offset = plt->data_offset; - - p = section_ptr_add(plt, 16); - write64le(p, got_offset); - return plt_offset; -} - -/* relocate the PLT: compute addresses and offsets in the PLT now that final - address for PLT and GOT are known (see fill_program_header) */ -ST_FUNC void relocate_plt(TCCState *s1) -{ - uint8_t *p, *p_end; - - if (!s1->plt) - return; - - p = s1->plt->data; - p_end = p + s1->plt->data_offset; - - if (p < p_end) { - uint64_t plt = s1->plt->sh_addr; - uint64_t got = s1->got->sh_addr; - uint64_t off = (got - plt + 0x800) >> 12; - if ((off + ((uint32_t)1 << 20)) >> 21) - tcc_error_noabort("Failed relocating PLT (off=0x%lx, got=0x%lx, plt=0x%lx)", (long)off, (long)got, (long)plt); - write32le(p, 0x397 | (off << 12)); // auipc t2, %pcrel_hi(got) - write32le(p + 4, 0x41c30333); // sub t1, t1, t3 - write32le(p + 8, 0x0003be03 // ld t3, %pcrel_lo(got)(t2) - | (((got - plt) & 0xfff) << 20)); - write32le(p + 12, 0xfd430313); // addi t1, t1, -(32+12) - write32le(p + 16, 0x00038293 // addi t0, t2, %pcrel_lo(got) - | (((got - plt) & 0xfff) << 20)); - write32le(p + 20, 0x00135313); // srli t1, t1, log2(16/PTRSIZE) - write32le(p + 24, 0x0082b283); // ld t0, PTRSIZE(t0) - write32le(p + 28, 0x000e0067); // jr t3 - p += 32; - while (p < p_end) { - uint64_t pc = plt + (p - s1->plt->data); - uint64_t addr = got + read64le(p); - uint64_t off = (addr - pc + 0x800) >> 12; - if ((off + ((uint32_t)1 << 20)) >> 21) - tcc_error_noabort("Failed relocating PLT (off=0x%lx, addr=0x%lx, pc=0x%lx)", (long)off, (long)addr, (long)pc); - write32le(p, 0xe17 | (off << 12)); // auipc t3, %pcrel_hi(func@got) - write32le(p + 4, 0x000e3e03 // ld t3, %pcrel_lo(func@got)(t3) - | (((addr - pc) & 0xfff) << 20)); - write32le(p + 8, 0x000e0367); // jalr t1, t3 - write32le(p + 12, 0x00000013); // nop - p += 16; - } - } - - if (s1->plt->reloc) { - ElfW_Rel *rel; - p = s1->got->data; - for_each_elem(s1->plt->reloc, 0, rel, ElfW_Rel) { - write64le(p + rel->r_offset, s1->plt->sh_addr); - } - } -} - -ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, - addr_t addr, addr_t val) -{ - uint64_t off64; - uint32_t off32; - int sym_index = ELFW(R_SYM)(rel->r_info), esym_index; - ElfW(Sym) *sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; - - switch(type) { - case R_RISCV_ALIGN: - case R_RISCV_RELAX: - return; - - case R_RISCV_BRANCH: - off64 = val - addr; - if ((off64 + (1 << 12)) & ~(uint64_t)0x1ffe) - tcc_error_noabort("R_RISCV_BRANCH relocation failed" - " (val=%lx, addr=%lx)", (long)val, (long)addr); - off32 = off64 >> 1; - write32le(ptr, (read32le(ptr) & ~0xfe000f80) - | ((off32 & 0x800) << 20) - | ((off32 & 0x3f0) << 21) - | ((off32 & 0x00f) << 8) - | ((off32 & 0x400) >> 3)); - return; - case R_RISCV_JAL: - off64 = val - addr; - if ((off64 + (1 << 21)) & ~(((uint64_t)1 << 22) - 2)) - tcc_error_noabort("R_RISCV_JAL relocation failed" - " (val=%lx, addr=%lx)", (long)val, (long)addr); - off32 = off64; - write32le(ptr, (read32le(ptr) & 0xfff) - | (((off32 >> 12) & 0xff) << 12) - | (((off32 >> 11) & 1) << 20) - | (((off32 >> 1) & 0x3ff) << 21) - | (((off32 >> 20) & 1) << 31)); - return; - case R_RISCV_CALL: - case R_RISCV_CALL_PLT: - write32le(ptr, (read32le(ptr) & 0xfff) - | ((val - addr + 0x800) & ~0xfff)); - write32le(ptr + 4, (read32le(ptr + 4) & 0xfffff) - | (((val - addr) & 0xfff) << 20)); - return; - case R_RISCV_PCREL_HI20: -#ifdef DEBUG_RELOC - printf("PCREL_HI20: val=%lx addr=%lx\n", (long)val, (long)addr); -#endif - off64 = (int64_t)(val - addr + 0x800) >> 12; - if ((off64 + ((uint64_t)1 << 20)) >> 21) - tcc_error_noabort("R_RISCV_PCREL_HI20 relocation failed: off=%lx cond=%lx sym=%s", - (long)off64, (long)((int64_t)(off64 + ((uint64_t)1 << 20)) >> 21), - symtab_section->link->data + sym->st_name); - write32le(ptr, (read32le(ptr) & 0xfff) - | ((off64 & 0xfffff) << 12)); - last_hi.addr = addr; - last_hi.val = val; - return; - case R_RISCV_GOT_HI20: - val = s1->got->sh_addr + get_sym_attr(s1, sym_index, 0)->got_offset; - off64 = (int64_t)(val - addr + 0x800) >> 12; - if ((off64 + ((uint64_t)1 << 20)) >> 21) - tcc_error_noabort("R_RISCV_GOT_HI20 relocation failed"); - last_hi.addr = addr; - last_hi.val = val; - write32le(ptr, (read32le(ptr) & 0xfff) - | ((off64 & 0xfffff) << 12)); - return; - case R_RISCV_PCREL_LO12_I: -#ifdef DEBUG_RELOC - printf("PCREL_LO12_I: val=%lx addr=%lx\n", (long)val, (long)addr); -#endif - if (val != last_hi.addr) - tcc_error_noabort("unsupported hi/lo pcrel reloc scheme"); - val = last_hi.val; - addr = last_hi.addr; - write32le(ptr, (read32le(ptr) & 0xfffff) - | (((val - addr) & 0xfff) << 20)); - return; - case R_RISCV_PCREL_LO12_S: - if (val != last_hi.addr) - tcc_error_noabort("unsupported hi/lo pcrel reloc scheme"); - val = last_hi.val; - addr = last_hi.addr; - off32 = val - addr; - write32le(ptr, (read32le(ptr) & ~0xfe000f80) - | ((off32 & 0xfe0) << 20) - | ((off32 & 0x01f) << 7)); - return; - - case R_RISCV_RVC_BRANCH: - off64 = (val - addr); - if ((off64 + (1 << 8)) & ~(uint64_t)0x1fe) - tcc_error_noabort("R_RISCV_RVC_BRANCH relocation failed" - " (val=%lx, addr=%lx)", (long)val, (long)addr); - off32 = off64; - write16le(ptr, (read16le(ptr) & 0xe383) - | (((off32 >> 5) & 1) << 2) - | (((off32 >> 1) & 3) << 3) - | (((off32 >> 6) & 3) << 5) - | (((off32 >> 3) & 3) << 10) - | (((off32 >> 8) & 1) << 12)); - return; - case R_RISCV_RVC_JUMP: - off64 = (val - addr); - if ((off64 + (1 << 11)) & ~(uint64_t)0xffe) - tcc_error_noabort("R_RISCV_RVC_BRANCH relocation failed" - " (val=%lx, addr=%lx)", (long)val, (long)addr); - off32 = off64; - write16le(ptr, (read16le(ptr) & 0xe003) - | (((off32 >> 5) & 1) << 2) - | (((off32 >> 1) & 7) << 3) - | (((off32 >> 7) & 1) << 6) - | (((off32 >> 6) & 1) << 7) - | (((off32 >> 10) & 1) << 8) - | (((off32 >> 8) & 3) << 9) - | (((off32 >> 4) & 1) << 11) - | (((off32 >> 11) & 1) << 12)); - return; - - case R_RISCV_32: - if (s1->output_type & TCC_OUTPUT_DYN) { - /* XXX: this logic may depend on TCC's codegen - now TCC uses R_RISCV_RELATIVE even for a 64bit pointer */ - qrel->r_offset = rel->r_offset; - qrel->r_info = ELFW(R_INFO)(0, R_RISCV_RELATIVE); - /* Use sign extension! */ - qrel->r_addend = (int)read32le(ptr) + val; - qrel++; - } - add32le(ptr, val); - return; - case R_RISCV_64: - if (s1->output_type & TCC_OUTPUT_DYN) { - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - qrel->r_offset = rel->r_offset; - if (esym_index) { - qrel->r_info = ELFW(R_INFO)(esym_index, R_RISCV_64); - qrel->r_addend = rel->r_addend; - qrel++; - break; - } else { - qrel->r_info = ELFW(R_INFO)(0, R_RISCV_RELATIVE); - qrel->r_addend = read64le(ptr) + val; - qrel++; - } - } - case R_RISCV_JUMP_SLOT: - add64le(ptr, val); - return; - case R_RISCV_ADD64: - write64le(ptr, read64le(ptr) + val); - return; - case R_RISCV_ADD32: - write32le(ptr, read32le(ptr) + val); - return; - case R_RISCV_SUB64: - write64le(ptr, read64le(ptr) - val); - return; - case R_RISCV_SUB32: - write32le(ptr, read32le(ptr) - val); - return; - case R_RISCV_ADD16: - write16le(ptr, read16le(ptr) + val); - return; - case R_RISCV_SUB8: - *ptr -= val; - return; - case R_RISCV_SUB16: - write16le(ptr, read16le(ptr) - val); - return; - case R_RISCV_SET6: - *ptr = (*ptr & ~0x3f) | (val & 0x3f); - return; - case R_RISCV_SET8: - *ptr = (*ptr & ~0xff) | (val & 0xff); - return; - case R_RISCV_SET16: - *ptr = (*ptr & ~0xffff) | (val & 0xffff); - return; - case R_RISCV_SUB6: - *ptr = (*ptr & ~0x3f) | ((*ptr - val) & 0x3f); - return; - case R_RISCV_32_PCREL: - if (s1->output_type & TCC_OUTPUT_DYN) { - /* DLL relocation */ - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - if (esym_index) { - qrel->r_offset = rel->r_offset; - qrel->r_info = ELFW(R_INFO)(esym_index, R_RISCV_32_PCREL); - /* Use sign extension! */ - qrel->r_addend = (int)read32le(ptr) + rel->r_addend; - qrel++; - break; - } - } - add32le(ptr, val - addr); - return; - case R_RISCV_COPY: - /* XXX */ - return; - - default: - fprintf(stderr, "FIXME: handle reloc type %x at %x [%p] to %x\n", - type, (unsigned)addr, ptr, (unsigned)val); - return; - } -} -#endif diff --git a/riscv64-tok.h b/riscv64-tok.h deleted file mode 100644 index 2bf3fe50..00000000 --- a/riscv64-tok.h +++ /dev/null @@ -1,477 +0,0 @@ -/* ------------------------------------------------------------------ */ -/* WARNING: relative order of tokens is important. */ - -/* - * The specifications are available under https://riscv.org/technical/specifications/ - */ - -#define DEF_ASM_WITH_SUFFIX(x, y) \ - DEF(TOK_ASM_ ## x ## _ ## y, #x "." #y) - -#define DEF_ASM_WITH_SUFFIXES(x, y, z) \ - DEF(TOK_ASM_ ## x ## _ ## y ## _ ## z, #x "." #y "." #z) - -#define DEF_ASM_FENCE(x) \ - DEF(TOK_ASM_ ## x ## _fence, #x) - -/* register */ - /* integer */ - DEF_ASM(x0) - DEF_ASM(x1) - DEF_ASM(x2) - DEF_ASM(x3) - DEF_ASM(x4) - DEF_ASM(x5) - DEF_ASM(x6) - DEF_ASM(x7) - DEF_ASM(x8) - DEF_ASM(x9) - DEF_ASM(x10) - DEF_ASM(x11) - DEF_ASM(x12) - DEF_ASM(x13) - DEF_ASM(x14) - DEF_ASM(x15) - DEF_ASM(x16) - DEF_ASM(x17) - DEF_ASM(x18) - DEF_ASM(x19) - DEF_ASM(x20) - DEF_ASM(x21) - DEF_ASM(x22) - DEF_ASM(x23) - DEF_ASM(x24) - DEF_ASM(x25) - DEF_ASM(x26) - DEF_ASM(x27) - DEF_ASM(x28) - DEF_ASM(x29) - DEF_ASM(x30) - DEF_ASM(x31) - /* float */ - DEF_ASM(f0) - DEF_ASM(f1) - DEF_ASM(f2) - DEF_ASM(f3) - DEF_ASM(f4) - DEF_ASM(f5) - DEF_ASM(f6) - DEF_ASM(f7) - DEF_ASM(f8) - DEF_ASM(f9) - DEF_ASM(f10) - DEF_ASM(f11) - DEF_ASM(f12) - DEF_ASM(f13) - DEF_ASM(f14) - DEF_ASM(f15) - DEF_ASM(f16) - DEF_ASM(f17) - DEF_ASM(f18) - DEF_ASM(f19) - DEF_ASM(f20) - DEF_ASM(f21) - DEF_ASM(f22) - DEF_ASM(f23) - DEF_ASM(f24) - DEF_ASM(f25) - DEF_ASM(f26) - DEF_ASM(f27) - DEF_ASM(f28) - DEF_ASM(f29) - DEF_ASM(f30) - DEF_ASM(f31) - -/* register ABI mnemonics, refer to RISC-V ABI 1.0 */ - /* integer */ - DEF_ASM(zero) - DEF_ASM(ra) - DEF_ASM(sp) - DEF_ASM(gp) - DEF_ASM(tp) - DEF_ASM(t0) - DEF_ASM(t1) - DEF_ASM(t2) - DEF_ASM(s0) - DEF_ASM(s1) - DEF_ASM(a0) - DEF_ASM(a1) - DEF_ASM(a2) - DEF_ASM(a3) - DEF_ASM(a4) - DEF_ASM(a5) - DEF_ASM(a6) - DEF_ASM(a7) - DEF_ASM(s2) - DEF_ASM(s3) - DEF_ASM(s4) - DEF_ASM(s5) - DEF_ASM(s6) - DEF_ASM(s7) - DEF_ASM(s8) - DEF_ASM(s9) - DEF_ASM(s10) - DEF_ASM(s11) - DEF_ASM(t3) - DEF_ASM(t4) - DEF_ASM(t5) - DEF_ASM(t6) - /* float */ - DEF_ASM(ft0) - DEF_ASM(ft1) - DEF_ASM(ft2) - DEF_ASM(ft3) - DEF_ASM(ft4) - DEF_ASM(ft5) - DEF_ASM(ft6) - DEF_ASM(ft7) - DEF_ASM(fs0) - DEF_ASM(fs1) - DEF_ASM(fa0) - DEF_ASM(fa1) - DEF_ASM(fa2) - DEF_ASM(fa3) - DEF_ASM(fa4) - DEF_ASM(fa5) - DEF_ASM(fa6) - DEF_ASM(fa7) - DEF_ASM(fs2) - DEF_ASM(fs3) - DEF_ASM(fs4) - DEF_ASM(fs5) - DEF_ASM(fs6) - DEF_ASM(fs7) - DEF_ASM(fs8) - DEF_ASM(fs9) - DEF_ASM(fs10) - DEF_ASM(fs11) - DEF_ASM(ft8) - DEF_ASM(ft9) - DEF_ASM(ft10) - DEF_ASM(ft11) - /* not in the ABI */ - DEF_ASM(pc) - -/* Loads */ - - DEF_ASM(lb) - DEF_ASM(lh) - DEF_ASM(lw) - DEF_ASM(lbu) - DEF_ASM(lhu) - /* RV64 */ - DEF_ASM(ld) - DEF_ASM(lwu) - -/* Stores */ - - DEF_ASM(sb) - DEF_ASM(sh) - DEF_ASM(sw) - /* RV64 */ - DEF_ASM(sd) - -/* Shifts */ - - DEF_ASM(sll) - DEF_ASM(srl) - DEF_ASM(sra) - /* RV64 */ - DEF_ASM(slli) - DEF_ASM(srli) - DEF_ASM(sllw) - DEF_ASM(slliw) - DEF_ASM(srlw) - DEF_ASM(srliw) - DEF_ASM(srai) - DEF_ASM(sraw) - DEF_ASM(sraiw) - -/* Arithmetic */ - - DEF_ASM(add) - DEF_ASM(addi) - DEF_ASM(sub) - DEF_ASM(lui) - DEF_ASM(auipc) - /* RV64 */ - DEF_ASM(addw) - DEF_ASM(addiw) - DEF_ASM(subw) - -/* Logical */ - - DEF_ASM(xor) - DEF_ASM(xori) - DEF_ASM(or) - DEF_ASM(ori) - DEF_ASM(and) - DEF_ASM(andi) - -/* Compare */ - - DEF_ASM(slt) - DEF_ASM(slti) - DEF_ASM(sltu) - DEF_ASM(sltiu) - -/* Branch */ - - DEF_ASM(beq) - DEF_ASM(bne) - DEF_ASM(blt) - DEF_ASM(bge) - DEF_ASM(bltu) - DEF_ASM(bgeu) - -/* Jump */ - - DEF_ASM(jal) - DEF_ASM(jalr) - -/* Sync */ - - DEF_ASM(fence) - /* Zifencei extension */ - DEF_ASM_WITH_SUFFIX(fence, i) - -/* System call */ - - /* used to be called scall and sbreak */ - DEF_ASM(ecall) - DEF_ASM(ebreak) - -/* Counters */ - - DEF_ASM(rdcycle) - DEF_ASM(rdcycleh) - DEF_ASM(rdtime) - DEF_ASM(rdtimeh) - DEF_ASM(rdinstret) - DEF_ASM(rdinstreth) - -/* “M” Standard Extension for Integer Multiplication and Division, V2.0 */ - DEF_ASM(mul) - DEF_ASM(mulh) - DEF_ASM(mulhsu) - DEF_ASM(mulhu) - DEF_ASM(div) - DEF_ASM(divu) - DEF_ASM(rem) - DEF_ASM(remu) - /* RV64 */ - DEF_ASM(mulw) - DEF_ASM(divw) - DEF_ASM(divuw) - DEF_ASM(remw) - DEF_ASM(remuw) - -/* "C" Extension for Compressed Instructions, V2.0 */ - DEF_ASM_WITH_SUFFIX(c, nop) -/* Loads */ - DEF_ASM_WITH_SUFFIX(c, li) - DEF_ASM_WITH_SUFFIX(c, lw) - DEF_ASM_WITH_SUFFIX(c, lwsp) - /* single float */ - DEF_ASM_WITH_SUFFIX(c, flw) - DEF_ASM_WITH_SUFFIX(c, flwsp) - /* double float */ - DEF_ASM_WITH_SUFFIX(c, fld) - DEF_ASM_WITH_SUFFIX(c, fldsp) - /* RV64 */ - DEF_ASM_WITH_SUFFIX(c, ld) - DEF_ASM_WITH_SUFFIX(c, ldsp) - -/* Stores */ - - DEF_ASM_WITH_SUFFIX(c, sw) - DEF_ASM_WITH_SUFFIX(c, sd) - DEF_ASM_WITH_SUFFIX(c, swsp) - DEF_ASM_WITH_SUFFIX(c, sdsp) - /* single float */ - DEF_ASM_WITH_SUFFIX(c, fsw) - DEF_ASM_WITH_SUFFIX(c, fswsp) - /* double float */ - DEF_ASM_WITH_SUFFIX(c, fsd) - DEF_ASM_WITH_SUFFIX(c, fsdsp) - -/* Shifts */ - DEF_ASM_WITH_SUFFIX(c, slli) - DEF_ASM_WITH_SUFFIX(c, srli) - DEF_ASM_WITH_SUFFIX(c, srai) - -/* Arithmetic */ - DEF_ASM_WITH_SUFFIX(c, add) - DEF_ASM_WITH_SUFFIX(c, addi) - DEF_ASM_WITH_SUFFIX(c, addi16sp) - DEF_ASM_WITH_SUFFIX(c, addi4spn) - DEF_ASM_WITH_SUFFIX(c, lui) - DEF_ASM_WITH_SUFFIX(c, sub) - DEF_ASM_WITH_SUFFIX(c, mv) - /* RV64 */ - DEF_ASM_WITH_SUFFIX(c, addw) - DEF_ASM_WITH_SUFFIX(c, addiw) - DEF_ASM_WITH_SUFFIX(c, subw) - -/* Logical */ - DEF_ASM_WITH_SUFFIX(c, xor) - DEF_ASM_WITH_SUFFIX(c, or) - DEF_ASM_WITH_SUFFIX(c, and) - DEF_ASM_WITH_SUFFIX(c, andi) - -/* Branch */ - DEF_ASM_WITH_SUFFIX(c, beqz) - DEF_ASM_WITH_SUFFIX(c, bnez) - -/* Jump */ - DEF_ASM_WITH_SUFFIX(c, j) - DEF_ASM_WITH_SUFFIX(c, jr) - DEF_ASM_WITH_SUFFIX(c, jal) - DEF_ASM_WITH_SUFFIX(c, jalr) - -/* System call */ - DEF_ASM_WITH_SUFFIX(c, ebreak) - -/* XXX F Extension: Single-Precision Floating Point */ -/* XXX D Extension: Double-Precision Floating Point */ -/* from the spec: Tables 16.5–16.7 list the RVC instructions. */ - -/* “Zicsr”, Control and Status Register (CSR) Instructions, V2.0 */ - DEF_ASM(csrrw) - DEF_ASM(csrrs) - DEF_ASM(csrrc) - DEF_ASM(csrrwi) - DEF_ASM(csrrsi) - DEF_ASM(csrrci) - /* registers */ - DEF_ASM(cycle) - DEF_ASM(fcsr) - DEF_ASM(fflags) - DEF_ASM(frm) - DEF_ASM(instret) - DEF_ASM(time) - /* RV32I-only */ - DEF_ASM(cycleh) - DEF_ASM(instreth) - DEF_ASM(timeh) - /* pseudo */ - DEF_ASM(csrc) - DEF_ASM(csrci) - DEF_ASM(csrr) - DEF_ASM(csrs) - DEF_ASM(csrsi) - DEF_ASM(csrw) - DEF_ASM(csrwi) - DEF_ASM(frcsr) - DEF_ASM(frflags) - DEF_ASM(frrm) - DEF_ASM(fscsr) - DEF_ASM(fsflags) - DEF_ASM(fsrm) - -/* Privileged Instructions */ - - DEF_ASM(mrts) - DEF_ASM(mrth) - DEF_ASM(hrts) - DEF_ASM(wfi) - -/* pseudoinstructions */ - DEF_ASM(beqz) - DEF_ASM(bgez) - DEF_ASM(bgt) - DEF_ASM(bgtu) - DEF_ASM(bgtz) - DEF_ASM(ble) - DEF_ASM(bleu) - DEF_ASM(blez) - DEF_ASM(bltz) - DEF_ASM(bnez) - DEF_ASM(call) - DEF_ASM_WITH_SUFFIX(fabs, d) - DEF_ASM_WITH_SUFFIX(fabs, s) - DEF_ASM(fld) - DEF_ASM(flw) - DEF_ASM_WITH_SUFFIX(fmv, d) - DEF_ASM_WITH_SUFFIX(fmv, s) - DEF_ASM_WITH_SUFFIX(fneg, d) - DEF_ASM_WITH_SUFFIX(fneg, s) - DEF_ASM(fsd) - DEF_ASM(fsw) - DEF_ASM(j) - DEF_ASM(jump) - DEF_ASM(jr) - DEF_ASM(la) - DEF_ASM(li) - DEF_ASM(lla) - DEF_ASM(mv) - DEF_ASM(neg) - DEF_ASM(negw) - DEF_ASM(nop) - DEF_ASM(not) - DEF_ASM(ret) - DEF_ASM(seqz) - DEF_ASM_WITH_SUFFIX(sext, w) - DEF_ASM(sgtz) - DEF_ASM(sltz) - DEF_ASM(snez) - DEF_ASM(tail) - -/* Possible values for .option directive */ - DEF_ASM(arch) - DEF_ASM(rvc) - DEF_ASM(norvc) - DEF_ASM(pic) - DEF_ASM(nopic) - DEF_ASM(relax) - DEF_ASM(norelax) - DEF_ASM(push) - DEF_ASM(pop) - -/* “A” Standard Extension for Atomic Instructions, Version 2.1 */ - /* XXX: Atomic memory operations */ - DEF_ASM_WITH_SUFFIX(lr, w) - DEF_ASM_WITH_SUFFIXES(lr, w, aq) - DEF_ASM_WITH_SUFFIXES(lr, w, rl) - DEF_ASM_WITH_SUFFIXES(lr, w, aqrl) - - DEF_ASM_WITH_SUFFIX(lr, d) - DEF_ASM_WITH_SUFFIXES(lr, d, aq) - DEF_ASM_WITH_SUFFIXES(lr, d, rl) - DEF_ASM_WITH_SUFFIXES(lr, d, aqrl) - - - DEF_ASM_WITH_SUFFIX(sc, w) - DEF_ASM_WITH_SUFFIXES(sc, w, aq) - DEF_ASM_WITH_SUFFIXES(sc, w, rl) - DEF_ASM_WITH_SUFFIXES(sc, w, aqrl) - - DEF_ASM_WITH_SUFFIX(sc, d) - DEF_ASM_WITH_SUFFIXES(sc, d, aq) - DEF_ASM_WITH_SUFFIXES(sc, d, rl) - DEF_ASM_WITH_SUFFIXES(sc, d, aqrl) - -/* `fence` arguments */ -/* NOTE: Order is important */ - DEF_ASM_FENCE(w) - DEF_ASM_FENCE(r) - DEF_ASM_FENCE(rw) - - DEF_ASM_FENCE(o) - DEF_ASM_FENCE(ow) - DEF_ASM_FENCE(or) - DEF_ASM_FENCE(orw) - - DEF_ASM_FENCE(i) - DEF_ASM_FENCE(iw) - DEF_ASM_FENCE(ir) - DEF_ASM_FENCE(irw) - - DEF_ASM_FENCE(io) - DEF_ASM_FENCE(iow) - DEF_ASM_FENCE(ior) - DEF_ASM_FENCE(iorw) - -#undef DEF_ASM_FENCE -#undef DEF_ASM_WITH_SUFFIX -#undef DEF_ASM_WITH_SUFFIXES diff --git a/tcc.c b/tcc.c index e396a5d9..c6bb4534 100644 --- a/tcc.c +++ b/tcc.c @@ -18,18 +18,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ONE_SOURCE -# define ONE_SOURCE 1 -#endif - +#include "config.h" #include "tcc.h" -#if ONE_SOURCE -# include "libtcc.c" -#endif #include "tcctools.c" static const char help[] = - "Tiny C Compiler "TCC_VERSION" - Copyright (C) 2001-2006 Fabrice Bellard\n" + "Tiny C Compiler "PACKAGE_VERSION" - Copyright (C) 2001-2006 Fabrice Bellard\n" "Usage: tcc [options...] [-o outfile] [-c] infile(s)...\n" " tcc [options...] -run infile (or --) [arguments...]\n" "General options:\n" @@ -61,9 +55,6 @@ static const char help[] = "Debugger options:\n" " -g generate stab runtime debug info\n" " -gdwarf[-x] generate dwarf runtime debug info\n" -#ifdef TCC_TARGET_PE - " -g.pdb create .pdb debug database\n" -#endif #ifdef CONFIG_TCC_BCHECK " -b compile with built-in memory and bounds checker (implies -g)\n" #endif @@ -79,18 +70,12 @@ static const char help[] = " -M[M]D generate make dependency file [ignore system files]\n" " -M[M] as above but no other output\n" " -MF file specify dependency file name\n" -#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64) - " -m32/64 defer to i386/x86_64 cross compiler\n" -#endif "Tools:\n" " create library : tcc -ar [crstvx] lib [files]\n" -#ifdef TCC_TARGET_PE - " create def file : tcc -impdef lib.dll [-v] [-o lib.def]\n" -#endif ; static const char help2[] = - "Tiny C Compiler "TCC_VERSION" - More Options\n" + "Tiny C Compiler "PACKAGE_VERSION" - More Options\n" "Special options:\n" " -P -P1 with -E: no/alternative #line output\n" " -dD -dM with -E: output #define directives\n" @@ -125,12 +110,6 @@ static const char help2[] = " test-coverage create code coverage code\n" "-m... target specific options:\n" " ms-bitfields use MSVC bitfield layout\n" -#ifdef TCC_TARGET_ARM - " float-abi hard/softfp on arm\n" -#endif -#ifdef TCC_TARGET_X86_64 - " no-sse disable floats on x86_64\n" -#endif "-Wl,... linker options:\n" " -nostdlib do not link with standard crt/libs\n" " -[no-]whole-archive load lib(s) fully/only as needed\n" @@ -138,69 +117,20 @@ static const char help2[] = " -export-dynamic same as -rdynamic\n" " -image-base= -Ttext= set base address of executable\n" " -section-alignment= set section alignment in executable\n" -#ifdef TCC_TARGET_PE - " -file-alignment= set PE file alignment\n" - " -stack= set PE stack reserve\n" - " -large-address-aware set related PE option\n" - " -subsystem=[console/windows] set PE subsystem\n" - " -oformat=[pe-* binary] set executable output format\n" - "Predefined macros:\n" - " tcc -E -dM - < nul\n" -#else " -rpath= set dynamic library search path\n" " -enable-new-dtags set DT_RUNPATH instead of DT_RPATH\n" " -soname= set DT_SONAME elf tag\n" -#if defined(TCC_TARGET_MACHO) - " -install_name= set DT_SONAME elf tag (soname macOS alias)\n" -#endif " -Bsymbolic set DT_SYMBOLIC elf tag\n" " -oformat=[elf32/64-* binary] set executable output format\n" " -init= -fini= -Map= -as-needed -O (ignored)\n" "Predefined macros:\n" " tcc -E -dM - < /dev/null\n" -#endif "See also the manual for more details.\n" ; static const char version[] = - "tcc version "TCC_VERSION -#ifdef TCC_GITHASH - " "TCC_GITHASH -#endif - " (" -#ifdef TCC_TARGET_I386 - "i386" -#elif defined TCC_TARGET_X86_64 - "x86_64" -#elif defined TCC_TARGET_C67 - "C67" -#elif defined TCC_TARGET_ARM - "ARM" -# ifdef TCC_ARM_EABI - " eabi" -# ifdef TCC_ARM_HARDFLOAT - "hf" -# endif -# endif -#elif defined TCC_TARGET_ARM64 - "AArch64" -#elif defined TCC_TARGET_RISCV64 - "riscv64" -#endif -#ifdef TCC_TARGET_PE - " Windows" -#elif defined(TCC_TARGET_MACHO) - " Darwin" -#elif TARGETOS_FreeBSD || TARGETOS_FreeBSD_kernel - " FreeBSD" -#elif TARGETOS_OpenBSD - " OpenBSD" -#elif TARGETOS_NetBSD - " NetBSD" -#else - " Linux" -#endif - ")\n" + "tcc version "PACKAGE_VERSION + " (i386)\n" ; static void print_dirs(const char *msg, char **paths, int nb_paths) @@ -218,10 +148,8 @@ static void print_search_dirs(TCCState *s) print_dirs("include", s->sysinclude_paths, s->nb_sysinclude_paths); print_dirs("libraries", s->library_paths, s->nb_library_paths); printf("libtcc1:\n %s/%s\n", s->library_paths[0], CONFIG_TCC_CROSSPREFIX TCC_LIBTCC1); -#if !defined TCC_TARGET_PE && !defined TCC_TARGET_MACHO print_dirs("crt", s->crt_paths, s->nb_crt_paths); printf("elfinterp:\n %s\n", DEFAULT_ELFINTERP(s)); -#endif } static void set_environment(TCCState *s) @@ -252,16 +180,8 @@ static char *default_outputfile(TCCState *s, const char *first_file) name = tcc_basename(first_file); snprintf(buf, sizeof(buf), "%s", name); ext = tcc_fileextension(buf); -#ifdef TCC_TARGET_PE - if (s->output_type == TCC_OUTPUT_DLL) - strcpy(ext, ".dll"); - else - if (s->output_type == TCC_OUTPUT_EXE) - strcpy(ext, ".exe"); - else -#endif if ((s->just_deps || s->output_type == TCC_OUTPUT_OBJ) && !s->option_r && *ext) - strcpy(ext, ".o"); + strcpy(ext, ".obj"); else strcpy(buf, "a.out"); return tcc_strdup(buf); @@ -314,10 +234,6 @@ redo: printf("%s", version); if (opt == OPT_AR) return tcc_tool_ar(s, argc, argv); -#ifdef TCC_TARGET_PE - if (opt == OPT_IMPDEF) - return tcc_tool_impdef(s, argc, argv); -#endif if (opt == OPT_V) return 0; if (opt == OPT_PRINT_DIRS) { @@ -391,9 +307,6 @@ redo: ; } else if (0 == ret) { if (s->output_type == TCC_OUTPUT_MEMORY) { -#ifdef TCC_IS_NATIVE - ret = tcc_run(s, argc, argv); -#endif } else { if (!s->outfile) s->outfile = default_outputfile(s, first_file); diff --git a/tcc.h b/tcc.h index 84e27bc2..d6352880 100644 --- a/tcc.h +++ b/tcc.h @@ -147,46 +147,7 @@ extern long double strtold (const char *__nptr, char **__endptr); /* #define TCC_TARGET_RISCV64 *//* risc-v code generator */ /* default target is I386 */ -#if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_ARM) && \ - !defined(TCC_TARGET_ARM64) && !defined(TCC_TARGET_C67) && \ - !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_RISCV64) -# if defined __x86_64__ -# define TCC_TARGET_X86_64 -# elif defined __arm__ -# define TCC_TARGET_ARM -# define TCC_ARM_EABI -# define TCC_ARM_VFP -# define TCC_ARM_HARDFLOAT -# elif defined __aarch64__ -# define TCC_TARGET_ARM64 -# elif defined __riscv -# define TCC_TARGET_RISCV64 -# else # define TCC_TARGET_I386 -# endif -# ifdef _WIN32 -# define TCC_TARGET_PE 1 -# endif -# ifdef __APPLE__ -# define TCC_TARGET_MACHO 1 -# endif -#endif - -/* only native compiler supports -run */ -#if defined _WIN32 == defined TCC_TARGET_PE \ - && defined __APPLE__ == defined TCC_TARGET_MACHO -# if defined __i386__ && defined TCC_TARGET_I386 -# define TCC_IS_NATIVE -# elif defined __x86_64__ && defined TCC_TARGET_X86_64 -# define TCC_IS_NATIVE -# elif defined __arm__ && defined TCC_TARGET_ARM -# define TCC_IS_NATIVE -# elif defined __aarch64__ && defined TCC_TARGET_ARM64 -# define TCC_IS_NATIVE -# elif defined __riscv && defined __LP64__ && defined TCC_TARGET_RISCV64 -# define TCC_IS_NATIVE -# endif -#endif #if defined CONFIG_TCC_BACKTRACE && CONFIG_TCC_BACKTRACE==0 # undef CONFIG_TCC_BACKTRACE @@ -200,33 +161,6 @@ extern long double strtold (const char *__nptr, char **__endptr); # define CONFIG_TCC_BCHECK 1 /* enable bound checking code */ #endif -#if defined CONFIG_NEW_MACHO && CONFIG_NEW_MACHO==0 -# undef CONFIG_NEW_MACHO -#else -# define CONFIG_NEW_MACHO 1 /* enable new macho code */ -#endif - -#if defined TARGETOS_OpenBSD \ - || defined TARGETOS_FreeBSD \ - || defined TARGETOS_NetBSD \ - || defined TARGETOS_FreeBSD_kernel -# define TARGETOS_BSD 1 -#elif !(defined TCC_TARGET_PE || defined TCC_TARGET_MACHO) -# define TARGETOS_Linux 1 /* for tccdefs_.h */ -#endif - -#if defined TCC_TARGET_PE || defined TCC_TARGET_MACHO -# define ELF_OBJ_ONLY /* create elf .o but native executables */ -#endif - -/* No ten-byte long doubles on window and macos except in - cross-compilers made by a mingw-GCC */ -#if defined TCC_TARGET_PE \ - || (defined TCC_TARGET_MACHO && defined TCC_TARGET_ARM64) \ - || (defined _WIN32 && !defined __GNUC__) -# define TCC_USING_DOUBLE_FOR_LDOUBLE 1 -#endif - #ifdef CONFIG_TCC_PIE # define CONFIG_TCC_PIC 1 #endif @@ -343,19 +277,9 @@ extern long double strtold (const char *__nptr, char **__endptr); # define PUB_FUNC #endif -#ifndef ONE_SOURCE -# define ONE_SOURCE 0 -#endif - -#if ONE_SOURCE -#define ST_INLN static inline -#define ST_FUNC static -#define ST_DATA static -#else #define ST_INLN #define ST_FUNC #define ST_DATA extern -#endif #ifdef TCC_PROFILE /* profile all functions */ # define static @@ -366,60 +290,22 @@ extern long double strtold (const char *__nptr, char **__endptr); /* include the target specific definitions */ #define TARGET_DEFS_ONLY -#ifdef TCC_TARGET_I386 # include "i386-gen.c" # include "i386-link.c" -#elif defined TCC_TARGET_X86_64 -# include "x86_64-gen.c" -# include "x86_64-link.c" -#elif defined TCC_TARGET_ARM -# include "arm-gen.c" -# include "arm-link.c" -# include "arm-asm.c" -#elif defined TCC_TARGET_ARM64 -# include "arm64-gen.c" -# include "arm64-link.c" -# include "arm-asm.c" -#elif defined TCC_TARGET_C67 -# define TCC_TARGET_COFF -# include "coff.h" -# include "c67-gen.c" -# include "c67-link.c" -#elif defined(TCC_TARGET_RISCV64) -# include "riscv64-gen.c" -# include "riscv64-link.c" -# include "riscv64-asm.c" -#else -#error unknown target -#endif #undef TARGET_DEFS_ONLY -/* -------------------------------------------- */ - -#if PTR_SIZE == 8 -# define ELFCLASSW ELFCLASS64 -# define ElfW(type) Elf##64##_##type -# define ELFW(type) ELF##64##_##type -# define ElfW_Rel ElfW(Rela) -# define SHT_RELX SHT_RELA -# define REL_SECTION_FMT ".rela%s" -#else # define ELFCLASSW ELFCLASS32 # define ElfW(type) Elf##32##_##type # define ELFW(type) ELF##32##_##type # define ElfW_Rel ElfW(Rel) # define SHT_RELX SHT_REL # define REL_SECTION_FMT ".rel%s" -#endif + /* target address type */ #define addr_t ElfW(Addr) #define ElfSym ElfW(Sym) -#if PTR_SIZE == 8 && !defined TCC_TARGET_PE -# define LONG_SIZE 8 -#else # define LONG_SIZE 4 -#endif /* -------------------------------------------- */ @@ -1710,51 +1596,7 @@ ST_FUNC void gen_cvt_csti(int t); ST_FUNC void gen_increment_tcov (SValue *sv); #endif -/* ------------ x86_64-gen.c ------------ */ -#ifdef TCC_TARGET_X86_64 -ST_FUNC void gen_addr64(int r, Sym *sym, int64_t c); -ST_FUNC void gen_opl(int op); -#ifdef TCC_TARGET_PE -ST_FUNC void gen_vla_result(int addr); -#endif -ST_FUNC void gen_cvt_sxtw(void); -ST_FUNC void gen_cvt_csti(int t); -#endif -/* ------------ arm-gen.c ------------ */ -#ifdef TCC_TARGET_ARM -#if defined(TCC_ARM_EABI) && !defined(CONFIG_TCC_ELFINTERP) -PUB_FUNC const char *default_elfinterp(struct TCCState *s); -#endif -ST_FUNC void arm_init(struct TCCState *s); -ST_FUNC void gen_increment_tcov (SValue *sv); -#endif - -/* ------------ arm64-gen.c ------------ */ -#ifdef TCC_TARGET_ARM64 -ST_FUNC void gen_opl(int op); -ST_FUNC void gfunc_return(CType *func_type); -ST_FUNC void gen_va_start(void); -ST_FUNC void gen_va_arg(CType *t); -ST_FUNC void gen_clear_cache(void); -ST_FUNC void gen_cvt_sxtw(void); -ST_FUNC void gen_cvt_csti(int t); -ST_FUNC void gen_increment_tcov (SValue *sv); -#endif - -/* ------------ riscv64-gen.c ------------ */ -#ifdef TCC_TARGET_RISCV64 -ST_FUNC void gen_opl(int op); -//ST_FUNC void gfunc_return(CType *func_type); -ST_FUNC void gen_va_start(void); -ST_FUNC void arch_transfer_ret_regs(int); -ST_FUNC void gen_cvt_sxtw(void); -ST_FUNC void gen_increment_tcov (SValue *sv); -#endif - -/* ------------ c67-gen.c ------------ */ -#ifdef TCC_TARGET_C67 -#endif /* ------------ tcccoff.c ------------ */ #ifdef TCC_TARGET_COFF @@ -1773,9 +1615,6 @@ ST_FUNC void asm_expr(TCCState *s1, ExprValue *pe); ST_FUNC int asm_int_expr(TCCState *s1); /* ------------ i386-asm.c ------------ */ ST_FUNC void gen_expr32(ExprValue *pe); -#ifdef TCC_TARGET_X86_64 -ST_FUNC void gen_expr64(ExprValue *pe); -#endif ST_FUNC void asm_opcode(TCCState *s1, int opcode); ST_FUNC int asm_parse_regvar(int t); ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg); @@ -1784,56 +1623,12 @@ ST_FUNC void asm_gen_code(ASMOperand *operands, int nb_operands, int nb_outputs, ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str); #endif -/* ------------ tccpe.c -------------- */ -#ifdef TCC_TARGET_PE -ST_FUNC int pe_load_file(struct TCCState *s1, int fd, const char *filename); -ST_FUNC int pe_output_file(TCCState * s1, const char *filename); -ST_FUNC int pe_putimport(TCCState *s1, int dllindex, const char *name, addr_t value); -#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 -#endif -#ifdef TCC_TARGET_X86_64 -ST_FUNC void pe_add_unwind_data(unsigned start, unsigned end, unsigned stack); -#endif -PUB_FUNC int tcc_get_dllexports(const char *filename, char **pp); -/* symbol properties stored in Elf32_Sym->st_other */ -# define ST_PE_EXPORT 0x10 -# define ST_PE_IMPORT 0x20 -# define ST_PE_STDCALL 0x40 -#endif #define ST_ASM_SET 0x04 -/* ------------ tccmacho.c ----------------- */ -#ifdef TCC_TARGET_MACHO -ST_FUNC int macho_output_file(TCCState * s1, const char *filename); -ST_FUNC int macho_load_dll(TCCState *s1, int fd, const char *filename, int lev); -ST_FUNC int macho_load_tbd(TCCState *s1, int fd, const char *filename, int lev); -#ifdef TCC_IS_NATIVE -ST_FUNC void tcc_add_macos_sdkpath(TCCState* s); -ST_FUNC const char* macho_tbd_soname(const char* filename); -#endif -#endif -/* ------------ tccrun.c ----------------- */ -#ifdef TCC_IS_NATIVE -#ifdef CONFIG_TCC_STATIC -#define RTLD_LAZY 0x001 -#define RTLD_NOW 0x002 -#define RTLD_GLOBAL 0x100 -#define RTLD_DEFAULT NULL -/* dummy function for profiling */ -ST_FUNC void *dlopen(const char *filename, int flag); -ST_FUNC void dlclose(void *p); -ST_FUNC const char *dlerror(void); -ST_FUNC void *dlsym(void *handle, const char *symbol); -#endif -ST_FUNC void tcc_run_free(TCCState *s1); -#endif /* ------------ tcctools.c ----------------- */ #if 0 /* included in tcc.c */ ST_FUNC int tcc_tool_ar(TCCState *s, int argc, char **argv); -#ifdef TCC_TARGET_PE -ST_FUNC int tcc_tool_impdef(TCCState *s, int argc, char **argv); -#endif ST_FUNC int tcc_tool_cross(TCCState *s, char **argv, int option); ST_FUNC int gen_makedeps(TCCState *s, const char *target, const char *filename); #endif diff --git a/tccasm.c b/tccasm.c index 5dea167b..52d81fa8 100644 --- a/tccasm.c +++ b/tccasm.c @@ -541,10 +541,6 @@ static void asm_parse_directive(TCCState *s1, int global) ind += size; break; case TOK_ASMDIR_quad: -#ifdef TCC_TARGET_X86_64 - size = 8; - goto asm_data; -#else next(); for(;;) { uint64_t vl; @@ -571,7 +567,6 @@ static void asm_parse_directive(TCCState *s1, int global) next(); } break; -#endif case TOK_ASMDIR_byte: size = 1; goto asm_data; @@ -590,10 +585,6 @@ static void asm_parse_directive(TCCState *s1, int global) if (sec->sh_type != SHT_NOBITS) { if (size == 4) { gen_expr32(&e); -#ifdef TCC_TARGET_X86_64 - } else if (size == 8) { - gen_expr64(&e); -#endif } else { if (e.sym) expect("constant"); @@ -926,7 +917,6 @@ static void asm_parse_directive(TCCState *s1, int global) next(); pop_section(s1); break; -#ifdef TCC_TARGET_I386 case TOK_ASMDIR_code16: { next(); @@ -939,38 +929,6 @@ static void asm_parse_directive(TCCState *s1, int global) s1->seg_size = 32; } break; -#endif -#ifdef TCC_TARGET_X86_64 - /* added for compatibility with GAS */ - case TOK_ASMDIR_code64: - next(); - break; -#endif -#ifdef TCC_TARGET_RISCV64 - case TOK_ASMDIR_option: - next(); - switch(tok){ - case TOK_ASM_rvc: /* Will be deprecated soon in favor of arch */ - case TOK_ASM_norvc: /* Will be deprecated soon in favor of arch */ - case TOK_ASM_pic: - case TOK_ASM_nopic: - case TOK_ASM_relax: - case TOK_ASM_norelax: - case TOK_ASM_push: - case TOK_ASM_pop: - /* TODO: unimplemented */ - next(); - break; - case TOK_ASM_arch: - /* TODO: unimplemented, requires extra parsing */ - tcc_error("unimp .option '.%s'", get_tok_str(tok, NULL)); - break; - default: - tcc_error("unknown .option '.%s'", get_tok_str(tok, NULL)); - break; - } - break; -#endif /* TODO: Implement symvar support. FreeBSD >= 14 needs this */ case TOK_ASMDIR_symver: next(); @@ -1071,9 +1029,7 @@ static void tcc_assemble_inline(TCCState *s1, const char *str, int len, int glob { const int *saved_macro_ptr = macro_ptr; int dotid = set_idnum('.', IS_ID); -#ifndef TCC_TARGET_RISCV64 int dolid = set_idnum('$', 0); -#endif tcc_open_bf(s1, ":asm:", len); memcpy(file->buffer, str, len); @@ -1081,9 +1037,7 @@ static void tcc_assemble_inline(TCCState *s1, const char *str, int len, int glob tcc_assemble_internal(s1, 0, global); tcc_close(); -#ifndef TCC_TARGET_RISCV64 set_idnum('$', dolid); -#endif set_idnum('.', dotid); macro_ptr = saved_macro_ptr; } @@ -1147,9 +1101,6 @@ static void subst_asm_operands(ASMOperand *operands, int nb_operands, if (*str == 'c' || *str == 'n' || *str == 'b' || *str == 'w' || *str == 'h' || *str == 'k' || *str == 'q' || *str == 'l' || -#ifdef TCC_TARGET_RISCV64 - *str == 'z' || -#endif /* P in GCC would add "@PLT" to symbol refs in PIC mode, and make literal operands not be decorated with '$'. */ *str == 'P') diff --git a/tcccoff.c b/tcccoff.c index 56064cdd..fbbc58ee 100644 --- a/tcccoff.c +++ b/tcccoff.c @@ -1,951 +1,83 @@ -/* - * COFF file handling for TCC - * - * Copyright (c) 2003, 2004 TK - * Copyright (c) 2004 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - +#include "coff.h" #include "tcc.h" -/* XXX: this file uses tcc_error() to the effect of exit(1) */ -#undef _tcc_error -#define MAXNSCNS 255 /* MAXIMUM NUMBER OF SECTIONS */ -#define MAX_STR_TABLE 1000000 -AOUTHDR o_filehdr; /* OPTIONAL (A.OUT) FILE HEADER */ - -SCNHDR section_header[MAXNSCNS]; - -#define MAX_FUNCS 1000 -#define MAX_FUNC_NAME_LENGTH 128 - -int nFuncs; -char Func[MAX_FUNCS][MAX_FUNC_NAME_LENGTH]; -char AssociatedFile[MAX_FUNCS][MAX_FUNC_NAME_LENGTH]; -int LineNoFilePtr[MAX_FUNCS]; -int EndAddress[MAX_FUNCS]; -int LastLineNo[MAX_FUNCS]; -int FuncEntries[MAX_FUNCS]; - -int OutputTheSection(Section * sect); -short int GetCoffFlags(const char *s); -void SortSymbolTable(TCCState *s1); -Section *FindSection(TCCState * s1, const char *sname); - -int C67_main_entry_point; - -int FindCoffSymbolIndex(TCCState * s1, const char *func_name); -int nb_syms; - -typedef struct { - long tag; - long size; - long fileptr; - long nextsym; - short int dummy; -} AUXFUNC; - -typedef struct { - long regmask; - unsigned short lineno; - unsigned short nentries; - int localframe; - int nextentry; - short int dummy; -} AUXBF; - -typedef struct { - long dummy; - unsigned short lineno; - unsigned short dummy1; - int dummy2; - int dummy3; - unsigned short dummy4; -} AUXEF; - -ST_FUNC int tcc_output_coff(TCCState *s1, FILE *f) +static int +read_mem(int fd, unsigned offset, void *buffer, unsigned len) { - Section *tcc_sect; - SCNHDR *coff_sec; - int file_pointer; - char *Coff_str_table, *pCoff_str_table; - int CoffTextSectionNo, coff_nb_syms; - FILHDR file_hdr; /* FILE HEADER STRUCTURE */ - Section *stext, *sdata, *sbss; - int i, NSectionsToOutput = 0; - - Coff_str_table = pCoff_str_table = NULL; - - stext = FindSection(s1, ".text"); - sdata = FindSection(s1, ".data"); - sbss = FindSection(s1, ".bss"); - - nb_syms = symtab_section->data_offset / sizeof(Elf32_Sym); - coff_nb_syms = FindCoffSymbolIndex(s1, "XXXXXXXXXX1"); - - file_hdr.f_magic = COFF_C67_MAGIC; /* magic number */ - file_hdr.f_timdat = 0; /* time & date stamp */ - file_hdr.f_opthdr = sizeof(AOUTHDR); /* sizeof(optional hdr) */ - file_hdr.f_flags = 0x1143; /* flags (copied from what code composer does) */ - file_hdr.f_TargetID = 0x99; /* for C6x = 0x0099 */ - - o_filehdr.magic = 0x0108; /* see magic.h */ - o_filehdr.vstamp = 0x0190; /* version stamp */ - o_filehdr.tsize = stext->data_offset; /* text size in bytes, padded to FW bdry */ - o_filehdr.dsize = sdata->data_offset; /* initialized data " " */ - o_filehdr.bsize = sbss->data_offset; /* uninitialized data " " */ - o_filehdr.entrypt = C67_main_entry_point; /* entry pt. */ - o_filehdr.text_start = stext->sh_addr; /* base of text used for this file */ - o_filehdr.data_start = sdata->sh_addr; /* base of data used for this file */ - - - // create all the section headers - - file_pointer = FILHSZ + sizeof(AOUTHDR); - - CoffTextSectionNo = -1; - - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - if (OutputTheSection(tcc_sect)) { - NSectionsToOutput++; - - if (CoffTextSectionNo == -1 && tcc_sect == stext) - CoffTextSectionNo = NSectionsToOutput; // rem which coff sect number the .text sect is - - strcpy(coff_sec->s_name, tcc_sect->name); /* section name */ - - coff_sec->s_paddr = tcc_sect->sh_addr; /* physical address */ - coff_sec->s_vaddr = tcc_sect->sh_addr; /* virtual address */ - coff_sec->s_size = tcc_sect->data_offset; /* section size */ - coff_sec->s_scnptr = 0; /* file ptr to raw data for section */ - coff_sec->s_relptr = 0; /* file ptr to relocation */ - coff_sec->s_lnnoptr = 0; /* file ptr to line numbers */ - coff_sec->s_nreloc = 0; /* number of relocation entries */ - coff_sec->s_flags = GetCoffFlags(coff_sec->s_name); /* flags */ - coff_sec->s_reserved = 0; /* reserved byte */ - coff_sec->s_page = 0; /* memory page id */ - - file_pointer += sizeof(SCNHDR); - } - } - - file_hdr.f_nscns = NSectionsToOutput; /* number of sections */ - - // now loop through and determine file pointer locations - // for the raw data - - - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - if (OutputTheSection(tcc_sect)) { - // put raw data - coff_sec->s_scnptr = file_pointer; /* file ptr to raw data for section */ - file_pointer += coff_sec->s_size; - } - } - - // now loop through and determine file pointer locations - // for the relocation data - - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - if (OutputTheSection(tcc_sect)) { - // put relocations data - if (coff_sec->s_nreloc > 0) { - coff_sec->s_relptr = file_pointer; /* file ptr to relocation */ - file_pointer += coff_sec->s_nreloc * sizeof(struct reloc); - } - } - } - - // now loop through and determine file pointer locations - // for the line number data - - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - coff_sec->s_nlnno = 0; - coff_sec->s_lnnoptr = 0; - - if (s1->do_debug && tcc_sect == stext) { - // count how many line nos data - - // also find association between source file name and function - // so we can sort the symbol table - - - Stab_Sym *sym, *sym_end; - char func_name[MAX_FUNC_NAME_LENGTH], - last_func_name[MAX_FUNC_NAME_LENGTH]; - unsigned long func_addr, last_pc, pc; - const char *incl_files[INCLUDE_STACK_SIZE]; - int incl_index, len, last_line_num; - const char *str, *p; - - coff_sec->s_lnnoptr = file_pointer; /* file ptr to linno */ - - - func_name[0] = '\0'; - func_addr = 0; - incl_index = 0; - last_func_name[0] = '\0'; - last_pc = 0xffffffff; - last_line_num = 1; - sym = (Stab_Sym *) stab_section->data + 1; - sym_end = - (Stab_Sym *) (stab_section->data + - stab_section->data_offset); - - nFuncs = 0; - while (sym < sym_end) { - switch (sym->n_type) { - /* function start or end */ - case N_FUN: - if (sym->n_strx == 0) { - // end of function - - coff_sec->s_nlnno++; - file_pointer += LINESZ; - - pc = sym->n_value + func_addr; - func_name[0] = '\0'; - func_addr = 0; - EndAddress[nFuncs] = pc; - FuncEntries[nFuncs] = - (file_pointer - - LineNoFilePtr[nFuncs]) / LINESZ - 1; - LastLineNo[nFuncs++] = last_line_num + 1; - } else { - // beginning of function - - LineNoFilePtr[nFuncs] = file_pointer; - coff_sec->s_nlnno++; - file_pointer += LINESZ; - - str = - (const char *) stabstr_section->data + - sym->n_strx; - - p = strchr(str, ':'); - if (!p) { - pstrcpy(func_name, sizeof(func_name), str); - pstrcpy(Func[nFuncs], sizeof(func_name), str); - } else { - len = p - str; - if (len > sizeof(func_name) - 1) - len = sizeof(func_name) - 1; - memcpy(func_name, str, len); - memcpy(Func[nFuncs], str, len); - func_name[len] = '\0'; - } - - // save the file that it came in so we can sort later - pstrcpy(AssociatedFile[nFuncs], sizeof(func_name), - incl_files[incl_index - 1]); - - func_addr = sym->n_value; - } - break; - - /* line number info */ - case N_SLINE: - pc = sym->n_value + func_addr; - - last_pc = pc; - last_line_num = sym->n_desc; - - /* XXX: slow! */ - strcpy(last_func_name, func_name); - - coff_sec->s_nlnno++; - file_pointer += LINESZ; - break; - /* include files */ - case N_BINCL: - str = - (const char *) stabstr_section->data + sym->n_strx; - add_incl: - if (incl_index < INCLUDE_STACK_SIZE) { - incl_files[incl_index++] = str; - } - break; - case N_EINCL: - if (incl_index > 1) - incl_index--; - break; - case N_SO: - if (sym->n_strx == 0) { - incl_index = 0; /* end of translation unit */ - } else { - str = - (const char *) stabstr_section->data + - sym->n_strx; - /* do not add path */ - len = strlen(str); - if (len > 0 && str[len - 1] != '/') - goto add_incl; - } - break; - } - sym++; - } - } - - } - - file_hdr.f_symptr = file_pointer; /* file pointer to symtab */ - - if (s1->do_debug) - file_hdr.f_nsyms = coff_nb_syms; /* number of symtab entries */ - else - file_hdr.f_nsyms = 0; - - file_pointer += file_hdr.f_nsyms * SYMNMLEN; - - // OK now we are all set to write the file - - - fwrite(&file_hdr, FILHSZ, 1, f); - fwrite(&o_filehdr, sizeof(o_filehdr), 1, f); - - // write section headers - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - if (OutputTheSection(tcc_sect)) { - fwrite(coff_sec, sizeof(SCNHDR), 1, f); - } - } - - // write raw data - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - if (OutputTheSection(tcc_sect)) { - fwrite(tcc_sect->data, tcc_sect->data_offset, 1, f); - } - } - - // write relocation data - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - if (OutputTheSection(tcc_sect)) { - // put relocations data - if (coff_sec->s_nreloc > 0) { - fwrite(tcc_sect->reloc, - coff_sec->s_nreloc * sizeof(struct reloc), 1, f); - } - } - } - - - // group the symbols in order of filename, func1, func2, etc - // finally global symbols - - if (s1->do_debug) - SortSymbolTable(s1); - - // write line no data - - for (i = 1; i < s1->nb_sections; i++) { - coff_sec = §ion_header[i]; - tcc_sect = s1->sections[i]; - - if (s1->do_debug && tcc_sect == stext) { - // count how many line nos data - - - Stab_Sym *sym, *sym_end; - char func_name[128], last_func_name[128]; - unsigned long func_addr, last_pc, pc; - const char *incl_files[INCLUDE_STACK_SIZE]; - int incl_index, len, last_line_num; - const char *str, *p; - - LINENO CoffLineNo; - - func_name[0] = '\0'; - func_addr = 0; - incl_index = 0; - last_func_name[0] = '\0'; - last_pc = 0; - last_line_num = 1; - sym = (Stab_Sym *) stab_section->data + 1; - sym_end = - (Stab_Sym *) (stab_section->data + - stab_section->data_offset); - - while (sym < sym_end) { - switch (sym->n_type) { - /* function start or end */ - case N_FUN: - if (sym->n_strx == 0) { - // end of function - - CoffLineNo.l_addr.l_paddr = last_pc; - CoffLineNo.l_lnno = last_line_num + 1; - fwrite(&CoffLineNo, 6, 1, f); - - pc = sym->n_value + func_addr; - func_name[0] = '\0'; - func_addr = 0; - } else { - // beginning of function - - str = - (const char *) stabstr_section->data + - sym->n_strx; - - - p = strchr(str, ':'); - if (!p) { - pstrcpy(func_name, sizeof(func_name), str); - } else { - len = p - str; - if (len > sizeof(func_name) - 1) - len = sizeof(func_name) - 1; - memcpy(func_name, str, len); - func_name[len] = '\0'; - } - func_addr = sym->n_value; - last_pc = func_addr; - last_line_num = -1; - - // output a function begin - - CoffLineNo.l_addr.l_symndx = - FindCoffSymbolIndex(s1, func_name); - CoffLineNo.l_lnno = 0; - - fwrite(&CoffLineNo, 6, 1, f); - } - break; - - /* line number info */ - case N_SLINE: - pc = sym->n_value + func_addr; - - - /* XXX: slow! */ - strcpy(last_func_name, func_name); - - // output a line reference - - CoffLineNo.l_addr.l_paddr = last_pc; - - if (last_line_num == -1) { - CoffLineNo.l_lnno = sym->n_desc; - } else { - CoffLineNo.l_lnno = last_line_num + 1; - } - - fwrite(&CoffLineNo, 6, 1, f); - - last_pc = pc; - last_line_num = sym->n_desc; - - break; - - /* include files */ - case N_BINCL: - str = - (const char *) stabstr_section->data + sym->n_strx; - add_incl2: - if (incl_index < INCLUDE_STACK_SIZE) { - incl_files[incl_index++] = str; - } - break; - case N_EINCL: - if (incl_index > 1) - incl_index--; - break; - case N_SO: - if (sym->n_strx == 0) { - incl_index = 0; /* end of translation unit */ - } else { - str = - (const char *) stabstr_section->data + - sym->n_strx; - /* do not add path */ - len = strlen(str); - if (len > 0 && str[len - 1] != '/') - goto add_incl2; - } - break; - } - sym++; - } - } - } - - // write symbol table - if (s1->do_debug) { - int k; - struct syment csym; - AUXFUNC auxfunc; - AUXBF auxbf; - AUXEF auxef; - int i; - Elf32_Sym *p; - const char *name; - int nstr; - int n = 0; - - Coff_str_table = (char *) tcc_malloc(MAX_STR_TABLE); - pCoff_str_table = Coff_str_table; - nstr = 0; - - p = (Elf32_Sym *) symtab_section->data; - - - for (i = 0; i < nb_syms; i++) { - - name = symtab_section->link->data + p->st_name; - - for (k = 0; k < 8; k++) - csym._n._n_name[k] = 0; - - if (strlen(name) <= 8) { - strcpy(csym._n._n_name, name); - } else { - if (pCoff_str_table - Coff_str_table + strlen(name) > - MAX_STR_TABLE - 1) - tcc_error("String table too large"); - - csym._n._n_n._n_zeroes = 0; - csym._n._n_n._n_offset = - pCoff_str_table - Coff_str_table + 4; - - strcpy(pCoff_str_table, name); - pCoff_str_table += strlen(name) + 1; // skip over null - nstr++; - } - - if (p->st_info == 4) { - // put a filename symbol - csym.n_value = 33; // ????? - csym.n_scnum = N_DEBUG; - csym.n_type = 0; - csym.n_sclass = C_FILE; - csym.n_numaux = 0; - fwrite(&csym, 18, 1, f); - n++; - - } else if (p->st_info == 0x12) { - // find the function data - - for (k = 0; k < nFuncs; k++) { - if (strcmp(name, Func[k]) == 0) - break; - } - - if (k >= nFuncs) { - tcc_error("debug info can't find function: %s", name); - } - // put a Function Name - - csym.n_value = p->st_value; // physical address - csym.n_scnum = CoffTextSectionNo; - csym.n_type = MKTYPE(T_INT, DT_FCN, 0, 0, 0, 0, 0); - csym.n_sclass = C_EXT; - csym.n_numaux = 1; - fwrite(&csym, 18, 1, f); - - // now put aux info - - auxfunc.tag = 0; - auxfunc.size = EndAddress[k] - p->st_value; - auxfunc.fileptr = LineNoFilePtr[k]; - auxfunc.nextsym = n + 6; // tktk - auxfunc.dummy = 0; - fwrite(&auxfunc, 18, 1, f); - - // put a .bf - - strcpy(csym._n._n_name, ".bf"); - csym.n_value = p->st_value; // physical address - csym.n_scnum = CoffTextSectionNo; - csym.n_type = 0; - csym.n_sclass = C_FCN; - csym.n_numaux = 1; - fwrite(&csym, 18, 1, f); - - // now put aux info - - auxbf.regmask = 0; - auxbf.lineno = 0; - auxbf.nentries = FuncEntries[k]; - auxbf.localframe = 0; - auxbf.nextentry = n + 6; - auxbf.dummy = 0; - fwrite(&auxbf, 18, 1, f); - - // put a .ef - - strcpy(csym._n._n_name, ".ef"); - csym.n_value = EndAddress[k]; // physical address - csym.n_scnum = CoffTextSectionNo; - csym.n_type = 0; - csym.n_sclass = C_FCN; - csym.n_numaux = 1; - fwrite(&csym, 18, 1, f); - - // now put aux info - - auxef.dummy = 0; - auxef.lineno = LastLineNo[k]; - auxef.dummy1 = 0; - auxef.dummy2 = 0; - auxef.dummy3 = 0; - auxef.dummy4 = 0; - fwrite(&auxef, 18, 1, f); - - n += 6; - - } else { - // try an put some type info - - if ((p->st_other & VT_BTYPE) == VT_DOUBLE) { - csym.n_type = T_DOUBLE; // int - csym.n_sclass = C_EXT; - } else if ((p->st_other & VT_BTYPE) == VT_FLOAT) { - csym.n_type = T_FLOAT; - csym.n_sclass = C_EXT; - } else if ((p->st_other & VT_BTYPE) == VT_INT) { - csym.n_type = T_INT; // int - csym.n_sclass = C_EXT; - } else if ((p->st_other & VT_BTYPE) == VT_SHORT) { - csym.n_type = T_SHORT; - csym.n_sclass = C_EXT; - } else if ((p->st_other & VT_BTYPE) == VT_BYTE) { - csym.n_type = T_CHAR; - csym.n_sclass = C_EXT; - } else { - csym.n_type = T_INT; // just mark as a label - csym.n_sclass = C_LABEL; - } - - - csym.n_value = p->st_value; - csym.n_scnum = 2; - csym.n_numaux = 1; - fwrite(&csym, 18, 1, f); - - auxfunc.tag = 0; - auxfunc.size = 0x20; - auxfunc.fileptr = 0; - auxfunc.nextsym = 0; - auxfunc.dummy = 0; - fwrite(&auxfunc, 18, 1, f); - n++; - n++; - - } - - p++; - } - } - - if (s1->do_debug) { - // write string table - - // first write the size - i = pCoff_str_table - Coff_str_table; - fwrite(&i, 4, 1, f); - - // then write the strings - fwrite(Coff_str_table, i, 1, f); - - tcc_free(Coff_str_table); - } - - return 0; + lseek(fd, offset, SEEK_SET); + return len == read(fd, buffer, len); } - - -// group the symbols in order of filename, func1, func2, etc -// finally global symbols - -void SortSymbolTable(TCCState *s1) +int +coff_load_lib(TCCState *s1, int fd) { - int i, j, k, n = 0; - Elf32_Sym *p, *p2, *NewTable; - char *name, *name2; - - NewTable = (Elf32_Sym *) tcc_malloc(nb_syms * sizeof(Elf32_Sym)); - - p = (Elf32_Sym *) symtab_section->data; - - - // find a file symbol, copy it over - // then scan the whole symbol list and copy any function - // symbols that match the file association - - for (i = 0; i < nb_syms; i++) { - if (p->st_info == 4) { - name = (char *) symtab_section->link->data + p->st_name; - - // this is a file symbol, copy it over - - NewTable[n++] = *p; - - p2 = (Elf32_Sym *) symtab_section->data; - - for (j = 0; j < nb_syms; j++) { - if (p2->st_info == 0x12) { - // this is a func symbol - - name2 = - (char *) symtab_section->link->data + p2->st_name; - - // find the function data index - - for (k = 0; k < nFuncs; k++) { - if (strcmp(name2, Func[k]) == 0) - break; - } - - if (k >= nFuncs) { - tcc_error("debug (sort) info can't find function: %s", name2); - } - - if (strcmp(AssociatedFile[k], name) == 0) { - // yes they match copy it over - - NewTable[n++] = *p2; - } - } - p2++; - } - } - p++; - } - - // now all the filename and func symbols should have been copied over - // copy all the rest over (all except file and funcs) - - p = (Elf32_Sym *) symtab_section->data; - for (i = 0; i < nb_syms; i++) { - if (p->st_info != 4 && p->st_info != 0x12) { - NewTable[n++] = *p; - } - p++; - } - - if (n != nb_syms) - tcc_error("Internal Compiler error, debug info"); - - // copy it all back - - p = (Elf32_Sym *) symtab_section->data; - for (i = 0; i < nb_syms; i++) { - *p++ = NewTable[i]; - } - - tcc_free(NewTable); + return (0); } - -int FindCoffSymbolIndex(TCCState *s1, const char *func_name) +int +coff_load_obj(TCCState *s1, int fd) { - int i, n = 0; - Elf32_Sym *p; - char *name; + FILHDR hdr; + SCNHDR *scns; + SYMENT *syments; + uint16_t i; + int32_t j; + char buff[9]; - p = (Elf32_Sym *) symtab_section->data; + if (!read_mem(fd, 0, &hdr, FILHSZ)) + return (tcc_error_noabort("not a coff object file")); - for (i = 0; i < nb_syms; i++) { + if (hdr.f_magic != F_MACH_I386 || hdr.f_flags & F_EXEC) + return (tcc_error_noabort("invalid coff object file")); - name = (char *) symtab_section->link->data + p->st_name; + /* load symtab */ - if (p->st_info == 4) { - // put a filename symbol - n++; - } else if (p->st_info == 0x12) { - - if (strcmp(func_name, name) == 0) - return n; - - n += 6; - - // put a Function Name - - // now put aux info - - // put a .bf - - // now put aux info - - // put a .ef - - // now put aux info - - } else { - n += 2; - } - - p++; - } - - return n; // total number of symbols -} - -int OutputTheSection(Section * sect) -{ - const char *s = sect->name; - - if (!strcmp(s, ".text")) - return 1; - else if (!strcmp(s, ".data")) - return 1; - else - return 0; -} - -short int GetCoffFlags(const char *s) -{ - if (!strcmp(s, ".text")) - return STYP_TEXT | STYP_DATA | STYP_ALIGN | 0x400; - else if (!strcmp(s, ".data")) - return STYP_DATA; - else if (!strcmp(s, ".bss")) - return STYP_BSS; - else if (!strcmp(s, ".stack")) - return STYP_BSS | STYP_ALIGN | 0x200; - else if (!strcmp(s, ".cinit")) - return STYP_COPY | STYP_DATA | STYP_ALIGN | 0x200; - else - return 0; -} - -Section *FindSection(TCCState * s1, const char *sname) -{ - Section *s; - int i; - - for (i = 1; i < s1->nb_sections; i++) { - s = s1->sections[i]; - - if (!strcmp(sname, s->name)) - return s; - } - - tcc_error("could not find section %s", sname); - return 0; -} - -ST_FUNC int tcc_load_coff(TCCState * s1, int fd) -{ -// tktk TokenSym *ts; - - FILE *f; - unsigned int str_size; - char *Coff_str_table, *name; - int i, k; - struct syment csym; - char name2[9]; - FILHDR file_hdr; /* FILE HEADER STRUCTURE */ - - f = fdopen(fd, "rb"); - if (!f) { - tcc_error("Unable to open .out file for input"); - } - - if (fread(&file_hdr, FILHSZ, 1, f) != 1) - tcc_error("error reading .out file for input"); - - if (fread(&o_filehdr, sizeof(o_filehdr), 1, f) != 1) - tcc_error("error reading .out file for input"); - - // first read the string table - - if (fseek(f, file_hdr.f_symptr + file_hdr.f_nsyms * SYMESZ, SEEK_SET)) - tcc_error("error reading .out file for input"); - - if (fread(&str_size, sizeof(int), 1, f) != 1) - tcc_error("error reading .out file for input"); - - - Coff_str_table = (char *) tcc_malloc(str_size); - - if (fread(Coff_str_table, str_size - 4, 1, f) != 1) - tcc_error("error reading .out file for input"); - - // read/process all the symbols - - // seek back to symbols - - if (fseek(f, file_hdr.f_symptr, SEEK_SET)) - tcc_error("error reading .out file for input"); - - for (i = 0; i < file_hdr.f_nsyms; i++) { - if (fread(&csym, SYMESZ, 1, f) != 1) - tcc_error("error reading .out file for input"); - - if (csym._n._n_n._n_zeroes == 0) { - name = Coff_str_table + csym._n._n_n._n_offset - 4; - } else { - name = csym._n._n_name; - - if (name[7] != 0) { - for (k = 0; k < 8; k++) - name2[k] = name[k]; - - name2[8] = 0; - - name = name2; - } - } -// if (strcmp("_DAC_Buffer",name)==0) // tktk -// name[0]=0; - - if (((csym.n_type & 0x30) == 0x20 && csym.n_sclass == 0x2) || ((csym.n_type & 0x30) == 0x30 && csym.n_sclass == 0x2) || (csym.n_type == 0x4 && csym.n_sclass == 0x2) || (csym.n_type == 0x8 && csym.n_sclass == 0x2) || // structures - (csym.n_type == 0x18 && csym.n_sclass == 0x2) || // pointer to structure - (csym.n_type == 0x7 && csym.n_sclass == 0x2) || // doubles - (csym.n_type == 0x6 && csym.n_sclass == 0x2)) // floats + /* read sections */ + scns = tcc_malloc(SCNHSZ * hdr.f_nscns); + if (!read_mem(fd, FILHSZ, scns, SCNHSZ * hdr.f_nscns)) { - // strip off any leading underscore (except for other main routine) - - if (name[0] == '_' && strcmp(name, "_main") != 0) - name++; - - tcc_add_symbol(s1, name, (void*)(uintptr_t)csym.n_value); + tcc_free(scns); + return (-1); } - // skip any aux records - if (csym.n_numaux == 1) { - if (fread(&csym, SYMESZ, 1, f) != 1) - tcc_error("error reading .out file for input"); - i++; + for (i = 0; i < hdr.f_nscns; i++) + { + memset(buff, 0, 9); + memcpy(buff, scns[i].s_name, 8); + printf("sec: %s\n", buff); } - } - return 0; + /* load symtab */ + syments = tcc_malloc(SYMESZ * hdr.f_nsyms); + read_mem(fd, hdr.f_symptr, syments, SYMESZ * hdr.f_nsyms); + for (j = 0; j < hdr.f_nsyms; j++) + { + memset(buff, 0, 9); + memcpy(buff, syments[i].n_name, 8); + printf("sym: %s\n", buff); + } + + tcc_free(syments); + tcc_free(scns); + return (0); } + +int +coff_load_file(TCCState *s1, int fd, const char *fname) +{ + if (strcmp(tcc_fileextension(fname), ".a") == 0) + { + return (coff_load_lib(s1, fd)); + } + else + { + return (coff_load_obj(s1, fd)); + } +} + +int +coff_output_file(TCCState *s1, const char *fname) +{ + return (0); +} \ No newline at end of file diff --git a/tccdbg.c b/tccdbg.c index 345f7aa9..711f1871 100644 --- a/tccdbg.c +++ b/tccdbg.c @@ -1097,7 +1097,7 @@ ST_FUNC void tcc_debug_start(TCCState *s1) } dwarf_data1(dwarf_info_section, DWARF_ABBREV_COMPILE_UNIT); - dwarf_strp(dwarf_info_section, "tcc " TCC_VERSION); + dwarf_strp(dwarf_info_section, "tcc " PACKAGE_VERSION); dwarf_data1(dwarf_info_section, s1->cversion == 201112 ? DW_LANG_C11 : DW_LANG_C99); dwarf_line_strp(dwarf_info_section, filename); dwarf_line_strp(dwarf_info_section, buf); diff --git a/tccelf.c b/tccelf.c index 2ac52b1d..c9286aa2 100644 --- a/tccelf.c +++ b/tccelf.c @@ -3169,11 +3169,6 @@ invalid: || 0 == strncmp(sh_name, ".stab", 5)) { if (!s1->do_debug || seencompressed) continue; -#if !(TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD) - } else if (0 == strncmp(sh_name, ".eh_frame", 9)) { - if (NULL == eh_frame_section) - continue; -#endif } else if (sh->sh_type != SHT_PROGBITS && sh->sh_type != SHT_NOTE && @@ -3181,12 +3176,6 @@ invalid: sh->sh_type != SHT_PREINIT_ARRAY && sh->sh_type != SHT_INIT_ARRAY && sh->sh_type != SHT_FINI_ARRAY -#ifdef TCC_ARM_EABI - && sh->sh_type != SHT_ARM_EXIDX -#endif -#if TARGETOS_OpenBSD || TARGETOS_FreeBSD || TARGETOS_NetBSD - && sh->sh_type != SHT_X86_64_UNWIND -#endif ) continue; diff --git a/tccpp.c b/tccpp.c index 8f6b3d4c..2bfe8954 100644 --- a/tccpp.c +++ b/tccpp.c @@ -3553,32 +3553,10 @@ ST_INLN void unget_tok(int last_tok) /* init preprocessor */ static const char * const target_os_defs = -#ifdef TCC_TARGET_PE - "_WIN32\0" -# if PTR_SIZE == 8 - "_WIN64\0" -# endif -#else -# if defined TCC_TARGET_MACHO - "__APPLE__\0" -# elif TARGETOS_FreeBSD - "__FreeBSD__ 12\0" -# elif TARGETOS_FreeBSD_kernel - "__FreeBSD_kernel__\0" -# elif TARGETOS_NetBSD - "__NetBSD__\0" -# elif TARGETOS_OpenBSD - "__OpenBSD__\0" -# else - "__linux__\0" - "__linux\0" -# if TARGETOS_ANDROID - "__ANDROID__\0" -# endif -# endif + "__stupidos__\0" + "__stupidos\0" "__unix__\0" "__unix\0" -#endif ; static void putdef(CString *cs, const char *p) @@ -3594,7 +3572,7 @@ static void putdefs(CString *cs, const char *p) static void tcc_predefs(TCCState *s1, CString *cs, int is_asm) { - cstr_printf(cs, "#define __TINYC__ 9%.2s\n", *& TCC_VERSION + 4); + cstr_printf(cs, "#define __TINYC__ 9%.2s\n", *& PACKAGE_VERSION + 4); putdefs(cs, target_machine_defs); putdefs(cs, target_os_defs); diff --git a/tccrun.c b/tccrun.c deleted file mode 100644 index 28c7379f..00000000 --- a/tccrun.c +++ /dev/null @@ -1,1536 +0,0 @@ -/* - * TCC - Tiny C Compiler - Support for -run switch - * - * Copyright (c) 2001-2004 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "tcc.h" - -/* only native compiler supports -run */ -#ifdef TCC_IS_NATIVE - -#ifdef CONFIG_TCC_BACKTRACE -/* runtime debug info block */ -typedef struct rt_context -{ - /* tccelf.c:tcc_add_btstub() wants these in that order: */ - union { - struct { - Stab_Sym *stab_sym; - Stab_Sym *stab_sym_end; - char *stab_str; - }; - struct { - unsigned char *dwarf_line; - unsigned char *dwarf_line_end; - unsigned char *dwarf_line_str; - }; - }; - ElfW(Sym) *esym_start; - ElfW(Sym) *esym_end; - char *elf_str; - // 6 * PTR_SIZE - addr_t prog_base; - void *bounds_start; - void *top_func; - struct rt_context *next; - // 10 * PTR_SIZE - int num_callers; - int dwarf; -} rt_context; - -/* linked list of rt_contexts */ -static rt_context *g_rc; -static int signal_set; -static void set_exception_handler(void); -#endif /* def CONFIG_TCC_BACKTRACE */ - -typedef struct rt_frame { - addr_t ip, fp, sp; -} rt_frame; - -static TCCState *g_s1; -/* semaphore to protect it */ -TCC_SEM(static rt_sem); -static void rt_wait_sem(void) { WAIT_SEM(&rt_sem); } -static void rt_post_sem(void) { POST_SEM(&rt_sem); } -static int rt_get_caller_pc(addr_t *paddr, rt_frame *f, int level); -static void rt_exit(rt_frame *f, int code); - -/* ------------------------------------------------------------- */ -/* defined when included from lib/bt-exe.c */ -#ifndef CONFIG_TCC_BACKTRACE_ONLY - -#ifndef _WIN32 -# include -#endif - -static int protect_pages(void *ptr, unsigned long length, int mode); -static int tcc_relocate_ex(TCCState *s1, void *ptr, unsigned ptr_diff); -static void st_link(TCCState *s1); -static void st_unlink(TCCState *s1); -#ifdef CONFIG_TCC_BACKTRACE -static int _tcc_backtrace(rt_frame *f, const char *fmt, va_list ap); -#endif -#ifdef _WIN64 -static void *win64_add_function_table(TCCState *s1); -static void win64_del_function_table(void *); -#endif - -#if !defined PAGESIZE -# if defined _SC_PAGESIZE -# define PAGESIZE sysconf(_SC_PAGESIZE) -# elif defined __APPLE__ -# include -# define PAGESIZE getpagesize() -# else -# define PAGESIZE 4096 -# endif -#endif - -#define PAGEALIGN(n) ((addr_t)n + (-(addr_t)n & (PAGESIZE-1))) - -#if !_WIN32 && !__APPLE__ -//#define CONFIG_SELINUX 1 -#endif - -static int rt_mem(TCCState *s1, int size) -{ - void *ptr; - int ptr_diff = 0; -#ifdef CONFIG_SELINUX - /* Using mmap instead of malloc */ - void *prw; - char tmpfname[] = "/tmp/.tccrunXXXXXX"; - int fd = mkstemp(tmpfname); - unlink(tmpfname); - ftruncate(fd, size); - - ptr = mmap(NULL, size * 2, PROT_READ|PROT_EXEC, MAP_SHARED, fd, 0); - /* mmap RW memory at fixed distance */ - prw = mmap((char*)ptr + size, size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd, 0); - close(fd); - if (ptr == MAP_FAILED || prw == MAP_FAILED) - return tcc_error_noabort("tccrun: could not map memory"); - ptr_diff = (char*)prw - (char*)ptr; /* = size; */ - //printf("map %p %p %p\n", ptr, prw, (void*)ptr_diff); - size *= 2; -#else - ptr = tcc_malloc(size += PAGESIZE); /* one extra page to align malloc memory */ -#endif - s1->run_ptr = ptr; - s1->run_size = size; - return ptr_diff; -} - -/* ------------------------------------------------------------- */ -/* Do all relocations (needed before using tcc_get_symbol()) - Returns -1 on error. */ - -LIBTCCAPI int tcc_relocate(TCCState *s1) -{ - int size, ret, ptr_diff; - - if (s1->run_ptr) - exit(tcc_error_noabort("'tcc_relocate()' twice is no longer supported")); -#ifdef CONFIG_TCC_BACKTRACE - if (s1->do_backtrace) - tcc_add_symbol(s1, "_tcc_backtrace", _tcc_backtrace); /* for bt-log.c */ -#endif - size = tcc_relocate_ex(s1, NULL, 0); - if (size < 0) - return -1; - ptr_diff = rt_mem(s1, size); - if (ptr_diff < 0) - return -1; - ret = tcc_relocate_ex(s1, s1->run_ptr, ptr_diff); - if (ret == 0) - st_link(s1); - return ret; -} - -ST_FUNC void tcc_run_free(TCCState *s1) -{ - unsigned size; - void *ptr; - int i; - - /* free any loaded DLLs */ - for ( i = 0; i < s1->nb_loaded_dlls; i++) { - DLLReference *ref = s1->loaded_dlls[i]; - if ( ref->handle ) -#ifdef _WIN32 - FreeLibrary((HMODULE)ref->handle); -#else - dlclose(ref->handle); -#endif - } - /* unmap or unprotect and free memory */ - ptr = s1->run_ptr; - if (NULL == ptr) - return; - st_unlink(s1); - size = s1->run_size; -#ifdef CONFIG_SELINUX - munmap(ptr, size); -#else - /* unprotect memory to make it usable for malloc again */ - protect_pages((void*)PAGEALIGN(ptr), size - PAGESIZE, 2 /*rw*/); -# ifdef _WIN64 - win64_del_function_table(s1->run_function_table); -# endif - tcc_free(ptr); -#endif -} - -#define RT_EXIT_ZERO 0xE0E00E0E /* passed from longjmp instead of '0' */ - -/* launch the compiled program with the given arguments */ -LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv) -{ - int (*prog_main)(int, char **, char **), ret; - const char *top_sym; - jmp_buf main_jb; - -#if defined(__APPLE__) || defined(__FreeBSD__) - char **envp = NULL; -#elif defined(__OpenBSD__) || defined(__NetBSD__) - extern char **environ; - char **envp = environ; -#else - char **envp = environ; -#endif - - /* tcc -dt -run ... nothing to do if no main() */ - if ((s1->dflag & 16) && (addr_t)-1 == get_sym_addr(s1, "main", 0, 1)) - return 0; - - tcc_add_symbol(s1, "__rt_exit", rt_exit); - if (s1->nostdlib) { - s1->run_main = top_sym = "_start"; - } else { - tcc_add_support(s1, "runmain.o"); - s1->run_main = "_runmain"; - top_sym = "main"; - } - if (tcc_relocate(s1) < 0) - return -1; - - prog_main = (void*)get_sym_addr(s1, s1->run_main, 1, 1); - if ((addr_t)-1 == (addr_t)prog_main) - return -1; - errno = 0; /* clean errno value */ - fflush(stdout); - fflush(stderr); - - ret = tcc_setjmp(s1, main_jb, tcc_get_symbol(s1, top_sym)); - if (0 == ret) - ret = prog_main(argc, argv, envp); - else if (RT_EXIT_ZERO == ret) - ret = 0; - - if (s1->dflag & 16 && ret) /* tcc -dt -run ... */ - fprintf(s1->ppfp, "[returns %d]\n", ret), fflush(s1->ppfp); - return ret; -} - -/* ------------------------------------------------------------- */ -/* remove all STB_LOCAL symbols */ -static void cleanup_symbols(TCCState *s1) -{ - Section *s = s1->symtab; - int sym_index, end_sym = s->data_offset / sizeof (ElfSym); - /* reset symtab */ - s->data_offset = s->link->data_offset = s->hash->data_offset = 0; - init_symtab(s); - /* add global symbols again */ - for (sym_index = 1; sym_index < end_sym; ++sym_index) { - ElfW(Sym) *sym = &((ElfW(Sym) *)s->data)[sym_index]; - const char *name = (char *)s->link->data + sym->st_name; - if (ELFW(ST_BIND)(sym->st_info) == STB_LOCAL) - continue; - //printf("sym %s\n", name); - put_elf_sym(s, sym->st_value, sym->st_size, sym->st_info, sym->st_other, sym->st_shndx, name); - } -} - -/* free all sections except symbols */ -static void cleanup_sections(TCCState *s1) -{ - struct { Section **secs; int nb_secs; } *p = (void*)&s1->sections; - int i, f = 2; - do { - for (i = --f; i < p->nb_secs; i++) { - Section *s = p->secs[i]; - if (s == s1->symtab || s == s1->symtab->link || s == s1->symtab->hash) { - s->data = tcc_realloc(s->data, s->data_allocated = s->data_offset); - } else { - free_section(s), tcc_free(s), p->secs[i] = NULL; - } - } - } while (++p, f); -} - -/* ------------------------------------------------------------- */ -/* 0 = .text rwx other rw (memory >= 2 pages a 4096 bytes) */ -/* 1 = .text rx other rw (memory >= 3 pages) */ -/* 2 = .text rx .rdata ro .data/.bss rw (memory >= 4 pages) */ - -/* Some targets implement secutiry options that do not allow write in - executable code. These targets need CONFIG_RUNMEM_RO=1. - The disadvantage of this is that it requires a little bit more memory. */ - -#ifndef CONFIG_RUNMEM_RO -# ifdef __APPLE__ -# define CONFIG_RUNMEM_RO 1 -# else -# define CONFIG_RUNMEM_RO 0 -# endif -#endif - -/* relocate code. Return -1 on error, required size if ptr is NULL, - otherwise copy code into buffer passed by the caller */ -static int tcc_relocate_ex(TCCState *s1, void *ptr, unsigned ptr_diff) -{ - Section *s; - unsigned offset, length, align, i, k, f; - unsigned n, copy; - addr_t mem, addr; - - if (NULL == ptr) { -#ifdef TCC_TARGET_PE - pe_output_file(s1, NULL); -#else - tcc_add_runtime(s1); - resolve_common_syms(s1); - build_got_entries(s1, 0); -#endif - } - - offset = copy = 0; - mem = (addr_t)ptr; -redo: - if (s1->verbose == 2 && copy) - printf(&"-----------------------------------------------------\n"[PTR_SIZE*2 - 8]); - if (s1->nb_errors) - return -1; - if (copy == 3) - return 0; - - for (k = 0; k < 3; ++k) { /* 0:rx, 1:ro, 2:rw sections */ - n = 0; addr = 0; - for(i = 1; i < s1->nb_sections; i++) { - static const char shf[] = { - SHF_ALLOC|SHF_EXECINSTR, SHF_ALLOC, SHF_ALLOC|SHF_WRITE - }; - s = s1->sections[i]; - if (shf[k] != (s->sh_flags & (SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR))) - continue; - length = s->data_offset; - if (copy == 2) { - if (addr == 0) - addr = s->sh_addr; - n = (s->sh_addr - addr) + length; - continue; - } - if (copy) { /* final step: copy section data to memory */ - if (s1->verbose == 2) - printf("%d: %-16s %p len %05x align %04x\n", - k, s->name, (void*)s->sh_addr, length, s->sh_addralign); - ptr = (void*)s->sh_addr; - if (k == 0) - ptr = (void*)(s->sh_addr + ptr_diff); - if (NULL == s->data || s->sh_type == SHT_NOBITS) - memset(ptr, 0, length); - else - memcpy(ptr, s->data, length); - continue; - } - - align = s->sh_addralign; - if (++n == 1) { -#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 - /* To avoid that x86 processors would reload cached instructions - each time when data is written in the near, we need to make - sure that code and data do not share the same 64 byte unit */ - if (align < 64) - align = 64; -#endif - /* start new page for different permissions */ - if (k <= CONFIG_RUNMEM_RO) - align = PAGESIZE; - } - s->sh_addralign = align; - addr = k ? mem + ptr_diff : mem; - offset += -(addr + offset) & (align - 1); - s->sh_addr = mem ? addr + offset : 0; - offset += length; - } - if (copy == 2) { /* set permissions */ - if (n == 0) /* no data */ - continue; -#ifdef CONFIG_SELINUX - if (k == 0) /* SHF_EXECINSTR has its own mapping */ - continue; -#endif - f = k; - if (f >= CONFIG_RUNMEM_RO) { - if (f != 0) - continue; - f = 3; /* change only SHF_EXECINSTR to rwx */ - } - n = PAGEALIGN(n); - if (s1->verbose == 2) { - printf("protect %3s %p len %05x\n", - &"rx\0ro\0rw\0rwx"[f*3], (void*)addr, (unsigned)n); - } - if (protect_pages((void*)addr, n, f) < 0) - return tcc_error_noabort( - "mprotect failed (did you mean to configure --with-selinux?)"); - } - } - - if (0 == mem) - return PAGEALIGN(offset); - - if (++copy == 2) { - goto redo; - } - if (copy == 3) { -#ifdef _WIN64 - s1->run_function_table = win64_add_function_table(s1); -#endif - /* remove local symbols and free sections except symtab */ - cleanup_symbols(s1); - cleanup_sections(s1); - goto redo; - } - - /* relocate symbols */ - relocate_syms(s1, s1->symtab, !(s1->nostdlib)); - /* relocate sections */ -#ifdef TCC_TARGET_PE - s1->pe_imagebase = mem; -#else - relocate_plt(s1); -#endif - relocate_sections(s1); - goto redo; -} - -/* ------------------------------------------------------------- */ -/* allow to run code in memory */ - -static int protect_pages(void *ptr, unsigned long length, int mode) -{ -#ifdef _WIN32 - static const unsigned char protect[] = { - PAGE_EXECUTE_READ, - PAGE_READONLY, - PAGE_READWRITE, - PAGE_EXECUTE_READWRITE - }; - DWORD old; - if (!VirtualProtect(ptr, length, protect[mode], &old)) - return -1; -#else - static const unsigned char protect[] = { - PROT_READ | PROT_EXEC, - PROT_READ, - PROT_READ | PROT_WRITE, - PROT_READ | PROT_WRITE | PROT_EXEC - }; - if (mprotect(ptr, length, protect[mode])) - return -1; -/* XXX: BSD sometimes dump core with bad system call */ -# if (defined TCC_TARGET_ARM && !TARGETOS_BSD) || defined TCC_TARGET_ARM64 - if (mode == 0 || mode == 3) { - void __clear_cache(void *beginning, void *end); - __clear_cache(ptr, (char *)ptr + length); - } -# endif -#endif - return 0; -} - -#ifdef _WIN64 -static void *win64_add_function_table(TCCState *s1) -{ - void *p = NULL; - if (s1->uw_pdata) { - p = (void*)s1->uw_pdata->sh_addr; - RtlAddFunctionTable( - (RUNTIME_FUNCTION*)p, - s1->uw_pdata->data_offset / sizeof (RUNTIME_FUNCTION), - s1->pe_imagebase - ); - s1->uw_pdata = NULL; - } - return p; -} - -static void win64_del_function_table(void *p) -{ - if (p) { - RtlDeleteFunctionTable((RUNTIME_FUNCTION*)p); - } -} -#endif - -static void bt_link(TCCState *s1) -{ -#ifdef CONFIG_TCC_BACKTRACE - rt_context *rc; - void *p; - - if (!s1->do_backtrace) - return; - rc = tcc_get_symbol(s1, "__rt_info"); - if (!rc) - return; - rc->esym_start = (ElfW(Sym) *)(symtab_section->data); - rc->esym_end = (ElfW(Sym) *)(symtab_section->data + symtab_section->data_offset); - rc->elf_str = (char *)symtab_section->link->data; - if (PTR_SIZE == 8 && !s1->dwarf) - rc->prog_base &= 0xffffffff00000000ULL; -#ifdef CONFIG_TCC_BCHECK - if (s1->do_bounds_check) { - if ((p = tcc_get_symbol(s1, "__bound_init"))) - ((void(*)(void*,int))p)(rc->bounds_start, 1); - } -#endif - rc->next = g_rc, g_rc = rc, s1->rc = rc; - if (0 == signal_set) - set_exception_handler(), signal_set = 1; -#endif -} - -static void st_link(TCCState *s1) -{ - rt_wait_sem(); - s1->next = g_s1, g_s1 = s1; - bt_link(s1); - rt_post_sem(); -} - -/* remove 'el' from 'list' */ -static void ptr_unlink(void *list, void *e, unsigned next) -{ - void **pp, **nn, *p; - for (pp = list; !!(p = *pp); pp = nn) { - nn = (void*)((char*)p + next); /* nn = &p->next; */ - if (p == e) { - *pp = *nn; - break; - } - } -} - -static void st_unlink(TCCState *s1) -{ - rt_wait_sem(); -#ifdef CONFIG_TCC_BACKTRACE - ptr_unlink(&g_rc, s1->rc, offsetof(rt_context, next)); -#endif - ptr_unlink(&g_s1, s1, offsetof(TCCState, next)); - rt_post_sem(); -} - -LIBTCCAPI void *_tcc_setjmp(TCCState *s1, void *p_jmp_buf, void *func, void *p_longjmp) -{ - s1->run_lj = p_longjmp; - s1->run_jb = p_jmp_buf; -#ifdef CONFIG_TCC_BACKTRACE - if (s1->rc) - s1->rc->top_func = func; -#endif - return p_jmp_buf; -} - -LIBTCCAPI void tcc_set_backtrace_func(TCCState *s1, void *data, TCCBtFunc *func) -{ - s1->bt_func = func; - s1->bt_data = data; -} - -static TCCState *rt_find_state(rt_frame *f) -{ - TCCState *s; - int level; - addr_t pc; - - s = g_s1; - if (NULL == s || NULL == s->next) { - /* play it safe in the simple case when there is only one state */ - return s; - } - for (level = 0; level < 8; ++level) { - if (rt_get_caller_pc(&pc, f, level) < 0) - break; - for (s = g_s1; s; s = s->next) { - if (pc >= (addr_t)s->run_ptr - && pc < (addr_t)s->run_ptr + s->run_size) - return s; - } - } - return NULL; -} - -static void rt_exit(rt_frame *f, int code) -{ - TCCState *s; - rt_wait_sem(); - s = rt_find_state(f); - rt_post_sem(); - if (s && s->run_lj) { - if (code == 0) - code = RT_EXIT_ZERO; - ((void(*)(void*,int))s->run_lj)(s->run_jb, code); - } - exit(code); -} - -/* ------------------------------------------------------------- */ -#else // if defined CONFIG_TCC_BACKTRACE_ONLY -static void rt_exit(rt_frame *f, int code) -{ - exit(code); -} -#endif //ndef CONFIG_TCC_BACKTRACE_ONLY -/* ------------------------------------------------------------- */ -#ifdef CONFIG_TCC_BACKTRACE - -static int rt_vprintf(const char *fmt, va_list ap) -{ - int ret = vfprintf(stderr, fmt, ap); - fflush(stderr); - return ret; -} - -static int rt_printf(const char *fmt, ...) -{ - va_list ap; - int r; - va_start(ap, fmt); - r = rt_vprintf(fmt, ap); - va_end(ap); - return r; -} - -static char *rt_elfsym(rt_context *rc, addr_t wanted_pc, addr_t *func_addr) -{ - ElfW(Sym) *esym; - for (esym = rc->esym_start + 1; esym < rc->esym_end; ++esym) { - int type = ELFW(ST_TYPE)(esym->st_info); - if ((type == STT_FUNC || type == STT_GNU_IFUNC) - && wanted_pc >= esym->st_value - && wanted_pc < esym->st_value + esym->st_size) { - *func_addr = esym->st_value; - return rc->elf_str + esym->st_name; - } - } - return NULL; -} - -typedef struct bt_info -{ - char file[100]; - int line; - char func[100]; - addr_t func_pc; -} bt_info; - -/* print the position in the source file of PC value 'pc' by reading - the stabs debug information */ -static addr_t rt_printline (rt_context *rc, addr_t wanted_pc, bt_info *bi) -{ - char func_name[128]; - addr_t func_addr, last_pc, pc; - const char *incl_files[INCLUDE_STACK_SIZE]; - int incl_index, last_incl_index, len, last_line_num, i; - const char *str, *p; - Stab_Sym *sym; - - func_name[0] = '\0'; - func_addr = 0; - incl_index = 0; - last_pc = (addr_t)-1; - last_line_num = 1; - last_incl_index = 0; - - for (sym = rc->stab_sym + 1; sym < rc->stab_sym_end; ++sym) { - str = rc->stab_str + sym->n_strx; - pc = sym->n_value; - - switch(sym->n_type) { - case N_SLINE: - if (func_addr) - goto rel_pc; - case N_SO: - case N_SOL: - goto abs_pc; - case N_FUN: - if (sym->n_strx == 0) /* end of function */ - goto rel_pc; - abs_pc: -#if PTR_SIZE == 8 - /* Stab_Sym.n_value is only 32bits */ - pc += rc->prog_base; -#endif - goto check_pc; - rel_pc: - pc += func_addr; - check_pc: - if (pc >= wanted_pc && wanted_pc >= last_pc) - goto found; - break; - } - - switch(sym->n_type) { - /* function start or end */ - case N_FUN: - if (sym->n_strx == 0) - goto reset_func; - p = strchr(str, ':'); - if (0 == p || (len = p - str + 1, len > sizeof func_name)) - len = sizeof func_name; - pstrcpy(func_name, len, str); - func_addr = pc; - break; - /* line number info */ - case N_SLINE: - last_pc = pc; - last_line_num = sym->n_desc; - last_incl_index = incl_index; - break; - /* include files */ - case N_BINCL: - if (incl_index < INCLUDE_STACK_SIZE) - incl_files[incl_index++] = str; - break; - case N_EINCL: - if (incl_index > 1) - incl_index--; - break; - /* start/end of translation unit */ - case N_SO: - incl_index = 0; - if (sym->n_strx) { - /* do not add path */ - len = strlen(str); - if (len > 0 && str[len - 1] != '/') - incl_files[incl_index++] = str; - } - reset_func: - func_name[0] = '\0'; - func_addr = 0; - last_pc = (addr_t)-1; - break; - /* alternative file name (from #line or #include directives) */ - case N_SOL: - if (incl_index) - incl_files[incl_index-1] = str; - break; - } - } - last_incl_index = 0, func_name[0] = 0, func_addr = 0; -found: - i = last_incl_index; - if (i > 0) { - pstrcpy(bi->file, sizeof bi->file, incl_files[--i]); - bi->line = last_line_num; - } - pstrcpy(bi->func, sizeof bi->func, func_name); - bi->func_pc = func_addr; - return func_addr; -} - -/* ------------------------------------------------------------- */ -/* rt_printline - dwarf version */ - -#define DIR_TABLE_SIZE (64) -#define FILE_TABLE_SIZE (512) - -#define dwarf_ignore_type(ln, end) /* timestamp/size/md5/... */ \ - switch (entry_format[j].form) { \ - case DW_FORM_data1: (ln) += 1; break; \ - case DW_FORM_data2: (ln) += 2; break; \ - case DW_FORM_data4: (ln) += 3; break; \ - case DW_FORM_data8: (ln) += 8; break; \ - case DW_FORM_data16: (ln) += 16; break; \ - case DW_FORM_udata: dwarf_read_uleb128(&(ln), (end)); break; \ - default: goto next_line; \ - } - -static addr_t rt_printline_dwarf (rt_context *rc, addr_t wanted_pc, bt_info *bi) -{ - unsigned char *ln; - unsigned char *cp; - unsigned char *end; - unsigned char *opcode_length; - unsigned long long size; - unsigned int length; - unsigned char version; - unsigned int min_insn_length; - unsigned int max_ops_per_insn; - int line_base; - unsigned int line_range; - unsigned int opcode_base; - unsigned int opindex; - unsigned int col; - unsigned int i; - unsigned int j; - unsigned int len; - unsigned long long value; - struct { - unsigned int type; - unsigned int form; - } entry_format[256]; - unsigned int dir_size; -#if 0 - char *dirs[DIR_TABLE_SIZE]; -#endif - unsigned int filename_size; - struct /*dwarf_filename_struct*/ { - unsigned int dir_entry; - char *name; - } filename_table[FILE_TABLE_SIZE]; - addr_t last_pc; - addr_t pc; - addr_t func_addr; - int line; - char *filename; - char *function; - - filename = NULL; - function = NULL; - func_addr = 0; - line = 0; - - ln = rc->dwarf_line; - while (ln < rc->dwarf_line_end) { - dir_size = 0; - filename_size = 0; - last_pc = 0; - pc = 0; - func_addr = 0; - line = 1; - filename = NULL; - function = NULL; - length = 4; - size = dwarf_read_4(ln, rc->dwarf_line_end); - if (size == 0xffffffffu) // dwarf 64 - length = 8, size = dwarf_read_8(ln, rc->dwarf_line_end); - end = ln + size; - if (end < ln || end > rc->dwarf_line_end) - break; - version = dwarf_read_2(ln, end); - if (version >= 5) - ln += length + 2; // address size, segment selector, prologue Length - else - ln += length; // prologue Length - min_insn_length = dwarf_read_1(ln, end); - if (version >= 4) - max_ops_per_insn = dwarf_read_1(ln, end); - else - max_ops_per_insn = 1; - ln++; // Initial value of 'is_stmt' - line_base = dwarf_read_1(ln, end); - line_base |= line_base >= 0x80 ? ~0xff : 0; - line_range = dwarf_read_1(ln, end); - opcode_base = dwarf_read_1(ln, end); - opcode_length = ln; - ln += opcode_base - 1; - opindex = 0; - if (version >= 5) { - col = dwarf_read_1(ln, end); - for (i = 0; i < col; i++) { - entry_format[i].type = dwarf_read_uleb128(&ln, end); - entry_format[i].form = dwarf_read_uleb128(&ln, end); - } - dir_size = dwarf_read_uleb128(&ln, end); - for (i = 0; i < dir_size; i++) { - for (j = 0; j < col; j++) { - if (entry_format[j].type == DW_LNCT_path) { - if (entry_format[j].form != DW_FORM_line_strp) - goto next_line; -#if 0 - value = length == 4 ? dwarf_read_4(ln, end) - : dwarf_read_8(ln, end); - if (i < DIR_TABLE_SIZE) - dirs[i] = (char *)rc->dwarf_line_str + value; -#else - length == 4 ? dwarf_read_4(ln, end) - : dwarf_read_8(ln, end); -#endif - } - else - dwarf_ignore_type(ln, end); - } - } - col = dwarf_read_1(ln, end); - for (i = 0; i < col; i++) { - entry_format[i].type = dwarf_read_uleb128(&ln, end); - entry_format[i].form = dwarf_read_uleb128(&ln, end); - } - filename_size = dwarf_read_uleb128(&ln, end); - for (i = 0; i < filename_size; i++) - for (j = 0; j < col; j++) { - if (entry_format[j].type == DW_LNCT_path) { - if (entry_format[j].form != DW_FORM_line_strp) - goto next_line; - value = length == 4 ? dwarf_read_4(ln, end) - : dwarf_read_8(ln, end); - if (i < FILE_TABLE_SIZE) - filename_table[i].name = - (char *)rc->dwarf_line_str + value; - } - else if (entry_format[j].type == DW_LNCT_directory_index) { - switch (entry_format[j].form) { - case DW_FORM_data1: value = dwarf_read_1(ln, end); break; - case DW_FORM_data2: value = dwarf_read_2(ln, end); break; - case DW_FORM_data4: value = dwarf_read_4(ln, end); break; - case DW_FORM_udata: value = dwarf_read_uleb128(&ln, end); break; - default: goto next_line; - } - if (i < FILE_TABLE_SIZE) - filename_table[i].dir_entry = value; - } - else - dwarf_ignore_type(ln, end); - } - } - else { - while ((dwarf_read_1(ln, end))) { -#if 0 - if (++dir_size < DIR_TABLE_SIZE) - dirs[dir_size - 1] = (char *)ln - 1; -#endif - while (dwarf_read_1(ln, end)) {} - } - while ((dwarf_read_1(ln, end))) { - if (++filename_size < FILE_TABLE_SIZE) { - filename_table[filename_size - 1].name = (char *)ln - 1; - while (dwarf_read_1(ln, end)) {} - filename_table[filename_size - 1].dir_entry = - dwarf_read_uleb128(&ln, end); - } - else { - while (dwarf_read_1(ln, end)) {} - dwarf_read_uleb128(&ln, end); - } - dwarf_read_uleb128(&ln, end); // time - dwarf_read_uleb128(&ln, end); // size - } - } - if (filename_size >= 1) - filename = filename_table[0].name; - while (ln < end) { - last_pc = pc; - i = dwarf_read_1(ln, end); - if (i >= opcode_base) { - if (max_ops_per_insn == 1) - pc += ((i - opcode_base) / line_range) * min_insn_length; - else { - pc += (opindex + (i - opcode_base) / line_range) / - max_ops_per_insn * min_insn_length; - opindex = (opindex + (i - opcode_base) / line_range) % - max_ops_per_insn; - } - i = (int)((i - opcode_base) % line_range) + line_base; -check_pc: - if (pc >= wanted_pc && wanted_pc >= last_pc) - goto found; - line += i; - } - else { - switch (i) { - case 0: - len = dwarf_read_uleb128(&ln, end); - cp = ln; - ln += len; - if (len == 0) - goto next_line; - switch (dwarf_read_1(cp, end)) { - case DW_LNE_end_sequence: - break; - case DW_LNE_set_address: -#if PTR_SIZE == 4 - pc = dwarf_read_4(cp, end); -#else - pc = dwarf_read_8(cp, end); -#endif -#if defined TCC_TARGET_MACHO - pc += rc->prog_base; -#endif - opindex = 0; - break; - case DW_LNE_define_file: /* deprecated */ - if (++filename_size < FILE_TABLE_SIZE) { - filename_table[filename_size - 1].name = (char *)ln - 1; - while (dwarf_read_1(ln, end)) {} - filename_table[filename_size - 1].dir_entry = - dwarf_read_uleb128(&ln, end); - } - else { - while (dwarf_read_1(ln, end)) {} - dwarf_read_uleb128(&ln, end); - } - dwarf_read_uleb128(&ln, end); // time - dwarf_read_uleb128(&ln, end); // size - break; - case DW_LNE_hi_user - 1: - function = (char *)cp; - func_addr = pc; - break; - default: - break; - } - break; - case DW_LNS_advance_pc: - if (max_ops_per_insn == 1) - pc += dwarf_read_uleb128(&ln, end) * min_insn_length; - else { - unsigned long long off = dwarf_read_uleb128(&ln, end); - - pc += (opindex + off) / max_ops_per_insn * - min_insn_length; - opindex = (opindex + off) % max_ops_per_insn; - } - i = 0; - goto check_pc; - case DW_LNS_advance_line: - line += dwarf_read_sleb128(&ln, end); - break; - case DW_LNS_set_file: - i = dwarf_read_uleb128(&ln, end); - i -= i > 0 && version < 5; - if (i < FILE_TABLE_SIZE && i < filename_size) - filename = filename_table[i].name; - break; - case DW_LNS_const_add_pc: - if (max_ops_per_insn == 1) - pc += ((255 - opcode_base) / line_range) * min_insn_length; - else { - unsigned int off = (255 - opcode_base) / line_range; - - pc += ((opindex + off) / max_ops_per_insn) * - min_insn_length; - opindex = (opindex + off) % max_ops_per_insn; - } - i = 0; - goto check_pc; - case DW_LNS_fixed_advance_pc: - i = dwarf_read_2(ln, end); - pc += i; - opindex = 0; - i = 0; - goto check_pc; - default: - for (j = 0; j < opcode_length[i - 1]; j++) - dwarf_read_uleb128 (&ln, end); - break; - } - } - } -next_line: - ln = end; - } - filename = function = NULL, func_addr = 0; -found: - if (filename) - pstrcpy(bi->file, sizeof bi->file, filename), bi->line = line; - if (function) - pstrcpy(bi->func, sizeof bi->func, function); - bi->func_pc = func_addr; - return (addr_t)func_addr; -} -/* ------------------------------------------------------------- */ -#ifndef CONFIG_TCC_BACKTRACE_ONLY -static -#endif -int _tcc_backtrace(rt_frame *f, const char *fmt, va_list ap) -{ - rt_context *rc, *rc2; - addr_t pc; - char skip[40], msg[200]; - int i, level, ret, n, one; - const char *a, *b; - bt_info bi; - addr_t (*getinfo)(rt_context*, addr_t, bt_info*); - - skip[0] = 0; - /* If fmt is like "^file.c^..." then skip calls from 'file.c' */ - if (fmt[0] == '^' && (b = strchr(a = fmt + 1, fmt[0]))) { - memcpy(skip, a, b - a), skip[b - a] = 0; - fmt = b + 1; - } - one = 0; - /* hack for bcheck.c:dprintf(): one level, no newline */ - if (fmt[0] == '\001') - ++fmt, one = 1; - vsnprintf(msg, sizeof msg, fmt, ap); - - rt_wait_sem(); - rc = g_rc; - getinfo = rt_printline, n = 6; - if (rc) { - if (rc->dwarf) - getinfo = rt_printline_dwarf; - if (rc->num_callers) - n = rc->num_callers; - } - - for (i = level = 0; level < n; i++) { - ret = rt_get_caller_pc(&pc, f, i); - if (ret == -1) - break; - memset(&bi, 0, sizeof bi); - for (rc2 = rc; rc2; rc2 = rc2->next) { - if (getinfo(rc2, pc, &bi)) - break; - /* we try symtab symbols (no line number info) */ - if (!!(a = rt_elfsym(rc2, pc, &bi.func_pc))) { - pstrcpy(bi.func, sizeof bi.func, a); - break; - } - } - //fprintf(stderr, "%d rc %p %p\n", i, (void*)pcfunc, (void*)pc); - if (skip[0] && strstr(bi.file, skip)) - continue; -#ifndef CONFIG_TCC_BACKTRACE_ONLY - { - TCCState *s = rt_find_state(f); - if (s && s->bt_func) { - ret = s->bt_func( - s->bt_data, - (void*)pc, - bi.file[0] ? bi.file : NULL, - bi.line, - bi.func[0] ? bi.func : NULL, - level == 0 ? msg : NULL - ); - if (ret == 0) - break; - goto check_break; - } - } -#endif - if (bi.file[0]) { - rt_printf("%s:%d", bi.file, bi.line); - } else { - rt_printf("0x%08llx", (long long)pc); - } - rt_printf(": %s %s", level ? "by" : "at", bi.func[0] ? bi.func : "???"); - if (level == 0) { - rt_printf(": %s", msg); - if (one) - break; - } - rt_printf("\n"); - -#ifndef CONFIG_TCC_BACKTRACE_ONLY - check_break: -#endif - if (rc2 - && bi.func_pc - && bi.func_pc == (addr_t)rc2->top_func) - break; - ++level; - } - rt_post_sem(); - return 0; -} - -/* emit a run time error at position 'pc' */ -static int rt_error(rt_frame *f, const char *fmt, ...) -{ - va_list ap; char msg[200]; int ret; - va_start(ap, fmt); - snprintf(msg, sizeof msg, "RUNTIME ERROR: %s", fmt); - ret = _tcc_backtrace(f, msg, ap); - va_end(ap); - return ret; -} - -/* ------------------------------------------------------------- */ - -#ifndef _WIN32 -# include -# ifndef __OpenBSD__ -# include -# endif -#else -# define ucontext_t CONTEXT -#endif - -/* translate from ucontext_t* to internal rt_context * */ -static void rt_getcontext(ucontext_t *uc, rt_frame *rc) -{ -#if defined _WIN64 - rc->ip = uc->Rip; - rc->fp = uc->Rbp; - rc->sp = uc->Rsp; -#elif defined _WIN32 - rc->ip = uc->Eip; - rc->fp = uc->Ebp; - rc->sp = uc->Esp; -#elif defined __i386__ -# if defined(__APPLE__) - rc->ip = uc->uc_mcontext->__ss.__eip; - rc->fp = uc->uc_mcontext->__ss.__ebp; -# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - rc->ip = uc->uc_mcontext.mc_eip; - rc->fp = uc->uc_mcontext.mc_ebp; -# elif defined(__dietlibc__) - rc->ip = uc->uc_mcontext.eip; - rc->fp = uc->uc_mcontext.ebp; -# elif defined(__NetBSD__) - rc->ip = uc->uc_mcontext.__gregs[_REG_EIP]; - rc->fp = uc->uc_mcontext.__gregs[_REG_EBP]; -# elif defined(__OpenBSD__) - rc->ip = uc->sc_eip; - rc->fp = uc->sc_ebp; -# elif !defined REG_EIP && defined EIP /* fix for glibc 2.1 */ - rc->ip = uc->uc_mcontext.gregs[EIP]; - rc->fp = uc->uc_mcontext.gregs[EBP]; -# else - rc->ip = uc->uc_mcontext.gregs[REG_EIP]; - rc->fp = uc->uc_mcontext.gregs[REG_EBP]; -# endif -#elif defined(__x86_64__) -# if defined(__APPLE__) - rc->ip = uc->uc_mcontext->__ss.__rip; - rc->fp = uc->uc_mcontext->__ss.__rbp; -# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) - rc->ip = uc->uc_mcontext.mc_rip; - rc->fp = uc->uc_mcontext.mc_rbp; -# elif defined(__NetBSD__) - rc->ip = uc->uc_mcontext.__gregs[_REG_RIP]; - rc->fp = uc->uc_mcontext.__gregs[_REG_RBP]; -# elif defined(__OpenBSD__) - rc->ip = uc->sc_rip; - rc->fp = uc->sc_rbp; -# else - rc->ip = uc->uc_mcontext.gregs[REG_RIP]; - rc->fp = uc->uc_mcontext.gregs[REG_RBP]; -# endif -#elif defined(__arm__) && defined(__NetBSD__) - rc->ip = uc->uc_mcontext.__gregs[_REG_PC]; - rc->fp = uc->uc_mcontext.__gregs[_REG_FP]; -#elif defined(__arm__) && defined(__OpenBSD__) - rc->ip = uc->sc_pc; - rc->fp = uc->sc_r11; -#elif defined(__arm__) && defined(__FreeBSD__) - rc->ip = uc->uc_mcontext.__gregs[_REG_PC]; - rc->fp = uc->uc_mcontext.__gregs[_REG_FP]; -#elif defined(__arm__) - rc->ip = uc->uc_mcontext.arm_pc; - rc->fp = uc->uc_mcontext.arm_fp; -#elif defined(__aarch64__) && defined(__APPLE__) - // see: - // /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/mach/arm/_structs.h - rc->ip = uc->uc_mcontext->__ss.__pc; - rc->fp = uc->uc_mcontext->__ss.__fp; -#elif defined(__aarch64__) && defined(__FreeBSD__) - rc->ip = uc->uc_mcontext.mc_gpregs.gp_elr; /* aka REG_PC */ - rc->fp = uc->uc_mcontext.mc_gpregs.gp_x[29]; -#elif defined(__aarch64__) && defined(__NetBSD__) - rc->ip = uc->uc_mcontext.__gregs[_REG_PC]; - rc->fp = uc->uc_mcontext.__gregs[_REG_FP]; -#elif defined(__aarch64__) && defined(__OpenBSD__) - rc->ip = uc->sc_elr; - rc->fp = uc->sc_x[29]; -#elif defined(__aarch64__) - rc->ip = uc->uc_mcontext.pc; - rc->fp = uc->uc_mcontext.regs[29]; -#elif defined(__riscv) && defined(__OpenBSD__) - rc->ip = uc->sc_sepc; - rc->fp = uc->sc_s[0]; -#elif defined(__riscv) - rc->ip = uc->uc_mcontext.__gregs[REG_PC]; - rc->fp = uc->uc_mcontext.__gregs[REG_S0]; -#endif -} - -/* ------------------------------------------------------------- */ -#ifndef _WIN32 -/* signal handler for fatal errors */ -static void sig_error(int signum, siginfo_t *siginf, void *puc) -{ - rt_frame f; - rt_getcontext(puc, &f); - - switch(signum) { - case SIGFPE: - switch(siginf->si_code) { - case FPE_INTDIV: - case FPE_FLTDIV: - rt_error(&f, "division by zero"); - break; - default: - rt_error(&f, "floating point exception"); - break; - } - break; - case SIGBUS: - case SIGSEGV: - rt_error(&f, "invalid memory access"); - break; - case SIGILL: - rt_error(&f, "illegal instruction"); - break; - case SIGABRT: - rt_error(&f, "abort() called"); - break; - default: - rt_error(&f, "caught signal %d", signum); - break; - } - { - sigset_t s; - sigemptyset(&s); - sigaddset(&s, signum); - sigprocmask(SIG_UNBLOCK, &s, NULL); - } - rt_exit(&f, 255); -} - -#ifndef SA_SIGINFO -# define SA_SIGINFO 0x00000004u -#endif - -/* Generate a stack backtrace when a CPU exception occurs. */ -static void set_exception_handler(void) -{ - struct sigaction sigact; - /* install TCC signal handlers to print debug info on fatal - runtime errors */ - sigemptyset (&sigact.sa_mask); - sigact.sa_flags = SA_SIGINFO; //| SA_RESETHAND; -#if 0//def SIGSTKSZ // this causes signals not to work at all on some (older) linuxes - sigact.sa_flags |= SA_ONSTACK; -#endif - sigact.sa_sigaction = sig_error; - sigaction(SIGFPE, &sigact, NULL); - sigaction(SIGILL, &sigact, NULL); - sigaction(SIGSEGV, &sigact, NULL); - sigaction(SIGBUS, &sigact, NULL); - sigaction(SIGABRT, &sigact, NULL); -#if 0//def SIGSTKSZ - /* This allows stack overflow to be reported instead of a SEGV */ - { - stack_t ss; - static unsigned char stack[SIGSTKSZ] __attribute__((aligned(16))); - - ss.ss_sp = stack; - ss.ss_size = SIGSTKSZ; - ss.ss_flags = 0; - sigaltstack(&ss, NULL); - } -#endif -} - -#else /* WIN32 */ - -/* signal handler for fatal errors */ -static long __stdcall cpu_exception_handler(EXCEPTION_POINTERS *ex_info) -{ - rt_frame f; - unsigned code; - rt_getcontext(ex_info->ContextRecord, &f); - - switch (code = ex_info->ExceptionRecord->ExceptionCode) { - case EXCEPTION_ACCESS_VIOLATION: - rt_error(&f, "invalid memory access"); - break; - case EXCEPTION_STACK_OVERFLOW: - rt_error(&f, "stack overflow"); - break; - case EXCEPTION_INT_DIVIDE_BY_ZERO: - rt_error(&f, "division by zero"); - break; - case EXCEPTION_BREAKPOINT: - case EXCEPTION_SINGLE_STEP: - f.ip = *(addr_t*)f.sp; - rt_error(&f, "breakpoint/single-step exception:"); - return EXCEPTION_CONTINUE_SEARCH; - default: - rt_error(&f, "caught exception %08x", code); - break; - } - rt_exit(&f, 255); - return EXCEPTION_EXECUTE_HANDLER; -} - -/* Generate a stack backtrace when a CPU exception occurs. */ -static void set_exception_handler(void) -{ - SetUnhandledExceptionFilter(cpu_exception_handler); -} - -#endif - -/* ------------------------------------------------------------- */ -/* return the PC at frame level 'level'. Return negative if not found */ -#if defined(__i386__) || defined(__x86_64__) -static int rt_get_caller_pc(addr_t *paddr, rt_frame *rc, int level) -{ - if (level == 0) { - *paddr = rc->ip; - } else { - addr_t fp = rc->fp; - while (1) { - if (fp < 0x1000) - return -1; - if (0 == --level) - break; - /* XXX: check address validity with program info */ - fp = ((addr_t *)fp)[0]; - } - *paddr = ((addr_t *)fp)[1]; - } - return 0; -} - -/* XXX: only supports linux/bsd */ -#elif defined(__arm__) && !defined(_WIN32) -static int rt_get_caller_pc(addr_t *paddr, rt_frame *rc, int level) -{ - if (level == 0) { - *paddr = rc->ip; - } else { - addr_t fp = rc->fp; - while (1) { - if (fp < 0x1000) - return -1; - if (0 == --level) - break; - fp = ((addr_t *)fp)[0]; - } - *paddr = ((addr_t *)fp)[2]; - } - return 0; -} - -#elif defined(__aarch64__) -static int rt_get_caller_pc(addr_t *paddr, rt_frame *rc, int level) -{ - if (level == 0) { - *paddr = rc->ip; - } else { - addr_t fp = rc->fp; - while (1) { - if (fp < 0x1000) - return -1; - if (0 == --level) - break; - fp = ((addr_t *)fp)[0]; - } - *paddr = ((addr_t *)fp)[1]; - } - return 0; -} - -#elif defined(__riscv) -static int rt_get_caller_pc(addr_t *paddr, rt_frame *rc, int level) -{ - if (level == 0) { - *paddr = rc->ip; - } else { - addr_t fp = rc->fp; - while (1) { - if (fp < 0x1000) - return -1; - if (0 == --level) - break; - fp = ((addr_t *)fp)[-2]; - } - *paddr = ((addr_t *)fp)[-1]; - } - return 0; -} - -#else -#warning add arch specific rt_get_caller_pc() -static int rt_get_caller_pc(addr_t *paddr, rt_frame *rc, int level) -{ - return -1; -} - -#endif -#else // for runmain.c:exit(); when CONFIG_TCC_BACKTRACE == 0 */ -static int rt_get_caller_pc(addr_t *paddr, rt_frame *f, int level) -{ - if (level) - return -1; - *paddr = f->ip; - return 0; -} -#endif /* CONFIG_TCC_BACKTRACE */ -/* ------------------------------------------------------------- */ -#ifdef CONFIG_TCC_STATIC - -/* dummy function for profiling */ -ST_FUNC void *dlopen(const char *filename, int flag) -{ - return NULL; -} - -ST_FUNC void dlclose(void *p) -{ -} - -ST_FUNC const char *dlerror(void) -{ - return "error"; -} - -typedef struct TCCSyms { - char *str; - void *ptr; -} TCCSyms; - - -/* add the symbol you want here if no dynamic linking is done */ -static TCCSyms tcc_syms[] = { -#if !defined(CONFIG_TCCBOOT) -#define TCCSYM(a) { #a, &a, }, - TCCSYM(printf) - TCCSYM(fprintf) - TCCSYM(fopen) - TCCSYM(fclose) -#undef TCCSYM -#endif - { NULL, NULL }, -}; - -ST_FUNC void *dlsym(void *handle, const char *symbol) -{ - TCCSyms *p; - p = tcc_syms; - while (p->str != NULL) { - if (!strcmp(p->str, symbol)) - return p->ptr; - p++; - } - return NULL; -} - -#endif /* CONFIG_TCC_STATIC */ -#endif /* TCC_IS_NATIVE */ -/* ------------------------------------------------------------- */ diff --git a/tcctools.c b/tcctools.c index 0f7acef7..eccb22af 100644 --- a/tcctools.c +++ b/tcctools.c @@ -336,132 +336,6 @@ the_end: return ret; } -/* -------------------------------------------------------------- */ -/* - * tiny_impdef creates an export definition file (.def) from a dll - * on MS-Windows. Usage: tiny_impdef library.dll [-o outputfile]" - * - * Copyright (c) 2005,2007 grischka - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef TCC_TARGET_PE - -ST_FUNC int tcc_tool_impdef(TCCState *s1, int argc, char **argv) -{ - int ret, v, i; - char infile[260]; - char outfile[260]; - - const char *file; - char *p, *q; - FILE *fp, *op; - -#ifdef _WIN32 - char path[260]; -#endif - - infile[0] = outfile[0] = 0; - fp = op = NULL; - ret = 1; - p = NULL; - v = 0; - - for (i = 1; i < argc; ++i) { - const char *a = argv[i]; - if ('-' == a[0]) { - if (0 == strcmp(a, "-v")) { - v = 1; - } else if (0 == strcmp(a, "-o")) { - if (++i == argc) - goto usage; - strcpy(outfile, argv[i]); - } else - goto usage; - } else if (0 == infile[0]) - strcpy(infile, a); - else - goto usage; - } - - if (0 == infile[0]) { -usage: - fprintf(stderr, - "usage: tcc -impdef library.dll [-v] [-o outputfile]\n" - "create export definition file (.def) from dll\n" - ); - goto the_end; - } - - if (0 == outfile[0]) { - strcpy(outfile, tcc_basename(infile)); - q = strrchr(outfile, '.'); - if (NULL == q) - q = strchr(outfile, 0); - strcpy(q, ".def"); - } - - file = infile; -#ifdef _WIN32 - if (SearchPath(NULL, file, ".dll", sizeof path, path, NULL)) - file = path; -#endif - ret = tcc_get_dllexports(file, &p); - if (ret || !p) { - fprintf(stderr, "tcc: impdef: %s '%s'\n", - ret == -1 ? "can't find file" : - ret == 1 ? "can't read symbols" : - ret == 0 ? "no symbols found in" : - "unknown file type", file); - ret = 1; - goto the_end; - } - - if (v) - printf("-> %s\n", file); - - op = fopen(outfile, "wb"); - if (NULL == op) { - fprintf(stderr, "tcc: impdef: could not create output file: %s\n", outfile); - goto the_end; - } - - fprintf(op, "LIBRARY %s\n\nEXPORTS\n", tcc_basename(file)); - for (q = p, i = 0; *q; ++i) { - fprintf(op, "%s\n", q); - q += strlen(q) + 1; - } - - if (v) - printf("<- %s (%d symbol%s)\n", outfile, i, &"s"[i<2]); - - ret = 0; - -the_end: - if (p) - tcc_free(p); - if (fp) - fclose(fp); - if (op) - fclose(op); - return ret; -} - -#endif /* TCC_TARGET_PE */ - /* -------------------------------------------------------------- */ /* * TCC - Tiny C Compiler diff --git a/win32/build-tcc.bat b/win32/build-tcc.bat deleted file mode 100644 index 9c66327a..00000000 --- a/win32/build-tcc.bat +++ /dev/null @@ -1,210 +0,0 @@ -@rem ------------------------------------------------------ -@rem batch file to build tcc using mingw, msvc or tcc itself -@rem ------------------------------------------------------ - -@echo off -setlocal -if (%1)==(-clean) goto :cleanup -set CC=gcc -set /p VERSION= < ..\VERSION -set TCCDIR= -set BINDIR= -set DOC=no -set XCC=no -goto :a0 -:a2 -shift -:a3 -shift -:a0 -if not (%1)==(-c) goto :a1 -set CC=%~2 -if (%2)==(cl) set CC=@call :cl -goto :a2 -:a1 -if (%1)==(-t) set T=%2&& goto :a2 -if (%1)==(-v) set VERSION=%~2&& goto :a2 -if (%1)==(-i) set TCCDIR=%2&& goto :a2 -if (%1)==(-b) set BINDIR=%2&& goto :a2 -if (%1)==(-d) set DOC=yes&& goto :a3 -if (%1)==(-x) set XCC=yes&& goto :a3 -if (%1)==() goto :p1 -:usage -echo usage: build-tcc.bat [ options ... ] -echo options: -echo -c prog use prog (gcc/tcc/cl) to compile tcc -echo -c "prog options" use prog with options to compile tcc -echo -t 32/64 force 32/64 bit default target -echo -v "version" set tcc version -echo -i tccdir install tcc into tccdir -echo -b bindir but install tcc.exe and libtcc.dll into bindir -echo -d create tcc-doc.html too (needs makeinfo) -echo -x build the cross compiler too -echo -clean delete all previously produced files and directories -exit /B 1 - -@rem ------------------------------------------------------ -@rem sub-routines - -:cleanup -set LOG=echo -%LOG% removing files: -for %%f in (*tcc.exe libtcc.dll lib\*.a) do call :del_file %%f -for %%f in (..\config.h ..\config.texi) do call :del_file %%f -for %%f in (include\*.h) do @if exist ..\%%f call :del_file %%f -for %%f in (include\tcclib.h examples\libtcc_test.c) do call :del_file %%f -for %%f in (lib\*.o *.o *.obj *.def *.pdb *.lib *.exp *.ilk) do call :del_file %%f -%LOG% removing directories: -for %%f in (doc libtcc) do call :del_dir %%f -%LOG% done. -exit /B 0 -:del_file -if exist %1 del %1 && %LOG% %1 -exit /B 0 -:del_dir -if exist %1 rmdir /Q/S %1 && %LOG% %1 -exit /B 0 - -:cl -@echo off -set CMD=cl -:c0 -set ARG=%1 -set ARG=%ARG:.dll=.lib% -if (%1)==(-shared) set ARG=-LD -if (%1)==(-o) shift && set ARG=-Fe%2 -set CMD=%CMD% %ARG% -shift -if not (%1)==() goto :c0 -echo on -%CMD% -O2 -W2 -Zi -MT -GS- -nologo %DEF_GITHASH% -link -opt:ref,icf -@exit /B %ERRORLEVEL% - -@rem ------------------------------------------------------ -@rem main program - -:p1 -if not %T%_==_ goto :p2 -set T=32 -if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64 -if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64 -:p2 -if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static -if (%BINDIR%)==() set BINDIR=%TCCDIR% - -set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386 -set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 -set P32=i386-win32 -set P64=x86_64-win32 - -if %T%==64 goto :t64 -set D=%D32% -set P=%P32% -set DX=%D64% -set PX=%P64% -set TX=64 -goto :p3 - -:t64 -set D=%D64% -set P=%P64% -set DX=%D32% -set PX=%P32% -set TX=32 -goto :p3 - -:p3 -git.exe --version 2>nul -if not %ERRORLEVEL%==0 goto :git_done -for /f %%b in ('git.exe rev-parse --abbrev-ref HEAD') do set GITHASH=%%b -for /f %%b in ('git.exe log -1 "--pretty=format:%%cs_%GITHASH%@%%h"') do set GITHASH=%%b -git.exe diff --quiet -if %ERRORLEVEL%==1 set GITHASH=%GITHASH%* -:git_done -@echo on - -:config.h -echo>..\config.h #define TCC_VERSION "%VERSION%" -if not (%GITHASH%)==() echo>> ..\config.h #define TCC_GITHASH "%GITHASH%" -@if not (%BINDIR%)==(%TCCDIR%) echo>> ..\config.h #define CONFIG_TCCDIR "%TCCDIR:\=/%" -if %TX%==64 echo>> ..\config.h #ifdef TCC_TARGET_X86_64 -if %TX%==32 echo>> ..\config.h #ifdef TCC_TARGET_I386 -echo>> ..\config.h #define CONFIG_TCC_CROSSPREFIX "%PX%-" -echo>> ..\config.h #endif - -for %%f in (*tcc.exe *tcc.dll) do @del %%f - -@if _%TCC_C%_==__ goto compiler_2parts -@rem if TCC_C was defined then build only tcc.exe -%CC% -o tcc.exe %TCC_C% %D% -@if errorlevel 1 goto :the_end -@goto :compiler_done - -:compiler_2parts -@if _%LIBTCC_C%_==__ set LIBTCC_C=..\libtcc.c -%CC% -o libtcc.dll -shared %LIBTCC_C% %D% -DLIBTCC_AS_DLL -@if errorlevel 1 goto :the_end -%CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE"=0" -@if errorlevel 1 goto :the_end -if not _%XCC%_==_yes_ goto :compiler_done -%CC% -o %PX%-tcc.exe ..\tcc.c %DX% -@if errorlevel 1 goto :the_end -:compiler_done -@if (%EXES_ONLY%)==(yes) goto :files_done - -if not exist libtcc mkdir libtcc -if not exist doc mkdir doc -copy>nul ..\include\*.h include -copy>nul ..\tcclib.h include -copy>nul ..\libtcc.h libtcc -copy>nul ..\tests\libtcc_test.c examples -copy>nul tcc-win32.txt doc - -if exist libtcc.dll .\tcc -impdef libtcc.dll -o libtcc\libtcc.def -@if errorlevel 1 goto :the_end - -:lib -call :make_lib %T% || goto :the_end -@if exist %PX%-tcc.exe call :make_lib %TX% %PX%- || goto :the_end - -:tcc-doc.html -@if not (%DOC%)==(yes) goto :doc-done -echo>..\config.texi @set VERSION %VERSION% -cmd /c makeinfo --html --no-split ../tcc-doc.texi -o doc/tcc-doc.html -:doc-done - -:files_done -for %%f in (*.o *.def) do @del %%f - -:copy-install -@if (%TCCDIR%)==() goto :the_end -if not exist %BINDIR% mkdir %BINDIR% -for %%f in (*tcc.exe *tcc.dll) do @copy>nul %%f %BINDIR%\%%f -if not exist %TCCDIR% mkdir %TCCDIR% -@if not exist %TCCDIR%\lib mkdir %TCCDIR%\lib -for %%f in (lib\*.a lib\*.o lib\*.def) do @copy>nul %%f %TCCDIR%\%%f -for %%f in (include examples libtcc doc) do @xcopy>nul /s/i/q/y %%f %TCCDIR%\%%f - -:the_end -exit /B %ERRORLEVEL% - -:make_lib -.\tcc -B. -m%1 -c ../lib/libtcc1.c -.\tcc -B. -m%1 -c lib/crt1.c -.\tcc -B. -m%1 -c lib/crt1w.c -.\tcc -B. -m%1 -c lib/wincrt1.c -.\tcc -B. -m%1 -c lib/wincrt1w.c -.\tcc -B. -m%1 -c lib/dllcrt1.c -.\tcc -B. -m%1 -c lib/dllmain.c -.\tcc -B. -m%1 -c lib/chkstk.S -.\tcc -B. -m%1 -c ../lib/alloca.S -.\tcc -B. -m%1 -c ../lib/alloca-bt.S -.\tcc -B. -m%1 -c ../lib/stdatomic.c -.\tcc -B. -m%1 -c ../lib/builtin.c -.\tcc -B. -m%1 -ar lib/%2libtcc1.a libtcc1.o crt1.o crt1w.o wincrt1.o wincrt1w.o dllcrt1.o dllmain.o chkstk.o alloca.o alloca-bt.o stdatomic.o builtin.o -.\tcc -B. -m%1 -c ../lib/bcheck.c -o lib/%2bcheck.o -bt -I.. -.\tcc -B. -m%1 -c ../lib/bt-exe.c -o lib/%2bt-exe.o -.\tcc -B. -m%1 -c ../lib/bt-log.c -o lib/%2bt-log.o -.\tcc -B. -m%1 -c ../lib/bt-dll.c -o lib/%2bt-dll.o -.\tcc -B. -m%1 -c ../lib/runmain.c -o lib/%2runmain.o -exit /B %ERRORLEVEL% diff --git a/win32/examples/dll.c b/win32/examples/dll.c deleted file mode 100644 index 052a0564..00000000 --- a/win32/examples/dll.c +++ /dev/null @@ -1,13 +0,0 @@ -//+--------------------------------------------------------------------------- -// -// dll.c - Windows DLL example - dynamically linked part -// - -#include - -__declspec(dllexport) const char *hello_data = "(not set)"; - -__declspec(dllexport) void hello_func (void) -{ - MessageBox (0, hello_data, "From DLL", MB_ICONINFORMATION); -} diff --git a/win32/examples/fib.c b/win32/examples/fib.c deleted file mode 100644 index 8da26bce..00000000 --- a/win32/examples/fib.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include // atoi() - -int fib(n) -{ - if (n <= 2) - return 1; - else - return fib(n-1) + fib(n-2); -} - -int main(int argc, char **argv) -{ - int n; - if (argc < 2) { - printf("usage: fib n\n" - "Compute nth Fibonacci number\n"); - return 1; - } - - n = atoi(argv[1]); - printf("fib(%d) = %d\n", n, fib(n)); - return 0; -} diff --git a/win32/examples/hello_dll.c b/win32/examples/hello_dll.c deleted file mode 100644 index 4813c5b9..00000000 --- a/win32/examples/hello_dll.c +++ /dev/null @@ -1,20 +0,0 @@ -//+--------------------------------------------------------------------------- -// -// HELLO_DLL.C - Windows DLL example - main application part -// - -#include - -void hello_func (void); -__declspec(dllimport) extern const char *hello_data; - -int WINAPI WinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - hello_data = "Hello World!"; - hello_func(); - return 0; -} diff --git a/win32/examples/hello_win.c b/win32/examples/hello_win.c deleted file mode 100644 index 96546e41..00000000 --- a/win32/examples/hello_win.c +++ /dev/null @@ -1,163 +0,0 @@ -//+--------------------------------------------------------------------------- -// -// HELLO_WIN.C - Windows GUI 'Hello World!' Example -// -//+--------------------------------------------------------------------------- - -#include - -#define APPNAME "HELLO_WIN" - -char szAppName[] = APPNAME; // The name of this application -char szTitle[] = APPNAME; // The title bar text -const char *pWindowText; - -void CenterWindow(HWND hWnd); - -//+--------------------------------------------------------------------------- -// -// Function: WndProc -// -// Synopsis: very unusual type of function - gets called by system to -// process windows messages. -// -// Arguments: same as always. -//---------------------------------------------------------------------------- - -LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) { - - // ----------------------- first and last - case WM_CREATE: - CenterWindow(hwnd); - break; - - case WM_DESTROY: - PostQuitMessage(0); - break; - - // ----------------------- get out of it... - case WM_RBUTTONUP: - DestroyWindow(hwnd); - break; - - case WM_KEYDOWN: - if (VK_ESCAPE == wParam) - DestroyWindow(hwnd); - break; - - // ----------------------- display our minimal info - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hdc; - RECT rc; - hdc = BeginPaint(hwnd, &ps); - - GetClientRect(hwnd, &rc); - SetTextColor(hdc, RGB(240,240,96)); - SetBkMode(hdc, TRANSPARENT); - DrawText(hdc, pWindowText, -1, &rc, DT_CENTER|DT_SINGLELINE|DT_VCENTER); - - EndPaint(hwnd, &ps); - break; - } - - // ----------------------- let windows do all other stuff - default: - return DefWindowProc(hwnd, message, wParam, lParam); - } - return 0; -} - -//+--------------------------------------------------------------------------- -// -// Function: WinMain -// -// Synopsis: standard entrypoint for GUI Win32 apps -// -//---------------------------------------------------------------------------- -int APIENTRY WinMain( - HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow - ) -{ - MSG msg; - WNDCLASS wc; - HWND hwnd; - - pWindowText = lpCmdLine[0] ? lpCmdLine : "Hello Windows!"; - - // Fill in window class structure with parameters that describe - // the main window. - - ZeroMemory(&wc, sizeof wc); - wc.hInstance = hInstance; - wc.lpszClassName = szAppName; - wc.lpfnWndProc = (WNDPROC)WndProc; - wc.style = CS_DBLCLKS|CS_VREDRAW|CS_HREDRAW; - wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - - if (FALSE == RegisterClass(&wc)) - return 0; - - // create the browser - hwnd = CreateWindow( - szAppName, - szTitle, - WS_OVERLAPPEDWINDOW|WS_VISIBLE, - CW_USEDEFAULT, - CW_USEDEFAULT, - 360,//CW_USEDEFAULT, - 240,//CW_USEDEFAULT, - 0, - 0, - hInstance, - 0); - - if (NULL == hwnd) - return 0; - - // Main message loop: - while (GetMessage(&msg, NULL, 0, 0) > 0) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - -//+--------------------------------------------------------------------------- - -//+--------------------------------------------------------------------------- - -void CenterWindow(HWND hwnd_self) -{ - HWND hwnd_parent; - RECT rw_self, rc_parent, rw_parent; - int xpos, ypos; - - hwnd_parent = GetParent(hwnd_self); - if (NULL == hwnd_parent) - hwnd_parent = GetDesktopWindow(); - - GetWindowRect(hwnd_parent, &rw_parent); - GetClientRect(hwnd_parent, &rc_parent); - GetWindowRect(hwnd_self, &rw_self); - - xpos = rw_parent.left + (rc_parent.right + rw_self.left - rw_self.right) / 2; - ypos = rw_parent.top + (rc_parent.bottom + rw_self.top - rw_self.bottom) / 2; - - SetWindowPos( - hwnd_self, NULL, - xpos, ypos, 0, 0, - SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE - ); -} - -//+--------------------------------------------------------------------------- diff --git a/win32/include/_mingw.h b/win32/include/_mingw.h deleted file mode 100644 index d10a6b18..00000000 --- a/win32/include/_mingw.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * _mingw.h - * - * This file is for TinyCC and not part of the Mingw32 package. - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -#ifndef __MINGW_H -#define __MINGW_H - -/* some winapi files define these before including _mingw.h --> */ -#undef __cdecl -#undef _X86_ -#undef WIN32 -/* <-- */ - -#include -#include - -#define __int8 char -#define __int16 short -#define __int32 int -#define __int64 long long -#define _HAVE_INT64 - -#define __cdecl -#define __declspec(x) __attribute__((x)) -#define __unaligned __attribute__((packed)) -#define __fastcall __attribute__((fastcall)) - -#define __MSVCRT__ 1 -#undef _MSVCRT_ -#define __MINGW_IMPORT extern __declspec(dllimport) -#define __MINGW_ATTRIB_NORETURN __declspec(noreturn) -#define __MINGW_ATTRIB_CONST -#define __MINGW_ATTRIB_DEPRECATED -#define __MINGW_ATTRIB_MALLOC -#define __MINGW_ATTRIB_PURE -#define __MINGW_ATTRIB_NONNULL(arg) -#define __MINGW_NOTHROW -#define __GNUC_VA_LIST - -#define _CRTIMP extern -#define __CRT_INLINE static __inline__ - -#define _CRT_ALIGN(x) __attribute__((aligned(x))) -#define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) -#define _CRT_PACKING 8 -#define __CRT_UNALIGNED -#define _CONST_RETURN - -#ifndef _TRUNCATE -#define _TRUNCATE ((size_t)-1) -#endif - -#define __CRT_STRINGIZE(_Value) #_Value -#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value) -#define __CRT_WIDE(_String) L ## _String -#define _CRT_WIDE(_String) __CRT_WIDE(_String) - -#ifdef _WIN64 -#define __stdcall -#define _AMD64_ 1 -#define __x86_64 1 -#define _M_X64 100 /* Visual Studio */ -#define _M_AMD64 100 /* Visual Studio */ -#define USE_MINGW_SETJMP_TWO_ARGS -#define mingw_getsp tinyc_getbp -#else -#define __stdcall __attribute__((__stdcall__)) -#define _X86_ 1 -#define _M_IX86 300 /* Visual Studio */ -#ifndef __MINGW_USE_VC2005_COMPAT /* time became 64, but not timeval.tv_sec */ -# ifndef _USE_32BIT_TIME_T -# define _USE_32BIT_TIME_T -# endif -#endif -#endif - -/* in stddef.h */ -#define _SIZE_T_DEFINED -#define _SSIZE_T_DEFINED -#define _PTRDIFF_T_DEFINED -#define _WCHAR_T_DEFINED -#define _UINTPTR_T_DEFINED -#define _INTPTR_T_DEFINED -#define _INTEGRAL_MAX_BITS 64 - -#ifndef _TIME32_T_DEFINED -#define _TIME32_T_DEFINED -typedef long __time32_t; -#endif - -#ifndef _TIME64_T_DEFINED -#define _TIME64_T_DEFINED -typedef long long __time64_t; -#endif - -#ifndef _TIME_T_DEFINED -#define _TIME_T_DEFINED -#ifdef _USE_32BIT_TIME_T -typedef __time32_t time_t; -#else -typedef __time64_t time_t; -#endif -#endif - -#ifndef _WCTYPE_T_DEFINED -#define _WCTYPE_T_DEFINED -typedef wchar_t wctype_t; -#endif - -#ifndef _WINT_T -#define _WINT_T -typedef __WINT_TYPE__ wint_t; -#endif - -typedef int errno_t; -#define _ERRCODE_DEFINED - -typedef struct threadlocaleinfostruct *pthreadlocinfo; -typedef struct threadmbcinfostruct *pthreadmbcinfo; -typedef struct localeinfo_struct _locale_tstruct,*_locale_t; - -/* for winapi */ -#define _ANONYMOUS_UNION -#define _ANONYMOUS_STRUCT -#define DECLSPEC_NORETURN __declspec(noreturn) -#define DECLARE_STDCALL_P(type) __stdcall type -#define NOSERVICE 1 -#define NOMCX 1 -#define NOIME 1 -#define __INTRIN_H_ -#ifndef DUMMYUNIONNAME -# define DUMMYUNIONNAME -# define DUMMYUNIONNAME1 -# define DUMMYUNIONNAME2 -# define DUMMYUNIONNAME3 -# define DUMMYUNIONNAME4 -# define DUMMYUNIONNAME5 -#endif -#ifndef DUMMYSTRUCTNAME -# define DUMMYSTRUCTNAME -#endif -#ifndef WINVER -# define WINVER 0x0502 -#endif -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x502 -#endif - -#define __C89_NAMELESS -#define __MINGW_EXTENSION -#define WINAPI_FAMILY_PARTITION(X) 1 -#define MINGW_HAS_SECURE_API -#define WIN32 1 - -#endif /* __MINGW_H */ diff --git a/win32/include/assert.h b/win32/include/assert.h deleted file mode 100644 index b15bb638..00000000 --- a/win32/include/assert.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef __ASSERT_H_ -#define __ASSERT_H_ - -#include <_mingw.h> -#ifdef __cplusplus -#include -#endif - -#ifdef NDEBUG -#ifndef assert -#define assert(_Expression) ((void)0) -#endif -#else - -#ifndef _CRT_TERMINATE_DEFINED -#define _CRT_TERMINATE_DEFINED - void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; - _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; -#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ -/* C99 function name */ -void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; -__CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) -{ _exit(status); } -#endif - -#pragma push_macro("abort") -#undef abort - void __cdecl __declspec(noreturn) abort(void); -#pragma pop_macro("abort") - -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - -extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); -extern void __cdecl _assert(const char *, const char *, unsigned); - -#ifdef __cplusplus -} -#endif - -#ifndef assert -//#define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0)) -#define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__)) -#endif - -#endif - -#if (__STDC_VERSION__ >= 201112L) && !defined(static_assert) -/* C11, section 7.2: The macro static_assert expands to _Static_assert. */ -#define static_assert(exp, str) _Static_assert(exp, str) -#endif - -#endif diff --git a/win32/include/conio.h b/win32/include/conio.h deleted file mode 100644 index 39f779eb..00000000 --- a/win32/include/conio.h +++ /dev/null @@ -1,409 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_CONIO -#define _INC_CONIO - -#include <_mingw.h> - -#ifdef __cplusplus -extern "C" { -#endif - - _CRTIMP char *_cgets(char *_Buffer); - _CRTIMP int __cdecl _cprintf(const char *_Format,...); - _CRTIMP int __cdecl _cputs(const char *_Str); - _CRTIMP int __cdecl _cscanf(const char *_Format,...); - _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _getch(void); - _CRTIMP int __cdecl _getche(void); - _CRTIMP int __cdecl _vcprintf(const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cprintf_p(const char *_Format,...); - _CRTIMP int __cdecl _vcprintf_p(const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cprintf_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _cprintf_p_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _kbhit(void); - -#if defined(_X86_) && !defined(__x86_64) - int __cdecl _inp(unsigned short); - unsigned short __cdecl _inpw(unsigned short); - unsigned long __cdecl _inpd(unsigned short); - int __cdecl _outp(unsigned short,int); - unsigned short __cdecl _outpw(unsigned short,unsigned short); - unsigned long __cdecl _outpd(unsigned short,unsigned long); -#endif - - _CRTIMP int __cdecl _putch(int _Ch); - _CRTIMP int __cdecl _ungetch(int _Ch); - _CRTIMP int __cdecl _getch_nolock(void); - _CRTIMP int __cdecl _getche_nolock(void); - _CRTIMP int __cdecl _putch_nolock(int _Ch); - _CRTIMP int __cdecl _ungetch_nolock(int _Ch); - -#ifndef _WCONIO_DEFINED -#define _WCONIO_DEFINED - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - - _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); - _CRTIMP wint_t __cdecl _getwch(void); - _CRTIMP wint_t __cdecl _getwche(void); - _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); - _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); - _CRTIMP int __cdecl _cputws(const wchar_t *_String); - _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); - _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh); - _CRTIMP wint_t __cdecl _getwch_nolock(void); - _CRTIMP wint_t __cdecl _getwche_nolock(void); - _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh); -#endif - -#ifndef NO_OLDNAMES - char *__cdecl cgets(char *_Buffer); - int __cdecl cprintf(const char *_Format,...); - int __cdecl cputs(const char *_Str); - int __cdecl cscanf(const char *_Format,...); - int __cdecl getch(void); - int __cdecl getche(void); - int __cdecl kbhit(void); - int __cdecl putch(int _Ch); - int __cdecl ungetch(int _Ch); - -#if (defined(_X86_) && !defined(__x86_64)) - int __cdecl inp(unsigned short); - unsigned short __cdecl inpw(unsigned short); - int __cdecl outp(unsigned short,int); - unsigned short __cdecl outpw(unsigned short,unsigned short); -#endif - - /* I/O intrin functions. */ - __CRT_INLINE unsigned char __inbyte(unsigned short Port) - { - unsigned char value; - __asm__ __volatile__ ("inb %w1,%b0" - : "=a" (value) - : "Nd" (Port)); - return value; - } - __CRT_INLINE unsigned short __inword(unsigned short Port) - { - unsigned short value; - __asm__ __volatile__ ("inw %w1,%w0" - : "=a" (value) - : "Nd" (Port)); - return value; - } - __CRT_INLINE unsigned long __indword(unsigned short Port) - { - unsigned long value; - __asm__ __volatile__ ("inl %w1,%0" - : "=a" (value) - : "Nd" (Port)); - return value; - } - __CRT_INLINE void __outbyte(unsigned short Port,unsigned char Data) - { - __asm__ __volatile__ ("outb %b0,%w1" - : - : "a" (Data), "Nd" (Port)); - } - __CRT_INLINE void __outword(unsigned short Port,unsigned short Data) - { - __asm__ __volatile__ ("outw %w0,%w1" - : - : "a" (Data), "Nd" (Port)); - } - __CRT_INLINE void __outdword(unsigned short Port,unsigned long Data) - { - __asm__ __volatile__ ("outl %0,%w1" - : - : "a" (Data), "Nd" (Port)); - } - __CRT_INLINE void __inbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) - { - __asm__ __volatile__ ( - "cld ; rep ; insb " - : "=D" (Buffer), "=c" (Count) - : "d"(Port), "0"(Buffer), "1" (Count) - ); - } - __CRT_INLINE void __inwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) - { - __asm__ __volatile__ ( - "cld ; rep ; insw " - : "=D" (Buffer), "=c" (Count) - : "d"(Port), "0"(Buffer), "1" (Count) - ); - } - __CRT_INLINE void __indwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) - { - __asm__ __volatile__ ( - "cld ; rep ; insl " - : "=D" (Buffer), "=c" (Count) - : "d"(Port), "0"(Buffer), "1" (Count) - ); - } - - __CRT_INLINE void __outbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count) - { - __asm__ __volatile__ ( - "cld ; rep ; outsb " - : "=S" (Buffer), "=c" (Count) - : "d"(Port), "0"(Buffer), "1" (Count) - ); - } - __CRT_INLINE void __outwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count) - { - __asm__ __volatile__ ( - "cld ; rep ; outsw " - : "=S" (Buffer), "=c" (Count) - : "d"(Port), "0"(Buffer), "1" (Count) - ); - } - __CRT_INLINE void __outdwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count) - { - __asm__ __volatile__ ( - "cld ; rep ; outsl " - : "=S" (Buffer), "=c" (Count) - : "d"(Port), "0"(Buffer), "1" (Count) - ); - } - - __CRT_INLINE unsigned __int64 __readcr0(void) - { - unsigned __int64 value; - __asm__ __volatile__ ( - "mov %%cr0, %[value]" - : [value] "=q" (value)); - return value; - } - - /* Register sizes are different between 32/64 bit mode. So we have to do this for _WIN64 and _WIN32 - separately. */ - -#ifdef _WIN64 - __CRT_INLINE void __writecr0(unsigned __int64 Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr0" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned __int64 __readcr2(void) - { - unsigned __int64 value; - __asm__ __volatile__ ( - "mov %%cr2, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr2(unsigned __int64 Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr2" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned __int64 __readcr3(void) - { - unsigned __int64 value; - __asm__ __volatile__ ( - "mov %%cr3, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr3(unsigned __int64 Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr3" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned __int64 __readcr4(void) - { - unsigned __int64 value; - __asm__ __volatile__ ( - "mov %%cr4, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr4(unsigned __int64 Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr4" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned __int64 __readcr8(void) - { - unsigned __int64 value; - __asm__ __volatile__ ( - "mov %%cr8, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr8(unsigned __int64 Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr8" - : - : [Data] "q" (Data) - : "memory"); - } - -#elif defined(_WIN32) - - __CRT_INLINE void __writecr0(unsigned Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr0" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned long __readcr2(void) - { - unsigned long value; - __asm__ __volatile__ ( - "mov %%cr2, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr2(unsigned Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr2" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned long __readcr3(void) - { - unsigned long value; - __asm__ __volatile__ ( - "mov %%cr3, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr3(unsigned Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr3" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned long __readcr4(void) - { - unsigned long value; - __asm__ __volatile__ ( - "mov %%cr4, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr4(unsigned Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr4" - : - : [Data] "q" (Data) - : "memory"); - } - - __CRT_INLINE unsigned long __readcr8(void) - { - unsigned long value; __asm__ __volatile__ ( - "mov %%cr8, %[value]" - : [value] "=q" (value)); - return value; - } - - __CRT_INLINE void __writecr8(unsigned Data) - { - __asm__ __volatile__ ( - "mov %[Data], %%cr8" - : - : [Data] "q" (Data) - : "memory"); - } - -#endif - - __CRT_INLINE unsigned __int64 __readmsr(unsigned long msr) - { - unsigned __int64 val1, val2; - __asm__ __volatile__( - "rdmsr" - : "=a" (val1), "=d" (val2) - : "c" (msr)); - return val1 | (val2 << 32); - } - - __CRT_INLINE void __writemsr (unsigned long msr, unsigned __int64 Value) - { - unsigned long val1 = Value, val2 = Value >> 32; - __asm__ __volatile__ ( - "wrmsr" - : - : "c" (msr), "a" (val1), "d" (val2)); - } - - __CRT_INLINE unsigned __int64 __rdtsc(void) - { - unsigned __int64 val1, val2; - __asm__ __volatile__ ( - "rdtsc" - : "=a" (val1), "=d" (val2)); - return val1 | (val2 << 32); - } - - __CRT_INLINE void __cpuid(int CPUInfo[4], int InfoType) - { - __asm__ __volatile__ ( - "cpuid" - : "=a" (CPUInfo [0]), "=b" (CPUInfo [1]), "=c" (CPUInfo [2]), "=d" (CPUInfo [3]) - : "a" (InfoType)); - } - -#endif - -#ifdef __cplusplus -} -#endif - -#include - -#endif diff --git a/win32/include/ctype.h b/win32/include/ctype.h deleted file mode 100644 index 7e901002..00000000 --- a/win32/include/ctype.h +++ /dev/null @@ -1,281 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_CTYPE -#define _INC_CTYPE - -#include <_mingw.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - -#ifndef _CRT_CTYPEDATA_DEFINED -#define _CRT_CTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS - -#ifndef __PCTYPE_FUNC -#define __PCTYPE_FUNC __pctype_func() -#ifdef _MSVCRT_ -#define __pctype_func() (_pctype) -#else -#define __pctype_func() (*_imp___pctype) -#endif -#endif - -#ifndef _pctype -#ifdef _MSVCRT_ - extern unsigned short *_pctype; -#else - extern unsigned short **_imp___pctype; -#define _pctype (*_imp___pctype) -#endif -#endif - -#endif -#endif - -#ifndef _CRT_WCTYPEDATA_DEFINED -#define _CRT_WCTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS -#ifndef _wctype -#ifdef _MSVCRT_ - extern unsigned short *_wctype; -#else - extern unsigned short **_imp___wctype; -#define _wctype (*_imp___wctype) -#endif -#endif -#ifdef _MSVCRT_ -#define __pwctype_func() (_pwctype) -#ifndef _pwctype - extern unsigned short *_pwctype; -#endif -#else -#define __pwctype_func() (*_imp___pwctype) -#ifndef _pwctype - extern unsigned short **_imp___pwctype; -#define _pwctype (*_imp___pwctype) -#endif -#endif -#endif -#endif - - /* CRT stuff */ -#if 1 - extern const unsigned char __newclmap[]; - extern const unsigned char __newcumap[]; - extern pthreadlocinfo __ptlocinfo; - extern pthreadmbcinfo __ptmbcinfo; - extern int __globallocalestatus; - extern int __locale_changed; - extern struct threadlocaleinfostruct __initiallocinfo; - extern _locale_tstruct __initiallocalestructinfo; - pthreadlocinfo __cdecl __updatetlocinfo(void); - pthreadmbcinfo __cdecl __updatetmbcinfo(void); -#endif - -#define _UPPER 0x1 -#define _LOWER 0x2 -#define _DIGIT 0x4 -#define _SPACE 0x8 - -#define _PUNCT 0x10 -#define _CONTROL 0x20 -#define _BLANK 0x40 -#define _HEX 0x80 - -#define _LEADBYTE 0x8000 -#define _ALPHA (0x0100|_UPPER|_LOWER) - -#ifndef _CTYPE_DEFINED -#define _CTYPE_DEFINED - - _CRTIMP int __cdecl _isctype(int _C,int _Type); - _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); - _CRTIMP int __cdecl isalpha(int _C); - _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl isupper(int _C); - _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl islower(int _C); - _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl isdigit(int _C); - _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl isxdigit(int _C); - _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl isspace(int _C); - _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl ispunct(int _C); - _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl isalnum(int _C); - _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl isprint(int _C); - _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl isgraph(int _C); - _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl iscntrl(int _C); - _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl toupper(int _C); - _CRTIMP int __cdecl tolower(int _C); - _CRTIMP int __cdecl _tolower(int _C); - _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl _toupper(int _C); - _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale); - _CRTIMP int __cdecl __isascii(int _C); - _CRTIMP int __cdecl __toascii(int _C); - _CRTIMP int __cdecl __iscsymf(int _C); - _CRTIMP int __cdecl __iscsym(int _C); - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) -int __cdecl isblank(int _C); -#endif -#endif - -#ifndef _WCTYPE_DEFINED -#define _WCTYPE_DEFINED - - int __cdecl iswalpha(wint_t _C); - _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); - int __cdecl iswupper(wint_t _C); - _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); - int __cdecl iswlower(wint_t _C); - _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); - int __cdecl iswdigit(wint_t _C); - _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); - int __cdecl iswxdigit(wint_t _C); - _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); - int __cdecl iswspace(wint_t _C); - _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); - int __cdecl iswpunct(wint_t _C); - _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); - int __cdecl iswalnum(wint_t _C); - _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); - int __cdecl iswprint(wint_t _C); - _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); - int __cdecl iswgraph(wint_t _C); - _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); - int __cdecl iswcntrl(wint_t _C); - _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); - int __cdecl iswascii(wint_t _C); - int __cdecl isleadbyte(int _C); - _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); - wint_t __cdecl towupper(wint_t _C); - _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); - wint_t __cdecl towlower(wint_t _C); - _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); - int __cdecl iswctype(wint_t _C,wctype_t _Type); - _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); - _CRTIMP int __cdecl __iswcsymf(wint_t _C); - _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl __iswcsym(wint_t _C); - _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); - int __cdecl is_wctype(wint_t _C,wctype_t _Type); - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) -int __cdecl iswblank(wint_t _C); -#endif -#endif - -#ifndef _CTYPE_DISABLE_MACROS - -#ifndef MB_CUR_MAX -#define MB_CUR_MAX ___mb_cur_max_func() -#ifndef __mb_cur_max -#ifdef _MSVCRT_ - extern int __mb_cur_max; -#else -#define __mb_cur_max (*_imp____mb_cur_max) - extern int *_imp____mb_cur_max; -#endif -#endif -#ifdef _MSVCRT_ -#define ___mb_cur_max_func() (__mb_cur_max) -#else -#define ___mb_cur_max_func() (*_imp____mb_cur_max) -#endif -#endif - -#define __chvalidchk(a,b) (__PCTYPE_FUNC[(a)] & (b)) -#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[_Char] & (_Flag)) -#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale)) -#define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale) -#define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale) -#define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale) -#define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale) -#define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale) -#define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale) -#define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale) -#define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale) -#define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale) -#define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale) -#define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale) -#define _tolower(_Char) ((_Char)-'A'+'a') -#define _toupper(_Char) ((_Char)-'a'+'A') -#define __isascii(_Char) ((unsigned)(_Char) < 0x80) -#define __toascii(_Char) ((_Char) & 0x7f) - -#ifndef _WCTYPE_INLINE_DEFINED -#define _WCTYPE_INLINE_DEFINED - -#undef _CRT_WCTYPE_NOINLINE -#ifndef __cplusplus -#define iswalpha(_c) (iswctype(_c,_ALPHA)) -#define iswupper(_c) (iswctype(_c,_UPPER)) -#define iswlower(_c) (iswctype(_c,_LOWER)) -#define iswdigit(_c) (iswctype(_c,_DIGIT)) -#define iswxdigit(_c) (iswctype(_c,_HEX)) -#define iswspace(_c) (iswctype(_c,_SPACE)) -#define iswpunct(_c) (iswctype(_c,_PUNCT)) -#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) -#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) -#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) -#define iswcntrl(_c) (iswctype(_c,_CONTROL)) -#define iswascii(_c) ((unsigned)(_c) < 0x80) -#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) -#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) -#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) -#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) -#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) -#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) -#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) -#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) -#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) -#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) -#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) -#endif -#endif - -#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) -#define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) -#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) -#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) -#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) -#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) -#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) -#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) -#endif - -#ifndef NO_OLDNAMES -#ifndef _CTYPE_DEFINED - int __cdecl isascii(int _C); - int __cdecl toascii(int _C); - int __cdecl iscsymf(int _C); - int __cdecl iscsym(int _C); -#else -#define isascii __isascii -#define toascii __toascii -#define iscsymf __iscsymf -#define iscsym __iscsym -#endif -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/dir.h b/win32/include/dir.h deleted file mode 100644 index f38f750d..00000000 --- a/win32/include/dir.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* - * dir.h - * - * This file OBSOLESCENT and only provided for backward compatibility. - * Please use io.h instead. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Colin Peters - * Mumit Khan - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -#include - diff --git a/win32/include/direct.h b/win32/include/direct.h deleted file mode 100644 index 99ce69db..00000000 --- a/win32/include/direct.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_DIRECT -#define _INC_DIRECT - -#include <_mingw.h> -#include - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _DISKFREE_T_DEFINED -#define _DISKFREE_T_DEFINED - struct _diskfree_t { - unsigned total_clusters; - unsigned avail_clusters; - unsigned sectors_per_cluster; - unsigned bytes_per_sector; - }; -#endif - - _CRTIMP char *__cdecl _getcwd(char *_DstBuf,int _SizeInBytes); - _CRTIMP char *__cdecl _getdcwd(int _Drive,char *_DstBuf,int _SizeInBytes); - char *__cdecl _getdcwd_nolock(int _Drive,char *_DstBuf,int _SizeInBytes); - _CRTIMP int __cdecl _chdir(const char *_Path); - _CRTIMP int __cdecl _mkdir(const char *_Path); - _CRTIMP int __cdecl _rmdir(const char *_Path); - _CRTIMP int __cdecl _chdrive(int _Drive); - _CRTIMP int __cdecl _getdrive(void); - _CRTIMP unsigned long __cdecl _getdrives(void); - -#ifndef _GETDISKFREE_DEFINED -#define _GETDISKFREE_DEFINED - _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); -#endif - -#ifndef _WDIRECT_DEFINED -#define _WDIRECT_DEFINED - _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); - _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); - wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); - _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); - _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); - _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); -#endif - -#ifndef NO_OLDNAMES - -#define diskfree_t _diskfree_t - - char *__cdecl getcwd(char *_DstBuf,int _SizeInBytes); - int __cdecl chdir(const char *_Path); - int __cdecl mkdir(const char *_Path); - int __cdecl rmdir(const char *_Path); -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/dirent.h b/win32/include/dirent.h deleted file mode 100644 index cd31f59e..00000000 --- a/win32/include/dirent.h +++ /dev/null @@ -1,135 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* All the headers include this file. */ -#include <_mingw.h> - -#ifndef __STRICT_ANSI__ - -#ifndef _DIRENT_H_ -#define _DIRENT_H_ - - -#pragma pack(push,_CRT_PACKING) - -#include - -#ifndef RC_INVOKED - -#ifdef __cplusplus -extern "C" { -#endif - - struct dirent - { - long d_ino; /* Always zero. */ - unsigned short d_reclen; /* Always zero. */ - unsigned short d_namlen; /* Length of name in d_name. */ - char* d_name; /* File name. */ - /* NOTE: The name in the dirent structure points to the name in the - * finddata_t structure in the DIR. */ - }; - - /* - * This is an internal data structure. Good programmers will not use it - * except as an argument to one of the functions below. - * dd_stat field is now int (was short in older versions). - */ - typedef struct - { - /* disk transfer area for this dir */ - struct _finddata_t dd_dta; - - /* dirent struct to return from dir (NOTE: this makes this thread - * safe as long as only one thread uses a particular DIR struct at - * a time) */ - struct dirent dd_dir; - - /* _findnext handle */ - long dd_handle; - - /* - * Status of search: - * 0 = not started yet (next entry to read is first entry) - * -1 = off the end - * positive = 0 based index of next entry - */ - int dd_stat; - - /* given path for dir with search pattern (struct is extended) */ - char dd_name[1]; - } DIR; - - DIR* __cdecl opendir (const char*); - struct dirent* __cdecl readdir (DIR*); - int __cdecl closedir (DIR*); - void __cdecl rewinddir (DIR*); - long __cdecl telldir (DIR*); - void __cdecl seekdir (DIR*, long); - - - /* wide char versions */ - - struct _wdirent - { - long d_ino; /* Always zero. */ - unsigned short d_reclen; /* Always zero. */ - unsigned short d_namlen; /* Length of name in d_name. */ - wchar_t* d_name; /* File name. */ - /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ - }; - - /* - * This is an internal data structure. Good programmers will not use it - * except as an argument to one of the functions below. - */ - typedef struct - { - /* disk transfer area for this dir */ - struct _wfinddata_t dd_dta; - - /* dirent struct to return from dir (NOTE: this makes this thread - * safe as long as only one thread uses a particular DIR struct at - * a time) */ - struct _wdirent dd_dir; - - /* _findnext handle */ - long dd_handle; - - /* - * Status of search: - * 0 = not started yet (next entry to read is first entry) - * -1 = off the end - * positive = 0 based index of next entry - */ - int dd_stat; - - /* given path for dir with search pattern (struct is extended) */ - wchar_t dd_name[1]; - } _WDIR; - - - - _WDIR* __cdecl _wopendir (const wchar_t*); - struct _wdirent* __cdecl _wreaddir (_WDIR*); - int __cdecl _wclosedir (_WDIR*); - void __cdecl _wrewinddir (_WDIR*); - long __cdecl _wtelldir (_WDIR*); - void __cdecl _wseekdir (_WDIR*, long); - - -#ifdef __cplusplus -} -#endif - -#endif /* Not RC_INVOKED */ - -#pragma pack(pop) - -#endif /* Not _DIRENT_H_ */ - - -#endif /* Not __STRICT_ANSI__ */ - diff --git a/win32/include/dos.h b/win32/include/dos.h deleted file mode 100644 index 294e8fe1..00000000 --- a/win32/include/dos.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_DOS -#define _INC_DOS - -#include <_mingw.h> -#include - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _DISKFREE_T_DEFINED -#define _DISKFREE_T_DEFINED - - struct _diskfree_t { - unsigned total_clusters; - unsigned avail_clusters; - unsigned sectors_per_cluster; - unsigned bytes_per_sector; - }; -#endif - -#define _A_NORMAL 0x00 -#define _A_RDONLY 0x01 -#define _A_HIDDEN 0x02 -#define _A_SYSTEM 0x04 -#define _A_SUBDIR 0x10 -#define _A_ARCH 0x20 - -#ifndef _GETDISKFREE_DEFINED -#define _GETDISKFREE_DEFINED - _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); -#endif - -#if (defined(_X86_) && !defined(__x86_64)) - void __cdecl _disable(void); - void __cdecl _enable(void); -#endif - -#ifndef NO_OLDNAMES -#define diskfree_t _diskfree_t -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/errno.h b/win32/include/errno.h deleted file mode 100644 index 574ffa9b..00000000 --- a/win32/include/errno.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_ERRNO -#define _INC_ERRNO - -#include <_mingw.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _CRT_ERRNO_DEFINED -#define _CRT_ERRNO_DEFINED - _CRTIMP int *__cdecl _errno(void); -#define errno (*_errno()) - - errno_t __cdecl _set_errno(int _Value); - errno_t __cdecl _get_errno(int *_Value); -#endif - -#define EPERM 1 -#define ENOENT 2 -#define ESRCH 3 -#define EINTR 4 -#define EIO 5 -#define ENXIO 6 -#define E2BIG 7 -#define ENOEXEC 8 -#define EBADF 9 -#define ECHILD 10 -#define EAGAIN 11 -#define ENOMEM 12 -#define EACCES 13 -#define EFAULT 14 -#define EBUSY 16 -#define EEXIST 17 -#define EXDEV 18 -#define ENODEV 19 -#define ENOTDIR 20 -#define EISDIR 21 -#define ENFILE 23 -#define EMFILE 24 -#define ENOTTY 25 -#define EFBIG 27 -#define ENOSPC 28 -#define ESPIPE 29 -#define EROFS 30 -#define EMLINK 31 -#define EPIPE 32 -#define EDOM 33 -#define EDEADLK 36 -#define ENAMETOOLONG 38 -#define ENOLCK 39 -#define ENOSYS 40 -#define ENOTEMPTY 41 - -#ifndef RC_INVOKED -#if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED) -#define _SECURECRT_ERRCODE_VALUES_DEFINED -#define EINVAL 22 -#define ERANGE 34 -#define EILSEQ 42 -#define STRUNCATE 80 -#endif -#endif - -#define EDEADLOCK EDEADLK - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/excpt.h b/win32/include/excpt.h deleted file mode 100644 index 26cc9437..00000000 --- a/win32/include/excpt.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_EXCPT -#define _INC_EXCPT - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - - struct _EXCEPTION_POINTERS; - -#ifndef EXCEPTION_DISPOSITION -#define EXCEPTION_DISPOSITION int -#endif -#define ExceptionContinueExecution 0 -#define ExceptionContinueSearch 1 -#define ExceptionNestedException 2 -#define ExceptionCollidedUnwind 3 - -#if (defined(_X86_) && !defined(__x86_64)) - struct _EXCEPTION_RECORD; - struct _CONTEXT; - - EXCEPTION_DISPOSITION __cdecl _except_handler(struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,void *_DispatcherContext); -#elif defined(__ia64__) - - typedef struct _EXCEPTION_POINTERS *Exception_info_ptr; - struct _EXCEPTION_RECORD; - struct _CONTEXT; - struct _DISPATCHER_CONTEXT; - - _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,unsigned __int64 _MemoryStackFp,unsigned __int64 _BackingStoreFp,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext,unsigned __int64 _GlobalPointer); -#elif defined(__x86_64) - - struct _EXCEPTION_RECORD; - struct _CONTEXT; -#endif - -#define GetExceptionCode _exception_code -#define exception_code _exception_code -#define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info -#define exception_info (struct _EXCEPTION_POINTERS *)_exception_info -#define AbnormalTermination _abnormal_termination -#define abnormal_termination _abnormal_termination - - unsigned long __cdecl _exception_code(void); - void *__cdecl _exception_info(void); - int __cdecl _abnormal_termination(void); - -#define EXCEPTION_EXECUTE_HANDLER 1 -#define EXCEPTION_CONTINUE_SEARCH 0 -#define EXCEPTION_CONTINUE_EXECUTION -1 - - /* CRT stuff */ - typedef void (__cdecl * _PHNDLR)(int); - - struct _XCPT_ACTION { - unsigned long XcptNum; - int SigNum; - _PHNDLR XcptAction; - }; - - extern struct _XCPT_ACTION _XcptActTab[]; - extern int _XcptActTabCount; - extern int _XcptActTabSize; - extern int _First_FPE_Indx; - extern int _Num_FPE; - - int __cdecl __CppXcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); - int __cdecl _XcptFilter(unsigned long _ExceptionNum,struct _EXCEPTION_POINTERS * _ExceptionPtr); - - /* - * The type of function that is expected as an exception handler to be - * installed with _try1. - */ - typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); - -#ifndef HAVE_NO_SEH - /* - * This is not entirely necessary, but it is the structure installed by - * the _try1 primitive below. - */ - typedef struct _EXCEPTION_REGISTRATION { - struct _EXCEPTION_REGISTRATION *prev; - EXCEPTION_DISPOSITION (*handler)(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*); - } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION; - - typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD; - typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; -#endif - -#if (defined(_X86_) && !defined(__x86_64)) -#define __try1(pHandler) \ - __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); - -#define __except1 \ - __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ - : : : "%eax"); -#elif defined(__x86_64) -#define __try1(pHandler) \ - __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler)); - -#define __except1 \ - __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \ - : : : "%rax"); -#else -#define __try1(pHandler) -#define __except1 -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/fcntl.h b/win32/include/fcntl.h deleted file mode 100644 index 9202b08c..00000000 --- a/win32/include/fcntl.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#include <_mingw.h> - -#include - -#ifndef _INC_FCNTL -#define _INC_FCNTL - -#define _O_RDONLY 0x0000 -#define _O_WRONLY 0x0001 -#define _O_RDWR 0x0002 -#define _O_APPEND 0x0008 -#define _O_CREAT 0x0100 -#define _O_TRUNC 0x0200 -#define _O_EXCL 0x0400 -#define _O_TEXT 0x4000 -#define _O_BINARY 0x8000 -#define _O_WTEXT 0x10000 -#define _O_U16TEXT 0x20000 -#define _O_U8TEXT 0x40000 -#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) - -#define _O_RAW _O_BINARY -#define _O_NOINHERIT 0x0080 -#define _O_TEMPORARY 0x0040 -#define _O_SHORT_LIVED 0x1000 - -#define _O_SEQUENTIAL 0x0020 -#define _O_RANDOM 0x0010 - -#if !defined(NO_OLDNAMES) || defined(_POSIX) -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_APPEND _O_APPEND -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_EXCL _O_EXCL -#define O_TEXT _O_TEXT -#define O_BINARY _O_BINARY -#define O_RAW _O_BINARY -#define O_TEMPORARY _O_TEMPORARY -#define O_NOINHERIT _O_NOINHERIT -#define O_SEQUENTIAL _O_SEQUENTIAL -#define O_RANDOM _O_RANDOM -#define O_ACCMODE _O_ACCMODE -#endif -#endif diff --git a/win32/include/fenv.h b/win32/include/fenv.h deleted file mode 100644 index 258f3a5d..00000000 --- a/win32/include/fenv.h +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _FENV_H_ -#define _FENV_H_ - -#include <_mingw.h> - -/* FPU status word exception flags */ -#define FE_INVALID 0x01 -#define FE_DENORMAL 0x02 -#define FE_DIVBYZERO 0x04 -#define FE_OVERFLOW 0x08 -#define FE_UNDERFLOW 0x10 -#define FE_INEXACT 0x20 -#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \ - | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT) - -/* FPU control word rounding flags */ -#define FE_TONEAREST 0x0000 -#define FE_DOWNWARD 0x0400 -#define FE_UPWARD 0x0800 -#define FE_TOWARDZERO 0x0c00 - -/* The MXCSR exception flags are the same as the - FE flags. */ -#define __MXCSR_EXCEPT_FLAG_SHIFT 0 - -/* How much to shift FE status word exception flags - to get MXCSR rounding flags, */ -#define __MXCSR_ROUND_FLAG_SHIFT 3 - -#ifndef RC_INVOKED -/* - For now, support only for the basic abstraction of flags that are - either set or clear. fexcept_t could be structure that holds more - info about the fp environment. -*/ -typedef unsigned short fexcept_t; - -/* This 32-byte struct represents the entire floating point - environment as stored by fnstenv or fstenv, augmented by - the contents of the MXCSR register, as stored by stmxcsr - (if CPU supports it). */ -typedef struct -{ - unsigned short __control_word; - unsigned short __unused0; - unsigned short __status_word; - unsigned short __unused1; - unsigned short __tag_word; - unsigned short __unused2; - unsigned int __ip_offset; /* instruction pointer offset */ - unsigned short __ip_selector; - unsigned short __opcode; - unsigned int __data_offset; - unsigned short __data_selector; - unsigned short __unused3; - unsigned int __mxcsr; /* contents of the MXCSR register */ -} fenv_t; - - -/*The C99 standard (7.6.9) allows us to define implementation-specific macros for - different fp environments */ - -/* The default Intel x87 floating point environment (64-bit mantissa) */ -#define FE_PC64_ENV ((const fenv_t *)-1) - -/* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */ -#define FE_PC53_ENV ((const fenv_t *)-2) - -/* The FE_DFL_ENV macro is required by standard. - fesetenv will use the environment set at app startup.*/ -#define FE_DFL_ENV ((const fenv_t *) 0) - -#ifdef __cplusplus -extern "C" { -#endif - -/*TODO: Some of these could be inlined */ -/* 7.6.2 Exception */ - -extern int __cdecl feclearexcept (int); -extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts); -extern int __cdecl feraiseexcept (int excepts ); -extern int __cdecl fesetexceptflag (const fexcept_t *, int); -extern int __cdecl fetestexcept (int excepts); - -/* 7.6.3 Rounding */ - -extern int __cdecl fegetround (void); -extern int __cdecl fesetround (int mode); - -/* 7.6.4 Environment */ - -extern int __cdecl fegetenv(fenv_t * envp); -extern int __cdecl fesetenv(const fenv_t * ); -extern int __cdecl feupdateenv(const fenv_t *); -extern int __cdecl feholdexcept(fenv_t *); - -#ifdef __cplusplus -} -#endif -#endif /* Not RC_INVOKED */ - -#endif /* ndef _FENV_H */ diff --git a/win32/include/inttypes.h b/win32/include/inttypes.h deleted file mode 100644 index 73600919..00000000 --- a/win32/include/inttypes.h +++ /dev/null @@ -1,297 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* 7.8 Format conversion of integer types */ - -#ifndef _INTTYPES_H_ -#define _INTTYPES_H_ - -#include <_mingw.h> -#include -#define __need_wchar_t -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - intmax_t quot; - intmax_t rem; - } imaxdiv_t; - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) - -/* 7.8.1 Macros for format specifiers - * - * MS runtime does not yet understand C9x standard "ll" - * length specifier. It appears to treat "ll" as "l". - * The non-standard I64 length specifier causes warning in GCC, - * but understood by MS runtime functions. - */ - -/* fprintf macros for signed types */ -#define PRId8 "d" -#define PRId16 "d" -#define PRId32 "d" -#define PRId64 "I64d" - -#define PRIdLEAST8 "d" -#define PRIdLEAST16 "d" -#define PRIdLEAST32 "d" -#define PRIdLEAST64 "I64d" - -#define PRIdFAST8 "d" -#define PRIdFAST16 "d" -#define PRIdFAST32 "d" -#define PRIdFAST64 "I64d" - -#define PRIdMAX "I64d" - -#define PRIi8 "i" -#define PRIi16 "i" -#define PRIi32 "i" -#define PRIi64 "I64i" - -#define PRIiLEAST8 "i" -#define PRIiLEAST16 "i" -#define PRIiLEAST32 "i" -#define PRIiLEAST64 "I64i" - -#define PRIiFAST8 "i" -#define PRIiFAST16 "i" -#define PRIiFAST32 "i" -#define PRIiFAST64 "I64i" - -#define PRIiMAX "I64i" - -#define PRIo8 "o" -#define PRIo16 "o" -#define PRIo32 "o" -#define PRIo64 "I64o" - -#define PRIoLEAST8 "o" -#define PRIoLEAST16 "o" -#define PRIoLEAST32 "o" -#define PRIoLEAST64 "I64o" - -#define PRIoFAST8 "o" -#define PRIoFAST16 "o" -#define PRIoFAST32 "o" -#define PRIoFAST64 "I64o" - -#define PRIoMAX "I64o" - -/* fprintf macros for unsigned types */ -#define PRIu8 "u" -#define PRIu16 "u" -#define PRIu32 "u" -#define PRIu64 "I64u" - - -#define PRIuLEAST8 "u" -#define PRIuLEAST16 "u" -#define PRIuLEAST32 "u" -#define PRIuLEAST64 "I64u" - -#define PRIuFAST8 "u" -#define PRIuFAST16 "u" -#define PRIuFAST32 "u" -#define PRIuFAST64 "I64u" - -#define PRIuMAX "I64u" - -#define PRIx8 "x" -#define PRIx16 "x" -#define PRIx32 "x" -#define PRIx64 "I64x" - -#define PRIxLEAST8 "x" -#define PRIxLEAST16 "x" -#define PRIxLEAST32 "x" -#define PRIxLEAST64 "I64x" - -#define PRIxFAST8 "x" -#define PRIxFAST16 "x" -#define PRIxFAST32 "x" -#define PRIxFAST64 "I64x" - -#define PRIxMAX "I64x" - -#define PRIX8 "X" -#define PRIX16 "X" -#define PRIX32 "X" -#define PRIX64 "I64X" - -#define PRIXLEAST8 "X" -#define PRIXLEAST16 "X" -#define PRIXLEAST32 "X" -#define PRIXLEAST64 "I64X" - -#define PRIXFAST8 "X" -#define PRIXFAST16 "X" -#define PRIXFAST32 "X" -#define PRIXFAST64 "I64X" - -#define PRIXMAX "I64X" - -/* - * fscanf macros for signed int types - * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t - * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have - * no length identifiers - */ - -#define SCNd16 "hd" -#define SCNd32 "d" -#define SCNd64 "I64d" - -#define SCNdLEAST16 "hd" -#define SCNdLEAST32 "d" -#define SCNdLEAST64 "I64d" - -#define SCNdFAST16 "hd" -#define SCNdFAST32 "d" -#define SCNdFAST64 "I64d" - -#define SCNdMAX "I64d" - -#define SCNi16 "hi" -#define SCNi32 "i" -#define SCNi64 "I64i" - -#define SCNiLEAST16 "hi" -#define SCNiLEAST32 "i" -#define SCNiLEAST64 "I64i" - -#define SCNiFAST16 "hi" -#define SCNiFAST32 "i" -#define SCNiFAST64 "I64i" - -#define SCNiMAX "I64i" - -#define SCNo16 "ho" -#define SCNo32 "o" -#define SCNo64 "I64o" - -#define SCNoLEAST16 "ho" -#define SCNoLEAST32 "o" -#define SCNoLEAST64 "I64o" - -#define SCNoFAST16 "ho" -#define SCNoFAST32 "o" -#define SCNoFAST64 "I64o" - -#define SCNoMAX "I64o" - -#define SCNx16 "hx" -#define SCNx32 "x" -#define SCNx64 "I64x" - -#define SCNxLEAST16 "hx" -#define SCNxLEAST32 "x" -#define SCNxLEAST64 "I64x" - -#define SCNxFAST16 "hx" -#define SCNxFAST32 "x" -#define SCNxFAST64 "I64x" - -#define SCNxMAX "I64x" - -/* fscanf macros for unsigned int types */ - -#define SCNu16 "hu" -#define SCNu32 "u" -#define SCNu64 "I64u" - -#define SCNuLEAST16 "hu" -#define SCNuLEAST32 "u" -#define SCNuLEAST64 "I64u" - -#define SCNuFAST16 "hu" -#define SCNuFAST32 "u" -#define SCNuFAST64 "I64u" - -#define SCNuMAX "I64u" - -#ifdef _WIN64 -#define PRIdPTR "I64d" -#define PRIiPTR "I64i" -#define PRIoPTR "I64o" -#define PRIuPTR "I64u" -#define PRIxPTR "I64x" -#define PRIXPTR "I64X" -#define SCNdPTR "I64d" -#define SCNiPTR "I64i" -#define SCNoPTR "I64o" -#define SCNxPTR "I64x" -#define SCNuPTR "I64u" -#else -#define PRIdPTR "d" -#define PRIiPTR "i" -#define PRIoPTR "o" -#define PRIuPTR "u" -#define PRIxPTR "x" -#define PRIXPTR "X" -#define SCNdPTR "d" -#define SCNiPTR "i" -#define SCNoPTR "o" -#define SCNxPTR "x" -#define SCNuPTR "u" -#endif - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -/* - * no length modifier for char types prior to C9x - * MS runtime scanf appears to treat "hh" as "h" - */ - -/* signed char */ -#define SCNd8 "hhd" -#define SCNdLEAST8 "hhd" -#define SCNdFAST8 "hhd" - -#define SCNi8 "hhi" -#define SCNiLEAST8 "hhi" -#define SCNiFAST8 "hhi" - -#define SCNo8 "hho" -#define SCNoLEAST8 "hho" -#define SCNoFAST8 "hho" - -#define SCNx8 "hhx" -#define SCNxLEAST8 "hhx" -#define SCNxFAST8 "hhx" - -/* unsigned char */ -#define SCNu8 "hhu" -#define SCNuLEAST8 "hhu" -#define SCNuFAST8 "hhu" -#endif /* __STDC_VERSION__ >= 199901 */ - -#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ - -intmax_t __cdecl imaxabs (intmax_t j); -__CRT_INLINE intmax_t __cdecl imaxabs (intmax_t j) - {return (j >= 0 ? j : -j);} -imaxdiv_t __cdecl imaxdiv (intmax_t numer, intmax_t denom); - -/* 7.8.2 Conversion functions for greatest-width integer types */ - -intmax_t __cdecl strtoimax (const char* __restrict__ nptr, - char** __restrict__ endptr, int base); -uintmax_t __cdecl strtoumax (const char* __restrict__ nptr, - char** __restrict__ endptr, int base); - -intmax_t __cdecl wcstoimax (const wchar_t* __restrict__ nptr, - wchar_t** __restrict__ endptr, int base); -uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr, - wchar_t** __restrict__ endptr, int base); - -#ifdef __cplusplus -} -#endif - -#endif /* ndef _INTTYPES_H */ diff --git a/win32/include/io.h b/win32/include/io.h deleted file mode 100644 index e2aeec3d..00000000 --- a/win32/include/io.h +++ /dev/null @@ -1,418 +0,0 @@ - -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _IO_H_ -#define _IO_H_ - -#include <_mingw.h> -#include - -#pragma pack(push,_CRT_PACKING) - -#ifndef _POSIX_ - -#ifdef __cplusplus -extern "C" { -#endif - -_CRTIMP char* __cdecl _getcwd (char*, int); -#ifndef _FSIZE_T_DEFINED - typedef unsigned long _fsize_t; -#define _FSIZE_T_DEFINED -#endif - -#ifndef _FINDDATA_T_DEFINED - - struct _finddata32_t { - unsigned attrib; - __time32_t time_create; - __time32_t time_access; - __time32_t time_write; - _fsize_t size; - char name[260]; - }; - -/*#if _INTEGRAL_MAX_BITS >= 64*/ - - struct _finddata32i64_t { - unsigned attrib; - __time32_t time_create; - __time32_t time_access; - __time32_t time_write; - __int64 size; - char name[260]; - }; - - struct _finddata64i32_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - _fsize_t size; - char name[260]; - }; - - struct __finddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - __int64 size; - char name[260]; - }; -/* #endif */ - -#ifdef _USE_32BIT_TIME_T -#define _finddata_t _finddata32_t -#define _finddatai64_t _finddata32i64_t - -#ifdef _WIN64 -#define _findfirst _findfirst32 -#define _findnext _findnext32 -#else -#define _findfirst32 _findfirst -#define _findnext32 _findnext -#endif -#define _findfirsti64 _findfirst32i64 -#define _findnexti64 _findnext32i64 -#else -#define _finddata_t _finddata64i32_t -#define _finddatai64_t __finddata64_t - -#define _findfirst _findfirst64i32 -#define _findnext _findnext64i32 -#define _findfirsti64 _findfirst64 -#define _findnexti64 _findnext64 -#endif - -#define _FINDDATA_T_DEFINED -#endif - -#ifndef _WFINDDATA_T_DEFINED - - struct _wfinddata32_t { - unsigned attrib; - __time32_t time_create; - __time32_t time_access; - __time32_t time_write; - _fsize_t size; - wchar_t name[260]; - }; - -/* #if _INTEGRAL_MAX_BITS >= 64 */ - - struct _wfinddata32i64_t { - unsigned attrib; - __time32_t time_create; - __time32_t time_access; - __time32_t time_write; - __int64 size; - wchar_t name[260]; - }; - - struct _wfinddata64i32_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - _fsize_t size; - wchar_t name[260]; - }; - - struct _wfinddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - __int64 size; - wchar_t name[260]; - }; -/* #endif */ - -#ifdef _USE_32BIT_TIME_T -#define _wfinddata_t _wfinddata32_t -#define _wfinddatai64_t _wfinddata32i64_t - -#define _wfindfirst _wfindfirst32 -#define _wfindnext _wfindnext32 -#define _wfindfirsti64 _wfindfirst32i64 -#define _wfindnexti64 _wfindnext32i64 -#else -#define _wfinddata_t _wfinddata64i32_t -#define _wfinddatai64_t _wfinddata64_t - -#define _wfindfirst _wfindfirst64i32 -#define _wfindnext _wfindnext64i32 -#define _wfindfirsti64 _wfindfirst64 -#define _wfindnexti64 _wfindnext64 -#endif - -#define _WFINDDATA_T_DEFINED -#endif - -#define _A_NORMAL 0x00 -#define _A_RDONLY 0x01 -#define _A_HIDDEN 0x02 -#define _A_SYSTEM 0x04 -#define _A_SUBDIR 0x10 -#define _A_ARCH 0x20 - -#ifndef _SIZE_T_DEFINED -#define _SIZE_T_DEFINED -#undef size_t -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef unsigned int size_t __attribute__ ((mode (DI))); -#else - typedef unsigned __int64 size_t; -#endif -#else - typedef unsigned int size_t; -#endif -#endif - -#ifndef _SSIZE_T_DEFINED -#define _SSIZE_T_DEFINED -#undef ssize_t -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef int ssize_t __attribute__ ((mode (DI))); -#else - typedef __int64 ssize_t; -#endif -#else - typedef int ssize_t; -#endif -#endif - -#ifndef _OFF_T_DEFINED -#define _OFF_T_DEFINED -#ifndef _OFF_T_ -#define _OFF_T_ - typedef long _off_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long off_t; -#endif -#endif -#endif - -#ifndef _OFF64_T_DEFINED -#define _OFF64_T_DEFINED -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef int _off64_t __attribute__ ((mode (DI))); -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef int off64_t __attribute__ ((mode (DI))); -#endif -#else - typedef long long _off64_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long long off64_t; -#endif -#endif -#endif - - /* Some defines for _access nAccessMode (MS doesn't define them, but - * it doesn't seem to hurt to add them). */ -#define F_OK 0 /* Check for file existence */ -#define X_OK 1 /* Check for execute permission. */ -#define W_OK 2 /* Check for write permission */ -#define R_OK 4 /* Check for read permission */ - - _CRTIMP int __cdecl _access(const char *_Filename,int _AccessMode); - _CRTIMP int __cdecl _chmod(const char *_Filename,int _Mode); - _CRTIMP int __cdecl _chsize(int _FileHandle,long _Size); - _CRTIMP int __cdecl _close(int _FileHandle); - _CRTIMP int __cdecl _commit(int _FileHandle); - _CRTIMP int __cdecl _creat(const char *_Filename,int _PermissionMode); - _CRTIMP int __cdecl _dup(int _FileHandle); - _CRTIMP int __cdecl _dup2(int _FileHandleSrc,int _FileHandleDst); - _CRTIMP int __cdecl _eof(int _FileHandle); - _CRTIMP long __cdecl _filelength(int _FileHandle); - _CRTIMP intptr_t __cdecl _findfirst32(const char *_Filename,struct _finddata32_t *_FindData); - _CRTIMP int __cdecl _findnext32(intptr_t _FindHandle,struct _finddata32_t *_FindData); - _CRTIMP int __cdecl _findclose(intptr_t _FindHandle); - _CRTIMP int __cdecl _isatty(int _FileHandle); - _CRTIMP int __cdecl _locking(int _FileHandle,int _LockMode,long _NumOfBytes); - _CRTIMP long __cdecl _lseek(int _FileHandle,long _Offset,int _Origin); - _off64_t lseek64(int fd,_off64_t offset, int whence); - _CRTIMP char *__cdecl _mktemp(char *_TemplateName); - _CRTIMP int __cdecl _pipe(int *_PtHandles,unsigned int _PipeSize,int _TextMode); - _CRTIMP int __cdecl _read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); - -#ifndef _CRT_DIRECTORY_DEFINED -#define _CRT_DIRECTORY_DEFINED - int __cdecl remove(const char *_Filename); - int __cdecl rename(const char *_OldFilename,const char *_NewFilename); - _CRTIMP int __cdecl _unlink(const char *_Filename); -#ifndef NO_OLDNAMES - int __cdecl unlink(const char *_Filename); -#endif -#endif - - _CRTIMP int __cdecl _setmode(int _FileHandle,int _Mode); - _CRTIMP long __cdecl _tell(int _FileHandle); - _CRTIMP int __cdecl _umask(int _Mode); - _CRTIMP int __cdecl _write(int _FileHandle,const void *_Buf,unsigned int _MaxCharCount); - -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP __int64 __cdecl _filelengthi64(int _FileHandle); - _CRTIMP intptr_t __cdecl _findfirst32i64(const char *_Filename,struct _finddata32i64_t *_FindData); - _CRTIMP intptr_t __cdecl _findfirst64(const char *_Filename,struct __finddata64_t *_FindData); -#ifdef __cplusplus -#include -#endif - intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData); - __CRT_INLINE intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData) - { - struct __finddata64_t fd; - intptr_t ret = _findfirst64(_Filename,&fd); - _FindData->attrib=fd.attrib; - _FindData->time_create=fd.time_create; - _FindData->time_access=fd.time_access; - _FindData->time_write=fd.time_write; - _FindData->size=(_fsize_t) fd.size; - strncpy(_FindData->name,fd.name,260); - return ret; - } - _CRTIMP int __cdecl _findnext32i64(intptr_t _FindHandle,struct _finddata32i64_t *_FindData); - _CRTIMP int __cdecl _findnext64(intptr_t _FindHandle,struct __finddata64_t *_FindData); - int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData); - __CRT_INLINE int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData) - { - struct __finddata64_t fd; - int ret = _findnext64(_FindHandle,&fd); - _FindData->attrib=fd.attrib; - _FindData->time_create=fd.time_create; - _FindData->time_access=fd.time_access; - _FindData->time_write=fd.time_write; - _FindData->size=(_fsize_t) fd.size; - strncpy(_FindData->name,fd.name,260); - return ret; - } - __int64 __cdecl _lseeki64(int _FileHandle,__int64 _Offset,int _Origin); - __int64 __cdecl _telli64(int _FileHandle); -#endif -#ifndef NO_OLDNAMES - -#ifndef _UWIN - int __cdecl chdir (const char *); - char *__cdecl getcwd (char *, int); - int __cdecl mkdir (const char *); - char *__cdecl mktemp(char *); - int __cdecl rmdir (const char*); - int __cdecl chmod (const char *, int); -#endif /* _UWIN */ - -#endif /* Not NO_OLDNAMES */ - - _CRTIMP errno_t __cdecl _sopen_s(int *_FileHandle,const char *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode); - -#ifndef __cplusplus - _CRTIMP int __cdecl _open(const char *_Filename,int _OpenFlag,...); - _CRTIMP int __cdecl _sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); -#else - extern "C++" _CRTIMP int __cdecl _open(const char *_Filename,int _Openflag,int _PermissionMode = 0); - extern "C++" _CRTIMP int __cdecl _sopen(const char *_Filename,int _Openflag,int _ShareFlag,int _PermissionMode = 0); -#endif - -#ifndef _WIO_DEFINED -#define _WIO_DEFINED - _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); - _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); - _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); - _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); - _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); - _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); - _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); - _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); - -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); - intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); - _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); - _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); - int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); - _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); -#endif - - _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); - -#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) - _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); - _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); -#else - extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); - extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); -#endif - -#endif - - int __cdecl __lock_fhandle(int _Filehandle); - void __cdecl _unlock_fhandle(int _Filehandle); - _CRTIMP intptr_t __cdecl _get_osfhandle(int _FileHandle); - _CRTIMP int __cdecl _open_osfhandle(intptr_t _OSFileHandle,int _Flags); - -#ifndef NO_OLDNAMES - int __cdecl access(const char *_Filename,int _AccessMode); - int __cdecl chmod(const char *_Filename,int _AccessMode); - int __cdecl chsize(int _FileHandle,long _Size); - int __cdecl close(int _FileHandle); - int __cdecl creat(const char *_Filename,int _PermissionMode); - int __cdecl dup(int _FileHandle); - int __cdecl dup2(int _FileHandleSrc,int _FileHandleDst); - int __cdecl eof(int _FileHandle); - long __cdecl filelength(int _FileHandle); - int __cdecl isatty(int _FileHandle); - int __cdecl locking(int _FileHandle,int _LockMode,long _NumOfBytes); - long __cdecl lseek(int _FileHandle,long _Offset,int _Origin); - char *__cdecl mktemp(char *_TemplateName); - int __cdecl open(const char *_Filename,int _OpenFlag,...); - int __cdecl read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); - int __cdecl setmode(int _FileHandle,int _Mode); - int __cdecl sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); - long __cdecl tell(int _FileHandle); - int __cdecl umask(int _Mode); - int __cdecl write(int _Filehandle,const void *_Buf,unsigned int _MaxCharCount); -#endif - -#ifdef __cplusplus -} -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Misc stuff */ -char *getlogin(void); -#ifdef __USE_MINGW_ALARM -unsigned int alarm(unsigned int seconds); -#endif - -#ifdef __USE_MINGW_ACCESS -/* Old versions of MSVCRT access() just ignored X_OK, while the version - shipped with Vista, returns an error code. This will restore the - old behaviour */ -static inline int __mingw_access (const char *__fname, int __mode) { - return _access (__fname, __mode & ~X_OK); -} - -#define access(__f,__m) __mingw_access (__f, __m) -#endif - - -#ifdef __cplusplus -} -#endif - - -#pragma pack(pop) - -#include - -#endif /* End _IO_H_ */ - diff --git a/win32/include/iso646.h b/win32/include/iso646.h deleted file mode 100644 index 02770f6b..00000000 --- a/win32/include/iso646.h +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the TinyCC package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -/* - * ISO C Standard: 7.9 Alternative spellings - */ - -#ifndef _ISO646_H_ -#define _ISO646_H_ - -#define and && -#define and_eq &= -#define bitand & -#define bitor | -#define compl ~ -#define not ! -#define not_eq != -#define or || -#define or_eq |= -#define xor ^ -#define xor_eq ^= - -#endif /* _ISO646_H_ */ - - - - - - - - - - diff --git a/win32/include/limits.h b/win32/include/limits.h deleted file mode 100644 index 498e02e4..00000000 --- a/win32/include/limits.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#include <_mingw.h> - -#ifndef _INC_LIMITS -#define _INC_LIMITS - -/* -* File system limits -* -* TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the -* same as FILENAME_MAX and FOPEN_MAX from stdio.h? -* NOTE: Apparently the actual size of PATH_MAX is 260, but a space is -* required for the NUL. TODO: Test? -*/ -#define PATH_MAX (259) - -#define CHAR_BIT 8 -#define SCHAR_MIN (-128) -#define SCHAR_MAX 127 -#define UCHAR_MAX 0xff - -#ifndef __CHAR_UNSIGNED__ -#define CHAR_MIN SCHAR_MIN -#define CHAR_MAX SCHAR_MAX -#else -#define CHAR_MIN 0 -#define CHAR_MAX UCHAR_MAX -#endif - -#define MB_LEN_MAX 5 -#define SHRT_MIN (-32768) -#define SHRT_MAX 32767 -#define USHRT_MAX 0xffff -#define INT_MIN (-2147483647 - 1) -#define INT_MAX 2147483647 -#define UINT_MAX 0xffffffff -#define LONG_MIN (-2147483647L - 1) -#define LONG_MAX 2147483647L -#define ULONG_MAX 0xffffffffUL -#define LLONG_MAX 9223372036854775807ll -#define LLONG_MIN (-9223372036854775807ll - 1) -#define ULLONG_MAX 0xffffffffffffffffull - -#if _INTEGRAL_MAX_BITS >= 8 -#define _I8_MIN (-127 - 1) -#define _I8_MAX 127i8 -#define _UI8_MAX 0xffu -#endif - -#if _INTEGRAL_MAX_BITS >= 16 -#define _I16_MIN (-32767 - 1) -#define _I16_MAX 32767i16 -#define _UI16_MAX 0xffffu -#endif - -#if _INTEGRAL_MAX_BITS >= 32 -#define _I32_MIN (-2147483647 - 1) -#define _I32_MAX 2147483647 -#define _UI32_MAX 0xffffffffu -#endif - -#if defined(__GNUC__) -#undef LONG_LONG_MAX -#define LONG_LONG_MAX 9223372036854775807ll -#undef LONG_LONG_MIN -#define LONG_LONG_MIN (-LONG_LONG_MAX-1) -#undef ULONG_LONG_MAX -#define ULONG_LONG_MAX (2ull * LONG_LONG_MAX + 1ull) -#endif - -#if _INTEGRAL_MAX_BITS >= 64 -#define _I64_MIN (-9223372036854775807ll - 1) -#define _I64_MAX 9223372036854775807ll -#define _UI64_MAX 0xffffffffffffffffull -#endif - -#ifndef SIZE_MAX -#ifdef _WIN64 -#define SIZE_MAX _UI64_MAX -#else -#define SIZE_MAX UINT_MAX -#endif -#endif - -#ifdef _POSIX_ -#define _POSIX_ARG_MAX 4096 -#define _POSIX_CHILD_MAX 6 -#define _POSIX_LINK_MAX 8 -#define _POSIX_MAX_CANON 255 -#define _POSIX_MAX_INPUT 255 -#define _POSIX_NAME_MAX 14 -#define _POSIX_NGROUPS_MAX 0 -#define _POSIX_OPEN_MAX 16 -#define _POSIX_PATH_MAX 255 -#define _POSIX_PIPE_BUF 512 -#define _POSIX_SSIZE_MAX 32767 -#define _POSIX_STREAM_MAX 8 -#define _POSIX_TZNAME_MAX 3 -#define ARG_MAX 14500 -#define LINK_MAX 1024 -#define MAX_CANON _POSIX_MAX_CANON -#define MAX_INPUT _POSIX_MAX_INPUT -#define NAME_MAX 255 -#define NGROUPS_MAX 16 -#define OPEN_MAX 32 -#define PATH_MAX 512 -#define PIPE_BUF _POSIX_PIPE_BUF -#define SSIZE_MAX _POSIX_SSIZE_MAX -#define STREAM_MAX 20 -#define TZNAME_MAX 10 -#endif -#endif diff --git a/win32/include/locale.h b/win32/include/locale.h deleted file mode 100644 index 686aa9ba..00000000 --- a/win32/include/locale.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_LOCALE -#define _INC_LOCALE - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#define LC_ALL 0 -#define LC_COLLATE 1 -#define LC_CTYPE 2 -#define LC_MONETARY 3 -#define LC_NUMERIC 4 -#define LC_TIME 5 - -#define LC_MIN LC_ALL -#define LC_MAX LC_TIME - -#ifndef _LCONV_DEFINED -#define _LCONV_DEFINED - struct lconv { - char *decimal_point; - char *thousands_sep; - char *grouping; - char *int_curr_symbol; - char *currency_symbol; - char *mon_decimal_point; - char *mon_thousands_sep; - char *mon_grouping; - char *positive_sign; - char *negative_sign; - char int_frac_digits; - char frac_digits; - char p_cs_precedes; - char p_sep_by_space; - char n_cs_precedes; - char n_sep_by_space; - char p_sign_posn; - char n_sign_posn; - }; -#endif - -#ifndef _CONFIG_LOCALE_SWT -#define _CONFIG_LOCALE_SWT - -#define _ENABLE_PER_THREAD_LOCALE 0x1 -#define _DISABLE_PER_THREAD_LOCALE 0x2 -#define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 -#define _DISABLE_PER_THREAD_LOCALE_GLOBAL 0x20 -#define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 -#define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 - -#endif - - int __cdecl _configthreadlocale(int _Flag); - char *__cdecl setlocale(int _Category,const char *_Locale); - _CRTIMP struct lconv *__cdecl localeconv(void); - _locale_t __cdecl _get_current_locale(void); - _locale_t __cdecl _create_locale(int _Category,const char *_Locale); - void __cdecl _free_locale(_locale_t _Locale); - _locale_t __cdecl __get_current_locale(void); - _locale_t __cdecl __create_locale(int _Category,const char *_Locale); - void __cdecl __free_locale(_locale_t _Locale); - -#ifndef _WLOCALE_DEFINED -#define _WLOCALE_DEFINED - _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/malloc.h b/win32/include/malloc.h deleted file mode 100644 index c2f7f76f..00000000 --- a/win32/include/malloc.h +++ /dev/null @@ -1,181 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _MALLOC_H_ -#define _MALLOC_H_ - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifndef _MM_MALLOC_H_INCLUDED -#define _MM_MALLOC_H_INCLUDED -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _WIN64 -#define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0 -#else -#define _HEAP_MAXREQ 0xFFFFFFE0 -#endif - -#ifndef _STATIC_ASSERT -#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1]) -#endif - -/* Return codes for _heapwalk() */ -#define _HEAPEMPTY (-1) -#define _HEAPOK (-2) -#define _HEAPBADBEGIN (-3) -#define _HEAPBADNODE (-4) -#define _HEAPEND (-5) -#define _HEAPBADPTR (-6) - -/* Values for _heapinfo.useflag */ -#define _FREEENTRY 0 -#define _USEDENTRY 1 - -#ifndef _HEAPINFO_DEFINED -#define _HEAPINFO_DEFINED - /* The structure used to walk through the heap with _heapwalk. */ - typedef struct _heapinfo { - int *_pentry; - size_t _size; - int _useflag; - } _HEAPINFO; -#endif - - extern unsigned int _amblksiz; - -#define _mm_free(a) _aligned_free(a) -#define _mm_malloc(a,b) _aligned_malloc(a,b) - -#ifndef _CRT_ALLOCATION_DEFINED -#define _CRT_ALLOCATION_DEFINED - void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); - void __cdecl free(void *_Memory); - void *__cdecl malloc(size_t _Size); - void *__cdecl realloc(void *_Memory,size_t _NewSize); - _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); - _CRTIMP void __cdecl _aligned_free(void *_Memory); - _CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); - _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); - _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); - _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); - _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); - _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); -#endif - -#define _MAX_WAIT_MALLOC_CRT 60000 - - _CRTIMP int __cdecl _resetstkoflw (void); - _CRTIMP unsigned long __cdecl _set_malloc_crt_max_wait(unsigned long _NewValue); - - _CRTIMP void *__cdecl _expand(void *_Memory,size_t _NewSize); - _CRTIMP size_t __cdecl _msize(void *_Memory); -#ifdef __GNUC__ -#undef _alloca -#define _alloca(x) __builtin_alloca((x)) -#else - /* tcc implements alloca internally and exposes it (since commit d778bde7). - /* alloca is declared at include/stddef.h (which is distributed with tcc). - */ -#ifdef _alloca -#undef _alloca -#endif -#define _alloca(x) alloca((x)) -#endif - _CRTIMP size_t __cdecl _get_sbh_threshold(void); - _CRTIMP int __cdecl _set_sbh_threshold(size_t _NewValue); - _CRTIMP errno_t __cdecl _set_amblksiz(size_t _Value); - _CRTIMP errno_t __cdecl _get_amblksiz(size_t *_Value); - _CRTIMP int __cdecl _heapadd(void *_Memory,size_t _Size); - _CRTIMP int __cdecl _heapchk(void); - _CRTIMP int __cdecl _heapmin(void); - _CRTIMP int __cdecl _heapset(unsigned int _Fill); - _CRTIMP int __cdecl _heapwalk(_HEAPINFO *_EntryInfo); - _CRTIMP size_t __cdecl _heapused(size_t *_Used,size_t *_Commit); - _CRTIMP intptr_t __cdecl _get_heap_handle(void); - -#define _ALLOCA_S_THRESHOLD 1024 -#define _ALLOCA_S_STACK_MARKER 0xCCCC -#define _ALLOCA_S_HEAP_MARKER 0xDDDD - -#if(defined(_X86_) && !defined(__x86_64)) -#define _ALLOCA_S_MARKER_SIZE 8 -#elif defined(__ia64__) || defined(__x86_64) -#define _ALLOCA_S_MARKER_SIZE 16 -#endif - -#if !defined(RC_INVOKED) - static __inline void *_MarkAllocaS(void *_Ptr,unsigned int _Marker) { - if(_Ptr) { - *((unsigned int*)_Ptr) = _Marker; - _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE; - } - return _Ptr; - } -#endif - -#undef _malloca -#define _malloca(size) \ - ((((size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) ? \ - _MarkAllocaS(_alloca((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_STACK_MARKER) : \ - _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_HEAP_MARKER)) -#undef _FREEA_INLINE -#define _FREEA_INLINE - -#ifndef RC_INVOKED -#undef _freea - static __inline void __cdecl _freea(void *_Memory) { - unsigned int _Marker; - if(_Memory) { - _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE; - _Marker = *(unsigned int *)_Memory; - if(_Marker==_ALLOCA_S_HEAP_MARKER) { - free(_Memory); - } -#ifdef _ASSERTE - else if(_Marker!=_ALLOCA_S_STACK_MARKER) { - _ASSERTE(("Corrupted pointer passed to _freea",0)); - } -#endif - } - } -#endif /* RC_INVOKED */ - -#ifndef NO_OLDNAMES -#ifdef __GNUC__ -#undef alloca -#define alloca(x) __builtin_alloca((x)) -#endif -#endif - -#ifdef HEAPHOOK -#ifndef _HEAPHOOK_DEFINED -#define _HEAPHOOK_DEFINED - typedef int (__cdecl *_HEAPHOOK)(int,size_t,void *,void **); -#endif - - _CRTIMP _HEAPHOOK __cdecl _setheaphook(_HEAPHOOK _NewHook); - -#define _HEAP_MALLOC 1 -#define _HEAP_CALLOC 2 -#define _HEAP_FREE 3 -#define _HEAP_REALLOC 4 -#define _HEAP_MSIZE 5 -#define _HEAP_EXPAND 6 -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) - -#endif /* _MALLOC_H_ */ diff --git a/win32/include/math.h b/win32/include/math.h deleted file mode 100644 index 8e66407e..00000000 --- a/win32/include/math.h +++ /dev/null @@ -1,497 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _MATH_H_ -#define _MATH_H_ - -#if __GNUC__ >= 3 -#pragma GCC system_header -#endif - -#include <_mingw.h> - -struct exception; - -#pragma pack(push,_CRT_PACKING) - -#define _DOMAIN 1 -#define _SING 2 -#define _OVERFLOW 3 -#define _UNDERFLOW 4 -#define _TLOSS 5 -#define _PLOSS 6 - -#ifndef __STRICT_ANSI__ -#ifndef NO_OLDNAMES -#define DOMAIN _DOMAIN -#define SING _SING -#define OVERFLOW _OVERFLOW -#define UNDERFLOW _UNDERFLOW -#define TLOSS _TLOSS -#define PLOSS _PLOSS -#endif -#endif - -#ifndef __STRICT_ANSI__ -#define M_E 2.71828182845904523536 -#define M_LOG2E 1.44269504088896340736 -#define M_LOG10E 0.434294481903251827651 -#define M_LN2 0.693147180559945309417 -#define M_LN10 2.30258509299404568402 -#define M_PI 3.14159265358979323846 -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.785398163397448309616 -#define M_1_PI 0.318309886183790671538 -#define M_2_PI 0.636619772367581343076 -#define M_2_SQRTPI 1.12837916709551257390 -#define M_SQRT2 1.41421356237309504880 -#define M_SQRT1_2 0.707106781186547524401 -#endif - -#ifndef __STRICT_ANSI__ -/* See also float.h */ -#ifndef __MINGW_FPCLASS_DEFINED -#define __MINGW_FPCLASS_DEFINED 1 -#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ -#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ -#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ -#define _FPCLASS_NN 0x0008 /* Negative Normal */ -#define _FPCLASS_ND 0x0010 /* Negative Denormal */ -#define _FPCLASS_NZ 0x0020 /* Negative Zero */ -#define _FPCLASS_PZ 0x0040 /* Positive Zero */ -#define _FPCLASS_PD 0x0080 /* Positive Denormal */ -#define _FPCLASS_PN 0x0100 /* Positive Normal */ -#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _EXCEPTION_DEFINED -#define _EXCEPTION_DEFINED - struct _exception { - int type; - char *name; - double arg1; - double arg2; - double retval; - }; -#endif - -#ifndef _COMPLEX_DEFINED -#define _COMPLEX_DEFINED - struct _complex { - double x,y; - }; -#endif - -#define EDOM 33 -#define ERANGE 34 - -#ifndef _HUGE -#ifdef _MSVCRT_ - extern double *_HUGE; -#else - extern double *_imp___HUGE; -#define _HUGE (*_imp___HUGE) -#endif -#endif - -#define HUGE_VAL _HUGE - -#ifndef _CRT_ABS_DEFINED -#define _CRT_ABS_DEFINED - int __cdecl abs(int _X); - long __cdecl labs(long _X); -#endif - double __cdecl acos(double _X); - double __cdecl asin(double _X); - double __cdecl atan(double _X); - double __cdecl atan2(double _Y,double _X); -#ifndef _SIGN_DEFINED -#define _SIGN_DEFINED - _CRTIMP double __cdecl _copysign (double _Number,double _Sign); - _CRTIMP double __cdecl _chgsign (double _X); -#endif - double __cdecl cos(double _X); - double __cdecl cosh(double _X); - double __cdecl exp(double _X); - double __cdecl expm1(double _X); - double __cdecl fabs(double _X); - double __cdecl fmod(double _X,double _Y); - double __cdecl log(double _X); - double __cdecl log10(double _X); - double __cdecl pow(double _X,double _Y); - double __cdecl sin(double _X); - double __cdecl sinh(double _X); - double __cdecl tan(double _X); - double __cdecl tanh(double _X); - double __cdecl sqrt(double _X); -#ifndef _CRT_ATOF_DEFINED -#define _CRT_ATOF_DEFINED - double __cdecl atof(const char *_String); - double __cdecl _atof_l(const char *_String,_locale_t _Locale); -#endif - - _CRTIMP double __cdecl _cabs(struct _complex _ComplexA); - double __cdecl ceil(double _X); - double __cdecl floor(double _X); - double __cdecl frexp(double _X,int *_Y); - double __cdecl _hypot(double _X,double _Y); - _CRTIMP double __cdecl _j0(double _X); - _CRTIMP double __cdecl _j1(double _X); - _CRTIMP double __cdecl _jn(int _X,double _Y); - double __cdecl ldexp(double _X,int _Y); -#ifndef _CRT_MATHERR_DEFINED -#define _CRT_MATHERR_DEFINED - int __cdecl _matherr(struct _exception *_Except); -#endif - double __cdecl modf(double _X,double *_Y); - _CRTIMP double __cdecl _y0(double _X); - _CRTIMP double __cdecl _y1(double _X); - _CRTIMP double __cdecl _yn(int _X,double _Y); - -#if(defined(_X86_) && !defined(__x86_64)) - _CRTIMP int __cdecl _set_SSE2_enable(int _Flag); - /* from libmingwex */ - float __cdecl _hypotf(float _X,float _Y); -#endif - - float frexpf(float _X,int *_Y); - float __cdecl ldexpf(float _X,int _Y); - long double __cdecl ldexpl(long double _X,int _Y); - float __cdecl acosf(float _X); - float __cdecl asinf(float _X); - float __cdecl atanf(float _X); - float __cdecl atan2f(float _X,float _Y); - float __cdecl cosf(float _X); - float __cdecl sinf(float _X); - float __cdecl tanf(float _X); - float __cdecl coshf(float _X); - float __cdecl sinhf(float _X); - float __cdecl tanhf(float _X); - float __cdecl expf(float _X); - float __cdecl expm1f(float _X); - float __cdecl logf(float _X); - float __cdecl log10f(float _X); - float __cdecl modff(float _X,float *_Y); - float __cdecl powf(float _X,float _Y); - float __cdecl sqrtf(float _X); - float __cdecl ceilf(float _X); - float __cdecl floorf(float _X); - float __cdecl fmodf(float _X,float _Y); - float __cdecl _hypotf(float _X,float _Y); - float __cdecl fabsf(float _X); -#if !defined(__ia64__) - /* from libmingwex */ - float __cdecl _copysignf (float _Number,float _Sign); - float __cdecl _chgsignf (float _X); - float __cdecl _logbf(float _X); - float __cdecl _nextafterf(float _X,float _Y); - int __cdecl _finitef(float _X); - int __cdecl _isnanf(float _X); - int __cdecl _fpclassf(float _X); -#endif - -#ifndef NO_OLDNAMES -#define matherr _matherr - -#define HUGE _HUGE - /* double __cdecl cabs(struct _complex _X); */ - double __cdecl hypot(double _X,double _Y); - _CRTIMP double __cdecl j0(double _X); - _CRTIMP double __cdecl j1(double _X); - _CRTIMP double __cdecl jn(int _X,double _Y); - _CRTIMP double __cdecl y0(double _X); - _CRTIMP double __cdecl y1(double _X); - _CRTIMP double __cdecl yn(int _X,double _Y); -#endif - -#ifndef __NO_ISOCEXT -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __GLIBCPP__ - -#define NAN (0.0F/0.0F) -#define HUGE_VALF (1.0F/0.0F) -#define HUGE_VALL (1.0L/0.0L) -#define INFINITY (1.0F/0.0F) - - -#define FP_NAN 0x0100 -#define FP_NORMAL 0x0400 -#define FP_INFINITE (FP_NAN | FP_NORMAL) -#define FP_ZERO 0x4000 -#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO) - /* 0x0200 is signbit mask */ - - - /* - We can't __CRT_INLINE float or double, because we want to ensure truncation - to semantic type before classification. - (A normal long double value might become subnormal when - converted to double, and zero when converted to float.) - */ - - extern int __cdecl __fpclassifyf (float); - extern int __cdecl __fpclassify (double); - extern int __cdecl __fpclassifyl (long double); - -/* Implemented at tcc/tcc_libm.h -#define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \ - : sizeof (x) == sizeof (double) ? __fpclassify (x) \ - : __fpclassifyl (x)) -*/ -#define fpclassify(x) \ - _Generic(x, float: __fpclassifyf, double: __fpclassify, long double: __fpclassifyl)(x) - - /* 7.12.3.2 */ -#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0) - - /* 7.12.3.3 */ -#define isinf(x) (fpclassify(x) == FP_INFINITE) - - /* 7.12.3.4 */ - /* We don't need to worry about truncation here: - A NaN stays a NaN. */ -#define isnan(x) (fpclassify(x) == FP_NAN) - - /* 7.12.3.5 */ -#define isnormal(x) (fpclassify(x) == FP_NORMAL) - - /* 7.12.3.6 The signbit macro */ - - extern int __cdecl __signbitf (float); - extern int __cdecl __signbit (double); - extern int __cdecl __signbitl (long double); - -/* Implemented at tcc/tcc_libm.h -#define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \ - : sizeof (x) == sizeof (double) ? __signbit (x) \ - : __signbitl (x)) -*/ -#define signbit(x) \ - _Generic(x, float: __signbitf, double: __signbit, long double: __signbitl)(x) - - extern double __cdecl exp2(double); - extern float __cdecl exp2f(float); - extern long double __cdecl exp2l(long double); - -#define FP_ILOGB0 ((int)0x80000000) -#define FP_ILOGBNAN ((int)0x80000000) - extern int __cdecl ilogb (double); - extern int __cdecl ilogbf (float); - extern int __cdecl ilogbl (long double); - - extern double __cdecl log1p(double); - extern float __cdecl log1pf(float); - extern long double __cdecl log1pl(long double); - - extern double __cdecl log2 (double); - extern float __cdecl log2f (float); - extern long double __cdecl log2l (long double); - - extern double __cdecl logb (double); - extern float __cdecl logbf (float); - extern long double __cdecl logbl (long double); - - extern long double __cdecl modfl (long double, long double*); - - /* 7.12.6.13 */ - extern double __cdecl scalbn (double, int); - extern float __cdecl scalbnf (float, int); - extern long double __cdecl scalbnl (long double, int); - - extern double __cdecl scalbln (double, long); - extern float __cdecl scalblnf (float, long); - extern long double __cdecl scalblnl (long double, long); - - /* 7.12.7.1 */ - /* Implementations adapted from Cephes versions */ - extern double __cdecl cbrt (double); - extern float __cdecl cbrtf (float); - extern long double __cdecl cbrtl (long double); - - extern double __cdecl hypot (double, double); - extern float __cdecl hypotf (float, float); - extern long double __cdecl hypotl (long double, long double); - - extern long double __cdecl powl (long double, long double); - extern long double __cdecl expl(long double); - extern long double __cdecl expm1l(long double); - extern long double __cdecl coshl(long double); - extern long double __cdecl fabsl (long double); - extern long double __cdecl acosl(long double); - extern long double __cdecl asinl(long double); - extern long double __cdecl atanl(long double); - extern long double __cdecl atan2l(long double,long double); - extern long double __cdecl sinhl(long double); - extern long double __cdecl tanhl(long double); - - /* 7.12.8.1 The erf functions */ - extern double __cdecl erf (double); - extern float __cdecl erff (float); - /* TODO - extern long double __cdecl erfl (long double); - */ - - /* 7.12.8.2 The erfc functions */ - extern double __cdecl erfc (double); - extern float __cdecl erfcf (float); - /* TODO - extern long double __cdecl erfcl (long double); - */ - - /* 7.12.8.3 The lgamma functions */ - extern double __cdecl lgamma (double); - extern float __cdecl lgammaf (float); - extern long double __cdecl lgammal (long double); - - /* 7.12.8.4 The tgamma functions */ - extern double __cdecl tgamma (double); - extern float __cdecl tgammaf (float); - extern long double __cdecl tgammal (long double); - - extern long double __cdecl ceill (long double); - extern long double __cdecl floorl (long double); - extern long double __cdecl frexpl(long double,int *); - extern long double __cdecl log10l(long double); - extern long double __cdecl logl(long double); - extern long double __cdecl cosl(long double); - extern long double __cdecl sinl(long double); - extern long double __cdecl tanl(long double); - extern long double sqrtl(long double); - - /* 7.12.9.3 */ - extern double __cdecl nearbyint ( double); - extern float __cdecl nearbyintf (float); - extern long double __cdecl nearbyintl (long double); - - /* 7.12.9.4 */ - /* round, using fpu control word settings */ - extern double __cdecl rint (double); - extern float __cdecl rintf (float); - extern long double __cdecl rintl (long double); - - extern long __cdecl lrint (double); - extern long __cdecl lrintf (float); - extern long __cdecl lrintl (long double); - - extern long long __cdecl llrint (double); - extern long long __cdecl llrintf (float); - extern long long __cdecl llrintl (long double); - - #define FE_TONEAREST 0x0000 - #define FE_DOWNWARD 0x0400 - #define FE_UPWARD 0x0800 - #define FE_TOWARDZERO 0x0c00 - - /* 7.12.9.6 */ - /* round away from zero, regardless of fpu control word settings */ - extern double __cdecl round (double); - extern float __cdecl roundf (float); - extern long double __cdecl roundl (long double); - - /* 7.12.9.7 */ - extern long __cdecl lround (double); - extern long __cdecl lroundf (float); - extern long __cdecl lroundl (long double); - - extern long long __cdecl llround (double); - extern long long __cdecl llroundf (float); - extern long long __cdecl llroundl (long double); - - /* 7.12.9.8 */ - /* round towards zero, regardless of fpu control word settings */ - extern double __cdecl trunc (double); - extern float __cdecl truncf (float); - extern long double __cdecl truncl (long double); - - extern long double __cdecl fmodl (long double, long double); - - /* 7.12.10.2 */ - extern double __cdecl remainder (double, double); - extern float __cdecl remainderf (float, float); - extern long double __cdecl remainderl (long double, long double); - - /* 7.12.10.3 */ - extern double __cdecl remquo(double, double, int *); - extern float __cdecl remquof(float, float, int *); - extern long double __cdecl remquol(long double, long double, int *); - - /* 7.12.11.1 */ - extern double __cdecl copysign (double, double); /* in libmoldname.a */ - extern float __cdecl copysignf (float, float); - extern long double __cdecl copysignl (long double, long double); - - /* 7.12.11.2 Return a NaN */ - extern double __cdecl nan(const char *tagp); - extern float __cdecl nanf(const char *tagp); - extern long double __cdecl nanl(const char *tagp); - -#ifndef __STRICT_ANSI__ -#define _nan() nan("") -#define _nanf() nanf("") -#define _nanl() nanl("") -#endif - - /* 7.12.11.3 */ - extern double __cdecl nextafter (double, double); /* in libmoldname.a */ - extern float __cdecl nextafterf (float, float); - extern long double __cdecl nextafterl (long double, long double); - - /* 7.12.11.4 The nexttoward functions: TODO */ - - /* 7.12.12.1 */ - /* x > y ? (x - y) : 0.0 */ - extern double __cdecl fdim (double x, double y); - extern float __cdecl fdimf (float x, float y); - extern long double __cdecl fdiml (long double x, long double y); - - /* fmax and fmin. - NaN arguments are treated as missing data: if one argument is a NaN - and the other numeric, then these functions choose the numeric - value. */ - - /* 7.12.12.2 */ - extern double __cdecl fmax (double, double); - extern float __cdecl fmaxf (float, float); - extern long double __cdecl fmaxl (long double, long double); - - /* 7.12.12.3 */ - extern double __cdecl fmin (double, double); - extern float __cdecl fminf (float, float); - extern long double __cdecl fminl (long double, long double); - - /* 7.12.13.1 */ - /* return x * y + z as a ternary op */ - extern double __cdecl fma (double, double, double); - extern float __cdecl fmaf (float, float, float); - extern long double __cdecl fmal (long double, long double, long double); - - -#endif /* __STDC_VERSION__ >= 199901L */ -#endif /* __NO_ISOCEXT */ - -#ifdef __cplusplus -} -#endif -#pragma pack(pop) - -/* 7.12.14 */ -/* - * With these functions, comparisons involving quiet NaNs set the FP - * condition code to "unordered". The IEEE floating-point spec - * dictates that the result of floating-point comparisons should be - * false whenever a NaN is involved, with the exception of the != op, - * which always returns true: yes, (NaN != NaN) is true). - */ - -/* Mini libm (inline __fpclassify*, __signbit* and variants) */ -#include "tcc/tcc_libm.h" - -#endif /* End _MATH_H_ */ - diff --git a/win32/include/mem.h b/win32/include/mem.h deleted file mode 100644 index 25520235..00000000 --- a/win32/include/mem.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* - * This file is part of the Mingw32 package. - * - * mem.h maps to string.h - */ -#ifndef __STRICT_ANSI__ -#include -#endif diff --git a/win32/include/memory.h b/win32/include/memory.h deleted file mode 100644 index 90d88aed..00000000 --- a/win32/include/memory.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_MEMORY -#define _INC_MEMORY - -#include <_mingw.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _CONST_RETURN -#define _CONST_RETURN -#endif - -#define _WConst_return _CONST_RETURN - -#ifndef _CRT_MEMORY_DEFINED -#define _CRT_MEMORY_DEFINED - _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); - _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); - _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); - _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); - int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); - void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); - void *__cdecl memset(void *_Dst,int _Val,size_t _Size); - -#ifndef NO_OLDNAMES - void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); - int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); -#endif -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/process.h b/win32/include/process.h deleted file mode 100644 index dadaf2b7..00000000 --- a/win32/include/process.h +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_PROCESS -#define _INC_PROCESS - -#include <_mingw.h> - -/* Includes a definition of _pid_t and pid_t */ -#include - -#ifndef _POSIX_ -#ifdef __cplusplus -extern "C" { -#endif - -#define _P_WAIT 0 -#define _P_NOWAIT 1 -#define _OLD_P_OVERLAY 2 -#define _P_NOWAITO 3 -#define _P_DETACH 4 -#define _P_OVERLAY 2 - -#define _WAIT_CHILD 0 -#define _WAIT_GRANDCHILD 1 - - _CRTIMP uintptr_t __cdecl _beginthread(void (__cdecl *_StartAddress) (void *),unsigned _StackSize,void *_ArgList); - _CRTIMP void __cdecl _endthread(void); - _CRTIMP uintptr_t __cdecl _beginthreadex(void *_Security,unsigned _StackSize,unsigned (__stdcall *_StartAddress) (void *),void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr); - _CRTIMP void __cdecl _endthreadex(unsigned _Retval); - -#ifndef _CRT_TERMINATE_DEFINED -#define _CRT_TERMINATE_DEFINED - void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; - _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; - -#pragma push_macro("abort") -#undef abort - void __cdecl __declspec(noreturn) abort(void); -#pragma pop_macro("abort") - -#endif - - _CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void); - _CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void); - _CRTIMP int __cdecl _getpid(void); - _CRTIMP intptr_t __cdecl _cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); - _CRTIMP intptr_t __cdecl _execl(const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _execle(const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _execlp(const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _execlpe(const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _execv(const char *_Filename,const char *const *_ArgList); - _CRTIMP intptr_t __cdecl _execve(const char *_Filename,const char *const *_ArgList,const char *const *_Env); - _CRTIMP intptr_t __cdecl _execvp(const char *_Filename,const char *const *_ArgList); - _CRTIMP intptr_t __cdecl _execvpe(const char *_Filename,const char *const *_ArgList,const char *const *_Env); - _CRTIMP intptr_t __cdecl _spawnl(int _Mode,const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _spawnle(int _Mode,const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _spawnlp(int _Mode,const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _spawnlpe(int _Mode,const char *_Filename,const char *_ArgList,...); - _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList); - _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); - _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList); - _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); - -#ifndef _CRT_SYSTEM_DEFINED -#define _CRT_SYSTEM_DEFINED - int __cdecl system(const char *_Command); -#endif - -#ifndef _WPROCESS_DEFINED -#define _WPROCESS_DEFINED - _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); - _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); - _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); - _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); -#ifndef _CRT_WSYSTEM_DEFINED -#define _CRT_WSYSTEM_DEFINED - _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); -#endif -#endif - - void __cdecl __security_init_cookie(void); -#if (defined(_X86_) && !defined(__x86_64)) - void __fastcall __security_check_cookie(uintptr_t _StackCookie); - __declspec(noreturn) void __cdecl __report_gsfailure(void); -#else - void __cdecl __security_check_cookie(uintptr_t _StackCookie); - __declspec(noreturn) void __cdecl __report_gsfailure(uintptr_t _StackCookie); -#endif - extern uintptr_t __security_cookie; - - intptr_t __cdecl _loaddll(char *_Filename); - int __cdecl _unloaddll(intptr_t _Handle); - int (__cdecl *__cdecl _getdllprocaddr(intptr_t _Handle,char *_ProcedureName,intptr_t _Ordinal))(void); - -#ifdef _DECL_DLLMAIN -#ifdef _WINDOWS_ - WINBOOL WINAPI DllMain(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); - WINBOOL WINAPI _CRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); - WINBOOL WINAPI _wCRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); - extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID); -#else - int __stdcall DllMain(void *_HDllHandle,unsigned _Reason,void *_Reserved); - int __stdcall _CRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); - int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); - extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *); -#endif -#endif - -#ifndef NO_OLDNAMES -#define P_WAIT _P_WAIT -#define P_NOWAIT _P_NOWAIT -#define P_OVERLAY _P_OVERLAY -#define OLD_P_OVERLAY _OLD_P_OVERLAY -#define P_NOWAITO _P_NOWAITO -#define P_DETACH _P_DETACH -#define WAIT_CHILD _WAIT_CHILD -#define WAIT_GRANDCHILD _WAIT_GRANDCHILD - - intptr_t __cdecl cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); -#ifdef __GNUC__ - int __cdecl execl(const char *_Filename,const char *_ArgList,...); - int __cdecl execle(const char *_Filename,const char *_ArgList,...); - int __cdecl execlp(const char *_Filename,const char *_ArgList,...); - int __cdecl execlpe(const char *_Filename,const char *_ArgList,...); -#else - intptr_t __cdecl execl(const char *_Filename,const char *_ArgList,...); - intptr_t __cdecl execle(const char *_Filename,const char *_ArgList,...); - intptr_t __cdecl execlp(const char *_Filename,const char *_ArgList,...); - intptr_t __cdecl execlpe(const char *_Filename,const char *_ArgList,...); -#endif - intptr_t __cdecl spawnl(int,const char *_Filename,const char *_ArgList,...); - intptr_t __cdecl spawnle(int,const char *_Filename,const char *_ArgList,...); - intptr_t __cdecl spawnlp(int,const char *_Filename,const char *_ArgList,...); - intptr_t __cdecl spawnlpe(int,const char *_Filename,const char *_ArgList,...); - int __cdecl getpid(void); -#ifdef __GNUC__ - /* Those methods are predefined by gcc builtins to return int. So to prevent - stupid warnings, define them in POSIX way. This is save, because those - methods do not return in success case, so that the return value is not - really dependent to its scalar width. */ - int __cdecl execv(const char *_Filename,const char *const _ArgList[]); - int __cdecl execve(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); - int __cdecl execvp(const char *_Filename,const char *const _ArgList[]); - int __cdecl execvpe(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); -#else - intptr_t __cdecl execv(const char *_Filename,const char *const _ArgList[]); - intptr_t __cdecl execve(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); - intptr_t __cdecl execvp(const char *_Filename,const char *const _ArgList[]); - intptr_t __cdecl execvpe(const char *_Filename,const char *const _ArgList[],const char *const _Env[]); -#endif - intptr_t __cdecl spawnv(int,const char *_Filename,const char *const _ArgList[]); - intptr_t __cdecl spawnve(int,const char *_Filename,const char *const _ArgList[],const char *const _Env[]); - intptr_t __cdecl spawnvp(int,const char *_Filename,const char *const _ArgList[]); - intptr_t __cdecl spawnvpe(int,const char *_Filename,const char *const _ArgList[],char *const _Env[]); -#endif - -#ifdef __cplusplus -} -#endif -#endif -#endif diff --git a/win32/include/sec_api/conio_s.h b/win32/include/sec_api/conio_s.h deleted file mode 100644 index 98d97ba2..00000000 --- a/win32/include/sec_api/conio_s.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -#ifndef _INC_CONIO_S -#define _INC_CONIO_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - - _CRTIMP errno_t __cdecl _cgets_s(char *_Buffer,size_t _Size,size_t *_SizeRead); - _CRTIMP int __cdecl _cprintf_s(const char *_Format,...); - _CRTIMP int __cdecl _cscanf_s(const char *_Format,...); - _CRTIMP int __cdecl _cscanf_s_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcprintf_s(const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cprintf_s_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - -#ifndef _WCONIO_DEFINED_S -#define _WCONIO_DEFINED_S - _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); - _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); -#endif - -#ifdef __cplusplus -} -#endif - -#endif -#endif diff --git a/win32/include/sec_api/crtdbg_s.h b/win32/include/sec_api/crtdbg_s.h deleted file mode 100644 index 4598b4f7..00000000 --- a/win32/include/sec_api/crtdbg_s.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -#ifndef _INC_CRTDBG_S -#define _INC_CRTDBG_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#define _dupenv_s_dbg(ps1,size,s2,t,f,l) _dupenv_s(ps1,size,s2) -#define _wdupenv_s_dbg(ps1,size,s2,t,f,l) _wdupenv_s(ps1,size,s2) - -#endif - -#endif diff --git a/win32/include/sec_api/io_s.h b/win32/include/sec_api/io_s.h deleted file mode 100644 index ec565a61..00000000 --- a/win32/include/sec_api/io_s.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_IO_S -#define _INC_IO_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - - _CRTIMP errno_t __cdecl _access_s(const char *_Filename,int _AccessMode); - _CRTIMP errno_t __cdecl _chsize_s(int _FileHandle,__int64 _Size); - _CRTIMP errno_t __cdecl _mktemp_s(char *_TemplateName,size_t _Size); - _CRTIMP errno_t __cdecl _umask_s(int _NewMode,int *_OldMode); - -#ifndef _WIO_S_DEFINED -#define _WIO_S_DEFINED - _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); - _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); -#endif - -#ifdef __cplusplus -} -#endif - -#endif -#endif diff --git a/win32/include/sec_api/mbstring_s.h b/win32/include/sec_api/mbstring_s.h deleted file mode 100644 index 6b2b188f..00000000 --- a/win32/include/sec_api/mbstring_s.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_MBSTRING_S -#define _INC_MBSTRING_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _MBSTRING_S_DEFINED -#define _MBSTRING_S_DEFINED - _CRTIMP errno_t __cdecl _mbscat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); - _CRTIMP errno_t __cdecl _mbscat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbscpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); - _CRTIMP errno_t __cdecl _mbscpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbslwr_s(unsigned char *_Str,size_t _SizeInBytes); - _CRTIMP errno_t __cdecl _mbslwr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsnbcat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); - _CRTIMP errno_t __cdecl _mbsnbcat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsnbcpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); - _CRTIMP errno_t __cdecl _mbsnbcpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsnbset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount); - _CRTIMP errno_t __cdecl _mbsnbset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsncat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); - _CRTIMP errno_t __cdecl _mbsncat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsncpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); - _CRTIMP errno_t __cdecl _mbsncpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsnset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount); - _CRTIMP errno_t __cdecl _mbsnset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val); - _CRTIMP errno_t __cdecl _mbsset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,_locale_t _Locale); - _CRTIMP unsigned char *__cdecl _mbstok_s(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context); - _CRTIMP unsigned char *__cdecl _mbstok_s_l(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbsupr_s(unsigned char *_Str,size_t _SizeInBytes); - _CRTIMP errno_t __cdecl _mbsupr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); - _CRTIMP errno_t __cdecl _mbccpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src); - _CRTIMP errno_t __cdecl _mbccpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src,_locale_t _Locale); -#endif - -#ifdef __cplusplus -} -#endif - -#endif -#endif diff --git a/win32/include/sec_api/search_s.h b/win32/include/sec_api/search_s.h deleted file mode 100644 index cae89989..00000000 --- a/win32/include/sec_api/search_s.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_SEARCH_S -#define _INC_SEARCH_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - - _CRTIMP void *__cdecl _lfind_s(const void *_Key,const void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); - _CRTIMP void *__cdecl _lsearch_s(const void *_Key,void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); - -#ifdef __cplusplus -} -#endif - -#endif -#endif diff --git a/win32/include/sec_api/stdio_s.h b/win32/include/sec_api/stdio_s.h deleted file mode 100644 index c9b803b1..00000000 --- a/win32/include/sec_api/stdio_s.h +++ /dev/null @@ -1,145 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_STDIO_S -#define _INC_STDIO_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _STDIO_S_DEFINED -#define _STDIO_S_DEFINED - _CRTIMP errno_t __cdecl clearerr_s(FILE *_File); - int __cdecl fprintf_s(FILE *_File,const char *_Format,...); - size_t __cdecl fread_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); - _CRTIMP int __cdecl _fscanf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); - int __cdecl printf_s(const char *_Format,...); - _CRTIMP int __cdecl _scanf_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _scanf_s_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,...); - _CRTIMP int __cdecl _snprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,...); - _CRTIMP int __cdecl _vsnprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); - int __cdecl sprintf_s(char *_DstBuf,size_t _DstSize,const char *_Format,...); - _CRTIMP int __cdecl _fscanf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _sscanf_l(const char *_Src,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _sscanf_s_l(const char *_Src,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snscanf_s(const char *_Src,size_t _MaxCount,const char *_Format,...); - _CRTIMP int __cdecl _snscanf_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snscanf_s_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); - int __cdecl vfprintf_s(FILE *_File,const char *_Format,va_list _ArgList); - int __cdecl vprintf_s(const char *_Format,va_list _ArgList); - int __cdecl vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); - int __cdecl vsprintf_s(char *_DstBuf,size_t _Size,const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _fprintf_p(FILE *_File,const char *_Format,...); - _CRTIMP int __cdecl _printf_p(const char *_Format,...); - _CRTIMP int __cdecl _sprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,...); - _CRTIMP int __cdecl _vfprintf_p(FILE *_File,const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _vprintf_p(const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _vsprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _scprintf_p(const char *_Format,...); - _CRTIMP int __cdecl _vscprintf_p(const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _printf_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _printf_p_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _fprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vfprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vfprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _sprintf_l(char *_DstBuf,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _sprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsprintf_l(char *_DstBuf,const char *_Format,_locale_t,va_list _ArgList); - _CRTIMP int __cdecl _vsprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _scprintf_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _scprintf_p_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vscprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vscprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _printf_s_l(const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vfprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _sprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _snprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsnprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _snprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsnprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vsnprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *,_locale_t _Locale,va_list _ArgList); - -#ifndef _WSTDIO_S_DEFINED -#define _WSTDIO_S_DEFINED - _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); - int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); - int __cdecl wprintf_s(const wchar_t *_Format,...); - int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); - int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); - int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); - _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); - _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); - _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); - _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); - _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); - _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); - _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); - _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); - _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); -#endif -#endif - - _CRTIMP size_t __cdecl _fread_nolock_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); - -#ifdef __cplusplus -} -#endif -#endif -#endif diff --git a/win32/include/sec_api/stdlib_s.h b/win32/include/sec_api/stdlib_s.h deleted file mode 100644 index f98262cc..00000000 --- a/win32/include/sec_api/stdlib_s.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_STDLIB_S -#define _INC_STDLIB_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - - _CRTIMP errno_t __cdecl _dupenv_s(char **_PBuffer,size_t *_PBufferSizeInBytes,const char *_VarName); - _CRTIMP errno_t __cdecl _itoa_s(int _Value,char *_DstBuf,size_t _Size,int _Radix); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP errno_t __cdecl _i64toa_s(__int64 _Val,char *_DstBuf,size_t _Size,int _Radix); - _CRTIMP errno_t __cdecl _ui64toa_s(unsigned __int64 _Val,char *_DstBuf,size_t _Size,int _Radix); -#endif - _CRTIMP errno_t __cdecl _ltoa_s(long _Val,char *_DstBuf,size_t _Size,int _Radix); - _CRTIMP errno_t __cdecl mbstowcs_s(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount); - _CRTIMP errno_t __cdecl _mbstowcs_s_l(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount,_locale_t _Locale); - _CRTIMP errno_t __cdecl _ultoa_s(unsigned long _Val,char *_DstBuf,size_t _Size,int _Radix); - _CRTIMP errno_t __cdecl _wctomb_s_l(int *_SizeConverted,char *_MbCh,size_t _SizeInBytes,wchar_t _WCh,_locale_t _Locale); - _CRTIMP errno_t __cdecl wcstombs_s(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes); - _CRTIMP errno_t __cdecl _wcstombs_s_l(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes,_locale_t _Locale); - -#ifndef _WSTDLIB_S_DEFINED -#define _WSTDLIB_S_DEFINED - _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); - _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); -#endif -#endif - -#ifndef _POSIX_ - _CRTIMP errno_t __cdecl _ecvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDights,int *_PtDec,int *_PtSign); - _CRTIMP errno_t __cdecl _fcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); - _CRTIMP errno_t __cdecl _gcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDigits); - _CRTIMP errno_t __cdecl _makepath_s(char *_PathResult,size_t _Size,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); - _CRTIMP errno_t __cdecl _putenv_s(const char *_Name,const char *_Value); - _CRTIMP errno_t __cdecl _searchenv_s(const char *_Filename,const char *_EnvVar,char *_ResultPath,size_t _SizeInBytes); - _CRTIMP errno_t __cdecl _splitpath_s(const char *_FullPath,char *_Drive,size_t _DriveSize,char *_Dir,size_t _DirSize,char *_Filename,size_t _FilenameSize,char *_Ext,size_t _ExtSize); - -#ifndef _WSTDLIBP_S_DEFINED -#define _WSTDLIBP_S_DEFINED - _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); - _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); - _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); - _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif -#endif diff --git a/win32/include/sec_api/stralign_s.h b/win32/include/sec_api/stralign_s.h deleted file mode 100644 index 5b78f586..00000000 --- a/win32/include/sec_api/stralign_s.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef __STRALIGN_H_S_ -#define __STRALIGN_H_S_ - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(I_X86_) && defined(_WSTRING_S_DEFINED) -#if defined(__cplusplus) && defined(_WConst_Return) - static __inline PUWSTR ua_wcscpy_s(PUWSTR Destination,size_t DestinationSize,PCUWSTR Source) { - if(WSTR_ALIGNED(Source) && WSTR_ALIGNED(Destination)) return (wcscpy_s((PWSTR)Destination,DestinationSize,(PCWSTR)Source)==0 ? Destination : NULL); - return uaw_wcscpy((PCUWSTR)String,Character); - } -#endif -#endif - -#ifdef __cplusplus -} -#endif -#endif -#endif diff --git a/win32/include/sec_api/string_s.h b/win32/include/sec_api/string_s.h deleted file mode 100644 index 9db70e77..00000000 --- a/win32/include/sec_api/string_s.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_STRING_S -#define _INC_STRING_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - - _CRTIMP errno_t __cdecl _strset_s(char *_Dst,size_t _DstSize,int _Value); - _CRTIMP errno_t __cdecl _strerror_s(char *_Buf,size_t _SizeInBytes,const char *_ErrMsg); - _CRTIMP errno_t __cdecl _strlwr_s(char *_Str,size_t _Size); - _CRTIMP errno_t __cdecl _strlwr_s_l(char *_Str,size_t _Size,_locale_t _Locale); - _CRTIMP errno_t __cdecl _strnset_s(char *_Str,size_t _Size,int _Val,size_t _MaxCount); - _CRTIMP errno_t __cdecl _strupr_s(char *_Str,size_t _Size); - _CRTIMP errno_t __cdecl _strupr_s_l(char *_Str,size_t _Size,_locale_t _Locale); -#ifndef _WSTRING_S_DEFINED -#define _WSTRING_S_DEFINED - _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); - _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); - _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); - _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); - _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); - _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); - _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); - _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); - _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); -#endif - -#ifdef __cplusplus -} -#endif -#endif -#endif diff --git a/win32/include/sec_api/sys/timeb_s.h b/win32/include/sec_api/sys/timeb_s.h deleted file mode 100644 index af5ef098..00000000 --- a/win32/include/sec_api/sys/timeb_s.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -#ifndef _TIMEB_H_S -#define _TIMEB_H_S - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef _USE_32BIT_TIME_T -#define _ftime_s _ftime32_s -#else -#define _ftime_s _ftime64_s -#endif - - _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time); -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/win32/include/sec_api/tchar_s.h b/win32/include/sec_api/tchar_s.h deleted file mode 100644 index 343d348e..00000000 --- a/win32/include/sec_api/tchar_s.h +++ /dev/null @@ -1,266 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_TCHAR_S -#define _INC_TCHAR_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef _UNICODE - -#define _tprintf_s wprintf_s -#define _tprintf_s_l _wprintf_s_l -#define _tcprintf_s _cwprintf_s -#define _tcprintf_s_l _cwprintf_s_l -#define _vtcprintf_s _vcwprintf_s -#define _vtcprintf_s_l _vcwprintf_s_l -#define _ftprintf_s fwprintf_s -#define _ftprintf_s_l _fwprintf_s_l -#define _stprintf_s swprintf_s -#define _stprintf_s_l _swprintf_s_l -#define _sntprintf_s _snwprintf_s -#define _sntprintf_s_l _snwprintf_s_l -#define _vtprintf_s vwprintf_s -#define _vtprintf_s_l _vwprintf_s_l -#define _vftprintf_s vfwprintf_s -#define _vftprintf_s_l _vfwprintf_s_l -#define _vstprintf_s vswprintf_s -#define _vstprintf_s_l _vswprintf_s_l -#define _vsntprintf_s _vsnwprintf_s -#define _vsntprintf_s_l _vsnwprintf_s_l - -#define _tscanf_s wscanf_s -#define _tscanf_s_l _wscanf_s_l -#define _tcscanf_s _cwscanf_s -#define _tcscanf_s_l _cwscanf_s_l -#define _ftscanf_s fwscanf_s -#define _ftscanf_s_l _fwscanf_s_l -#define _stscanf_s swscanf_s -#define _stscanf_s_l _swscanf_s_l -#define _sntscanf_s _snwscanf_s -#define _sntscanf_s_l _snwscanf_s_l - -#define _cgetts_s _cgetws_s -#define _getts_s _getws_s - -#define _itot_s _itow_s -#define _ltot_s _ltow_s -#define _ultot_s _ultow_s -#define _i64tot_s _i64tow_s -#define _ui64tot_s _ui64tow_s - -#define _tcscat_s wcscat_s -#define _tcscpy_s wcscpy_s -#define _tcsncat_s wcsncat_s -#define _tcsncat_s_l _wcsncat_s_l -#define _tcsncpy_s wcsncpy_s -#define _tcsncpy_s_l _wcsncpy_s_l -#define _tcstok_s wcstok_s -#define _tcstok_s_l _wcstok_s_l -#define _tcserror_s _wcserror_s -#define __tcserror_s __wcserror_s - -#define _tcsnset_s _wcsnset_s -#define _tcsnset_s_l _wcsnset_s_l -#define _tcsset_s _wcsset_s -#define _tcsset_s_l _wcsset_s_l - -#define _tasctime_s _wasctime_s -#define _tctime_s _wctime_s -#define _tctime32_s _wctime32_s -#define _tctime64_s _wctime64_s -#define _tstrdate_s _wstrdate_s -#define _tstrtime_s _wstrtime_s - -#define _tgetenv_s _wgetenv_s -#define _tdupenv_s _wdupenv_s -#define _tmakepath_s _wmakepath_s -#define _tputenv_s _wputenv_s -#define _tsearchenv_s _wsearchenv_s -#define _tsplitpath_s _wsplitpath_s - -#define _tfopen_s _wfopen_s -#define _tfreopen_s _wfreopen_s -#define _ttmpnam_s _wtmpnam_s -#define _taccess_s _waccess_s -#define _tmktemp_s _wmktemp_s - -#define _tcsnccat_s wcsncat_s -#define _tcsnccat_s_l _wcsncat_s_l -#define _tcsnccpy_s wcsncpy_s -#define _tcsnccpy_s_l _wcsncpy_s_l - -#define _tcslwr_s _wcslwr_s -#define _tcslwr_s_l _wcslwr_s_l -#define _tcsupr_s _wcsupr_s -#define _tcsupr_s_l _wcsupr_s_l - -#define _wcstok_s_l(_String,_Delimiters,_Current_position,_Locale) (wcstok_s(_String,_Delimiters,_Current_position)) -#define _wcsnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_wcsnset_s(_Destination,_Destination_size_chars,_Value,_Count)) -#define _wcsset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_wcsset_s(_Destination,_Destination_size_chars,_Value)) - -#else - -#define _tprintf_s printf_s -#define _tprintf_s_l _printf_s_l -#define _tcprintf_s _cprintf_s -#define _tcprintf_s_l _cprintf_s_l -#define _vtcprintf_s _vcprintf_s -#define _vtcprintf_s_l _vcprintf_s_l -#define _ftprintf_s fprintf_s -#define _ftprintf_s_l _fprintf_s_l -#define _stprintf_s sprintf_s -#define _stprintf_s_l _sprintf_s_l -#define _sntprintf_s _snprintf_s -#define _sntprintf_s_l _snprintf_s_l -#define _vtprintf_s vprintf_s -#define _vtprintf_s_l _vprintf_s_l -#define _vftprintf_s vfprintf_s -#define _vftprintf_s_l _vfprintf_s_l -#define _vstprintf_s vsprintf_s -#define _vstprintf_s_l _vsprintf_s_l -#define _vsntprintf_s _vsnprintf_s -#define _vsntprintf_s_l _vsnprintf_s_l -#define _tscanf_s scanf_s -#define _tscanf_s_l _scanf_s_l -#define _tcscanf_s _cscanf_s -#define _tcscanf_s_l _cscanf_s_l -#define _ftscanf_s fscanf_s -#define _ftscanf_s_l _fscanf_s_l -#define _stscanf_s sscanf_s -#define _stscanf_s_l _sscanf_s_l -#define _sntscanf_s _snscanf_s -#define _sntscanf_s_l _snscanf_s_l - -#define _getts_s gets_s -#define _cgetts_s _cgets_s -#define _itot_s _itoa_s -#define _ltot_s _ltoa_s -#define _ultot_s _ultoa_s -#define _i64tot_s _i64toa_s -#define _ui64tot_s _ui64toa_s - -#define _tcscat_s strcat_s -#define _tcscpy_s strcpy_s -#define _tcserror_s strerror_s -#define __tcserror_s _strerror_s - -#define _tasctime_s asctime_s -#define _tctime_s ctime_s -#define _tctime32_s _ctime32_s -#define _tctime64_s _ctime64_s -#define _tstrdate_s _strdate_s -#define _tstrtime_s _strtime_s - -#define _tgetenv_s getenv_s -#define _tdupenv_s _dupenv_s -#define _tmakepath_s _makepath_s -#define _tputenv_s _putenv_s -#define _tsearchenv_s _searchenv_s -#define _tsplitpath_s _splitpath_s - -#define _tfopen_s fopen_s -#define _tfreopen_s freopen_s -#define _ttmpnam_s tmpnam_s -#define _tmktemp_s _mktemp_s - -#ifndef _POSIX_ -#define _taccess_s _access_s -#endif - -#define _tsopen_s _sopen_s - -#ifdef _MBCS - -#ifdef _MB_MAP_DIRECT - -#define _tcsncat_s _mbsnbcat_s -#define _tcsncat_s_l _mbsnbcat_s_l -#define _tcsncpy_s _mbsnbcpy_s -#define _tcsncpy_s_l _mbsnbcpy_s_l -#define _tcstok_s _mbstok_s -#define _tcstok_s_l _mbstok_s_l - -#define _tcsnset_s _mbsnbset_s -#define _tcsnset_s_l _mbsnbset_s_l -#define _tcsset_s _mbsset_s -#define _tcsset_s_l _mbsset_s_l - -#define _tcsnccat_s _mbsncat_s -#define _tcsnccat_s_l _mbsncat_s_l -#define _tcsnccpy_s _mbsncpy_s -#define _tcsnccpy_s_l _mbsncpy_s_l -#define _tcsncset_s _mbsnset_s -#define _tcsncset_s_l _mbsnset_s_l - -#define _tcslwr_s _mbslwr_s -#define _tcslwr_s_l _mbslwr_s_l -#define _tcsupr_s _mbsupr_s -#define _tcsupr_s_l _mbsupr_s_l - -#define _tccpy_s _mbccpy_s -#define _tccpy_s_l _mbccpy_s_l -#else - - _CRTIMP char *__cdecl _tcsncat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsncat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsncpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsncpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcstok_s(char *_Str,const char *_Delim,char **_Context); - _CRTIMP char *__cdecl _tcstok_s_l(char *_Str,const char *_Delim,char **_Context,_locale_t _Locale); - _CRTIMP errno_t __cdecl _tcsset_s(char *_Str,size_t _SizeInChars,unsigned int _Val); - _CRTIMP errno_t __cdecl _tcsset_s_l(char *_Str,size_t _SizeInChars,unsigned int,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsnccat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsnccat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsnccpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsnccpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcslwr_s(char *_Str,size_t _SizeInChars); - _CRTIMP char *__cdecl _tcslwr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsupr_s(char *_Str,size_t _SizeInChars); - _CRTIMP char *__cdecl _tcsupr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); - -#endif - -#else - -#define _tcsncat_s strncat_s -#define _tcsncat_s_l _strncat_s_l -#define _tcsncpy_s strncpy_s -#define _tcsncpy_s_l _strncpy_s_l -#define _tcstok_s strtok_s -#define _tcstok_s_l _strtok_s_l - -#define _tcsnset_s _strnset_s -#define _tcsnset_s_l _strnset_s_l -#define _tcsset_s _strset_s -#define _tcsset_s _strset_s -#define _tcsset_s_l _strset_s_l - -#define _tcsnccat_s strncat_s -#define _tcsnccat_s_l _strncat_s_l -#define _tcsnccpy_s strncpy_s -#define _tcsnccpy_s_l _strncpy_s_l - -#define _tcslwr_s _strlwr_s -#define _tcslwr_s_l _strlwr_s_l -#define _tcsupr_s _strupr_s -#define _tcsupr_s_l _strupr_s_l - -#define _strnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_strnset_s(_Destination,_Destination_size_chars,_Value,_Count)) -#define _strset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_strset_s(_Destination,_Destination_size_chars,_Value)) -#endif -#endif - -#ifdef __cplusplus -} -#endif -#endif -#endif diff --git a/win32/include/sec_api/time_s.h b/win32/include/sec_api/time_s.h deleted file mode 100644 index 9603b94f..00000000 --- a/win32/include/sec_api/time_s.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _TIME_H__S -#define _TIME_H__S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - - _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time); - _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time); - _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time); - _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes); - _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time); - _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time); - _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time); -#endif - -#ifndef _WTIME_S_DEFINED -#define _WTIME_S_DEFINED - _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); - _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); - _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); - _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); -#endif - -#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) -#define _INC_WTIME_S_INL -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } -#else -__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } -#endif -#endif -#endif - -#ifndef RC_INVOKED -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); } -#else -__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); } -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif -#endif diff --git a/win32/include/sec_api/wchar_s.h b/win32/include/sec_api/wchar_s.h deleted file mode 100644 index 94251aa8..00000000 --- a/win32/include/sec_api/wchar_s.h +++ /dev/null @@ -1,128 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_WCHAR_S -#define _INC_WCHAR_S - -#include - -#if defined(MINGW_HAS_SECURE_API) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _WIO_S_DEFINED -#define _WIO_S_DEFINED - _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); - _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); -#endif - -#ifndef _WCONIO_S_DEFINED -#define _WCONIO_S_DEFINED - _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); - _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); -#endif - -#ifndef _WSTDIO_S_DEFINED -#define _WSTDIO_S_DEFINED - _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); - int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); - int __cdecl wprintf_s(const wchar_t *_Format,...); - int __cdecl vfwprintf_s(FILE *_File,const wchar_t *_Format,va_list _ArgList); - int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); - int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); - int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); - _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); - _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); - _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); -#endif - -#ifndef _WSTDLIB_S_DEFINED -#define _WSTDLIB_S_DEFINED - _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); - _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); - _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); -#endif -#endif - -#ifndef _POSIX_ -#ifndef _WSTDLIBP_S_DEFINED -#define _WSTDLIBP_S_DEFINED - _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); - _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); - _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); - _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); -#endif -#endif - -#ifndef _WSTRING_S_DEFINED -#define _WSTRING_S_DEFINED - _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); - _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); - _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); - _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); - _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); - _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); - _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); - _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); - _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); -#endif - -#ifndef _WTIME_S_DEFINED -#define _WTIME_S_DEFINED - _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); - _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); - _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); - _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); -#endif - -#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) -#define _INC_WTIME_S_INL -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } -#else -__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } -#endif -#endif -#endif - - _CRTIMP errno_t __cdecl mbsrtowcs_s(size_t *_Retval,wchar_t *_Dst,size_t _SizeInWords,const char **_PSrc,size_t _N,mbstate_t *_State); - _CRTIMP errno_t __cdecl wcrtomb_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,wchar_t _Ch,mbstate_t *_State); - _CRTIMP errno_t __cdecl wcsrtombs_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,const wchar_t **_Src,size_t _Size,mbstate_t *_State); - -#ifdef __cplusplus -} -#endif - -#endif -#endif diff --git a/win32/include/setjmp.h b/win32/include/setjmp.h deleted file mode 100644 index e4f142a3..00000000 --- a/win32/include/setjmp.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_SETJMP -#define _INC_SETJMP - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#if (defined(_X86_) && !defined(__x86_64)) - -#define _JBLEN 16 -#define _JBTYPE int - - typedef struct __JUMP_BUFFER { - unsigned long Ebp; - unsigned long Ebx; - unsigned long Edi; - unsigned long Esi; - unsigned long Esp; - unsigned long Eip; - unsigned long Registration; - unsigned long TryLevel; - unsigned long Cookie; - unsigned long UnwindFunc; - unsigned long UnwindData[6]; - } _JUMP_BUFFER; -#elif defined(__ia64__) - typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { - __int64 LowPart; - __int64 HighPart; - } SETJMP_FLOAT128; - -#define _JBLEN 33 - typedef SETJMP_FLOAT128 _JBTYPE; - - typedef struct __JUMP_BUFFER { - - unsigned long iAReserved[6]; - - unsigned long Registration; - unsigned long TryLevel; - unsigned long Cookie; - unsigned long UnwindFunc; - - unsigned long UnwindData[6]; - - SETJMP_FLOAT128 FltS0; - SETJMP_FLOAT128 FltS1; - SETJMP_FLOAT128 FltS2; - SETJMP_FLOAT128 FltS3; - SETJMP_FLOAT128 FltS4; - SETJMP_FLOAT128 FltS5; - SETJMP_FLOAT128 FltS6; - SETJMP_FLOAT128 FltS7; - SETJMP_FLOAT128 FltS8; - SETJMP_FLOAT128 FltS9; - SETJMP_FLOAT128 FltS10; - SETJMP_FLOAT128 FltS11; - SETJMP_FLOAT128 FltS12; - SETJMP_FLOAT128 FltS13; - SETJMP_FLOAT128 FltS14; - SETJMP_FLOAT128 FltS15; - SETJMP_FLOAT128 FltS16; - SETJMP_FLOAT128 FltS17; - SETJMP_FLOAT128 FltS18; - SETJMP_FLOAT128 FltS19; - __int64 FPSR; - __int64 StIIP; - __int64 BrS0; - __int64 BrS1; - __int64 BrS2; - __int64 BrS3; - __int64 BrS4; - __int64 IntS0; - __int64 IntS1; - __int64 IntS2; - __int64 IntS3; - __int64 RsBSP; - __int64 RsPFS; - __int64 ApUNAT; - __int64 ApLC; - __int64 IntSp; - __int64 IntNats; - __int64 Preds; - - } _JUMP_BUFFER; -#elif defined(__x86_64) - typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { - unsigned __int64 Part[2]; - } SETJMP_FLOAT128; - -#define _JBLEN 16 - typedef SETJMP_FLOAT128 _JBTYPE; - - typedef struct _JUMP_BUFFER { - unsigned __int64 Frame; - unsigned __int64 Rbx; - unsigned __int64 Rsp; - unsigned __int64 Rbp; - unsigned __int64 Rsi; - unsigned __int64 Rdi; - unsigned __int64 R12; - unsigned __int64 R13; - unsigned __int64 R14; - unsigned __int64 R15; - unsigned __int64 Rip; - unsigned __int64 Spare; - SETJMP_FLOAT128 Xmm6; - SETJMP_FLOAT128 Xmm7; - SETJMP_FLOAT128 Xmm8; - SETJMP_FLOAT128 Xmm9; - SETJMP_FLOAT128 Xmm10; - SETJMP_FLOAT128 Xmm11; - SETJMP_FLOAT128 Xmm12; - SETJMP_FLOAT128 Xmm13; - SETJMP_FLOAT128 Xmm14; - SETJMP_FLOAT128 Xmm15; - } _JUMP_BUFFER; -#endif -#ifndef _JMP_BUF_DEFINED - typedef _JBTYPE jmp_buf[_JBLEN]; -#define _JMP_BUF_DEFINED -#endif - - void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void); - -#ifdef USE_MINGW_SETJMP_TWO_ARGS -#ifndef _INC_SETJMPEX -#define setjmp(BUF) _setjmp((BUF),mingw_getsp()) - int __cdecl __attribute__ ((__nothrow__)) _setjmp(jmp_buf _Buf,void *_Ctx); -#else -#undef setjmp -#define setjmp(BUF) _setjmpex((BUF),mingw_getsp()) -#define setjmpex(BUF) _setjmpex((BUF),mingw_getsp()) - int __cdecl __attribute__ ((__nothrow__)) _setjmpex(jmp_buf _Buf,void *_Ctx); -#endif -#else -#ifndef _INC_SETJMPEX -#define setjmp _setjmp -#endif - int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf); -#endif - - __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/; - __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value); - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/share.h b/win32/include/share.h deleted file mode 100644 index 358855fe..00000000 --- a/win32/include/share.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_SHARE -#define _INC_SHARE - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#define _SH_COMPAT 0x00 -#define _SH_DENYRW 0x10 -#define _SH_DENYWR 0x20 -#define _SH_DENYRD 0x30 -#define _SH_DENYNO 0x40 -#define _SH_SECURE 0x80 - -#ifndef NO_OLDNAMES -#define SH_COMPAT _SH_COMPAT -#define SH_DENYRW _SH_DENYRW -#define SH_DENYWR _SH_DENYWR -#define SH_DENYRD _SH_DENYRD -#define SH_DENYNO _SH_DENYNO -#endif - -#endif diff --git a/win32/include/signal.h b/win32/include/signal.h deleted file mode 100644 index a518f6b3..00000000 --- a/win32/include/signal.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_SIGNAL -#define _INC_SIGNAL - -#include <_mingw.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _SIG_ATOMIC_T_DEFINED -#define _SIG_ATOMIC_T_DEFINED - typedef int sig_atomic_t; -#endif - -#define NSIG 23 - -#define SIGHUP 1 /* hangup */ -#define SIGINT 2 -#define SIGQUIT 3 /* quit */ -#define SIGILL 4 -#define SIGTRAP 5 /* trace trap (not reset when caught) */ -#define SIGIOT 6 /* IOT instruction */ -#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ -#define SIGEMT 7 /* EMT instruction */ -#define SIGFPE 8 -#define SIGKILL 9 /* kill (cannot be caught or ignored) */ -#define SIGBUS 10 /* bus error */ -#define SIGSEGV 11 -#define SIGSYS 12 /* bad argument to system call */ -#define SIGPIPE 13 /* write on a pipe with no one to read it */ -#ifdef __USE_MINGW_ALARM -#define SIGALRM 14 /* alarm clock */ -#endif -#define SIGTERM 15 -#define SIGBREAK 21 -#define SIGABRT2 22 - -#define SIGABRT_COMPAT 6 - - typedef void (*__p_sig_fn_t)(int); - -#define SIG_DFL (__p_sig_fn_t)0 -#define SIG_IGN (__p_sig_fn_t)1 -#define SIG_GET (__p_sig_fn_t)2 -#define SIG_SGE (__p_sig_fn_t)3 -#define SIG_ACK (__p_sig_fn_t)4 -#define SIG_ERR (__p_sig_fn_t)-1 - - extern void **__cdecl __pxcptinfoptrs(void); -#define _pxcptinfoptrs (*__pxcptinfoptrs()) - - __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func); - int __cdecl raise(int _SigNum); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/stdint.h b/win32/include/stdint.h deleted file mode 100644 index cde32b6e..00000000 --- a/win32/include/stdint.h +++ /dev/null @@ -1,212 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* ISO C9x 7.18 Integer types - * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * Contributor: Danny Smith - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Date: 2000-12-02 - */ - - -#ifndef _STDINT_H -#define _STDINT_H - -#include <_mingw.h> - -#define __need_wint_t -#define __need_wchar_t -#include "stddef.h" - -#ifndef __int8_t_defined -#define __int8_t_defined -/* 7.18.1.1 Exact-width integer types */ -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned uint32_t; -typedef long long int64_t; -typedef unsigned long long uint64_t; -#endif - -/* 7.18.1.2 Minimum-width integer types */ -typedef signed char int_least8_t; -typedef unsigned char uint_least8_t; -typedef short int_least16_t; -typedef unsigned short uint_least16_t; -typedef int int_least32_t; -typedef unsigned uint_least32_t; -typedef long long int_least64_t; -typedef unsigned long long uint_least64_t; - -/* 7.18.1.3 Fastest minimum-width integer types - * Not actually guaranteed to be fastest for all purposes - * Here we use the exact-width types for 8 and 16-bit ints. - */ -typedef char int_fast8_t; -typedef unsigned char uint_fast8_t; -typedef short int_fast16_t; -typedef unsigned short uint_fast16_t; -typedef int int_fast32_t; -typedef unsigned int uint_fast32_t; -typedef long long int_fast64_t; -typedef unsigned long long uint_fast64_t; - -/* 7.18.1.5 Greatest-width integer types */ -typedef long long intmax_t; -typedef unsigned long long uintmax_t; - -/* 7.18.2 Limits of specified-width integer types */ -#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) - -/* 7.18.2.1 Limits of exact-width integer types */ -#define INT8_MIN (-128) -#define INT16_MIN (-32768) -#define INT32_MIN (-2147483647 - 1) -#define INT64_MIN (-9223372036854775807LL - 1) - -#define INT8_MAX 127 -#define INT16_MAX 32767 -#define INT32_MAX 2147483647 -#define INT64_MAX 9223372036854775807LL - -#define UINT8_MAX 0xff /* 255U */ -#define UINT16_MAX 0xffff /* 65535U */ -#define UINT32_MAX 0xffffffff /* 4294967295U */ -#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ - -/* 7.18.2.2 Limits of minimum-width integer types */ -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -/* 7.18.2.3 Limits of fastest minimum-width integer types */ -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST64_MIN INT64_MIN - -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MAX INT64_MAX - -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -/* 7.18.2.4 Limits of integer types capable of holding - object pointers */ -#ifdef _WIN64 -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX -#else -#define INTPTR_MIN INT32_MIN -#define INTPTR_MAX INT32_MAX -#define UINTPTR_MAX UINT32_MAX -#endif - -/* 7.18.2.5 Limits of greatest-width integer types */ -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -/* 7.18.3 Limits of other integer types */ -#ifdef _WIN64 -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX -#else -#define PTRDIFF_MIN INT32_MIN -#define PTRDIFF_MAX INT32_MAX -#endif - -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX - -#ifndef SIZE_MAX -#ifdef _WIN64 -#define SIZE_MAX UINT64_MAX -#else -#define SIZE_MAX UINT32_MAX -#endif -#endif - -#ifndef WCHAR_MIN /* also in wchar.h */ -#define WCHAR_MIN 0 -#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ -#endif - -/* - * wint_t is unsigned short for compatibility with MS runtime - */ -#define WINT_MIN 0 -#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */ - -#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ - - -/* 7.18.4 Macros for integer constants */ -#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) - -/* 7.18.4.1 Macros for minimum-width integer constants - - According to Douglas Gwyn : - "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC - 9899:1999 as initially published, the expansion was required - to be an integer constant of precisely matching type, which - is impossible to accomplish for the shorter types on most - platforms, because C99 provides no standard way to designate - an integer constant with width less than that of type int. - TC1 changed this to require just an integer constant - *expression* with *promoted* type." - - The trick used here is from Clive D W Feather. -*/ - -#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val)) -#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val)) -#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val)) -/* The 'trick' doesn't work in C89 for long long because, without - suffix, (val) will be evaluated as int, not intmax_t */ -#define INT64_C(val) val##LL - -#define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val)) -#define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val)) -#define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val)) -#define UINT64_C(val) val##ULL - -/* 7.18.4.2 Macros for greatest-width integer constants */ -#define INTMAX_C(val) val##LL -#define UINTMAX_C(val) val##ULL - -#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ - -#endif diff --git a/win32/include/stdio.h b/win32/include/stdio.h deleted file mode 100644 index da887936..00000000 --- a/win32/include/stdio.h +++ /dev/null @@ -1,429 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_STDIO -#define _INC_STDIO - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#define BUFSIZ 512 -#define _NFILE _NSTREAM_ -#define _NSTREAM_ 512 -#define _IOB_ENTRIES 20 -#define EOF (-1) - -#ifndef _FILE_DEFINED - struct _iobuf { - char *_ptr; - int _cnt; - char *_base; - int _flag; - int _file; - int _charbuf; - int _bufsiz; - char *_tmpfname; - }; - typedef struct _iobuf FILE; -#define _FILE_DEFINED -#endif - -#ifdef _POSIX_ -#define _P_tmpdir "/" -#define _wP_tmpdir L"/" -#else -#define _P_tmpdir "\\" -#define _wP_tmpdir L"\\" -#endif - -#define L_tmpnam (sizeof(_P_tmpdir) + 12) - -#ifdef _POSIX_ -#define L_ctermid 9 -#define L_cuserid 32 -#endif - -#define SEEK_CUR 1 -#define SEEK_END 2 -#define SEEK_SET 0 - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -#define FILENAME_MAX 260 -#define FOPEN_MAX 20 -#define _SYS_OPEN 20 -#define TMP_MAX 32767 - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#ifndef _OFF_T_DEFINED -#define _OFF_T_DEFINED -#ifndef _OFF_T_ -#define _OFF_T_ - typedef long _off_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long off_t; -#endif -#endif -#endif - -#ifndef _OFF64_T_DEFINED -#define _OFF64_T_DEFINED - typedef long long _off64_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long long off64_t; -#endif -#endif - -#ifndef _STDIO_DEFINED -#ifdef _WIN64 - _CRTIMP FILE *__cdecl __iob_func(void); -#else -#ifdef _MSVCRT_ -extern FILE _iob[]; /* A pointer to an array of FILE */ -#define __iob_func() (_iob) -#else -extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ -#define __iob_func() (*_imp___iob) -#define _iob __iob_func() -#endif -#endif -#endif - -#ifndef _FPOS_T_DEFINED -#define _FPOS_T_DEFINED -#undef _FPOSOFF - -#if (!defined(NO_OLDNAMES) || defined(__GNUC__)) && _INTEGRAL_MAX_BITS >= 64 - typedef __int64 fpos_t; -#define _FPOSOFF(fp) ((long)(fp)) -#else - typedef long long fpos_t; -#define _FPOSOFF(fp) ((long)(fp)) -#endif - -#endif - -#ifndef _STDSTREAM_DEFINED -#define _STDSTREAM_DEFINED - -#define stdin (&__iob_func()[0]) -#define stdout (&__iob_func()[1]) -#define stderr (&__iob_func()[2]) -#endif - -#define _IOREAD 0x0001 -#define _IOWRT 0x0002 - -#define _IOFBF 0x0000 -#define _IOLBF 0x0040 -#define _IONBF 0x0004 - -#define _IOMYBUF 0x0008 -#define _IOEOF 0x0010 -#define _IOERR 0x0020 -#define _IOSTRG 0x0040 -#define _IORW 0x0080 -#ifdef _POSIX_ -#define _IOAPPEND 0x0200 -#endif - -#define _TWO_DIGIT_EXPONENT 0x1 - -#ifndef _STDIO_DEFINED - - _CRTIMP int __cdecl _filbuf(FILE *_File); - _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File); -#ifdef _POSIX_ - _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode); -#else - _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag); -#endif - void __cdecl clearerr(FILE *_File); - int __cdecl fclose(FILE *_File); - _CRTIMP int __cdecl _fcloseall(void); -#ifdef _POSIX_ - FILE *__cdecl fdopen(int _FileHandle,const char *_Mode); -#else - _CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode); -#endif - int __cdecl feof(FILE *_File); - int __cdecl ferror(FILE *_File); - int __cdecl fflush(FILE *_File); - int __cdecl fgetc(FILE *_File); - _CRTIMP int __cdecl _fgetchar(void); - int __cdecl fgetpos(FILE *_File ,fpos_t *_Pos); - char *__cdecl fgets(char *_Buf,int _MaxCount,FILE *_File); -#ifdef _POSIX_ - int __cdecl fileno(FILE *_File); -#else - _CRTIMP int __cdecl _fileno(FILE *_File); -#endif - _CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix); - _CRTIMP int __cdecl _flushall(void); - FILE *__cdecl fopen(const char *_Filename,const char *_Mode); - FILE *fopen64(const char *filename,const char *mode); - int __cdecl fprintf(FILE *_File,const char *_Format,...); - int __cdecl fputc(int _Ch,FILE *_File); - _CRTIMP int __cdecl _fputchar(int _Ch); - int __cdecl fputs(const char *_Str,FILE *_File); - size_t __cdecl fread(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); - FILE *__cdecl freopen(const char *_Filename,const char *_Mode,FILE *_File); - int __cdecl fscanf(FILE *_File,const char *_Format,...); - int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos); - int __cdecl fseek(FILE *_File,long _Offset,int _Origin); - int fseeko64(FILE* stream, _off64_t offset, int whence); - long __cdecl ftell(FILE *_File); - _off64_t ftello64(FILE * stream); - int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin); - __int64 __cdecl _ftelli64(FILE *_File); - size_t __cdecl fwrite(const void *_Str,size_t _Size,size_t _Count,FILE *_File); - int __cdecl getc(FILE *_File); - int __cdecl getchar(void); - _CRTIMP int __cdecl _getmaxstdio(void); - char *__cdecl gets(char *_Buffer); - int __cdecl _getw(FILE *_File); -#ifndef _CRT_PERROR_DEFINED -#define _CRT_PERROR_DEFINED - void __cdecl perror(const char *_ErrMsg); -#endif - _CRTIMP int __cdecl _pclose(FILE *_File); - _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode); -#if !defined(NO_OLDNAMES) && !defined(popen) -#define popen _popen -#define pclose _pclose -#endif - int __cdecl printf(const char *_Format,...); - int __cdecl putc(int _Ch,FILE *_File); - int __cdecl putchar(int _Ch); - int __cdecl puts(const char *_Str); - _CRTIMP int __cdecl _putw(int _Word,FILE *_File); -#ifndef _CRT_DIRECTORY_DEFINED -#define _CRT_DIRECTORY_DEFINED - int __cdecl remove(const char *_Filename); - int __cdecl rename(const char *_OldFilename,const char *_NewFilename); - _CRTIMP int __cdecl _unlink(const char *_Filename); -#ifndef NO_OLDNAMES - int __cdecl unlink(const char *_Filename); -#endif -#endif - void __cdecl rewind(FILE *_File); - _CRTIMP int __cdecl _rmtmp(void); - int __cdecl scanf(const char *_Format,...); - void __cdecl setbuf(FILE *_File,char *_Buffer); - _CRTIMP int __cdecl _setmaxstdio(int _Max); - _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format); - _CRTIMP unsigned int __cdecl _get_output_format(void); - int __cdecl setvbuf(FILE *_File,char *_Buf,int _Mode,size_t _Size); - _CRTIMP int __cdecl _scprintf(const char *_Format,...); - int __cdecl sscanf(const char *_Src,const char *_Format,...); - _CRTIMP int __cdecl _snscanf(const char *_Src,size_t _MaxCount,const char *_Format,...); - FILE *__cdecl tmpfile(void); - char *__cdecl tmpnam(char *_Buffer); - int __cdecl ungetc(int _Ch,FILE *_File); - int __cdecl vfprintf(FILE *_File,const char *_Format,va_list _ArgList); - int __cdecl vprintf(const char *_Format,va_list _ArgList); - /* Make sure macros are not defined. */ -#pragma push_macro("vsnprintf") -#pragma push_macro("snprintf") -# undef vsnprintf -# undef snprintf - extern - __attribute__((format(gnu_printf, 3, 0))) __attribute__((nonnull (3))) - int __mingw_vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); - extern - __attribute__((format(gnu_printf, 3, 4))) __attribute__((nonnull (3))) - int __mingw_snprintf(char* s, size_t n, const char* format, ...); - int __cdecl vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _snprintf(char *_Dest,size_t _Count,const char *_Format,...); - _CRTIMP int __cdecl _vsnprintf(char *_Dest,size_t _Count,const char *_Format,va_list _Args); - int __cdecl sprintf(char *_Dest,const char *_Format,...); - int __cdecl vsprintf(char *_Dest,const char *_Format,va_list _Args); -#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ - int __cdecl snprintf(char* s, size_t n, const char* format, ...); - __CRT_INLINE int __cdecl vsnprintf (char* s, size_t n, const char* format,va_list arg) { - return _vsnprintf ( s, n, format, arg); - } - int __cdecl vscanf(const char * Format, va_list argp); - int __cdecl vfscanf (FILE * fp, const char * Format,va_list argp); - int __cdecl vsscanf (const char * _Str,const char * Format,va_list argp); -#endif -/* Restore may prior defined macros snprintf/vsnprintf. */ -#pragma pop_macro("snprintf") -#pragma pop_macro("vsnprintf") -/* Check if vsnprintf and snprintf are defaulting to gnu-style. */ -# if defined(USE_MINGW_GNU_SNPRINTF) && USE_MINGW_GNU_SNPRINTF -# ifndef vsnprint -# define vsnprintf __mingw_vsnprintf -# endif -# ifndef snprintf -# define snprintf __mingw_snprintf -# endif -# endif - _CRTIMP int __cdecl _vscprintf(const char *_Format,va_list _ArgList); - _CRTIMP int __cdecl _set_printf_count_output(int _Value); - _CRTIMP int __cdecl _get_printf_count_output(void); - -#ifndef _WSTDIO_DEFINED - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - -#ifdef _POSIX_ - _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); -#else - _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); -#endif - wint_t __cdecl fgetwc(FILE *_File); - _CRTIMP wint_t __cdecl _fgetwchar(void); - wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); - _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); - wint_t __cdecl getwc(FILE *_File); - wint_t __cdecl getwchar(void); - wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); - wint_t __cdecl putwchar(wchar_t _Ch); - wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); - wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); - int __cdecl fputws(const wchar_t *_Str,FILE *_File); - _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); - _CRTIMP int __cdecl _putws(const wchar_t *_Str); - int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); - int __cdecl wprintf(const wchar_t *_Format,...); - _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); - int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); - int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); - _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); - _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); -#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ - int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); - __CRT_INLINE int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, va_list arg) { return _vsnwprintf(s,n,format,arg); } - int __cdecl vwscanf (const wchar_t *, va_list); - int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); - int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); -#endif - _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); - -#ifndef RC_INVOKED -#include -#endif - -#ifdef _CRT_NON_CONFORMING_SWPRINTFS -#ifndef __cplusplus -#define swprintf _swprintf -#define vswprintf _vswprintf -#define _swprintf_l __swprintf_l -#define _vswprintf_l __vswprintf_l -#endif -#endif - - _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); - _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); - int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); - int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); - _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); - int __cdecl wscanf(const wchar_t *_Format,...); - _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); - _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); - _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); -#ifndef _CRT_WPERROR_DEFINED -#define _CRT_WPERROR_DEFINED - _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); -#endif - _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); -#if !defined(NO_OLDNAMES) && !defined(wpopen) -#define wpopen _wpopen -#endif - _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); - _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); - _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); - _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); - _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); - -#undef _CRT_GETPUTWCHAR_NOINLINE - -#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) -#define getwchar() fgetwc(stdin) -#define putwchar(_c) fputwc((_c),stdout) -#else - __CRT_INLINE wint_t __cdecl getwchar() { return (fgetwc(stdin)); } - __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) { return (fputwc(_C,stdout)); } -#endif - -#define getwc(_stm) fgetwc(_stm) -#define putwc(_c,_stm) fputwc(_c,_stm) -#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) -#define _getwc_nolock(_stm) _fgetwc_nolock(_stm) - -#define _WSTDIO_DEFINED -#endif - -#define _STDIO_DEFINED -#endif - -#define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) -#define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) -#define _getc_nolock(_stream) _fgetc_nolock(_stream) -#define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream) -#define _getchar_nolock() _getc_nolock(stdin) -#define _putchar_nolock(_c) _putc_nolock((_c),stdout) -#define _getwchar_nolock() _getwc_nolock(stdin) -#define _putwchar_nolock(_c) _putwc_nolock((_c),stdout) - - _CRTIMP void __cdecl _lock_file(FILE *_File); - _CRTIMP void __cdecl _unlock_file(FILE *_File); - _CRTIMP int __cdecl _fclose_nolock(FILE *_File); - _CRTIMP int __cdecl _fflush_nolock(FILE *_File); - _CRTIMP size_t __cdecl _fread_nolock(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); - _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin); - _CRTIMP long __cdecl _ftell_nolock(FILE *_File); - _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin); - _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File); - _CRTIMP size_t __cdecl _fwrite_nolock(const void *_DstBuf,size_t _Size,size_t _Count,FILE *_File); - _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File); - -#if !defined(NO_OLDNAMES) || !defined(_POSIX) -#define P_tmpdir _P_tmpdir -#define SYS_OPEN _SYS_OPEN - - char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix); - int __cdecl fcloseall(void); - FILE *__cdecl fdopen(int _FileHandle,const char *_Format); - int __cdecl fgetchar(void); - int __cdecl fileno(FILE *_File); - int __cdecl flushall(void); - int __cdecl fputchar(int _Ch); - int __cdecl getw(FILE *_File); - int __cdecl putw(int _Ch,FILE *_File); - int __cdecl rmtmp(void); -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) - -#include - -#endif diff --git a/win32/include/stdlib.h b/win32/include/stdlib.h deleted file mode 100644 index 3a656e70..00000000 --- a/win32/include/stdlib.h +++ /dev/null @@ -1,585 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_STDLIB -#define _INC_STDLIB - -#include <_mingw.h> -#include - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 - -#ifndef _ONEXIT_T_DEFINED -#define _ONEXIT_T_DEFINED - - typedef int (__cdecl *_onexit_t)(void); - -#ifndef NO_OLDNAMES -#define onexit_t _onexit_t -#endif -#endif - -#ifndef _DIV_T_DEFINED -#define _DIV_T_DEFINED - - typedef struct _div_t { - int quot; - int rem; - } div_t; - - typedef struct _ldiv_t { - long quot; - long rem; - } ldiv_t; -#endif - -#ifndef _CRT_DOUBLE_DEC -#define _CRT_DOUBLE_DEC - -#pragma pack(4) - typedef struct { - unsigned char ld[10]; - } _LDOUBLE; -#pragma pack() - -#define _PTR_LD(x) ((unsigned char *)(&(x)->ld)) - - typedef struct { - double x; - } _CRT_DOUBLE; - - typedef struct { - float f; - } _CRT_FLOAT; - -#pragma push_macro("long") -#undef long - - typedef struct { - long double x; - } _LONGDOUBLE; - -#pragma pop_macro("long") - -#pragma pack(4) - typedef struct { - unsigned char ld12[12]; - } _LDBL12; -#pragma pack() -#endif - -#define RAND_MAX 0x7fff - -#ifndef MB_CUR_MAX -#define MB_CUR_MAX ___mb_cur_max_func() -#ifndef __mb_cur_max -#ifdef _MSVCRT_ - extern int __mb_cur_max; -#else -#define __mb_cur_max (*_imp____mb_cur_max) - extern int *_imp____mb_cur_max; -#endif -#endif -#ifdef _MSVCRT_ - extern int __mbcur_max; -#define ___mb_cur_max_func() (__mb_cur_max) -#else - extern int* _imp____mbcur_max; -#define ___mb_cur_max_func() (*_imp____mb_cur_max) -#endif -#endif - -#define __max(a,b) (((a) > (b)) ? (a) : (b)) -#define __min(a,b) (((a) < (b)) ? (a) : (b)) - -#define _MAX_PATH 260 -#define _MAX_DRIVE 3 -#define _MAX_DIR 256 -#define _MAX_FNAME 256 -#define _MAX_EXT 256 - -#define _OUT_TO_DEFAULT 0 -#define _OUT_TO_STDERR 1 -#define _OUT_TO_MSGBOX 2 -#define _REPORT_ERRMODE 3 - -#define _WRITE_ABORT_MSG 0x1 -#define _CALL_REPORTFAULT 0x2 - -#define _MAX_ENV 32767 - - typedef void (__cdecl *_purecall_handler)(void); - - _CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler _Handler); - _CRTIMP _purecall_handler __cdecl _get_purecall_handler(void); - - typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t); - _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler); - _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void); - -#ifndef _CRT_ERRNO_DEFINED -#define _CRT_ERRNO_DEFINED - _CRTIMP int *__cdecl _errno(void); -#define errno (*_errno()) - errno_t __cdecl _set_errno(int _Value); - errno_t __cdecl _get_errno(int *_Value); -#endif - _CRTIMP unsigned long *__cdecl __doserrno(void); -#define _doserrno (*__doserrno()) - errno_t __cdecl _set_doserrno(unsigned long _Value); - errno_t __cdecl _get_doserrno(unsigned long *_Value); -#ifdef _MSVCRT_ - extern char *_sys_errlist[]; - extern int _sys_nerr; -#else - _CRTIMP char *_sys_errlist[1]; - _CRTIMP int _sys_nerr; -#endif -#if (defined(_X86_) && !defined(__x86_64)) - _CRTIMP int *__cdecl __p___argc(void); - _CRTIMP char ***__cdecl __p___argv(void); - _CRTIMP wchar_t ***__cdecl __p___wargv(void); - _CRTIMP char ***__cdecl __p__environ(void); - _CRTIMP wchar_t ***__cdecl __p__wenviron(void); - _CRTIMP char **__cdecl __p__pgmptr(void); - _CRTIMP wchar_t **__cdecl __p__wpgmptr(void); -#endif -#ifndef __argc -#ifdef _MSVCRT_ - extern int __argc; -#else -#define __argc (*_imp____argc) - extern int *_imp____argc; -#endif -#endif -#ifndef __argv -#ifdef _MSVCRT_ - extern char **__argv; -#else -#define __argv (*_imp____argv) - extern char ***_imp____argv; -#endif -#endif -#ifndef __wargv -#ifdef _MSVCRT_ - extern wchar_t **__wargv; -#else -#define __wargv (*_imp____wargv) - extern wchar_t ***_imp____wargv; -#endif -#endif - -#ifdef _POSIX_ - extern char **environ; -#else -#ifndef _environ -#ifdef _MSVCRT_ - extern char **_environ; -#else -#define _environ (*_imp___environ) - extern char ***_imp___environ; -#endif -#endif - -#ifndef _wenviron -#ifdef _MSVCRT_ - extern wchar_t **_wenviron; -#else -#define _wenviron (*_imp___wenviron) - extern wchar_t ***_imp___wenviron; -#endif -#endif -#endif -#ifndef _pgmptr -#ifdef _MSVCRT_ - extern char *_pgmptr; -#else -#define _pgmptr (*_imp___pgmptr) - extern char **_imp___pgmptr; -#endif -#endif - -#ifndef _wpgmptr -#ifdef _MSVCRT_ - extern wchar_t *_wpgmptr; -#else -#define _wpgmptr (*_imp___wpgmptr) - extern wchar_t **_imp___wpgmptr; -#endif -#endif - errno_t __cdecl _get_pgmptr(char **_Value); - errno_t __cdecl _get_wpgmptr(wchar_t **_Value); -#ifndef _fmode -#ifdef _MSVCRT_ - extern int _fmode; -#else -#define _fmode (*_imp___fmode) - extern int *_imp___fmode; -#endif -#endif - _CRTIMP errno_t __cdecl _set_fmode(int _Mode); - _CRTIMP errno_t __cdecl _get_fmode(int *_PMode); - -#ifndef _osplatform -#ifdef _MSVCRT_ - extern unsigned int _osplatform; -#else -#define _osplatform (*_imp___osplatform) - extern unsigned int *_imp___osplatform; -#endif -#endif - -#ifndef _osver -#ifdef _MSVCRT_ - extern unsigned int _osver; -#else -#define _osver (*_imp___osver) - extern unsigned int *_imp___osver; -#endif -#endif - -#ifndef _winver -#ifdef _MSVCRT_ - extern unsigned int _winver; -#else -#define _winver (*_imp___winver) - extern unsigned int *_imp___winver; -#endif -#endif - -#ifndef _winmajor -#ifdef _MSVCRT_ - extern unsigned int _winmajor; -#else -#define _winmajor (*_imp___winmajor) - extern unsigned int *_imp___winmajor; -#endif -#endif - -#ifndef _winminor -#ifdef _MSVCRT_ - extern unsigned int _winminor; -#else -#define _winminor (*_imp___winminor) - extern unsigned int *_imp___winminor; -#endif -#endif - - errno_t __cdecl _get_osplatform(unsigned int *_Value); - errno_t __cdecl _get_osver(unsigned int *_Value); - errno_t __cdecl _get_winver(unsigned int *_Value); - errno_t __cdecl _get_winmajor(unsigned int *_Value); - errno_t __cdecl _get_winminor(unsigned int *_Value); -#ifndef _countof -#ifndef __cplusplus -#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) -#else - extern "C++" { - template char (*__countof_helper(UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray]; -#define _countof(_Array) sizeof(*__countof_helper(_Array)) - } -#endif -#endif - -#ifndef _CRT_TERMINATE_DEFINED -#define _CRT_TERMINATE_DEFINED - void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; - _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; -#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ - /* C99 function name */ - void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; - __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) - { _exit(status); } -#endif - -#pragma push_macro("abort") -#undef abort - void __cdecl __declspec(noreturn) abort(void); -#pragma pop_macro("abort") - -#endif - - _CRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int _Flags,unsigned int _Mask); - -#ifndef _CRT_ABS_DEFINED -#define _CRT_ABS_DEFINED - int __cdecl abs(int _X); - long __cdecl labs(long _X); -#endif - -#if _INTEGRAL_MAX_BITS >= 64 - __int64 __cdecl _abs64(__int64); -#endif - int __cdecl atexit(void (__cdecl *)(void)); -#ifndef _CRT_ATOF_DEFINED -#define _CRT_ATOF_DEFINED - double __cdecl atof(const char *_String); - double __cdecl _atof_l(const char *_String,_locale_t _Locale); -#endif - int __cdecl atoi(const char *_Str); - _CRTIMP int __cdecl _atoi_l(const char *_Str,_locale_t _Locale); - long __cdecl atol(const char *_Str); - _CRTIMP long __cdecl _atol_l(const char *_Str,_locale_t _Locale); -#ifndef _CRT_ALGO_DEFINED -#define _CRT_ALGO_DEFINED - void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); - void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); -#endif - unsigned short __cdecl _byteswap_ushort(unsigned short _Short); - /*unsigned long __cdecl _byteswap_ulong (unsigned long _Long); */ -#if _INTEGRAL_MAX_BITS >= 64 - unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64); -#endif - div_t __cdecl div(int _Numerator,int _Denominator); - char *__cdecl getenv(const char *_VarName); - _CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix); - _CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix); - _CRTIMP __int64 __cdecl _atoi64(const char *_String); - _CRTIMP __int64 __cdecl _atoi64_l(const char *_String,_locale_t _Locale); - _CRTIMP __int64 __cdecl _strtoi64(const char *_String,char **_EndPtr,int _Radix); - _CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); - _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix); - _CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); -#endif - ldiv_t __cdecl ldiv(long _Numerator,long _Denominator); - _CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix); - int __cdecl mblen(const char *_Ch,size_t _MaxCount); - _CRTIMP int __cdecl _mblen_l(const char *_Ch,size_t _MaxCount,_locale_t _Locale); - _CRTIMP size_t __cdecl _mbstrlen(const char *_Str); - _CRTIMP size_t __cdecl _mbstrlen_l(const char *_Str,_locale_t _Locale); - _CRTIMP size_t __cdecl _mbstrnlen(const char *_Str,size_t _MaxCount); - _CRTIMP size_t __cdecl _mbstrnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); - int __cdecl mbtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes); - _CRTIMP int __cdecl _mbtowc_l(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes,_locale_t _Locale); - size_t __cdecl mbstowcs(wchar_t *_Dest,const char *_Source,size_t _MaxCount); - _CRTIMP size_t __cdecl _mbstowcs_l(wchar_t *_Dest,const char *_Source,size_t _MaxCount,_locale_t _Locale); - int __cdecl rand(void); - _CRTIMP int __cdecl _set_error_mode(int _Mode); - void __cdecl srand(unsigned int _Seed); - double __cdecl strtod(const char *_Str,char **_EndPtr); - float __cdecl strtof(const char *nptr, char **endptr); -#if !defined __NO_ISOCEXT /* in libmingwex.a */ - float __cdecl strtof (const char * __restrict__, char ** __restrict__); - long double __cdecl strtold(const char * __restrict__, char ** __restrict__); -#endif /* __NO_ISOCEXT */ - _CRTIMP double __cdecl _strtod_l(const char *_Str,char **_EndPtr,_locale_t _Locale); - long __cdecl strtol(const char *_Str,char **_EndPtr,int _Radix); - _CRTIMP long __cdecl _strtol_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); - unsigned long __cdecl strtoul(const char *_Str,char **_EndPtr,int _Radix); - _CRTIMP unsigned long __cdecl _strtoul_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); -#ifndef _CRT_SYSTEM_DEFINED -#define _CRT_SYSTEM_DEFINED - int __cdecl system(const char *_Command); -#endif - _CRTIMP char *__cdecl _ultoa(unsigned long _Value,char *_Dest,int _Radix); - int __cdecl wctomb(char *_MbCh,wchar_t _WCh); - _CRTIMP int __cdecl _wctomb_l(char *_MbCh,wchar_t _WCh,_locale_t _Locale); - size_t __cdecl wcstombs(char *_Dest,const wchar_t *_Source,size_t _MaxCount); - _CRTIMP size_t __cdecl _wcstombs_l(char *_Dest,const wchar_t *_Source,size_t _MaxCount,_locale_t _Locale); - -#ifndef _CRT_ALLOCATION_DEFINED -#define _CRT_ALLOCATION_DEFINED - void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); - void __cdecl free(void *_Memory); - void *__cdecl malloc(size_t _Size); - void *__cdecl realloc(void *_Memory,size_t _NewSize); - _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); - _CRTIMP void __cdecl _aligned_free(void *_Memory); - _CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); - _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); - _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); - _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); - _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); - _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); -#endif - -#ifndef _WSTDLIB_DEFINED -#define _WSTDLIB_DEFINED - - _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); - _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); - _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); - double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); - float __cdecl wcstof(const wchar_t *nptr, wchar_t **endptr); -#if !defined __NO_ISOCEXT /* in libmingwex.a */ - float __cdecl wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__); - long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__); -#endif /* __NO_ISOCEXT */ - _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); - long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); - unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); -#ifndef _CRT_WSYSTEM_DEFINED -#define _CRT_WSYSTEM_DEFINED - _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); -#endif - _CRTIMP double __cdecl _wtof(const wchar_t *_Str); - _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); - _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); - _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); - _CRTIMP long __cdecl _wtol(const wchar_t *_Str); - _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); - -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); - _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); - _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); - _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); - _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); - _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); -#endif -#endif - -#ifndef _POSIX_ -#define _CVTBUFSIZE (309+40) - _CRTIMP char *__cdecl _fullpath(char *_FullPath,const char *_Path,size_t _SizeInBytes); - _CRTIMP char *__cdecl _ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); - _CRTIMP char *__cdecl _fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); - _CRTIMP char *__cdecl _gcvt(double _Val,int _NumOfDigits,char *_DstBuf); - _CRTIMP int __cdecl _atodbl(_CRT_DOUBLE *_Result,char *_Str); - _CRTIMP int __cdecl _atoldbl(_LDOUBLE *_Result,char *_Str); - _CRTIMP int __cdecl _atoflt(_CRT_FLOAT *_Result,char *_Str); - _CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale); - _CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale); - _CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale); - unsigned long __cdecl _lrotl(unsigned long _Val,int _Shift); - unsigned long __cdecl _lrotr(unsigned long _Val,int _Shift); - _CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); - _onexit_t __cdecl _onexit(_onexit_t _Func); - -#ifndef _CRT_PERROR_DEFINED -#define _CRT_PERROR_DEFINED - void __cdecl perror(const char *_ErrMsg); -#endif - _CRTIMP int __cdecl _putenv(const char *_EnvString); - unsigned int __cdecl _rotl(unsigned int _Val,int _Shift); -#if _INTEGRAL_MAX_BITS >= 64 - unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val,int _Shift); -#endif - unsigned int __cdecl _rotr(unsigned int _Val,int _Shift); -#if _INTEGRAL_MAX_BITS >= 64 - unsigned __int64 __cdecl _rotr64(unsigned __int64 _Val,int _Shift); -#endif - _CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath); - _CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext); - _CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes); - -#ifndef _WSTDLIBP_DEFINED -#define _WSTDLIBP_DEFINED - _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); - _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); -#ifndef _CRT_WPERROR_DEFINED -#define _CRT_WPERROR_DEFINED - _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); -#endif - _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); - _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); - _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); -#endif - - _CRTIMP void __cdecl _beep(unsigned _Frequency,unsigned _Duration) __MINGW_ATTRIB_DEPRECATED; - /* Not to be confused with _set_error_mode (int). */ - _CRTIMP void __cdecl _seterrormode(int _Mode) __MINGW_ATTRIB_DEPRECATED; - _CRTIMP void __cdecl _sleep(unsigned long _Duration) __MINGW_ATTRIB_DEPRECATED; -#endif - -#ifndef NO_OLDNAMES -#ifndef _POSIX_ -#if 0 -#ifndef __cplusplus -#ifndef NOMINMAX -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif -#endif -#endif -#endif - -#define sys_errlist _sys_errlist -#define sys_nerr _sys_nerr -#define environ _environ - char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); - char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); - char *__cdecl gcvt(double _Val,int _NumOfDigits,char *_DstBuf); - char *__cdecl itoa(int _Val,char *_DstBuf,int _Radix); - char *__cdecl ltoa(long _Val,char *_DstBuf,int _Radix); - int __cdecl putenv(const char *_EnvString); - void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes); - char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix); - onexit_t __cdecl onexit(onexit_t _Func); -#endif -#endif - -#if !defined __NO_ISOCEXT /* externs in static libmingwex.a */ - - typedef struct { long long quot, rem; } lldiv_t; - - lldiv_t __cdecl lldiv(long long, long long); - - __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); } - - #ifdef __TINYC__ /* gr */ - #define strtoll _strtoi64 - #define strtoull _strtoui64 - #else - long long __cdecl strtoll(const char* __restrict__, char** __restrict, int); - unsigned long long __cdecl strtoull(const char* __restrict__, char** __restrict__, int); - #endif - - /* these are stubs for MS _i64 versions */ - long long __cdecl atoll (const char *); - -#ifndef __STRICT_ANSI__ - long long __cdecl wtoll (const wchar_t *); - char *__cdecl lltoa (long long, char *, int); - char *__cdecl ulltoa (unsigned long long , char *, int); - wchar_t *__cdecl lltow (long long, wchar_t *, int); - wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int); - - /* __CRT_INLINE using non-ansi functions */ - __CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); } - __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); } - __CRT_INLINE char *__cdecl ulltoa (unsigned long long _n, char * _c, int _i) { return _ui64toa (_n, _c, _i); } - __CRT_INLINE long long __cdecl wtoll (const wchar_t * _w) { return _wtoi64 (_w); } - __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); } - __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); } -#endif /* (__STRICT_ANSI__) */ - -#endif /* !__NO_ISOCEXT */ - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) - -#include -#include - -#endif diff --git a/win32/include/string.h b/win32/include/string.h deleted file mode 100644 index 3249dc3b..00000000 --- a/win32/include/string.h +++ /dev/null @@ -1,164 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_STRING -#define _INC_STRING - -#include <_mingw.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _NLSCMP_DEFINED -#define _NLSCMP_DEFINED -#define _NLSCMPERROR 2147483647 -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#define _WConst_return _CONST_RETURN - -#ifndef _CRT_MEMORY_DEFINED -#define _CRT_MEMORY_DEFINED - _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); - _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); - _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); - _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); - int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); - void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); - void *__cdecl memset(void *_Dst,int _Val,size_t _Size); -#ifndef NO_OLDNAMES - void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); - int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); -#endif -#endif - char *__cdecl _strset(char *_Str,int _Val); - char *__cdecl strcpy(char *_Dest,const char *_Source); - char *__cdecl strcat(char *_Dest,const char *_Source); - int __cdecl strcmp(const char *_Str1,const char *_Str2); - size_t __cdecl strlen(const char *_Str); -#if 0 - size_t __cdecl strnlen(const char *_Str,size_t _MaxCount); -#endif - void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size); - _CRTIMP char *__cdecl _strdup(const char *_Src); - _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val); - _CRTIMP int __cdecl _stricmp(const char *_Str1,const char *_Str2); - _CRTIMP int __cdecl _strcmpi(const char *_Str1,const char *_Str2); - _CRTIMP int __cdecl _stricmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); - int __cdecl strcoll(const char *_Str1,const char *_Str2); - _CRTIMP int __cdecl _strcoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _stricoll(const char *_Str1,const char *_Str2); - _CRTIMP int __cdecl _stricoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _strncoll (const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _strncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _strnicoll (const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _strnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - size_t __cdecl strcspn(const char *_Str,const char *_Control); - _CRTIMP char *__cdecl _strerror(const char *_ErrMsg); - char *__cdecl strerror(int); - _CRTIMP char *__cdecl _strlwr(char *_String); - char *strlwr_l(char *_String,_locale_t _Locale); - char *__cdecl strncat(char *_Dest,const char *_Source,size_t _Count); - int __cdecl strncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _strnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _strnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - char *strncpy(char *_Dest,const char *_Source,size_t _Count); - _CRTIMP char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount); - _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control); - _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch); - _CRTIMP char *__cdecl _strrev(char *_Str); - size_t __cdecl strspn(const char *_Str,const char *_Control); - _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr); - char *__cdecl strtok(char *_Str,const char *_Delim); - _CRTIMP char *__cdecl _strupr(char *_String); - _CRTIMP char *_strupr_l(char *_String,_locale_t _Locale); - size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount); - _CRTIMP size_t __cdecl _strxfrm_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); - -#ifndef NO_OLDNAMES - char *__cdecl strdup(const char *_Src); - int __cdecl strcmpi(const char *_Str1,const char *_Str2); - int __cdecl stricmp(const char *_Str1,const char *_Str2); - char *__cdecl strlwr(char *_Str); - int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount); - __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); } - __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); } - char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount); - char *__cdecl strrev(char *_Str); - char *__cdecl strset(char *_Str,int _Val); - char *__cdecl strupr(char *_Str); -#endif - -#ifndef _WSTRING_DEFINED -#define _WSTRING_DEFINED - - _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); - wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); - _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); - int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); - wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); - size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); - size_t __cdecl wcslen(const wchar_t *_Str); - size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); - wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); - int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); - _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); - _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); - size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); - _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); - wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); - _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); - _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); - _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); - _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); - _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); - _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); - _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); - _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); - _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); - size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); - _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); - int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); - _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); - _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); - -#ifndef NO_OLDNAMES - wchar_t *__cdecl wcsdup(const wchar_t *_Str); -#define wcswcs wcsstr - int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); - int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); - wchar_t *__cdecl wcsrev(wchar_t *_Str); - wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); - wchar_t *__cdecl wcslwr(wchar_t *_Str); - wchar_t *__cdecl wcsupr(wchar_t *_Str); - int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/win32/include/sys/fcntl.h b/win32/include/sys/fcntl.h deleted file mode 100644 index 29fd55a1..00000000 --- a/win32/include/sys/fcntl.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* - * This file is part of the Mingw32 package. - * - * This fcntl.h maps to the root fcntl.h - */ -#ifndef __STRICT_ANSI__ -#include -#endif diff --git a/win32/include/sys/file.h b/win32/include/sys/file.h deleted file mode 100644 index 370f352d..00000000 --- a/win32/include/sys/file.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* - * This file is part of the Mingw32 package. - * - * This file.h maps to the root fcntl.h - * TODO? - */ -#ifndef __STRICT_ANSI__ -#include -#endif diff --git a/win32/include/sys/locking.h b/win32/include/sys/locking.h deleted file mode 100644 index e3fc85b3..00000000 --- a/win32/include/sys/locking.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_LOCKING -#define _INC_LOCKING - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -/* All the headers include this file. */ -#include <_mingw.h> - -#define _LK_UNLCK 0 -#define _LK_LOCK 1 -#define _LK_NBLCK 2 -#define _LK_RLCK 3 -#define _LK_NBRLCK 4 - -#ifndef NO_OLDNAMES -#define LK_UNLCK _LK_UNLCK -#define LK_LOCK _LK_LOCK -#define LK_NBLCK _LK_NBLCK -#define LK_RLCK _LK_RLCK -#define LK_NBRLCK _LK_NBRLCK -#endif - -#endif diff --git a/win32/include/sys/stat.h b/win32/include/sys/stat.h deleted file mode 100644 index 4a95e659..00000000 --- a/win32/include/sys/stat.h +++ /dev/null @@ -1,290 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_STAT -#define _INC_STAT - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#include <_mingw.h> -#include - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _CRTIMP -#define _CRTIMP __declspec(dllimport) -#endif - -#include - -#ifndef __TINYC__ /* gr */ -#ifdef _USE_32BIT_TIME_T -#ifdef _WIN64 -#undef _USE_32BIT_TIME_T -#endif -#else -#if _INTEGRAL_MAX_BITS < 64 -#define _USE_32BIT_TIME_T -#endif -#endif -#endif - -#ifndef _TIME32_T_DEFINED - typedef long __time32_t; -#define _TIME32_T_DEFINED -#endif - -#ifndef _TIME64_T_DEFINED -#if _INTEGRAL_MAX_BITS >= 64 - typedef __int64 __time64_t; -#endif -#define _TIME64_T_DEFINED -#endif - -#ifndef _TIME_T_DEFINED -#ifdef _USE_32BIT_TIME_T - typedef __time32_t time_t; -#else - typedef __time64_t time_t; -#endif -#define _TIME_T_DEFINED -#endif - -#ifndef _WCHAR_T_DEFINED - typedef unsigned short wchar_t; -#define _WCHAR_T_DEFINED -#endif - -#ifndef _STAT_DEFINED - -#ifdef _USE_32BIT_TIME_T -#ifndef _WIN64 -#define _fstat32 _fstat -#define _stat32 _stat -#define _wstat32 _wstat -#else -#define _fstat _fstat32 -#define _stat _stat32 -#define _wstat _wstat32 -#endif -#define _fstati64 _fstat32i64 -#define _stati64 _stat32i64 -#define _wstati64 _wstat32i64 -#else -#define _fstat _fstat64i32 -#define _fstati64 _fstat64 -#define _stat _stat64 -#define _stati64 _stat64 -#define _wstat _wstat64 -#define _wstati64 _wstat64 -#endif - - struct _stat32 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - __time32_t st_atime; - __time32_t st_mtime; - __time32_t st_ctime; - }; - -#ifndef NO_OLDNAMES - struct stat { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; - }; -#endif - -#if _INTEGRAL_MAX_BITS >= 64 - struct _stat32i64 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - __time32_t st_atime; - __time32_t st_mtime; - __time32_t st_ctime; - }; - - struct _stat64i32 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - __time64_t st_atime; - __time64_t st_mtime; - __time64_t st_ctime; - }; - - struct _stat64 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - __time64_t st_atime; - __time64_t st_mtime; - __time64_t st_ctime; - }; -#endif - -#define __stat64 _stat64 - -#define _STAT_DEFINED -#endif - -#define _S_IFMT 0xF000 -#define _S_IFDIR 0x4000 -#define _S_IFCHR 0x2000 -#define _S_IFIFO 0x1000 -#define _S_IFREG 0x8000 -#define _S_IREAD 0x0100 -#define _S_IWRITE 0x0080 -#define _S_IEXEC 0x0040 - - _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat); - _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat); - _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat); - int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat); - __CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat) - { - struct _stat64 st; - int ret=_fstat64(_FileDes,&st); - _Stat->st_dev=st.st_dev; - _Stat->st_ino=st.st_ino; - _Stat->st_mode=st.st_mode; - _Stat->st_nlink=st.st_nlink; - _Stat->st_uid=st.st_uid; - _Stat->st_gid=st.st_gid; - _Stat->st_rdev=st.st_rdev; - _Stat->st_size=(_off_t) st.st_size; - _Stat->st_atime=st.st_atime; - _Stat->st_mtime=st.st_mtime; - _Stat->st_ctime=st.st_ctime; - return ret; - } - _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat); - _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat); - int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat); - __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat) - { - struct _stat64 st; - int ret=_stat64(_Name,&st); - _Stat->st_dev=st.st_dev; - _Stat->st_ino=st.st_ino; - _Stat->st_mode=st.st_mode; - _Stat->st_nlink=st.st_nlink; - _Stat->st_uid=st.st_uid; - _Stat->st_gid=st.st_gid; - _Stat->st_rdev=st.st_rdev; - _Stat->st_size=(_off_t) st.st_size; - _Stat->st_atime=st.st_atime; - _Stat->st_mtime=st.st_mtime; - _Stat->st_ctime=st.st_ctime; - return ret; - } -#endif - -#ifndef _WSTAT_DEFINED -#define _WSTAT_DEFINED - _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); - int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); - _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); -#endif -#endif - -#ifndef NO_OLDNAMES -#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ - -#define S_IFMT _S_IFMT -#define S_IFDIR _S_IFDIR -#define S_IFCHR _S_IFCHR -#define S_IFREG _S_IFREG -#define S_IREAD _S_IREAD -#define S_IWRITE _S_IWRITE -#define S_IEXEC _S_IEXEC -#define S_IFIFO _S_IFIFO -#define S_IFBLK _S_IFBLK - -#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) -#define _S_IXUSR _S_IEXEC -#define _S_IWUSR _S_IWRITE - -#define S_IRWXU _S_IRWXU -#define S_IXUSR _S_IXUSR -#define S_IWUSR _S_IWUSR -#define S_IRUSR _S_IRUSR -#define _S_IRUSR _S_IREAD - -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) - -#endif - -#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) -int __cdecl stat(const char *_Filename,struct stat *_Stat); -int __cdecl fstat(int _Desc,struct stat *_Stat); -int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat); -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { - return _fstat32(_Desc,(struct _stat32 *)_Stat); -} -__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { - return _stat32(_Filename,(struct _stat32 *)_Stat); -} -#else -__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { - return _fstat64i32(_Desc,(struct _stat64i32 *)_Stat); -} -__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { - return _stat64i32(_Filename,(struct _stat64i32 *)_Stat); -} -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/sys/time.h b/win32/include/sys/time.h deleted file mode 100644 index 8ccab831..00000000 --- a/win32/include/sys/time.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -#ifndef _SYS_TIME_H_ -#define _SYS_TIME_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __STRICT_ANSI__ -#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ -#define _TIMEVAL_DEFINED -struct timeval { - long tv_sec; - long tv_usec; -}; -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timercmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec != (uvp)->tv_sec) ? \ - ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ - ((tvp)->tv_usec cmp (uvp)->tv_usec)) -#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 -#endif /* _TIMEVAL_DEFINED */ - -#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ -#define _TIMEZONE_DEFINED -/* Provided for compatibility with code that assumes that - the presence of gettimeofday function implies a definition - of struct timezone. */ -struct timezone -{ - int tz_minuteswest; /* of Greenwich */ - int tz_dsttime; /* type of dst correction to apply */ -}; - - extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); - -#endif - -/* - Implementation as per: - The Open Group Base Specifications, Issue 6 - IEEE Std 1003.1, 2004 Edition - - The timezone pointer arg is ignored. Errors are ignored. -*/ -#ifndef _GETTIMEOFDAY_DEFINED -#define _GETTIMEOFDAY_DEFINED -int __cdecl gettimeofday(struct timeval *__restrict__, - void *__restrict__ /* tzp (unused) */); -#endif - -#endif /* __STRICT_ANSI__ */ - -#ifdef __cplusplus -} -#endif - -/* Adding timespec definition. */ -#include - - -#endif /* _SYS_TIME_H_ */ diff --git a/win32/include/sys/timeb.h b/win32/include/sys/timeb.h deleted file mode 100644 index 34837738..00000000 --- a/win32/include/sys/timeb.h +++ /dev/null @@ -1,133 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _TIMEB_H_ -#define _TIMEB_H_ - -#include <_mingw.h> - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _CRTIMP -#define _CRTIMP __declspec(dllimport) -#endif - -#ifndef __TINYC__ /* gr */ -#ifdef _USE_32BIT_TIME_T -#ifdef _WIN64 -#undef _USE_32BIT_TIME_T -#endif -#else -#if _INTEGRAL_MAX_BITS < 64 -#define _USE_32BIT_TIME_T -#endif -#endif -#endif - -#ifndef _TIME32_T_DEFINED - typedef long __time32_t; -#define _TIME32_T_DEFINED -#endif - -#ifndef _TIME64_T_DEFINED -#if _INTEGRAL_MAX_BITS >= 64 - typedef __int64 __time64_t; -#endif -#define _TIME64_T_DEFINED -#endif - -#ifndef _TIME_T_DEFINED -#ifdef _USE_32BIT_TIME_T - typedef __time32_t time_t; -#else - typedef __time64_t time_t; -#endif -#define _TIME_T_DEFINED -#endif - -#ifndef _TIMEB_DEFINED -#define _TIMEB_DEFINED - - struct __timeb32 { - __time32_t time; - unsigned short millitm; - short timezone; - short dstflag; - }; - -#ifndef NO_OLDNAMES - struct timeb { - time_t time; - unsigned short millitm; - short timezone; - short dstflag; - }; -#endif - -#if _INTEGRAL_MAX_BITS >= 64 - struct __timeb64 { - __time64_t time; - unsigned short millitm; - short timezone; - short dstflag; - }; -#endif - -#ifdef _USE_32BIT_TIME_T -#define _timeb __timeb32 -//gr #define _ftime _ftime32 -#define _ftime32 _ftime -#else -#define _timeb __timeb64 -#define _ftime _ftime64 -#endif -#endif - - _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time); -#endif - -#ifndef _TIMESPEC_DEFINED -#define _TIMESPEC_DEFINED -struct timespec { - time_t tv_sec; /* Seconds */ - long tv_nsec; /* Nanoseconds */ -}; - -struct itimerspec { - struct timespec it_interval; /* Timer period */ - struct timespec it_value; /* Timer expiration */ -}; -#endif - -#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { - _ftime32((struct __timeb32 *)_Tmb); -} -#else -__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { - _ftime64((struct __timeb64 *)_Tmb); -} -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) - -#include -#endif diff --git a/win32/include/sys/types.h b/win32/include/sys/types.h deleted file mode 100644 index 144fb107..00000000 --- a/win32/include/sys/types.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_TYPES -#define _INC_TYPES - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#include <_mingw.h> - -#ifndef __TINYC__ /* gr */ -#ifdef _USE_32BIT_TIME_T -#ifdef _WIN64 -#undef _USE_32BIT_TIME_T -#endif -#else -#if _INTEGRAL_MAX_BITS < 64 -#define _USE_32BIT_TIME_T -#endif -#endif -#endif - -#ifndef _TIME32_T_DEFINED -#define _TIME32_T_DEFINED -typedef long __time32_t; -#endif - -#ifndef _TIME64_T_DEFINED -#define _TIME64_T_DEFINED -#if _INTEGRAL_MAX_BITS >= 64 -typedef __int64 __time64_t; -#endif -#endif - -#ifndef _TIME_T_DEFINED -#define _TIME_T_DEFINED -#ifdef _USE_32BIT_TIME_T -typedef __time32_t time_t; -#else -typedef __time64_t time_t; -#endif -#endif - -#ifndef _INO_T_DEFINED -#define _INO_T_DEFINED -typedef unsigned short _ino_t; -#ifndef NO_OLDNAMES -typedef unsigned short ino_t; -#endif -#endif - -#ifndef _DEV_T_DEFINED -#define _DEV_T_DEFINED -typedef unsigned int _dev_t; -#ifndef NO_OLDNAMES -typedef unsigned int dev_t; -#endif -#endif - -#ifndef _PID_T_ -#define _PID_T_ -#ifndef _WIN64 -typedef int _pid_t; -#else -typedef __int64 _pid_t; -#endif - -#ifndef NO_OLDNAMES -typedef _pid_t pid_t; -#endif -#endif /* Not _PID_T_ */ - -#ifndef _MODE_T_ -#define _MODE_T_ -typedef unsigned short _mode_t; - -#ifndef NO_OLDNAMES -typedef _mode_t mode_t; -#endif -#endif /* Not _MODE_T_ */ - -#ifndef _OFF_T_DEFINED -#define _OFF_T_DEFINED -#ifndef _OFF_T_ -#define _OFF_T_ - typedef long _off_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long off_t; -#endif -#endif -#endif - -#ifndef _OFF64_T_DEFINED -#define _OFF64_T_DEFINED - typedef long long _off64_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long long off64_t; -#endif -#endif - -/* required by (unbundled) unistd.h for usleep arg type */ -#ifndef __NO_ISOCEXT -typedef unsigned int useconds_t; -#endif - -#ifndef _TIMESPEC_DEFINED -#define _TIMESPEC_DEFINED -struct timespec { - time_t tv_sec; /* Seconds */ - long tv_nsec; /* Nanoseconds */ -}; - -struct itimerspec { - struct timespec it_interval; /* Timer period */ - struct timespec it_value; /* Timer expiration */ -}; -#endif - -#endif diff --git a/win32/include/sys/unistd.h b/win32/include/sys/unistd.h deleted file mode 100644 index 31006d32..00000000 --- a/win32/include/sys/unistd.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -/* - * This file is part of the Mingw32 package. - * - * unistd.h maps (roughly) to io.h - */ -#ifndef __STRICT_ANSI__ -#include -#endif - diff --git a/win32/include/sys/utime.h b/win32/include/sys/utime.h deleted file mode 100644 index fec8304f..00000000 --- a/win32/include/sys/utime.h +++ /dev/null @@ -1,146 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_UTIME -#define _INC_UTIME - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _CRTIMP -#define _CRTIMP __declspec(dllimport) -#endif - -#ifndef _WCHAR_T_DEFINED - typedef unsigned short wchar_t; -#define _WCHAR_T_DEFINED -#endif - -#ifndef __TINYC__ /* gr */ -#ifdef _USE_32BIT_TIME_T -#ifdef _WIN64 -#undef _USE_32BIT_TIME_T -#endif -#else -#if _INTEGRAL_MAX_BITS < 64 -#define _USE_32BIT_TIME_T -#endif -#endif -#endif - -#ifndef _TIME32_T_DEFINED -#define _TIME32_T_DEFINED - typedef long __time32_t; -#endif - -#ifndef _TIME64_T_DEFINED -#define _TIME64_T_DEFINED -#if _INTEGRAL_MAX_BITS >= 64 - typedef __int64 __time64_t; -#endif -#endif - -#ifndef _TIME_T_DEFINED -#define _TIME_T_DEFINED -#ifdef _USE_32BIT_TIME_T - typedef __time32_t time_t; -#else - typedef __time64_t time_t; -#endif -#endif - -#ifndef _UTIMBUF_DEFINED -#define _UTIMBUF_DEFINED - - struct _utimbuf { - time_t actime; - time_t modtime; - }; - - struct __utimbuf32 { - __time32_t actime; - __time32_t modtime; - }; - -#if _INTEGRAL_MAX_BITS >= 64 - struct __utimbuf64 { - __time64_t actime; - __time64_t modtime; - }; -#endif - -#ifndef NO_OLDNAMES - struct utimbuf { - time_t actime; - time_t modtime; - }; - - struct utimbuf32 { - __time32_t actime; - __time32_t modtime; - }; -#endif -#endif - - _CRTIMP int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Time); - _CRTIMP int __cdecl _futime32(int _FileDes,struct __utimbuf32 *_Time); - _CRTIMP int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Time); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP int __cdecl _utime64(const char *_Filename,struct __utimbuf64 *_Time); - _CRTIMP int __cdecl _futime64(int _FileDes,struct __utimbuf64 *_Time); - _CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time); -#endif - -#ifndef RC_INVOKED -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { - return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { - return _futime32(_Desc,(struct __utimbuf32 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { - return _wutime32(_Filename,(struct __utimbuf32 *)_Utimbuf); -} -#else -__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { - return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { - return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); -} -__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { - return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); -} -#endif - -#ifndef NO_OLDNAMES -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { - return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); -} -#else -__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { - return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); -} -#endif -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/tcc/tcc_libm.h b/win32/include/tcc/tcc_libm.h deleted file mode 100644 index ba26ee00..00000000 --- a/win32/include/tcc/tcc_libm.h +++ /dev/null @@ -1,618 +0,0 @@ -#ifndef _TCC_LIBM_H_ -#define _TCC_LIBM_H_ - -#include "../math.h" -#include "../stdint.h" - -/* TCC uses 8 bytes for double and long double, so effectively the l variants - * are never used. For now, they just run the normal (double) variant. - */ - -/* - * most of the code in this file is taken from MUSL rs-1.0 (MIT license) - * - musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0 - * - License: http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0 - */ - -/******************************************************************************* - Start of code based on MUSL -*******************************************************************************/ -/* -musl as a whole is licensed under the following standard MIT license: - ----------------------------------------------------------------------- -Copyright © 2005-2014 Rich Felker, et al. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- -*/ - -/* fpclassify */ - -__CRT_INLINE int __cdecl __fpclassify (double x) { - union {double f; uint64_t i;} u = {.f = x}; - int e = u.i>>52 & 0x7ff; - if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; - if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; - return FP_NORMAL; -} - -__CRT_INLINE int __cdecl __fpclassifyf (float x) { - union {float f; uint32_t i;} u = {.f = x}; - int e = u.i>>23 & 0xff; - if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; - if (e==0xff) return u.i<<9 ? FP_NAN : FP_INFINITE; - return FP_NORMAL; -} - -__CRT_INLINE int __cdecl __fpclassifyl (long double x) { - return __fpclassify(x); -} - - -/* signbit */ - -__CRT_INLINE int __cdecl __signbit (double x) { - union {double f; uint64_t i;} u = {.f = x}; - return u.i>>63; -} - -__CRT_INLINE int __cdecl __signbitf (float x) { - union {float f; uint32_t i; } u = {.f = x}; - return u.i>>31; -} - -__CRT_INLINE int __cdecl __signbitl (long double x) { - return __signbit(x); -} - - -/* fmin*, fmax* */ - -#define TCCFP_FMIN_EVAL (isnan(x) ? y : \ - isnan(y) ? x : \ - (signbit(x) != signbit(y)) ? (signbit(x) ? x : y) : \ - x < y ? x : y) - -__CRT_INLINE double __cdecl fmin (double x, double y) { - return TCCFP_FMIN_EVAL; -} - -__CRT_INLINE float __cdecl fminf (float x, float y) { - return TCCFP_FMIN_EVAL; -} - -__CRT_INLINE long double __cdecl fminl (long double x, long double y) { - return TCCFP_FMIN_EVAL; -} - -#define TCCFP_FMAX_EVAL (isnan(x) ? y : \ - isnan(y) ? x : \ - (signbit(x) != signbit(y)) ? (signbit(x) ? y : x) : \ - x < y ? y : x) - -__CRT_INLINE double __cdecl fmax (double x, double y) { - return TCCFP_FMAX_EVAL; -} - -__CRT_INLINE float __cdecl fmaxf (float x, float y) { - return TCCFP_FMAX_EVAL; -} - -__CRT_INLINE long double __cdecl fmaxl (long double x, long double y) { - return TCCFP_FMAX_EVAL; -} - - -/* *round* */ - -#define TCCFP_FORCE_EVAL(x) do { \ - volatile typeof(x) __x; \ - __x = (x); \ -} while(0) - -__CRT_INLINE double __cdecl round (double x) { - union {double f; uint64_t i;} u = {.f = x}; - int e = u.i >> 52 & 0x7ff; - double y; - - if (e >= 0x3ff+52) - return x; - if (u.i >> 63) - x = -x; - if (e < 0x3ff-1) { - /* raise inexact if x!=0 */ - TCCFP_FORCE_EVAL(x + 0x1p52); - return 0*u.f; - } - y = (double)(x + 0x1p52) - 0x1p52 - x; - y = y + x - (y > 0.5) + (y <= -0.5); /* branchless */ - return (u.i >> 63) ? -y : y; -} - -__CRT_INLINE long __cdecl lround (double x) { - return round(x); -} - -__CRT_INLINE long long __cdecl llround (double x) { - return round(x); -} - -__CRT_INLINE float __cdecl roundf (float x) { - return round(x); -} - -__CRT_INLINE long __cdecl lroundf (float x) { - return round(x); -} - -__CRT_INLINE long long __cdecl llroundf (float x) { - return round(x); -} - -__CRT_INLINE long double __cdecl roundl (long double x) { - return round(x); -} - -__CRT_INLINE long __cdecl lroundl (long double x) { - return round(x); -} - -__CRT_INLINE long long __cdecl llroundl (long double x) { - return round(x); -} - - -/* MUSL asinh, acosh, atanh */ - -__CRT_INLINE double __cdecl asinh(double x) { - union {double f; uint64_t i;} u = {.f = x}; - unsigned e = u.i >> 52 & 0x7ff, s = u.i >> 63; - u.i &= -1ull / 2, x = u.f; - if (e >= 0x3ff + 26) x = log(x) + 0.693147180559945309; - else if (e >= 0x3ff + 1) x = log(2*x + 1 / (sqrt(x*x + 1) + x)); /* |x|>=2 */ - else if (e >= 0x3ff - 26) x = log1p(x + x*x / (sqrt(x*x + 1) + 1)); - else TCCFP_FORCE_EVAL(x + 0x1p120f); - return s ? -x : x; -} - -__CRT_INLINE double __cdecl acosh(double x) { - union {double f; uint64_t i;} u = {.f = x}; - unsigned e = u.i >> 52 & 0x7ff; - if (e < 0x3ff + 1) return --x, log1p(x + sqrt(x*x + 2*x)); /* |x|<2 */ - if (e < 0x3ff + 26) return log(2*x - 1 / (x + sqrt(x*x - 1))); - return log(x) + 0.693147180559945309; -} - -__CRT_INLINE double __cdecl atanh(double x) { - union {double f; uint64_t i;} u = {.f = x}; - unsigned e = u.i >> 52 & 0x7ff, s = u.i >> 63; - u.i &= -1ull / 2, x = u.f; - if (e < 0x3ff - 1) { - if (e < 0x3ff - 32) { if (e == 0) TCCFP_FORCE_EVAL((float)x); } - else x = 0.5 * log1p(2*x + 2*x*x / (1 - x)); /* |x| < 0.5 */ - } else x = 0.5 * log1p(2*(x / (1 - x))); /* avoid overflow */ - return s ? -x : x; -} - -/* MUSL scalbn */ - -__CRT_INLINE double __cdecl scalbn(double x, int n) { - union {double f; uint64_t i;} u; - if (n > 1023) { - x *= 0x1p1023, n -= 1023; - if (n > 1023) { - x *= 0x1p1023, n -= 1023; - if (n > 1023) n = 1023; - } - } else if (n < -1022) { - x *= 0x1p-1022 * 0x1p53, n += 1022 - 53; - if (n < -1022) { - x *= 0x1p-1022 * 0x1p53, n += 1022 - 53; - if (n < -1022) n = -1022; - } - } - u.i = (0x3ffull + n) << 52; - return x * u.f; -} - -/* MUSL: Override msvcrt frexp(): 4.5x speedup! */ - -__CRT_INLINE double __cdecl frexp(double x, int *e) { - union {double f; uint64_t i;} u = {.f = x}; - int ee = u.i>>52 & 0x7ff; - if (!ee) { - if (x) x = frexp(x*0x1p64, e), *e -= 64; - else *e = 0; - return x; - } else if (ee == 0x7ff) - return x; - *e = ee - 0x3fe; - u.i &= 0x800fffffffffffffull; - u.i |= 0x3fe0000000000000ull; - return u.f; -} - -/* MUSL nan */ - -__CRT_INLINE double __cdecl nan(const char* s) { - return NAN; -} -__CRT_INLINE float __cdecl nanf(const char* s) { - return NAN; -} -__CRT_INLINE long double __cdecl nanl(const char* s) { - return NAN; -} - - -/******************************************************************************* - End of code based on MUSL -*******************************************************************************/ - - -/* Following are math functions missing from msvcrt.dll, and not defined - * in math.h or above. Functions still remaining: - * remquo(), remainder(), fma(), erf(), erfc(), nearbyint(). - * In : lldiv(). - */ - -__CRT_INLINE float __cdecl scalbnf(float x, int n) { - return scalbn(x, n); -} -__CRT_INLINE long double __cdecl scalbnl(long double x, int n) { - return scalbn(x, n); -} - -__CRT_INLINE double __cdecl scalbln(double x, long n) { - return scalbn(x, n); -} -__CRT_INLINE float __cdecl scalblnf(float x, long n) { - return scalbn(x, n); -} -__CRT_INLINE long double __cdecl scalblnl(long double x, long n) { - return scalbn(x, n); -} - -/* Override msvcrt ldexp(): 7.3x speedup! */ - -__CRT_INLINE double __cdecl ldexp(double x, int expn) { - return scalbn(x, expn); -} -__CRT_INLINE float __cdecl ldexpf(float x, int expn) { - return scalbn(x, expn); -} -__CRT_INLINE long double __cdecl ldexpl(long double x, int expn) { - return scalbn(x, expn); -} - -__CRT_INLINE float __cdecl frexpf(float x, int *y) { - return frexp(x, y); -} -__CRT_INLINE long double __cdecl frexpl (long double x, int* y) { - return frexp(x, y); -} - - -__CRT_INLINE double __cdecl rint(double x) { -double retval; - __asm__ ( - "fldl %1\n" - "frndint \n" - "fstpl %0\n" : "=m" (retval) : "m" (x)); - return retval; -} - -__CRT_INLINE float __cdecl rintf(float x) { - float retval; - __asm__ ( - "flds %1\n" - "frndint \n" - "fstps %0\n" : "=m" (retval) : "m" (x)); - return retval; -} -__CRT_INLINE long double __cdecl rintl (long double x) { - return rint(x); -} - - -/* 7.12.9.5 */ -__CRT_INLINE long __cdecl lrint(double x) { - long retval; - __asm__ __volatile__ - ("fldl %1\n" - "fistpl %0" : "=m" (retval) : "m" (x)); - return retval; -} - -__CRT_INLINE long __cdecl lrintf(float x) { - long retval; - __asm__ __volatile__ - ("flds %1\n" - "fistpl %0" : "=m" (retval) : "m" (x)); - return retval; -} - -__CRT_INLINE long __cdecl lrintl (long double x) { - return lrint(x); -} - - -__CRT_INLINE long long __cdecl llrint(double x) { -long long retval; - __asm__ __volatile__ - ("fldl %1\n" - "fistpll %0" : "=m" (retval) : "m" (x)); - return retval; -} - -__CRT_INLINE long long __cdecl llrintf(float x) { - long long retval; - __asm__ __volatile__ - ("flds %1\n" - "fistpll %0" : "=m" (retval) : "m" (x)); - return retval; -} - -__CRT_INLINE long long __cdecl llrintl (long double x) { - return llrint(x); -} - - -__CRT_INLINE double __cdecl trunc(double _x) { - double retval; - unsigned short saved_cw; - unsigned short tmp_cw; - __asm__ ("fnstcw %0;" : "=m" (saved_cw)); /* save FPU control word */ - tmp_cw = (saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO)) - | FE_TOWARDZERO; - __asm__ ("fldcw %0;" : : "m" (tmp_cw)); - __asm__ ("fldl %1;" - "frndint;" - "fstpl %0;" : "=m" (retval) : "m" (_x)); /* round towards zero */ - __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */ - return retval; -} - -__CRT_INLINE float __cdecl truncf(float x) { - return (float) ((intptr_t) x); -} -__CRT_INLINE long double __cdecl truncl(long double x) { - return trunc(x); -} - - -__CRT_INLINE long double __cdecl nextafterl(long double x, long double to) { - return nextafter(x, to); -} - -__CRT_INLINE double __cdecl nexttoward(double x, long double to) { - return nextafter(x, to); -} -__CRT_INLINE float __cdecl nexttowardf(float x, long double to) { - return nextafterf(x, to); -} -__CRT_INLINE long double __cdecl nexttowardl(long double x, long double to) { - return nextafter(x, to); -} - -/* Override msvcrt fabs(): 6.3x speedup! */ - -__CRT_INLINE double __cdecl fabs(double x) { - return x < 0 ? -x : x; -} -__CRT_INLINE float __cdecl fabsf(float x) { - return x < 0 ? -x : x; -} -__CRT_INLINE long double __cdecl fabsl(long double x) { - return x < 0 ? -x : x; -} - - -#if defined(_WIN32) && !defined(_WIN64) && !defined(__ia64__) - __CRT_INLINE float acosf(float x) { return acos(x); } - __CRT_INLINE float asinf(float x) { return asin(x); } - __CRT_INLINE float atanf(float x) { return atan(x); } - __CRT_INLINE float atan2f(float x, float y) { return atan2(x, y); } - __CRT_INLINE float ceilf(float x) { return ceil(x); } - __CRT_INLINE float cosf(float x) { return cos(x); } - __CRT_INLINE float coshf(float x) { return cosh(x); } - __CRT_INLINE float expf(float x) { return exp(x); } - __CRT_INLINE float floorf(float x) { return floor(x); } - __CRT_INLINE float fmodf(float x, float y) { return fmod(x, y); } - __CRT_INLINE float logf(float x) { return log(x); } - __CRT_INLINE float logbf(float x) { return logb(x); } - __CRT_INLINE float log10f(float x) { return log10(x); } - __CRT_INLINE float modff(float x, float *y) { double di, df = modf(x, &di); *y = di; return df; } - __CRT_INLINE float powf(float x, float y) { return pow(x, y); } - __CRT_INLINE float sinf(float x) { return sin(x); } - __CRT_INLINE float sinhf(float x) { return sinh(x); } - __CRT_INLINE float sqrtf(float x) { return sqrt(x); } - __CRT_INLINE float tanf(float x) { return tan(x); } - __CRT_INLINE float tanhf(float x) { return tanh(x); } -#endif -__CRT_INLINE float __cdecl asinhf(float x) { return asinh(x); } -__CRT_INLINE float __cdecl acoshf(float x) { return acosh(x); } -__CRT_INLINE float __cdecl atanhf(float x) { return atanh(x); } - -__CRT_INLINE long double __cdecl asinhl(long double x) { return asinh(x); } -__CRT_INLINE long double __cdecl acoshl(long double x) { return acosh(x); } -__CRT_INLINE long double __cdecl atanhl(long double x) { return atanh(x); } -__CRT_INLINE long double __cdecl asinl(long double x) { return asin(x); } -__CRT_INLINE long double __cdecl acosl(long double x) { return acos(x); } -__CRT_INLINE long double __cdecl atanl(long double x) { return atan(x); } -__CRT_INLINE long double __cdecl ceill(long double x) { return ceil(x); } -__CRT_INLINE long double __cdecl coshl(long double x) { return cosh(x); } -__CRT_INLINE long double __cdecl cosl(long double x) { return cos(x); } -__CRT_INLINE long double __cdecl expl(long double x) { return exp(x); } -__CRT_INLINE long double __cdecl floorl(long double x) { return floor(x); } -__CRT_INLINE long double __cdecl fmodl(long double x, long double y) { return fmod(x, y); } -__CRT_INLINE long double __cdecl hypotl(long double x, long double y) { return hypot(x, y); } -__CRT_INLINE long double __cdecl logl(long double x) { return log(x); } -__CRT_INLINE long double __cdecl logbl(long double x) { return logb(x); } -__CRT_INLINE long double __cdecl log10l(long double x) { return log10(x); } -__CRT_INLINE long double __cdecl modfl(long double x, long double* y) { double y1 = *y; x = modf(x, &y1); *y = y1; return x; } -__CRT_INLINE long double __cdecl powl(long double x, long double y) { return pow(x, y); } -__CRT_INLINE long double __cdecl sinhl(long double x) { return sinh(x); } -__CRT_INLINE long double __cdecl sinl(long double x) { return sin(x); } -__CRT_INLINE long double __cdecl sqrtl(long double x) { return sqrt(x); } -__CRT_INLINE long double __cdecl tanhl(long double x) { return tanh(x); } -__CRT_INLINE long double __cdecl tanl(long double x) { return tan(x); } - -/* Following are accurate, but much shorter implementations than MUSL lib. */ - -__CRT_INLINE double __cdecl log1p(double x) { - double u = 1.0 + x; - return u == 1.0 ? x : log(u)*(x / (u - 1.0)); -} -__CRT_INLINE float __cdecl log1pf(float x) { - float u = 1.0f + x; - return u == 1.0f ? x : logf(u)*(x / (u - 1.0f)); -} -__CRT_INLINE long double __cdecl log1pl(long double x) { - return log1p(x); -} - - -__CRT_INLINE double __cdecl expm1(double x) { - if (x > 0.0024 || x < -0.0024) return exp(x) - 1.0; - return x*(1.0 + 0.5*x*(1.0 + (1/3.0)*x*(1.0 + 0.25*x*(1.0 + 0.2*x)))); -} -__CRT_INLINE float __cdecl expm1f(float x) { - if (x > 0.085f || x < -0.085f) return expf(x) - 1.0f; - return x*(1.0f + 0.5f*x*(1.0f + (1/3.0f)*x*(1.0f + 0.25f*x))); -} -__CRT_INLINE long double __cdecl expm1l(long double x) { - return expm1(x); -} - - -__CRT_INLINE double __cdecl cbrt(double x) { - return x < 0.0 ? -pow(-x, 1/3.0) : pow(x, 1/3.0); -} -__CRT_INLINE float __cdecl cbrtf(float x) { - return x < 0.0f ? -pow(-x, 1/3.0) : pow(x, 1/3.0); -} -__CRT_INLINE long double __cdecl cbrtl(long double x) { - return cbrt(x); -} - - -__CRT_INLINE double __cdecl log2(double x) { - return log(x) * 1.442695040888963407; -} -__CRT_INLINE float __cdecl log2f(float x) { - return log(x) * 1.442695040888963407; -} -__CRT_INLINE long double __cdecl log2l(long double x) { - return log(x) * 1.442695040888963407; -} - - -__CRT_INLINE double __cdecl exp2(double x) { - return exp(x * 0.693147180559945309); -} -__CRT_INLINE float __cdecl exp2f(float x) { - return exp(x * 0.693147180559945309); -} -__CRT_INLINE long double __cdecl exp2l(long double x) { - return exp(x * 0.693147180559945309); -} - - -__CRT_INLINE int __cdecl ilogb(double x) { - return (int) logb(x); -} -__CRT_INLINE int __cdecl ilogbf(float x) { - return (int) logbf(x); -} -__CRT_INLINE int __cdecl ilogbl(long double x) { - return (int) logb(x); -} - - -__CRT_INLINE double __cdecl fdim(double x, double y) { - if (isnan(x) || isnan(y)) return NAN; - return x > y ? x - y : 0; -} -__CRT_INLINE float __cdecl fdimf(float x, float y) { - if (isnan(x) || isnan(y)) return NAN; - return x > y ? x - y : 0; -} -__CRT_INLINE long double __cdecl fdiml(long double x, long double y) { - if (isnan(x) || isnan(y)) return NAN; - return x > y ? x - y : 0; -} - - -/* tgamma and lgamma: Lanczos approximation - * https://rosettacode.org/wiki/Gamma_function - * https://www.johndcook.com/blog/cpp_gamma - */ - -__CRT_INLINE double __cdecl tgamma(double x) { - double m = 1.0, t = 3.14159265358979323; - if (x == floor(x)) { - if (x == 0) return INFINITY; - if (x < 0) return NAN; - if (x < 26) { for (double k = 2; k < x; ++k) m *= k; return m; } - } - if (x < 0.5) - return t / (sin(t*x)*tgamma(1.0 - x)); - if (x > 12.0) - return exp(lgamma(x)); - - static const double c[8] = {676.5203681218851, -1259.1392167224028, - 771.32342877765313, -176.61502916214059, - 12.507343278686905, -0.13857109526572012, - 9.9843695780195716e-6, 1.5056327351493116e-7}; - m = 0.99999999999980993, t = x + 6.5; /* x-1+8-.5 */ - for (int k = 0; k < 8; ++k) m += c[k] / (x + k); - return 2.50662827463100050 * pow(t, x - 0.5)*exp(-t)*m; /* C=sqrt(2pi) */ -} - - -__CRT_INLINE double __cdecl lgamma(double x) { - if (x < 12.0) { - if (x <= 0.0 && x == floor(x)) return INFINITY; - x = tgamma(x); - return log(x < 0.0 ? -x : x); - } - static const double c[7] = {1.0/12.0, -1.0/360.0, 1.0/1260.0, -1.0/1680.0, - 1.0/1188.0, -691.0/360360.0, 1.0/156.0}; - double m = -3617.0/122400.0, t = 1.0 / (x*x); - for (int k = 6; k >= 0; --k) m = m*t + c[k]; - return (x - 0.5)*log(x) - x + 0.918938533204672742 + m / x; /* C=log(2pi)/2 */ -} - -__CRT_INLINE float __cdecl tgammaf(float x) { - return tgamma(x); -} -__CRT_INLINE float __cdecl lgammaf(float x) { - return lgamma(x); -} -__CRT_INLINE long double __cdecl tgammal(long double x) { - return tgamma(x); -} -__CRT_INLINE long double __cdecl lgammal(long double x) { - return lgamma(x); -} - -#endif /* _TCC_LIBM_H_ */ diff --git a/win32/include/tchar.h b/win32/include/tchar.h deleted file mode 100644 index cd44beca..00000000 --- a/win32/include/tchar.h +++ /dev/null @@ -1,1102 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#include <_mingw.h> - -#ifndef _INC_TCHAR -#define _INC_TCHAR - -#ifdef _STRSAFE_H_INCLUDED_ -#error Need to include strsafe.h after tchar.h -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define _ftcscat _tcscat -#define _ftcschr _tcschr -#define _ftcscpy _tcscpy -#define _ftcscspn _tcscspn -#define _ftcslen _tcslen -#define _ftcsncat _tcsncat -#define _ftcsncpy _tcsncpy -#define _ftcspbrk _tcspbrk -#define _ftcsrchr _tcsrchr -#define _ftcsspn _tcsspn -#define _ftcsstr _tcsstr -#define _ftcstok _tcstok - -#define _ftcsdup _tcsdup -#define _ftcsnset _tcsnset -#define _ftcsrev _tcsrev -#define _ftcsset _tcsset - -#define _ftcscmp _tcscmp -#define _ftcsicmp _tcsicmp -#define _ftcsnccmp _tcsnccmp -#define _ftcsncmp _tcsncmp -#define _ftcsncicmp _tcsncicmp -#define _ftcsnicmp _tcsnicmp - -#define _ftcscoll _tcscoll -#define _ftcsicoll _tcsicoll -#define _ftcsnccoll _tcsnccoll -#define _ftcsncoll _tcsncoll -#define _ftcsncicoll _tcsncicoll -#define _ftcsnicoll _tcsnicoll - -#define _ftcsclen _tcsclen -#define _ftcsnccat _tcsnccat -#define _ftcsnccpy _tcsnccpy -#define _ftcsncset _tcsncset - -#define _ftcsdec _tcsdec -#define _ftcsinc _tcsinc -#define _ftcsnbcnt _tcsnbcnt -#define _ftcsnccnt _tcsnccnt -#define _ftcsnextc _tcsnextc -#define _ftcsninc _tcsninc -#define _ftcsspnp _tcsspnp - -#define _ftcslwr _tcslwr -#define _ftcsupr _tcsupr - -#define _ftclen _tclen -#define _ftccpy _tccpy -#define _ftccmp _tccmp - -#ifndef _CONST_RETURN -#ifdef __cplusplus -#define _CONST_RETURN const -#define _CRT_CONST_CORRECT_OVERLOADS -#else -#define _CONST_RETURN -#endif -#endif - -#define _WConst_return _CONST_RETURN - -#ifdef _UNICODE - -#ifdef __cplusplus -} -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _WCTYPE_T_DEFINED -#define _WCTYPE_T_DEFINED - typedef unsigned short wint_t; - typedef unsigned short wctype_t; -#endif - -#ifndef __TCHAR_DEFINED -#define __TCHAR_DEFINED - typedef wchar_t _TCHAR; - typedef wchar_t _TSCHAR; - typedef wchar_t _TUCHAR; - typedef wchar_t _TXCHAR; - typedef wint_t _TINT; -#endif - -#ifndef _TCHAR_DEFINED -#define _TCHAR_DEFINED -#ifndef NO_OLDNAMES - typedef wchar_t TCHAR; -#endif -#endif - -#define _TEOF WEOF - -#define __T(x) L##x - -#define _tmain wmain -#define _tWinMain wWinMain -#define _tenviron _wenviron -#define __targv __wargv - -#define _tprintf wprintf -#define _tprintf_l _wprintf_l -#define _tprintf_p _wprintf_p -#define _tprintf_p_l _wprintf_p_l -#define _tcprintf _cwprintf -#define _tcprintf_l _cwprintf_l -#define _tcprintf_p _cwprintf_p -#define _tcprintf_p_l _cwprintf_p_l -#define _vtcprintf _vcwprintf -#define _vtcprintf_l _vcwprintf_l -#define _vtcprintf_p _vcwprintf_p -#define _vtcprintf_p_l _vcwprintf_p_l -#define _ftprintf fwprintf -#define _ftprintf_l _fwprintf_l -#define _ftprintf_p _fwprintf_p -#define _ftprintf_p_l _fwprintf_p_l -#define _stprintf swprintf -#define _stprintf_l __swprintf_l -#define _stprintf_p _swprintf_p -#define _stprintf_p_l _swprintf_p_l -#define _sctprintf _scwprintf -#define _sctprintf_l _scwprintf_l -#define _sctprintf_p _scwprintf_p -#define _sctprintf_p_l _scwprintf_p_l -#define _sntprintf _snwprintf -#define _sntprintf_l _snwprintf_l -#define _vtprintf vwprintf -#define _vtprintf_l _vwprintf_l -#define _vtprintf_p _vwprintf_p -#define _vtprintf_p_l _vwprintf_p_l -#define _vftprintf vfwprintf -#define _vftprintf_l _vfwprintf_l -#define _vftprintf_p _vfwprintf_p -#define _vftprintf_p_l _vfwprintf_p_l -#define _vstprintf vswprintf -#define _vstprintf_l _vswprintf_l -#define _vstprintf_p _vswprintf_p -#define _vstprintf_p_l _vswprintf_p_l -#define _vsctprintf _vscwprintf -#define _vsctprintf_l _vscwprintf_l -#define _vsctprintf_p _vscwprintf_p -#define _vsctprintf_p_l _vscwprintf_p_l -#define _vsntprintf _vsnwprintf -#define _vsntprintf_l _vsnwprintf_l - -#define _tscanf wscanf -#define _tscanf_l _wscanf_l -#define _tcscanf _cwscanf -#define _tcscanf_l _cwscanf_l -#define _ftscanf fwscanf -#define _ftscanf_l _fwscanf_l -#define _stscanf swscanf -#define _stscanf_l _swscanf_l -#define _sntscanf _snwscanf -#define _sntscanf_l _snwscanf_l - -#define _fgettc fgetwc -#define _fgettc_nolock _fgetwc_nolock -#define _fgettchar _fgetwchar -#define _fgetts fgetws -#define _fputtc fputwc -#define _fputtc_nolock _fputwc_nolock -#define _fputtchar _fputwchar -#define _fputts fputws -#define _cputts _cputws -#define _cgetts _cgetws -#define _gettc getwc -#define _gettc_nolock _getwc_nolock -#define _gettch _getwch -#define _gettch_nolock _getwch_nolock -#define _gettche _getwche -#define _gettche_nolock _getwche_nolock -#define _gettchar getwchar -#define _gettchar_nolock _getwchar_nolock -#define _getts _getws -#define _puttc putwc -#define _puttc_nolock _putwc_nolock -#define _puttchar putwchar -#define _puttchar_nolock _putwchar_nolock -#define _puttch _putwch -#define _puttch_nolock _putwch_nolock -#define _putts _putws -#define _ungettc ungetwc -#define _ungettc_nolock _ungetwc_nolock -#define _ungettch _ungetwch -#define _ungettch_nolock _ungetwch_nolock - -#define _tcstod wcstod -#define _tcstol wcstol -#define _tcstoul wcstoul -#define _tcstoi64 _wcstoi64 -#define _tcstoui64 _wcstoui64 -#define _tstof _wtof -#define _tstol _wtol -#define _tstoi _wtoi -#define _tstoi64 _wtoi64 -#define _tcstod_l _wcstod_l -#define _tcstol_l _wcstol_l -#define _tcstoul_l _wcstoul_l -#define _tcstoi64_l _wcstoi64_l -#define _tcstoui64_l _wcstoui64_l -#define _tstof_l _wtof_l -#define _tstol_l _wtol_l -#define _tstoi_l _wtoi_l -#define _tstoi64_l _wtoi64_l - -#define _itot _itow -#define _ltot _ltow -#define _ultot _ultow -#define _ttoi _wtoi -#define _ttol _wtol - -#define _ttoi64 _wtoi64 -#define _i64tot _i64tow -#define _ui64tot _ui64tow - -#define _tcscat wcscat -#define _tcschr wcschr -#define _tcscpy wcscpy -#define _tcscspn wcscspn -#define _tcslen wcslen -#define _tcsnlen wcsnlen -#define _tcsncat wcsncat -#define _tcsncat_l _wcsncat_l -#define _tcsncpy wcsncpy -#define _tcsncpy_l _wcsncpy_l -#define _tcspbrk wcspbrk -#define _tcsrchr wcsrchr -#define _tcsspn wcsspn -#define _tcsstr wcsstr -#define _tcstok wcstok -#define _tcstok_l _wcstok_l -#define _tcserror _wcserror -#define __tcserror __wcserror - -#define _tcsdup _wcsdup -#define _tcsnset _wcsnset -#define _tcsnset_l _wcsnset_l -#define _tcsrev _wcsrev -#define _tcsset _wcsset -#define _tcsset_l _wcsset_l - -#define _tcscmp wcscmp -#define _tcsicmp _wcsicmp -#define _tcsicmp_l _wcsicmp_l -#define _tcsnccmp wcsncmp -#define _tcsncmp wcsncmp -#define _tcsncicmp _wcsnicmp -#define _tcsncicmp_l _wcsnicmp_l -#define _tcsnicmp _wcsnicmp -#define _tcsnicmp_l _wcsnicmp_l - -#define _tcscoll wcscoll -#define _tcscoll_l _wcscoll_l -#define _tcsicoll _wcsicoll -#define _tcsicoll_l _wcsicoll_l -#define _tcsnccoll _wcsncoll -#define _tcsnccoll_l _wcsncoll_l -#define _tcsncoll _wcsncoll -#define _tcsncoll_l _wcsncoll_l -#define _tcsncicoll _wcsnicoll -#define _tcsncicoll_l _wcsnicoll_l -#define _tcsnicoll _wcsnicoll -#define _tcsnicoll_l _wcsnicoll_l - -#define _texecl _wexecl -#define _texecle _wexecle -#define _texeclp _wexeclp -#define _texeclpe _wexeclpe -#define _texecv _wexecv -#define _texecve _wexecve -#define _texecvp _wexecvp -#define _texecvpe _wexecvpe - -#define _tspawnl _wspawnl -#define _tspawnle _wspawnle -#define _tspawnlp _wspawnlp -#define _tspawnlpe _wspawnlpe -#define _tspawnv _wspawnv -#define _tspawnve _wspawnve -#define _tspawnvp _wspawnvp -#define _tspawnvp _wspawnvp -#define _tspawnvpe _wspawnvpe - -#define _tsystem _wsystem - -#define _tasctime _wasctime -#define _tctime _wctime -#define _tctime32 _wctime32 -#define _tctime64 _wctime64 -#define _tstrdate _wstrdate -#define _tstrtime _wstrtime -#define _tutime _wutime -#define _tutime32 _wutime32 -#define _tutime64 _wutime64 -#define _tcsftime wcsftime -#define _tcsftime_l _wcsftime_l - -#define _tchdir _wchdir -#define _tgetcwd _wgetcwd -#define _tgetdcwd _wgetdcwd -#define _tgetdcwd_nolock _wgetdcwd_nolock -#define _tmkdir _wmkdir -#define _trmdir _wrmdir - -#define _tfullpath _wfullpath -#define _tgetenv _wgetenv -#define _tmakepath _wmakepath -#define _tpgmptr _wpgmptr -#define _get_tpgmptr _get_wpgmptr -#define _tputenv _wputenv -#define _tsearchenv _wsearchenv -#define _tsplitpath _wsplitpath - -#define _tfdopen _wfdopen -#define _tfsopen _wfsopen -#define _tfopen _wfopen -#define _tfreopen _wfreopen -#define _tperror _wperror -#define _tpopen _wpopen -#define _ttempnam _wtempnam -#define _ttmpnam _wtmpnam - -#define _taccess _waccess -#define _tchmod _wchmod -#define _tcreat _wcreat -#define _tfindfirst _wfindfirst -#define _tfindfirst32 _wfindfirst32 -#define _tfindfirst64 _wfindfirst64 -#define _tfindfirsti64 _wfindfirsti64 -#define _tfindfirst32i64 _wfindfirst32i64 -#define _tfindfirst64i32 _wfindfirst64i32 -#define _tfindnext _wfindnext -#define _tfindnext32 _wfindnext32 -#define _tfindnext64 _wfindnext64 -#define _tfindnexti64 _wfindnexti64 -#define _tfindnext32i64 _wfindnext32i64 -#define _tfindnext64i32 _wfindnext64i32 -#define _tmktemp _wmktemp -#define _topen _wopen -#define _tremove _wremove -#define _trename _wrename -#define _tsopen _wsopen -#define _tunlink _wunlink - -#define _tfinddata_t _wfinddata_t -#define _tfinddata32_t _wfinddata32_t -#define _tfinddata64_t _wfinddata64_t -#define _tfinddatai64_t _wfinddatai64_t -#define _tfinddata32i64_t _wfinddata32i64_t -#define _tfinddata64i32_t _wfinddata64i32_t - -#define _tstat _wstat -#define _tstat32 _wstat32 -#define _tstat32i64 _wstat32i64 -#define _tstat64 _wstat64 -#define _tstat64i32 _wstat64i32 -#define _tstati64 _wstati64 - -#define _tsetlocale _wsetlocale - -#define _tcsclen wcslen -#define _tcscnlen wcsnlen -#define _tcsclen_l(_String,_Locale) wcslen(_String) -#define _tcscnlen_l(_String,_Max_count,_Locale) wcsnlen_l((_String),(_Max_count)) -#define _tcsnccat wcsncat -#define _tcsnccat_l _wcsncat_l -#define _tcsnccpy wcsncpy -#define _tcsnccpy_l _wcsncpy_l -#define _tcsncset _wcsnset - -#define _tcsdec _wcsdec -#define _tcsinc _wcsinc -#define _tcsnbcnt _wcsncnt -#define _tcsnccnt _wcsncnt -#define _tcsnextc _wcsnextc -#define _tcsninc _wcsninc -#define _tcsspnp _wcsspnp - -#define _tcslwr _wcslwr -#define _tcslwr_l _wcslwr_l -#define _tcsupr _wcsupr -#define _tcsupr_l _wcsupr_l -#define _tcsxfrm wcsxfrm -#define _tcsxfrm_l _wcsxfrm_l - -#define _tclen(_pc) (1) -#define _tccpy(_pc1,_cpc2) ((*(_pc1) = *(_cpc2))) -#define _tccmp(_cpc1,_cpc2) ((*(_cpc1))-(*(_cpc2))) - -#define _istalnum iswalnum -#define _istalnum_l _iswalnum_l -#define _istalpha iswalpha -#define _istalpha_l _iswalpha_l -#define _istascii iswascii -#define _istcntrl iswcntrl -#define _istcntrl_l _iswcntrl_l -#define _istdigit iswdigit -#define _istdigit_l _iswdigit_l -#define _istgraph iswgraph -#define _istgraph_l _iswgraph_l -#define _istlower iswlower -#define _istlower_l _iswlower_l -#define _istprint iswprint -#define _istprint_l _iswprint_l -#define _istpunct iswpunct -#define _istpunct_l _iswpunct_l -#define _istspace iswspace -#define _istspace_l _iswspace_l -#define _istupper iswupper -#define _istupper_l _iswupper_l -#define _istxdigit iswxdigit -#define _istxdigit_l _iswxdigit_l - -#define _totupper towupper -#define _totupper_l _towupper_l -#define _totlower towlower -#define _totlower_l _towlower_l - -#define _istlegal(_Char) (1) -#define _istlead(_Char) (0) -#define _istleadbyte(_Char) (0) -#define _istleadbyte_l(_Char,_Locale) (0) - -#define _wcsdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) -#define _wcsinc(_pc) ((_pc)+1) -#define _wcsnextc(_cpc) ((unsigned int) *(_cpc)) -#define _wcsninc(_pc,_sz) (((_pc)+(_sz))) - _CRTIMP size_t __cdecl __wcsncnt(const wchar_t *_Str,size_t _MaxCount); -#define _wcsncnt(_cpc,_sz) (__wcsncnt(_cpc,_sz)) -#define _wcsspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+wcsspn(_cpc1,_cpc2))) ? ((_cpc1)+wcsspn(_cpc1,_cpc2)) : NULL)) -#define _wcsncpy_l(_Destination,_Source,_Count,_Locale) (wcsncpy(_Destination,_Source,_Count)) -#define _wcsncat_l(_Destination,_Source,_Count,_Locale) (wcsncat(_Destination,_Source,_Count)) -#define _wcstok_l(_String,_Delimiters,_Locale) (wcstok(_String,_Delimiters)) -#define _wcsnset_l(_Destination,_Value,_Count,_Locale) (_wcsnset(_Destination,_Value,_Count)) -#define _wcsset_l(_Destination,_Value,_Locale) (_wcsset(_Destination,_Value)) - - /* dirent structures and functions */ -#define _tdirent _wdirent -#define _TDIR _WDIR -#define _topendir _wopendir -#define _tclosedir _wclosedir -#define _treaddir _wreaddir -#define _trewinddir _wrewinddir -#define _ttelldir _wtelldir -#define _tseekdir _wseekdir - -#else - -#ifdef __cplusplus -} -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define _TEOF EOF - -#define __T(x) x - -#define _tmain main -#define _tWinMain WinMain -#ifdef _POSIX_ -#define _tenviron environ -#else -#define _tenviron _environ -#endif -#define __targv __argv - -#define _tprintf printf -#define _tprintf_l _printf_l -#define _tprintf_p _printf_p -#define _tprintf_p_l _printf_p_l -#define _tcprintf _cprintf -#define _tcprintf_l _cprintf_l -#define _tcprintf_p _cprintf_p -#define _tcprintf_p_l _cprintf_p_l -#define _vtcprintf _vcprintf -#define _vtcprintf_l _vcprintf_l -#define _vtcprintf_p _vcprintf_p -#define _vtcprintf_p_l _vcprintf_p_l -#define _ftprintf fprintf -#define _ftprintf_l _fprintf_l -#define _ftprintf_p _fprintf_p -#define _ftprintf_p_l _fprintf_p_l -#define _stprintf sprintf -#define _stprintf_l _sprintf_l -#define _stprintf_p _sprintf_p -#define _stprintf_p_l _sprintf_p_l -#define _sctprintf _scprintf -#define _sctprintf_l _scprintf_l -#define _sctprintf_p _scprintf_p -#define _sctprintf_p_l _scprintf_p_l -#define _sntprintf _snprintf -#define _sntprintf_l _snprintf_l -#define _vtprintf vprintf -#define _vtprintf_l _vprintf_l -#define _vtprintf_p _vprintf_p -#define _vtprintf_p_l _vprintf_p_l -#define _vftprintf vfprintf -#define _vftprintf_l _vfprintf_l -#define _vftprintf_p _vfprintf_p -#define _vftprintf_p_l _vfprintf_p_l -#define _vstprintf vsprintf -#define _vstprintf_l _vsprintf_l -#define _vstprintf_p _vsprintf_p -#define _vstprintf_p_l _vsprintf_p_l -#define _vsctprintf _vscprintf -#define _vsctprintf_l _vscprintf_l -#define _vsctprintf_p _vscprintf_p -#define _vsctprintf_p_l _vscprintf_p_l -#define _vsntprintf _vsnprintf -#define _vsntprintf_l _vsnprintf_l - -#define _tscanf scanf -#define _tscanf_l _scanf_l -#define _tcscanf _cscanf -#define _tcscanf_l _cscanf_l -#define _ftscanf fscanf -#define _ftscanf_l _fscanf_l -#define _stscanf sscanf -#define _stscanf_l _sscanf_l -#define _sntscanf _snscanf -#define _sntscanf_l _snscanf_l - -#define _fgettc fgetc -#define _fgettc_nolock _fgetc_nolock -#define _fgettchar _fgetchar -#define _fgetts fgets -#define _fputtc fputc -#define _fputtc_nolock _fputc_nolock -#define _fputtchar _fputchar -#define _fputts fputs -#define _cputts _cputs -#define _gettc getc -#define _gettc_nolock _getc_nolock -#define _gettch _getch -#define _gettch_nolock _getch_nolock -#define _gettche _getche -#define _gettche_nolock _getche_nolock -#define _gettchar getchar -#define _gettchar_nolock _getchar_nolock -#define _getts gets -#define _cgetts _cgets -#define _puttc putc -#define _puttc_nolock _putc_nolock -#define _puttchar putchar -#define _puttchar_nolock _putchar_nolock -#define _puttch _putch -#define _puttch_nolock _putch_nolock -#define _putts puts -#define _ungettc ungetc -#define _ungettc_nolock _ungetc_nolock -#define _ungettch _ungetch -#define _ungettch_nolock _ungetch_nolock - -#define _tcstod strtod -#define _tcstol strtol -#define _tcstoul strtoul -#define _tstof atof -#define _tstol atol -#define _tstoi atoi -#define _tstoi64 _atoi64 -#define _tcstod_l _strtod_l -#define _tcstol_l _strtol_l -#define _tcstoul_l _strtoul_l -#define _tstof_l _atof_l -#define _tstol_l _atol_l -#define _tstoi_l _atoi_l -#define _tstoi64_l _atoi64_l - -#define _itot _itoa -#define _ltot _ltoa -#define _ultot _ultoa -#define _ttoi atoi -#define _ttol atol - -#define _ttoi64 _atoi64 -#define _tcstoi64 _strtoi64 -#define _tcstoi64_l _strtoi64_l -#define _tcstoui64 _strtoui64 -#define _tcstoui64_l _strtoui64_l -#define _i64tot _i64toa -#define _ui64tot _ui64toa - -#define _tcscat strcat -#define _tcscpy strcpy -#define _tcsdup _strdup -#define _tcslen strlen -#if 0 -#define _tcsnlen strnlen -#endif -#define _tcsxfrm strxfrm -#define _tcsxfrm_l _strxfrm_l -#define _tcserror strerror -#define __tcserror _strerror - -#define _texecl _execl -#define _texecle _execle -#define _texeclp _execlp -#define _texeclpe _execlpe -#define _texecv _execv -#define _texecve _execve -#define _texecvp _execvp -#define _texecvpe _execvpe - -#define _tspawnl _spawnl -#define _tspawnle _spawnle -#define _tspawnlp _spawnlp -#define _tspawnlpe _spawnlpe -#define _tspawnv _spawnv -#define _tspawnve _spawnve -#define _tspawnvp _spawnvp -#define _tspawnvpe _spawnvpe - -#define _tsystem system - -#define _tasctime asctime -#define _tctime ctime -#define _tctime32 _ctime32 -#define _tctime64 _ctime64 -#define _tstrdate _strdate -#define _tstrtime _strtime -#define _tutime _utime -#define _tutime32 _utime32 -#define _tutime64 _utime64 -#define _tcsftime strftime -#define _tcsftime_l _strftime_l - -#define _tchdir _chdir -#define _tgetcwd _getcwd -#define _tgetdcwd _getdcwd -#define _tgetdcwd_nolock _getdcwd_nolock -#define _tmkdir _mkdir -#define _trmdir _rmdir - -#define _tfullpath _fullpath -#define _tgetenv getenv -#define _tmakepath _makepath -#define _tpgmptr _pgmptr -#define _get_tpgmptr _get_pgmptr -#define _tputenv _putenv -#define _tsearchenv _searchenv -#define _tsplitpath _splitpath - -#ifdef _POSIX_ -#define _tfdopen fdopen -#else -#define _tfdopen _fdopen -#endif -#define _tfsopen _fsopen -#define _tfopen fopen -#define _tfreopen freopen -#define _tperror perror -#define _tpopen _popen -#define _ttempnam _tempnam -#define _ttmpnam tmpnam - -#define _tchmod _chmod -#define _tcreat _creat -#define _tfindfirst _findfirst -#define _tfindfirst32 _findfirst32 -#define _tfindfirst64 _findfirst64 -#define _tfindfirsti64 _findfirsti64 -#define _tfindfirst32i64 _findfirst32i64 -#define _tfindfirst64i32 _findfirst64i32 -#define _tfindnext _findnext -#define _tfindnext32 _findnext32 -#define _tfindnext64 _findnext64 -#define _tfindnexti64 _findnexti64 -#define _tfindnext32i64 _findnext32i64 -#define _tfindnext64i32 _findnext64i32 -#define _tmktemp _mktemp - -#ifdef _POSIX_ -#define _topen open -#define _taccess access -#else -#define _topen _open -#define _taccess _access -#endif - -#define _tremove remove -#define _trename rename -#define _tsopen _sopen -#define _tunlink _unlink - -#define _tfinddata_t _finddata_t -#define _tfinddata32_t _finddata32_t -#define _tfinddata64_t __finddata64_t -#define _tfinddatai64_t _finddatai64_t -#define _tfinddata32i64_t _finddata32i64_t -#define _tfinddata64i32_t _finddata64i32_t - -#define _istascii __isascii -#define _istcntrl iscntrl -#define _istcntrl_l _iscntrl_l -#define _istxdigit isxdigit -#define _istxdigit_l _isxdigit_l - -#define _tstat _stat -#define _tstat32 _stat32 -#define _tstat32i64 _stat32i64 -#define _tstat64 _stat64 -#define _tstat64i32 _stat64i32 -#define _tstati64 _stati64 - -#define _tsetlocale setlocale - -#ifdef _MBCS - -#ifdef __cplusplus -} -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __TCHAR_DEFINED - typedef char _TCHAR; - typedef signed char _TSCHAR; - typedef unsigned char _TUCHAR; - typedef unsigned char _TXCHAR; - typedef unsigned int _TINT; -#define __TCHAR_DEFINED -#endif - -#ifndef _TCHAR_DEFINED -#ifndef NO_OLDNAMES - typedef char TCHAR; -#endif -#define _TCHAR_DEFINED -#endif - -#ifdef _MB_MAP_DIRECT - -#define _tcschr _mbschr -#define _tcscspn _mbscspn -#define _tcsncat _mbsnbcat -#define _tcsncat_l _mbsnbcat_l -#define _tcsncpy _mbsnbcpy -#define _tcsncpy_l _mbsnbcpy_l -#define _tcspbrk _mbspbrk -#define _tcsrchr _mbsrchr -#define _tcsspn _mbsspn -#define _tcsstr _mbsstr -#define _tcstok _mbstok -#define _tcstok_l _mbstok_l - -#define _tcsnset _mbsnbset -#define _tcsnset_l _mbsnbset_l -#define _tcsrev _mbsrev -#define _tcsset _mbsset -#define _tcsset_l _mbsset_l - -#define _tcscmp _mbscmp -#define _tcsicmp _mbsicmp -#define _tcsicmp_l _mbsicmp_l -#define _tcsnccmp _mbsncmp -#define _tcsncmp _mbsnbcmp -#define _tcsncicmp _mbsnicmp -#define _tcsncicmp_l _mbsnicmp_l -#define _tcsnicmp _mbsnbicmp -#define _tcsnicmp_l _mbsnbicmp_l - -#define _tcscoll _mbscoll -#define _tcscoll_l _mbscoll_l -#define _tcsicoll _mbsicoll -#define _tcsicoll_l _mbsicoll_l -#define _tcsnccoll _mbsncoll -#define _tcsnccoll_l _mbsncoll_l -#define _tcsncoll _mbsnbcoll -#define _tcsncoll_l _mbsnbcoll_l -#define _tcsncicoll _mbsnicoll -#define _tcsncicoll_l _mbsnicoll_l -#define _tcsnicoll _mbsnbicoll -#define _tcsnicoll_l _mbsnbicoll_l - -#define _tcsclen _mbslen -#define _tcscnlen _mbsnlen -#define _tcsclen_l _mbslen_l -#define _tcscnlen_l _mbsnlen_l -#define _tcsnccat _mbsncat -#define _tcsnccat_l _mbsncat_l -#define _tcsnccpy _mbsncpy -#define _tcsnccpy_l _mbsncpy_l -#define _tcsncset _mbsnset -#define _tcsncset_l _mbsnset_l - -#define _tcsdec _mbsdec -#define _tcsinc _mbsinc -#define _tcsnbcnt _mbsnbcnt -#define _tcsnccnt _mbsnccnt -#define _tcsnextc _mbsnextc -#define _tcsninc _mbsninc -#define _tcsspnp _mbsspnp - -#define _tcslwr _mbslwr -#define _tcslwr_l _mbslwr_l -#define _tcsupr _mbsupr -#define _tcsupr_l _mbsupr_l - -#define _tclen _mbclen -#define _tccpy _mbccpy -#define _tccpy_l _mbccpy_l -#else - - _CRTIMP _CONST_RETURN char *__cdecl _tcschr(const char *_Str,unsigned int _Val); - _CRTIMP size_t __cdecl _tcscspn(const char *_Str,const char *_Control); - _CRTIMP char *__cdecl _tcsncat(char *_Dst,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsncat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsncpy(char *_Dst,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsncpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP _CONST_RETURN char *__cdecl _tcspbrk(const char *_Str,const char *_Control); - _CRTIMP _CONST_RETURN char *__cdecl _tcsrchr(const char *_Str,unsigned int _Ch); - _CRTIMP size_t __cdecl _tcsspn(const char *_Str,const char *_Control); - _CRTIMP _CONST_RETURN char *__cdecl _tcsstr(const char *_Str,const char *_Substr); - _CRTIMP char *__cdecl _tcstok(char *_Str,const char *_Delim); - _CRTIMP char *__cdecl _tcstok_l(char *_Str,const char *_Delim,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsnset(char *_Str,unsigned int _Val,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsrev(char *_Str); - _CRTIMP char *__cdecl _tcsset(char *_Str,unsigned int _Val); - _CRTIMP char *__cdecl _tcsset_l(char *_Str,unsigned int _Val,_locale_t _Locale); - _CRTIMP int __cdecl _tcscmp(const char *_Str1,const char *_Str); - _CRTIMP int __cdecl _tcsicmp(const char *_Str1,const char *_Str2); - _CRTIMP int __cdecl _tcsicmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _tcsnccmp(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsncicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsncicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _tcsnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _tcscoll(const char *_Str1,const char *_Str2); - _CRTIMP int __cdecl _tcscoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _tcsicoll(const char *_Str1,const char *_Str2); - _CRTIMP int __cdecl _tcsicoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _tcsnccoll(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsnccoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _tcsncoll(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _tcsncicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsncicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _tcsnicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _tcsnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP size_t __cdecl _tcsclen(const char *_Str); - _CRTIMP size_t __cdecl _tcscnlen(const char *_Str,size_t _MaxCount); - _CRTIMP size_t __cdecl _tcsclen_l(const char *_Str,_locale_t _Locale); - _CRTIMP size_t __cdecl _tcscnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsnccat(char *_Dst,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsnccat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsnccpy(char *_Dst,const char *_Src,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsnccpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsncset(char *_Str,unsigned int _Val,size_t _MaxCount); - _CRTIMP char *__cdecl _tcsdec(const char *_Start,const char *_Pos); - _CRTIMP char *__cdecl _tcsinc(const char *_Ptr); - _CRTIMP size_t __cdecl _tcsnbcnt(const char *_Str,size_t _MaxCount); - _CRTIMP size_t __cdecl _tcsnccnt(const char *_Str,size_t _MaxCount); - _CRTIMP unsigned int __cdecl _tcsnextc (const char *_Str); - _CRTIMP char *__cdecl _tcsninc(const char *_Ptr,size_t _Count); - _CRTIMP char *__cdecl _tcsspnp(const char *_Str1,const char *_Str2); - _CRTIMP char *__cdecl _tcslwr(char *_Str); - _CRTIMP char *__cdecl _tcslwr_l(char *_Str,_locale_t _Locale); - _CRTIMP char *__cdecl _tcsupr(char *_Str); - _CRTIMP char *__cdecl _tcsupr_l(char *_Str,_locale_t _Locale); - _CRTIMP size_t __cdecl _tclen(const char *_Str); - _CRTIMP void __cdecl _tccpy(char *_DstCh,const char *_SrcCh); - -#ifdef __cplusplus -#ifndef _CPP_TCHAR_INLINES_DEFINED -#define _CPP_TCHAR_INLINES_DEFINED - extern "C++" { - extern inline char *__cdecl _tcschr(char *_S,unsigned int _C) { return ((char *)_tcschr((const char *)_S,_C)); } - extern inline char *__cdecl _tcspbrk(char *_S,const char *_P) { return ((char *)_tcspbrk((const char *)_S,_P)); } - extern inline char *__cdecl _tcsrchr(char *_S,unsigned int _C) { return ((char *)_tcsrchr((const char *)_S,_C)); } - extern inline char *__cdecl _tcsstr(char *_S,const char *_P) { return ((char *)_tcsstr((const char *)_S,_P)); } - } -#endif -#endif -#endif - -#define _tccmp(_cp1,_cp2) _tcsnccmp(_cp1,_cp2,1) - -#define _istalnum _ismbcalnum -#define _istalnum_l _ismbcalnum_l -#define _istalpha _ismbcalpha -#define _istalpha_l _ismbcalpha_l -#define _istdigit _ismbcdigit -#define _istdigit_l _ismbcdigit_l -#define _istgraph _ismbcgraph -#define _istgraph_l _ismbcgraph_l -#define _istlegal _ismbclegal -#define _istlegal_l _ismbclegal_l -#define _istlower _ismbclower -#define _istlower_l _ismbclower_l -#define _istprint _ismbcprint -#define _istprint_l _ismbcprint_l -#define _istpunct _ismbcpunct -#define _istpunct_l _ismbcpunct_l -#define _istspace _ismbcspace -#define _istspace_l _ismbcspace_l -#define _istupper _ismbcupper -#define _istupper_l _ismbcupper_l - -#define _totupper _mbctoupper -#define _totupper_l _mbctoupper_l -#define _totlower _mbctolower -#define _totlower_l _mbctolower_l - -#define _istlead _ismbblead -#define _istleadbyte isleadbyte -#define _istleadbyte_l _isleadbyte_l -#else - -#ifndef __TCHAR_DEFINED -#define __TCHAR_DEFINED - typedef char _TCHAR; - typedef signed char _TSCHAR; - typedef unsigned char _TUCHAR; - typedef char _TXCHAR; - typedef int _TINT; -#endif - -#ifndef _TCHAR_DEFINED -#define _TCHAR_DEFINED -#ifndef NO_OLDNAMES - typedef char TCHAR; -#endif -#endif - -#define _tcschr strchr -#define _tcscspn strcspn -#define _tcsncat strncat -#define _tcsncat_l _strncat_l -#define _tcsncpy strncpy -#define _tcsncpy_l _strncpy_l -#define _tcspbrk strpbrk -#define _tcsrchr strrchr -#define _tcsspn strspn -#define _tcsstr strstr -#define _tcstok strtok -#define _tcstok_l _strtok_l - -#define _tcsnset _strnset -#define _tcsnset_l _strnset_l -#define _tcsrev _strrev -#define _tcsset _strset - -#define _tcscmp strcmp -#define _tcsicmp _stricmp -#define _tcsicmp_l _stricmp_l -#define _tcsnccmp strncmp -#define _tcsncmp strncmp -#define _tcsncicmp _strnicmp -#define _tcsncicmp_l _strnicmp_l -#define _tcsnicmp _strnicmp -#define _tcsnicmp_l _strnicmp_l - -#define _tcscoll strcoll -#define _tcscoll_l _strcoll_l -#define _tcsicoll _stricoll -#define _tcsicoll_l _stricoll_l -#define _tcsnccoll _strncoll -#define _tcsnccoll_l _strncoll_l -#define _tcsncoll _strncoll -#define _tcsncoll_l _strncoll_l -#define _tcsncicoll _strnicoll -#define _tcsncicoll_l _strnicoll_l -#define _tcsnicoll _strnicoll -#define _tcsnicoll_l _strnicoll_l - -#define _tcsclen strlen -#define _tcscnlen strnlen -#define _tcsclen_l(_String,_Locale) strlen(_String) -#define _tcscnlen_l(_String,_Max_count,_Locale) strnlen_l((_String),(_Max_count)) -#define _tcsnccat strncat -#define _tcsnccat_l _strncat_l -#define _tcsnccpy strncpy -#define _tcsnccpy_l _strncpy_l -#define _tcsncset _strnset - -#define _tcsdec _strdec -#define _tcsinc _strinc -#define _tcsnbcnt _strncnt -#define _tcsnccnt _strncnt -#define _tcsnextc _strnextc -#define _tcsninc _strninc -#define _tcsspnp _strspnp - -#define _tcslwr _strlwr -#define _tcslwr_l _strlwr_l -#define _tcsupr _strupr -#define _tcsupr_l _strupr_l -#define _tcsxfrm strxfrm -#define _tcsxfrm_l _strxfrm_l - -#define _istlead(_Char) (0) -#define _istleadbyte(_Char) (0) -#define _istleadbyte_l(_Char,_Locale) (0) - -#define _tclen(_pc) (1) -#define _tccpy(_pc1,_cpc2) (*(_pc1) = *(_cpc2)) -#define _tccmp(_cpc1,_cpc2) (((unsigned char)*(_cpc1))-((unsigned char)*(_cpc2))) - - /* dirent structures and functions */ -#define _tdirent dirent -#define _TDIR DIR -#define _topendir opendir -#define _tclosedir closedir -#define _treaddir readdir -#define _trewinddir rewinddir -#define _ttelldir telldir -#define _tseekdir seekdir - -#define _istalnum isalnum -#define _istalnum_l _isalnum_l -#define _istalpha isalpha -#define _istalpha_l _isalpha_l -#define _istdigit isdigit -#define _istdigit_l _isdigit_l -#define _istgraph isgraph -#define _istgraph_l _isgraph_l -#define _istlower islower -#define _istlower_l _islower_l -#define _istprint isprint -#define _istprint_l _isprint_l -#define _istpunct ispunct -#define _istpunct_l _ispunct_l -#define _istspace isspace -#define _istspace_l _isspace_l -#define _istupper isupper -#define _istupper_l _isupper_l - -#define _totupper toupper -#define _totupper_l _toupper_l -#define _totlower tolower -#define _totlower_l _tolower_l - -#define _istlegal(_c) (1) - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#define _strdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) -#define _strinc(_pc) ((_pc)+1) -#define _strnextc(_cpc) ((unsigned int) *(const unsigned char *)(_cpc)) -#define _strninc(_pc,_sz) (((_pc)+(_sz))) - _CRTIMP size_t __cdecl __strncnt(const char *_Str,size_t _Cnt); -#define _strncnt(_cpc,_sz) (__strncnt(_cpc,_sz)) -#define _strspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+strspn(_cpc1,_cpc2))) ? ((_cpc1)+strspn(_cpc1,_cpc2)) : NULL)) - -#define _strncpy_l(_Destination,_Source,_Count,_Locale) (strncpy(_Destination,_Source,_Count)) -#define _strncat_l(_Destination,_Source,_Count,_Locale) (strncat(_Destination,_Source,_Count)) -#define _strtok_l(_String,_Delimiters,_Locale) (strtok(_String,_Delimiters)) -#define _strnset_l(_Destination,_Value,_Count,_Locale) (_strnset(_Destination,_Value,_Count)) -#define _strset_l(_Destination,_Value,_Locale) (_strset(_Destination,_Value)) -#endif -#endif - -#define _T(x) __T(x) -#define _TEXT(x) __T(x) - -#ifdef __cplusplus -} -#endif - -#include -#endif diff --git a/win32/include/time.h b/win32/include/time.h deleted file mode 100644 index 6c72e266..00000000 --- a/win32/include/time.h +++ /dev/null @@ -1,287 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _TIME_H_ -#define _TIME_H_ - -#include <_mingw.h> - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _CRTIMP -#define _CRTIMP __declspec(dllimport) -#endif - -#ifndef _WCHAR_T_DEFINED -#define _WCHAR_T_DEFINED - typedef unsigned short wchar_t; -#endif - -#ifndef _TIME32_T_DEFINED -#define _TIME32_T_DEFINED - typedef long __time32_t; -#endif - -#ifndef _TIME64_T_DEFINED -#define _TIME64_T_DEFINED -#if _INTEGRAL_MAX_BITS >= 64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef int _time64_t __attribute__ ((mode (DI))); -#else - typedef __int64 __time64_t; -#endif -#endif -#endif - -#ifndef _TIME_T_DEFINED -#define _TIME_T_DEFINED -#ifdef _USE_32BIT_TIME_T - typedef __time32_t time_t; -#else - typedef __time64_t time_t; -#endif -#endif - -#ifndef _CLOCK_T_DEFINED -#define _CLOCK_T_DEFINED - typedef long clock_t; -#endif - -#ifndef _SIZE_T_DEFINED -#define _SIZE_T_DEFINED -#undef size_t -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef unsigned int size_t __attribute__ ((mode (DI))); -#else - typedef unsigned __int64 size_t; -#endif -#else - typedef unsigned int size_t; -#endif -#endif - -#ifndef _SSIZE_T_DEFINED -#define _SSIZE_T_DEFINED -#undef ssize_t -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef int ssize_t __attribute__ ((mode (DI))); -#else - typedef __int64 ssize_t; -#endif -#else - typedef int ssize_t; -#endif -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#ifdef _USE_32BIT_TIME_T -#define _localtime32 localtime -#define _difftime32 difftime -#define _ctime32 ctime -#define _gmtime32 gmtime -#define _mktime32 mktime -#define _time32 time -#endif - -#ifndef _TM_DEFINED -#define _TM_DEFINED - struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - }; -#endif - -#define CLOCKS_PER_SEC 1000 - - __MINGW_IMPORT int _daylight; - __MINGW_IMPORT long _dstbias; - __MINGW_IMPORT long _timezone; - __MINGW_IMPORT char * _tzname[2]; - _CRTIMP errno_t __cdecl _get_daylight(int *_Daylight); - _CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias); - _CRTIMP errno_t __cdecl _get_timezone(long *_Timezone); - _CRTIMP errno_t __cdecl _get_tzname(size_t *_ReturnValue,char *_Buffer,size_t _SizeInBytes,int _Index); - char *__cdecl asctime(const struct tm *_Tm); - _CRTIMP char *__cdecl _ctime32(const __time32_t *_Time); - clock_t __cdecl clock(void); - _CRTIMP double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2); - _CRTIMP struct tm *__cdecl _gmtime32(const __time32_t *_Time); - _CRTIMP struct tm *__cdecl _localtime32(const __time32_t *_Time); - size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm); - _CRTIMP size_t __cdecl _strftime_l(char *_Buf,size_t _Max_size,const char *_Format,const struct tm *_Tm,_locale_t _Locale); - _CRTIMP char *__cdecl _strdate(char *_Buffer); - _CRTIMP char *__cdecl _strtime(char *_Buffer); - _CRTIMP __time32_t __cdecl _time32(__time32_t *_Time); - _CRTIMP __time32_t __cdecl _mktime32(struct tm *_Tm); - _CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm); -#if defined (_POSIX_) || defined(__GNUC__) - void __cdecl tzset(void); -#else - _CRTIMP void __cdecl _tzset(void); -#endif - -#if _INTEGRAL_MAX_BITS >= 64 - double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2); - _CRTIMP char *__cdecl _ctime64(const __time64_t *_Time); - _CRTIMP struct tm *__cdecl _gmtime64(const __time64_t *_Time); - _CRTIMP struct tm *__cdecl _localtime64(const __time64_t *_Time); - _CRTIMP __time64_t __cdecl _mktime64(struct tm *_Tm); - _CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *_Tm); - _CRTIMP __time64_t __cdecl _time64(__time64_t *_Time); -#endif - unsigned __cdecl _getsystime(struct tm *_Tm); - unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec); - -#ifndef _SIZE_T_DEFINED -#define _SIZE_T_DEFINED -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef unsigned int size_t __attribute__ ((mode (DI))); -#else - typedef unsigned __int64 size_t; -#endif -#else - typedef unsigned long size_t; -#endif -#endif - -#ifndef _SSIZE_T_DEFINED -#define _SSIZE_T_DEFINED -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef int ssize_t __attribute__ ((mode (DI))); -#else - typedef __int64 ssize_t; -#endif -#else - typedef long ssize_t; -#endif -#endif - -#ifndef _WTIME_DEFINED - _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); - _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); - size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); - _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); - _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); -#endif - -#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) -#define _INC_WTIME_INL -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } -#else -__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } -#endif -#endif - -#define _WTIME_DEFINED -#endif - -#ifndef RC_INVOKED -double __cdecl difftime(time_t _Time1,time_t _Time2); -char *__cdecl ctime(const time_t *_Time); -struct tm *__cdecl gmtime(const time_t *_Time); -struct tm *__cdecl localtime(const time_t *_Time); -struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *); - -time_t __cdecl mktime(struct tm *_Tm); -time_t __cdecl _mkgmtime(struct tm *_Tm); -time_t __cdecl time(time_t *_Time); - -#ifdef _USE_32BIT_TIME_T -#if 0 -__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); } -__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); } -__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); } -__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); } -__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); } -__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); } -__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); } -#endif -#else -__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); } -__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); } -__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); } -__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); } -__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); } -__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); } -__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); } -#endif -#endif - -#if !defined(NO_OLDNAMES) || defined(_POSIX) -#define CLK_TCK CLOCKS_PER_SEC - - __MINGW_IMPORT int daylight; - __MINGW_IMPORT long dstbias; - __MINGW_IMPORT long timezone; - __MINGW_IMPORT char *tzname[2]; - void __cdecl tzset(void); -#endif - -#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ -#define _TIMEVAL_DEFINED -struct timeval { - long tv_sec; - long tv_usec; -}; -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timercmp(tvp,uvp,cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || (tvp)->tv_sec==(uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) -#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 -#endif /* _TIMEVAL_DEFINED */ - -#ifndef __STRICT_ANSI__ -#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ -#define _TIMEZONE_DEFINED -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; - - extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); -#endif -#endif /* __STRICT_ANSI__ */ - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) - -#include - -/* Adding timespec definition. */ -#include - -#endif /* End _TIME_H_ */ - diff --git a/win32/include/uchar.h b/win32/include/uchar.h deleted file mode 100644 index 1a2c0294..00000000 --- a/win32/include/uchar.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the TinyCC package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -#ifndef _INC_UCHAR -#define _INC_UCHAR - -/* - * The following defines are only valid when C11 (-std=c11) is used. - * - * ... a wide character constant prefixed by the letter u or U has type char16_t - * or char32_t, respectively, unsigned integer types defined in the - * header. - */ - -#if __STDC_VERSION__ >= 201112L -/** - * __STDC_UTF_16__ The integer constant 1, intended to indicate that - * values of type char16_t are UTF-16 encoded. - */ -#define __STDC_UTF_16__ 1 -/** - * __STDC_UTF_32__ The integer constant 1, intended to indicate that - * values of type char32_t are UTF-32 encoded. - */ -#define __STDC_UTF_32__ 1 - -typedef unsigned short char16_t; -typedef unsigned int char32_t; -#endif /* __STDC_VERSION__ >= 201112L */ -#endif /* _INC_UCHAR */ diff --git a/win32/include/unistd.h b/win32/include/unistd.h deleted file mode 100644 index 5cab0b5a..00000000 --- a/win32/include/unistd.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/win32/include/vadefs.h b/win32/include/vadefs.h deleted file mode 100644 index 749b0bdd..00000000 --- a/win32/include/vadefs.h +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_VADEFS -#define _INC_VADEFS - -//!__TINYC__: GNUC specific stuff removed - -#endif diff --git a/win32/include/values.h b/win32/include/values.h deleted file mode 100644 index 1cd643ce..00000000 --- a/win32/include/values.h +++ /dev/null @@ -1,4 +0,0 @@ -/* - * TODO: Nothing here yet. Should provide UNIX compatibility constants - * comparable to those in limits.h and float.h. - */ diff --git a/win32/include/wchar.h b/win32/include/wchar.h deleted file mode 100644 index 389196fa..00000000 --- a/win32/include/wchar.h +++ /dev/null @@ -1,873 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_WCHAR -#define _INC_WCHAR - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef WCHAR_MIN /* also at stdint.h */ -#define WCHAR_MIN 0 -#define WCHAR_MAX ((wchar_t) -1) /* UINT16_MAX */ -#endif - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST - typedef __builtin_va_list __gnuc_va_list; -#endif - -#ifndef _VA_LIST_DEFINED -#define _VA_LIST_DEFINED - typedef __gnuc_va_list va_list; -#endif - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - -#ifndef _FILE_DEFINED - struct _iobuf { - char *_ptr; - int _cnt; - char *_base; - int _flag; - int _file; - int _charbuf; - int _bufsiz; - char *_tmpfname; - }; - typedef struct _iobuf FILE; -#define _FILE_DEFINED -#endif - -#ifndef _STDIO_DEFINED -#ifdef _WIN64 - _CRTIMP FILE *__cdecl __iob_func(void); -#else -#ifdef _MSVCRT_ -extern FILE _iob[]; /* A pointer to an array of FILE */ -#define __iob_func() (_iob) -#else -extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ -#define __iob_func() (*_imp___iob) -#define _iob __iob_func() -#endif -#endif - -#define _iob __iob_func() -#endif - -#ifndef _STDSTREAM_DEFINED -#define stdin (&__iob_func()[0]) -#define stdout (&__iob_func()[1]) -#define stderr (&__iob_func()[2]) -#define _STDSTREAM_DEFINED -#endif - -#ifndef _FSIZE_T_DEFINED - typedef unsigned long _fsize_t; -#define _FSIZE_T_DEFINED -#endif - -#ifndef _WFINDDATA_T_DEFINED - struct _wfinddata32_t { - unsigned attrib; - __time32_t time_create; - __time32_t time_access; - __time32_t time_write; - _fsize_t size; - wchar_t name[260]; - }; - -/* #if _INTEGRAL_MAX_BITS >= 64 */ - - struct _wfinddata32i64_t { - unsigned attrib; - __time32_t time_create; - __time32_t time_access; - __time32_t time_write; - __int64 size; - wchar_t name[260]; - }; - - struct _wfinddata64i32_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - _fsize_t size; - wchar_t name[260]; - }; - - struct _wfinddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - __int64 size; - wchar_t name[260]; - }; -/* #endif */ - -#ifdef _USE_32BIT_TIME_T -#define _wfinddata_t _wfinddata32_t -#define _wfinddatai64_t _wfinddata32i64_t - -#define _wfindfirst _wfindfirst32 -#define _wfindnext _wfindnext32 -#define _wfindfirsti64 _wfindfirst32i64 -#define _wfindnexti64 _wfindnext32i64 -#else -#define _wfinddata_t _wfinddata64i32_t -#define _wfinddatai64_t _wfinddata64_t - -#define _wfindfirst _wfindfirst64i32 -#define _wfindnext _wfindnext64i32 -#define _wfindfirsti64 _wfindfirst64 -#define _wfindnexti64 _wfindnext64 -#endif - -#define _WFINDDATA_T_DEFINED -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#ifndef _CONST_RETURN -#define _CONST_RETURN -#endif - -#define _WConst_return _CONST_RETURN - -#ifndef _CRT_CTYPEDATA_DEFINED -#define _CRT_CTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS - -#ifndef __PCTYPE_FUNC -#define __PCTYPE_FUNC __pctype_func() -#ifdef _MSVCRT_ -#define __pctype_func() (_pctype) -#else -#define __pctype_func() (*_imp___pctype) -#endif -#endif - -#ifndef _pctype -#ifdef _MSVCRT_ - extern unsigned short *_pctype; -#else - extern unsigned short **_imp___pctype; -#define _pctype (*_imp___pctype) -#endif -#endif -#endif -#endif - -#ifndef _CRT_WCTYPEDATA_DEFINED -#define _CRT_WCTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS -#ifndef _wctype -#ifdef _MSVCRT_ - extern unsigned short *_wctype; -#else - extern unsigned short **_imp___wctype; -#define _wctype (*_imp___wctype) -#endif -#endif - -#ifdef _MSVCRT_ -#define __pwctype_func() (_pwctype) -#else -#define __pwctype_func() (*_imp___pwctype) -#endif - -#ifndef _pwctype -#ifdef _MSVCRT_ - extern unsigned short *_pwctype; -#else - extern unsigned short **_imp___pwctype; -#define _pwctype (*_imp___pwctype) -#endif -#endif - -#endif -#endif - -#define _UPPER 0x1 -#define _LOWER 0x2 -#define _DIGIT 0x4 -#define _SPACE 0x8 - -#define _PUNCT 0x10 -#define _CONTROL 0x20 -#define _BLANK 0x40 -#define _HEX 0x80 - -#define _LEADBYTE 0x8000 -#define _ALPHA (0x0100|_UPPER|_LOWER) - -#ifndef _WCTYPE_DEFINED -#define _WCTYPE_DEFINED - - int __cdecl iswalpha(wint_t _C); - _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); - int __cdecl iswupper(wint_t _C); - _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); - int __cdecl iswlower(wint_t _C); - _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); - int __cdecl iswdigit(wint_t _C); - _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); - int __cdecl iswxdigit(wint_t _C); - _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); - int __cdecl iswspace(wint_t _C); - _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); - int __cdecl iswpunct(wint_t _C); - _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); - int __cdecl iswalnum(wint_t _C); - _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); - int __cdecl iswprint(wint_t _C); - _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); - int __cdecl iswgraph(wint_t _C); - _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); - int __cdecl iswcntrl(wint_t _C); - _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); - int __cdecl iswascii(wint_t _C); - int __cdecl isleadbyte(int _C); - _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); - wint_t __cdecl towupper(wint_t _C); - _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); - wint_t __cdecl towlower(wint_t _C); - _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); - int __cdecl iswctype(wint_t _C,wctype_t _Type); - _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); - _CRTIMP int __cdecl __iswcsymf(wint_t _C); - _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); - _CRTIMP int __cdecl __iswcsym(wint_t _C); - _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); - int __cdecl is_wctype(wint_t _C,wctype_t _Type); -#endif - -#ifndef _WDIRECT_DEFINED -#define _WDIRECT_DEFINED - - _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); - _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); - wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); - _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); - _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); - _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); -#endif - -#ifndef _WIO_DEFINED -#define _WIO_DEFINED - - _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); - _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); - _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); - _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); - _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); - _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); - _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); - _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); - intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); - _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); - _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); - int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); - _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); -#endif - _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); -#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) - _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); - _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); -#else - extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); - extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); -#endif -#endif - -#ifndef _WLOCALE_DEFINED -#define _WLOCALE_DEFINED - _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); -#endif - -#ifndef _WPROCESS_DEFINED -#define _WPROCESS_DEFINED - - _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); - _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); - _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); - _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); - _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); - _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); -#ifndef _CRT_WSYSTEM_DEFINED -#define _CRT_WSYSTEM_DEFINED - _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); -#endif -#endif - -#ifndef _WCTYPE_INLINE_DEFINED -#undef _CRT_WCTYPE_NOINLINE -#if !defined(__cplusplus) || defined(_CRT_WCTYPE_NOINLINE) -#define iswalpha(_c) (iswctype(_c,_ALPHA)) -#define iswupper(_c) (iswctype(_c,_UPPER)) -#define iswlower(_c) (iswctype(_c,_LOWER)) -#define iswdigit(_c) (iswctype(_c,_DIGIT)) -#define iswxdigit(_c) (iswctype(_c,_HEX)) -#define iswspace(_c) (iswctype(_c,_SPACE)) -#define iswpunct(_c) (iswctype(_c,_PUNCT)) -#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) -#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) -#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) -#define iswcntrl(_c) (iswctype(_c,_CONTROL)) -#define iswascii(_c) ((unsigned)(_c) < 0x80) - -#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) -#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) -#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) -#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) -#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) -#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) -#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) -#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) -#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) -#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) -#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) -#ifndef _CTYPE_DISABLE_MACROS -#define isleadbyte(_c) (__PCTYPE_FUNC[(unsigned char)(_c)] & _LEADBYTE) -#endif -#endif -#define _WCTYPE_INLINE_DEFINED -#endif - -#if !defined(_POSIX_) || defined(__GNUC__) -#ifndef _INO_T_DEFINED -#define _INO_T_DEFINED - typedef unsigned short _ino_t; -#ifndef NO_OLDNAMES - typedef unsigned short ino_t; -#endif -#endif - -#ifndef _DEV_T_DEFINED -#define _DEV_T_DEFINED - typedef unsigned int _dev_t; -#ifndef NO_OLDNAMES - typedef unsigned int dev_t; -#endif -#endif - -#ifndef _OFF_T_DEFINED -#define _OFF_T_DEFINED -#ifndef _OFF_T_ -#define _OFF_T_ - typedef long _off_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long off_t; -#endif -#endif -#endif - -#ifndef _OFF64_T_DEFINED -#define _OFF64_T_DEFINED - typedef long long _off64_t; -#if !defined(NO_OLDNAMES) || defined(_POSIX) - typedef long long off64_t; -#endif -#endif - -#ifndef _STAT_DEFINED -#define _STAT_DEFINED - -#ifdef _USE_32BIT_TIME_T -#ifdef WIN64 -#define _fstat _fstat32 -#define _stat _stat32 -#define _wstat _wstat32 -#else -#define _fstat32 _fstat -#define _stat32 _stat -#define _wstat32 _wstat -#endif -#define _fstati64 _fstat32i64 -#define _stati64 _stat32i64 -#define _wstati64 _wstat32i64 -#else -#define _fstat _fstat64i32 -#define _fstati64 _fstat64 -#define _stat _stat64i32 -#define _stati64 _stat64 -#define _wstat _wstat64i32 -#define _wstati64 _wstat64 -#endif - - struct _stat32 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - __time32_t st_atime; - __time32_t st_mtime; - __time32_t st_ctime; - }; - -#ifndef NO_OLDNAMES - struct stat { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; - }; -#endif - -#if _INTEGRAL_MAX_BITS >= 64 - - struct _stat32i64 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - __time32_t st_atime; - __time32_t st_mtime; - __time32_t st_ctime; - }; - - struct _stat64i32 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - _off_t st_size; - __time64_t st_atime; - __time64_t st_mtime; - __time64_t st_ctime; - }; - - struct _stat64 { - _dev_t st_dev; - _ino_t st_ino; - unsigned short st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - __time64_t st_atime; - __time64_t st_mtime; - __time64_t st_ctime; - }; -#endif - -#define __stat64 _stat64 - -#endif - -#ifndef _WSTAT_DEFINED -#define _WSTAT_DEFINED - - _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); - int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); - _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); -#endif -#endif -#endif - -#ifndef _WCONIO_DEFINED -#define _WCONIO_DEFINED - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - - _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); - _CRTIMP wint_t __cdecl _getwch(void); - _CRTIMP wint_t __cdecl _getwche(void); - _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); - _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); - _CRTIMP int __cdecl _cputws(const wchar_t *_String); - _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); - _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); - _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); - - _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - wint_t __cdecl _putwch_nolock(wchar_t _WCh); - wint_t __cdecl _getwch_nolock(void); - wint_t __cdecl _getwche_nolock(void); - wint_t __cdecl _ungetwch_nolock(wint_t _WCh); -#endif - -#ifndef _WSTDIO_DEFINED -#define _WSTDIO_DEFINED - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - -#ifdef _POSIX_ - _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); -#else - _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); -#endif - - wint_t __cdecl fgetwc(FILE *_File); - _CRTIMP wint_t __cdecl _fgetwchar(void); - wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); - _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); - wint_t __cdecl getwc(FILE *_File); - wint_t __cdecl getwchar(void); - wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); - wint_t __cdecl putwchar(wchar_t _Ch); - wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); - wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); - int __cdecl fputws(const wchar_t *_Str,FILE *_File); - _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); - _CRTIMP int __cdecl _putws(const wchar_t *_Str); - int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); - int __cdecl wprintf(const wchar_t *_Format,...); - _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); - int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); - int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); - _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); - _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); -#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ - int __cdecl snwprintf (wchar_t *s, size_t n, const wchar_t * format, ...); - __CRT_INLINE int __cdecl vsnwprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg) { return _vsnwprintf(s,n,format,arg); } - int __cdecl vwscanf (const wchar_t *, va_list); - int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); - int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); -#endif - _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); - _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); - _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); - _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); - _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); - _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); - _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); -#ifndef RC_INVOKED -#include -#endif - -#ifdef _CRT_NON_CONFORMING_SWPRINTFS -#ifndef __cplusplus -#define swprintf _swprintf -#define vswprintf _vswprintf -#define _swprintf_l __swprintf_l -#define _vswprintf_l __vswprintf_l -#endif -#endif - - _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); - _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); - _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); - int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); - _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); - int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); - _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); - _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); - int __cdecl wscanf(const wchar_t *_Format,...); - _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); - _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); - _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); - _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); - -#ifndef _CRT_WPERROR_DEFINED -#define _CRT_WPERROR_DEFINED - _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); -#endif - _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); -#if !defined(NO_OLDNAMES) && !defined(wpopen) -#define wpopen _wpopen -#endif - _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); - _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); - _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); - _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); - _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); - -#undef _CRT_GETPUTWCHAR_NOINLINE - -#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) -#define getwchar() fgetwc(stdin) -#define putwchar(_c) fputwc((_c),stdout) -#else - __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); } - __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); } -#endif - -#define getwc(_stm) fgetwc(_stm) -#define putwc(_c,_stm) fputwc(_c,_stm) -#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) -#define _getwc_nolock(_c) _fgetwc_nolock(_c) -#endif - -#ifndef _WSTDLIB_DEFINED -#define _WSTDLIB_DEFINED - - _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); - _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); - _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); - double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); - _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); - float __cdecl wcstof( const wchar_t *nptr, wchar_t **endptr); -#if !defined __NO_ISOCEXT /* in libmingwex.a */ - float __cdecl wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__); - long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); -#endif /* __NO_ISOCEXT */ - long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); - unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); -#ifndef _CRT_WSYSTEM_DEFINED -#define _CRT_WSYSTEM_DEFINED - _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); -#endif - _CRTIMP double __cdecl _wtof(const wchar_t *_Str); - _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); - _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); - _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); - _CRTIMP long __cdecl _wtol(const wchar_t *_Str); - _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); - -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); - _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); - _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); - _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); - _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); - _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); - _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); -#endif -#endif - -#ifndef _POSIX_ -#ifndef _WSTDLIBP_DEFINED -#define _WSTDLIBP_DEFINED - _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); - _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); -#ifndef _CRT_WPERROR_DEFINED -#define _CRT_WPERROR_DEFINED - _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); -#endif - _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); - _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); - _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); -#endif -#endif - -#ifndef _WSTRING_DEFINED -#define _WSTRING_DEFINED - _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); - wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); - _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); - int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); - wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); - size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); - size_t __cdecl wcslen(const wchar_t *_Str); - size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); - wchar_t *__cdecl wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); - int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - wchar_t *__cdecl wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); - _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); - _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); - size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); - _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); - wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); - _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); - _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); - _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); - _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); - _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); - _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); - _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); - _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); - _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); - size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); - _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); - int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); - _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); - _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); - _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); - _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); - -#ifndef NO_OLDNAMES - wchar_t *__cdecl wcsdup(const wchar_t *_Str); -#define wcswcs wcsstr - int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); - int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); - wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); - wchar_t *__cdecl wcsrev(wchar_t *_Str); - wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); - wchar_t *__cdecl wcslwr(wchar_t *_Str); - wchar_t *__cdecl wcsupr(wchar_t *_Str); - int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); -#endif -#endif - -#ifndef _TM_DEFINED -#define _TM_DEFINED - struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - }; -#endif - -#ifndef _WTIME_DEFINED -#define _WTIME_DEFINED - - _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); - _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); - size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); - _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); - _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); - _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); -#if _INTEGRAL_MAX_BITS >= 64 - _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); -#endif - -#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) -#define _INC_WTIME_INL -#ifdef _USE_32BIT_TIME_T -__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } -#else -__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } -#endif -#endif -#endif - - typedef int mbstate_t; - typedef wchar_t _Wint_t; - - wint_t __cdecl btowc(int); - size_t __cdecl mbrlen(const char *_Ch,size_t _SizeInBytes,mbstate_t *_State); - size_t __cdecl mbrtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SizeInBytes,mbstate_t *_State); - size_t __cdecl mbsrtowcs(wchar_t *_Dest,const char **_PSrc,size_t _Count,mbstate_t *_State); - size_t __cdecl wcrtomb(char *_Dest,wchar_t _Source,mbstate_t *_State); - size_t __cdecl wcsrtombs(char *_Dest,const wchar_t **_PSource,size_t _Count,mbstate_t *_State); - int __cdecl wctob(wint_t _WCh); - -#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */ - wchar_t *__cdecl wmemset(wchar_t *s, wchar_t c, size_t n); - _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *s, wchar_t c, size_t n); - int wmemcmp(const wchar_t *s1, const wchar_t *s2,size_t n); - wchar_t *__cdecl wmemcpy(wchar_t *s1,const wchar_t *s2,size_t n); - wchar_t *__cdecl wmemmove(wchar_t *s1, const wchar_t *s2, size_t n); - long long __cdecl wcstoll(const wchar_t *nptr,wchar_t **endptr, int base); - unsigned long long __cdecl wcstoull(const wchar_t *nptr,wchar_t **endptr, int base); -#endif /* __NO_ISOCEXT */ - - void *__cdecl memmove(void *_Dst,const void *_Src,size_t _MaxCount); - void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _MaxCount); - __CRT_INLINE int __cdecl fwide(FILE *_F,int _M) { (void)_F; return (_M); } - __CRT_INLINE int __cdecl mbsinit(const mbstate_t *_P) { return (!_P || *_P==0); } - __CRT_INLINE _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *_S,wchar_t _C,size_t _N) { for (;0<_N;++_S,--_N) if (*_S==_C) return (_CONST_RETURN wchar_t *)(_S); return (0); } - __CRT_INLINE int __cdecl wmemcmp(const wchar_t *_S1,const wchar_t *_S2,size_t _N) { for (; 0 < _N; ++_S1,++_S2,--_N) if (*_S1!=*_S2) return (*_S1 < *_S2 ? -1 : +1); return (0); } - __CRT_INLINE wchar_t *__cdecl wmemcpy(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memcpy(_S1,_S2,_N*sizeof(wchar_t)); } - __CRT_INLINE wchar_t *__cdecl wmemmove(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memmove(_S1,_S2,_N*sizeof(wchar_t)); } - __CRT_INLINE wchar_t *__cdecl wmemset(wchar_t *_S,wchar_t _C,size_t _N) { - wchar_t *_Su = _S; - for (;0<_N;++_Su,--_N) { - *_Su = _C; - } - return (_S); - } -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) - -#include -#endif diff --git a/win32/include/wctype.h b/win32/include/wctype.h deleted file mode 100644 index a44cb384..00000000 --- a/win32/include/wctype.h +++ /dev/null @@ -1,172 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_WCTYPE -#define _INC_WCTYPE - -#ifndef _WIN32 -#error Only Win32 target is supported! -#endif - -#include <_mingw.h> - -#pragma pack(push,_CRT_PACKING) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _CRTIMP -#define _CRTIMP __declspec(dllimport) -#endif - -#ifndef _WCHAR_T_DEFINED - typedef unsigned short wchar_t; -#define _WCHAR_T_DEFINED -#endif - -#ifndef _WCTYPE_T_DEFINED - typedef unsigned short wint_t; - typedef unsigned short wctype_t; -#define _WCTYPE_T_DEFINED -#endif - -#ifndef WEOF -#define WEOF (wint_t)(0xFFFF) -#endif - -#ifndef _CRT_CTYPEDATA_DEFINED -#define _CRT_CTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS - -#ifndef __PCTYPE_FUNC -#define __PCTYPE_FUNC __pctype_func() -#ifdef _MSVCRT_ -#define __pctype_func() (_pctype) -#else -#define __pctype_func() (*_imp___pctype) -#endif -#endif - -#ifndef _pctype -#ifdef _MSVCRT_ - extern unsigned short *_pctype; -#else - extern unsigned short **_imp___pctype; -#define _pctype (*_imp___pctype) -#endif -#endif - -#endif -#endif - -#ifndef _CRT_WCTYPEDATA_DEFINED -#define _CRT_WCTYPEDATA_DEFINED -#ifndef _CTYPE_DISABLE_MACROS -#ifndef _wctype -#ifdef _MSVCRT_ - extern unsigned short *_wctype; -#else - extern unsigned short **_imp___wctype; -#define _wctype (*_imp___wctype) -#endif -#endif - -#ifndef _pwctype -#ifdef _MSVCRT_ - extern unsigned short *_pwctype; -#else - extern unsigned short **_imp___pwctype; -#define _pwctype (*_imp___pwctype) -#define __pwctype_func() (*_imp___pwctype) -#endif -#endif -#endif -#endif - -#define _UPPER 0x1 -#define _LOWER 0x2 -#define _DIGIT 0x4 -#define _SPACE 0x8 - -#define _PUNCT 0x10 -#define _CONTROL 0x20 -#define _BLANK 0x40 -#define _HEX 0x80 - -#define _LEADBYTE 0x8000 -#define _ALPHA (0x0100|_UPPER|_LOWER) - -#ifndef _WCTYPE_DEFINED -#define _WCTYPE_DEFINED - - int __cdecl iswalpha(wint_t); - int __cdecl iswupper(wint_t); - int __cdecl iswlower(wint_t); - int __cdecl iswdigit(wint_t); - int __cdecl iswxdigit(wint_t); - int __cdecl iswspace(wint_t); - int __cdecl iswpunct(wint_t); - int __cdecl iswalnum(wint_t); - int __cdecl iswprint(wint_t); - int __cdecl iswgraph(wint_t); - int __cdecl iswcntrl(wint_t); - int __cdecl iswascii(wint_t); - int __cdecl isleadbyte(int); - wint_t __cdecl towupper(wint_t); - wint_t __cdecl towlower(wint_t); - int __cdecl iswctype(wint_t,wctype_t); - _CRTIMP int __cdecl __iswcsymf(wint_t); - _CRTIMP int __cdecl __iswcsym(wint_t); - int __cdecl is_wctype(wint_t,wctype_t); -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) -int __cdecl isblank(int _C); -#endif -#endif - -#ifndef _WCTYPE_INLINE_DEFINED -#define _WCTYPE_INLINE_DEFINED -#ifndef __cplusplus -#define iswalpha(_c) (iswctype(_c,_ALPHA)) -#define iswupper(_c) (iswctype(_c,_UPPER)) -#define iswlower(_c) (iswctype(_c,_LOWER)) -#define iswdigit(_c) (iswctype(_c,_DIGIT)) -#define iswxdigit(_c) (iswctype(_c,_HEX)) -#define iswspace(_c) (iswctype(_c,_SPACE)) -#define iswpunct(_c) (iswctype(_c,_PUNCT)) -#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) -#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) -#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) -#define iswcntrl(_c) (iswctype(_c,_CONTROL)) -#define iswascii(_c) ((unsigned)(_c) < 0x80) -#define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) -#else - __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } - __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } - __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } - __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } - __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } - __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } - __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } - __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } - __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } - __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } - __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } - __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } - __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } -#endif -#endif - - typedef wchar_t wctrans_t; - wint_t __cdecl towctrans(wint_t,wctrans_t); - wctrans_t __cdecl wctrans(const char *); - wctype_t __cdecl wctype(const char *); - -#ifdef __cplusplus -} -#endif - -#pragma pack(pop) -#endif diff --git a/win32/include/winapi/basetsd.h b/win32/include/winapi/basetsd.h deleted file mode 100644 index 47d78c4c..00000000 --- a/win32/include/winapi/basetsd.h +++ /dev/null @@ -1,149 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _BASETSD_H_ -#define _BASETSD_H_ - -#if (defined(__x86_64) || defined(__ia64__)) && !defined(RC_INVOKED) -typedef unsigned __int64 POINTER_64_INT; -#else -typedef unsigned long POINTER_64_INT; -#endif - -#define POINTER_32 -#define POINTER_64 -#define FIRMWARE_PTR - -#ifdef __cplusplus -extern "C" { -#endif - - typedef signed char INT8,*PINT8; - typedef signed short INT16,*PINT16; - typedef signed int INT32,*PINT32; - typedef signed __int64 INT64,*PINT64; - typedef unsigned char UINT8,*PUINT8; - typedef unsigned short UINT16,*PUINT16; - typedef unsigned int UINT32,*PUINT32; - typedef unsigned __int64 UINT64,*PUINT64; - typedef signed int LONG32,*PLONG32; - typedef unsigned int ULONG32,*PULONG32; - typedef unsigned int DWORD32,*PDWORD32; - -#ifndef _W64 -#define _W64 -#endif - -#ifdef _WIN64 - typedef __int64 INT_PTR,*PINT_PTR; - typedef unsigned __int64 UINT_PTR,*PUINT_PTR; - typedef __int64 LONG_PTR,*PLONG_PTR; - typedef unsigned __int64 ULONG_PTR,*PULONG_PTR; -#define __int3264 __int64 -#else - typedef int INT_PTR,*PINT_PTR; - typedef unsigned int UINT_PTR,*PUINT_PTR; - typedef long LONG_PTR,*PLONG_PTR; - typedef unsigned long ULONG_PTR,*PULONG_PTR; -#define __int3264 __int32 -#endif - -#ifdef _WIN64 -#define ADDRESS_TAG_BIT 0x40000000000ULL - typedef __int64 SHANDLE_PTR; - typedef unsigned __int64 HANDLE_PTR; - typedef unsigned int UHALF_PTR,*PUHALF_PTR; - typedef int HALF_PTR,*PHALF_PTR; - - static __inline unsigned long HandleToULong(const void *h) { return((unsigned long) (ULONG_PTR) h); } - static __inline long HandleToLong(const void *h) { return((long) (LONG_PTR) h); } - static __inline void *ULongToHandle(const unsigned long h) { return((void *) (UINT_PTR) h); } - static __inline void *LongToHandle(const long h) { return((void *) (INT_PTR) h); } - static __inline unsigned long PtrToUlong(const void *p) { return((unsigned long) (ULONG_PTR) p); } - static __inline unsigned int PtrToUint(const void *p) { return((unsigned int) (UINT_PTR) p); } - static __inline unsigned short PtrToUshort(const void *p) { return((unsigned short) (unsigned long) (ULONG_PTR) p); } - static __inline long PtrToLong(const void *p) { return((long) (LONG_PTR) p); } - static __inline int PtrToInt(const void *p) { return((int) (INT_PTR) p); } - static __inline short PtrToShort(const void *p) { return((short) (long) (LONG_PTR) p); } - static __inline void *IntToPtr(const int i) { return((void *)(INT_PTR)i); } - static __inline void *UIntToPtr(const unsigned int ui) { return((void *)(UINT_PTR)ui); } - static __inline void *LongToPtr(const long l) { return((void *)(LONG_PTR)l); } - static __inline void *ULongToPtr(const unsigned long ul) { return((void *)(ULONG_PTR)ul); } - -#define PtrToPtr64(p) ((void *) p) -#define Ptr64ToPtr(p) ((void *) p) -#define HandleToHandle64(h) (PtrToPtr64(h)) -#define Handle64ToHandle(h) (Ptr64ToPtr(h)) - - static __inline void *Ptr32ToPtr(const void *p) { return (void *)p; } - static __inline void *Handle32ToHandle(const void *h) { return((void *) h); } - static __inline void *PtrToPtr32(const void *p) { return((void *) (ULONG_PTR) p); } - -#define HandleToHandle32(h) (PtrToPtr32(h)) -#else - -#define ADDRESS_TAG_BIT 0x80000000UL - - typedef unsigned short UHALF_PTR,*PUHALF_PTR; - typedef short HALF_PTR,*PHALF_PTR; - typedef long SHANDLE_PTR; - typedef unsigned long HANDLE_PTR; - -#define HandleToULong(h) ((ULONG)(ULONG_PTR)(h)) -#define HandleToLong(h) ((LONG)(LONG_PTR) (h)) -#define ULongToHandle(ul) ((HANDLE)(ULONG_PTR) (ul)) -#define LongToHandle(h) ((HANDLE)(LONG_PTR) (h)) -#define PtrToUlong(p) ((ULONG)(ULONG_PTR) (p)) -#define PtrToLong(p) ((LONG)(LONG_PTR) (p)) -#define PtrToUint(p) ((UINT)(UINT_PTR) (p)) -#define PtrToInt(p) ((INT)(INT_PTR) (p)) -#define PtrToUshort(p) ((unsigned short)(ULONG_PTR)(p)) -#define PtrToShort(p) ((short)(LONG_PTR)(p)) -#define IntToPtr(i) ((VOID *)(INT_PTR)((int)i)) -#define UIntToPtr(ui) ((VOID *)(UINT_PTR)((unsigned int)ui)) -#define LongToPtr(l) ((VOID *)(LONG_PTR)((long)l)) -#define ULongToPtr(ul) ((VOID *)(ULONG_PTR)((unsigned long)ul)) - - static __inline void *PtrToPtr64(const void *p) { return((void *) (ULONG_PTR)p); } - static __inline void *Ptr64ToPtr(const void *p) { return((void *) (ULONG_PTR) p); } - static __inline void *HandleToHandle64(const void *h) { return((void *) h); } - static __inline void *Handle64ToHandle(const void *h) { return((void *) (ULONG_PTR) h); } - -#define Ptr32ToPtr(p) ((void *) p) -#define Handle32ToHandle(h) (Ptr32ToPtr(h)) -#define PtrToPtr32(p) ((void *) p) -#define HandleToHandle32(h) (PtrToPtr32(h)) -#endif - -#define HandleToUlong(h) HandleToULong(h) -#define UlongToHandle(ul) ULongToHandle(ul) -#define UlongToPtr(ul) ULongToPtr(ul) -#define UintToPtr(ui) UIntToPtr(ui) - -#define MAXUINT_PTR (~((UINT_PTR)0)) -#define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1)) -#define MININT_PTR (~MAXINT_PTR) - -#define MAXULONG_PTR (~((ULONG_PTR)0)) -#define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1)) -#define MINLONG_PTR (~MAXLONG_PTR) - -#define MAXUHALF_PTR ((UHALF_PTR)~0) -#define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1)) -#define MINHALF_PTR (~MAXHALF_PTR) - - typedef ULONG_PTR SIZE_T,*PSIZE_T; - typedef LONG_PTR SSIZE_T,*PSSIZE_T; - typedef ULONG_PTR DWORD_PTR,*PDWORD_PTR; - typedef __int64 LONG64,*PLONG64; - typedef unsigned __int64 ULONG64,*PULONG64; - typedef unsigned __int64 DWORD64,*PDWORD64; - typedef ULONG_PTR KAFFINITY; - typedef KAFFINITY *PKAFFINITY; - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/basetyps.h b/win32/include/winapi/basetyps.h deleted file mode 100644 index 376665e7..00000000 --- a/win32/include/winapi/basetyps.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#if !defined(_BASETYPS_H_) -#define _BASETYPS_H_ - -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C extern -#endif - -#define STDMETHODCALLTYPE WINAPI -#define STDMETHODVCALLTYPE __cdecl - -#define STDAPICALLTYPE WINAPI -#define STDAPIVCALLTYPE __cdecl - -#define STDAPI EXTERN_C HRESULT WINAPI -#define STDAPI_(type) EXTERN_C type WINAPI - -#define STDMETHODIMP HRESULT WINAPI -#define STDMETHODIMP_(type) type WINAPI - -#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE -#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE - -#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE -#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE - -#if defined(__cplusplus) && !defined(CINTERFACE) - -#define __STRUCT__ struct -#define STDMETHOD(method) virtual HRESULT WINAPI method -#define STDMETHOD_(type,method) virtual type WINAPI method -#define STDMETHODV(method) virtual HRESULT STDMETHODVCALLTYPE method -#define STDMETHODV_(type,method) virtual type STDMETHODVCALLTYPE method -#define PURE = 0 -#define THIS_ -#define THIS void -#define DECLARE_INTERFACE(iface) __STRUCT__ iface -#define DECLARE_INTERFACE_(iface,baseiface) __STRUCT__ iface : public baseiface -#else - -#ifndef __OBJC__ -#define interface struct -#endif - -#define STDMETHOD(method) HRESULT (WINAPI *method) -#define STDMETHOD_(type,method) type (WINAPI *method) -#define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method) -#define STDMETHODV_(type,method) type (STDMETHODVCALLTYPE *method) - -#define PURE -#define THIS_ INTERFACE *This, -#define THIS INTERFACE *This -#ifdef CONST_VTABLE -#define DECLARE_INTERFACE(iface) typedef struct iface { \ - const struct iface##Vtbl *lpVtbl; } iface; \ - typedef const struct iface##Vtbl iface##Vtbl; \ - const struct iface##Vtbl -#else -#define DECLARE_INTERFACE(iface) typedef struct iface { \ - struct iface##Vtbl *lpVtbl; \ - } iface; \ - typedef struct iface##Vtbl iface##Vtbl; \ - struct iface##Vtbl -#endif -#define DECLARE_INTERFACE_(iface,baseiface) DECLARE_INTERFACE(iface) -#endif - -#include - -#ifndef _ERROR_STATUS_T_DEFINED -#define _ERROR_STATUS_T_DEFINED -typedef unsigned long error_status_t; -#endif - -#ifndef _WCHAR_T_DEFINED -typedef unsigned short wchar_t; -#define _WCHAR_T_DEFINED -#endif -#endif diff --git a/win32/include/winapi/guiddef.h b/win32/include/winapi/guiddef.h deleted file mode 100644 index 4e7909a9..00000000 --- a/win32/include/winapi/guiddef.h +++ /dev/null @@ -1,156 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef GUID_DEFINED -#define GUID_DEFINED -typedef struct _GUID { - unsigned long Data1; - unsigned short Data2; - unsigned short Data3; - unsigned char Data4[8 ]; -} GUID; -#endif - -#ifndef UUID_DEFINED -#define UUID_DEFINED -typedef GUID UUID; -#endif - -#ifndef FAR -#define FAR -#endif - -#ifndef DECLSPEC_SELECTANY -#define DECLSPEC_SELECTANY __declspec(selectany) -#endif - -#ifndef EXTERN_C -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C extern -#endif -#endif - -#ifdef DEFINE_GUID -#undef DEFINE_GUID -#endif - -#ifdef INITGUID -#ifdef __cplusplus -#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } -#else -#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l,w1,w2,{ b1,b2,b3,b4,b5,b6,b7,b8 } } -#endif -#else -#define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name -#endif - -#define DEFINE_OLEGUID(name,l,w1,w2) DEFINE_GUID(name,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) - -#ifndef _GUIDDEF_H_ -#define _GUIDDEF_H_ - -#ifndef __LPGUID_DEFINED__ -#define __LPGUID_DEFINED__ -typedef GUID *LPGUID; -#endif - -#ifndef __LPCGUID_DEFINED__ -#define __LPCGUID_DEFINED__ -typedef const GUID *LPCGUID; -#endif - -#ifndef __IID_DEFINED__ -#define __IID_DEFINED__ - -typedef GUID IID; -typedef IID *LPIID; -#define IID_NULL GUID_NULL -#define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) -typedef GUID CLSID; -typedef CLSID *LPCLSID; -#define CLSID_NULL GUID_NULL -#define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) -typedef GUID FMTID; -typedef FMTID *LPFMTID; -#define FMTID_NULL GUID_NULL -#define IsEqualFMTID(rfmtid1,rfmtid2) IsEqualGUID(rfmtid1,rfmtid2) - -#ifdef __midl_proxy -#define __MIDL_CONST -#else -#define __MIDL_CONST const -#endif - -#ifndef _REFGUID_DEFINED -#define _REFGUID_DEFINED -#ifdef __cplusplus -#define REFGUID const GUID & -#else -#define REFGUID const GUID *__MIDL_CONST -#endif -#endif - -#ifndef _REFIID_DEFINED -#define _REFIID_DEFINED -#ifdef __cplusplus -#define REFIID const IID & -#else -#define REFIID const IID *__MIDL_CONST -#endif -#endif - -#ifndef _REFCLSID_DEFINED -#define _REFCLSID_DEFINED -#ifdef __cplusplus -#define REFCLSID const IID & -#else -#define REFCLSID const IID *__MIDL_CONST -#endif -#endif - -#ifndef _REFFMTID_DEFINED -#define _REFFMTID_DEFINED -#ifdef __cplusplus -#define REFFMTID const IID & -#else -#define REFFMTID const IID *__MIDL_CONST -#endif -#endif -#endif - -#ifndef _SYS_GUID_OPERATORS_ -#define _SYS_GUID_OPERATORS_ -#include - -#ifdef __cplusplus -__inline int InlineIsEqualGUID(REFGUID rguid1,REFGUID rguid2) { - return (((unsigned long *) &rguid1)[0]==((unsigned long *) &rguid2)[0] && ((unsigned long *) &rguid1)[1]==((unsigned long *) &rguid2)[1] && - ((unsigned long *) &rguid1)[2]==((unsigned long *) &rguid2)[2] && ((unsigned long *) &rguid1)[3]==((unsigned long *) &rguid2)[3]); -} -__inline int IsEqualGUID(REFGUID rguid1,REFGUID rguid2) { return !memcmp(&rguid1,&rguid2,sizeof(GUID)); } -#else -#define InlineIsEqualGUID(rguid1,rguid2) (((unsigned long *) rguid1)[0]==((unsigned long *) rguid2)[0] && ((unsigned long *) rguid1)[1]==((unsigned long *) rguid2)[1] && ((unsigned long *) rguid1)[2]==((unsigned long *) rguid2)[2] && ((unsigned long *) rguid1)[3]==((unsigned long *) rguid2)[3]) -#define IsEqualGUID(rguid1,rguid2) (!memcmp(rguid1,rguid2,sizeof(GUID))) -#endif - -#ifdef __INLINE_ISEQUAL_GUID -#undef IsEqualGUID -#define IsEqualGUID(rguid1,rguid2) InlineIsEqualGUID(rguid1,rguid2) -#endif - -#define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2) -#define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2) - -#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_ -#define _SYS_GUID_OPERATOR_EQ_ -#ifdef __cplusplus -__inline int operator==(REFGUID guidOne,REFGUID guidOther) { return IsEqualGUID(guidOne,guidOther); } -__inline int operator!=(REFGUID guidOne,REFGUID guidOther) { return !(guidOne==guidOther); } -#endif -#endif -#endif -#endif diff --git a/win32/include/winapi/poppack.h b/win32/include/winapi/poppack.h deleted file mode 100644 index b08cba22..00000000 --- a/win32/include/winapi/poppack.h +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#if !(defined(lint) || defined(RC_INVOKED)) -#pragma pack(pop) -#endif diff --git a/win32/include/winapi/pshpack1.h b/win32/include/winapi/pshpack1.h deleted file mode 100644 index d18d9e85..00000000 --- a/win32/include/winapi/pshpack1.h +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#if !(defined(lint) || defined(RC_INVOKED)) -#pragma pack(push,1) -#endif diff --git a/win32/include/winapi/pshpack2.h b/win32/include/winapi/pshpack2.h deleted file mode 100644 index 7de16fd3..00000000 --- a/win32/include/winapi/pshpack2.h +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#if !(defined(lint) || defined(RC_INVOKED)) -#pragma pack(push,2) -#endif diff --git a/win32/include/winapi/pshpack4.h b/win32/include/winapi/pshpack4.h deleted file mode 100644 index 1c8e61d7..00000000 --- a/win32/include/winapi/pshpack4.h +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#if !(defined(lint) || defined(RC_INVOKED)) -#pragma pack(push,4) -#endif diff --git a/win32/include/winapi/pshpack8.h b/win32/include/winapi/pshpack8.h deleted file mode 100644 index 70a3c7f7..00000000 --- a/win32/include/winapi/pshpack8.h +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#if !(defined(lint) || defined(RC_INVOKED)) -#pragma pack(push,8) -#endif diff --git a/win32/include/winapi/qos.h b/win32/include/winapi/qos.h deleted file mode 100644 index 7fa6ad19..00000000 --- a/win32/include/winapi/qos.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef __QOS_H_ -#define __QOS_H_ - -typedef ULONG SERVICETYPE; - -#define SERVICETYPE_NOTRAFFIC 0x00000000 -#define SERVICETYPE_BESTEFFORT 0x00000001 -#define SERVICETYPE_CONTROLLEDLOAD 0x00000002 -#define SERVICETYPE_GUARANTEED 0x00000003 - -#define SERVICETYPE_NETWORK_UNAVAILABLE 0x00000004 -#define SERVICETYPE_GENERAL_INFORMATION 0x00000005 -#define SERVICETYPE_NOCHANGE 0x00000006 -#define SERVICETYPE_NONCONFORMING 0x00000009 -#define SERVICETYPE_NETWORK_CONTROL 0x0000000A -#define SERVICETYPE_QUALITATIVE 0x0000000D - -#define SERVICE_BESTEFFORT 0x80010000 -#define SERVICE_CONTROLLEDLOAD 0x80020000 -#define SERVICE_GUARANTEED 0x80040000 -#define SERVICE_QUALITATIVE 0x80200000 - -#define SERVICE_NO_TRAFFIC_CONTROL 0x81000000 - -#define SERVICE_NO_QOS_SIGNALING 0x40000000 - -typedef struct _flowspec { - ULONG TokenRate; - ULONG TokenBucketSize; - ULONG PeakBandwidth; - ULONG Latency; - ULONG DelayVariation; - SERVICETYPE ServiceType; - ULONG MaxSduSize; - ULONG MinimumPolicedSize; -} FLOWSPEC,*PFLOWSPEC,*LPFLOWSPEC; - -#define QOS_NOT_SPECIFIED 0xFFFFFFFF -#define POSITIVE_INFINITY_RATE 0xFFFFFFFE - -typedef struct { - ULONG ObjectType; - ULONG ObjectLength; -} QOS_OBJECT_HDR,*LPQOS_OBJECT_HDR; - -#define QOS_GENERAL_ID_BASE 2000 -#define QOS_OBJECT_END_OF_LIST (0x00000001 + QOS_GENERAL_ID_BASE) -#define QOS_OBJECT_SD_MODE (0x00000002 + QOS_GENERAL_ID_BASE) -#define QOS_OBJECT_SHAPING_RATE (0x00000003 + QOS_GENERAL_ID_BASE) -#define QOS_OBJECT_DESTADDR (0x00000004 + QOS_GENERAL_ID_BASE) - -typedef struct _QOS_SD_MODE { - QOS_OBJECT_HDR ObjectHdr; - ULONG ShapeDiscardMode; -} QOS_SD_MODE,*LPQOS_SD_MODE; - -#define TC_NONCONF_BORROW 0 -#define TC_NONCONF_SHAPE 1 -#define TC_NONCONF_DISCARD 2 -#define TC_NONCONF_BORROW_PLUS 3 - -typedef struct _QOS_SHAPING_RATE { - QOS_OBJECT_HDR ObjectHdr; - ULONG ShapingRate; -} QOS_SHAPING_RATE,*LPQOS_SHAPING_RATE; - -#endif diff --git a/win32/include/winapi/shellapi.h b/win32/include/winapi/shellapi.h deleted file mode 100644 index ce4e78ec..00000000 --- a/win32/include/winapi/shellapi.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _INC_SHELLAPI -#define _INC_SHELLAPI - -#ifndef WINSHELLAPI -#if !defined(_SHELL32_) -#define WINSHELLAPI DECLSPEC_IMPORT -#else -#define WINSHELLAPI -#endif -#endif - -#ifndef SHSTDAPI -#if !defined(_SHELL32_) -#define SHSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT WINAPI -#define SHSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI -#else -#define SHSTDAPI STDAPI -#define SHSTDAPI_(type) STDAPI_(type) -#endif -#endif - -/* SHDOCAPI[_] definitions not required in this TinyCC minimal header */ - -#if !defined(_WIN64) -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef UNICODE -#define ShellExecute ShellExecuteW -#define FindExecutable FindExecutableW -#else -#define ShellExecute ShellExecuteA -#define FindExecutable FindExecutableA -#endif - - /* minimal subset distributed with TinyCC. nShowCmd is at winuser.h */ - SHSTDAPI_(HINSTANCE) ShellExecuteA(HWND hwnd,LPCSTR lpOperation,LPCSTR lpFile,LPCSTR lpParameters,LPCSTR lpDirectory,INT nShowCmd); - SHSTDAPI_(HINSTANCE) ShellExecuteW(HWND hwnd,LPCWSTR lpOperation,LPCWSTR lpFile,LPCWSTR lpParameters,LPCWSTR lpDirectory,INT nShowCmd); - SHSTDAPI_(HINSTANCE) FindExecutableA(LPCSTR lpFile,LPCSTR lpDirectory,LPSTR lpResult); - SHSTDAPI_(HINSTANCE) FindExecutableW(LPCWSTR lpFile,LPCWSTR lpDirectory,LPWSTR lpResult); - SHSTDAPI_(LPWSTR *) CommandLineToArgvW(LPCWSTR lpCmdLine,int*pNumArgs); - -#ifdef __cplusplus -} -#endif - -#if !defined(_WIN64) -#include -#endif -#endif diff --git a/win32/include/winapi/winbase.h b/win32/include/winapi/winbase.h deleted file mode 100644 index f873601b..00000000 --- a/win32/include/winapi/winbase.h +++ /dev/null @@ -1,2958 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINBASE_ -#define _WINBASE_ - -#define WINADVAPI DECLSPEC_IMPORT -#define WINBASEAPI DECLSPEC_IMPORT -#define ZAWPROXYAPI DECLSPEC_IMPORT - -#ifdef __cplusplus -extern "C" { -#endif - -#define DefineHandleTable(w) ((w),TRUE) -#define LimitEmsPages(dw) -#define SetSwapAreaSize(w) (w) -#define LockSegment(w) GlobalFix((HANDLE)(w)) -#define UnlockSegment(w) GlobalUnfix((HANDLE)(w)) -#define GetCurrentTime() GetTickCount() - -#define Yield() - -#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1) -#define INVALID_FILE_SIZE ((DWORD)0xffffffff) -#define INVALID_SET_FILE_POINTER ((DWORD)-1) -#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) - -#define FILE_BEGIN 0 -#define FILE_CURRENT 1 -#define FILE_END 2 - -#define TIME_ZONE_ID_INVALID ((DWORD)0xffffffff) - -#define WAIT_FAILED ((DWORD)0xffffffff) -#define WAIT_OBJECT_0 ((STATUS_WAIT_0) + 0) -#define WAIT_ABANDONED ((STATUS_ABANDONED_WAIT_0) + 0) -#define WAIT_ABANDONED_0 ((STATUS_ABANDONED_WAIT_0) + 0) -#define WAIT_IO_COMPLETION STATUS_USER_APC -#define STILL_ACTIVE STATUS_PENDING -#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION -#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT -#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT -#define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP -#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED -#define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND -#define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO -#define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT -#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION -#define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW -#define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK -#define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW -#define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO -#define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW -#define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION -#define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR -#define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION -#define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION -#define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW -#define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION -#define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION -#define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE -#define EXCEPTION_POSSIBLE_DEADLOCK STATUS_POSSIBLE_DEADLOCK -#define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT -#define MoveMemory RtlMoveMemory -#define CopyMemory RtlCopyMemory -#define FillMemory RtlFillMemory -#define ZeroMemory RtlZeroMemory -#define SecureZeroMemory RtlSecureZeroMemory - -#define FILE_FLAG_WRITE_THROUGH 0x80000000 -#define FILE_FLAG_OVERLAPPED 0x40000000 -#define FILE_FLAG_NO_BUFFERING 0x20000000 -#define FILE_FLAG_RANDOM_ACCESS 0x10000000 -#define FILE_FLAG_SEQUENTIAL_SCAN 0x8000000 -#define FILE_FLAG_DELETE_ON_CLOSE 0x4000000 -#define FILE_FLAG_BACKUP_SEMANTICS 0x2000000 -#define FILE_FLAG_POSIX_SEMANTICS 0x1000000 -#define FILE_FLAG_OPEN_REPARSE_POINT 0x200000 -#define FILE_FLAG_OPEN_NO_RECALL 0x100000 -#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x80000 - -#define CREATE_NEW 1 -#define CREATE_ALWAYS 2 -#define OPEN_EXISTING 3 -#define OPEN_ALWAYS 4 -#define TRUNCATE_EXISTING 5 - -#define PROGRESS_CONTINUE 0 -#define PROGRESS_CANCEL 1 -#define PROGRESS_STOP 2 -#define PROGRESS_QUIET 3 - -#define CALLBACK_CHUNK_FINISHED 0x0 -#define CALLBACK_STREAM_SWITCH 0x1 - -#define COPY_FILE_FAIL_IF_EXISTS 0x1 -#define COPY_FILE_RESTARTABLE 0x2 -#define COPY_FILE_OPEN_SOURCE_FOR_WRITE 0x4 -#define COPY_FILE_ALLOW_DECRYPTED_DESTINATION 0x8 - -#define REPLACEFILE_WRITE_THROUGH 0x1 -#define REPLACEFILE_IGNORE_MERGE_ERRORS 0x2 - -#define PIPE_ACCESS_INBOUND 0x1 -#define PIPE_ACCESS_OUTBOUND 0x2 -#define PIPE_ACCESS_DUPLEX 0x3 - -#define PIPE_CLIENT_END 0x0 -#define PIPE_SERVER_END 0x1 - -#define PIPE_WAIT 0x0 -#define PIPE_NOWAIT 0x1 -#define PIPE_READMODE_BYTE 0x0 -#define PIPE_READMODE_MESSAGE 0x2 -#define PIPE_TYPE_BYTE 0x0 -#define PIPE_TYPE_MESSAGE 0x4 - -#define PIPE_UNLIMITED_INSTANCES 255 - -#define SECURITY_ANONYMOUS (SecurityAnonymous << 16) -#define SECURITY_IDENTIFICATION (SecurityIdentification << 16) -#define SECURITY_IMPERSONATION (SecurityImpersonation << 16) -#define SECURITY_DELEGATION (SecurityDelegation << 16) - -#define SECURITY_CONTEXT_TRACKING 0x40000 -#define SECURITY_EFFECTIVE_ONLY 0x80000 - -#define SECURITY_SQOS_PRESENT 0x100000 -#define SECURITY_VALID_SQOS_FLAGS 0x1f0000 - - typedef struct _OVERLAPPED { - ULONG_PTR Internal; - ULONG_PTR InternalHigh; - union { - struct { - DWORD Offset; - DWORD OffsetHigh; - }; - PVOID Pointer; - }; - HANDLE hEvent; - } OVERLAPPED,*LPOVERLAPPED; - - typedef struct _SECURITY_ATTRIBUTES { - DWORD nLength; - LPVOID lpSecurityDescriptor; - WINBOOL bInheritHandle; - } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES; - - typedef struct _PROCESS_INFORMATION { - HANDLE hProcess; - HANDLE hThread; - DWORD dwProcessId; - DWORD dwThreadId; - } PROCESS_INFORMATION,*PPROCESS_INFORMATION,*LPPROCESS_INFORMATION; - -#ifndef _FILETIME_ -#define _FILETIME_ - typedef struct _FILETIME { - DWORD dwLowDateTime; - DWORD dwHighDateTime; - } FILETIME,*PFILETIME,*LPFILETIME; -#endif - - typedef struct _SYSTEMTIME { - WORD wYear; - WORD wMonth; - WORD wDayOfWeek; - WORD wDay; - WORD wHour; - WORD wMinute; - WORD wSecond; - WORD wMilliseconds; - } SYSTEMTIME,*PSYSTEMTIME,*LPSYSTEMTIME; - - typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter); - typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; - typedef VOID (WINAPI *PFIBER_START_ROUTINE)(LPVOID lpFiberParameter); - typedef PFIBER_START_ROUTINE LPFIBER_START_ROUTINE; - - typedef RTL_CRITICAL_SECTION CRITICAL_SECTION; - typedef PRTL_CRITICAL_SECTION PCRITICAL_SECTION; - typedef PRTL_CRITICAL_SECTION LPCRITICAL_SECTION; - typedef RTL_CRITICAL_SECTION_DEBUG CRITICAL_SECTION_DEBUG; - typedef PRTL_CRITICAL_SECTION_DEBUG PCRITICAL_SECTION_DEBUG; - typedef PRTL_CRITICAL_SECTION_DEBUG LPCRITICAL_SECTION_DEBUG; - - WINBASEAPI PVOID WINAPI EncodePointer(PVOID Ptr); - WINBASEAPI PVOID WINAPI DecodePointer(PVOID Ptr); - WINBASEAPI PVOID WINAPI EncodeSystemPointer(PVOID Ptr); - WINBASEAPI PVOID WINAPI DecodeSystemPointer(PVOID Ptr); - -#ifdef I_X86_ - typedef PLDT_ENTRY LPLDT_ENTRY; -#else - typedef LPVOID LPLDT_ENTRY; -#endif - -#define MUTEX_MODIFY_STATE MUTANT_QUERY_STATE -#define MUTEX_ALL_ACCESS MUTANT_ALL_ACCESS - -#define SP_SERIALCOMM ((DWORD)0x1) - -#define PST_UNSPECIFIED ((DWORD)0x0) -#define PST_RS232 ((DWORD)0x1) -#define PST_PARALLELPORT ((DWORD)0x2) -#define PST_RS422 ((DWORD)0x3) -#define PST_RS423 ((DWORD)0x4) -#define PST_RS449 ((DWORD)0x5) -#define PST_MODEM ((DWORD)0x6) -#define PST_FAX ((DWORD)0x21) -#define PST_SCANNER ((DWORD)0x22) -#define PST_NETWORK_BRIDGE ((DWORD)0x100) -#define PST_LAT ((DWORD)0x101) -#define PST_TCPIP_TELNET ((DWORD)0x102) -#define PST_X25 ((DWORD)0x103) - -#define PCF_DTRDSR ((DWORD)0x1) -#define PCF_RTSCTS ((DWORD)0x2) -#define PCF_RLSD ((DWORD)0x4) -#define PCF_PARITY_CHECK ((DWORD)0x8) -#define PCF_XONXOFF ((DWORD)0x10) -#define PCF_SETXCHAR ((DWORD)0x20) -#define PCF_TOTALTIMEOUTS ((DWORD)0x40) -#define PCF_INTTIMEOUTS ((DWORD)0x80) -#define PCF_SPECIALCHARS ((DWORD)0x100) -#define PCF_16BITMODE ((DWORD)0x200) - -#define SP_PARITY ((DWORD)0x1) -#define SP_BAUD ((DWORD)0x2) -#define SP_DATABITS ((DWORD)0x4) -#define SP_STOPBITS ((DWORD)0x8) -#define SP_HANDSHAKING ((DWORD)0x10) -#define SP_PARITY_CHECK ((DWORD)0x20) -#define SP_RLSD ((DWORD)0x40) - -#define BAUD_075 ((DWORD)0x1) -#define BAUD_110 ((DWORD)0x2) -#define BAUD_134_5 ((DWORD)0x4) -#define BAUD_150 ((DWORD)0x8) -#define BAUD_300 ((DWORD)0x10) -#define BAUD_600 ((DWORD)0x20) -#define BAUD_1200 ((DWORD)0x40) -#define BAUD_1800 ((DWORD)0x80) -#define BAUD_2400 ((DWORD)0x100) -#define BAUD_4800 ((DWORD)0x200) -#define BAUD_7200 ((DWORD)0x400) -#define BAUD_9600 ((DWORD)0x800) -#define BAUD_14400 ((DWORD)0x1000) -#define BAUD_19200 ((DWORD)0x2000) -#define BAUD_38400 ((DWORD)0x4000) -#define BAUD_56K ((DWORD)0x8000) -#define BAUD_128K ((DWORD)0x10000) -#define BAUD_115200 ((DWORD)0x20000) -#define BAUD_57600 ((DWORD)0x40000) -#define BAUD_USER ((DWORD)0x10000000) - -#define DATABITS_5 ((WORD)0x1) -#define DATABITS_6 ((WORD)0x2) -#define DATABITS_7 ((WORD)0x4) -#define DATABITS_8 ((WORD)0x8) -#define DATABITS_16 ((WORD)0x10) -#define DATABITS_16X ((WORD)0x20) - -#define STOPBITS_10 ((WORD)0x1) -#define STOPBITS_15 ((WORD)0x2) -#define STOPBITS_20 ((WORD)0x4) -#define PARITY_NONE ((WORD)0x100) -#define PARITY_ODD ((WORD)0x200) -#define PARITY_EVEN ((WORD)0x400) -#define PARITY_MARK ((WORD)0x800) -#define PARITY_SPACE ((WORD)0x1000) - - typedef struct _COMMPROP { - WORD wPacketLength; - WORD wPacketVersion; - DWORD dwServiceMask; - DWORD dwReserved1; - DWORD dwMaxTxQueue; - DWORD dwMaxRxQueue; - DWORD dwMaxBaud; - DWORD dwProvSubType; - DWORD dwProvCapabilities; - DWORD dwSettableParams; - DWORD dwSettableBaud; - WORD wSettableData; - WORD wSettableStopParity; - DWORD dwCurrentTxQueue; - DWORD dwCurrentRxQueue; - DWORD dwProvSpec1; - DWORD dwProvSpec2; - WCHAR wcProvChar[1]; - } COMMPROP,*LPCOMMPROP; - -#define COMMPROP_INITIALIZED ((DWORD)0xE73CF52E) - - typedef struct _COMSTAT { - DWORD fCtsHold : 1; - DWORD fDsrHold : 1; - DWORD fRlsdHold : 1; - DWORD fXoffHold : 1; - DWORD fXoffSent : 1; - DWORD fEof : 1; - DWORD fTxim : 1; - DWORD fReserved : 25; - DWORD cbInQue; - DWORD cbOutQue; - } COMSTAT,*LPCOMSTAT; - -#define DTR_CONTROL_DISABLE 0x0 -#define DTR_CONTROL_ENABLE 0x1 -#define DTR_CONTROL_HANDSHAKE 0x2 - -#define RTS_CONTROL_DISABLE 0x0 -#define RTS_CONTROL_ENABLE 0x1 -#define RTS_CONTROL_HANDSHAKE 0x2 -#define RTS_CONTROL_TOGGLE 0x3 - - typedef struct _DCB { - DWORD DCBlength; - DWORD BaudRate; - DWORD fBinary: 1; - DWORD fParity: 1; - DWORD fOutxCtsFlow:1; - DWORD fOutxDsrFlow:1; - DWORD fDtrControl:2; - DWORD fDsrSensitivity:1; - DWORD fTXContinueOnXoff: 1; - DWORD fOutX: 1; - DWORD fInX: 1; - DWORD fErrorChar: 1; - DWORD fNull: 1; - DWORD fRtsControl:2; - DWORD fAbortOnError:1; - DWORD fDummy2:17; - WORD wReserved; - WORD XonLim; - WORD XoffLim; - BYTE ByteSize; - BYTE Parity; - BYTE StopBits; - char XonChar; - char XoffChar; - char ErrorChar; - char EofChar; - char EvtChar; - WORD wReserved1; - } DCB,*LPDCB; - - typedef struct _COMMTIMEOUTS { - DWORD ReadIntervalTimeout; - DWORD ReadTotalTimeoutMultiplier; - DWORD ReadTotalTimeoutConstant; - DWORD WriteTotalTimeoutMultiplier; - DWORD WriteTotalTimeoutConstant; - } COMMTIMEOUTS,*LPCOMMTIMEOUTS; - - typedef struct _COMMCONFIG { - DWORD dwSize; - WORD wVersion; - WORD wReserved; - DCB dcb; - DWORD dwProviderSubType; - DWORD dwProviderOffset; - DWORD dwProviderSize; - WCHAR wcProviderData[1]; - } COMMCONFIG,*LPCOMMCONFIG; - - typedef struct _SYSTEM_INFO { - union { - DWORD dwOemId; - struct { - WORD wProcessorArchitecture; - WORD wReserved; - }; - }; - DWORD dwPageSize; - LPVOID lpMinimumApplicationAddress; - LPVOID lpMaximumApplicationAddress; - DWORD_PTR dwActiveProcessorMask; - DWORD dwNumberOfProcessors; - DWORD dwProcessorType; - DWORD dwAllocationGranularity; - WORD wProcessorLevel; - WORD wProcessorRevision; - } SYSTEM_INFO,*LPSYSTEM_INFO; - -#define FreeModule(hLibModule) FreeLibrary((hLibModule)) -#define MakeProcInstance(lpProc,hInstance) (lpProc) -#define FreeProcInstance(lpProc) (lpProc) - -#define GMEM_FIXED 0x0 -#define GMEM_MOVEABLE 0x2 -#define GMEM_NOCOMPACT 0x10 -#define GMEM_NODISCARD 0x20 -#define GMEM_ZEROINIT 0x40 -#define GMEM_MODIFY 0x80 -#define GMEM_DISCARDABLE 0x100 -#define GMEM_NOT_BANKED 0x1000 -#define GMEM_SHARE 0x2000 -#define GMEM_DDESHARE 0x2000 -#define GMEM_NOTIFY 0x4000 -#define GMEM_LOWER GMEM_NOT_BANKED -#define GMEM_VALID_FLAGS 0x7F72 -#define GMEM_INVALID_HANDLE 0x8000 - -#define GHND (GMEM_MOVEABLE | GMEM_ZEROINIT) -#define GPTR (GMEM_FIXED | GMEM_ZEROINIT) - -#define GlobalLRUNewest(h) ((HANDLE)(h)) -#define GlobalLRUOldest(h) ((HANDLE)(h)) -#define GlobalDiscard(h) GlobalReAlloc((h),0,GMEM_MOVEABLE) - -#define GMEM_DISCARDED 0x4000 -#define GMEM_LOCKCOUNT 0xff - - typedef struct _MEMORYSTATUS { - DWORD dwLength; - DWORD dwMemoryLoad; - SIZE_T dwTotalPhys; - SIZE_T dwAvailPhys; - SIZE_T dwTotalPageFile; - SIZE_T dwAvailPageFile; - SIZE_T dwTotalVirtual; - SIZE_T dwAvailVirtual; - } MEMORYSTATUS,*LPMEMORYSTATUS; - -#define LMEM_FIXED 0x0 -#define LMEM_MOVEABLE 0x2 -#define LMEM_NOCOMPACT 0x10 -#define LMEM_NODISCARD 0x20 -#define LMEM_ZEROINIT 0x40 -#define LMEM_MODIFY 0x80 -#define LMEM_DISCARDABLE 0xf00 -#define LMEM_VALID_FLAGS 0xf72 -#define LMEM_INVALID_HANDLE 0x8000 - -#define LHND (LMEM_MOVEABLE | LMEM_ZEROINIT) -#define LPTR (LMEM_FIXED | LMEM_ZEROINIT) - -#define NONZEROLHND (LMEM_MOVEABLE) -#define NONZEROLPTR (LMEM_FIXED) - -#define LocalDiscard(h) LocalReAlloc((h),0,LMEM_MOVEABLE) - -#define LMEM_DISCARDED 0x4000 -#define LMEM_LOCKCOUNT 0xff - -#define DEBUG_PROCESS 0x1 -#define DEBUG_ONLY_THIS_PROCESS 0x2 -#define CREATE_SUSPENDED 0x4 -#define DETACHED_PROCESS 0x8 -#define CREATE_NEW_CONSOLE 0x10 -#define NORMAL_PRIORITY_CLASS 0x20 -#define IDLE_PRIORITY_CLASS 0x40 -#define HIGH_PRIORITY_CLASS 0x80 -#define REALTIME_PRIORITY_CLASS 0x100 -#define CREATE_NEW_PROCESS_GROUP 0x200 -#define CREATE_UNICODE_ENVIRONMENT 0x400 -#define CREATE_SEPARATE_WOW_VDM 0x800 -#define CREATE_SHARED_WOW_VDM 0x1000 -#define CREATE_FORCEDOS 0x2000 -#define BELOW_NORMAL_PRIORITY_CLASS 0x4000 -#define ABOVE_NORMAL_PRIORITY_CLASS 0x8000 -#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x10000 - -#define CREATE_BREAKAWAY_FROM_JOB 0x1000000 -#define CREATE_PRESERVE_CODE_AUTHZ_LEVEL 0x2000000 - -#define CREATE_DEFAULT_ERROR_MODE 0x4000000 -#define CREATE_NO_WINDOW 0x8000000 - -#define PROFILE_USER 0x10000000 -#define PROFILE_KERNEL 0x20000000 -#define PROFILE_SERVER 0x40000000 - -#define CREATE_IGNORE_SYSTEM_DEFAULT 0x80000000 - -#define THREAD_PRIORITY_LOWEST THREAD_BASE_PRIORITY_MIN -#define THREAD_PRIORITY_BELOW_NORMAL (THREAD_PRIORITY_LOWEST+1) -#define THREAD_PRIORITY_NORMAL 0 -#define THREAD_PRIORITY_HIGHEST THREAD_BASE_PRIORITY_MAX -#define THREAD_PRIORITY_ABOVE_NORMAL (THREAD_PRIORITY_HIGHEST-1) -#define THREAD_PRIORITY_ERROR_RETURN (MAXLONG) - -#define THREAD_PRIORITY_TIME_CRITICAL THREAD_BASE_PRIORITY_LOWRT -#define THREAD_PRIORITY_IDLE THREAD_BASE_PRIORITY_IDLE - -#define EXCEPTION_DEBUG_EVENT 1 -#define CREATE_THREAD_DEBUG_EVENT 2 -#define CREATE_PROCESS_DEBUG_EVENT 3 -#define EXIT_THREAD_DEBUG_EVENT 4 -#define EXIT_PROCESS_DEBUG_EVENT 5 -#define LOAD_DLL_DEBUG_EVENT 6 -#define UNLOAD_DLL_DEBUG_EVENT 7 -#define OUTPUT_DEBUG_STRING_EVENT 8 -#define RIP_EVENT 9 - - typedef struct _EXCEPTION_DEBUG_INFO { - EXCEPTION_RECORD ExceptionRecord; - DWORD dwFirstChance; - } EXCEPTION_DEBUG_INFO,*LPEXCEPTION_DEBUG_INFO; - - typedef struct _CREATE_THREAD_DEBUG_INFO { - HANDLE hThread; - LPVOID lpThreadLocalBase; - LPTHREAD_START_ROUTINE lpStartAddress; - } CREATE_THREAD_DEBUG_INFO,*LPCREATE_THREAD_DEBUG_INFO; - - typedef struct _CREATE_PROCESS_DEBUG_INFO { - HANDLE hFile; - HANDLE hProcess; - HANDLE hThread; - LPVOID lpBaseOfImage; - DWORD dwDebugInfoFileOffset; - DWORD nDebugInfoSize; - LPVOID lpThreadLocalBase; - LPTHREAD_START_ROUTINE lpStartAddress; - LPVOID lpImageName; - WORD fUnicode; - } CREATE_PROCESS_DEBUG_INFO,*LPCREATE_PROCESS_DEBUG_INFO; - - typedef struct _EXIT_THREAD_DEBUG_INFO { - DWORD dwExitCode; - } EXIT_THREAD_DEBUG_INFO,*LPEXIT_THREAD_DEBUG_INFO; - - typedef struct _EXIT_PROCESS_DEBUG_INFO { - DWORD dwExitCode; - } EXIT_PROCESS_DEBUG_INFO,*LPEXIT_PROCESS_DEBUG_INFO; - - typedef struct _LOAD_DLL_DEBUG_INFO { - HANDLE hFile; - LPVOID lpBaseOfDll; - DWORD dwDebugInfoFileOffset; - DWORD nDebugInfoSize; - LPVOID lpImageName; - WORD fUnicode; - } LOAD_DLL_DEBUG_INFO,*LPLOAD_DLL_DEBUG_INFO; - - typedef struct _UNLOAD_DLL_DEBUG_INFO { - LPVOID lpBaseOfDll; - } UNLOAD_DLL_DEBUG_INFO,*LPUNLOAD_DLL_DEBUG_INFO; - - typedef struct _OUTPUT_DEBUG_STRING_INFO { - LPSTR lpDebugStringData; - WORD fUnicode; - WORD nDebugStringLength; - } OUTPUT_DEBUG_STRING_INFO,*LPOUTPUT_DEBUG_STRING_INFO; - - typedef struct _RIP_INFO { - DWORD dwError; - DWORD dwType; - } RIP_INFO,*LPRIP_INFO; - - typedef struct _DEBUG_EVENT { - DWORD dwDebugEventCode; - DWORD dwProcessId; - DWORD dwThreadId; - union { - EXCEPTION_DEBUG_INFO Exception; - CREATE_THREAD_DEBUG_INFO CreateThread; - CREATE_PROCESS_DEBUG_INFO CreateProcessInfo; - EXIT_THREAD_DEBUG_INFO ExitThread; - EXIT_PROCESS_DEBUG_INFO ExitProcess; - LOAD_DLL_DEBUG_INFO LoadDll; - UNLOAD_DLL_DEBUG_INFO UnloadDll; - OUTPUT_DEBUG_STRING_INFO DebugString; - RIP_INFO RipInfo; - } u; - } DEBUG_EVENT,*LPDEBUG_EVENT; - - typedef PCONTEXT LPCONTEXT; - typedef PEXCEPTION_RECORD LPEXCEPTION_RECORD; - typedef PEXCEPTION_POINTERS LPEXCEPTION_POINTERS; - -#define DRIVE_UNKNOWN 0 -#define DRIVE_NO_ROOT_DIR 1 -#define DRIVE_REMOVABLE 2 -#define DRIVE_FIXED 3 -#define DRIVE_REMOTE 4 -#define DRIVE_CDROM 5 -#define DRIVE_RAMDISK 6 - -#define GetFreeSpace(w) (0x100000L) -#define FILE_TYPE_UNKNOWN 0x0 -#define FILE_TYPE_DISK 0x1 -#define FILE_TYPE_CHAR 0x2 -#define FILE_TYPE_PIPE 0x3 -#define FILE_TYPE_REMOTE 0x8000 - -#define STD_INPUT_HANDLE ((DWORD)-10) -#define STD_OUTPUT_HANDLE ((DWORD)-11) -#define STD_ERROR_HANDLE ((DWORD)-12) - -#define NOPARITY 0 -#define ODDPARITY 1 -#define EVENPARITY 2 -#define MARKPARITY 3 -#define SPACEPARITY 4 - -#define ONESTOPBIT 0 -#define ONE5STOPBITS 1 -#define TWOSTOPBITS 2 - -#define IGNORE 0 -#define INFINITE 0xffffffff - -#define CBR_110 110 -#define CBR_300 300 -#define CBR_600 600 -#define CBR_1200 1200 -#define CBR_2400 2400 -#define CBR_4800 4800 -#define CBR_9600 9600 -#define CBR_14400 14400 -#define CBR_19200 19200 -#define CBR_38400 38400 -#define CBR_56000 56000 -#define CBR_57600 57600 -#define CBR_115200 115200 -#define CBR_128000 128000 -#define CBR_256000 256000 - -#define CE_RXOVER 0x1 -#define CE_OVERRUN 0x2 -#define CE_RXPARITY 0x4 -#define CE_FRAME 0x8 -#define CE_BREAK 0x10 -#define CE_TXFULL 0x100 -#define CE_PTO 0x200 -#define CE_IOE 0x400 -#define CE_DNS 0x800 -#define CE_OOP 0x1000 -#define CE_MODE 0x8000 - -#define IE_BADID (-1) -#define IE_OPEN (-2) -#define IE_NOPEN (-3) -#define IE_MEMORY (-4) -#define IE_DEFAULT (-5) -#define IE_HARDWARE (-10) -#define IE_BYTESIZE (-11) -#define IE_BAUDRATE (-12) - -#define EV_RXCHAR 0x1 -#define EV_RXFLAG 0x2 -#define EV_TXEMPTY 0x4 -#define EV_CTS 0x8 -#define EV_DSR 0x10 -#define EV_RLSD 0x20 -#define EV_BREAK 0x40 -#define EV_ERR 0x80 -#define EV_RING 0x100 -#define EV_PERR 0x200 -#define EV_RX80FULL 0x400 -#define EV_EVENT1 0x800 -#define EV_EVENT2 0x1000 - -#define SETXOFF 1 -#define SETXON 2 -#define SETRTS 3 -#define CLRRTS 4 -#define SETDTR 5 -#define CLRDTR 6 -#define RESETDEV 7 -#define SETBREAK 8 -#define CLRBREAK 9 - -#define PURGE_TXABORT 0x1 -#define PURGE_RXABORT 0x2 -#define PURGE_TXCLEAR 0x4 -#define PURGE_RXCLEAR 0x8 - -#define LPTx 0x80 - -#define MS_CTS_ON ((DWORD)0x10) -#define MS_DSR_ON ((DWORD)0x20) -#define MS_RING_ON ((DWORD)0x40) -#define MS_RLSD_ON ((DWORD)0x80) - -#define S_QUEUEEMPTY 0 -#define S_THRESHOLD 1 -#define S_ALLTHRESHOLD 2 - -#define S_NORMAL 0 -#define S_LEGATO 1 -#define S_STACCATO 2 - -#define S_PERIOD512 0 -#define S_PERIOD1024 1 -#define S_PERIOD2048 2 -#define S_PERIODVOICE 3 -#define S_WHITE512 4 -#define S_WHITE1024 5 -#define S_WHITE2048 6 -#define S_WHITEVOICE 7 - -#define S_SERDVNA (-1) -#define S_SEROFM (-2) -#define S_SERMACT (-3) -#define S_SERQFUL (-4) -#define S_SERBDNT (-5) -#define S_SERDLN (-6) -#define S_SERDCC (-7) -#define S_SERDTP (-8) -#define S_SERDVL (-9) -#define S_SERDMD (-10) -#define S_SERDSH (-11) -#define S_SERDPT (-12) -#define S_SERDFQ (-13) -#define S_SERDDR (-14) -#define S_SERDSR (-15) -#define S_SERDST (-16) - -#define NMPWAIT_WAIT_FOREVER 0xffffffff -#define NMPWAIT_NOWAIT 0x1 -#define NMPWAIT_USE_DEFAULT_WAIT 0x0 - -#define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES -#define FS_CASE_SENSITIVE FILE_CASE_SENSITIVE_SEARCH -#define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK -#define FS_PERSISTENT_ACLS FILE_PERSISTENT_ACLS -#define FS_VOL_IS_COMPRESSED FILE_VOLUME_IS_COMPRESSED -#define FS_FILE_COMPRESSION FILE_FILE_COMPRESSION -#define FS_FILE_ENCRYPTION FILE_SUPPORTS_ENCRYPTION - -#define FILE_MAP_COPY SECTION_QUERY -#define FILE_MAP_WRITE SECTION_MAP_WRITE -#define FILE_MAP_READ SECTION_MAP_READ -#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS -#define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT - -#define OF_READ 0x0 -#define OF_WRITE 0x1 -#define OF_READWRITE 0x2 -#define OF_SHARE_COMPAT 0x0 -#define OF_SHARE_EXCLUSIVE 0x10 -#define OF_SHARE_DENY_WRITE 0x20 -#define OF_SHARE_DENY_READ 0x30 -#define OF_SHARE_DENY_NONE 0x40 -#define OF_PARSE 0x100 -#define OF_DELETE 0x200 -#define OF_VERIFY 0x400 -#define OF_CANCEL 0x800 -#define OF_CREATE 0x1000 -#define OF_PROMPT 0x2000 -#define OF_EXIST 0x4000 -#define OF_REOPEN 0x8000 - -#define OFS_MAXPATHNAME 128 - typedef struct _OFSTRUCT { - BYTE cBytes; - BYTE fFixedDisk; - WORD nErrCode; - WORD Reserved1; - WORD Reserved2; - CHAR szPathName[OFS_MAXPATHNAME]; - } OFSTRUCT,*LPOFSTRUCT,*POFSTRUCT; - -#ifndef NOWINBASEINTERLOCK - -#ifndef _NTOS_ - -#if defined(__ia64__) && !defined(RC_INVOKED) - -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire _InterlockedIncrement_acq -#define InterlockedIncrementRelease _InterlockedIncrement_rel -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire _InterlockedDecrement_acq -#define InterlockedDecrementRelease _InterlockedDecrement_rel -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq -#define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer_rel -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer_acq - -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAcquire64 _InterlockedExchange64_acq -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 _InterlockedCompareExchange64_acq -#define InterlockedCompareExchangeRelease64 _InterlockedCompareExchange64_rel - - LONGLONG __cdecl InterlockedIncrement64(LONGLONG volatile *Addend); - LONGLONG __cdecl InterlockedDecrement64(LONGLONG volatile *Addend); - LONG __cdecl InterlockedIncrementAcquire(LONG volatile *Addend); - LONG __cdecl InterlockedDecrementAcquire(LONG volatile *Addend); - LONG __cdecl InterlockedIncrementRelease(LONG volatile *Addend); - LONG __cdecl InterlockedDecrementRelease(LONG volatile *Addend); - LONGLONG __cdecl InterlockedExchange64 (LONGLONG volatile *Target,LONGLONG Value); - LONGLONG __cdecl InterlockedExchangeAcquire64 (LONGLONG volatile *Target,LONGLONG Value); - LONGLONG __cdecl InterlockedExchangeAdd64 (LONGLONG volatile *Addend,LONGLONG Value); - LONGLONG __cdecl InterlockedCompareExchange64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); - LONGLONG __cdecl InterlockedCompareExchangeAcquire64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); - LONGLONG __cdecl InterlockedCompareExchangeRelease64 (LONGLONG volatile *Destination,LONGLONG ExChange,LONGLONG Comperand); - LONG __cdecl InterlockedIncrement(LONG volatile *lpAddend); - LONG __cdecl InterlockedDecrement(LONG volatile *lpAddend); - LONG __cdecl InterlockedExchange(LONG volatile *Target,LONG Value); - LONG __cdecl InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); - LONG __cdecl InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); - LONG __cdecl InterlockedCompareExchangeRelease(LONG volatile *Destination,LONG ExChange,LONG Comperand); - LONG __cdecl InterlockedCompareExchangeAcquire(LONG volatile *Destination,LONG ExChange,LONG Comperand); - PVOID __cdecl InterlockedExchangePointer(PVOID volatile *Target,PVOID Value); - PVOID __cdecl InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand); - PVOID __cdecl InterlockedCompareExchangePointerAcquire(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); - PVOID __cdecl InterlockedCompareExchangePointerRelease(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); - -#ifndef InterlockedAnd -#define InterlockedAnd InterlockedAnd_Inline - __CRT_INLINE LONG InterlockedAnd_Inline(LONG volatile *Target,LONG Set) { - LONG i; - LONG j; - j = *Target; - do { - i = j; - j = InterlockedCompareExchange(Target,i & Set,i); - } while(i!=j); - return j; - } -#endif - -#ifndef InterlockedOr -#define InterlockedOr InterlockedOr_Inline - - __CRT_INLINE LONG InterlockedOr_Inline(LONG volatile *Target,LONG Set) { - LONG i; - LONG j; - j = *Target; - do { - i = j; - j = InterlockedCompareExchange(Target,i | Set,i); - } while(i!=j); - return j; - } -#endif - -#ifndef InterlockedXor -#define InterlockedXor InterlockedXor_Inline - - __CRT_INLINE LONG InterlockedXor_Inline(LONG volatile *Target,LONG Set) { - LONG i; - LONG j; - j = *Target; - do { - i = j; - j = InterlockedCompareExchange(Target,i ^ Set,i); - } while(i!=j); - return j; - } -#endif - -#ifndef !defined (InterlockedAnd64) -#define InterlockedAnd64 InterlockedAnd64_Inline - - __CRT_INLINE LONGLONG InterlockedAnd64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Destination; - } while(InterlockedCompareExchange64(Destination,Old & Value,Old)!=Old); - return Old; - } -#endif - -#ifndef InterlockedOr64 -#define InterlockedOr64 InterlockedOr64_Inline - - __CRT_INLINE LONGLONG InterlockedOr64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Destination; - } while(InterlockedCompareExchange64(Destination,Old | Value,Old)!=Old); - return Old; - } -#endif - -#ifndef InterlockedXor64 -#define InterlockedXor64 InterlockedXor64_Inline - - __CRT_INLINE LONGLONG InterlockedXor64_Inline (LONGLONG volatile *Destination,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Destination; - } while(InterlockedCompareExchange64(Destination,Old ^ Value,Old)!=Old); - return Old; - } -#endif - -#ifndef InterlockedBitTestAndSet -#define InterlockedBitTestAndSet InterlockedBitTestAndSet_Inline - - __CRT_INLINE BOOLEAN InterlockedBitTestAndSet_Inline(LONG *Base,LONG Bit) { - LONG tBit; - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN)((InterlockedOr(&Base[Bit/(sizeof(*Base)*8)],tBit)&tBit)!=0); - } -#endif - -#ifndef InterlockedBitTestAndReset -#define InterlockedBitTestAndReset InterlockedBitTestAndReset_Inline - - __CRT_INLINE BOOLEAN InterlockedBitTestAndReset_Inline(LONG *Base,LONG Bit) { - LONG tBit; - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN)((InterlockedAnd(&Base[Bit/(sizeof(*Base)*8)],~tBit)&tBit)!=0); - } -#endif - -#ifndef InterlockedBitTestAndComplement -#define InterlockedBitTestAndComplement InterlockedBitTestAndComplement_Inline - - __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement_Inline(LONG *Base,LONG Bit) { - LONG tBit; - tBit = 1<<(Bit & (sizeof (*Base)*8-1)); - return (BOOLEAN)((InterlockedXor(&Base[Bit/(sizeof(*Base)*8)],tBit)&tBit)!=0); - } -#endif -#elif defined(__x86_64) && !defined(RC_INVOKED) - -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire InterlockedIncrement -#define InterlockedIncrementRelease InterlockedIncrement -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire InterlockedDecrement -#define InterlockedDecrementRelease InterlockedDecrement -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire InterlockedCompareExchange -#define InterlockedCompareExchangeRelease InterlockedCompareExchange -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer -#define InterlockedAnd64 _InterlockedAnd64 -#define InterlockedOr64 _InterlockedOr64 -#define InterlockedXor64 _InterlockedXor64 -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 -#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 - - LONG InterlockedIncrement(LONG volatile *Addend); - LONG InterlockedDecrement(LONG volatile *Addend); - LONG InterlockedExchange(LONG volatile *Target,LONG Value); - LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); - LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand); - PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID Exchange,PVOID Comperand); - PVOID InterlockedExchangePointer(PVOID volatile *Target,PVOID Value); - LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value); - LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value); - LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value); - LONG64 InterlockedIncrement64(LONG64 volatile *Addend); - LONG64 InterlockedDecrement64(LONG64 volatile *Addend); - LONG64 InterlockedExchange64(LONG64 volatile *Target,LONG64 Value); - LONG64 InterlockedExchangeAdd64(LONG64 volatile *Addend,LONG64 Value); - LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination,LONG64 ExChange,LONG64 Comperand); -#else - LONG WINAPI InterlockedIncrement(LONG volatile *lpAddend); - LONG WINAPI InterlockedDecrement(LONG volatile *lpAddend); - LONG WINAPI InterlockedExchange(LONG volatile *Target,LONG Value); - -#define InterlockedExchangePointer(Target,Value) (PVOID)InterlockedExchange((PLONG)(Target),(LONG)(Value)) - - LONG WINAPI InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); - LONG WINAPI InterlockedCompareExchange(LONG volatile *Destination,LONG Exchange,LONG Comperand); - LONGLONG WINAPI InterlockedCompareExchange64(LONGLONG volatile *Destination,LONGLONG Exchange,LONGLONG Comperand); - - __CRT_INLINE LONGLONG InterlockedAnd64 (LONGLONG volatile *Destination,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Destination; - } while(InterlockedCompareExchange64(Destination,Old & Value,Old)!=Old); - return Old; - } - - __CRT_INLINE LONGLONG InterlockedOr64 (LONGLONG volatile *Destination,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Destination; - } while(InterlockedCompareExchange64(Destination,Old | Value,Old)!=Old); - return Old; - } - - __CRT_INLINE LONGLONG InterlockedXor64 (LONGLONG volatile *Destination,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Destination; - } while(InterlockedCompareExchange64(Destination,Old ^ Value,Old)!=Old); - - return Old; - } - - __CRT_INLINE LONGLONG InterlockedIncrement64(LONGLONG volatile *Addend) { - LONGLONG Old; - do { - Old = *Addend; - } while(InterlockedCompareExchange64(Addend,Old + 1,Old)!=Old); - return Old + 1; - } - - __CRT_INLINE LONGLONG InterlockedDecrement64(LONGLONG volatile *Addend) { - LONGLONG Old; - do { - Old = *Addend; - } while(InterlockedCompareExchange64(Addend,Old - 1,Old)!=Old); - return Old - 1; - } - - __CRT_INLINE LONGLONG InterlockedExchange64(LONGLONG volatile *Target,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Target; - } while(InterlockedCompareExchange64(Target,Value,Old)!=Old); - return Old; - } - - __CRT_INLINE LONGLONG InterlockedExchangeAdd64(LONGLONG volatile *Addend,LONGLONG Value) { - LONGLONG Old; - do { - Old = *Addend; - } while(InterlockedCompareExchange64(Addend,Old + Value,Old)!=Old); - return Old; - } - -#ifdef __cplusplus - __CRT_INLINE PVOID __cdecl __InlineInterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) { - return((PVOID)(LONG_PTR)InterlockedCompareExchange((LONG volatile *)Destination,(LONG)(LONG_PTR)ExChange,(LONG)(LONG_PTR)Comperand)); - } -#define InterlockedCompareExchangePointer __InlineInterlockedCompareExchangePointer -#else -#define InterlockedCompareExchangePointer(Destination,ExChange,Comperand)(PVOID)(LONG_PTR)InterlockedCompareExchange((LONG volatile *)(Destination),(LONG)(LONG_PTR)(ExChange),(LONG)(LONG_PTR)(Comperand)) -#endif - -#define InterlockedIncrementAcquire InterlockedIncrement -#define InterlockedIncrementRelease InterlockedIncrement -#define InterlockedDecrementAcquire InterlockedDecrement -#define InterlockedDecrementRelease InterlockedDecrement -#define InterlockedIncrementAcquire InterlockedIncrement -#define InterlockedIncrementRelease InterlockedIncrement -#define InterlockedCompareExchangeAcquire InterlockedCompareExchange -#define InterlockedCompareExchangeRelease InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 -#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 -#define InterlockedCompareExchangePointerAcquire InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease InterlockedCompareExchangePointer -#endif - -#if defined(_SLIST_HEADER_) && !defined(_NTOSP_) - WINBASEAPI VOID WINAPI InitializeSListHead(PSLIST_HEADER ListHead); - WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead); - WINBASEAPI PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER ListHead,PSLIST_ENTRY ListEntry); - WINBASEAPI PSLIST_ENTRY WINAPI InterlockedFlushSList(PSLIST_HEADER ListHead); - WINBASEAPI USHORT WINAPI QueryDepthSList(PSLIST_HEADER ListHead); -#endif -#endif -#endif - - WINBASEAPI WINBOOL WINAPI FreeResource(HGLOBAL hResData); - WINBASEAPI LPVOID WINAPI LockResource(HGLOBAL hResData); - -#define UnlockResource(hResData) ((hResData),0) -#define MAXINTATOM 0xC000 -#define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) -#define INVALID_ATOM ((ATOM)0) - - int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd); - WINBASEAPI WINBOOL WINAPI FreeLibrary(HMODULE hLibModule); - WINBASEAPI DECLSPEC_NORETURN VOID WINAPI FreeLibraryAndExitThread(HMODULE hLibModule,DWORD dwExitCode); - WINBASEAPI WINBOOL WINAPI DisableThreadLibraryCalls(HMODULE hLibModule); - WINBASEAPI FARPROC WINAPI GetProcAddress(HMODULE hModule,LPCSTR lpProcName); - WINBASEAPI DWORD WINAPI GetVersion(VOID); - WINBASEAPI HGLOBAL WINAPI GlobalAlloc(UINT uFlags,SIZE_T dwBytes); - WINBASEAPI HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hMem,SIZE_T dwBytes,UINT uFlags); - WINBASEAPI SIZE_T WINAPI GlobalSize(HGLOBAL hMem); - WINBASEAPI UINT WINAPI GlobalFlags(HGLOBAL hMem); - WINBASEAPI LPVOID WINAPI GlobalLock(HGLOBAL hMem); - WINBASEAPI HGLOBAL WINAPI GlobalHandle(LPCVOID pMem); - WINBASEAPI WINBOOL WINAPI GlobalUnlock(HGLOBAL hMem); - WINBASEAPI HGLOBAL WINAPI GlobalFree(HGLOBAL hMem); - WINBASEAPI SIZE_T WINAPI GlobalCompact(DWORD dwMinFree); - WINBASEAPI VOID WINAPI GlobalFix(HGLOBAL hMem); - WINBASEAPI VOID WINAPI GlobalUnfix(HGLOBAL hMem); - WINBASEAPI LPVOID WINAPI GlobalWire(HGLOBAL hMem); - WINBASEAPI WINBOOL WINAPI GlobalUnWire(HGLOBAL hMem); - WINBASEAPI VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer); - - typedef struct _MEMORYSTATUSEX { - DWORD dwLength; - DWORD dwMemoryLoad; - DWORDLONG ullTotalPhys; - DWORDLONG ullAvailPhys; - DWORDLONG ullTotalPageFile; - DWORDLONG ullAvailPageFile; - DWORDLONG ullTotalVirtual; - DWORDLONG ullAvailVirtual; - DWORDLONG ullAvailExtendedVirtual; - } MEMORYSTATUSEX,*LPMEMORYSTATUSEX; - - WINBASEAPI WINBOOL WINAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer); - WINBASEAPI HLOCAL WINAPI LocalAlloc(UINT uFlags,SIZE_T uBytes); - WINBASEAPI HLOCAL WINAPI LocalReAlloc(HLOCAL hMem,SIZE_T uBytes,UINT uFlags); - WINBASEAPI LPVOID WINAPI LocalLock(HLOCAL hMem); - WINBASEAPI HLOCAL WINAPI LocalHandle(LPCVOID pMem); - WINBASEAPI WINBOOL WINAPI LocalUnlock(HLOCAL hMem); - WINBASEAPI SIZE_T WINAPI LocalSize(HLOCAL hMem); - WINBASEAPI UINT WINAPI LocalFlags(HLOCAL hMem); - WINBASEAPI HLOCAL WINAPI LocalFree(HLOCAL hMem); - WINBASEAPI SIZE_T WINAPI LocalShrink(HLOCAL hMem,UINT cbNewSize); - WINBASEAPI SIZE_T WINAPI LocalCompact(UINT uMinFree); - WINBASEAPI WINBOOL WINAPI FlushInstructionCache(HANDLE hProcess,LPCVOID lpBaseAddress,SIZE_T dwSize); - WINBASEAPI LPVOID WINAPI VirtualAlloc(LPVOID lpAddress,SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect); - WINBASEAPI WINBOOL WINAPI VirtualFree(LPVOID lpAddress,SIZE_T dwSize,DWORD dwFreeType); - WINBASEAPI WINBOOL WINAPI VirtualProtect(LPVOID lpAddress,SIZE_T dwSize,DWORD flNewProtect,PDWORD lpflOldProtect); - WINBASEAPI SIZE_T WINAPI VirtualQuery(LPCVOID lpAddress,PMEMORY_BASIC_INFORMATION lpBuffer,SIZE_T dwLength); - WINBASEAPI LPVOID WINAPI VirtualAllocEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD flAllocationType,DWORD flProtect); - WINBASEAPI UINT WINAPI GetWriteWatch(DWORD dwFlags,PVOID lpBaseAddress,SIZE_T dwRegionSize,PVOID *lpAddresses,ULONG_PTR *lpdwCount,PULONG lpdwGranularity); - WINBASEAPI UINT WINAPI ResetWriteWatch(LPVOID lpBaseAddress,SIZE_T dwRegionSize); - WINBASEAPI SIZE_T WINAPI GetLargePageMinimum(VOID); - WINBASEAPI UINT WINAPI EnumSystemFirmwareTables(DWORD FirmwareTableProviderSignature,PVOID pFirmwareTableEnumBuffer,DWORD BufferSize); - WINBASEAPI UINT WINAPI GetSystemFirmwareTable(DWORD FirmwareTableProviderSignature,DWORD FirmwareTableID,PVOID pFirmwareTableBuffer,DWORD BufferSize); - WINBASEAPI WINBOOL WINAPI VirtualFreeEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD dwFreeType); - WINBASEAPI WINBOOL WINAPI VirtualProtectEx(HANDLE hProcess,LPVOID lpAddress,SIZE_T dwSize,DWORD flNewProtect,PDWORD lpflOldProtect); - WINBASEAPI SIZE_T WINAPI VirtualQueryEx(HANDLE hProcess,LPCVOID lpAddress,PMEMORY_BASIC_INFORMATION lpBuffer,SIZE_T dwLength); - WINBASEAPI HANDLE WINAPI HeapCreate(DWORD flOptions,SIZE_T dwInitialSize,SIZE_T dwMaximumSize); - WINBASEAPI WINBOOL WINAPI HeapDestroy(HANDLE hHeap); - WINBASEAPI LPVOID WINAPI HeapAlloc(HANDLE hHeap,DWORD dwFlags,SIZE_T dwBytes); - WINBASEAPI LPVOID WINAPI HeapReAlloc(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem,SIZE_T dwBytes); - WINBASEAPI WINBOOL WINAPI HeapFree(HANDLE hHeap,DWORD dwFlags,LPVOID lpMem); - WINBASEAPI SIZE_T WINAPI HeapSize(HANDLE hHeap,DWORD dwFlags,LPCVOID lpMem); - WINBASEAPI WINBOOL WINAPI HeapValidate(HANDLE hHeap,DWORD dwFlags,LPCVOID lpMem); - WINBASEAPI SIZE_T WINAPI HeapCompact(HANDLE hHeap,DWORD dwFlags); - WINBASEAPI HANDLE WINAPI GetProcessHeap(VOID); - WINBASEAPI DWORD WINAPI GetProcessHeaps(DWORD NumberOfHeaps,PHANDLE ProcessHeaps); - - typedef struct _PROCESS_HEAP_ENTRY { - PVOID lpData; - DWORD cbData; - BYTE cbOverhead; - BYTE iRegionIndex; - WORD wFlags; - union { - struct { - HANDLE hMem; - DWORD dwReserved[3]; - } Block; - struct { - DWORD dwCommittedSize; - DWORD dwUnCommittedSize; - LPVOID lpFirstBlock; - LPVOID lpLastBlock; - } Region; - }; - } PROCESS_HEAP_ENTRY,*LPPROCESS_HEAP_ENTRY,*PPROCESS_HEAP_ENTRY; - -#define PROCESS_HEAP_REGION 0x1 -#define PROCESS_HEAP_UNCOMMITTED_RANGE 0x2 -#define PROCESS_HEAP_ENTRY_BUSY 0x4 -#define PROCESS_HEAP_ENTRY_MOVEABLE 0x10 -#define PROCESS_HEAP_ENTRY_DDESHARE 0x20 - - WINBASEAPI WINBOOL WINAPI HeapLock(HANDLE hHeap); - WINBASEAPI WINBOOL WINAPI HeapUnlock(HANDLE hHeap); - WINBASEAPI WINBOOL WINAPI HeapWalk(HANDLE hHeap,LPPROCESS_HEAP_ENTRY lpEntry); - WINBASEAPI WINBOOL WINAPI HeapSetInformation(HANDLE HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength); - WINBASEAPI WINBOOL WINAPI HeapQueryInformation(HANDLE HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength); - -#define SCS_32BIT_BINARY 0 -#define SCS_DOS_BINARY 1 -#define SCS_WOW_BINARY 2 -#define SCS_PIF_BINARY 3 -#define SCS_POSIX_BINARY 4 -#define SCS_OS216_BINARY 5 -#define SCS_64BIT_BINARY 6 - -#ifdef UNICODE -#define GetBinaryType GetBinaryTypeW -#define GetShortPathName GetShortPathNameW -#define GetLongPathName GetLongPathNameW -#define GetEnvironmentStrings GetEnvironmentStringsW -#define SetEnvironmentStrings SetEnvironmentStringsW -#define FreeEnvironmentStrings FreeEnvironmentStringsW -#else -#define GetBinaryType GetBinaryTypeA -#define GetShortPathName GetShortPathNameA -#define GetLongPathName GetLongPathNameA -#define GetEnvironmentStringsA GetEnvironmentStrings -#define SetEnvironmentStrings SetEnvironmentStringsA -#define FreeEnvironmentStrings FreeEnvironmentStringsA -#endif - -#ifdef _WIN64 -#define SCS_THIS_PLATFORM_BINARY SCS_64BIT_BINARY -#else -#define SCS_THIS_PLATFORM_BINARY SCS_32BIT_BINARY -#endif - - WINBASEAPI WINBOOL WINAPI GetBinaryTypeA(LPCSTR lpApplicationName,LPDWORD lpBinaryType); - WINBASEAPI WINBOOL WINAPI GetBinaryTypeW(LPCWSTR lpApplicationName,LPDWORD lpBinaryType); - WINBASEAPI DWORD WINAPI GetShortPathNameA(LPCSTR lpszLongPath,LPSTR lpszShortPath,DWORD cchBuffer); - WINBASEAPI DWORD WINAPI GetShortPathNameW(LPCWSTR lpszLongPath,LPWSTR lpszShortPath,DWORD cchBuffer); - WINBASEAPI DWORD WINAPI GetLongPathNameA(LPCSTR lpszShortPath,LPSTR lpszLongPath,DWORD cchBuffer); - WINBASEAPI DWORD WINAPI GetLongPathNameW(LPCWSTR lpszShortPath,LPWSTR lpszLongPath,DWORD cchBuffer); - WINBASEAPI WINBOOL WINAPI GetProcessAffinityMask(HANDLE hProcess,PDWORD_PTR lpProcessAffinityMask,PDWORD_PTR lpSystemAffinityMask); - WINBASEAPI WINBOOL WINAPI SetProcessAffinityMask(HANDLE hProcess,DWORD_PTR dwProcessAffinityMask); - WINBASEAPI WINBOOL WINAPI GetProcessHandleCount(HANDLE hProcess,PDWORD pdwHandleCount); - WINBASEAPI WINBOOL WINAPI GetProcessTimes(HANDLE hProcess,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); - WINBASEAPI WINBOOL WINAPI GetProcessIoCounters(HANDLE hProcess,PIO_COUNTERS lpIoCounters); - WINBASEAPI WINBOOL WINAPI GetProcessWorkingSetSize(HANDLE hProcess,PSIZE_T lpMinimumWorkingSetSize,PSIZE_T lpMaximumWorkingSetSize); - WINBASEAPI WINBOOL WINAPI GetProcessWorkingSetSizeEx(HANDLE hProcess,PSIZE_T lpMinimumWorkingSetSize,PSIZE_T lpMaximumWorkingSetSize,PDWORD Flags); - WINBASEAPI WINBOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess,SIZE_T dwMinimumWorkingSetSize,SIZE_T dwMaximumWorkingSetSize); - WINBASEAPI WINBOOL WINAPI SetProcessWorkingSetSizeEx(HANDLE hProcess,SIZE_T dwMinimumWorkingSetSize,SIZE_T dwMaximumWorkingSetSize,DWORD Flags); - WINBASEAPI HANDLE WINAPI OpenProcess(DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwProcessId); - WINBASEAPI HANDLE WINAPI GetCurrentProcess(VOID); - WINBASEAPI DWORD WINAPI GetCurrentProcessId(VOID); - WINBASEAPI DECLSPEC_NORETURN VOID WINAPI ExitProcess(UINT uExitCode); - WINBASEAPI WINBOOL WINAPI TerminateProcess(HANDLE hProcess,UINT uExitCode); - WINBASEAPI WINBOOL WINAPI GetExitCodeProcess(HANDLE hProcess,LPDWORD lpExitCode); - WINBASEAPI VOID WINAPI FatalExit(int ExitCode); - /* WINBASEAPI LPCH WINAPI GetEnvironmentStrings(VOID); */ - WINBASEAPI LPWCH WINAPI GetEnvironmentStringsW(VOID); - WINBASEAPI WINBOOL WINAPI SetEnvironmentStringsA(LPCH NewEnvironment); - WINBASEAPI WINBOOL WINAPI SetEnvironmentStringsW(LPWCH NewEnvironment); - WINBASEAPI WINBOOL WINAPI FreeEnvironmentStringsA(LPCH); - WINBASEAPI WINBOOL WINAPI FreeEnvironmentStringsW(LPWCH); - WINBASEAPI VOID WINAPI RaiseException(DWORD dwExceptionCode,DWORD dwExceptionFlags,DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments); - WINBASEAPI LONG WINAPI UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo); - - typedef LONG (WINAPI *PTOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *ExceptionInfo); - typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; - - WINBASEAPI LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter); - -#define FIBER_FLAG_FLOAT_SWITCH 0x1 - - WINBASEAPI LPVOID WINAPI CreateFiber(SIZE_T dwStackSize,LPFIBER_START_ROUTINE lpStartAddress,LPVOID lpParameter); - WINBASEAPI LPVOID WINAPI CreateFiberEx(SIZE_T dwStackCommitSize,SIZE_T dwStackReserveSize,DWORD dwFlags,LPFIBER_START_ROUTINE lpStartAddress,LPVOID lpParameter); - WINBASEAPI VOID WINAPI DeleteFiber(LPVOID lpFiber); - WINBASEAPI LPVOID WINAPI ConvertThreadToFiber(LPVOID lpParameter); - WINBASEAPI LPVOID WINAPI ConvertThreadToFiberEx(LPVOID lpParameter,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI ConvertFiberToThread(VOID); - WINBASEAPI VOID WINAPI SwitchToFiber(LPVOID lpFiber); - WINBASEAPI WINBOOL WINAPI SwitchToThread(VOID); - WINBASEAPI HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes,SIZE_T dwStackSize,LPTHREAD_START_ROUTINE lpStartAddress,LPVOID lpParameter,DWORD dwCreationFlags,LPDWORD lpThreadId); - WINBASEAPI HANDLE WINAPI CreateRemoteThread(HANDLE hProcess,LPSECURITY_ATTRIBUTES lpThreadAttributes,SIZE_T dwStackSize,LPTHREAD_START_ROUTINE lpStartAddress,LPVOID lpParameter,DWORD dwCreationFlags,LPDWORD lpThreadId); - WINBASEAPI HANDLE WINAPI GetCurrentThread(VOID); - WINBASEAPI DWORD WINAPI GetCurrentThreadId(VOID); - WINBASEAPI WINBOOL WINAPI SetThreadStackGuarantee (PULONG StackSizeInBytes); - WINBASEAPI DWORD WINAPI GetProcessIdOfThread(HANDLE Thread); - WINBASEAPI DWORD WINAPI GetThreadId(HANDLE Thread); - WINBASEAPI DWORD WINAPI GetProcessId(HANDLE Process); - WINBASEAPI DWORD WINAPI GetCurrentProcessorNumber(VOID); - WINBASEAPI DWORD_PTR WINAPI SetThreadAffinityMask(HANDLE hThread,DWORD_PTR dwThreadAffinityMask); - WINBASEAPI DWORD WINAPI SetThreadIdealProcessor(HANDLE hThread,DWORD dwIdealProcessor); - WINBASEAPI WINBOOL WINAPI SetProcessPriorityBoost(HANDLE hProcess,WINBOOL bDisablePriorityBoost); - WINBASEAPI WINBOOL WINAPI GetProcessPriorityBoost(HANDLE hProcess,PBOOL pDisablePriorityBoost); - WINBASEAPI WINBOOL WINAPI RequestWakeupLatency(LATENCY_TIME latency); - WINBASEAPI WINBOOL WINAPI IsSystemResumeAutomatic(VOID); - WINBASEAPI HANDLE WINAPI OpenThread(DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwThreadId); - WINBASEAPI WINBOOL WINAPI SetThreadPriority(HANDLE hThread,int nPriority); - WINBASEAPI WINBOOL WINAPI SetThreadPriorityBoost(HANDLE hThread,WINBOOL bDisablePriorityBoost); - WINBASEAPI WINBOOL WINAPI GetThreadPriorityBoost(HANDLE hThread,PBOOL pDisablePriorityBoost); - WINBASEAPI int WINAPI GetThreadPriority(HANDLE hThread); - WINBASEAPI WINBOOL WINAPI GetThreadTimes(HANDLE hThread,LPFILETIME lpCreationTime,LPFILETIME lpExitTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); - WINBASEAPI WINBOOL WINAPI GetThreadIOPendingFlag(HANDLE hThread,PBOOL lpIOIsPending); - WINBASEAPI DECLSPEC_NORETURN VOID WINAPI ExitThread(DWORD dwExitCode); - WINBASEAPI WINBOOL WINAPI TerminateThread(HANDLE hThread,DWORD dwExitCode); - WINBASEAPI WINBOOL WINAPI GetExitCodeThread(HANDLE hThread,LPDWORD lpExitCode); - WINBASEAPI WINBOOL WINAPI GetThreadSelectorEntry(HANDLE hThread,DWORD dwSelector,LPLDT_ENTRY lpSelectorEntry); - WINBASEAPI EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE esFlags); - WINBASEAPI DWORD WINAPI GetLastError(VOID); - WINBASEAPI VOID WINAPI SetLastError(DWORD dwErrCode); - -#ifndef RC_INVOKED -#ifdef WINBASE_DECLARE_RESTORE_LAST_ERROR - WINBASEAPI VOID WINAPI RestoreLastError(DWORD dwErrCode); - - typedef VOID (WINAPI *PRESTORE_LAST_ERROR)(DWORD); - -#define RESTORE_LAST_ERROR_NAME_A "RestoreLastError" -#define RESTORE_LAST_ERROR_NAME_W L"RestoreLastError" -#define RESTORE_LAST_ERROR_NAME TEXT("RestoreLastError") -#endif -#endif - -#define HasOverlappedIoCompleted(lpOverlapped) (((DWORD)(lpOverlapped)->Internal)!=STATUS_PENDING) - - WINBASEAPI WINBOOL WINAPI GetOverlappedResult(HANDLE hFile,LPOVERLAPPED lpOverlapped,LPDWORD lpNumberOfBytesTransferred,WINBOOL bWait); - WINBASEAPI HANDLE WINAPI CreateIoCompletionPort(HANDLE FileHandle,HANDLE ExistingCompletionPort,ULONG_PTR CompletionKey,DWORD NumberOfConcurrentThreads); - WINBASEAPI WINBOOL WINAPI GetQueuedCompletionStatus(HANDLE CompletionPort,LPDWORD lpNumberOfBytesTransferred,PULONG_PTR lpCompletionKey,LPOVERLAPPED *lpOverlapped,DWORD dwMilliseconds); - WINBASEAPI WINBOOL WINAPI PostQueuedCompletionStatus(HANDLE CompletionPort,DWORD dwNumberOfBytesTransferred,ULONG_PTR dwCompletionKey,LPOVERLAPPED lpOverlapped); - -#define SEM_FAILCRITICALERRORS 0x1 -#define SEM_NOGPFAULTERRORBOX 0x2 -#define SEM_NOALIGNMENTFAULTEXCEPT 0x4 -#define SEM_NOOPENFILEERRORBOX 0x8000 - - WINBASEAPI UINT WINAPI SetErrorMode(UINT uMode); - WINBASEAPI WINBOOL WINAPI ReadProcessMemory(HANDLE hProcess,LPCVOID lpBaseAddress,LPVOID lpBuffer,SIZE_T nSize,SIZE_T *lpNumberOfBytesRead); - WINBASEAPI WINBOOL WINAPI WriteProcessMemory(HANDLE hProcess,LPVOID lpBaseAddress,LPCVOID lpBuffer,SIZE_T nSize,SIZE_T *lpNumberOfBytesWritten); - WINBASEAPI WINBOOL WINAPI GetThreadContext(HANDLE hThread,LPCONTEXT lpContext); - WINBASEAPI WINBOOL WINAPI SetThreadContext(HANDLE hThread,CONST CONTEXT *lpContext); - WINBASEAPI DWORD WINAPI SuspendThread(HANDLE hThread); - WINBASEAPI DWORD WINAPI ResumeThread(HANDLE hThread); - - typedef VOID (WINAPI *PAPCFUNC)(ULONG_PTR dwParam); - - WINBASEAPI DWORD WINAPI QueueUserAPC(PAPCFUNC pfnAPC,HANDLE hThread,ULONG_PTR dwData); - WINBASEAPI WINBOOL WINAPI IsDebuggerPresent(VOID); - WINBASEAPI WINBOOL WINAPI CheckRemoteDebuggerPresent(HANDLE hProcess,PBOOL pbDebuggerPresent); - WINBASEAPI VOID WINAPI DebugBreak(VOID); - WINBASEAPI WINBOOL WINAPI WaitForDebugEvent(LPDEBUG_EVENT lpDebugEvent,DWORD dwMilliseconds); - WINBASEAPI WINBOOL WINAPI ContinueDebugEvent(DWORD dwProcessId,DWORD dwThreadId,DWORD dwContinueStatus); - WINBASEAPI WINBOOL WINAPI DebugActiveProcess(DWORD dwProcessId); - WINBASEAPI WINBOOL WINAPI DebugActiveProcessStop(DWORD dwProcessId); - WINBASEAPI WINBOOL WINAPI DebugSetProcessKillOnExit(WINBOOL KillOnExit); - WINBASEAPI WINBOOL WINAPI DebugBreakProcess(HANDLE Process); - WINBASEAPI VOID WINAPI InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - WINBASEAPI VOID WINAPI EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - WINBASEAPI VOID WINAPI LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - WINBASEAPI WINBOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION lpCriticalSection,DWORD dwSpinCount); - WINBASEAPI DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION lpCriticalSection,DWORD dwSpinCount); - WINBASEAPI WINBOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - WINBASEAPI VOID WINAPI DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection); - WINBASEAPI WINBOOL WINAPI SetEvent(HANDLE hEvent); - WINBASEAPI WINBOOL WINAPI ResetEvent(HANDLE hEvent); - WINBASEAPI WINBOOL WINAPI PulseEvent(HANDLE hEvent); - WINBASEAPI WINBOOL WINAPI ReleaseSemaphore(HANDLE hSemaphore,LONG lReleaseCount,LPLONG lpPreviousCount); - WINBASEAPI WINBOOL WINAPI ReleaseMutex(HANDLE hMutex); - WINBASEAPI DWORD WINAPI WaitForSingleObject(HANDLE hHandle,DWORD dwMilliseconds); - WINBASEAPI DWORD WINAPI WaitForMultipleObjects(DWORD nCount,CONST HANDLE *lpHandles,WINBOOL bWaitAll,DWORD dwMilliseconds); - WINBASEAPI VOID WINAPI Sleep(DWORD dwMilliseconds); - WINBASEAPI HGLOBAL WINAPI LoadResource(HMODULE hModule,HRSRC hResInfo); - WINBASEAPI DWORD WINAPI SizeofResource(HMODULE hModule,HRSRC hResInfo); - WINBASEAPI ATOM WINAPI GlobalDeleteAtom(ATOM nAtom); - WINBASEAPI WINBOOL WINAPI InitAtomTable(DWORD nSize); - WINBASEAPI ATOM WINAPI DeleteAtom(ATOM nAtom); - WINBASEAPI UINT WINAPI SetHandleCount(UINT uNumber); - WINBASEAPI DWORD WINAPI GetLogicalDrives(VOID); - WINBASEAPI WINBOOL WINAPI LockFile(HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh); - WINBASEAPI WINBOOL WINAPI UnlockFile(HANDLE hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh,DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh); - WINBASEAPI WINBOOL WINAPI LockFileEx(HANDLE hFile,DWORD dwFlags,DWORD dwReserved,DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh,LPOVERLAPPED lpOverlapped); - -#define LOCKFILE_FAIL_IMMEDIATELY 0x1 -#define LOCKFILE_EXCLUSIVE_LOCK 0x2 - - WINBASEAPI WINBOOL WINAPI UnlockFileEx(HANDLE hFile,DWORD dwReserved,DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh,LPOVERLAPPED lpOverlapped); - - typedef struct _BY_HANDLE_FILE_INFORMATION { - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD dwVolumeSerialNumber; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; - DWORD nNumberOfLinks; - DWORD nFileIndexHigh; - DWORD nFileIndexLow; - } BY_HANDLE_FILE_INFORMATION,*PBY_HANDLE_FILE_INFORMATION,*LPBY_HANDLE_FILE_INFORMATION; - -#ifdef UNICODE -#define SetFileShortName SetFileShortNameW -#else -#define SetFileShortName SetFileShortNameA -#endif - - WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle(HANDLE hFile,LPBY_HANDLE_FILE_INFORMATION lpFileInformation); - WINBASEAPI DWORD WINAPI GetFileType(HANDLE hFile); - WINBASEAPI DWORD WINAPI GetFileSize(HANDLE hFile,LPDWORD lpFileSizeHigh); - WINBASEAPI WINBOOL WINAPI GetFileSizeEx(HANDLE hFile,PLARGE_INTEGER lpFileSize); - WINBASEAPI HANDLE WINAPI GetStdHandle(DWORD nStdHandle); - WINBASEAPI WINBOOL WINAPI SetStdHandle(DWORD nStdHandle,HANDLE hHandle); - WINBASEAPI WINBOOL WINAPI WriteFile(HANDLE hFile,LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten,LPOVERLAPPED lpOverlapped); - WINBASEAPI WINBOOL WINAPI ReadFile(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,LPOVERLAPPED lpOverlapped); - WINBASEAPI WINBOOL WINAPI FlushFileBuffers(HANDLE hFile); - WINBASEAPI WINBOOL WINAPI DeviceIoControl(HANDLE hDevice,DWORD dwIoControlCode,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesReturned,LPOVERLAPPED lpOverlapped); - WINBASEAPI WINBOOL WINAPI RequestDeviceWakeup(HANDLE hDevice); - WINBASEAPI WINBOOL WINAPI CancelDeviceWakeupRequest(HANDLE hDevice); - WINBASEAPI WINBOOL WINAPI GetDevicePowerState(HANDLE hDevice,WINBOOL *pfOn); - WINBASEAPI WINBOOL WINAPI SetMessageWaitingIndicator(HANDLE hMsgIndicator,ULONG ulMsgCount); - WINBASEAPI WINBOOL WINAPI SetEndOfFile(HANDLE hFile); - WINBASEAPI DWORD WINAPI SetFilePointer(HANDLE hFile,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - WINBASEAPI WINBOOL WINAPI SetFilePointerEx(HANDLE hFile,LARGE_INTEGER liDistanceToMove,PLARGE_INTEGER lpNewFilePointer,DWORD dwMoveMethod); - WINBASEAPI WINBOOL WINAPI FindClose(HANDLE hFindFile); - WINBASEAPI WINBOOL WINAPI GetFileTime(HANDLE hFile,LPFILETIME lpCreationTime,LPFILETIME lpLastAccessTime,LPFILETIME lpLastWriteTime); - WINBASEAPI WINBOOL WINAPI SetFileTime(HANDLE hFile,CONST FILETIME *lpCreationTime,CONST FILETIME *lpLastAccessTime,CONST FILETIME *lpLastWriteTime); - WINBASEAPI WINBOOL WINAPI SetFileValidData(HANDLE hFile,LONGLONG ValidDataLength); - WINBASEAPI WINBOOL WINAPI SetFileShortNameA(HANDLE hFile,LPCSTR lpShortName); - WINBASEAPI WINBOOL WINAPI SetFileShortNameW(HANDLE hFile,LPCWSTR lpShortName); - WINBASEAPI WINBOOL WINAPI CloseHandle(HANDLE hObject); - WINBASEAPI WINBOOL WINAPI DuplicateHandle(HANDLE hSourceProcessHandle,HANDLE hSourceHandle,HANDLE hTargetProcessHandle,LPHANDLE lpTargetHandle,DWORD dwDesiredAccess,WINBOOL bInheritHandle,DWORD dwOptions); - WINBASEAPI WINBOOL WINAPI GetHandleInformation(HANDLE hObject,LPDWORD lpdwFlags); - WINBASEAPI WINBOOL WINAPI SetHandleInformation(HANDLE hObject,DWORD dwMask,DWORD dwFlags); - -#define HANDLE_FLAG_INHERIT 0x1 -#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x2 - -#define HINSTANCE_ERROR 32 - - WINBASEAPI DWORD WINAPI LoadModule(LPCSTR lpModuleName,LPVOID lpParameterBlock); - WINBASEAPI UINT WINAPI WinExec(LPCSTR lpCmdLine,UINT uCmdShow); - WINBASEAPI WINBOOL WINAPI ClearCommBreak(HANDLE hFile); - WINBASEAPI WINBOOL WINAPI ClearCommError(HANDLE hFile,LPDWORD lpErrors,LPCOMSTAT lpStat); - WINBASEAPI WINBOOL WINAPI SetupComm(HANDLE hFile,DWORD dwInQueue,DWORD dwOutQueue); - WINBASEAPI WINBOOL WINAPI EscapeCommFunction(HANDLE hFile,DWORD dwFunc); - WINBASEAPI WINBOOL WINAPI GetCommConfig(HANDLE hCommDev,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); - WINBASEAPI WINBOOL WINAPI GetCommMask(HANDLE hFile,LPDWORD lpEvtMask); - WINBASEAPI WINBOOL WINAPI GetCommProperties(HANDLE hFile,LPCOMMPROP lpCommProp); - WINBASEAPI WINBOOL WINAPI GetCommModemStatus(HANDLE hFile,LPDWORD lpModemStat); - WINBASEAPI WINBOOL WINAPI GetCommState(HANDLE hFile,LPDCB lpDCB); - WINBASEAPI WINBOOL WINAPI GetCommTimeouts(HANDLE hFile,LPCOMMTIMEOUTS lpCommTimeouts); - WINBASEAPI WINBOOL WINAPI PurgeComm(HANDLE hFile,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI SetCommBreak(HANDLE hFile); - WINBASEAPI WINBOOL WINAPI SetCommConfig(HANDLE hCommDev,LPCOMMCONFIG lpCC,DWORD dwSize); - WINBASEAPI WINBOOL WINAPI SetCommMask(HANDLE hFile,DWORD dwEvtMask); - WINBASEAPI WINBOOL WINAPI SetCommState(HANDLE hFile,LPDCB lpDCB); - WINBASEAPI WINBOOL WINAPI SetCommTimeouts(HANDLE hFile,LPCOMMTIMEOUTS lpCommTimeouts); - WINBASEAPI WINBOOL WINAPI TransmitCommChar(HANDLE hFile,char cChar); - WINBASEAPI WINBOOL WINAPI WaitCommEvent(HANDLE hFile,LPDWORD lpEvtMask,LPOVERLAPPED lpOverlapped); - WINBASEAPI DWORD WINAPI SetTapePosition(HANDLE hDevice,DWORD dwPositionMethod,DWORD dwPartition,DWORD dwOffsetLow,DWORD dwOffsetHigh,WINBOOL bImmediate); - WINBASEAPI DWORD WINAPI GetTapePosition(HANDLE hDevice,DWORD dwPositionType,LPDWORD lpdwPartition,LPDWORD lpdwOffsetLow,LPDWORD lpdwOffsetHigh); - WINBASEAPI DWORD WINAPI PrepareTape(HANDLE hDevice,DWORD dwOperation,WINBOOL bImmediate); - WINBASEAPI DWORD WINAPI EraseTape(HANDLE hDevice,DWORD dwEraseType,WINBOOL bImmediate); - WINBASEAPI DWORD WINAPI CreateTapePartition(HANDLE hDevice,DWORD dwPartitionMethod,DWORD dwCount,DWORD dwSize); - WINBASEAPI DWORD WINAPI WriteTapemark(HANDLE hDevice,DWORD dwTapemarkType,DWORD dwTapemarkCount,WINBOOL bImmediate); - WINBASEAPI DWORD WINAPI GetTapeStatus(HANDLE hDevice); - WINBASEAPI DWORD WINAPI GetTapeParameters(HANDLE hDevice,DWORD dwOperation,LPDWORD lpdwSize,LPVOID lpTapeInformation); - -#define GET_TAPE_MEDIA_INFORMATION 0 -#define GET_TAPE_DRIVE_INFORMATION 1 - - WINBASEAPI DWORD WINAPI SetTapeParameters(HANDLE hDevice,DWORD dwOperation,LPVOID lpTapeInformation); - -#define SET_TAPE_MEDIA_INFORMATION 0 -#define SET_TAPE_DRIVE_INFORMATION 1 - - WINBASEAPI WINBOOL WINAPI Beep(DWORD dwFreq,DWORD dwDuration); - WINBASEAPI int WINAPI MulDiv(int nNumber,int nNumerator,int nDenominator); - WINBASEAPI VOID WINAPI GetSystemTime(LPSYSTEMTIME lpSystemTime); - WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime); - WINBASEAPI WINBOOL WINAPI SetSystemTime(CONST SYSTEMTIME *lpSystemTime); - WINBASEAPI VOID WINAPI GetLocalTime(LPSYSTEMTIME lpSystemTime); - WINBASEAPI WINBOOL WINAPI SetLocalTime(CONST SYSTEMTIME *lpSystemTime); - WINBASEAPI VOID WINAPI GetSystemInfo(LPSYSTEM_INFO lpSystemInfo); - WINBASEAPI WINBOOL WINAPI SetSystemFileCacheSize(SIZE_T MinimumFileCacheSize,SIZE_T MaximumFileCacheSize,DWORD Flags); - WINBASEAPI WINBOOL WINAPI GetSystemFileCacheSize(PSIZE_T lpMinimumFileCacheSize,PSIZE_T lpMaximumFileCacheSize,PDWORD lpFlags); - WINBASEAPI WINBOOL WINAPI GetSystemRegistryQuota(PDWORD pdwQuotaAllowed,PDWORD pdwQuotaUsed); - WINBOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime,LPFILETIME lpKernelTime,LPFILETIME lpUserTime); - WINBASEAPI VOID WINAPI GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo); - WINBASEAPI WINBOOL WINAPI IsProcessorFeaturePresent(DWORD ProcessorFeature); - - typedef struct _TIME_ZONE_INFORMATION { - LONG Bias; - WCHAR StandardName[32]; - SYSTEMTIME StandardDate; - LONG StandardBias; - WCHAR DaylightName[32]; - SYSTEMTIME DaylightDate; - LONG DaylightBias; - } TIME_ZONE_INFORMATION,*PTIME_ZONE_INFORMATION,*LPTIME_ZONE_INFORMATION; - -#ifdef UNICODE -#define FormatMessage FormatMessageW -#else -#define FormatMessage FormatMessageA -#endif - - WINBASEAPI WINBOOL WINAPI SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,LPSYSTEMTIME lpUniversalTime,LPSYSTEMTIME lpLocalTime); - WINBASEAPI WINBOOL WINAPI TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,LPSYSTEMTIME lpLocalTime,LPSYSTEMTIME lpUniversalTime); - WINBASEAPI DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation); - WINBASEAPI WINBOOL WINAPI SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation); - WINBASEAPI WINBOOL WINAPI SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime,LPFILETIME lpFileTime); - WINBASEAPI WINBOOL WINAPI FileTimeToLocalFileTime(CONST FILETIME *lpFileTime,LPFILETIME lpLocalFileTime); - WINBASEAPI WINBOOL WINAPI LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime,LPFILETIME lpFileTime); - WINBASEAPI WINBOOL WINAPI FileTimeToSystemTime(CONST FILETIME *lpFileTime,LPSYSTEMTIME lpSystemTime); - WINBASEAPI LONG WINAPI CompareFileTime(CONST FILETIME *lpFileTime1,CONST FILETIME *lpFileTime2); - WINBASEAPI WINBOOL WINAPI FileTimeToDosDateTime(CONST FILETIME *lpFileTime,LPWORD lpFatDate,LPWORD lpFatTime); - WINBASEAPI WINBOOL WINAPI DosDateTimeToFileTime(WORD wFatDate,WORD wFatTime,LPFILETIME lpFileTime); - WINBASEAPI DWORD WINAPI GetTickCount(VOID); - WINBASEAPI WINBOOL WINAPI SetSystemTimeAdjustment(DWORD dwTimeAdjustment,WINBOOL bTimeAdjustmentDisabled); - WINBASEAPI WINBOOL WINAPI GetSystemTimeAdjustment(PDWORD lpTimeAdjustment,PDWORD lpTimeIncrement,PBOOL lpTimeAdjustmentDisabled); - WINBASEAPI DWORD WINAPI FormatMessageA(DWORD dwFlags,LPCVOID lpSource,DWORD dwMessageId,DWORD dwLanguageId,LPSTR lpBuffer,DWORD nSize,va_list *Arguments); - WINBASEAPI DWORD WINAPI FormatMessageW(DWORD dwFlags,LPCVOID lpSource,DWORD dwMessageId,DWORD dwLanguageId,LPWSTR lpBuffer,DWORD nSize,va_list *Arguments); - -#define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x100 -#define FORMAT_MESSAGE_IGNORE_INSERTS 0x200 -#define FORMAT_MESSAGE_FROM_STRING 0x400 -#define FORMAT_MESSAGE_FROM_HMODULE 0x800 -#define FORMAT_MESSAGE_FROM_SYSTEM 0x1000 -#define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x2000 -#define FORMAT_MESSAGE_MAX_WIDTH_MASK 0xff - -#ifdef UNICODE -#define CreateMailslot CreateMailslotW -#define EncryptFile EncryptFileW -#define DecryptFile DecryptFileW -#define FileEncryptionStatus FileEncryptionStatusW -#else -#define CreateMailslot CreateMailslotA -#define EncryptFile EncryptFileA -#define DecryptFile DecryptFileA -#define FileEncryptionStatus FileEncryptionStatusA -#endif - - WINBASEAPI WINBOOL WINAPI CreatePipe(PHANDLE hReadPipe,PHANDLE hWritePipe,LPSECURITY_ATTRIBUTES lpPipeAttributes,DWORD nSize); - WINBASEAPI WINBOOL WINAPI ConnectNamedPipe(HANDLE hNamedPipe,LPOVERLAPPED lpOverlapped); - WINBASEAPI WINBOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe); - WINBASEAPI WINBOOL WINAPI SetNamedPipeHandleState(HANDLE hNamedPipe,LPDWORD lpMode,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout); - WINBASEAPI WINBOOL WINAPI GetNamedPipeInfo(HANDLE hNamedPipe,LPDWORD lpFlags,LPDWORD lpOutBufferSize,LPDWORD lpInBufferSize,LPDWORD lpMaxInstances); - WINBASEAPI WINBOOL WINAPI PeekNamedPipe(HANDLE hNamedPipe,LPVOID lpBuffer,DWORD nBufferSize,LPDWORD lpBytesRead,LPDWORD lpTotalBytesAvail,LPDWORD lpBytesLeftThisMessage); - WINBASEAPI WINBOOL WINAPI TransactNamedPipe(HANDLE hNamedPipe,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,LPOVERLAPPED lpOverlapped); - WINBASEAPI HANDLE WINAPI CreateMailslotA(LPCSTR lpName,DWORD nMaxMessageSize,DWORD lReadTimeout,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI HANDLE WINAPI CreateMailslotW(LPCWSTR lpName,DWORD nMaxMessageSize,DWORD lReadTimeout,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI WINBOOL WINAPI GetMailslotInfo(HANDLE hMailslot,LPDWORD lpMaxMessageSize,LPDWORD lpNextSize,LPDWORD lpMessageCount,LPDWORD lpReadTimeout); - WINBASEAPI WINBOOL WINAPI SetMailslotInfo(HANDLE hMailslot,DWORD lReadTimeout); - WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE hFileMappingObject,DWORD dwDesiredAccess,DWORD dwFileOffsetHigh,DWORD dwFileOffsetLow,SIZE_T dwNumberOfBytesToMap); - WINBASEAPI WINBOOL WINAPI FlushViewOfFile(LPCVOID lpBaseAddress,SIZE_T dwNumberOfBytesToFlush); - WINBASEAPI WINBOOL WINAPI UnmapViewOfFile(LPCVOID lpBaseAddress); - WINADVAPI WINBOOL WINAPI EncryptFileA(LPCSTR lpFileName); - WINADVAPI WINBOOL WINAPI EncryptFileW(LPCWSTR lpFileName); - WINADVAPI WINBOOL WINAPI DecryptFileA(LPCSTR lpFileName,DWORD dwReserved); - WINADVAPI WINBOOL WINAPI DecryptFileW(LPCWSTR lpFileName,DWORD dwReserved); - -#define FILE_ENCRYPTABLE 0 -#define FILE_IS_ENCRYPTED 1 -#define FILE_SYSTEM_ATTR 2 -#define FILE_ROOT_DIR 3 -#define FILE_SYSTEM_DIR 4 -#define FILE_UNKNOWN 5 -#define FILE_SYSTEM_NOT_SUPPORT 6 -#define FILE_USER_DISALLOWED 7 -#define FILE_READ_ONLY 8 -#define FILE_DIR_DISALLOWED 9 - - WINADVAPI WINBOOL WINAPI FileEncryptionStatusA(LPCSTR lpFileName,LPDWORD lpStatus); - WINADVAPI WINBOOL WINAPI FileEncryptionStatusW(LPCWSTR lpFileName,LPDWORD lpStatus); - -#define EFS_USE_RECOVERY_KEYS (0x1) - - typedef DWORD (WINAPI *PFE_EXPORT_FUNC)(PBYTE pbData,PVOID pvCallbackContext,ULONG ulLength); - typedef DWORD (WINAPI *PFE_IMPORT_FUNC)(PBYTE pbData,PVOID pvCallbackContext,PULONG ulLength); - -#define CREATE_FOR_IMPORT (1) -#define CREATE_FOR_DIR (2) -#define OVERWRITE_HIDDEN (4) - -#ifdef UNICODE -#define OpenEncryptedFileRaw OpenEncryptedFileRawW -#define lstrcmp lstrcmpW -#define lstrcmpi lstrcmpiW -#define lstrcpyn lstrcpynW -#define lstrcpy lstrcpyW -#define lstrcat lstrcatW -#define lstrlen lstrlenW -#else -#define OpenEncryptedFileRaw OpenEncryptedFileRawA -#define lstrcmp lstrcmpA -#define lstrcmpi lstrcmpiA -#define lstrcpyn lstrcpynA -#define lstrcpy lstrcpyA -#define lstrcat lstrcatA -#define lstrlen lstrlenA -#endif - - WINADVAPI DWORD WINAPI OpenEncryptedFileRawA(LPCSTR lpFileName,ULONG ulFlags,PVOID *pvContext); - WINADVAPI DWORD WINAPI OpenEncryptedFileRawW(LPCWSTR lpFileName,ULONG ulFlags,PVOID *pvContext); - WINADVAPI DWORD WINAPI ReadEncryptedFileRaw(PFE_EXPORT_FUNC pfExportCallback,PVOID pvCallbackContext,PVOID pvContext); - WINADVAPI DWORD WINAPI WriteEncryptedFileRaw(PFE_IMPORT_FUNC pfImportCallback,PVOID pvCallbackContext,PVOID pvContext); - WINADVAPI VOID WINAPI CloseEncryptedFileRaw(PVOID pvContext); - WINBASEAPI int WINAPI lstrcmpA(LPCSTR lpString1,LPCSTR lpString2); - WINBASEAPI int WINAPI lstrcmpW(LPCWSTR lpString1,LPCWSTR lpString2); - WINBASEAPI int WINAPI lstrcmpiA(LPCSTR lpString1,LPCSTR lpString2); - WINBASEAPI int WINAPI lstrcmpiW(LPCWSTR lpString1,LPCWSTR lpString2); - WINBASEAPI LPSTR WINAPI lstrcpynA(LPSTR lpString1,LPCSTR lpString2,int iMaxLength); - WINBASEAPI LPWSTR WINAPI lstrcpynW(LPWSTR lpString1,LPCWSTR lpString2,int iMaxLength); - WINBASEAPI LPSTR WINAPI lstrcpyA(LPSTR lpString1,LPCSTR lpString2); - WINBASEAPI LPWSTR WINAPI lstrcpyW(LPWSTR lpString1,LPCWSTR lpString2); - WINBASEAPI LPSTR WINAPI lstrcatA(LPSTR lpString1,LPCSTR lpString2); - WINBASEAPI LPWSTR WINAPI lstrcatW(LPWSTR lpString1,LPCWSTR lpString2); - WINBASEAPI int WINAPI lstrlenA(LPCSTR lpString); - WINBASEAPI int WINAPI lstrlenW(LPCWSTR lpString); - WINBASEAPI HFILE WINAPI OpenFile(LPCSTR lpFileName,LPOFSTRUCT lpReOpenBuff,UINT uStyle); - WINBASEAPI HFILE WINAPI _lopen(LPCSTR lpPathName,int iReadWrite); - WINBASEAPI HFILE WINAPI _lcreat(LPCSTR lpPathName,int iAttribute); - WINBASEAPI UINT WINAPI _lread(HFILE hFile,LPVOID lpBuffer,UINT uBytes); - WINBASEAPI UINT WINAPI _lwrite(HFILE hFile,LPCCH lpBuffer,UINT uBytes); - WINBASEAPI long WINAPI _hread(HFILE hFile,LPVOID lpBuffer,long lBytes); - WINBASEAPI long WINAPI _hwrite(HFILE hFile,LPCCH lpBuffer,long lBytes); - WINBASEAPI HFILE WINAPI _lclose(HFILE hFile); - WINBASEAPI LONG WINAPI _llseek(HFILE hFile,LONG lOffset,int iOrigin); - WINADVAPI WINBOOL WINAPI IsTextUnicode(CONST VOID *lpv,int iSize,LPINT lpiResult); - -#define FLS_OUT_OF_INDEXES ((DWORD)0xffffffff) - - WINBASEAPI DWORD WINAPI FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback); - WINBASEAPI PVOID WINAPI FlsGetValue(DWORD dwFlsIndex); - WINBASEAPI WINBOOL WINAPI FlsSetValue(DWORD dwFlsIndex,PVOID lpFlsData); - WINBASEAPI WINBOOL WINAPI FlsFree(DWORD dwFlsIndex); - -#define TLS_OUT_OF_INDEXES ((DWORD)0xffffffff) - - WINBASEAPI DWORD WINAPI TlsAlloc(VOID); - WINBASEAPI LPVOID WINAPI TlsGetValue(DWORD dwTlsIndex); - WINBASEAPI WINBOOL WINAPI TlsSetValue(DWORD dwTlsIndex,LPVOID lpTlsValue); - WINBASEAPI WINBOOL WINAPI TlsFree(DWORD dwTlsIndex); - - typedef VOID (WINAPI *LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode,DWORD dwNumberOfBytesTransfered,LPOVERLAPPED lpOverlapped); - - WINBASEAPI DWORD WINAPI SleepEx(DWORD dwMilliseconds,WINBOOL bAlertable); - WINBASEAPI DWORD WINAPI WaitForSingleObjectEx(HANDLE hHandle,DWORD dwMilliseconds,WINBOOL bAlertable); - WINBASEAPI DWORD WINAPI WaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *lpHandles,WINBOOL bWaitAll,DWORD dwMilliseconds,WINBOOL bAlertable); - WINBASEAPI DWORD WINAPI SignalObjectAndWait(HANDLE hObjectToSignal,HANDLE hObjectToWaitOn,DWORD dwMilliseconds,WINBOOL bAlertable); - WINBASEAPI WINBOOL WINAPI ReadFileEx(HANDLE hFile,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINBASEAPI WINBOOL WINAPI WriteFileEx(HANDLE hFile,LPCVOID lpBuffer,DWORD nNumberOfBytesToWrite,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINBASEAPI WINBOOL WINAPI BackupRead(HANDLE hFile,LPBYTE lpBuffer,DWORD nNumberOfBytesToRead,LPDWORD lpNumberOfBytesRead,WINBOOL bAbort,WINBOOL bProcessSecurity,LPVOID *lpContext); - WINBASEAPI WINBOOL WINAPI BackupSeek(HANDLE hFile,DWORD dwLowBytesToSeek,DWORD dwHighBytesToSeek,LPDWORD lpdwLowByteSeeked,LPDWORD lpdwHighByteSeeked,LPVOID *lpContext); - WINBASEAPI WINBOOL WINAPI BackupWrite(HANDLE hFile,LPBYTE lpBuffer,DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten,WINBOOL bAbort,WINBOOL bProcessSecurity,LPVOID *lpContext); - - typedef struct _WIN32_STREAM_ID { - DWORD dwStreamId; - DWORD dwStreamAttributes; - LARGE_INTEGER Size; - DWORD dwStreamNameSize; - WCHAR cStreamName[ANYSIZE_ARRAY]; - } WIN32_STREAM_ID,*LPWIN32_STREAM_ID; - -#define BACKUP_INVALID 0x0 -#define BACKUP_DATA 0x1 -#define BACKUP_EA_DATA 0x2 -#define BACKUP_SECURITY_DATA 0x3 -#define BACKUP_ALTERNATE_DATA 0x4 -#define BACKUP_LINK 0x5 -#define BACKUP_PROPERTY_DATA 0x6 -#define BACKUP_OBJECT_ID 0x7 -#define BACKUP_REPARSE_DATA 0x8 -#define BACKUP_SPARSE_BLOCK 0x9 - -#define STREAM_NORMAL_ATTRIBUTE 0x0 -#define STREAM_MODIFIED_WHEN_READ 0x1 -#define STREAM_CONTAINS_SECURITY 0x2 -#define STREAM_CONTAINS_PROPERTIES 0x4 -#define STREAM_SPARSE_ATTRIBUTE 0x8 - - WINBASEAPI WINBOOL WINAPI ReadFileScatter(HANDLE hFile,FILE_SEGMENT_ELEMENT aSegmentArray[],DWORD nNumberOfBytesToRead,LPDWORD lpReserved,LPOVERLAPPED lpOverlapped); - WINBASEAPI WINBOOL WINAPI WriteFileGather(HANDLE hFile,FILE_SEGMENT_ELEMENT aSegmentArray[],DWORD nNumberOfBytesToWrite,LPDWORD lpReserved,LPOVERLAPPED lpOverlapped); - -#define STARTF_USESHOWWINDOW 0x1 -#define STARTF_USESIZE 0x2 -#define STARTF_USEPOSITION 0x4 -#define STARTF_USECOUNTCHARS 0x8 -#define STARTF_USEFILLATTRIBUTE 0x10 -#define STARTF_RUNFULLSCREEN 0x20 -#define STARTF_FORCEONFEEDBACK 0x40 -#define STARTF_FORCEOFFFEEDBACK 0x80 -#define STARTF_USESTDHANDLES 0x100 - -#define STARTF_USEHOTKEY 0x200 - - typedef struct _STARTUPINFOA { - DWORD cb; - LPSTR lpReserved; - LPSTR lpDesktop; - LPSTR lpTitle; - DWORD dwX; - DWORD dwY; - DWORD dwXSize; - DWORD dwYSize; - DWORD dwXCountChars; - DWORD dwYCountChars; - DWORD dwFillAttribute; - DWORD dwFlags; - WORD wShowWindow; - WORD cbReserved2; - LPBYTE lpReserved2; - HANDLE hStdInput; - HANDLE hStdOutput; - HANDLE hStdError; - } STARTUPINFOA,*LPSTARTUPINFOA; - - typedef struct _STARTUPINFOW { - DWORD cb; - LPWSTR lpReserved; - LPWSTR lpDesktop; - LPWSTR lpTitle; - DWORD dwX; - DWORD dwY; - DWORD dwXSize; - DWORD dwYSize; - DWORD dwXCountChars; - DWORD dwYCountChars; - DWORD dwFillAttribute; - DWORD dwFlags; - WORD wShowWindow; - WORD cbReserved2; - LPBYTE lpReserved2; - HANDLE hStdInput; - HANDLE hStdOutput; - HANDLE hStdError; - } STARTUPINFOW,*LPSTARTUPINFOW; - -#ifdef UNICODE - typedef STARTUPINFOW STARTUPINFO; - typedef LPSTARTUPINFOW LPSTARTUPINFO; -#else - typedef STARTUPINFOA STARTUPINFO; - typedef LPSTARTUPINFOA LPSTARTUPINFO; -#endif - -#define SHUTDOWN_NORETRY 0x1 - - typedef struct _WIN32_FIND_DATAA { - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; - DWORD dwReserved0; - DWORD dwReserved1; - CHAR cFileName[MAX_PATH]; - CHAR cAlternateFileName[14]; - } WIN32_FIND_DATAA,*PWIN32_FIND_DATAA,*LPWIN32_FIND_DATAA; - - typedef struct _WIN32_FIND_DATAW { - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; - DWORD dwReserved0; - DWORD dwReserved1; - WCHAR cFileName[MAX_PATH]; - WCHAR cAlternateFileName[14]; - } WIN32_FIND_DATAW,*PWIN32_FIND_DATAW,*LPWIN32_FIND_DATAW; - -#ifdef UNICODE - typedef WIN32_FIND_DATAW WIN32_FIND_DATA; - typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA; - typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA; -#else - typedef WIN32_FIND_DATAA WIN32_FIND_DATA; - typedef PWIN32_FIND_DATAA PWIN32_FIND_DATA; - typedef LPWIN32_FIND_DATAA LPWIN32_FIND_DATA; -#endif - - typedef struct _WIN32_FILE_ATTRIBUTE_DATA { - DWORD dwFileAttributes; - FILETIME ftCreationTime; - FILETIME ftLastAccessTime; - FILETIME ftLastWriteTime; - DWORD nFileSizeHigh; - DWORD nFileSizeLow; - } WIN32_FILE_ATTRIBUTE_DATA,*LPWIN32_FILE_ATTRIBUTE_DATA; - -#ifdef UNICODE -#define CreateMutex CreateMutexW -#define OpenMutex OpenMutexW -#define CreateEvent CreateEventW -#define OpenEvent OpenEventW -#define CreateSemaphore CreateSemaphoreW -#define OpenSemaphore OpenSemaphoreW -#else -#define CreateMutex CreateMutexA -#define OpenMutex OpenMutexA -#define CreateEvent CreateEventA -#define OpenEvent OpenEventA -#define CreateSemaphore CreateSemaphoreA -#define OpenSemaphore OpenSemaphoreA -#endif - - WINBASEAPI HANDLE WINAPI CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes,WINBOOL bInitialOwner,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes,WINBOOL bInitialOwner,LPCWSTR lpName); - WINBASEAPI HANDLE WINAPI OpenMutexA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI OpenMutexW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); - WINBASEAPI HANDLE WINAPI CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes,WINBOOL bManualReset,WINBOOL bInitialState,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes,WINBOOL bManualReset,WINBOOL bInitialState,LPCWSTR lpName); - WINBASEAPI HANDLE WINAPI OpenEventA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI OpenEventW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); - WINBASEAPI HANDLE WINAPI CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,LONG lInitialCount,LONG lMaximumCount,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,LONG lInitialCount,LONG lMaximumCount,LPCWSTR lpName); - WINBASEAPI HANDLE WINAPI OpenSemaphoreA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI OpenSemaphoreW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); - - typedef VOID (WINAPI *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue); - -#ifdef UNICODE -#define CreateWaitableTimer CreateWaitableTimerW -#define OpenWaitableTimer OpenWaitableTimerW -#define CreateFileMapping CreateFileMappingW -#define OpenFileMapping OpenFileMappingW -#define GetLogicalDriveStrings GetLogicalDriveStringsW -#define LoadLibrary LoadLibraryW -#define LoadLibraryEx LoadLibraryExW -#define GetModuleFileName GetModuleFileNameW -#define GetModuleHandle GetModuleHandleW -#else -#define CreateWaitableTimer CreateWaitableTimerA -#define OpenWaitableTimer OpenWaitableTimerA -#define CreateFileMapping CreateFileMappingA -#define OpenFileMapping OpenFileMappingA -#define GetLogicalDriveStrings GetLogicalDriveStringsA -#define LoadLibrary LoadLibraryA -#define LoadLibraryEx LoadLibraryExA -#define GetModuleFileName GetModuleFileNameA -#define GetModuleHandle GetModuleHandleA -#endif - - WINBASEAPI HANDLE WINAPI CreateWaitableTimerA(LPSECURITY_ATTRIBUTES lpTimerAttributes,WINBOOL bManualReset,LPCSTR lpTimerName); - WINBASEAPI HANDLE WINAPI CreateWaitableTimerW(LPSECURITY_ATTRIBUTES lpTimerAttributes,WINBOOL bManualReset,LPCWSTR lpTimerName); - WINBASEAPI HANDLE WINAPI OpenWaitableTimerA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpTimerName); - WINBASEAPI HANDLE WINAPI OpenWaitableTimerW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpTimerName); - WINBASEAPI WINBOOL WINAPI SetWaitableTimer(HANDLE hTimer,const LARGE_INTEGER *lpDueTime,LONG lPeriod,PTIMERAPCROUTINE pfnCompletionRoutine,LPVOID lpArgToCompletionRoutine,WINBOOL fResume); - WINBASEAPI WINBOOL WINAPI CancelWaitableTimer(HANDLE hTimer); - WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE hFile,LPSECURITY_ATTRIBUTES lpFileMappingAttributes,DWORD flProtect,DWORD dwMaximumSizeHigh,DWORD dwMaximumSizeLow,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE hFile,LPSECURITY_ATTRIBUTES lpFileMappingAttributes,DWORD flProtect,DWORD dwMaximumSizeHigh,DWORD dwMaximumSizeLow,LPCWSTR lpName); - WINBASEAPI HANDLE WINAPI OpenFileMappingA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI OpenFileMappingW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); - WINBASEAPI DWORD WINAPI GetLogicalDriveStringsA(DWORD nBufferLength,LPSTR lpBuffer); - WINBASEAPI DWORD WINAPI GetLogicalDriveStringsW(DWORD nBufferLength,LPWSTR lpBuffer); - - typedef enum _MEMORY_RESOURCE_NOTIFICATION_TYPE { - LowMemoryResourceNotification,HighMemoryResourceNotification - } MEMORY_RESOURCE_NOTIFICATION_TYPE; - - WINBASEAPI HANDLE WINAPI CreateMemoryResourceNotification(MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType); - WINBASEAPI WINBOOL WINAPI QueryMemoryResourceNotification(HANDLE ResourceNotificationHandle,PBOOL ResourceState); - WINBASEAPI HMODULE WINAPI LoadLibraryA(LPCSTR lpLibFileName); - WINBASEAPI HMODULE WINAPI LoadLibraryW(LPCWSTR lpLibFileName); - WINBASEAPI HMODULE WINAPI LoadLibraryExA(LPCSTR lpLibFileName,HANDLE hFile,DWORD dwFlags); - WINBASEAPI HMODULE WINAPI LoadLibraryExW(LPCWSTR lpLibFileName,HANDLE hFile,DWORD dwFlags); - -#define DONT_RESOLVE_DLL_REFERENCES 0x1 -#define LOAD_LIBRARY_AS_DATAFILE 0x2 -#define LOAD_WITH_ALTERED_SEARCH_PATH 0x8 -#define LOAD_IGNORE_CODE_AUTHZ_LEVEL 0x10 -#define LOAD_LINRARY_AS_IMAGE_RESOURCE 0x20 -#define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x40 -#define LOAD_LIBRARY_REQUIRE_SIGNED_TARGET 0x80 -#define LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR 0x100 -#define LOAD_LIBRARY_SEARCH_APPLICATION_DIR 0x200 -#define LOAD_LIBRARY_SEARCH_USER_DIRS 0x400 -#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x800 -#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x1000 -#define LOAD_LIBRARY_SAFE_CURRENT_DIRS 0x2000 - - WINBASEAPI DWORD WINAPI GetModuleFileNameA(HMODULE hModule,LPCH lpFilename,DWORD nSize); - WINBASEAPI DWORD WINAPI GetModuleFileNameW(HMODULE hModule,LPWCH lpFilename,DWORD nSize); - WINBASEAPI HMODULE WINAPI GetModuleHandleA(LPCSTR lpModuleName); - WINBASEAPI HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName); - -#ifndef RC_INVOKED -#define GET_MODULE_HANDLE_EX_FLAG_PIN (0x1) -#define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT (0x2) -#define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS (0x4) - - typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXA)(DWORD dwFlags,LPCSTR lpModuleName,HMODULE *phModule); - typedef WINBOOL (WINAPI *PGET_MODULE_HANDLE_EXW)(DWORD dwFlags,LPCWSTR lpModuleName,HMODULE *phModule); - -#ifdef UNICODE -#define PGET_MODULE_HANDLE_EX PGET_MODULE_HANDLE_EXW -#define GetModuleHandleEx GetModuleHandleExW -#else -#define PGET_MODULE_HANDLE_EX PGET_MODULE_HANDLE_EXA -#define GetModuleHandleEx GetModuleHandleExA -#endif - - WINBASEAPI WINBOOL WINAPI GetModuleHandleExA(DWORD dwFlags,LPCSTR lpModuleName,HMODULE *phModule); - WINBASEAPI WINBOOL WINAPI GetModuleHandleExW(DWORD dwFlags,LPCWSTR lpModuleName,HMODULE *phModule); -#endif - -#ifdef UNICODE -#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW -#define CreateProcess CreateProcessW -#define FatalAppExit FatalAppExitW -#define GetStartupInfo GetStartupInfoW -#define GetCommandLine GetCommandLineW -#define GetEnvironmentVariable GetEnvironmentVariableW -#define SetEnvironmentVariable SetEnvironmentVariableW -#define ExpandEnvironmentStrings ExpandEnvironmentStringsW -#define GetFirmwareEnvironmentVariable GetFirmwareEnvironmentVariableW -#define SetFirmwareEnvironmentVariable SetFirmwareEnvironmentVariableW -#define OutputDebugString OutputDebugStringW -#define FindResource FindResourceW -#define FindResourceEx FindResourceExW -#else -#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA -#define CreateProcess CreateProcessA -#define FatalAppExit FatalAppExitA -#define GetStartupInfo GetStartupInfoA -#define GetCommandLine GetCommandLineA -#define GetEnvironmentVariable GetEnvironmentVariableA -#define SetEnvironmentVariable SetEnvironmentVariableA -#define ExpandEnvironmentStrings ExpandEnvironmentStringsA -#define GetFirmwareEnvironmentVariable GetFirmwareEnvironmentVariableA -#define SetFirmwareEnvironmentVariable SetFirmwareEnvironmentVariableA -#define OutputDebugString OutputDebugStringA -#define FindResource FindResourceA -#define FindResourceEx FindResourceExA -#endif - - WINBASEAPI WINBOOL WINAPI NeedCurrentDirectoryForExePathA(LPCSTR ExeName); - WINBASEAPI WINBOOL WINAPI NeedCurrentDirectoryForExePathW(LPCWSTR ExeName); - WINBASEAPI WINBOOL WINAPI CreateProcessA(LPCSTR lpApplicationName,LPSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCSTR lpCurrentDirectory,LPSTARTUPINFOA lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); - WINBASEAPI WINBOOL WINAPI CreateProcessW(LPCWSTR lpApplicationName,LPWSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); - WINBASEAPI DWORD WINAPI AddLocalAlternateComputerNameA(LPCSTR lpDnsFQHostname,ULONG ulFlags); - WINBASEAPI DWORD WINAPI AddLocalAlternateComputerNameW(LPCWSTR lpDnsFQHostname,ULONG ulFlags); - WINBASEAPI WINBOOL WINAPI SetProcessShutdownParameters(DWORD dwLevel,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI GetProcessShutdownParameters(LPDWORD lpdwLevel,LPDWORD lpdwFlags); - WINBASEAPI DWORD WINAPI GetProcessVersion(DWORD ProcessId); - WINBASEAPI VOID WINAPI FatalAppExitA(UINT uAction,LPCSTR lpMessageText); - WINBASEAPI VOID WINAPI FatalAppExitW(UINT uAction,LPCWSTR lpMessageText); - WINBASEAPI VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo); - WINBASEAPI VOID WINAPI GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo); - WINBASEAPI LPSTR WINAPI GetCommandLineA(VOID); - WINBASEAPI LPWSTR WINAPI GetCommandLineW(VOID); - WINBASEAPI DWORD WINAPI GetEnvironmentVariableA(LPCSTR lpName,LPSTR lpBuffer,DWORD nSize); - WINBASEAPI DWORD WINAPI GetEnvironmentVariableW(LPCWSTR lpName,LPWSTR lpBuffer,DWORD nSize); - WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableA(LPCSTR lpName,LPCSTR lpValue); - WINBASEAPI WINBOOL WINAPI SetEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpValue); - WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsA(LPCSTR lpSrc,LPSTR lpDst,DWORD nSize); - WINBASEAPI DWORD WINAPI ExpandEnvironmentStringsW(LPCWSTR lpSrc,LPWSTR lpDst,DWORD nSize); - WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR lpName,LPCSTR lpGuid,PVOID pBuffer,DWORD nSize); - WINBASEAPI DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpGuid,PVOID pBuffer,DWORD nSize); - WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableA(LPCSTR lpName,LPCSTR lpGuid,PVOID pValue,DWORD nSize); - WINBASEAPI WINBOOL WINAPI SetFirmwareEnvironmentVariableW(LPCWSTR lpName,LPCWSTR lpGuid,PVOID pValue,DWORD nSize); - WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString); - WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString); - WINBASEAPI HRSRC WINAPI FindResourceA(HMODULE hModule,LPCSTR lpName,LPCSTR lpType); - WINBASEAPI HRSRC WINAPI FindResourceW(HMODULE hModule,LPCWSTR lpName,LPCWSTR lpType); - WINBASEAPI HRSRC WINAPI FindResourceExA(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,WORD wLanguage); - WINBASEAPI HRSRC WINAPI FindResourceExW(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage); - -#ifdef UNICODE -#define ENUMRESTYPEPROC ENUMRESTYPEPROCW -#define ENUMRESNAMEPROC ENUMRESNAMEPROCW -#define ENUMRESLANGPROC ENUMRESLANGPROCW -#define EnumResourceTypes EnumResourceTypesW -#define EnumResourceNames EnumResourceNamesW -#define EnumResourceLanguages EnumResourceLanguagesW -#define BeginUpdateResource BeginUpdateResourceW -#define UpdateResource UpdateResourceW -#define EndUpdateResource EndUpdateResourceW -#define GlobalAddAtom GlobalAddAtomW -#define GlobalFindAtom GlobalFindAtomW -#define GlobalGetAtomName GlobalGetAtomNameW -#define AddAtom AddAtomW -#define FindAtom FindAtomW -#define GetAtomName GetAtomNameW -#define GetProfileInt GetProfileIntW -#define GetProfileString GetProfileStringW -#define WriteProfileString WriteProfileStringW -#define GetProfileSection GetProfileSectionW -#define WriteProfileSection WriteProfileSectionW -#define GetPrivateProfileInt GetPrivateProfileIntW -#define GetPrivateProfileString GetPrivateProfileStringW -#define WritePrivateProfileString WritePrivateProfileStringW -#define GetPrivateProfileSection GetPrivateProfileSectionW -#define WritePrivateProfileSection WritePrivateProfileSectionW -#define GetPrivateProfileSectionNames GetPrivateProfileSectionNamesW -#define GetPrivateProfileStruct GetPrivateProfileStructW -#define WritePrivateProfileStruct WritePrivateProfileStructW -#define GetDriveType GetDriveTypeW -#define GetSystemDirectory GetSystemDirectoryW -#define GetTempPath GetTempPathW -#define GetTempFileName GetTempFileNameW -#define GetWindowsDirectory GetWindowsDirectoryW -#define GetSystemWindowsDirectory GetSystemWindowsDirectoryW -#define AddLocalAlternateComputerName AddLocalAlternateComputerNameW -#else -#define ENUMRESTYPEPROC ENUMRESTYPEPROCA -#define ENUMRESNAMEPROC ENUMRESNAMEPROCA -#define ENUMRESLANGPROC ENUMRESLANGPROCA -#define EnumResourceTypes EnumResourceTypesA -#define EnumResourceNames EnumResourceNamesA -#define EnumResourceLanguages EnumResourceLanguagesA -#define BeginUpdateResource BeginUpdateResourceA -#define UpdateResource UpdateResourceA -#define EndUpdateResource EndUpdateResourceA -#define GlobalAddAtom GlobalAddAtomA -#define GlobalFindAtom GlobalFindAtomA -#define GlobalGetAtomName GlobalGetAtomNameA -#define AddAtom AddAtomA -#define FindAtom FindAtomA -#define GetAtomName GetAtomNameA -#define GetProfileInt GetProfileIntA -#define GetProfileString GetProfileStringA -#define WriteProfileString WriteProfileStringA -#define GetProfileSection GetProfileSectionA -#define WriteProfileSection WriteProfileSectionA -#define GetPrivateProfileInt GetPrivateProfileIntA -#define GetPrivateProfileString GetPrivateProfileStringA -#define WritePrivateProfileString WritePrivateProfileStringA -#define GetPrivateProfileSection GetPrivateProfileSectionA -#define WritePrivateProfileSection WritePrivateProfileSectionA -#define GetPrivateProfileSectionNames GetPrivateProfileSectionNamesA -#define GetPrivateProfileStruct GetPrivateProfileStructA -#define WritePrivateProfileStruct WritePrivateProfileStructA -#define GetDriveType GetDriveTypeA -#define GetSystemDirectory GetSystemDirectoryA -#define GetTempPath GetTempPathA -#define GetTempFileName GetTempFileNameA -#define GetWindowsDirectory GetWindowsDirectoryA -#define GetSystemWindowsDirectory GetSystemWindowsDirectoryA -#define AddLocalAlternateComputerName AddLocalAlternateComputerNameA -#endif - - typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCA)(HMODULE hModule,LPSTR lpType,LONG_PTR lParam); - typedef WINBOOL (CALLBACK *ENUMRESTYPEPROCW)(HMODULE hModule,LPWSTR lpType,LONG_PTR lParam); - typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCA)(HMODULE hModule,LPCSTR lpType,LPSTR lpName,LONG_PTR lParam); - typedef WINBOOL (CALLBACK *ENUMRESNAMEPROCW)(HMODULE hModule,LPCWSTR lpType,LPWSTR lpName,LONG_PTR lParam); - typedef WINBOOL (CALLBACK *ENUMRESLANGPROCA)(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,WORD wLanguage,LONG_PTR lParam); - typedef WINBOOL (CALLBACK *ENUMRESLANGPROCW)(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage,LONG_PTR lParam); - - WINBASEAPI WINBOOL WINAPI EnumResourceTypesA(HMODULE hModule,ENUMRESTYPEPROCA lpEnumFunc,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumResourceTypesW(HMODULE hModule,ENUMRESTYPEPROCW lpEnumFunc,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumResourceNamesA(HMODULE hModule,LPCSTR lpType,ENUMRESNAMEPROCA lpEnumFunc,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumResourceNamesW(HMODULE hModule,LPCWSTR lpType,ENUMRESNAMEPROCW lpEnumFunc,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesA(HMODULE hModule,LPCSTR lpType,LPCSTR lpName,ENUMRESLANGPROCA lpEnumFunc,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumResourceLanguagesW(HMODULE hModule,LPCWSTR lpType,LPCWSTR lpName,ENUMRESLANGPROCW lpEnumFunc,LONG_PTR lParam); - WINBASEAPI HANDLE WINAPI BeginUpdateResourceA(LPCSTR pFileName,WINBOOL bDeleteExistingResources); - WINBASEAPI HANDLE WINAPI BeginUpdateResourceW(LPCWSTR pFileName,WINBOOL bDeleteExistingResources); - WINBASEAPI WINBOOL WINAPI UpdateResourceA(HANDLE hUpdate,LPCSTR lpType,LPCSTR lpName,WORD wLanguage,LPVOID lpData,DWORD cb); - WINBASEAPI WINBOOL WINAPI UpdateResourceW(HANDLE hUpdate,LPCWSTR lpType,LPCWSTR lpName,WORD wLanguage,LPVOID lpData,DWORD cb); - WINBASEAPI WINBOOL WINAPI EndUpdateResourceA(HANDLE hUpdate,WINBOOL fDiscard); - WINBASEAPI WINBOOL WINAPI EndUpdateResourceW(HANDLE hUpdate,WINBOOL fDiscard); - WINBASEAPI ATOM WINAPI GlobalAddAtomA(LPCSTR lpString); - WINBASEAPI ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString); - WINBASEAPI ATOM WINAPI GlobalFindAtomA(LPCSTR lpString); - WINBASEAPI ATOM WINAPI GlobalFindAtomW(LPCWSTR lpString); - WINBASEAPI UINT WINAPI GlobalGetAtomNameA(ATOM nAtom,LPSTR lpBuffer,int nSize); - WINBASEAPI UINT WINAPI GlobalGetAtomNameW(ATOM nAtom,LPWSTR lpBuffer,int nSize); - WINBASEAPI ATOM WINAPI AddAtomA(LPCSTR lpString); - WINBASEAPI ATOM WINAPI AddAtomW(LPCWSTR lpString); - WINBASEAPI ATOM WINAPI FindAtomA(LPCSTR lpString); - WINBASEAPI ATOM WINAPI FindAtomW(LPCWSTR lpString); - WINBASEAPI UINT WINAPI GetAtomNameA(ATOM nAtom,LPSTR lpBuffer,int nSize); - WINBASEAPI UINT WINAPI GetAtomNameW(ATOM nAtom,LPWSTR lpBuffer,int nSize); - WINBASEAPI UINT WINAPI GetProfileIntA(LPCSTR lpAppName,LPCSTR lpKeyName,INT nDefault); - WINBASEAPI UINT WINAPI GetProfileIntW(LPCWSTR lpAppName,LPCWSTR lpKeyName,INT nDefault); - WINBASEAPI DWORD WINAPI GetProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault,LPSTR lpReturnedString,DWORD nSize); - WINBASEAPI DWORD WINAPI GetProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpDefault,LPWSTR lpReturnedString,DWORD nSize); - WINBASEAPI WINBOOL WINAPI WriteProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpString); - WINBASEAPI WINBOOL WINAPI WriteProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString); - WINBASEAPI DWORD WINAPI GetProfileSectionA(LPCSTR lpAppName,LPSTR lpReturnedString,DWORD nSize); - WINBASEAPI DWORD WINAPI GetProfileSectionW(LPCWSTR lpAppName,LPWSTR lpReturnedString,DWORD nSize); - WINBASEAPI WINBOOL WINAPI WriteProfileSectionA(LPCSTR lpAppName,LPCSTR lpString); - WINBASEAPI WINBOOL WINAPI WriteProfileSectionW(LPCWSTR lpAppName,LPCWSTR lpString); - WINBASEAPI UINT WINAPI GetPrivateProfileIntA(LPCSTR lpAppName,LPCSTR lpKeyName,INT nDefault,LPCSTR lpFileName); - WINBASEAPI UINT WINAPI GetPrivateProfileIntW(LPCWSTR lpAppName,LPCWSTR lpKeyName,INT nDefault,LPCWSTR lpFileName); - WINBASEAPI DWORD WINAPI GetPrivateProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpDefault,LPSTR lpReturnedString,DWORD nSize,LPCSTR lpFileName); - WINBASEAPI DWORD WINAPI GetPrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpDefault,LPWSTR lpReturnedString,DWORD nSize,LPCWSTR lpFileName); - WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringA(LPCSTR lpAppName,LPCSTR lpKeyName,LPCSTR lpString,LPCSTR lpFileName); - WINBASEAPI WINBOOL WINAPI WritePrivateProfileStringW(LPCWSTR lpAppName,LPCWSTR lpKeyName,LPCWSTR lpString,LPCWSTR lpFileName); - WINBASEAPI DWORD WINAPI GetPrivateProfileSectionA(LPCSTR lpAppName,LPSTR lpReturnedString,DWORD nSize,LPCSTR lpFileName); - WINBASEAPI DWORD WINAPI GetPrivateProfileSectionW(LPCWSTR lpAppName,LPWSTR lpReturnedString,DWORD nSize,LPCWSTR lpFileName); - WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionA(LPCSTR lpAppName,LPCSTR lpString,LPCSTR lpFileName); - WINBASEAPI WINBOOL WINAPI WritePrivateProfileSectionW(LPCWSTR lpAppName,LPCWSTR lpString,LPCWSTR lpFileName); - WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesA(LPSTR lpszReturnBuffer,DWORD nSize,LPCSTR lpFileName); - WINBASEAPI DWORD WINAPI GetPrivateProfileSectionNamesW(LPWSTR lpszReturnBuffer,DWORD nSize,LPCWSTR lpFileName); - WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructA(LPCSTR lpszSection,LPCSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCSTR szFile); - WINBASEAPI WINBOOL WINAPI GetPrivateProfileStructW(LPCWSTR lpszSection,LPCWSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCWSTR szFile); - WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructA(LPCSTR lpszSection,LPCSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCSTR szFile); - WINBASEAPI WINBOOL WINAPI WritePrivateProfileStructW(LPCWSTR lpszSection,LPCWSTR lpszKey,LPVOID lpStruct,UINT uSizeStruct,LPCWSTR szFile); - WINBASEAPI UINT WINAPI GetDriveTypeA(LPCSTR lpRootPathName); - WINBASEAPI UINT WINAPI GetDriveTypeW(LPCWSTR lpRootPathName); - WINBASEAPI UINT WINAPI GetSystemDirectoryA(LPSTR lpBuffer,UINT uSize); - WINBASEAPI UINT WINAPI GetSystemDirectoryW(LPWSTR lpBuffer,UINT uSize); - WINBASEAPI DWORD WINAPI GetTempPathA(DWORD nBufferLength,LPSTR lpBuffer); - WINBASEAPI DWORD WINAPI GetTempPathW(DWORD nBufferLength,LPWSTR lpBuffer); - WINBASEAPI UINT WINAPI GetTempFileNameA(LPCSTR lpPathName,LPCSTR lpPrefixString,UINT uUnique,LPSTR lpTempFileName); - WINBASEAPI UINT WINAPI GetTempFileNameW(LPCWSTR lpPathName,LPCWSTR lpPrefixString,UINT uUnique,LPWSTR lpTempFileName); - WINBASEAPI UINT WINAPI GetWindowsDirectoryA(LPSTR lpBuffer,UINT uSize); - WINBASEAPI UINT WINAPI GetWindowsDirectoryW(LPWSTR lpBuffer,UINT uSize); - WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryA(LPSTR lpBuffer,UINT uSize); - WINBASEAPI UINT WINAPI GetSystemWindowsDirectoryW(LPWSTR lpBuffer,UINT uSize); - -#ifndef RC_INVOKED -#ifdef UNICODE -#define GetSystemWow64Directory GetSystemWow64DirectoryW -#else -#define GetSystemWow64Directory GetSystemWow64DirectoryA -#endif - - WINBASEAPI UINT WINAPI GetSystemWow64DirectoryA(LPSTR lpBuffer,UINT uSize); - WINBASEAPI UINT WINAPI GetSystemWow64DirectoryW(LPWSTR lpBuffer,UINT uSize); - WINBASEAPI BOOLEAN WINAPI Wow64EnableWow64FsRedirection(BOOLEAN Wow64FsEnableRedirection); - WINBASEAPI WINBOOL WINAPI Wow64DisableWow64FsRedirection(PVOID *OldValue); - WINBASEAPI WINBOOL WINAPI Wow64RevertWow64FsRedirection(PVOID OlValue); - - typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_A)(LPSTR lpBuffer,UINT uSize); - typedef UINT (WINAPI *PGET_SYSTEM_WOW64_DIRECTORY_W)(LPWSTR lpBuffer,UINT uSize); - -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A "GetSystemWow64DirectoryA" -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W L"GetSystemWow64DirectoryA" -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T TEXT("GetSystemWow64DirectoryA") -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A "GetSystemWow64DirectoryW" -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W L"GetSystemWow64DirectoryW" -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T TEXT("GetSystemWow64DirectoryW") - -#ifdef UNICODE -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A GET_SYSTEM_WOW64_DIRECTORY_NAME_W_A -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W GET_SYSTEM_WOW64_DIRECTORY_NAME_W_W -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T GET_SYSTEM_WOW64_DIRECTORY_NAME_W_T -#else -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_A GET_SYSTEM_WOW64_DIRECTORY_NAME_A_A -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_W GET_SYSTEM_WOW64_DIRECTORY_NAME_A_W -#define GET_SYSTEM_WOW64_DIRECTORY_NAME_T_T GET_SYSTEM_WOW64_DIRECTORY_NAME_A_T -#endif -#endif - -#ifdef UNICODE -#define SetCurrentDirectory SetCurrentDirectoryW -#define GetCurrentDirectory GetCurrentDirectoryW -#define SetDllDirectory SetDllDirectoryW -#define GetDllDirectory GetDllDirectoryW -#define GetDiskFreeSpace GetDiskFreeSpaceW -#define GetDiskFreeSpaceEx GetDiskFreeSpaceExW -#define CreateDirectory CreateDirectoryW -#define CreateDirectoryEx CreateDirectoryExW -#define RemoveDirectory RemoveDirectoryW -#define GetFullPathName GetFullPathNameW -#define DefineDosDevice DefineDosDeviceW -#define QueryDosDevice QueryDosDeviceW -#define CreateFile CreateFileW -#define SetFileAttributes SetFileAttributesW -#define GetFileAttributes GetFileAttributesW -#else -#define SetCurrentDirectory SetCurrentDirectoryA -#define GetCurrentDirectory GetCurrentDirectoryA -#define SetDllDirectory SetDllDirectoryA -#define GetDllDirectory GetDllDirectoryA -#define GetDiskFreeSpace GetDiskFreeSpaceA -#define GetDiskFreeSpaceEx GetDiskFreeSpaceExA -#define CreateDirectory CreateDirectoryA -#define CreateDirectoryEx CreateDirectoryExA -#define RemoveDirectory RemoveDirectoryA -#define GetFullPathName GetFullPathNameA -#define DefineDosDevice DefineDosDeviceA -#define QueryDosDevice QueryDosDeviceA -#define CreateFile CreateFileA -#define SetFileAttributes SetFileAttributesA -#define GetFileAttributes GetFileAttributesA -#endif - - WINBASEAPI WINBOOL WINAPI SetCurrentDirectoryA(LPCSTR lpPathName); - WINBASEAPI WINBOOL WINAPI SetCurrentDirectoryW(LPCWSTR lpPathName); - WINBASEAPI DWORD WINAPI GetCurrentDirectoryA(DWORD nBufferLength,LPSTR lpBuffer); - WINBASEAPI DWORD WINAPI GetCurrentDirectoryW(DWORD nBufferLength,LPWSTR lpBuffer); - WINBASEAPI WINBOOL WINAPI SetDllDirectoryA(LPCSTR lpPathName); - WINBASEAPI WINBOOL WINAPI SetDllDirectoryW(LPCWSTR lpPathName); - WINBASEAPI DWORD WINAPI GetDllDirectoryA(DWORD nBufferLength,LPSTR lpBuffer); - WINBASEAPI DWORD WINAPI GetDllDirectoryW(DWORD nBufferLength,LPWSTR lpBuffer); - WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceA(LPCSTR lpRootPathName,LPDWORD lpSectorsPerCluster,LPDWORD lpBytesPerSector,LPDWORD lpNumberOfFreeClusters,LPDWORD lpTotalNumberOfClusters); - WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceW(LPCWSTR lpRootPathName,LPDWORD lpSectorsPerCluster,LPDWORD lpBytesPerSector,LPDWORD lpNumberOfFreeClusters,LPDWORD lpTotalNumberOfClusters); - WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExA(LPCSTR lpDirectoryName,PULARGE_INTEGER lpFreeBytesAvailableToCaller,PULARGE_INTEGER lpTotalNumberOfBytes,PULARGE_INTEGER lpTotalNumberOfFreeBytes); - WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExW(LPCWSTR lpDirectoryName,PULARGE_INTEGER lpFreeBytesAvailableToCaller,PULARGE_INTEGER lpTotalNumberOfBytes,PULARGE_INTEGER lpTotalNumberOfFreeBytes); - WINBASEAPI WINBOOL WINAPI CreateDirectoryA(LPCSTR lpPathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI WINBOOL WINAPI CreateDirectoryW(LPCWSTR lpPathName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI WINBOOL WINAPI CreateDirectoryExA(LPCSTR lpTemplateDirectory,LPCSTR lpNewDirectory,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI WINBOOL WINAPI CreateDirectoryExW(LPCWSTR lpTemplateDirectory,LPCWSTR lpNewDirectory,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI WINBOOL WINAPI RemoveDirectoryA(LPCSTR lpPathName); - WINBASEAPI WINBOOL WINAPI RemoveDirectoryW(LPCWSTR lpPathName); - WINBASEAPI DWORD WINAPI GetFullPathNameA(LPCSTR lpFileName,DWORD nBufferLength,LPSTR lpBuffer,LPSTR *lpFilePart); - WINBASEAPI DWORD WINAPI GetFullPathNameW(LPCWSTR lpFileName,DWORD nBufferLength,LPWSTR lpBuffer,LPWSTR *lpFilePart); - -#define DDD_RAW_TARGET_PATH 0x1 -#define DDD_REMOVE_DEFINITION 0x2 -#define DDD_EXACT_MATCH_ON_REMOVE 0x4 -#define DDD_NO_BROADCAST_SYSTEM 0x8 -#define DDD_LUID_BROADCAST_DRIVE 0x10 - - WINBASEAPI WINBOOL WINAPI DefineDosDeviceA(DWORD dwFlags,LPCSTR lpDeviceName,LPCSTR lpTargetPath); - WINBASEAPI WINBOOL WINAPI DefineDosDeviceW(DWORD dwFlags,LPCWSTR lpDeviceName,LPCWSTR lpTargetPath); - WINBASEAPI DWORD WINAPI QueryDosDeviceA(LPCSTR lpDeviceName,LPSTR lpTargetPath,DWORD ucchMax); - WINBASEAPI DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName,LPWSTR lpTargetPath,DWORD ucchMax); - -#define EXPAND_LOCAL_DRIVES - - WINBASEAPI HANDLE WINAPI CreateFileA(LPCSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile); - WINBASEAPI HANDLE WINAPI CreateFileW(LPCWSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile); - WINBASEAPI HANDLE WINAPI ReOpenFile(HANDLE hOriginalFile,DWORD dwDesiredAccess,DWORD dwShareMode,DWORD dwFlagsAndAttributes); - WINBASEAPI WINBOOL WINAPI SetFileAttributesA(LPCSTR lpFileName,DWORD dwFileAttributes); - WINBASEAPI WINBOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName,DWORD dwFileAttributes); - WINBASEAPI DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName); - WINBASEAPI DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName); - - typedef enum _GET_FILEEX_INFO_LEVELS { - GetFileExInfoStandard,GetFileExMaxInfoLevel - } GET_FILEEX_INFO_LEVELS; - -#ifdef UNICODE -#define GetFileAttributesEx GetFileAttributesExW -#define GetCompressedFileSize GetCompressedFileSizeW -#define DeleteFile DeleteFileW -#define CheckNameLegalDOS8Dot3 CheckNameLegalDOS8Dot3W -#else -#define GetFileAttributesEx GetFileAttributesExA -#define GetCompressedFileSize GetCompressedFileSizeA -#define DeleteFile DeleteFileA -#define CheckNameLegalDOS8Dot3 CheckNameLegalDOS8Dot3A -#endif - - WINBASEAPI WINBOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation); - WINBASEAPI WINBOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName,GET_FILEEX_INFO_LEVELS fInfoLevelId,LPVOID lpFileInformation); - WINBASEAPI DWORD WINAPI GetCompressedFileSizeA(LPCSTR lpFileName,LPDWORD lpFileSizeHigh); - WINBASEAPI DWORD WINAPI GetCompressedFileSizeW(LPCWSTR lpFileName,LPDWORD lpFileSizeHigh); - WINBASEAPI WINBOOL WINAPI DeleteFileA(LPCSTR lpFileName); - WINBASEAPI WINBOOL WINAPI DeleteFileW(LPCWSTR lpFileName); - WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3A(LPCSTR lpName,LPSTR lpOemName,DWORD OemNameSize,PBOOL pbNameContainsSpaces,PBOOL pbNameLegal); - WINBASEAPI WINBOOL WINAPI CheckNameLegalDOS8Dot3W(LPCWSTR lpName,LPSTR lpOemName,DWORD OemNameSize,PBOOL pbNameContainsSpaces,PBOOL pbNameLegal); - - typedef enum _FINDEX_INFO_LEVELS { - FindExInfoStandard,FindExInfoMaxInfoLevel - } FINDEX_INFO_LEVELS; - - typedef enum _FINDEX_SEARCH_OPS { - FindExSearchNameMatch,FindExSearchLimitToDirectories,FindExSearchLimitToDevices,FindExSearchMaxSearchOp - } FINDEX_SEARCH_OPS; - -#define FIND_FIRST_EX_CASE_SENSITIVE 0x1 - -#ifdef UNICODE -#define FindFirstFileEx FindFirstFileExW -#define FindFirstFile FindFirstFileW -#define FindNextFile FindNextFileW -#define SearchPath SearchPathW -#define CopyFile CopyFileW -#define CopyFileEx CopyFileExW -#define MoveFile MoveFileW -#define MoveFileEx MoveFileExW -#define MoveFileWithProgress MoveFileWithProgressW -#define ReplaceFile ReplaceFileW -#define CreateHardLink CreateHardLinkW -#define CreateNamedPipe CreateNamedPipeW -#define GetNamedPipeHandleState GetNamedPipeHandleStateW -#define CallNamedPipe CallNamedPipeW -#define WaitNamedPipe WaitNamedPipeW -#define SetVolumeLabel SetVolumeLabelW -#define GetVolumeInformation GetVolumeInformationW -#define ClearEventLog ClearEventLogW -#define BackupEventLog BackupEventLogW -#define OpenEventLog OpenEventLogW -#define RegisterEventSource RegisterEventSourceW -#define OpenBackupEventLog OpenBackupEventLogW -#define ReadEventLog ReadEventLogW -#define ReportEvent ReportEventW -#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmW -#define AccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmW -#define AccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmW -#define AccessCheckByTypeResultListAndAuditAlarmByHandle AccessCheckByTypeResultListAndAuditAlarmByHandleW -#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmW -#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmW -#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmW -#define ObjectDeleteAuditAlarm ObjectDeleteAuditAlarmW -#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmW -#define SetFileSecurity SetFileSecurityW -#define GetFileSecurity GetFileSecurityW -#define FindFirstChangeNotification FindFirstChangeNotificationW -#define IsBadStringPtr IsBadStringPtrW -#define LookupAccountSid LookupAccountSidW -#define LookupAccountName LookupAccountNameW -#define LookupPrivilegeValue LookupPrivilegeValueW -#define LookupPrivilegeName LookupPrivilegeNameW -#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameW -#define BuildCommDCB BuildCommDCBW -#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsW -#define CommConfigDialog CommConfigDialogW -#define GetDefaultCommConfig GetDefaultCommConfigW -#define SetDefaultCommConfig SetDefaultCommConfigW -#define GetComputerName GetComputerNameW -#define SetComputerName SetComputerNameW -#define GetComputerNameEx GetComputerNameExW -#define SetComputerNameEx SetComputerNameExW -#define DnsHostnameToComputerName DnsHostnameToComputerNameW -#define GetUserName GetUserNameW -#else -#define FindFirstFileEx FindFirstFileExA -#define FindFirstFile FindFirstFileA -#define FindNextFile FindNextFileA -#define SearchPath SearchPathA -#define CopyFile CopyFileA -#define CopyFileEx CopyFileExA -#define MoveFile MoveFileA -#define MoveFileEx MoveFileExA -#define MoveFileWithProgress MoveFileWithProgressA -#define ReplaceFile ReplaceFileA -#define CreateHardLink CreateHardLinkA -#define CreateNamedPipe CreateNamedPipeA -#define GetNamedPipeHandleState GetNamedPipeHandleStateA -#define CallNamedPipe CallNamedPipeA -#define WaitNamedPipe WaitNamedPipeA -#define SetVolumeLabel SetVolumeLabelA -#define GetVolumeInformation GetVolumeInformationA -#define ClearEventLog ClearEventLogA -#define BackupEventLog BackupEventLogA -#define OpenEventLog OpenEventLogA -#define RegisterEventSource RegisterEventSourceA -#define OpenBackupEventLog OpenBackupEventLogA -#define ReadEventLog ReadEventLogA -#define ReportEvent ReportEventA -#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmA -#define AccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmA -#define AccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmA -#define AccessCheckByTypeResultListAndAuditAlarmByHandle AccessCheckByTypeResultListAndAuditAlarmByHandleA -#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmA -#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmA -#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmA -#define ObjectDeleteAuditAlarm ObjectDeleteAuditAlarmA -#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmA -#define SetFileSecurity SetFileSecurityA -#define GetFileSecurity GetFileSecurityA -#define FindFirstChangeNotification FindFirstChangeNotificationA -#define IsBadStringPtr IsBadStringPtrA -#define LookupAccountSid LookupAccountSidA -#define LookupAccountName LookupAccountNameA -#define LookupPrivilegeValue LookupPrivilegeValueA -#define LookupPrivilegeName LookupPrivilegeNameA -#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameA -#define BuildCommDCB BuildCommDCBA -#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsA -#define CommConfigDialog CommConfigDialogA -#define GetDefaultCommConfig GetDefaultCommConfigA -#define SetDefaultCommConfig SetDefaultCommConfigA -#define GetComputerName GetComputerNameA -#define SetComputerName SetComputerNameA -#define GetComputerNameEx GetComputerNameExA -#define SetComputerNameEx SetComputerNameExA -#define DnsHostnameToComputerName DnsHostnameToComputerNameA -#define GetUserName GetUserNameA -#endif - - WINBASEAPI HANDLE WINAPI FindFirstFileExA(LPCSTR lpFileName,FINDEX_INFO_LEVELS fInfoLevelId,LPVOID lpFindFileData,FINDEX_SEARCH_OPS fSearchOp,LPVOID lpSearchFilter,DWORD dwAdditionalFlags); - WINBASEAPI HANDLE WINAPI FindFirstFileExW(LPCWSTR lpFileName,FINDEX_INFO_LEVELS fInfoLevelId,LPVOID lpFindFileData,FINDEX_SEARCH_OPS fSearchOp,LPVOID lpSearchFilter,DWORD dwAdditionalFlags); - WINBASEAPI HANDLE WINAPI FindFirstFileA(LPCSTR lpFileName,LPWIN32_FIND_DATAA lpFindFileData); - WINBASEAPI HANDLE WINAPI FindFirstFileW(LPCWSTR lpFileName,LPWIN32_FIND_DATAW lpFindFileData); - WINBASEAPI WINBOOL WINAPI FindNextFileA(HANDLE hFindFile,LPWIN32_FIND_DATAA lpFindFileData); - WINBASEAPI WINBOOL WINAPI FindNextFileW(HANDLE hFindFile,LPWIN32_FIND_DATAW lpFindFileData); - WINBASEAPI DWORD WINAPI SearchPathA(LPCSTR lpPath,LPCSTR lpFileName,LPCSTR lpExtension,DWORD nBufferLength,LPSTR lpBuffer,LPSTR *lpFilePart); - WINBASEAPI DWORD WINAPI SearchPathW(LPCWSTR lpPath,LPCWSTR lpFileName,LPCWSTR lpExtension,DWORD nBufferLength,LPWSTR lpBuffer,LPWSTR *lpFilePart); - WINBASEAPI WINBOOL WINAPI CopyFileA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,WINBOOL bFailIfExists); - WINBASEAPI WINBOOL WINAPI CopyFileW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,WINBOOL bFailIfExists); - - typedef DWORD (WINAPI *LPPROGRESS_ROUTINE)(LARGE_INTEGER TotalFileSize,LARGE_INTEGER TotalBytesTransferred,LARGE_INTEGER StreamSize,LARGE_INTEGER StreamBytesTransferred,DWORD dwStreamNumber,DWORD dwCallbackReason,HANDLE hSourceFile,HANDLE hDestinationFile,LPVOID lpData); - - WINBASEAPI WINBOOL WINAPI CopyFileExA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,LPBOOL pbCancel,DWORD dwCopyFlags); - WINBASEAPI WINBOOL WINAPI CopyFileExW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,LPBOOL pbCancel,DWORD dwCopyFlags); - WINBASEAPI WINBOOL WINAPI MoveFileA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName); - WINBASEAPI WINBOOL WINAPI MoveFileW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName); - WINBASEAPI WINBOOL WINAPI MoveFileExA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI MoveFileExW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI MoveFileWithProgressA(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI MoveFileWithProgressW(LPCWSTR lpExistingFileName,LPCWSTR lpNewFileName,LPPROGRESS_ROUTINE lpProgressRoutine,LPVOID lpData,DWORD dwFlags); - -#define MOVEFILE_REPLACE_EXISTING 0x1 -#define MOVEFILE_COPY_ALLOWED 0x2 -#define MOVEFILE_DELAY_UNTIL_REBOOT 0x4 -#define MOVEFILE_WRITE_THROUGH 0x8 -#define MOVEFILE_CREATE_HARDLINK 0x10 -#define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x20 - - WINBASEAPI WINBOOL WINAPI ReplaceFileA(LPCSTR lpReplacedFileName,LPCSTR lpReplacementFileName,LPCSTR lpBackupFileName,DWORD dwReplaceFlags,LPVOID lpExclude,LPVOID lpReserved); - WINBASEAPI WINBOOL WINAPI ReplaceFileW(LPCWSTR lpReplacedFileName,LPCWSTR lpReplacementFileName,LPCWSTR lpBackupFileName,DWORD dwReplaceFlags,LPVOID lpExclude,LPVOID lpReserved); - WINBASEAPI WINBOOL WINAPI CreateHardLinkA(LPCSTR lpFileName,LPCSTR lpExistingFileName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI WINBOOL WINAPI CreateHardLinkW(LPCWSTR lpFileName,LPCWSTR lpExistingFileName,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - - typedef enum _STREAM_INFO_LEVELS { - FindStreamInfoStandard,FindStreamInfoMaxInfoLevel - } STREAM_INFO_LEVELS; - - typedef struct _WIN32_FIND_STREAM_DATA { - LARGE_INTEGER StreamSize; - WCHAR cStreamName[MAX_PATH + 36]; - } WIN32_FIND_STREAM_DATA,*PWIN32_FIND_STREAM_DATA; - - HANDLE WINAPI FindFirstStreamW(LPCWSTR lpFileName,STREAM_INFO_LEVELS InfoLevel,LPVOID lpFindStreamData,DWORD dwFlags); - WINBOOL WINAPI FindNextStreamW(HANDLE hFindStream,LPVOID lpFindStreamData); - WINBASEAPI HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName,DWORD dwOpenMode,DWORD dwPipeMode,DWORD nMaxInstances,DWORD nOutBufferSize,DWORD nInBufferSize,DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName,DWORD dwOpenMode,DWORD dwPipeMode,DWORD nMaxInstances,DWORD nOutBufferSize,DWORD nInBufferSize,DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateA(HANDLE hNamedPipe,LPDWORD lpState,LPDWORD lpCurInstances,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout,LPSTR lpUserName,DWORD nMaxUserNameSize); - WINBASEAPI WINBOOL WINAPI GetNamedPipeHandleStateW(HANDLE hNamedPipe,LPDWORD lpState,LPDWORD lpCurInstances,LPDWORD lpMaxCollectionCount,LPDWORD lpCollectDataTimeout,LPWSTR lpUserName,DWORD nMaxUserNameSize); - WINBASEAPI WINBOOL WINAPI CallNamedPipeA(LPCSTR lpNamedPipeName,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,DWORD nTimeOut); - WINBASEAPI WINBOOL WINAPI CallNamedPipeW(LPCWSTR lpNamedPipeName,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesRead,DWORD nTimeOut); - WINBASEAPI WINBOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName,DWORD nTimeOut); - WINBASEAPI WINBOOL WINAPI WaitNamedPipeW(LPCWSTR lpNamedPipeName,DWORD nTimeOut); - WINBASEAPI WINBOOL WINAPI SetVolumeLabelA(LPCSTR lpRootPathName,LPCSTR lpVolumeName); - WINBASEAPI WINBOOL WINAPI SetVolumeLabelW(LPCWSTR lpRootPathName,LPCWSTR lpVolumeName); - WINBASEAPI VOID WINAPI SetFileApisToOEM(VOID); - WINBASEAPI VOID WINAPI SetFileApisToANSI(VOID); - WINBASEAPI WINBOOL WINAPI AreFileApisANSI(VOID); - WINBASEAPI WINBOOL WINAPI GetVolumeInformationA(LPCSTR lpRootPathName,LPSTR lpVolumeNameBuffer,DWORD nVolumeNameSize,LPDWORD lpVolumeSerialNumber,LPDWORD lpMaximumComponentLength,LPDWORD lpFileSystemFlags,LPSTR lpFileSystemNameBuffer,DWORD nFileSystemNameSize); - WINBASEAPI WINBOOL WINAPI GetVolumeInformationW(LPCWSTR lpRootPathName,LPWSTR lpVolumeNameBuffer,DWORD nVolumeNameSize,LPDWORD lpVolumeSerialNumber,LPDWORD lpMaximumComponentLength,LPDWORD lpFileSystemFlags,LPWSTR lpFileSystemNameBuffer,DWORD nFileSystemNameSize); - WINBASEAPI WINBOOL WINAPI CancelIo(HANDLE hFile); - WINADVAPI WINBOOL WINAPI ClearEventLogA(HANDLE hEventLog,LPCSTR lpBackupFileName); - WINADVAPI WINBOOL WINAPI ClearEventLogW(HANDLE hEventLog,LPCWSTR lpBackupFileName); - WINADVAPI WINBOOL WINAPI BackupEventLogA(HANDLE hEventLog,LPCSTR lpBackupFileName); - WINADVAPI WINBOOL WINAPI BackupEventLogW(HANDLE hEventLog,LPCWSTR lpBackupFileName); - WINADVAPI WINBOOL WINAPI CloseEventLog(HANDLE hEventLog); - WINADVAPI WINBOOL WINAPI DeregisterEventSource(HANDLE hEventLog); - WINADVAPI WINBOOL WINAPI NotifyChangeEventLog(HANDLE hEventLog,HANDLE hEvent); - WINADVAPI WINBOOL WINAPI GetNumberOfEventLogRecords(HANDLE hEventLog,PDWORD NumberOfRecords); - WINADVAPI WINBOOL WINAPI GetOldestEventLogRecord(HANDLE hEventLog,PDWORD OldestRecord); - WINADVAPI HANDLE WINAPI OpenEventLogA(LPCSTR lpUNCServerName,LPCSTR lpSourceName); - WINADVAPI HANDLE WINAPI OpenEventLogW(LPCWSTR lpUNCServerName,LPCWSTR lpSourceName); - WINADVAPI HANDLE WINAPI RegisterEventSourceA(LPCSTR lpUNCServerName,LPCSTR lpSourceName); - WINADVAPI HANDLE WINAPI RegisterEventSourceW(LPCWSTR lpUNCServerName,LPCWSTR lpSourceName); - WINADVAPI HANDLE WINAPI OpenBackupEventLogA(LPCSTR lpUNCServerName,LPCSTR lpFileName); - WINADVAPI HANDLE WINAPI OpenBackupEventLogW(LPCWSTR lpUNCServerName,LPCWSTR lpFileName); - WINADVAPI WINBOOL WINAPI ReadEventLogA(HANDLE hEventLog,DWORD dwReadFlags,DWORD dwRecordOffset,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,DWORD *pnBytesRead,DWORD *pnMinNumberOfBytesNeeded); - WINADVAPI WINBOOL WINAPI ReadEventLogW(HANDLE hEventLog,DWORD dwReadFlags,DWORD dwRecordOffset,LPVOID lpBuffer,DWORD nNumberOfBytesToRead,DWORD *pnBytesRead,DWORD *pnMinNumberOfBytesNeeded); - WINADVAPI WINBOOL WINAPI ReportEventA(HANDLE hEventLog,WORD wType,WORD wCategory,DWORD dwEventID,PSID lpUserSid,WORD wNumStrings,DWORD dwDataSize,LPCSTR *lpStrings,LPVOID lpRawData); - WINADVAPI WINBOOL WINAPI ReportEventW(HANDLE hEventLog,WORD wType,WORD wCategory,DWORD dwEventID,PSID lpUserSid,WORD wNumStrings,DWORD dwDataSize,LPCWSTR *lpStrings,LPVOID lpRawData); - -#define EVENTLOG_FULL_INFO 0 - - typedef struct _EVENTLOG_FULL_INFORMATION { - DWORD dwFull; - } EVENTLOG_FULL_INFORMATION,*LPEVENTLOG_FULL_INFORMATION; - - WINADVAPI WINBOOL WINAPI GetEventLogInformation(HANDLE hEventLog,DWORD dwInfoLevel,LPVOID lpBuffer,DWORD cbBufSize,LPDWORD pcbBytesNeeded); - WINADVAPI WINBOOL WINAPI DuplicateToken(HANDLE ExistingTokenHandle,SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,PHANDLE DuplicateTokenHandle); - WINADVAPI WINBOOL WINAPI GetKernelObjectSecurity(HANDLE Handle,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); - WINADVAPI WINBOOL WINAPI ImpersonateNamedPipeClient(HANDLE hNamedPipe); - WINADVAPI WINBOOL WINAPI ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel); - WINADVAPI WINBOOL WINAPI RevertToSelf(VOID); - WINADVAPI WINBOOL WINAPI SetThreadToken (PHANDLE Thread,HANDLE Token); - WINADVAPI WINBOOL WINAPI AccessCheck(PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccess,LPBOOL AccessStatus); - WINADVAPI WINBOOL WINAPI AccessCheckByType(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID PrincipalSelfSid,HANDLE ClientToken,DWORD DesiredAccess,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccess,LPBOOL AccessStatus); - WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultList(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID PrincipalSelfSid,HANDLE ClientToken,DWORD DesiredAccess,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,PPRIVILEGE_SET PrivilegeSet,LPDWORD PrivilegeSetLength,LPDWORD GrantedAccessList,LPDWORD AccessStatusList); - WINADVAPI WINBOOL WINAPI OpenProcessToken(HANDLE ProcessHandle,DWORD DesiredAccess,PHANDLE TokenHandle); - WINADVAPI WINBOOL WINAPI OpenThreadToken(HANDLE ThreadHandle,DWORD DesiredAccess,WINBOOL OpenAsSelf,PHANDLE TokenHandle); - WINADVAPI WINBOOL WINAPI GetTokenInformation(HANDLE TokenHandle,TOKEN_INFORMATION_CLASS TokenInformationClass,LPVOID TokenInformation,DWORD TokenInformationLength,PDWORD ReturnLength); - WINADVAPI WINBOOL WINAPI SetTokenInformation(HANDLE TokenHandle,TOKEN_INFORMATION_CLASS TokenInformationClass,LPVOID TokenInformation,DWORD TokenInformationLength); - WINADVAPI WINBOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle,WINBOOL DisableAllPrivileges,PTOKEN_PRIVILEGES NewState,DWORD BufferLength,PTOKEN_PRIVILEGES PreviousState,PDWORD ReturnLength); - WINADVAPI WINBOOL WINAPI AdjustTokenGroups(HANDLE TokenHandle,WINBOOL ResetToDefault,PTOKEN_GROUPS NewState,DWORD BufferLength,PTOKEN_GROUPS PreviousState,PDWORD ReturnLength); - WINADVAPI WINBOOL WINAPI PrivilegeCheck(HANDLE ClientToken,PPRIVILEGE_SET RequiredPrivileges,LPBOOL pfResult); - WINADVAPI WINBOOL WINAPI AccessCheckAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPSTR ObjectTypeName,LPSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI AccessCheckAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPWSTR ObjectTypeName,LPWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,DWORD DesiredAccess,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI AccessCheckByTypeAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI AccessCheckByTypeAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPBOOL AccessStatus,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleA(LPCSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,LPCSTR ObjectTypeName,LPCSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleW(LPCWSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,LPCWSTR ObjectTypeName,LPCWSTR ObjectName,PSECURITY_DESCRIPTOR SecurityDescriptor,PSID PrincipalSelfSid,DWORD DesiredAccess,AUDIT_EVENT_TYPE AuditType,DWORD Flags,POBJECT_TYPE_LIST ObjectTypeList,DWORD ObjectTypeListLength,PGENERIC_MAPPING GenericMapping,WINBOOL ObjectCreation,LPDWORD GrantedAccess,LPDWORD AccessStatusList,LPBOOL pfGenerateOnClose); - WINADVAPI WINBOOL WINAPI ObjectOpenAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,LPSTR ObjectTypeName,LPSTR ObjectName,PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,DWORD GrantedAccess,PPRIVILEGE_SET Privileges,WINBOOL ObjectCreation,WINBOOL AccessGranted,LPBOOL GenerateOnClose); - WINADVAPI WINBOOL WINAPI ObjectOpenAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,LPWSTR ObjectTypeName,LPWSTR ObjectName,PSECURITY_DESCRIPTOR pSecurityDescriptor,HANDLE ClientToken,DWORD DesiredAccess,DWORD GrantedAccess,PPRIVILEGE_SET Privileges,WINBOOL ObjectCreation,WINBOOL AccessGranted,LPBOOL GenerateOnClose); - WINADVAPI WINBOOL WINAPI ObjectPrivilegeAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,DWORD DesiredAccess,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); - WINADVAPI WINBOOL WINAPI ObjectPrivilegeAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,HANDLE ClientToken,DWORD DesiredAccess,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); - WINADVAPI WINBOOL WINAPI ObjectCloseAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); - WINADVAPI WINBOOL WINAPI ObjectCloseAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); - WINADVAPI WINBOOL WINAPI ObjectDeleteAuditAlarmA(LPCSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); - WINADVAPI WINBOOL WINAPI ObjectDeleteAuditAlarmW(LPCWSTR SubsystemName,LPVOID HandleId,WINBOOL GenerateOnClose); - WINADVAPI WINBOOL WINAPI PrivilegedServiceAuditAlarmA(LPCSTR SubsystemName,LPCSTR ServiceName,HANDLE ClientToken,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); - WINADVAPI WINBOOL WINAPI PrivilegedServiceAuditAlarmW(LPCWSTR SubsystemName,LPCWSTR ServiceName,HANDLE ClientToken,PPRIVILEGE_SET Privileges,WINBOOL AccessGranted); - WINADVAPI WINBOOL WINAPI IsWellKnownSid(PSID pSid,WELL_KNOWN_SID_TYPE WellKnownSidType); - WINADVAPI WINBOOL WINAPI CreateWellKnownSid(WELL_KNOWN_SID_TYPE WellKnownSidType,PSID DomainSid,PSID pSid,DWORD *cbSid); - WINADVAPI WINBOOL WINAPI EqualDomainSid(PSID pSid1,PSID pSid2,WINBOOL *pfEqual); - WINADVAPI WINBOOL WINAPI GetWindowsAccountDomainSid(PSID pSid,PSID pDomainSid,DWORD *cbDomainSid); - WINADVAPI WINBOOL WINAPI IsValidSid(PSID pSid); - WINADVAPI WINBOOL WINAPI EqualSid(PSID pSid1,PSID pSid2); - WINADVAPI WINBOOL WINAPI EqualPrefixSid(PSID pSid1,PSID pSid2); - WINADVAPI DWORD WINAPI GetSidLengthRequired (UCHAR nSubAuthorityCount); - WINADVAPI WINBOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,BYTE nSubAuthorityCount,DWORD nSubAuthority0,DWORD nSubAuthority1,DWORD nSubAuthority2,DWORD nSubAuthority3,DWORD nSubAuthority4,DWORD nSubAuthority5,DWORD nSubAuthority6,DWORD nSubAuthority7,PSID *pSid); - WINADVAPI PVOID WINAPI FreeSid(PSID pSid); - WINADVAPI WINBOOL WINAPI InitializeSid(PSID Sid,PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,BYTE nSubAuthorityCount); - WINADVAPI PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID pSid); - WINADVAPI PDWORD WINAPI GetSidSubAuthority(PSID pSid,DWORD nSubAuthority); - WINADVAPI PUCHAR WINAPI GetSidSubAuthorityCount(PSID pSid); - WINADVAPI DWORD WINAPI GetLengthSid(PSID pSid); - WINADVAPI WINBOOL WINAPI CopySid(DWORD nDestinationSidLength,PSID pDestinationSid,PSID pSourceSid); - WINADVAPI WINBOOL WINAPI AreAllAccessesGranted(DWORD GrantedAccess,DWORD DesiredAccess); - WINADVAPI WINBOOL WINAPI AreAnyAccessesGranted(DWORD GrantedAccess,DWORD DesiredAccess); - WINADVAPI VOID WINAPI MapGenericMask(PDWORD AccessMask,PGENERIC_MAPPING GenericMapping); - WINADVAPI WINBOOL WINAPI IsValidAcl(PACL pAcl); - WINADVAPI WINBOOL WINAPI InitializeAcl(PACL pAcl,DWORD nAclLength,DWORD dwAclRevision); - WINADVAPI WINBOOL WINAPI GetAclInformation(PACL pAcl,LPVOID pAclInformation,DWORD nAclInformationLength,ACL_INFORMATION_CLASS dwAclInformationClass); - WINADVAPI WINBOOL WINAPI SetAclInformation(PACL pAcl,LPVOID pAclInformation,DWORD nAclInformationLength,ACL_INFORMATION_CLASS dwAclInformationClass); - WINADVAPI WINBOOL WINAPI AddAce(PACL pAcl,DWORD dwAceRevision,DWORD dwStartingAceIndex,LPVOID pAceList,DWORD nAceListLength); - WINADVAPI WINBOOL WINAPI DeleteAce(PACL pAcl,DWORD dwAceIndex); - WINADVAPI WINBOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce); - WINADVAPI WINBOOL WINAPI AddAccessAllowedAce(PACL pAcl,DWORD dwAceRevision,DWORD AccessMask,PSID pSid); - WINADVAPI WINBOOL WINAPI AddAccessAllowedAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,PSID pSid); - WINADVAPI WINBOOL WINAPI AddAccessDeniedAce(PACL pAcl,DWORD dwAceRevision,DWORD AccessMask,PSID pSid); - WINADVAPI WINBOOL WINAPI AddAccessDeniedAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,PSID pSid); - WINADVAPI WINBOOL WINAPI AddAuditAccessAce(PACL pAcl,DWORD dwAceRevision,DWORD dwAccessMask,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); - WINADVAPI WINBOOL WINAPI AddAuditAccessAceEx(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD dwAccessMask,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); - WINADVAPI WINBOOL WINAPI AddAccessAllowedObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid); - WINADVAPI WINBOOL WINAPI AddAccessDeniedObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid); - WINADVAPI WINBOOL WINAPI AddAuditAccessObjectAce(PACL pAcl,DWORD dwAceRevision,DWORD AceFlags,DWORD AccessMask,GUID *ObjectTypeGuid,GUID *InheritedObjectTypeGuid,PSID pSid,WINBOOL bAuditSuccess,WINBOOL bAuditFailure); - WINADVAPI WINBOOL WINAPI FindFirstFreeAce(PACL pAcl,LPVOID *pAce); - WINADVAPI WINBOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD dwRevision); - WINADVAPI WINBOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor); - WINADVAPI DWORD WINAPI GetSecurityDescriptorLength(PSECURITY_DESCRIPTOR pSecurityDescriptor); - WINADVAPI WINBOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSECURITY_DESCRIPTOR_CONTROL pControl,LPDWORD lpdwRevision); - WINADVAPI WINBOOL WINAPI SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor,SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet); - WINADVAPI WINBOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,WINBOOL bDaclPresent,PACL pDacl,WINBOOL bDaclDefaulted); - WINADVAPI WINBOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,LPBOOL lpbDaclPresent,PACL *pDacl,LPBOOL lpbDaclDefaulted); - WINADVAPI WINBOOL WINAPI SetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,WINBOOL bSaclPresent,PACL pSacl,WINBOOL bSaclDefaulted); - WINADVAPI WINBOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor,LPBOOL lpbSaclPresent,PACL *pSacl,LPBOOL lpbSaclDefaulted); - WINADVAPI WINBOOL WINAPI SetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID pOwner,WINBOOL bOwnerDefaulted); - WINADVAPI WINBOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID *pOwner,LPBOOL lpbOwnerDefaulted); - WINADVAPI WINBOOL WINAPI SetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID pGroup,WINBOOL bGroupDefaulted); - WINADVAPI WINBOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor,PSID *pGroup,LPBOOL lpbGroupDefaulted); - WINADVAPI DWORD WINAPI SetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,PUCHAR RMControl); - WINADVAPI DWORD WINAPI GetSecurityDescriptorRMControl(PSECURITY_DESCRIPTOR SecurityDescriptor,PUCHAR RMControl); - WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,WINBOOL IsDirectoryObject,HANDLE Token,PGENERIC_MAPPING GenericMapping); - WINADVAPI WINBOOL WINAPI ConvertToAutoInheritPrivateObjectSecurity(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CurrentSecurityDescriptor,PSECURITY_DESCRIPTOR *NewSecurityDescriptor,GUID *ObjectType,BOOLEAN IsDirectoryObject,PGENERIC_MAPPING GenericMapping); - WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurityEx(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,GUID *ObjectType,WINBOOL IsContainerObject,ULONG AutoInheritFlags,HANDLE Token,PGENERIC_MAPPING GenericMapping); - WINADVAPI WINBOOL WINAPI CreatePrivateObjectSecurityWithMultipleInheritance(PSECURITY_DESCRIPTOR ParentDescriptor,PSECURITY_DESCRIPTOR CreatorDescriptor,PSECURITY_DESCRIPTOR *NewDescriptor,GUID **ObjectTypes,ULONG GuidCount,WINBOOL IsContainerObject,ULONG AutoInheritFlags,HANDLE Token,PGENERIC_MAPPING GenericMapping); - WINADVAPI WINBOOL WINAPI SetPrivateObjectSecurity (SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ModificationDescriptor,PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,PGENERIC_MAPPING GenericMapping,HANDLE Token); - WINADVAPI WINBOOL WINAPI SetPrivateObjectSecurityEx (SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ModificationDescriptor,PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,ULONG AutoInheritFlags,PGENERIC_MAPPING GenericMapping,HANDLE Token); - WINADVAPI WINBOOL WINAPI GetPrivateObjectSecurity(PSECURITY_DESCRIPTOR ObjectDescriptor,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR ResultantDescriptor,DWORD DescriptorLength,PDWORD ReturnLength); - WINADVAPI WINBOOL WINAPI DestroyPrivateObjectSecurity(PSECURITY_DESCRIPTOR *ObjectDescriptor); - WINADVAPI WINBOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,LPDWORD lpdwBufferLength); - WINADVAPI WINBOOL WINAPI MakeAbsoluteSD(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,LPDWORD lpdwAbsoluteSecurityDescriptorSize,PACL pDacl,LPDWORD lpdwDaclSize,PACL pSacl,LPDWORD lpdwSaclSize,PSID pOwner,LPDWORD lpdwOwnerSize,PSID pPrimaryGroup,LPDWORD lpdwPrimaryGroupSize); - WINADVAPI WINBOOL WINAPI MakeAbsoluteSD2(PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,LPDWORD lpdwBufferSize); - WINADVAPI WINBOOL WINAPI SetFileSecurityA(LPCSTR lpFileName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); - WINADVAPI WINBOOL WINAPI SetFileSecurityW(LPCWSTR lpFileName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); - WINADVAPI WINBOOL WINAPI GetFileSecurityA(LPCSTR lpFileName,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); - WINADVAPI WINBOOL WINAPI GetFileSecurityW(LPCWSTR lpFileName,SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,DWORD nLength,LPDWORD lpnLengthNeeded); - WINADVAPI WINBOOL WINAPI SetKernelObjectSecurity(HANDLE Handle,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR SecurityDescriptor); - WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationA(LPCSTR lpPathName,WINBOOL bWatchSubtree,DWORD dwNotifyFilter); - WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationW(LPCWSTR lpPathName,WINBOOL bWatchSubtree,DWORD dwNotifyFilter); - WINBASEAPI WINBOOL WINAPI FindNextChangeNotification(HANDLE hChangeHandle); - WINBASEAPI WINBOOL WINAPI FindCloseChangeNotification(HANDLE hChangeHandle); - WINBASEAPI WINBOOL WINAPI ReadDirectoryChangesW(HANDLE hDirectory,LPVOID lpBuffer,DWORD nBufferLength,WINBOOL bWatchSubtree,DWORD dwNotifyFilter,LPDWORD lpBytesReturned,LPOVERLAPPED lpOverlapped,LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINBASEAPI WINBOOL WINAPI VirtualLock(LPVOID lpAddress,SIZE_T dwSize); - WINBASEAPI WINBOOL WINAPI VirtualUnlock(LPVOID lpAddress,SIZE_T dwSize); - WINBASEAPI LPVOID WINAPI MapViewOfFileEx(HANDLE hFileMappingObject,DWORD dwDesiredAccess,DWORD dwFileOffsetHigh,DWORD dwFileOffsetLow,SIZE_T dwNumberOfBytesToMap,LPVOID lpBaseAddress); - WINBASEAPI WINBOOL WINAPI SetPriorityClass(HANDLE hProcess,DWORD dwPriorityClass); - WINBASEAPI DWORD WINAPI GetPriorityClass(HANDLE hProcess); - WINBASEAPI WINBOOL WINAPI IsBadReadPtr(CONST VOID *lp,UINT_PTR ucb); - WINBASEAPI WINBOOL WINAPI IsBadWritePtr(LPVOID lp,UINT_PTR ucb); - WINBASEAPI WINBOOL WINAPI IsBadHugeReadPtr(CONST VOID *lp,UINT_PTR ucb); - WINBASEAPI WINBOOL WINAPI IsBadHugeWritePtr(LPVOID lp,UINT_PTR ucb); - WINBASEAPI WINBOOL WINAPI IsBadCodePtr(FARPROC lpfn); - WINBASEAPI WINBOOL WINAPI IsBadStringPtrA(LPCSTR lpsz,UINT_PTR ucchMax); - WINBASEAPI WINBOOL WINAPI IsBadStringPtrW(LPCWSTR lpsz,UINT_PTR ucchMax); - WINADVAPI WINBOOL WINAPI LookupAccountSidA(LPCSTR lpSystemName,PSID Sid,LPSTR Name,LPDWORD cchName,LPSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); - WINADVAPI WINBOOL WINAPI LookupAccountSidW(LPCWSTR lpSystemName,PSID Sid,LPWSTR Name,LPDWORD cchName,LPWSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); - WINADVAPI WINBOOL WINAPI LookupAccountNameA(LPCSTR lpSystemName,LPCSTR lpAccountName,PSID Sid,LPDWORD cbSid,LPSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); - WINADVAPI WINBOOL WINAPI LookupAccountNameW(LPCWSTR lpSystemName,LPCWSTR lpAccountName,PSID Sid,LPDWORD cbSid,LPWSTR ReferencedDomainName,LPDWORD cchReferencedDomainName,PSID_NAME_USE peUse); - WINADVAPI WINBOOL WINAPI LookupPrivilegeValueA(LPCSTR lpSystemName,LPCSTR lpName,PLUID lpLuid); - WINADVAPI WINBOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName,LPCWSTR lpName,PLUID lpLuid); - WINADVAPI WINBOOL WINAPI LookupPrivilegeNameA(LPCSTR lpSystemName,PLUID lpLuid,LPSTR lpName,LPDWORD cchName); - WINADVAPI WINBOOL WINAPI LookupPrivilegeNameW(LPCWSTR lpSystemName,PLUID lpLuid,LPWSTR lpName,LPDWORD cchName); - WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameA(LPCSTR lpSystemName,LPCSTR lpName,LPSTR lpDisplayName,LPDWORD cchDisplayName,LPDWORD lpLanguageId); - WINADVAPI WINBOOL WINAPI LookupPrivilegeDisplayNameW(LPCWSTR lpSystemName,LPCWSTR lpName,LPWSTR lpDisplayName,LPDWORD cchDisplayName,LPDWORD lpLanguageId); - WINADVAPI WINBOOL WINAPI AllocateLocallyUniqueId(PLUID Luid); - WINBASEAPI WINBOOL WINAPI BuildCommDCBA(LPCSTR lpDef,LPDCB lpDCB); - WINBASEAPI WINBOOL WINAPI BuildCommDCBW(LPCWSTR lpDef,LPDCB lpDCB); - WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsA(LPCSTR lpDef,LPDCB lpDCB,LPCOMMTIMEOUTS lpCommTimeouts); - WINBASEAPI WINBOOL WINAPI BuildCommDCBAndTimeoutsW(LPCWSTR lpDef,LPDCB lpDCB,LPCOMMTIMEOUTS lpCommTimeouts); - WINBASEAPI WINBOOL WINAPI CommConfigDialogA(LPCSTR lpszName,HWND hWnd,LPCOMMCONFIG lpCC); - WINBASEAPI WINBOOL WINAPI CommConfigDialogW(LPCWSTR lpszName,HWND hWnd,LPCOMMCONFIG lpCC); - WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigA(LPCSTR lpszName,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); - WINBASEAPI WINBOOL WINAPI GetDefaultCommConfigW(LPCWSTR lpszName,LPCOMMCONFIG lpCC,LPDWORD lpdwSize); - WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigA(LPCSTR lpszName,LPCOMMCONFIG lpCC,DWORD dwSize); - WINBASEAPI WINBOOL WINAPI SetDefaultCommConfigW(LPCWSTR lpszName,LPCOMMCONFIG lpCC,DWORD dwSize); - -#define MAX_COMPUTERNAME_LENGTH 15 - - WINBASEAPI WINBOOL WINAPI GetComputerNameA(LPSTR lpBuffer,LPDWORD nSize); - WINBASEAPI WINBOOL WINAPI GetComputerNameW(LPWSTR lpBuffer,LPDWORD nSize); - WINBASEAPI WINBOOL WINAPI SetComputerNameA(LPCSTR lpComputerName); - WINBASEAPI WINBOOL WINAPI SetComputerNameW(LPCWSTR lpComputerName); - - typedef enum _COMPUTER_NAME_FORMAT { - ComputerNameNetBIOS,ComputerNameDnsHostname,ComputerNameDnsDomain,ComputerNameDnsFullyQualified,ComputerNamePhysicalNetBIOS,ComputerNamePhysicalDnsHostname,ComputerNamePhysicalDnsDomain,ComputerNamePhysicalDnsFullyQualified,ComputerNameMax - } COMPUTER_NAME_FORMAT; - - WINBASEAPI WINBOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT NameType,LPSTR lpBuffer,LPDWORD nSize); - WINBASEAPI WINBOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType,LPWSTR lpBuffer,LPDWORD nSize); - WINBASEAPI WINBOOL WINAPI SetComputerNameExA(COMPUTER_NAME_FORMAT NameType,LPCSTR lpBuffer); - WINBASEAPI WINBOOL WINAPI SetComputerNameExW(COMPUTER_NAME_FORMAT NameType,LPCWSTR lpBuffer); - WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameA(LPCSTR Hostname,LPSTR ComputerName,LPDWORD nSize); - WINBASEAPI WINBOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR Hostname,LPWSTR ComputerName,LPDWORD nSize); - WINADVAPI WINBOOL WINAPI GetUserNameA(LPSTR lpBuffer,LPDWORD pcbBuffer); - WINADVAPI WINBOOL WINAPI GetUserNameW(LPWSTR lpBuffer,LPDWORD pcbBuffer); - -#define LOGON32_LOGON_INTERACTIVE 2 -#define LOGON32_LOGON_NETWORK 3 -#define LOGON32_LOGON_BATCH 4 -#define LOGON32_LOGON_SERVICE 5 -#define LOGON32_LOGON_UNLOCK 7 -#define LOGON32_LOGON_NETWORK_CLEARTEXT 8 -#define LOGON32_LOGON_NEW_CREDENTIALS 9 - -#define LOGON32_PROVIDER_DEFAULT 0 -#define LOGON32_PROVIDER_WINNT35 1 -#define LOGON32_PROVIDER_WINNT40 2 -#define LOGON32_PROVIDER_WINNT50 3 - -#ifdef UNICODE -#define LogonUser LogonUserW -#define LogonUserEx LogonUserExW -#define CreateProcessAsUser CreateProcessAsUserW -#else -#define LogonUser LogonUserA -#define LogonUserEx LogonUserExA -#define CreateProcessAsUser CreateProcessAsUserA -#endif - - WINADVAPI WINBOOL WINAPI LogonUserA(LPCSTR lpszUsername,LPCSTR lpszDomain,LPCSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken); - WINADVAPI WINBOOL WINAPI LogonUserW(LPCWSTR lpszUsername,LPCWSTR lpszDomain,LPCWSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken); - WINADVAPI WINBOOL WINAPI LogonUserExA(LPCSTR lpszUsername,LPCSTR lpszDomain,LPCSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken,PSID *ppLogonSid,PVOID *ppProfileBuffer,LPDWORD pdwProfileLength,PQUOTA_LIMITS pQuotaLimits); - WINADVAPI WINBOOL WINAPI LogonUserExW(LPCWSTR lpszUsername,LPCWSTR lpszDomain,LPCWSTR lpszPassword,DWORD dwLogonType,DWORD dwLogonProvider,PHANDLE phToken,PSID *ppLogonSid,PVOID *ppProfileBuffer,LPDWORD pdwProfileLength,PQUOTA_LIMITS pQuotaLimits); - WINADVAPI WINBOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken); - WINADVAPI WINBOOL WINAPI CreateProcessAsUserA(HANDLE hToken,LPCSTR lpApplicationName,LPSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCSTR lpCurrentDirectory,LPSTARTUPINFOA lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); - WINADVAPI WINBOOL WINAPI CreateProcessAsUserW(HANDLE hToken,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,LPSECURITY_ATTRIBUTES lpProcessAttributes,LPSECURITY_ATTRIBUTES lpThreadAttributes,WINBOOL bInheritHandles,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); - -#define LOGON_WITH_PROFILE 0x1 -#define LOGON_NETCREDENTIALS_ONLY 0x2 -#define LOGON_ZERO_PASSWORD_BUFFER 0x80000000 - - WINADVAPI WINBOOL WINAPI CreateProcessWithLogonW(LPCWSTR lpUsername,LPCWSTR lpDomain,LPCWSTR lpPassword,DWORD dwLogonFlags,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); - WINADVAPI WINBOOL WINAPI CreateProcessWithTokenW(HANDLE hToken,DWORD dwLogonFlags,LPCWSTR lpApplicationName,LPWSTR lpCommandLine,DWORD dwCreationFlags,LPVOID lpEnvironment,LPCWSTR lpCurrentDirectory,LPSTARTUPINFOW lpStartupInfo,LPPROCESS_INFORMATION lpProcessInformation); - WINADVAPI WINBOOL WINAPI ImpersonateAnonymousToken(HANDLE ThreadHandle); - WINADVAPI WINBOOL WINAPI DuplicateTokenEx(HANDLE hExistingToken,DWORD dwDesiredAccess,LPSECURITY_ATTRIBUTES lpTokenAttributes,SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,TOKEN_TYPE TokenType,PHANDLE phNewToken); - WINADVAPI WINBOOL WINAPI CreateRestrictedToken(HANDLE ExistingTokenHandle,DWORD Flags,DWORD DisableSidCount,PSID_AND_ATTRIBUTES SidsToDisable,DWORD DeletePrivilegeCount,PLUID_AND_ATTRIBUTES PrivilegesToDelete,DWORD RestrictedSidCount,PSID_AND_ATTRIBUTES SidsToRestrict,PHANDLE NewTokenHandle); - WINADVAPI WINBOOL WINAPI IsTokenRestricted(HANDLE TokenHandle); - WINADVAPI WINBOOL WINAPI IsTokenUntrusted(HANDLE TokenHandle); - WINADVAPI WINBOOL WINAPI CheckTokenMembership(HANDLE TokenHandle,PSID SidToCheck,PBOOL IsMember); - - typedef WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACK; - - WINBASEAPI WINBOOL WINAPI RegisterWaitForSingleObject(PHANDLE phNewWaitObject,HANDLE hObject,WAITORTIMERCALLBACK Callback,PVOID Context,ULONG dwMilliseconds,ULONG dwFlags); - WINBASEAPI HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE hObject,WAITORTIMERCALLBACK Callback,PVOID Context,ULONG dwMilliseconds,ULONG dwFlags); - WINBASEAPI WINBOOL WINAPI UnregisterWait(HANDLE WaitHandle); - WINBASEAPI WINBOOL WINAPI UnregisterWaitEx(HANDLE WaitHandle,HANDLE CompletionEvent); - WINBASEAPI WINBOOL WINAPI QueueUserWorkItem(LPTHREAD_START_ROUTINE Function,PVOID Context,ULONG Flags); - WINBASEAPI WINBOOL WINAPI BindIoCompletionCallback(HANDLE FileHandle,LPOVERLAPPED_COMPLETION_ROUTINE Function,ULONG Flags); - WINBASEAPI HANDLE WINAPI CreateTimerQueue(VOID); - WINBASEAPI WINBOOL WINAPI CreateTimerQueueTimer(PHANDLE phNewTimer,HANDLE TimerQueue,WAITORTIMERCALLBACK Callback,PVOID Parameter,DWORD DueTime,DWORD Period,ULONG Flags); - WINBASEAPI WINBOOL WINAPI ChangeTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer,ULONG DueTime,ULONG Period); - WINBASEAPI WINBOOL WINAPI DeleteTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer,HANDLE CompletionEvent); - WINBASEAPI WINBOOL WINAPI DeleteTimerQueueEx(HANDLE TimerQueue,HANDLE CompletionEvent); - WINBASEAPI HANDLE WINAPI SetTimerQueueTimer(HANDLE TimerQueue,WAITORTIMERCALLBACK Callback,PVOID Parameter,DWORD DueTime,DWORD Period,WINBOOL PreferIo); - WINBASEAPI WINBOOL WINAPI CancelTimerQueueTimer(HANDLE TimerQueue,HANDLE Timer); - WINBASEAPI WINBOOL WINAPI DeleteTimerQueue(HANDLE TimerQueue); - -#define HW_PROFILE_GUIDLEN 39 -#define MAX_PROFILE_LEN 80 - -#define DOCKINFO_UNDOCKED (0x1) -#define DOCKINFO_DOCKED (0x2) -#define DOCKINFO_USER_SUPPLIED (0x4) -#define DOCKINFO_USER_UNDOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_UNDOCKED) -#define DOCKINFO_USER_DOCKED (DOCKINFO_USER_SUPPLIED | DOCKINFO_DOCKED) - - typedef struct tagHW_PROFILE_INFOA { - DWORD dwDockInfo; - CHAR szHwProfileGuid[HW_PROFILE_GUIDLEN]; - CHAR szHwProfileName[MAX_PROFILE_LEN]; - } HW_PROFILE_INFOA,*LPHW_PROFILE_INFOA; - - typedef struct tagHW_PROFILE_INFOW { - DWORD dwDockInfo; - WCHAR szHwProfileGuid[HW_PROFILE_GUIDLEN]; - WCHAR szHwProfileName[MAX_PROFILE_LEN]; - } HW_PROFILE_INFOW,*LPHW_PROFILE_INFOW; - -#ifdef UNICODE - typedef HW_PROFILE_INFOW HW_PROFILE_INFO; - typedef LPHW_PROFILE_INFOW LPHW_PROFILE_INFO; -#else - typedef HW_PROFILE_INFOA HW_PROFILE_INFO; - typedef LPHW_PROFILE_INFOA LPHW_PROFILE_INFO; -#endif - -#ifdef UNICODE -#define GetCurrentHwProfile GetCurrentHwProfileW -#define GetVersionEx GetVersionExW -#define VerifyVersionInfo VerifyVersionInfoW -#else -#define GetCurrentHwProfile GetCurrentHwProfileA -#define GetVersionEx GetVersionExA -#define VerifyVersionInfo VerifyVersionInfoA -#endif - - WINADVAPI WINBOOL WINAPI GetCurrentHwProfileA (LPHW_PROFILE_INFOA lpHwProfileInfo); - WINADVAPI WINBOOL WINAPI GetCurrentHwProfileW (LPHW_PROFILE_INFOW lpHwProfileInfo); - WINBASEAPI WINBOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount); - WINBASEAPI WINBOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency); - WINBASEAPI WINBOOL WINAPI GetVersionExA(LPOSVERSIONINFOA lpVersionInformation); - WINBASEAPI WINBOOL WINAPI GetVersionExW(LPOSVERSIONINFOW lpVersionInformation); - WINBASEAPI WINBOOL WINAPI VerifyVersionInfoA(LPOSVERSIONINFOEXA lpVersionInformation,DWORD dwTypeMask,DWORDLONG dwlConditionMask); - WINBASEAPI WINBOOL WINAPI VerifyVersionInfoW(LPOSVERSIONINFOEXW lpVersionInformation,DWORD dwTypeMask,DWORDLONG dwlConditionMask); - -#include - -#define TC_NORMAL 0 -#define TC_HARDERR 1 -#define TC_GP_TRAP 2 -#define TC_SIGNAL 3 - -#define AC_LINE_OFFLINE 0x0 -#define AC_LINE_ONLINE 0x1 -#define AC_LINE_BACKUP_POWER 0x2 -#define AC_LINE_UNKNOWN 0xff - -#define BATTERY_FLAG_HIGH 0x1 -#define BATTERY_FLAG_LOW 0x2 -#define BATTERY_FLAG_CRITICAL 0x4 -#define BATTERY_FLAG_CHARGING 0x8 -#define BATTERY_FLAG_NO_BATTERY 0x80 -#define BATTERY_FLAG_UNKNOWN 0xff - -#define BATTERY_PERCENTAGE_UNKNOWN 0xff - -#define BATTERY_LIFE_UNKNOWN 0xffffffff - - typedef struct _SYSTEM_POWER_STATUS { - BYTE ACLineStatus; - BYTE BatteryFlag; - BYTE BatteryLifePercent; - BYTE Reserved1; - DWORD BatteryLifeTime; - DWORD BatteryFullLifeTime; - } SYSTEM_POWER_STATUS,*LPSYSTEM_POWER_STATUS; - -#ifdef UNICODE -#define CreateJobObject CreateJobObjectW -#define OpenJobObject OpenJobObjectW -#define FindFirstVolume FindFirstVolumeW -#define FindNextVolume FindNextVolumeW -#define FindFirstVolumeMountPoint FindFirstVolumeMountPointW -#define FindNextVolumeMountPoint FindNextVolumeMountPointW -#define SetVolumeMountPoint SetVolumeMountPointW -#define DeleteVolumeMountPoint DeleteVolumeMountPointW -#define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointW -#define GetVolumePathName GetVolumePathNameW -#define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameW -#else -#define CreateJobObject CreateJobObjectA -#define OpenJobObject OpenJobObjectA -#define FindFirstVolume FindFirstVolumeA -#define FindNextVolume FindNextVolumeA -#define FindFirstVolumeMountPoint FindFirstVolumeMountPointA -#define FindNextVolumeMountPoint FindNextVolumeMountPointA -#define SetVolumeMountPoint SetVolumeMountPointA -#define DeleteVolumeMountPoint DeleteVolumeMountPointA -#define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointA -#define GetVolumePathName GetVolumePathNameA -#define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameA -#endif - - WINBOOL WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS lpSystemPowerStatus); - WINBOOL WINAPI SetSystemPowerState(WINBOOL fSuspend,WINBOOL fForce); - WINBASEAPI WINBOOL WINAPI AllocateUserPhysicalPages(HANDLE hProcess,PULONG_PTR NumberOfPages,PULONG_PTR PageArray); - WINBASEAPI WINBOOL WINAPI FreeUserPhysicalPages(HANDLE hProcess,PULONG_PTR NumberOfPages,PULONG_PTR PageArray); - WINBASEAPI WINBOOL WINAPI MapUserPhysicalPages(PVOID VirtualAddress,ULONG_PTR NumberOfPages,PULONG_PTR PageArray); - WINBASEAPI WINBOOL WINAPI MapUserPhysicalPagesScatter(PVOID *VirtualAddresses,ULONG_PTR NumberOfPages,PULONG_PTR PageArray); - WINBASEAPI HANDLE WINAPI CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes,LPCWSTR lpName); - WINBASEAPI HANDLE WINAPI OpenJobObjectA(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCSTR lpName); - WINBASEAPI HANDLE WINAPI OpenJobObjectW(DWORD dwDesiredAccess,WINBOOL bInheritHandle,LPCWSTR lpName); - WINBASEAPI WINBOOL WINAPI AssignProcessToJobObject(HANDLE hJob,HANDLE hProcess); - WINBASEAPI WINBOOL WINAPI TerminateJobObject(HANDLE hJob,UINT uExitCode); - WINBASEAPI WINBOOL WINAPI QueryInformationJobObject(HANDLE hJob,JOBOBJECTINFOCLASS JobObjectInformationClass,LPVOID lpJobObjectInformation,DWORD cbJobObjectInformationLength,LPDWORD lpReturnLength); - WINBASEAPI WINBOOL WINAPI SetInformationJobObject(HANDLE hJob,JOBOBJECTINFOCLASS JobObjectInformationClass,LPVOID lpJobObjectInformation,DWORD cbJobObjectInformationLength); - WINBASEAPI WINBOOL WINAPI IsProcessInJob(HANDLE ProcessHandle,HANDLE JobHandle,PBOOL Result); - WINBASEAPI WINBOOL WINAPI CreateJobSet(ULONG NumJob,PJOB_SET_ARRAY UserJobSet,ULONG Flags); - WINBASEAPI PVOID WINAPI AddVectoredExceptionHandler (ULONG First,PVECTORED_EXCEPTION_HANDLER Handler); - WINBASEAPI ULONG WINAPI RemoveVectoredExceptionHandler(PVOID Handle); - WINBASEAPI PVOID WINAPI AddVectoredContinueHandler (ULONG First,PVECTORED_EXCEPTION_HANDLER Handler); - WINBASEAPI ULONG WINAPI RemoveVectoredContinueHandler(PVOID Handle); - WINBASEAPI HANDLE WINAPI FindFirstVolumeA(LPSTR lpszVolumeName,DWORD cchBufferLength); - WINBASEAPI HANDLE WINAPI FindFirstVolumeW(LPWSTR lpszVolumeName,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI FindNextVolumeA(HANDLE hFindVolume,LPSTR lpszVolumeName,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI FindNextVolumeW(HANDLE hFindVolume,LPWSTR lpszVolumeName,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI FindVolumeClose(HANDLE hFindVolume); - WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointA(LPCSTR lpszRootPathName,LPSTR lpszVolumeMountPoint,DWORD cchBufferLength); - WINBASEAPI HANDLE WINAPI FindFirstVolumeMountPointW(LPCWSTR lpszRootPathName,LPWSTR lpszVolumeMountPoint,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointA(HANDLE hFindVolumeMountPoint,LPSTR lpszVolumeMountPoint,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI FindNextVolumeMountPointW(HANDLE hFindVolumeMountPoint,LPWSTR lpszVolumeMountPoint,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI FindVolumeMountPointClose(HANDLE hFindVolumeMountPoint); - WINBASEAPI WINBOOL WINAPI SetVolumeMountPointA(LPCSTR lpszVolumeMountPoint,LPCSTR lpszVolumeName); - WINBASEAPI WINBOOL WINAPI SetVolumeMountPointW(LPCWSTR lpszVolumeMountPoint,LPCWSTR lpszVolumeName); - WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointA(LPCSTR lpszVolumeMountPoint); - WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointW(LPCWSTR lpszVolumeMountPoint); - WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointA(LPCSTR lpszVolumeMountPoint,LPSTR lpszVolumeName,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointW(LPCWSTR lpszVolumeMountPoint,LPWSTR lpszVolumeName,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI GetVolumePathNameA(LPCSTR lpszFileName,LPSTR lpszVolumePathName,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI GetVolumePathNameW(LPCWSTR lpszFileName,LPWSTR lpszVolumePathName,DWORD cchBufferLength); - WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameA(LPCSTR lpszVolumeName,LPCH lpszVolumePathNames,DWORD cchBufferLength,PDWORD lpcchReturnLength); - WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameW(LPCWSTR lpszVolumeName,LPWCH lpszVolumePathNames,DWORD cchBufferLength,PDWORD lpcchReturnLength); - -#define ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID 0x1 -#define ACTCTX_FLAG_LANGID_VALID 0x2 -#define ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID 0x4 -#define ACTCTX_FLAG_RESOURCE_NAME_VALID 0x8 -#define ACTCTX_FLAG_SET_PROCESS_DEFAULT 0x10 -#define ACTCTX_FLAG_APPLICATION_NAME_VALID 0x20 -#define ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF 0x40 -#define ACTCTX_FLAG_HMODULE_VALID 0x80 - - typedef struct tagACTCTXA { - ULONG cbSize; - DWORD dwFlags; - LPCSTR lpSource; - USHORT wProcessorArchitecture; - LANGID wLangId; - LPCSTR lpAssemblyDirectory; - LPCSTR lpResourceName; - LPCSTR lpApplicationName; - HMODULE hModule; - } ACTCTXA,*PACTCTXA; - - typedef struct tagACTCTXW { - ULONG cbSize; - DWORD dwFlags; - LPCWSTR lpSource; - USHORT wProcessorArchitecture; - LANGID wLangId; - LPCWSTR lpAssemblyDirectory; - LPCWSTR lpResourceName; - LPCWSTR lpApplicationName; - HMODULE hModule; - } ACTCTXW,*PACTCTXW; - - typedef const ACTCTXA *PCACTCTXA; - typedef const ACTCTXW *PCACTCTXW; - -#ifdef UNICODE - typedef ACTCTXW ACTCTX; - typedef PACTCTXW PACTCTX; - typedef PCACTCTXW PCACTCTX; -#else - typedef ACTCTXA ACTCTX; - typedef PACTCTXA PACTCTX; - typedef PCACTCTXA PCACTCTX; -#endif - -#ifdef UNICODE -#define CreateActCtx CreateActCtxW -#else -#define CreateActCtx CreateActCtxA -#endif - - WINBASEAPI HANDLE WINAPI CreateActCtxA(PCACTCTXA pActCtx); - WINBASEAPI HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx); - WINBASEAPI VOID WINAPI AddRefActCtx(HANDLE hActCtx); - WINBASEAPI VOID WINAPI ReleaseActCtx(HANDLE hActCtx); - WINBASEAPI WINBOOL WINAPI ZombifyActCtx(HANDLE hActCtx); - WINBASEAPI WINBOOL WINAPI ActivateActCtx(HANDLE hActCtx,ULONG_PTR *lpCookie); - -#define DEACTIVATE_ACTCTX_FLAG_FORCE_EARLY_DEACTIVATION (0x1) - - WINBASEAPI WINBOOL WINAPI DeactivateActCtx(DWORD dwFlags,ULONG_PTR ulCookie); - WINBASEAPI WINBOOL WINAPI GetCurrentActCtx(HANDLE *lphActCtx); - - typedef struct tagACTCTX_SECTION_KEYED_DATA_2600 { - ULONG cbSize; - ULONG ulDataFormatVersion; - PVOID lpData; - ULONG ulLength; - PVOID lpSectionGlobalData; - ULONG ulSectionGlobalDataLength; - PVOID lpSectionBase; - ULONG ulSectionTotalLength; - HANDLE hActCtx; - ULONG ulAssemblyRosterIndex; - } ACTCTX_SECTION_KEYED_DATA_2600,*PACTCTX_SECTION_KEYED_DATA_2600; - - typedef const ACTCTX_SECTION_KEYED_DATA_2600 *PCACTCTX_SECTION_KEYED_DATA_2600; - - typedef struct tagACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA { - PVOID lpInformation; - PVOID lpSectionBase; - ULONG ulSectionLength; - PVOID lpSectionGlobalDataBase; - ULONG ulSectionGlobalDataLength; - } ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA,*PACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; - - typedef const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA *PCACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; - - typedef struct tagACTCTX_SECTION_KEYED_DATA { - ULONG cbSize; - ULONG ulDataFormatVersion; - PVOID lpData; - ULONG ulLength; - PVOID lpSectionGlobalData; - ULONG ulSectionGlobalDataLength; - PVOID lpSectionBase; - ULONG ulSectionTotalLength; - HANDLE hActCtx; - ULONG ulAssemblyRosterIndex; - - ULONG ulFlags; - ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA AssemblyMetadata; - } ACTCTX_SECTION_KEYED_DATA,*PACTCTX_SECTION_KEYED_DATA; - - typedef const ACTCTX_SECTION_KEYED_DATA *PCACTCTX_SECTION_KEYED_DATA; - -#define FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX 0x1 -#define FIND_ACTCTX_SECTION_KEY_RETURN_FLAGS 0x2 -#define FIND_ACTCTX_SECTION_KEY_RETURN_ASSEMBLY_METADATA 0x4 - -#ifdef UNICODE -#define FindActCtxSectionString FindActCtxSectionStringW -#else -#define FindActCtxSectionString FindActCtxSectionStringA -#endif - - WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringA(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,LPCSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); - WINBASEAPI WINBOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,LPCWSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); - WINBASEAPI WINBOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags,const GUID *lpExtensionGuid,ULONG ulSectionId,const GUID *lpGuidToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); - -#ifndef RC_INVOKED -#ifndef ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED - - typedef struct _ACTIVATION_CONTEXT_BASIC_INFORMATION { - HANDLE hActCtx; - DWORD dwFlags; - } ACTIVATION_CONTEXT_BASIC_INFORMATION,*PACTIVATION_CONTEXT_BASIC_INFORMATION; - - typedef const struct _ACTIVATION_CONTEXT_BASIC_INFORMATION *PCACTIVATION_CONTEXT_BASIC_INFORMATION; - -#define ACTIVATION_CONTEXT_BASIC_INFORMATION_DEFINED 1 -#endif -#endif - -#define QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX 0x4 -#define QUERY_ACTCTX_FLAG_ACTCTX_IS_HMODULE 0x8 -#define QUERY_ACTCTX_FLAG_ACTCTX_IS_ADDRESS 0x10 -#define QUERY_ACTCTX_FLAG_NO_ADDREF 0x80000000 - - WINBASEAPI WINBOOL WINAPI QueryActCtxW(DWORD dwFlags,HANDLE hActCtx,PVOID pvSubInstance,ULONG ulInfoClass,PVOID pvBuffer,SIZE_T cbBuffer,SIZE_T *pcbWrittenOrRequired); - - typedef WINBOOL (WINAPI *PQUERYACTCTXW_FUNC)(DWORD dwFlags,HANDLE hActCtx,PVOID pvSubInstance,ULONG ulInfoClass,PVOID pvBuffer,SIZE_T cbBuffer,SIZE_T *pcbWrittenOrRequired); - - WINBASEAPI WINBOOL WINAPI ProcessIdToSessionId(DWORD dwProcessId,DWORD *pSessionId); - WINBASEAPI DWORD WINAPI WTSGetActiveConsoleSessionId(); - WINBASEAPI WINBOOL WINAPI IsWow64Process(HANDLE hProcess,PBOOL Wow64Process); - WINBASEAPI WINBOOL WINAPI GetLogicalProcessorInformation(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer,PDWORD ReturnedLength); - WINBASEAPI WINBOOL WINAPI GetNumaHighestNodeNumber(PULONG HighestNodeNumber); - WINBASEAPI WINBOOL WINAPI GetNumaProcessorNode(UCHAR Processor,PUCHAR NodeNumber); - WINBASEAPI WINBOOL WINAPI GetNumaNodeProcessorMask(UCHAR Node,PULONGLONG ProcessorMask); - WINBASEAPI WINBOOL WINAPI GetNumaAvailableMemoryNode(UCHAR Node,PULONGLONG AvailableBytes); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/wincon.h b/win32/include/winapi/wincon.h deleted file mode 100644 index a56c4723..00000000 --- a/win32/include/winapi/wincon.h +++ /dev/null @@ -1,309 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINCON_ -#define _WINCON_ - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct _COORD { - SHORT X; - SHORT Y; - } COORD,*PCOORD; - - typedef struct _SMALL_RECT { - SHORT Left; - SHORT Top; - SHORT Right; - SHORT Bottom; - } SMALL_RECT,*PSMALL_RECT; - - typedef struct _KEY_EVENT_RECORD { - WINBOOL bKeyDown; - WORD wRepeatCount; - WORD wVirtualKeyCode; - WORD wVirtualScanCode; - union { - WCHAR UnicodeChar; - CHAR AsciiChar; - } uChar; - DWORD dwControlKeyState; - } KEY_EVENT_RECORD,*PKEY_EVENT_RECORD; - -#define RIGHT_ALT_PRESSED 0x1 -#define LEFT_ALT_PRESSED 0x2 -#define RIGHT_CTRL_PRESSED 0x4 -#define LEFT_CTRL_PRESSED 0x8 -#define SHIFT_PRESSED 0x10 -#define NUMLOCK_ON 0x20 -#define SCROLLLOCK_ON 0x40 -#define CAPSLOCK_ON 0x80 -#define ENHANCED_KEY 0x100 -#define NLS_DBCSCHAR 0x10000 -#define NLS_ALPHANUMERIC 0x0 -#define NLS_KATAKANA 0x20000 -#define NLS_HIRAGANA 0x40000 -#define NLS_ROMAN 0x400000 -#define NLS_IME_CONVERSION 0x800000 -#define NLS_IME_DISABLE 0x20000000 - - typedef struct _MOUSE_EVENT_RECORD { - COORD dwMousePosition; - DWORD dwButtonState; - DWORD dwControlKeyState; - DWORD dwEventFlags; - } MOUSE_EVENT_RECORD,*PMOUSE_EVENT_RECORD; - -#define FROM_LEFT_1ST_BUTTON_PRESSED 0x1 -#define RIGHTMOST_BUTTON_PRESSED 0x2 -#define FROM_LEFT_2ND_BUTTON_PRESSED 0x4 -#define FROM_LEFT_3RD_BUTTON_PRESSED 0x8 -#define FROM_LEFT_4TH_BUTTON_PRESSED 0x10 - -#define MOUSE_MOVED 0x1 -#define DOUBLE_CLICK 0x2 -#define MOUSE_WHEELED 0x4 - - typedef struct _WINDOW_BUFFER_SIZE_RECORD { - COORD dwSize; - } WINDOW_BUFFER_SIZE_RECORD,*PWINDOW_BUFFER_SIZE_RECORD; - - typedef struct _MENU_EVENT_RECORD { - UINT dwCommandId; - } MENU_EVENT_RECORD,*PMENU_EVENT_RECORD; - - typedef struct _FOCUS_EVENT_RECORD { - WINBOOL bSetFocus; - } FOCUS_EVENT_RECORD,*PFOCUS_EVENT_RECORD; - - typedef struct _INPUT_RECORD { - WORD EventType; - union { - KEY_EVENT_RECORD KeyEvent; - MOUSE_EVENT_RECORD MouseEvent; - WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; - MENU_EVENT_RECORD MenuEvent; - FOCUS_EVENT_RECORD FocusEvent; - } Event; - } INPUT_RECORD,*PINPUT_RECORD; - -#define KEY_EVENT 0x1 -#define MOUSE_EVENT 0x2 -#define WINDOW_BUFFER_SIZE_EVENT 0x4 -#define MENU_EVENT 0x8 -#define FOCUS_EVENT 0x10 - - typedef struct _CHAR_INFO { - union { - WCHAR UnicodeChar; - CHAR AsciiChar; - } Char; - WORD Attributes; - } CHAR_INFO,*PCHAR_INFO; - -#define FOREGROUND_BLUE 0x1 -#define FOREGROUND_GREEN 0x2 -#define FOREGROUND_RED 0x4 -#define FOREGROUND_INTENSITY 0x8 -#define BACKGROUND_BLUE 0x10 -#define BACKGROUND_GREEN 0x20 -#define BACKGROUND_RED 0x40 -#define BACKGROUND_INTENSITY 0x80 -#define COMMON_LVB_LEADING_BYTE 0x100 -#define COMMON_LVB_TRAILING_BYTE 0x200 -#define COMMON_LVB_GRID_HORIZONTAL 0x400 -#define COMMON_LVB_GRID_LVERTICAL 0x800 -#define COMMON_LVB_GRID_RVERTICAL 0x1000 -#define COMMON_LVB_REVERSE_VIDEO 0x4000 -#define COMMON_LVB_UNDERSCORE 0x8000 - -#define COMMON_LVB_SBCSDBCS 0x300 - - typedef struct _CONSOLE_SCREEN_BUFFER_INFO { - COORD dwSize; - COORD dwCursorPosition; - WORD wAttributes; - SMALL_RECT srWindow; - COORD dwMaximumWindowSize; - } CONSOLE_SCREEN_BUFFER_INFO,*PCONSOLE_SCREEN_BUFFER_INFO; - - typedef struct _CONSOLE_CURSOR_INFO { - DWORD dwSize; - WINBOOL bVisible; - } CONSOLE_CURSOR_INFO,*PCONSOLE_CURSOR_INFO; - - typedef struct _CONSOLE_FONT_INFO { - DWORD nFont; - COORD dwFontSize; - } CONSOLE_FONT_INFO,*PCONSOLE_FONT_INFO; - - typedef struct _CONSOLE_SELECTION_INFO { - DWORD dwFlags; - COORD dwSelectionAnchor; - SMALL_RECT srSelection; - } CONSOLE_SELECTION_INFO,*PCONSOLE_SELECTION_INFO; - -#define CONSOLE_NO_SELECTION 0x0 -#define CONSOLE_SELECTION_IN_PROGRESS 0x1 -#define CONSOLE_SELECTION_NOT_EMPTY 0x2 -#define CONSOLE_MOUSE_SELECTION 0x4 -#define CONSOLE_MOUSE_DOWN 0x8 - - typedef WINBOOL (WINAPI *PHANDLER_ROUTINE)(DWORD CtrlType); - -#define CTRL_C_EVENT 0 -#define CTRL_BREAK_EVENT 1 -#define CTRL_CLOSE_EVENT 2 - -#define CTRL_LOGOFF_EVENT 5 -#define CTRL_SHUTDOWN_EVENT 6 - -#define ENABLE_PROCESSED_INPUT 0x1 -#define ENABLE_LINE_INPUT 0x2 -#define ENABLE_ECHO_INPUT 0x4 -#define ENABLE_WINDOW_INPUT 0x8 -#define ENABLE_MOUSE_INPUT 0x10 -#define ENABLE_INSERT_MODE 0x20 -#define ENABLE_QUICK_EDIT_MODE 0x40 -#define ENABLE_EXTENDED_FLAGS 0x80 -#define ENABLE_AUTO_POSITION 0x100 -#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x200 - -#define ENABLE_PROCESSED_OUTPUT 0x1 -#define ENABLE_WRAP_AT_EOL_OUTPUT 0x2 -#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4 -#define DISABLE_NEWLINE_AUTO_RETURN 0x8 -#define ENABLE_LVB_GRID_WORLDWIDE 0x10 - -#ifdef UNICODE -#define PeekConsoleInput PeekConsoleInputW -#define ReadConsoleInput ReadConsoleInputW -#define WriteConsoleInput WriteConsoleInputW -#define ReadConsoleOutput ReadConsoleOutputW -#define WriteConsoleOutput WriteConsoleOutputW -#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW -#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW -#define FillConsoleOutputCharacter FillConsoleOutputCharacterW -#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW -#define GetConsoleTitle GetConsoleTitleW -#define SetConsoleTitle SetConsoleTitleW -#define ReadConsole ReadConsoleW -#define WriteConsole WriteConsoleW -#define AddConsoleAlias AddConsoleAliasW -#define GetConsoleAlias GetConsoleAliasW -#define GetConsoleAliasesLength GetConsoleAliasesLengthW -#define GetConsoleAliasExesLength GetConsoleAliasExesLengthW -#define GetConsoleAliases GetConsoleAliasesW -#define GetConsoleAliasExes GetConsoleAliasExesW -#else -#define PeekConsoleInput PeekConsoleInputA -#define ReadConsoleInput ReadConsoleInputA -#define WriteConsoleInput WriteConsoleInputA -#define ReadConsoleOutput ReadConsoleOutputA -#define WriteConsoleOutput WriteConsoleOutputA -#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA -#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA -#define FillConsoleOutputCharacter FillConsoleOutputCharacterA -#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA -#define GetConsoleTitle GetConsoleTitleA -#define SetConsoleTitle SetConsoleTitleA -#define ReadConsole ReadConsoleA -#define WriteConsole WriteConsoleA -#define AddConsoleAlias AddConsoleAliasA -#define GetConsoleAlias GetConsoleAliasA -#define GetConsoleAliasesLength GetConsoleAliasesLengthA -#define GetConsoleAliasExesLength GetConsoleAliasExesLengthA -#define GetConsoleAliases GetConsoleAliasesA -#define GetConsoleAliasExes GetConsoleAliasExesA -#endif - - WINBASEAPI WINBOOL WINAPI PeekConsoleInputA(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); - WINBASEAPI WINBOOL WINAPI PeekConsoleInputW(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); - WINBASEAPI WINBOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); - WINBASEAPI WINBOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput,PINPUT_RECORD lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsRead); - WINBASEAPI WINBOOL WINAPI WriteConsoleInputA(HANDLE hConsoleInput,CONST INPUT_RECORD *lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsWritten); - WINBASEAPI WINBOOL WINAPI WriteConsoleInputW(HANDLE hConsoleInput,CONST INPUT_RECORD *lpBuffer,DWORD nLength,LPDWORD lpNumberOfEventsWritten); - WINBASEAPI WINBOOL WINAPI ReadConsoleOutputA(HANDLE hConsoleOutput,PCHAR_INFO lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpReadRegion); - WINBASEAPI WINBOOL WINAPI ReadConsoleOutputW(HANDLE hConsoleOutput,PCHAR_INFO lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpReadRegion); - WINBASEAPI WINBOOL WINAPI WriteConsoleOutputA(HANDLE hConsoleOutput,CONST CHAR_INFO *lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpWriteRegion); - WINBASEAPI WINBOOL WINAPI WriteConsoleOutputW(HANDLE hConsoleOutput,CONST CHAR_INFO *lpBuffer,COORD dwBufferSize,COORD dwBufferCoord,PSMALL_RECT lpWriteRegion); - WINBASEAPI WINBOOL WINAPI ReadConsoleOutputCharacterA(HANDLE hConsoleOutput,LPSTR lpCharacter,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfCharsRead); - WINBASEAPI WINBOOL WINAPI ReadConsoleOutputCharacterW(HANDLE hConsoleOutput,LPWSTR lpCharacter,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfCharsRead); - WINBASEAPI WINBOOL WINAPI ReadConsoleOutputAttribute(HANDLE hConsoleOutput,LPWORD lpAttribute,DWORD nLength,COORD dwReadCoord,LPDWORD lpNumberOfAttrsRead); - WINBASEAPI WINBOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput,LPCSTR lpCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); - WINBASEAPI WINBOOL WINAPI WriteConsoleOutputCharacterW(HANDLE hConsoleOutput,LPCWSTR lpCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); - WINBASEAPI WINBOOL WINAPI WriteConsoleOutputAttribute(HANDLE hConsoleOutput,CONST WORD *lpAttribute,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfAttrsWritten); - WINBASEAPI WINBOOL WINAPI FillConsoleOutputCharacterA(HANDLE hConsoleOutput,CHAR cCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); - WINBASEAPI WINBOOL WINAPI FillConsoleOutputCharacterW(HANDLE hConsoleOutput,WCHAR cCharacter,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfCharsWritten); - WINBASEAPI WINBOOL WINAPI FillConsoleOutputAttribute(HANDLE hConsoleOutput,WORD wAttribute,DWORD nLength,COORD dwWriteCoord,LPDWORD lpNumberOfAttrsWritten); - WINBASEAPI WINBOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle,LPDWORD lpMode); - WINBASEAPI WINBOOL WINAPI GetNumberOfConsoleInputEvents(HANDLE hConsoleInput,LPDWORD lpNumberOfEvents); - WINBASEAPI WINBOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo); - WINBASEAPI COORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput); - WINBASEAPI WINBOOL WINAPI GetConsoleCursorInfo(HANDLE hConsoleOutput,PCONSOLE_CURSOR_INFO lpConsoleCursorInfo); - WINBASEAPI WINBOOL WINAPI GetCurrentConsoleFont(HANDLE hConsoleOutput,WINBOOL bMaximumWindow,PCONSOLE_FONT_INFO lpConsoleCurrentFont); - WINBASEAPI COORD WINAPI GetConsoleFontSize(HANDLE hConsoleOutput,DWORD nFont); - WINBASEAPI WINBOOL WINAPI GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo); - WINBASEAPI WINBOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD lpNumberOfMouseButtons); - WINBASEAPI WINBOOL WINAPI SetConsoleMode(HANDLE hConsoleHandle,DWORD dwMode); - WINBASEAPI WINBOOL WINAPI SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput); - WINBASEAPI WINBOOL WINAPI FlushConsoleInputBuffer(HANDLE hConsoleInput); - WINBASEAPI WINBOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput,COORD dwSize); - WINBASEAPI WINBOOL WINAPI SetConsoleCursorPosition(HANDLE hConsoleOutput,COORD dwCursorPosition); - WINBASEAPI WINBOOL WINAPI SetConsoleCursorInfo(HANDLE hConsoleOutput,CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo); - WINBASEAPI WINBOOL WINAPI ScrollConsoleScreenBufferA(HANDLE hConsoleOutput,CONST SMALL_RECT *lpScrollRectangle,CONST SMALL_RECT *lpClipRectangle,COORD dwDestinationOrigin,CONST CHAR_INFO *lpFill); - WINBASEAPI WINBOOL WINAPI ScrollConsoleScreenBufferW(HANDLE hConsoleOutput,CONST SMALL_RECT *lpScrollRectangle,CONST SMALL_RECT *lpClipRectangle,COORD dwDestinationOrigin,CONST CHAR_INFO *lpFill); - WINBASEAPI WINBOOL WINAPI SetConsoleWindowInfo(HANDLE hConsoleOutput,WINBOOL bAbsolute,CONST SMALL_RECT *lpConsoleWindow); - WINBASEAPI WINBOOL WINAPI SetConsoleTextAttribute(HANDLE hConsoleOutput,WORD wAttributes); - WINBASEAPI WINBOOL WINAPI SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine,WINBOOL Add); - WINBASEAPI WINBOOL WINAPI GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,DWORD dwProcessGroupId); - WINBASEAPI WINBOOL WINAPI AllocConsole(VOID); - WINBASEAPI WINBOOL WINAPI FreeConsole(VOID); - WINBASEAPI WINBOOL WINAPI AttachConsole(DWORD dwProcessId); - -#define ATTACH_PARENT_PROCESS ((DWORD)-1) - - WINBASEAPI DWORD WINAPI GetConsoleTitleA(LPSTR lpConsoleTitle,DWORD nSize); - WINBASEAPI DWORD WINAPI GetConsoleTitleW(LPWSTR lpConsoleTitle,DWORD nSize); - WINBASEAPI WINBOOL WINAPI SetConsoleTitleA(LPCSTR lpConsoleTitle); - WINBASEAPI WINBOOL WINAPI SetConsoleTitleW(LPCWSTR lpConsoleTitle); - WINBASEAPI WINBOOL WINAPI ReadConsoleA(HANDLE hConsoleInput,LPVOID lpBuffer,DWORD nNumberOfCharsToRead,LPDWORD lpNumberOfCharsRead,LPVOID lpReserved); - WINBASEAPI WINBOOL WINAPI ReadConsoleW(HANDLE hConsoleInput,LPVOID lpBuffer,DWORD nNumberOfCharsToRead,LPDWORD lpNumberOfCharsRead,LPVOID lpReserved); - WINBASEAPI WINBOOL WINAPI WriteConsoleA(HANDLE hConsoleOutput,CONST VOID *lpBuffer,DWORD nNumberOfCharsToWrite,LPDWORD lpNumberOfCharsWritten,LPVOID lpReserved); - WINBASEAPI WINBOOL WINAPI WriteConsoleW(HANDLE hConsoleOutput,CONST VOID *lpBuffer,DWORD nNumberOfCharsToWrite,LPDWORD lpNumberOfCharsWritten,LPVOID lpReserved); - -#define CONSOLE_TEXTMODE_BUFFER 1 - - WINBASEAPI HANDLE WINAPI CreateConsoleScreenBuffer(DWORD dwDesiredAccess,DWORD dwShareMode,CONST SECURITY_ATTRIBUTES *lpSecurityAttributes,DWORD dwFlags,LPVOID lpScreenBufferData); - WINBASEAPI UINT WINAPI GetConsoleCP(VOID); - WINBASEAPI WINBOOL WINAPI SetConsoleCP(UINT wCodePageID); - WINBASEAPI UINT WINAPI GetConsoleOutputCP(VOID); - WINBASEAPI WINBOOL WINAPI SetConsoleOutputCP(UINT wCodePageID); - -#define CONSOLE_FULLSCREEN 1 -#define CONSOLE_FULLSCREEN_HARDWARE 2 - - WINBASEAPI WINBOOL WINAPI GetConsoleDisplayMode(LPDWORD lpModeFlags); - WINBASEAPI HWND WINAPI GetConsoleWindow(VOID); - WINBASEAPI DWORD WINAPI GetConsoleProcessList(LPDWORD lpdwProcessList,DWORD dwProcessCount); - WINBASEAPI WINBOOL WINAPI AddConsoleAliasA(LPSTR Source,LPSTR Target,LPSTR ExeName); - WINBASEAPI WINBOOL WINAPI AddConsoleAliasW(LPWSTR Source,LPWSTR Target,LPWSTR ExeName); - WINBASEAPI DWORD WINAPI GetConsoleAliasA(LPSTR Source,LPSTR TargetBuffer,DWORD TargetBufferLength,LPSTR ExeName); - WINBASEAPI DWORD WINAPI GetConsoleAliasW(LPWSTR Source,LPWSTR TargetBuffer,DWORD TargetBufferLength,LPWSTR ExeName); - WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthA(LPSTR ExeName); - WINBASEAPI DWORD WINAPI GetConsoleAliasesLengthW(LPWSTR ExeName); - WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthA(VOID); - WINBASEAPI DWORD WINAPI GetConsoleAliasExesLengthW(VOID); - WINBASEAPI DWORD WINAPI GetConsoleAliasesA(LPSTR AliasBuffer,DWORD AliasBufferLength,LPSTR ExeName); - WINBASEAPI DWORD WINAPI GetConsoleAliasesW(LPWSTR AliasBuffer,DWORD AliasBufferLength,LPWSTR ExeName); - WINBASEAPI DWORD WINAPI GetConsoleAliasExesA(LPSTR ExeNameBuffer,DWORD ExeNameBufferLength); - WINBASEAPI DWORD WINAPI GetConsoleAliasExesW(LPWSTR ExeNameBuffer,DWORD ExeNameBufferLength); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/windef.h b/win32/include/winapi/windef.h deleted file mode 100644 index d63bdef1..00000000 --- a/win32/include/winapi/windef.h +++ /dev/null @@ -1,293 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINDEF_ -#define _WINDEF_ - -#ifndef STRICT -#define STRICT 1 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef WINVER -#define WINVER 0x0502 -#endif - -#ifndef BASETYPES -#define BASETYPES - typedef unsigned long ULONG; - typedef ULONG *PULONG; - typedef unsigned short USHORT; - typedef USHORT *PUSHORT; - typedef unsigned char UCHAR; - typedef UCHAR *PUCHAR; - typedef char *PSZ; -#endif - -#define MAX_PATH 260 - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef IN -#define IN -#endif - -#ifndef OUT -#define OUT -#endif - -#ifndef OPTIONAL -#define OPTIONAL -#endif - -#undef far -#undef near -#undef pascal - -#define far -#define near -#define pascal __stdcall - -#define cdecl -#ifndef CDECL -#define CDECL -#endif -#ifndef CALLBACK -#define CALLBACK __stdcall -#endif -#ifndef WINAPI -#define WINAPI __stdcall -#endif -#define WINAPIV __cdecl -#define APIENTRY WINAPI -#define APIPRIVATE WINAPI -#define PASCAL WINAPI -#define WINAPI_INLINE WINAPI - -#undef FAR -#undef NEAR -#define FAR -#define NEAR -#ifndef CONST -#define CONST const -#endif - - typedef unsigned long DWORD; - typedef int WINBOOL; -#define BOOL WINBOOL - typedef unsigned char BYTE; - typedef unsigned short WORD; - typedef float FLOAT; - typedef FLOAT *PFLOAT; - typedef WINBOOL *PBOOL; - typedef WINBOOL *LPBOOL; - typedef BYTE *PBYTE; - typedef BYTE *LPBYTE; - typedef int *PINT; - typedef int *LPINT; - typedef WORD *PWORD; - typedef WORD *LPWORD; - typedef long *LPLONG; - typedef DWORD *PDWORD; - typedef DWORD *LPDWORD; - typedef void *LPVOID; -# ifndef _LPCVOID_DEFINED -#define _LPCVOID_DEFINED -typedef CONST void *LPCVOID; -#endif - typedef int INT; - typedef unsigned int UINT; - typedef unsigned int *PUINT; - -#ifndef NT_INCLUDED -#include -#endif - -//gr #include - - typedef UINT_PTR WPARAM; - typedef LONG_PTR LPARAM; - typedef LONG_PTR LRESULT; - -#ifndef __cplusplus -#ifndef NOMINMAX -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif -#endif -#endif - -#define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) -#define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) -#define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) -#define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) -#define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) -#define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) - -#ifndef WIN_INTERNAL - DECLARE_HANDLE (HWND); - DECLARE_HANDLE (HHOOK); -#ifdef WINABLE - DECLARE_HANDLE (HEVENT); -#endif -#endif - - typedef WORD ATOM; - - typedef HANDLE *SPHANDLE; - typedef HANDLE *LPHANDLE; - typedef HANDLE HGLOBAL; - typedef HANDLE HLOCAL; - typedef HANDLE GLOBALHANDLE; - typedef HANDLE LOCALHANDLE; -#ifdef _WIN64 - typedef INT_PTR (WINAPI *FARPROC)(); - typedef INT_PTR (WINAPI *NEARPROC)(); - typedef INT_PTR (WINAPI *PROC)(); -#else - typedef int (WINAPI *FARPROC)(); - typedef int (WINAPI *NEARPROC)(); - typedef int (WINAPI *PROC)(); -#endif - - typedef void *HGDIOBJ; - - DECLARE_HANDLE(HKEY); - typedef HKEY *PHKEY; - - DECLARE_HANDLE(HACCEL); - DECLARE_HANDLE(HBITMAP); - DECLARE_HANDLE(HBRUSH); - DECLARE_HANDLE(HCOLORSPACE); - DECLARE_HANDLE(HDC); - DECLARE_HANDLE(HGLRC); - DECLARE_HANDLE(HDESK); - DECLARE_HANDLE(HENHMETAFILE); - DECLARE_HANDLE(HFONT); - DECLARE_HANDLE(HICON); - DECLARE_HANDLE(HMENU); - DECLARE_HANDLE(HMETAFILE); - DECLARE_HANDLE(HINSTANCE); - typedef HINSTANCE HMODULE; - DECLARE_HANDLE(HPALETTE); - DECLARE_HANDLE(HPEN); - DECLARE_HANDLE(HRGN); - DECLARE_HANDLE(HRSRC); - DECLARE_HANDLE(HSTR); - DECLARE_HANDLE(HTASK); - DECLARE_HANDLE(HWINSTA); - DECLARE_HANDLE(HKL); - DECLARE_HANDLE(HMONITOR); - DECLARE_HANDLE(HWINEVENTHOOK); - DECLARE_HANDLE(HUMPD); - - typedef int HFILE; - typedef HICON HCURSOR; - typedef DWORD COLORREF; - typedef DWORD *LPCOLORREF; - -#define HFILE_ERROR ((HFILE)-1) - - typedef struct tagRECT { - LONG left; - LONG top; - LONG right; - LONG bottom; - } RECT,*PRECT,*NPRECT,*LPRECT; - - typedef const RECT *LPCRECT; - - typedef struct _RECTL { - LONG left; - LONG top; - LONG right; - LONG bottom; - } RECTL,*PRECTL,*LPRECTL; - - typedef const RECTL *LPCRECTL; - - typedef struct tagPOINT { - LONG x; - LONG y; - } POINT,*PPOINT,*NPPOINT,*LPPOINT; - - typedef struct _POINTL { - LONG x; - LONG y; - } POINTL,*PPOINTL; - - typedef struct tagSIZE { - LONG cx; - LONG cy; - } SIZE,*PSIZE,*LPSIZE; - - typedef SIZE SIZEL; - typedef SIZE *PSIZEL,*LPSIZEL; - - typedef struct tagPOINTS { - SHORT x; - SHORT y; - } POINTS,*PPOINTS,*LPPOINTS; - - typedef struct _FILETIME { - DWORD dwLowDateTime; - DWORD dwHighDateTime; - } FILETIME,*PFILETIME,*LPFILETIME; -#define _FILETIME_ - -#define DM_UPDATE 1 -#define DM_COPY 2 -#define DM_PROMPT 4 -#define DM_MODIFY 8 - -#define DM_IN_BUFFER DM_MODIFY -#define DM_IN_PROMPT DM_PROMPT -#define DM_OUT_BUFFER DM_COPY -#define DM_OUT_DEFAULT DM_UPDATE - -#define DC_FIELDS 1 -#define DC_PAPERS 2 -#define DC_PAPERSIZE 3 -#define DC_MINEXTENT 4 -#define DC_MAXEXTENT 5 -#define DC_BINS 6 -#define DC_DUPLEX 7 -#define DC_SIZE 8 -#define DC_EXTRA 9 -#define DC_VERSION 10 -#define DC_DRIVER 11 -#define DC_BINNAMES 12 -#define DC_ENUMRESOLUTIONS 13 -#define DC_FILEDEPENDENCIES 14 -#define DC_TRUETYPE 15 -#define DC_PAPERNAMES 16 -#define DC_ORIENTATION 17 -#define DC_COPIES 18 - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/windows.h b/win32/include/winapi/windows.h deleted file mode 100644 index ff6454a9..00000000 --- a/win32/include/winapi/windows.h +++ /dev/null @@ -1,127 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINDOWS_ -#define _WINDOWS_ - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#endif - -#ifndef WINVER -#define WINVER 0x0502 -#endif - -#include <_mingw.h> - -#ifndef _INC_WINDOWS -#define _INC_WINDOWS - -#if defined(RC_INVOKED) && !defined(NOWINRES) - -#include -#else - -#ifdef RC_INVOKED -#define NOATOM -#define NOGDI -#define NOGDICAPMASKS -#define NOMETAFILE -#define NOMINMAX -#define NOMSG -#define NOOPENFILE -#define NORASTEROPS -#define NOSCROLL -#define NOSOUND -#define NOSYSMETRICS -#define NOTEXTMETRIC -#define NOWH -#define NOCOMM -#define NOKANJI -#define NOCRYPT -#define NOMCX -#endif - -#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) -#define I_X86_ -#endif - -#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) -#define _AMD64_ -#endif - -#if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) -#if !defined(_IA64_) -#define _IA64_ -#endif -#endif - -#ifndef RC_INVOKED -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -//gr #include - -#ifndef WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef NOCRYPT -#include -#include -#include -#endif - -#ifndef NOUSER -#ifndef NOGDI -#include -#ifdef INC_OLE1 -#include -#else -#include -#endif -#include -#endif -#endif -#endif - -//gr #include - -#ifdef INC_OLE2 -#include -#endif - -#ifndef NOSERVICE -#include -#endif - -#ifndef NOMCX -#include -#endif - -#ifndef NOIME -#include -#endif - -#endif -#endif -#endif diff --git a/win32/include/winapi/winerror.h b/win32/include/winapi/winerror.h deleted file mode 100644 index 77d85edc..00000000 --- a/win32/include/winapi/winerror.h +++ /dev/null @@ -1,3166 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINERROR_ -#define _WINERROR_ - -#define FACILITY_WINDOWSUPDATE 36 -#define FACILITY_WINDOWS_CE 24 -#define FACILITY_WINDOWS 8 -#define FACILITY_URT 19 -#define FACILITY_UMI 22 -#define FACILITY_SXS 23 -#define FACILITY_STORAGE 3 -#define FACILITY_STATE_MANAGEMENT 34 -#define FACILITY_SSPI 9 -#define FACILITY_SCARD 16 -#define FACILITY_SETUPAPI 15 -#define FACILITY_SECURITY 9 -#define FACILITY_RPC 1 -#define FACILITY_WIN32 7 -#define FACILITY_CONTROL 10 -#define FACILITY_NULL 0 -#define FACILITY_METADIRECTORY 35 -#define FACILITY_MSMQ 14 -#define FACILITY_MEDIASERVER 13 -#define FACILITY_INTERNET 12 -#define FACILITY_ITF 4 -#define FACILITY_HTTP 25 -#define FACILITY_DPLAY 21 -#define FACILITY_DISPATCH 2 -#define FACILITY_DIRECTORYSERVICE 37 -#define FACILITY_CONFIGURATION 33 -#define FACILITY_COMPLUS 17 -#define FACILITY_CERT 11 -#define FACILITY_BACKGROUNDCOPY 32 -#define FACILITY_ACS 20 -#define FACILITY_AAF 18 -#define ERROR_SUCCESS 0L -#define NO_ERROR 0L -#define SEC_E_OK ((HRESULT)0x00000000L) -#define ERROR_INVALID_FUNCTION 1L -#define ERROR_FILE_NOT_FOUND 2L -#define ERROR_PATH_NOT_FOUND 3L -#define ERROR_TOO_MANY_OPEN_FILES 4L -#define ERROR_ACCESS_DENIED 5L -#define ERROR_INVALID_HANDLE 6L -#define ERROR_ARENA_TRASHED 7L -#define ERROR_NOT_ENOUGH_MEMORY 8L -#define ERROR_INVALID_BLOCK 9L -#define ERROR_BAD_ENVIRONMENT 10L -#define ERROR_BAD_FORMAT 11L -#define ERROR_INVALID_ACCESS 12L -#define ERROR_INVALID_DATA 13L -#define ERROR_OUTOFMEMORY 14L -#define ERROR_INVALID_DRIVE 15L -#define ERROR_CURRENT_DIRECTORY 16L -#define ERROR_NOT_SAME_DEVICE 17L -#define ERROR_NO_MORE_FILES 18L -#define ERROR_WRITE_PROTECT 19L -#define ERROR_BAD_UNIT 20L -#define ERROR_NOT_READY 21L -#define ERROR_BAD_COMMAND 22L -#define ERROR_CRC 23L -#define ERROR_BAD_LENGTH 24L -#define ERROR_SEEK 25L -#define ERROR_NOT_DOS_DISK 26L -#define ERROR_SECTOR_NOT_FOUND 27L -#define ERROR_OUT_OF_PAPER 28L -#define ERROR_WRITE_FAULT 29L -#define ERROR_READ_FAULT 30L -#define ERROR_GEN_FAILURE 31L -#define ERROR_SHARING_VIOLATION 32L -#define ERROR_LOCK_VIOLATION 33L -#define ERROR_WRONG_DISK 34L -#define ERROR_SHARING_BUFFER_EXCEEDED 36L -#define ERROR_HANDLE_EOF 38L -#define ERROR_HANDLE_DISK_FULL 39L -#define ERROR_NOT_SUPPORTED 50L -#define ERROR_REM_NOT_LIST 51L -#define ERROR_DUP_NAME 52L -#define ERROR_BAD_NETPATH 53L -#define ERROR_NETWORK_BUSY 54L -#define ERROR_DEV_NOT_EXIST 55L -#define ERROR_TOO_MANY_CMDS 56L -#define ERROR_ADAP_HDW_ERR 57L -#define ERROR_BAD_NET_RESP 58L -#define ERROR_UNEXP_NET_ERR 59L -#define ERROR_BAD_REM_ADAP 60L -#define ERROR_PRINTQ_FULL 61L -#define ERROR_NO_SPOOL_SPACE 62L -#define ERROR_PRINT_CANCELLED 63L -#define ERROR_NETNAME_DELETED 64L -#define ERROR_NETWORK_ACCESS_DENIED 65L -#define ERROR_BAD_DEV_TYPE 66L -#define ERROR_BAD_NET_NAME 67L -#define ERROR_TOO_MANY_NAMES 68L -#define ERROR_TOO_MANY_SESS 69L -#define ERROR_SHARING_PAUSED 70L -#define ERROR_REQ_NOT_ACCEP 71L -#define ERROR_REDIR_PAUSED 72L -#define ERROR_FILE_EXISTS 80L -#define ERROR_CANNOT_MAKE 82L -#define ERROR_FAIL_I24 83L -#define ERROR_OUT_OF_STRUCTURES 84L -#define ERROR_ALREADY_ASSIGNED 85L -#define ERROR_INVALID_PASSWORD 86L -#define ERROR_INVALID_PARAMETER 87L -#define ERROR_NET_WRITE_FAULT 88L -#define ERROR_NO_PROC_SLOTS 89L -#define ERROR_TOO_MANY_SEMAPHORES 100L -#define ERROR_EXCL_SEM_ALREADY_OWNED 101L -#define ERROR_SEM_IS_SET 102L -#define ERROR_TOO_MANY_SEM_REQUESTS 103L -#define ERROR_INVALID_AT_INTERRUPT_TIME 104L -#define ERROR_SEM_OWNER_DIED 105L -#define ERROR_SEM_USER_LIMIT 106L -#define ERROR_DISK_CHANGE 107L -#define ERROR_DRIVE_LOCKED 108L -#define ERROR_BROKEN_PIPE 109L -#define ERROR_OPEN_FAILED 110L -#define ERROR_BUFFER_OVERFLOW 111L -#define ERROR_DISK_FULL 112L -#define ERROR_NO_MORE_SEARCH_HANDLES 113L -#define ERROR_INVALID_TARGET_HANDLE 114L -#define ERROR_INVALID_CATEGORY 117L -#define ERROR_INVALID_VERIFY_SWITCH 118L -#define ERROR_BAD_DRIVER_LEVEL 119L -#define ERROR_CALL_NOT_IMPLEMENTED 120L -#define ERROR_SEM_TIMEOUT 121L -#define ERROR_INSUFFICIENT_BUFFER 122L -#define ERROR_INVALID_NAME 123L -#define ERROR_INVALID_LEVEL 124L -#define ERROR_NO_VOLUME_LABEL 125L -#define ERROR_MOD_NOT_FOUND 126L -#define ERROR_PROC_NOT_FOUND 127L -#define ERROR_WAIT_NO_CHILDREN 128L -#define ERROR_CHILD_NOT_COMPLETE 129L -#define ERROR_DIRECT_ACCESS_HANDLE 130L -#define ERROR_NEGATIVE_SEEK 131L -#define ERROR_SEEK_ON_DEVICE 132L -#define ERROR_IS_JOIN_TARGET 133L -#define ERROR_IS_JOINED 134L -#define ERROR_IS_SUBSTED 135L -#define ERROR_NOT_JOINED 136L -#define ERROR_NOT_SUBSTED 137L -#define ERROR_JOIN_TO_JOIN 138L -#define ERROR_SUBST_TO_SUBST 139L -#define ERROR_JOIN_TO_SUBST 140L -#define ERROR_SUBST_TO_JOIN 141L -#define ERROR_BUSY_DRIVE 142L -#define ERROR_SAME_DRIVE 143L -#define ERROR_DIR_NOT_ROOT 144L -#define ERROR_DIR_NOT_EMPTY 145L -#define ERROR_IS_SUBST_PATH 146L -#define ERROR_IS_JOIN_PATH 147L -#define ERROR_PATH_BUSY 148L -#define ERROR_IS_SUBST_TARGET 149L -#define ERROR_SYSTEM_TRACE 150L -#define ERROR_INVALID_EVENT_COUNT 151L -#define ERROR_TOO_MANY_MUXWAITERS 152L -#define ERROR_INVALID_LIST_FORMAT 153L -#define ERROR_LABEL_TOO_LONG 154L -#define ERROR_TOO_MANY_TCBS 155L -#define ERROR_SIGNAL_REFUSED 156L -#define ERROR_DISCARDED 157L -#define ERROR_NOT_LOCKED 158L -#define ERROR_BAD_THREADID_ADDR 159L -#define ERROR_BAD_ARGUMENTS 160L -#define ERROR_BAD_PATHNAME 161L -#define ERROR_SIGNAL_PENDING 162L -#define ERROR_MAX_THRDS_REACHED 164L -#define ERROR_LOCK_FAILED 167L -#define ERROR_BUSY 170L -#define ERROR_CANCEL_VIOLATION 173L -#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED 174L -#define ERROR_INVALID_SEGMENT_NUMBER 180L -#define ERROR_INVALID_ORDINAL 182L -#define ERROR_ALREADY_EXISTS 183L -#define ERROR_INVALID_FLAG_NUMBER 186L -#define ERROR_SEM_NOT_FOUND 187L -#define ERROR_INVALID_STARTING_CODESEG 188L -#define ERROR_INVALID_STACKSEG 189L -#define ERROR_INVALID_MODULETYPE 190L -#define ERROR_INVALID_EXE_SIGNATURE 191L -#define ERROR_EXE_MARKED_INVALID 192L -#define ERROR_BAD_EXE_FORMAT 193L -#define ERROR_ITERATED_DATA_EXCEEDS_64k 194L -#define ERROR_INVALID_MINALLOCSIZE 195L -#define ERROR_DYNLINK_FROM_INVALID_RING 196L -#define ERROR_IOPL_NOT_ENABLED 197L -#define ERROR_INVALID_SEGDPL 198L -#define ERROR_AUTODATASEG_EXCEEDS_64k 199L -#define ERROR_RING2SEG_MUST_BE_MOVABLE 200L -#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201L -#define ERROR_INFLOOP_IN_RELOC_CHAIN 202L -#define ERROR_ENVVAR_NOT_FOUND 203L -#define ERROR_NO_SIGNAL_SENT 205L -#define ERROR_FILENAME_EXCED_RANGE 206L -#define ERROR_RING2_STACK_IN_USE 207L -#define ERROR_META_EXPANSION_TOO_LONG 208L -#define ERROR_INVALID_SIGNAL_NUMBER 209L -#define ERROR_THREAD_1_INACTIVE 210L -#define ERROR_LOCKED 212L -#define ERROR_TOO_MANY_MODULES 214L -#define ERROR_NESTING_NOT_ALLOWED 215L -#define ERROR_EXE_MACHINE_TYPE_MISMATCH 216L -#define ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY 217L -#define ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY 218L -#define ERROR_BAD_PIPE 230L -#define ERROR_PIPE_BUSY 231L -#define ERROR_NO_DATA 232L -#define ERROR_PIPE_NOT_CONNECTED 233L -#define ERROR_MORE_DATA 234L -#define ERROR_VC_DISCONNECTED 240L -#define ERROR_INVALID_EA_NAME 254L -#define ERROR_EA_LIST_INCONSISTENT 255L -#define WAIT_TIMEOUT 258L -#define ERROR_NO_MORE_ITEMS 259L -#define ERROR_CANNOT_COPY 266L -#define ERROR_DIRECTORY 267L -#define ERROR_EAS_DIDNT_FIT 275L -#define ERROR_EA_FILE_CORRUPT 276L -#define ERROR_EA_TABLE_FULL 277L -#define ERROR_INVALID_EA_HANDLE 278L -#define ERROR_EAS_NOT_SUPPORTED 282L -#define ERROR_NOT_OWNER 288L -#define ERROR_TOO_MANY_POSTS 298L -#define ERROR_PARTIAL_COPY 299L -#define ERROR_OPLOCK_NOT_GRANTED 300L -#define ERROR_INVALID_OPLOCK_PROTOCOL 301L -#define ERROR_DISK_TOO_FRAGMENTED 302L -#define ERROR_DELETE_PENDING 303L -#define ERROR_MR_MID_NOT_FOUND 317L -#define ERROR_SCOPE_NOT_FOUND 318L -#define ERROR_INVALID_ADDRESS 487L -#define ERROR_ARITHMETIC_OVERFLOW 534L -#define ERROR_PIPE_CONNECTED 535L -#define ERROR_PIPE_LISTENING 536L -#define ERROR_EA_ACCESS_DENIED 994L -#define ERROR_OPERATION_ABORTED 995L -#define ERROR_IO_INCOMPLETE 996L -#define ERROR_IO_PENDING 997L -#define ERROR_NOACCESS 998L -#define ERROR_SWAPERROR 999L -#define ERROR_STACK_OVERFLOW 1001L -#define ERROR_INVALID_MESSAGE 1002L -#define ERROR_CAN_NOT_COMPLETE 1003L -#define ERROR_INVALID_FLAGS 1004L -#define ERROR_UNRECOGNIZED_VOLUME 1005L -#define ERROR_FILE_INVALID 1006L -#define ERROR_FULLSCREEN_MODE 1007L -#define ERROR_NO_TOKEN 1008L -#define ERROR_BADDB 1009L -#define ERROR_BADKEY 1010L -#define ERROR_CANTOPEN 1011L -#define ERROR_CANTREAD 1012L -#define ERROR_CANTWRITE 1013L -#define ERROR_REGISTRY_RECOVERED 1014L -#define ERROR_REGISTRY_CORRUPT 1015L -#define ERROR_REGISTRY_IO_FAILED 1016L -#define ERROR_NOT_REGISTRY_FILE 1017L -#define ERROR_KEY_DELETED 1018L -#define ERROR_NO_LOG_SPACE 1019L -#define ERROR_KEY_HAS_CHILDREN 1020L -#define ERROR_CHILD_MUST_BE_VOLATILE 1021L -#define ERROR_NOTIFY_ENUM_DIR 1022L -#define ERROR_DEPENDENT_SERVICES_RUNNING 1051L -#define ERROR_INVALID_SERVICE_CONTROL 1052L -#define ERROR_SERVICE_REQUEST_TIMEOUT 1053L -#define ERROR_SERVICE_NO_THREAD 1054L -#define ERROR_SERVICE_DATABASE_LOCKED 1055L -#define ERROR_SERVICE_ALREADY_RUNNING 1056L -#define ERROR_INVALID_SERVICE_ACCOUNT 1057L -#define ERROR_SERVICE_DISABLED 1058L -#define ERROR_CIRCULAR_DEPENDENCY 1059L -#define ERROR_SERVICE_DOES_NOT_EXIST 1060L -#define ERROR_SERVICE_CANNOT_ACCEPT_CTRL 1061L -#define ERROR_SERVICE_NOT_ACTIVE 1062L -#define ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 1063L -#define ERROR_EXCEPTION_IN_SERVICE 1064L -#define ERROR_DATABASE_DOES_NOT_EXIST 1065L -#define ERROR_SERVICE_SPECIFIC_ERROR 1066L -#define ERROR_PROCESS_ABORTED 1067L -#define ERROR_SERVICE_DEPENDENCY_FAIL 1068L -#define ERROR_SERVICE_LOGON_FAILED 1069L -#define ERROR_SERVICE_START_HANG 1070L -#define ERROR_INVALID_SERVICE_LOCK 1071L -#define ERROR_SERVICE_MARKED_FOR_DELETE 1072L -#define ERROR_SERVICE_EXISTS 1073L -#define ERROR_ALREADY_RUNNING_LKG 1074L -#define ERROR_SERVICE_DEPENDENCY_DELETED 1075L -#define ERROR_BOOT_ALREADY_ACCEPTED 1076L -#define ERROR_SERVICE_NEVER_STARTED 1077L -#define ERROR_DUPLICATE_SERVICE_NAME 1078L -#define ERROR_DIFFERENT_SERVICE_ACCOUNT 1079L -#define ERROR_CANNOT_DETECT_DRIVER_FAILURE 1080L -#define ERROR_CANNOT_DETECT_PROCESS_ABORT 1081L -#define ERROR_NO_RECOVERY_PROGRAM 1082L -#define ERROR_SERVICE_NOT_IN_EXE 1083L -#define ERROR_NOT_SAFEBOOT_SERVICE 1084L -#define ERROR_END_OF_MEDIA 1100L -#define ERROR_FILEMARK_DETECTED 1101L -#define ERROR_BEGINNING_OF_MEDIA 1102L -#define ERROR_SETMARK_DETECTED 1103L -#define ERROR_NO_DATA_DETECTED 1104L -#define ERROR_PARTITION_FAILURE 1105L -#define ERROR_INVALID_BLOCK_LENGTH 1106L -#define ERROR_DEVICE_NOT_PARTITIONED 1107L -#define ERROR_UNABLE_TO_LOCK_MEDIA 1108L -#define ERROR_UNABLE_TO_UNLOAD_MEDIA 1109L -#define ERROR_MEDIA_CHANGED 1110L -#define ERROR_BUS_RESET 1111L -#define ERROR_NO_MEDIA_IN_DRIVE 1112L -#define ERROR_NO_UNICODE_TRANSLATION 1113L -#define ERROR_DLL_INIT_FAILED 1114L -#define ERROR_SHUTDOWN_IN_PROGRESS 1115L -#define ERROR_NO_SHUTDOWN_IN_PROGRESS 1116L -#define ERROR_IO_DEVICE 1117L -#define ERROR_SERIAL_NO_DEVICE 1118L -#define ERROR_IRQ_BUSY 1119L -#define ERROR_MORE_WRITES 1120L -#define ERROR_COUNTER_TIMEOUT 1121L -#define ERROR_FLOPPY_ID_MARK_NOT_FOUND 1122L -#define ERROR_FLOPPY_WRONG_CYLINDER 1123L -#define ERROR_FLOPPY_UNKNOWN_ERROR 1124L -#define ERROR_FLOPPY_BAD_REGISTERS 1125L -#define ERROR_DISK_RECALIBRATE_FAILED 1126L -#define ERROR_DISK_OPERATION_FAILED 1127L -#define ERROR_DISK_RESET_FAILED 1128L -#define ERROR_EOM_OVERFLOW 1129L -#define ERROR_NOT_ENOUGH_SERVER_MEMORY 1130L -#define ERROR_POSSIBLE_DEADLOCK 1131L -#define ERROR_MAPPED_ALIGNMENT 1132L -#define ERROR_SET_POWER_STATE_VETOED 1140L -#define ERROR_SET_POWER_STATE_FAILED 1141L -#define ERROR_TOO_MANY_LINKS 1142L -#define ERROR_OLD_WIN_VERSION 1150L -#define ERROR_APP_WRONG_OS 1151L -#define ERROR_SINGLE_INSTANCE_APP 1152L -#define ERROR_RMODE_APP 1153L -#define ERROR_INVALID_DLL 1154L -#define ERROR_NO_ASSOCIATION 1155L -#define ERROR_DDE_FAIL 1156L -#define ERROR_DLL_NOT_FOUND 1157L -#define ERROR_NO_MORE_USER_HANDLES 1158L -#define ERROR_MESSAGE_SYNC_ONLY 1159L -#define ERROR_SOURCE_ELEMENT_EMPTY 1160L -#define ERROR_DESTINATION_ELEMENT_FULL 1161L -#define ERROR_ILLEGAL_ELEMENT_ADDRESS 1162L -#define ERROR_MAGAZINE_NOT_PRESENT 1163L -#define ERROR_DEVICE_REINITIALIZATION_NEEDED 1164L -#define ERROR_DEVICE_REQUIRES_CLEANING 1165L -#define ERROR_DEVICE_DOOR_OPEN 1166L -#define ERROR_DEVICE_NOT_CONNECTED 1167L -#define ERROR_NOT_FOUND 1168L -#define ERROR_NO_MATCH 1169L -#define ERROR_SET_NOT_FOUND 1170L -#define ERROR_POINT_NOT_FOUND 1171L -#define ERROR_NO_TRACKING_SERVICE 1172L -#define ERROR_NO_VOLUME_ID 1173L -#define ERROR_UNABLE_TO_REMOVE_REPLACED 1175L -#define ERROR_UNABLE_TO_MOVE_REPLACEMENT 1176L -#define ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 1177L -#define ERROR_JOURNAL_DELETE_IN_PROGRESS 1178L -#define ERROR_JOURNAL_NOT_ACTIVE 1179L -#define ERROR_POTENTIAL_FILE_FOUND 1180L -#define ERROR_JOURNAL_ENTRY_DELETED 1181L -#define ERROR_BAD_DEVICE 1200L -#define ERROR_CONNECTION_UNAVAIL 1201L -#define ERROR_DEVICE_ALREADY_REMEMBERED 1202L -#define ERROR_NO_NET_OR_BAD_PATH 1203L -#define ERROR_BAD_PROVIDER 1204L -#define ERROR_CANNOT_OPEN_PROFILE 1205L -#define ERROR_BAD_PROFILE 1206L -#define ERROR_NOT_CONTAINER 1207L -#define ERROR_EXTENDED_ERROR 1208L -#define ERROR_INVALID_GROUPNAME 1209L -#define ERROR_INVALID_COMPUTERNAME 1210L -#define ERROR_INVALID_EVENTNAME 1211L -#define ERROR_INVALID_DOMAINNAME 1212L -#define ERROR_INVALID_SERVICENAME 1213L -#define ERROR_INVALID_NETNAME 1214L -#define ERROR_INVALID_SHARENAME 1215L -#define ERROR_INVALID_PASSWORDNAME 1216L -#define ERROR_INVALID_MESSAGENAME 1217L -#define ERROR_INVALID_MESSAGEDEST 1218L -#define ERROR_SESSION_CREDENTIAL_CONFLICT 1219L -#define ERROR_REMOTE_SESSION_LIMIT_EXCEEDED 1220L -#define ERROR_DUP_DOMAINNAME 1221L -#define ERROR_NO_NETWORK 1222L -#define ERROR_CANCELLED 1223L -#define ERROR_USER_MAPPED_FILE 1224L -#define ERROR_CONNECTION_REFUSED 1225L -#define ERROR_GRACEFUL_DISCONNECT 1226L -#define ERROR_ADDRESS_ALREADY_ASSOCIATED 1227L -#define ERROR_ADDRESS_NOT_ASSOCIATED 1228L -#define ERROR_CONNECTION_INVALID 1229L -#define ERROR_CONNECTION_ACTIVE 1230L -#define ERROR_NETWORK_UNREACHABLE 1231L -#define ERROR_HOST_UNREACHABLE 1232L -#define ERROR_PROTOCOL_UNREACHABLE 1233L -#define ERROR_PORT_UNREACHABLE 1234L -#define ERROR_REQUEST_ABORTED 1235L -#define ERROR_CONNECTION_ABORTED 1236L -#define ERROR_RETRY 1237L -#define ERROR_CONNECTION_COUNT_LIMIT 1238L -#define ERROR_LOGIN_TIME_RESTRICTION 1239L -#define ERROR_LOGIN_WKSTA_RESTRICTION 1240L -#define ERROR_INCORRECT_ADDRESS 1241L -#define ERROR_ALREADY_REGISTERED 1242L -#define ERROR_SERVICE_NOT_FOUND 1243L -#define ERROR_NOT_AUTHENTICATED 1244L -#define ERROR_NOT_LOGGED_ON 1245L -#define ERROR_CONTINUE 1246L -#define ERROR_ALREADY_INITIALIZED 1247L -#define ERROR_NO_MORE_DEVICES 1248L -#define ERROR_NO_SUCH_SITE 1249L -#define ERROR_DOMAIN_CONTROLLER_EXISTS 1250L -#define ERROR_ONLY_IF_CONNECTED 1251L -#define ERROR_OVERRIDE_NOCHANGES 1252L -#define ERROR_BAD_USER_PROFILE 1253L -#define ERROR_NOT_SUPPORTED_ON_SBS 1254L -#define ERROR_SERVER_SHUTDOWN_IN_PROGRESS 1255L -#define ERROR_HOST_DOWN 1256L -#define ERROR_NON_ACCOUNT_SID 1257L -#define ERROR_NON_DOMAIN_SID 1258L -#define ERROR_APPHELP_BLOCK 1259L -#define ERROR_ACCESS_DISABLED_BY_POLICY 1260L -#define ERROR_REG_NAT_CONSUMPTION 1261L -#define ERROR_CSCSHARE_OFFLINE 1262L -#define ERROR_PKINIT_FAILURE 1263L -#define ERROR_SMARTCARD_SUBSYSTEM_FAILURE 1264L -#define ERROR_DOWNGRADE_DETECTED 1265L -#define ERROR_MACHINE_LOCKED 1271L -#define ERROR_CALLBACK_SUPPLIED_INVALID_DATA 1273L -#define ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED 1274L -#define ERROR_DRIVER_BLOCKED 1275L -#define ERROR_INVALID_IMPORT_OF_NON_DLL 1276L -#define ERROR_ACCESS_DISABLED_WEBBLADE 1277L -#define ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER 1278L -#define ERROR_RECOVERY_FAILURE 1279L -#define ERROR_ALREADY_FIBER 1280L -#define ERROR_ALREADY_THREAD 1281L -#define ERROR_STACK_BUFFER_OVERRUN 1282L -#define ERROR_PARAMETER_QUOTA_EXCEEDED 1283L -#define ERROR_DEBUGGER_INACTIVE 1284L -#define ERROR_DELAY_LOAD_FAILED 1285L -#define ERROR_VDM_DISALLOWED 1286L -#define ERROR_UNIDENTIFIED_ERROR 1287L -#define ERROR_NOT_ALL_ASSIGNED 1300L -#define ERROR_SOME_NOT_MAPPED 1301L -#define ERROR_NO_QUOTAS_FOR_ACCOUNT 1302L -#define ERROR_LOCAL_USER_SESSION_KEY 1303L -#define ERROR_NULL_LM_PASSWORD 1304L -#define ERROR_UNKNOWN_REVISION 1305L -#define ERROR_REVISION_MISMATCH 1306L -#define ERROR_INVALID_OWNER 1307L -#define ERROR_INVALID_PRIMARY_GROUP 1308L -#define ERROR_NO_IMPERSONATION_TOKEN 1309L -#define ERROR_CANT_DISABLE_MANDATORY 1310L -#define ERROR_NO_LOGON_SERVERS 1311L -#define ERROR_NO_SUCH_LOGON_SESSION 1312L -#define ERROR_NO_SUCH_PRIVILEGE 1313L -#define ERROR_PRIVILEGE_NOT_HELD 1314L -#define ERROR_INVALID_ACCOUNT_NAME 1315L -#define ERROR_USER_EXISTS 1316L -#define ERROR_NO_SUCH_USER 1317L -#define ERROR_GROUP_EXISTS 1318L -#define ERROR_NO_SUCH_GROUP 1319L -#define ERROR_MEMBER_IN_GROUP 1320L -#define ERROR_MEMBER_NOT_IN_GROUP 1321L -#define ERROR_LAST_ADMIN 1322L -#define ERROR_WRONG_PASSWORD 1323L -#define ERROR_ILL_FORMED_PASSWORD 1324L -#define ERROR_PASSWORD_RESTRICTION 1325L -#define ERROR_LOGON_FAILURE 1326L -#define ERROR_ACCOUNT_RESTRICTION 1327L -#define ERROR_INVALID_LOGON_HOURS 1328L -#define ERROR_INVALID_WORKSTATION 1329L -#define ERROR_PASSWORD_EXPIRED 1330L -#define ERROR_ACCOUNT_DISABLED 1331L -#define ERROR_NONE_MAPPED 1332L -#define ERROR_TOO_MANY_LUIDS_REQUESTED 1333L -#define ERROR_LUIDS_EXHAUSTED 1334L -#define ERROR_INVALID_SUB_AUTHORITY 1335L -#define ERROR_INVALID_ACL 1336L -#define ERROR_INVALID_SID 1337L -#define ERROR_INVALID_SECURITY_DESCR 1338L -#define ERROR_BAD_INHERITANCE_ACL 1340L -#define ERROR_SERVER_DISABLED 1341L -#define ERROR_SERVER_NOT_DISABLED 1342L -#define ERROR_INVALID_ID_AUTHORITY 1343L -#define ERROR_ALLOTTED_SPACE_EXCEEDED 1344L -#define ERROR_INVALID_GROUP_ATTRIBUTES 1345L -#define ERROR_BAD_IMPERSONATION_LEVEL 1346L -#define ERROR_CANT_OPEN_ANONYMOUS 1347L -#define ERROR_BAD_VALIDATION_CLASS 1348L -#define ERROR_BAD_TOKEN_TYPE 1349L -#define ERROR_NO_SECURITY_ON_OBJECT 1350L -#define ERROR_CANT_ACCESS_DOMAIN_INFO 1351L -#define ERROR_INVALID_SERVER_STATE 1352L -#define ERROR_INVALID_DOMAIN_STATE 1353L -#define ERROR_INVALID_DOMAIN_ROLE 1354L -#define ERROR_NO_SUCH_DOMAIN 1355L -#define ERROR_DOMAIN_EXISTS 1356L -#define ERROR_DOMAIN_LIMIT_EXCEEDED 1357L -#define ERROR_INTERNAL_DB_CORRUPTION 1358L -#define ERROR_INTERNAL_ERROR 1359L -#define ERROR_GENERIC_NOT_MAPPED 1360L -#define ERROR_BAD_DESCRIPTOR_FORMAT 1361L -#define ERROR_NOT_LOGON_PROCESS 1362L -#define ERROR_LOGON_SESSION_EXISTS 1363L -#define ERROR_NO_SUCH_PACKAGE 1364L -#define ERROR_BAD_LOGON_SESSION_STATE 1365L -#define ERROR_LOGON_SESSION_COLLISION 1366L -#define ERROR_INVALID_LOGON_TYPE 1367L -#define ERROR_CANNOT_IMPERSONATE 1368L -#define ERROR_RXACT_INVALID_STATE 1369L -#define ERROR_RXACT_COMMIT_FAILURE 1370L -#define ERROR_SPECIAL_ACCOUNT 1371L -#define ERROR_SPECIAL_GROUP 1372L -#define ERROR_SPECIAL_USER 1373L -#define ERROR_MEMBERS_PRIMARY_GROUP 1374L -#define ERROR_TOKEN_ALREADY_IN_USE 1375L -#define ERROR_NO_SUCH_ALIAS 1376L -#define ERROR_MEMBER_NOT_IN_ALIAS 1377L -#define ERROR_MEMBER_IN_ALIAS 1378L -#define ERROR_ALIAS_EXISTS 1379L -#define ERROR_LOGON_NOT_GRANTED 1380L -#define ERROR_TOO_MANY_SECRETS 1381L -#define ERROR_SECRET_TOO_LONG 1382L -#define ERROR_INTERNAL_DB_ERROR 1383L -#define ERROR_TOO_MANY_CONTEXT_IDS 1384L -#define ERROR_LOGON_TYPE_NOT_GRANTED 1385L -#define ERROR_NT_CROSS_ENCRYPTION_REQUIRED 1386L -#define ERROR_NO_SUCH_MEMBER 1387L -#define ERROR_INVALID_MEMBER 1388L -#define ERROR_TOO_MANY_SIDS 1389L -#define ERROR_LM_CROSS_ENCRYPTION_REQUIRED 1390L -#define ERROR_NO_INHERITANCE 1391L -#define ERROR_FILE_CORRUPT 1392L -#define ERROR_DISK_CORRUPT 1393L -#define ERROR_NO_USER_SESSION_KEY 1394L -#define ERROR_LICENSE_QUOTA_EXCEEDED 1395L -#define ERROR_WRONG_TARGET_NAME 1396L -#define ERROR_MUTUAL_AUTH_FAILED 1397L -#define ERROR_TIME_SKEW 1398L -#define ERROR_CURRENT_DOMAIN_NOT_ALLOWED 1399L -#define ERROR_INVALID_WINDOW_HANDLE 1400L -#define ERROR_INVALID_MENU_HANDLE 1401L -#define ERROR_INVALID_CURSOR_HANDLE 1402L -#define ERROR_INVALID_ACCEL_HANDLE 1403L -#define ERROR_INVALID_HOOK_HANDLE 1404L -#define ERROR_INVALID_DWP_HANDLE 1405L -#define ERROR_TLW_WITH_WSCHILD 1406L -#define ERROR_CANNOT_FIND_WND_CLASS 1407L -#define ERROR_WINDOW_OF_OTHER_THREAD 1408L -#define ERROR_HOTKEY_ALREADY_REGISTERED 1409L -#define ERROR_CLASS_ALREADY_EXISTS 1410L -#define ERROR_CLASS_DOES_NOT_EXIST 1411L -#define ERROR_CLASS_HAS_WINDOWS 1412L -#define ERROR_INVALID_INDEX 1413L -#define ERROR_INVALID_ICON_HANDLE 1414L -#define ERROR_PRIVATE_DIALOG_INDEX 1415L -#define ERROR_LISTBOX_ID_NOT_FOUND 1416L -#define ERROR_NO_WILDCARD_CHARACTERS 1417L -#define ERROR_CLIPBOARD_NOT_OPEN 1418L -#define ERROR_HOTKEY_NOT_REGISTERED 1419L -#define ERROR_WINDOW_NOT_DIALOG 1420L -#define ERROR_CONTROL_ID_NOT_FOUND 1421L -#define ERROR_INVALID_COMBOBOX_MESSAGE 1422L -#define ERROR_WINDOW_NOT_COMBOBOX 1423L -#define ERROR_INVALID_EDIT_HEIGHT 1424L -#define ERROR_DC_NOT_FOUND 1425L -#define ERROR_INVALID_HOOK_FILTER 1426L -#define ERROR_INVALID_FILTER_PROC 1427L -#define ERROR_HOOK_NEEDS_HMOD 1428L -#define ERROR_GLOBAL_ONLY_HOOK 1429L -#define ERROR_JOURNAL_HOOK_SET 1430L -#define ERROR_HOOK_NOT_INSTALLED 1431L -#define ERROR_INVALID_LB_MESSAGE 1432L -#define ERROR_SETCOUNT_ON_BAD_LB 1433L -#define ERROR_LB_WITHOUT_TABSTOPS 1434L -#define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD 1435L -#define ERROR_CHILD_WINDOW_MENU 1436L -#define ERROR_NO_SYSTEM_MENU 1437L -#define ERROR_INVALID_MSGBOX_STYLE 1438L -#define ERROR_INVALID_SPI_VALUE 1439L -#define ERROR_SCREEN_ALREADY_LOCKED 1440L -#define ERROR_HWNDS_HAVE_DIFF_PARENT 1441L -#define ERROR_NOT_CHILD_WINDOW 1442L -#define ERROR_INVALID_GW_COMMAND 1443L -#define ERROR_INVALID_THREAD_ID 1444L -#define ERROR_NON_MDICHILD_WINDOW 1445L -#define ERROR_POPUP_ALREADY_ACTIVE 1446L -#define ERROR_NO_SCROLLBARS 1447L -#define ERROR_INVALID_SCROLLBAR_RANGE 1448L -#define ERROR_INVALID_SHOWWIN_COMMAND 1449L -#define ERROR_NO_SYSTEM_RESOURCES 1450L -#define ERROR_NONPAGED_SYSTEM_RESOURCES 1451L -#define ERROR_PAGED_SYSTEM_RESOURCES 1452L -#define ERROR_WORKING_SET_QUOTA 1453L -#define ERROR_PAGEFILE_QUOTA 1454L -#define ERROR_COMMITMENT_LIMIT 1455L -#define ERROR_MENU_ITEM_NOT_FOUND 1456L -#define ERROR_INVALID_KEYBOARD_HANDLE 1457L -#define ERROR_HOOK_TYPE_NOT_ALLOWED 1458L -#define ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION 1459L -#define ERROR_TIMEOUT 1460L -#define ERROR_INVALID_MONITOR_HANDLE 1461L -#define ERROR_INCORRECT_SIZE 1462L -#define ERROR_EVENTLOG_FILE_CORRUPT 1500L -#define ERROR_EVENTLOG_CANT_START 1501L -#define ERROR_LOG_FILE_FULL 1502L -#define ERROR_EVENTLOG_FILE_CHANGED 1503L -#define ERROR_INSTALL_SERVICE_FAILURE 1601L -#define ERROR_INSTALL_USEREXIT 1602L -#define ERROR_INSTALL_FAILURE 1603L -#define ERROR_INSTALL_SUSPEND 1604L -#define ERROR_UNKNOWN_PRODUCT 1605L -#define ERROR_UNKNOWN_FEATURE 1606L -#define ERROR_UNKNOWN_COMPONENT 1607L -#define ERROR_UNKNOWN_PROPERTY 1608L -#define ERROR_INVALID_HANDLE_STATE 1609L -#define ERROR_BAD_CONFIGURATION 1610L -#define ERROR_INDEX_ABSENT 1611L -#define ERROR_INSTALL_SOURCE_ABSENT 1612L -#define ERROR_INSTALL_PACKAGE_VERSION 1613L -#define ERROR_PRODUCT_UNINSTALLED 1614L -#define ERROR_BAD_QUERY_SYNTAX 1615L -#define ERROR_INVALID_FIELD 1616L -#define ERROR_DEVICE_REMOVED 1617L -#define ERROR_INSTALL_ALREADY_RUNNING 1618L -#define ERROR_INSTALL_PACKAGE_OPEN_FAILED 1619L -#define ERROR_INSTALL_PACKAGE_INVALID 1620L -#define ERROR_INSTALL_UI_FAILURE 1621L -#define ERROR_INSTALL_LOG_FAILURE 1622L -#define ERROR_INSTALL_LANGUAGE_UNSUPPORTED 1623L -#define ERROR_INSTALL_TRANSFORM_FAILURE 1624L -#define ERROR_INSTALL_PACKAGE_REJECTED 1625L -#define ERROR_FUNCTION_NOT_CALLED 1626L -#define ERROR_FUNCTION_FAILED 1627L -#define ERROR_INVALID_TABLE 1628L -#define ERROR_DATATYPE_MISMATCH 1629L -#define ERROR_UNSUPPORTED_TYPE 1630L -#define ERROR_CREATE_FAILED 1631L -#define ERROR_INSTALL_TEMP_UNWRITABLE 1632L -#define ERROR_INSTALL_PLATFORM_UNSUPPORTED 1633L -#define ERROR_INSTALL_NOTUSED 1634L -#define ERROR_PATCH_PACKAGE_OPEN_FAILED 1635L -#define ERROR_PATCH_PACKAGE_INVALID 1636L -#define ERROR_PATCH_PACKAGE_UNSUPPORTED 1637L -#define ERROR_PRODUCT_VERSION 1638L -#define ERROR_INVALID_COMMAND_LINE 1639L -#define ERROR_INSTALL_REMOTE_DISALLOWED 1640L -#define ERROR_SUCCESS_REBOOT_INITIATED 1641L -#define ERROR_PATCH_TARGET_NOT_FOUND 1642L -#define ERROR_PATCH_PACKAGE_REJECTED 1643L -#define ERROR_INSTALL_TRANSFORM_REJECTED 1644L -#define ERROR_INSTALL_REMOTE_PROHIBITED 1645L -#define RPC_S_INVALID_STRING_BINDING 1700L -#define RPC_S_WRONG_KIND_OF_BINDING 1701L -#define RPC_S_INVALID_BINDING 1702L -#define RPC_S_PROTSEQ_NOT_SUPPORTED 1703L -#define RPC_S_INVALID_RPC_PROTSEQ 1704L -#define RPC_S_INVALID_STRING_UUID 1705L -#define RPC_S_INVALID_ENDPOINT_FORMAT 1706L -#define RPC_S_INVALID_NET_ADDR 1707L -#define RPC_S_NO_ENDPOINT_FOUND 1708L -#define RPC_S_INVALID_TIMEOUT 1709L -#define RPC_S_OBJECT_NOT_FOUND 1710L -#define RPC_S_ALREADY_REGISTERED 1711L -#define RPC_S_TYPE_ALREADY_REGISTERED 1712L -#define RPC_S_ALREADY_LISTENING 1713L -#define RPC_S_NO_PROTSEQS_REGISTERED 1714L -#define RPC_S_NOT_LISTENING 1715L -#define RPC_S_UNKNOWN_MGR_TYPE 1716L -#define RPC_S_UNKNOWN_IF 1717L -#define RPC_S_NO_BINDINGS 1718L -#define RPC_S_NO_PROTSEQS 1719L -#define RPC_S_CANT_CREATE_ENDPOINT 1720L -#define RPC_S_OUT_OF_RESOURCES 1721L -#define RPC_S_SERVER_UNAVAILABLE 1722L -#define RPC_S_SERVER_TOO_BUSY 1723L -#define RPC_S_INVALID_NETWORK_OPTIONS 1724L -#define RPC_S_NO_CALL_ACTIVE 1725L -#define RPC_S_CALL_FAILED 1726L -#define RPC_S_CALL_FAILED_DNE 1727L -#define RPC_S_PROTOCOL_ERROR 1728L -#define RPC_S_UNSUPPORTED_TRANS_SYN 1730L -#define RPC_S_UNSUPPORTED_TYPE 1732L -#define RPC_S_INVALID_TAG 1733L -#define RPC_S_INVALID_BOUND 1734L -#define RPC_S_NO_ENTRY_NAME 1735L -#define RPC_S_INVALID_NAME_SYNTAX 1736L -#define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737L -#define RPC_S_UUID_NO_ADDRESS 1739L -#define RPC_S_DUPLICATE_ENDPOINT 1740L -#define RPC_S_UNKNOWN_AUTHN_TYPE 1741L -#define RPC_S_MAX_CALLS_TOO_SMALL 1742L -#define RPC_S_STRING_TOO_LONG 1743L -#define RPC_S_PROTSEQ_NOT_FOUND 1744L -#define RPC_S_PROCNUM_OUT_OF_RANGE 1745L -#define RPC_S_BINDING_HAS_NO_AUTH 1746L -#define RPC_S_UNKNOWN_AUTHN_SERVICE 1747L -#define RPC_S_UNKNOWN_AUTHN_LEVEL 1748L -#define RPC_S_INVALID_AUTH_IDENTITY 1749L -#define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750L -#define EPT_S_INVALID_ENTRY 1751L -#define EPT_S_CANT_PERFORM_OP 1752L -#define EPT_S_NOT_REGISTERED 1753L -#define RPC_S_NOTHING_TO_EXPORT 1754L -#define RPC_S_INCOMPLETE_NAME 1755L -#define RPC_S_INVALID_VERS_OPTION 1756L -#define RPC_S_NO_MORE_MEMBERS 1757L -#define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758L -#define RPC_S_INTERFACE_NOT_FOUND 1759L -#define RPC_S_ENTRY_ALREADY_EXISTS 1760L -#define RPC_S_ENTRY_NOT_FOUND 1761L -#define RPC_S_NAME_SERVICE_UNAVAILABLE 1762L -#define RPC_S_INVALID_NAF_ID 1763L -#define RPC_S_CANNOT_SUPPORT 1764L -#define RPC_S_NO_CONTEXT_AVAILABLE 1765L -#define RPC_S_INTERNAL_ERROR 1766L -#define RPC_S_ZERO_DIVIDE 1767L -#define RPC_S_ADDRESS_ERROR 1768L -#define RPC_S_FP_DIV_ZERO 1769L -#define RPC_S_FP_UNDERFLOW 1770L -#define RPC_S_FP_OVERFLOW 1771L -#define RPC_X_NO_MORE_ENTRIES 1772L -#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773L -#define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774L -#define RPC_X_SS_IN_NULL_CONTEXT 1775L -#define RPC_X_SS_CONTEXT_DAMAGED 1777L -#define RPC_X_SS_HANDLES_MISMATCH 1778L -#define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779L -#define RPC_X_NULL_REF_POINTER 1780L -#define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781L -#define RPC_X_BYTE_COUNT_TOO_SMALL 1782L -#define RPC_X_BAD_STUB_DATA 1783L -#define ERROR_INVALID_USER_BUFFER 1784L -#define ERROR_UNRECOGNIZED_MEDIA 1785L -#define ERROR_NO_TRUST_LSA_SECRET 1786L -#define ERROR_NO_TRUST_SAM_ACCOUNT 1787L -#define ERROR_TRUSTED_DOMAIN_FAILURE 1788L -#define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789L -#define ERROR_TRUST_FAILURE 1790L -#define RPC_S_CALL_IN_PROGRESS 1791L -#define ERROR_NETLOGON_NOT_STARTED 1792L -#define ERROR_ACCOUNT_EXPIRED 1793L -#define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794L -#define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795L -#define ERROR_UNKNOWN_PORT 1796L -#define ERROR_UNKNOWN_PRINTER_DRIVER 1797L -#define ERROR_UNKNOWN_PRINTPROCESSOR 1798L -#define ERROR_INVALID_SEPARATOR_FILE 1799L -#define ERROR_INVALID_PRIORITY 1800L -#define ERROR_INVALID_PRINTER_NAME 1801L -#define ERROR_PRINTER_ALREADY_EXISTS 1802L -#define ERROR_INVALID_PRINTER_COMMAND 1803L -#define ERROR_INVALID_DATATYPE 1804L -#define ERROR_INVALID_ENVIRONMENT 1805L -#define RPC_S_NO_MORE_BINDINGS 1806L -#define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807L -#define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808L -#define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809L -#define ERROR_DOMAIN_TRUST_INCONSISTENT 1810L -#define ERROR_SERVER_HAS_OPEN_HANDLES 1811L -#define ERROR_RESOURCE_DATA_NOT_FOUND 1812L -#define ERROR_RESOURCE_TYPE_NOT_FOUND 1813L -#define ERROR_RESOURCE_NAME_NOT_FOUND 1814L -#define ERROR_RESOURCE_LANG_NOT_FOUND 1815L -#define ERROR_NOT_ENOUGH_QUOTA 1816L -#define RPC_S_NO_INTERFACES 1817L -#define RPC_S_CALL_CANCELLED 1818L -#define RPC_S_BINDING_INCOMPLETE 1819L -#define RPC_S_COMM_FAILURE 1820L -#define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821L -#define RPC_S_NO_PRINC_NAME 1822L -#define RPC_S_NOT_RPC_ERROR 1823L -#define RPC_S_UUID_LOCAL_ONLY 1824L -#define RPC_S_SEC_PKG_ERROR 1825L -#define RPC_S_NOT_CANCELLED 1826L -#define RPC_X_INVALID_ES_ACTION 1827L -#define RPC_X_WRONG_ES_VERSION 1828L -#define RPC_X_WRONG_STUB_VERSION 1829L -#define RPC_X_INVALID_PIPE_OBJECT 1830L -#define RPC_X_WRONG_PIPE_ORDER 1831L -#define RPC_X_WRONG_PIPE_VERSION 1832L -#define RPC_S_GROUP_MEMBER_NOT_FOUND 1898L -#define EPT_S_CANT_CREATE 1899L -#define RPC_S_INVALID_OBJECT 1900L -#define ERROR_INVALID_TIME 1901L -#define ERROR_INVALID_FORM_NAME 1902L -#define ERROR_INVALID_FORM_SIZE 1903L -#define ERROR_ALREADY_WAITING 1904L -#define ERROR_PRINTER_DELETED 1905L -#define ERROR_INVALID_PRINTER_STATE 1906L -#define ERROR_PASSWORD_MUST_CHANGE 1907L -#define ERROR_DOMAIN_CONTROLLER_NOT_FOUND 1908L -#define ERROR_ACCOUNT_LOCKED_OUT 1909L -#define OR_INVALID_OXID 1910L -#define OR_INVALID_OID 1911L -#define OR_INVALID_SET 1912L -#define RPC_S_SEND_INCOMPLETE 1913L -#define RPC_S_INVALID_ASYNC_HANDLE 1914L -#define RPC_S_INVALID_ASYNC_CALL 1915L -#define RPC_X_PIPE_CLOSED 1916L -#define RPC_X_PIPE_DISCIPLINE_ERROR 1917L -#define RPC_X_PIPE_EMPTY 1918L -#define ERROR_NO_SITENAME 1919L -#define ERROR_CANT_ACCESS_FILE 1920L -#define ERROR_CANT_RESOLVE_FILENAME 1921L -#define RPC_S_ENTRY_TYPE_MISMATCH 1922L -#define RPC_S_NOT_ALL_OBJS_EXPORTED 1923L -#define RPC_S_INTERFACE_NOT_EXPORTED 1924L -#define RPC_S_PROFILE_NOT_ADDED 1925L -#define RPC_S_PRF_ELT_NOT_ADDED 1926L -#define RPC_S_PRF_ELT_NOT_REMOVED 1927L -#define RPC_S_GRP_ELT_NOT_ADDED 1928L -#define RPC_S_GRP_ELT_NOT_REMOVED 1929L -#define ERROR_KM_DRIVER_BLOCKED 1930L -#define ERROR_CONTEXT_EXPIRED 1931L -#define ERROR_PER_USER_TRUST_QUOTA_EXCEEDED 1932L -#define ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED 1933L -#define ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED 1934L -#define ERROR_AUTHENTICATION_FIREWALL_FAILED 1935L -#define ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED 1936L -#define ERROR_INVALID_PIXEL_FORMAT 2000L -#define ERROR_BAD_DRIVER 2001L -#define ERROR_INVALID_WINDOW_STYLE 2002L -#define ERROR_METAFILE_NOT_SUPPORTED 2003L -#define ERROR_TRANSFORM_NOT_SUPPORTED 2004L -#define ERROR_CLIPPING_NOT_SUPPORTED 2005L -#define ERROR_INVALID_CMM 2010L -#define ERROR_INVALID_PROFILE 2011L -#define ERROR_TAG_NOT_FOUND 2012L -#define ERROR_TAG_NOT_PRESENT 2013L -#define ERROR_DUPLICATE_TAG 2014L -#define ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE 2015L -#define ERROR_PROFILE_NOT_FOUND 2016L -#define ERROR_INVALID_COLORSPACE 2017L -#define ERROR_ICM_NOT_ENABLED 2018L -#define ERROR_DELETING_ICM_XFORM 2019L -#define ERROR_INVALID_TRANSFORM 2020L -#define ERROR_COLORSPACE_MISMATCH 2021L -#define ERROR_INVALID_COLORINDEX 2022L -#define ERROR_CONNECTED_OTHER_PASSWORD 2108L -#define ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT 2109L -#define ERROR_BAD_USERNAME 2202L -#define ERROR_NOT_CONNECTED 2250L -#define ERROR_OPEN_FILES 2401L -#define ERROR_ACTIVE_CONNECTIONS 2402L -#define ERROR_DEVICE_IN_USE 2404L -#define ERROR_UNKNOWN_PRINT_MONITOR 3000L -#define ERROR_PRINTER_DRIVER_IN_USE 3001L -#define ERROR_SPOOL_FILE_NOT_FOUND 3002L -#define ERROR_SPL_NO_STARTDOC 3003L -#define ERROR_SPL_NO_ADDJOB 3004L -#define ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED 3005L -#define ERROR_PRINT_MONITOR_ALREADY_INSTALLED 3006L -#define ERROR_INVALID_PRINT_MONITOR 3007L -#define ERROR_PRINT_MONITOR_IN_USE 3008L -#define ERROR_PRINTER_HAS_JOBS_QUEUED 3009L -#define ERROR_SUCCESS_REBOOT_REQUIRED 3010L -#define ERROR_SUCCESS_RESTART_REQUIRED 3011L -#define ERROR_PRINTER_NOT_FOUND 3012L -#define ERROR_PRINTER_DRIVER_WARNED 3013L -#define ERROR_PRINTER_DRIVER_BLOCKED 3014L -#define ERROR_WINS_INTERNAL 4000L -#define ERROR_CAN_NOT_DEL_LOCAL_WINS 4001L -#define ERROR_STATIC_INIT 4002L -#define ERROR_INC_BACKUP 4003L -#define ERROR_FULL_BACKUP 4004L -#define ERROR_REC_NON_EXISTENT 4005L -#define ERROR_RPL_NOT_ALLOWED 4006L -#define ERROR_DHCP_ADDRESS_CONFLICT 4100L -#define ERROR_WMI_GUID_NOT_FOUND 4200L -#define ERROR_WMI_INSTANCE_NOT_FOUND 4201L -#define ERROR_WMI_ITEMID_NOT_FOUND 4202L -#define ERROR_WMI_TRY_AGAIN 4203L -#define ERROR_WMI_DP_NOT_FOUND 4204L -#define ERROR_WMI_UNRESOLVED_INSTANCE_REF 4205L -#define ERROR_WMI_ALREADY_ENABLED 4206L -#define ERROR_WMI_GUID_DISCONNECTED 4207L -#define ERROR_WMI_SERVER_UNAVAILABLE 4208L -#define ERROR_WMI_DP_FAILED 4209L -#define ERROR_WMI_INVALID_MOF 4210L -#define ERROR_WMI_INVALID_REGINFO 4211L -#define ERROR_WMI_ALREADY_DISABLED 4212L -#define ERROR_WMI_READ_ONLY 4213L -#define ERROR_WMI_SET_FAILURE 4214L -#define ERROR_INVALID_MEDIA 4300L -#define ERROR_INVALID_LIBRARY 4301L -#define ERROR_INVALID_MEDIA_POOL 4302L -#define ERROR_DRIVE_MEDIA_MISMATCH 4303L -#define ERROR_MEDIA_OFFLINE 4304L -#define ERROR_LIBRARY_OFFLINE 4305L -#define ERROR_EMPTY 4306L -#define ERROR_NOT_EMPTY 4307L -#define ERROR_MEDIA_UNAVAILABLE 4308L -#define ERROR_RESOURCE_DISABLED 4309L -#define ERROR_INVALID_CLEANER 4310L -#define ERROR_UNABLE_TO_CLEAN 4311L -#define ERROR_OBJECT_NOT_FOUND 4312L -#define ERROR_DATABASE_FAILURE 4313L -#define ERROR_DATABASE_FULL 4314L -#define ERROR_MEDIA_INCOMPATIBLE 4315L -#define ERROR_RESOURCE_NOT_PRESENT 4316L -#define ERROR_INVALID_OPERATION 4317L -#define ERROR_MEDIA_NOT_AVAILABLE 4318L -#define ERROR_DEVICE_NOT_AVAILABLE 4319L -#define ERROR_REQUEST_REFUSED 4320L -#define ERROR_INVALID_DRIVE_OBJECT 4321L -#define ERROR_LIBRARY_FULL 4322L -#define ERROR_MEDIUM_NOT_ACCESSIBLE 4323L -#define ERROR_UNABLE_TO_LOAD_MEDIUM 4324L -#define ERROR_UNABLE_TO_INVENTORY_DRIVE 4325L -#define ERROR_UNABLE_TO_INVENTORY_SLOT 4326L -#define ERROR_UNABLE_TO_INVENTORY_TRANSPORT 4327L -#define ERROR_TRANSPORT_FULL 4328L -#define ERROR_CONTROLLING_IEPORT 4329L -#define ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA 4330L -#define ERROR_CLEANER_SLOT_SET 4331L -#define ERROR_CLEANER_SLOT_NOT_SET 4332L -#define ERROR_CLEANER_CARTRIDGE_SPENT 4333L -#define ERROR_UNEXPECTED_OMID 4334L -#define ERROR_CANT_DELETE_LAST_ITEM 4335L -#define ERROR_MESSAGE_EXCEEDS_MAX_SIZE 4336L -#define ERROR_VOLUME_CONTAINS_SYS_FILES 4337L -#define ERROR_INDIGENOUS_TYPE 4338L -#define ERROR_NO_SUPPORTING_DRIVES 4339L -#define ERROR_CLEANER_CARTRIDGE_INSTALLED 4340L -#define ERROR_IEPORT_FULL 4341L -#define ERROR_FILE_OFFLINE 4350L -#define ERROR_REMOTE_STORAGE_NOT_ACTIVE 4351L -#define ERROR_REMOTE_STORAGE_MEDIA_ERROR 4352L -#define ERROR_NOT_A_REPARSE_POINT 4390L -#define ERROR_REPARSE_ATTRIBUTE_CONFLICT 4391L -#define ERROR_INVALID_REPARSE_DATA 4392L -#define ERROR_REPARSE_TAG_INVALID 4393L -#define ERROR_REPARSE_TAG_MISMATCH 4394L -#define ERROR_VOLUME_NOT_SIS_ENABLED 4500L -#define ERROR_DEPENDENT_RESOURCE_EXISTS 5001L -#define ERROR_DEPENDENCY_NOT_FOUND 5002L -#define ERROR_DEPENDENCY_ALREADY_EXISTS 5003L -#define ERROR_RESOURCE_NOT_ONLINE 5004L -#define ERROR_HOST_NODE_NOT_AVAILABLE 5005L -#define ERROR_RESOURCE_NOT_AVAILABLE 5006L -#define ERROR_RESOURCE_NOT_FOUND 5007L -#define ERROR_SHUTDOWN_CLUSTER 5008L -#define ERROR_CANT_EVICT_ACTIVE_NODE 5009L -#define ERROR_OBJECT_ALREADY_EXISTS 5010L -#define ERROR_OBJECT_IN_LIST 5011L -#define ERROR_GROUP_NOT_AVAILABLE 5012L -#define ERROR_GROUP_NOT_FOUND 5013L -#define ERROR_GROUP_NOT_ONLINE 5014L -#define ERROR_HOST_NODE_NOT_RESOURCE_OWNER 5015L -#define ERROR_HOST_NODE_NOT_GROUP_OWNER 5016L -#define ERROR_RESMON_CREATE_FAILED 5017L -#define ERROR_RESMON_ONLINE_FAILED 5018L -#define ERROR_RESOURCE_ONLINE 5019L -#define ERROR_QUORUM_RESOURCE 5020L -#define ERROR_NOT_QUORUM_CAPABLE 5021L -#define ERROR_CLUSTER_SHUTTING_DOWN 5022L -#define ERROR_INVALID_STATE 5023L -#define ERROR_RESOURCE_PROPERTIES_STORED 5024L -#define ERROR_NOT_QUORUM_CLASS 5025L -#define ERROR_CORE_RESOURCE 5026L -#define ERROR_QUORUM_RESOURCE_ONLINE_FAILED 5027L -#define ERROR_QUORUMLOG_OPEN_FAILED 5028L -#define ERROR_CLUSTERLOG_CORRUPT 5029L -#define ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE 5030L -#define ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE 5031L -#define ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND 5032L -#define ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE 5033L -#define ERROR_QUORUM_OWNER_ALIVE 5034L -#define ERROR_NETWORK_NOT_AVAILABLE 5035L -#define ERROR_NODE_NOT_AVAILABLE 5036L -#define ERROR_ALL_NODES_NOT_AVAILABLE 5037L -#define ERROR_RESOURCE_FAILED 5038L -#define ERROR_CLUSTER_INVALID_NODE 5039L -#define ERROR_CLUSTER_NODE_EXISTS 5040L -#define ERROR_CLUSTER_JOIN_IN_PROGRESS 5041L -#define ERROR_CLUSTER_NODE_NOT_FOUND 5042L -#define ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND 5043L -#define ERROR_CLUSTER_NETWORK_EXISTS 5044L -#define ERROR_CLUSTER_NETWORK_NOT_FOUND 5045L -#define ERROR_CLUSTER_NETINTERFACE_EXISTS 5046L -#define ERROR_CLUSTER_NETINTERFACE_NOT_FOUND 5047L -#define ERROR_CLUSTER_INVALID_REQUEST 5048L -#define ERROR_CLUSTER_INVALID_NETWORK_PROVIDER 5049L -#define ERROR_CLUSTER_NODE_DOWN 5050L -#define ERROR_CLUSTER_NODE_UNREACHABLE 5051L -#define ERROR_CLUSTER_NODE_NOT_MEMBER 5052L -#define ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS 5053L -#define ERROR_CLUSTER_INVALID_NETWORK 5054L -#define ERROR_CLUSTER_NODE_UP 5056L -#define ERROR_CLUSTER_IPADDR_IN_USE 5057L -#define ERROR_CLUSTER_NODE_NOT_PAUSED 5058L -#define ERROR_CLUSTER_NO_SECURITY_CONTEXT 5059L -#define ERROR_CLUSTER_NETWORK_NOT_INTERNAL 5060L -#define ERROR_CLUSTER_NODE_ALREADY_UP 5061L -#define ERROR_CLUSTER_NODE_ALREADY_DOWN 5062L -#define ERROR_CLUSTER_NETWORK_ALREADY_ONLINE 5063L -#define ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE 5064L -#define ERROR_CLUSTER_NODE_ALREADY_MEMBER 5065L -#define ERROR_CLUSTER_LAST_INTERNAL_NETWORK 5066L -#define ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS 5067L -#define ERROR_INVALID_OPERATION_ON_QUORUM 5068L -#define ERROR_DEPENDENCY_NOT_ALLOWED 5069L -#define ERROR_CLUSTER_NODE_PAUSED 5070L -#define ERROR_NODE_CANT_HOST_RESOURCE 5071L -#define ERROR_CLUSTER_NODE_NOT_READY 5072L -#define ERROR_CLUSTER_NODE_SHUTTING_DOWN 5073L -#define ERROR_CLUSTER_JOIN_ABORTED 5074L -#define ERROR_CLUSTER_INCOMPATIBLE_VERSIONS 5075L -#define ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED 5076L -#define ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED 5077L -#define ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND 5078L -#define ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED 5079L -#define ERROR_CLUSTER_RESNAME_NOT_FOUND 5080L -#define ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED 5081L -#define ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST 5082L -#define ERROR_CLUSTER_DATABASE_SEQMISMATCH 5083L -#define ERROR_RESMON_INVALID_STATE 5084L -#define ERROR_CLUSTER_GUM_NOT_LOCKER 5085L -#define ERROR_QUORUM_DISK_NOT_FOUND 5086L -#define ERROR_DATABASE_BACKUP_CORRUPT 5087L -#define ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT 5088L -#define ERROR_RESOURCE_PROPERTY_UNCHANGEABLE 5089L -#define ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE 5890L -#define ERROR_CLUSTER_QUORUMLOG_NOT_FOUND 5891L -#define ERROR_CLUSTER_MEMBERSHIP_HALT 5892L -#define ERROR_CLUSTER_INSTANCE_ID_MISMATCH 5893L -#define ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP 5894L -#define ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH 5895L -#define ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP 5896L -#define ERROR_CLUSTER_PARAMETER_MISMATCH 5897L -#define ERROR_NODE_CANNOT_BE_CLUSTERED 5898L -#define ERROR_CLUSTER_WRONG_OS_VERSION 5899L -#define ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME 5900L -#define ERROR_CLUSCFG_ALREADY_COMMITTED 5901L -#define ERROR_CLUSCFG_ROLLBACK_FAILED 5902L -#define ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT 5903L -#define ERROR_CLUSTER_OLD_VERSION 5904L -#define ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME 5905L -#define ERROR_ENCRYPTION_FAILED 6000L -#define ERROR_DECRYPTION_FAILED 6001L -#define ERROR_FILE_ENCRYPTED 6002L -#define ERROR_NO_RECOVERY_POLICY 6003L -#define ERROR_NO_EFS 6004L -#define ERROR_WRONG_EFS 6005L -#define ERROR_NO_USER_KEYS 6006L -#define ERROR_FILE_NOT_ENCRYPTED 6007L -#define ERROR_NOT_EXPORT_FORMAT 6008L -#define ERROR_FILE_READ_ONLY 6009L -#define ERROR_DIR_EFS_DISALLOWED 6010L -#define ERROR_EFS_SERVER_NOT_TRUSTED 6011L -#define ERROR_BAD_RECOVERY_POLICY 6012L -#define ERROR_EFS_ALG_BLOB_TOO_BIG 6013L -#define ERROR_VOLUME_NOT_SUPPORT_EFS 6014L -#define ERROR_EFS_DISABLED 6015L -#define ERROR_EFS_VERSION_NOT_SUPPORT 6016L -#define ERROR_NO_BROWSER_SERVERS_FOUND 6118L -#define SCHED_E_SERVICE_NOT_LOCALSYSTEM 6200L -#define ERROR_CTX_WINSTATION_NAME_INVALID 7001L -#define ERROR_CTX_INVALID_PD 7002L -#define ERROR_CTX_PD_NOT_FOUND 7003L -#define ERROR_CTX_WD_NOT_FOUND 7004L -#define ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY 7005L -#define ERROR_CTX_SERVICE_NAME_COLLISION 7006L -#define ERROR_CTX_CLOSE_PENDING 7007L -#define ERROR_CTX_NO_OUTBUF 7008L -#define ERROR_CTX_MODEM_INF_NOT_FOUND 7009L -#define ERROR_CTX_INVALID_MODEMNAME 7010L -#define ERROR_CTX_MODEM_RESPONSE_ERROR 7011L -#define ERROR_CTX_MODEM_RESPONSE_TIMEOUT 7012L -#define ERROR_CTX_MODEM_RESPONSE_NO_CARRIER 7013L -#define ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE 7014L -#define ERROR_CTX_MODEM_RESPONSE_BUSY 7015L -#define ERROR_CTX_MODEM_RESPONSE_VOICE 7016L -#define ERROR_CTX_TD_ERROR 7017L -#define ERROR_CTX_WINSTATION_NOT_FOUND 7022L -#define ERROR_CTX_WINSTATION_ALREADY_EXISTS 7023L -#define ERROR_CTX_WINSTATION_BUSY 7024L -#define ERROR_CTX_BAD_VIDEO_MODE 7025L -#define ERROR_CTX_GRAPHICS_INVALID 7035L -#define ERROR_CTX_LOGON_DISABLED 7037L -#define ERROR_CTX_NOT_CONSOLE 7038L -#define ERROR_CTX_CLIENT_QUERY_TIMEOUT 7040L -#define ERROR_CTX_CONSOLE_DISCONNECT 7041L -#define ERROR_CTX_CONSOLE_CONNECT 7042L -#define ERROR_CTX_SHADOW_DENIED 7044L -#define ERROR_CTX_WINSTATION_ACCESS_DENIED 7045L -#define ERROR_CTX_INVALID_WD 7049L -#define ERROR_CTX_SHADOW_INVALID 7050L -#define ERROR_CTX_SHADOW_DISABLED 7051L -#define ERROR_CTX_CLIENT_LICENSE_IN_USE 7052L -#define ERROR_CTX_CLIENT_LICENSE_NOT_SET 7053L -#define ERROR_CTX_LICENSE_NOT_AVAILABLE 7054L -#define ERROR_CTX_LICENSE_CLIENT_INVALID 7055L -#define ERROR_CTX_LICENSE_EXPIRED 7056L -#define ERROR_CTX_SHADOW_NOT_RUNNING 7057L -#define ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE 7058L -#define ERROR_ACTIVATION_COUNT_EXCEEDED 7059L -#define FRS_ERR_INVALID_API_SEQUENCE 8001L -#define FRS_ERR_STARTING_SERVICE 8002L -#define FRS_ERR_STOPPING_SERVICE 8003L -#define FRS_ERR_INTERNAL_API 8004L -#define FRS_ERR_INTERNAL 8005L -#define FRS_ERR_SERVICE_COMM 8006L -#define FRS_ERR_INSUFFICIENT_PRIV 8007L -#define FRS_ERR_AUTHENTICATION 8008L -#define FRS_ERR_PARENT_INSUFFICIENT_PRIV 8009L -#define FRS_ERR_PARENT_AUTHENTICATION 8010L -#define FRS_ERR_CHILD_TO_PARENT_COMM 8011L -#define FRS_ERR_PARENT_TO_CHILD_COMM 8012L -#define FRS_ERR_SYSVOL_POPULATE 8013L -#define FRS_ERR_SYSVOL_POPULATE_TIMEOUT 8014L -#define FRS_ERR_SYSVOL_IS_BUSY 8015L -#define FRS_ERR_SYSVOL_DEMOTE 8016L -#define FRS_ERR_INVALID_SERVICE_PARAMETER 8017L -#define DS_S_SUCCESS NO_ERROR -#define ERROR_DS_NOT_INSTALLED 8200L -#define ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY 8201L -#define ERROR_DS_NO_ATTRIBUTE_OR_VALUE 8202L -#define ERROR_DS_INVALID_ATTRIBUTE_SYNTAX 8203L -#define ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED 8204L -#define ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS 8205L -#define ERROR_DS_BUSY 8206L -#define ERROR_DS_UNAVAILABLE 8207L -#define ERROR_DS_NO_RIDS_ALLOCATED 8208L -#define ERROR_DS_NO_MORE_RIDS 8209L -#define ERROR_DS_INCORRECT_ROLE_OWNER 8210L -#define ERROR_DS_RIDMGR_INIT_ERROR 8211L -#define ERROR_DS_OBJ_CLASS_VIOLATION 8212L -#define ERROR_DS_CANT_ON_NON_LEAF 8213L -#define ERROR_DS_CANT_ON_RDN 8214L -#define ERROR_DS_CANT_MOD_OBJ_CLASS 8215L -#define ERROR_DS_CROSS_DOM_MOVE_ERROR 8216L -#define ERROR_DS_GC_NOT_AVAILABLE 8217L -#define ERROR_SHARED_POLICY 8218L -#define ERROR_POLICY_OBJECT_NOT_FOUND 8219L -#define ERROR_POLICY_ONLY_IN_DS 8220L -#define ERROR_PROMOTION_ACTIVE 8221L -#define ERROR_NO_PROMOTION_ACTIVE 8222L -#define ERROR_DS_OPERATIONS_ERROR 8224L -#define ERROR_DS_PROTOCOL_ERROR 8225L -#define ERROR_DS_TIMELIMIT_EXCEEDED 8226L -#define ERROR_DS_SIZELIMIT_EXCEEDED 8227L -#define ERROR_DS_ADMIN_LIMIT_EXCEEDED 8228L -#define ERROR_DS_COMPARE_FALSE 8229L -#define ERROR_DS_COMPARE_TRUE 8230L -#define ERROR_DS_AUTH_METHOD_NOT_SUPPORTED 8231L -#define ERROR_DS_STRONG_AUTH_REQUIRED 8232L -#define ERROR_DS_INAPPROPRIATE_AUTH 8233L -#define ERROR_DS_AUTH_UNKNOWN 8234L -#define ERROR_DS_REFERRAL 8235L -#define ERROR_DS_UNAVAILABLE_CRIT_EXTENSION 8236L -#define ERROR_DS_CONFIDENTIALITY_REQUIRED 8237L -#define ERROR_DS_INAPPROPRIATE_MATCHING 8238L -#define ERROR_DS_CONSTRAINT_VIOLATION 8239L -#define ERROR_DS_NO_SUCH_OBJECT 8240L -#define ERROR_DS_ALIAS_PROBLEM 8241L -#define ERROR_DS_INVALID_DN_SYNTAX 8242L -#define ERROR_DS_IS_LEAF 8243L -#define ERROR_DS_ALIAS_DEREF_PROBLEM 8244L -#define ERROR_DS_UNWILLING_TO_PERFORM 8245L -#define ERROR_DS_LOOP_DETECT 8246L -#define ERROR_DS_NAMING_VIOLATION 8247L -#define ERROR_DS_OBJECT_RESULTS_TOO_LARGE 8248L -#define ERROR_DS_AFFECTS_MULTIPLE_DSAS 8249L -#define ERROR_DS_SERVER_DOWN 8250L -#define ERROR_DS_LOCAL_ERROR 8251L -#define ERROR_DS_ENCODING_ERROR 8252L -#define ERROR_DS_DECODING_ERROR 8253L -#define ERROR_DS_FILTER_UNKNOWN 8254L -#define ERROR_DS_PARAM_ERROR 8255L -#define ERROR_DS_NOT_SUPPORTED 8256L -#define ERROR_DS_NO_RESULTS_RETURNED 8257L -#define ERROR_DS_CONTROL_NOT_FOUND 8258L -#define ERROR_DS_CLIENT_LOOP 8259L -#define ERROR_DS_REFERRAL_LIMIT_EXCEEDED 8260L -#define ERROR_DS_SORT_CONTROL_MISSING 8261L -#define ERROR_DS_OFFSET_RANGE_ERROR 8262L -#define ERROR_DS_ROOT_MUST_BE_NC 8301L -#define ERROR_DS_ADD_REPLICA_INHIBITED 8302L -#define ERROR_DS_ATT_NOT_DEF_IN_SCHEMA 8303L -#define ERROR_DS_MAX_OBJ_SIZE_EXCEEDED 8304L -#define ERROR_DS_OBJ_STRING_NAME_EXISTS 8305L -#define ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA 8306L -#define ERROR_DS_RDN_DOESNT_MATCH_SCHEMA 8307L -#define ERROR_DS_NO_REQUESTED_ATTS_FOUND 8308L -#define ERROR_DS_USER_BUFFER_TO_SMALL 8309L -#define ERROR_DS_ATT_IS_NOT_ON_OBJ 8310L -#define ERROR_DS_ILLEGAL_MOD_OPERATION 8311L -#define ERROR_DS_OBJ_TOO_LARGE 8312L -#define ERROR_DS_BAD_INSTANCE_TYPE 8313L -#define ERROR_DS_MASTERDSA_REQUIRED 8314L -#define ERROR_DS_OBJECT_CLASS_REQUIRED 8315L -#define ERROR_DS_MISSING_REQUIRED_ATT 8316L -#define ERROR_DS_ATT_NOT_DEF_FOR_CLASS 8317L -#define ERROR_DS_ATT_ALREADY_EXISTS 8318L -#define ERROR_DS_CANT_ADD_ATT_VALUES 8320L -#define ERROR_DS_SINGLE_VALUE_CONSTRAINT 8321L -#define ERROR_DS_RANGE_CONSTRAINT 8322L -#define ERROR_DS_ATT_VAL_ALREADY_EXISTS 8323L -#define ERROR_DS_CANT_REM_MISSING_ATT 8324L -#define ERROR_DS_CANT_REM_MISSING_ATT_VAL 8325L -#define ERROR_DS_ROOT_CANT_BE_SUBREF 8326L -#define ERROR_DS_NO_CHAINING 8327L -#define ERROR_DS_NO_CHAINED_EVAL 8328L -#define ERROR_DS_NO_PARENT_OBJECT 8329L -#define ERROR_DS_PARENT_IS_AN_ALIAS 8330L -#define ERROR_DS_CANT_MIX_MASTER_AND_REPS 8331L -#define ERROR_DS_CHILDREN_EXIST 8332L -#define ERROR_DS_OBJ_NOT_FOUND 8333L -#define ERROR_DS_ALIASED_OBJ_MISSING 8334L -#define ERROR_DS_BAD_NAME_SYNTAX 8335L -#define ERROR_DS_ALIAS_POINTS_TO_ALIAS 8336L -#define ERROR_DS_CANT_DEREF_ALIAS 8337L -#define ERROR_DS_OUT_OF_SCOPE 8338L -#define ERROR_DS_OBJECT_BEING_REMOVED 8339L -#define ERROR_DS_CANT_DELETE_DSA_OBJ 8340L -#define ERROR_DS_GENERIC_ERROR 8341L -#define ERROR_DS_DSA_MUST_BE_INT_MASTER 8342L -#define ERROR_DS_CLASS_NOT_DSA 8343L -#define ERROR_DS_INSUFF_ACCESS_RIGHTS 8344L -#define ERROR_DS_ILLEGAL_SUPERIOR 8345L -#define ERROR_DS_ATTRIBUTE_OWNED_BY_SAM 8346L -#define ERROR_DS_NAME_TOO_MANY_PARTS 8347L -#define ERROR_DS_NAME_TOO_LONG 8348L -#define ERROR_DS_NAME_VALUE_TOO_LONG 8349L -#define ERROR_DS_NAME_UNPARSEABLE 8350L -#define ERROR_DS_NAME_TYPE_UNKNOWN 8351L -#define ERROR_DS_NOT_AN_OBJECT 8352L -#define ERROR_DS_SEC_DESC_TOO_SHORT 8353L -#define ERROR_DS_SEC_DESC_INVALID 8354L -#define ERROR_DS_NO_DELETED_NAME 8355L -#define ERROR_DS_SUBREF_MUST_HAVE_PARENT 8356L -#define ERROR_DS_NCNAME_MUST_BE_NC 8357L -#define ERROR_DS_CANT_ADD_SYSTEM_ONLY 8358L -#define ERROR_DS_CLASS_MUST_BE_CONCRETE 8359L -#define ERROR_DS_INVALID_DMD 8360L -#define ERROR_DS_OBJ_GUID_EXISTS 8361L -#define ERROR_DS_NOT_ON_BACKLINK 8362L -#define ERROR_DS_NO_CROSSREF_FOR_NC 8363L -#define ERROR_DS_SHUTTING_DOWN 8364L -#define ERROR_DS_UNKNOWN_OPERATION 8365L -#define ERROR_DS_INVALID_ROLE_OWNER 8366L -#define ERROR_DS_COULDNT_CONTACT_FSMO 8367L -#define ERROR_DS_CROSS_NC_DN_RENAME 8368L -#define ERROR_DS_CANT_MOD_SYSTEM_ONLY 8369L -#define ERROR_DS_REPLICATOR_ONLY 8370L -#define ERROR_DS_OBJ_CLASS_NOT_DEFINED 8371L -#define ERROR_DS_OBJ_CLASS_NOT_SUBCLASS 8372L -#define ERROR_DS_NAME_REFERENCE_INVALID 8373L -#define ERROR_DS_CROSS_REF_EXISTS 8374L -#define ERROR_DS_CANT_DEL_MASTER_CROSSREF 8375L -#define ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD 8376L -#define ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX 8377L -#define ERROR_DS_DUP_RDN 8378L -#define ERROR_DS_DUP_OID 8379L -#define ERROR_DS_DUP_MAPI_ID 8380L -#define ERROR_DS_DUP_SCHEMA_ID_GUID 8381L -#define ERROR_DS_DUP_LDAP_DISPLAY_NAME 8382L -#define ERROR_DS_SEMANTIC_ATT_TEST 8383L -#define ERROR_DS_SYNTAX_MISMATCH 8384L -#define ERROR_DS_EXISTS_IN_MUST_HAVE 8385L -#define ERROR_DS_EXISTS_IN_MAY_HAVE 8386L -#define ERROR_DS_NONEXISTENT_MAY_HAVE 8387L -#define ERROR_DS_NONEXISTENT_MUST_HAVE 8388L -#define ERROR_DS_AUX_CLS_TEST_FAIL 8389L -#define ERROR_DS_NONEXISTENT_POSS_SUP 8390L -#define ERROR_DS_SUB_CLS_TEST_FAIL 8391L -#define ERROR_DS_BAD_RDN_ATT_ID_SYNTAX 8392L -#define ERROR_DS_EXISTS_IN_AUX_CLS 8393L -#define ERROR_DS_EXISTS_IN_SUB_CLS 8394L -#define ERROR_DS_EXISTS_IN_POSS_SUP 8395L -#define ERROR_DS_RECALCSCHEMA_FAILED 8396L -#define ERROR_DS_TREE_DELETE_NOT_FINISHED 8397L -#define ERROR_DS_CANT_DELETE 8398L -#define ERROR_DS_ATT_SCHEMA_REQ_ID 8399L -#define ERROR_DS_BAD_ATT_SCHEMA_SYNTAX 8400L -#define ERROR_DS_CANT_CACHE_ATT 8401L -#define ERROR_DS_CANT_CACHE_CLASS 8402L -#define ERROR_DS_CANT_REMOVE_ATT_CACHE 8403L -#define ERROR_DS_CANT_REMOVE_CLASS_CACHE 8404L -#define ERROR_DS_CANT_RETRIEVE_DN 8405L -#define ERROR_DS_MISSING_SUPREF 8406L -#define ERROR_DS_CANT_RETRIEVE_INSTANCE 8407L -#define ERROR_DS_CODE_INCONSISTENCY 8408L -#define ERROR_DS_DATABASE_ERROR 8409L -#define ERROR_DS_GOVERNSID_MISSING 8410L -#define ERROR_DS_MISSING_EXPECTED_ATT 8411L -#define ERROR_DS_NCNAME_MISSING_CR_REF 8412L -#define ERROR_DS_SECURITY_CHECKING_ERROR 8413L -#define ERROR_DS_SCHEMA_NOT_LOADED 8414L -#define ERROR_DS_SCHEMA_ALLOC_FAILED 8415L -#define ERROR_DS_ATT_SCHEMA_REQ_SYNTAX 8416L -#define ERROR_DS_GCVERIFY_ERROR 8417L -#define ERROR_DS_DRA_SCHEMA_MISMATCH 8418L -#define ERROR_DS_CANT_FIND_DSA_OBJ 8419L -#define ERROR_DS_CANT_FIND_EXPECTED_NC 8420L -#define ERROR_DS_CANT_FIND_NC_IN_CACHE 8421L -#define ERROR_DS_CANT_RETRIEVE_CHILD 8422L -#define ERROR_DS_SECURITY_ILLEGAL_MODIFY 8423L -#define ERROR_DS_CANT_REPLACE_HIDDEN_REC 8424L -#define ERROR_DS_BAD_HIERARCHY_FILE 8425L -#define ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED 8426L -#define ERROR_DS_CONFIG_PARAM_MISSING 8427L -#define ERROR_DS_COUNTING_AB_INDICES_FAILED 8428L -#define ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED 8429L -#define ERROR_DS_INTERNAL_FAILURE 8430L -#define ERROR_DS_UNKNOWN_ERROR 8431L -#define ERROR_DS_ROOT_REQUIRES_CLASS_TOP 8432L -#define ERROR_DS_REFUSING_FSMO_ROLES 8433L -#define ERROR_DS_MISSING_FSMO_SETTINGS 8434L -#define ERROR_DS_UNABLE_TO_SURRENDER_ROLES 8435L -#define ERROR_DS_DRA_GENERIC 8436L -#define ERROR_DS_DRA_INVALID_PARAMETER 8437L -#define ERROR_DS_DRA_BUSY 8438L -#define ERROR_DS_DRA_BAD_DN 8439L -#define ERROR_DS_DRA_BAD_NC 8440L -#define ERROR_DS_DRA_DN_EXISTS 8441L -#define ERROR_DS_DRA_INTERNAL_ERROR 8442L -#define ERROR_DS_DRA_INCONSISTENT_DIT 8443L -#define ERROR_DS_DRA_CONNECTION_FAILED 8444L -#define ERROR_DS_DRA_BAD_INSTANCE_TYPE 8445L -#define ERROR_DS_DRA_OUT_OF_MEM 8446L -#define ERROR_DS_DRA_MAIL_PROBLEM 8447L -#define ERROR_DS_DRA_REF_ALREADY_EXISTS 8448L -#define ERROR_DS_DRA_REF_NOT_FOUND 8449L -#define ERROR_DS_DRA_OBJ_IS_REP_SOURCE 8450L -#define ERROR_DS_DRA_DB_ERROR 8451L -#define ERROR_DS_DRA_NO_REPLICA 8452L -#define ERROR_DS_DRA_ACCESS_DENIED 8453L -#define ERROR_DS_DRA_NOT_SUPPORTED 8454L -#define ERROR_DS_DRA_RPC_CANCELLED 8455L -#define ERROR_DS_DRA_SOURCE_DISABLED 8456L -#define ERROR_DS_DRA_SINK_DISABLED 8457L -#define ERROR_DS_DRA_NAME_COLLISION 8458L -#define ERROR_DS_DRA_SOURCE_REINSTALLED 8459L -#define ERROR_DS_DRA_MISSING_PARENT 8460L -#define ERROR_DS_DRA_PREEMPTED 8461L -#define ERROR_DS_DRA_ABANDON_SYNC 8462L -#define ERROR_DS_DRA_SHUTDOWN 8463L -#define ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET 8464L -#define ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA 8465L -#define ERROR_DS_DRA_EXTN_CONNECTION_FAILED 8466L -#define ERROR_DS_INSTALL_SCHEMA_MISMATCH 8467L -#define ERROR_DS_DUP_LINK_ID 8468L -#define ERROR_DS_NAME_ERROR_RESOLVING 8469L -#define ERROR_DS_NAME_ERROR_NOT_FOUND 8470L -#define ERROR_DS_NAME_ERROR_NOT_UNIQUE 8471L -#define ERROR_DS_NAME_ERROR_NO_MAPPING 8472L -#define ERROR_DS_NAME_ERROR_DOMAIN_ONLY 8473L -#define ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING 8474L -#define ERROR_DS_CONSTRUCTED_ATT_MOD 8475L -#define ERROR_DS_WRONG_OM_OBJ_CLASS 8476L -#define ERROR_DS_DRA_REPL_PENDING 8477L -#define ERROR_DS_DS_REQUIRED 8478L -#define ERROR_DS_INVALID_LDAP_DISPLAY_NAME 8479L -#define ERROR_DS_NON_BASE_SEARCH 8480L -#define ERROR_DS_CANT_RETRIEVE_ATTS 8481L -#define ERROR_DS_BACKLINK_WITHOUT_LINK 8482L -#define ERROR_DS_EPOCH_MISMATCH 8483L -#define ERROR_DS_SRC_NAME_MISMATCH 8484L -#define ERROR_DS_SRC_AND_DST_NC_IDENTICAL 8485L -#define ERROR_DS_DST_NC_MISMATCH 8486L -#define ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC 8487L -#define ERROR_DS_SRC_GUID_MISMATCH 8488L -#define ERROR_DS_CANT_MOVE_DELETED_OBJECT 8489L -#define ERROR_DS_PDC_OPERATION_IN_PROGRESS 8490L -#define ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD 8491L -#define ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION 8492L -#define ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS 8493L -#define ERROR_DS_NC_MUST_HAVE_NC_PARENT 8494L -#define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE 8495L -#define ERROR_DS_DST_DOMAIN_NOT_NATIVE 8496L -#define ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER 8497L -#define ERROR_DS_CANT_MOVE_ACCOUNT_GROUP 8498L -#define ERROR_DS_CANT_MOVE_RESOURCE_GROUP 8499L -#define ERROR_DS_INVALID_SEARCH_FLAG 8500L -#define ERROR_DS_NO_TREE_DELETE_ABOVE_NC 8501L -#define ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE 8502L -#define ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE 8503L -#define ERROR_DS_SAM_INIT_FAILURE 8504L -#define ERROR_DS_SENSITIVE_GROUP_VIOLATION 8505L -#define ERROR_DS_CANT_MOD_PRIMARYGROUPID 8506L -#define ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD 8507L -#define ERROR_DS_NONSAFE_SCHEMA_CHANGE 8508L -#define ERROR_DS_SCHEMA_UPDATE_DISALLOWED 8509L -#define ERROR_DS_CANT_CREATE_UNDER_SCHEMA 8510L -#define ERROR_DS_INSTALL_NO_SRC_SCH_VERSION 8511L -#define ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE 8512L -#define ERROR_DS_INVALID_GROUP_TYPE 8513L -#define ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN 8514L -#define ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN 8515L -#define ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER 8516L -#define ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER 8517L -#define ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER 8518L -#define ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER 8519L -#define ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER 8520L -#define ERROR_DS_HAVE_PRIMARY_MEMBERS 8521L -#define ERROR_DS_STRING_SD_CONVERSION_FAILED 8522L -#define ERROR_DS_NAMING_MASTER_GC 8523L -#define ERROR_DS_DNS_LOOKUP_FAILURE 8524L -#define ERROR_DS_COULDNT_UPDATE_SPNS 8525L -#define ERROR_DS_CANT_RETRIEVE_SD 8526L -#define ERROR_DS_KEY_NOT_UNIQUE 8527L -#define ERROR_DS_WRONG_LINKED_ATT_SYNTAX 8528L -#define ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD 8529L -#define ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY 8530L -#define ERROR_DS_CANT_START 8531L -#define ERROR_DS_INIT_FAILURE 8532L -#define ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION 8533L -#define ERROR_DS_SOURCE_DOMAIN_IN_FOREST 8534L -#define ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST 8535L -#define ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED 8536L -#define ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN 8537L -#define ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER 8538L -#define ERROR_DS_SRC_SID_EXISTS_IN_FOREST 8539L -#define ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH 8540L -#define ERROR_SAM_INIT_FAILURE 8541L -#define ERROR_DS_DRA_SCHEMA_INFO_SHIP 8542L -#define ERROR_DS_DRA_SCHEMA_CONFLICT 8543L -#define ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT 8544L -#define ERROR_DS_DRA_OBJ_NC_MISMATCH 8545L -#define ERROR_DS_NC_STILL_HAS_DSAS 8546L -#define ERROR_DS_GC_REQUIRED 8547L -#define ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY 8548L -#define ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS 8549L -#define ERROR_DS_CANT_ADD_TO_GC 8550L -#define ERROR_DS_NO_CHECKPOINT_WITH_PDC 8551L -#define ERROR_DS_SOURCE_AUDITING_NOT_ENABLED 8552L -#define ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC 8553L -#define ERROR_DS_INVALID_NAME_FOR_SPN 8554L -#define ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS 8555L -#define ERROR_DS_UNICODEPWD_NOT_IN_QUOTES 8556L -#define ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED 8557L -#define ERROR_DS_MUST_BE_RUN_ON_DST_DC 8558L -#define ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER 8559L -#define ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ 8560L -#define ERROR_DS_INIT_FAILURE_CONSOLE 8561L -#define ERROR_DS_SAM_INIT_FAILURE_CONSOLE 8562L -#define ERROR_DS_FOREST_VERSION_TOO_HIGH 8563L -#define ERROR_DS_DOMAIN_VERSION_TOO_HIGH 8564L -#define ERROR_DS_FOREST_VERSION_TOO_LOW 8565L -#define ERROR_DS_DOMAIN_VERSION_TOO_LOW 8566L -#define ERROR_DS_INCOMPATIBLE_VERSION 8567L -#define ERROR_DS_LOW_DSA_VERSION 8568L -#define ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN 8569L -#define ERROR_DS_NOT_SUPPORTED_SORT_ORDER 8570L -#define ERROR_DS_NAME_NOT_UNIQUE 8571L -#define ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 8572L -#define ERROR_DS_OUT_OF_VERSION_STORE 8573L -#define ERROR_DS_INCOMPATIBLE_CONTROLS_USED 8574L -#define ERROR_DS_NO_REF_DOMAIN 8575L -#define ERROR_DS_RESERVED_LINK_ID 8576L -#define ERROR_DS_LINK_ID_NOT_AVAILABLE 8577L -#define ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER 8578L -#define ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE 8579L -#define ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC 8580L -#define ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG 8581L -#define ERROR_DS_MODIFYDN_WRONG_GRANDPARENT 8582L -#define ERROR_DS_NAME_ERROR_TRUST_REFERRAL 8583L -#define ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER 8584L -#define ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD 8585L -#define ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 8586L -#define ERROR_DS_THREAD_LIMIT_EXCEEDED 8587L -#define ERROR_DS_NOT_CLOSEST 8588L -#define ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF 8589L -#define ERROR_DS_SINGLE_USER_MODE_FAILED 8590L -#define ERROR_DS_NTDSCRIPT_SYNTAX_ERROR 8591L -#define ERROR_DS_NTDSCRIPT_PROCESS_ERROR 8592L -#define ERROR_DS_DIFFERENT_REPL_EPOCHS 8593L -#define ERROR_DS_DRS_EXTENSIONS_CHANGED 8594L -#define ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR 8595L -#define ERROR_DS_NO_MSDS_INTID 8596L -#define ERROR_DS_DUP_MSDS_INTID 8597L -#define ERROR_DS_EXISTS_IN_RDNATTID 8598L -#define ERROR_DS_AUTHORIZATION_FAILED 8599L -#define ERROR_DS_INVALID_SCRIPT 8600L -#define ERROR_DS_REMOTE_CROSSREF_OP_FAILED 8601L -#define ERROR_DS_CROSS_REF_BUSY 8602L -#define ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN 8603L -#define ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC 8604L -#define ERROR_DS_DUPLICATE_ID_FOUND 8605L -#define ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT 8606L -#define ERROR_DS_GROUP_CONVERSION_ERROR 8607L -#define ERROR_DS_CANT_MOVE_APP_BASIC_GROUP 8608L -#define ERROR_DS_CANT_MOVE_APP_QUERY_GROUP 8609L -#define ERROR_DS_ROLE_NOT_VERIFIED 8610L -#define ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL 8611L -#define ERROR_DS_DOMAIN_RENAME_IN_PROGRESS 8612L -#define ERROR_DS_EXISTING_AD_CHILD_NC 8613L -#define ERROR_DS_REPL_LIFETIME_EXCEEDED 8614L -#define ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER 8615L -#define ERROR_DS_LDAP_SEND_QUEUE_FULL 8616L -#define ERROR_DS_DRA_OUT_SCHEDULE_WINDOW 8617L -#define DNS_ERROR_RESPONSE_CODES_BASE 9000 -#define DNS_ERROR_RCODE_NO_ERROR NO_ERROR -#define DNS_ERROR_MASK 0x00002328 -#define DNS_ERROR_RCODE_FORMAT_ERROR 9001L -#define DNS_ERROR_RCODE_SERVER_FAILURE 9002L -#define DNS_ERROR_RCODE_NAME_ERROR 9003L -#define DNS_ERROR_RCODE_NOT_IMPLEMENTED 9004L -#define DNS_ERROR_RCODE_REFUSED 9005L -#define DNS_ERROR_RCODE_YXDOMAIN 9006L -#define DNS_ERROR_RCODE_YXRRSET 9007L -#define DNS_ERROR_RCODE_NXRRSET 9008L -#define DNS_ERROR_RCODE_NOTAUTH 9009L -#define DNS_ERROR_RCODE_NOTZONE 9010L -#define DNS_ERROR_RCODE_BADSIG 9016L -#define DNS_ERROR_RCODE_BADKEY 9017L -#define DNS_ERROR_RCODE_BADTIME 9018L -#define DNS_ERROR_RCODE_LAST DNS_ERROR_RCODE_BADTIME -#define DNS_ERROR_PACKET_FMT_BASE 9500 -#define DNS_INFO_NO_RECORDS 9501L -#define DNS_ERROR_BAD_PACKET 9502L -#define DNS_ERROR_NO_PACKET 9503L -#define DNS_ERROR_RCODE 9504L -#define DNS_ERROR_UNSECURE_PACKET 9505L -#define DNS_STATUS_PACKET_UNSECURE DNS_ERROR_UNSECURE_PACKET -#define DNS_ERROR_NO_MEMORY ERROR_OUTOFMEMORY -#define DNS_ERROR_INVALID_NAME ERROR_INVALID_NAME -#define DNS_ERROR_INVALID_DATA ERROR_INVALID_DATA -#define DNS_ERROR_GENERAL_API_BASE 9550 -#define DNS_ERROR_INVALID_TYPE 9551L -#define DNS_ERROR_INVALID_IP_ADDRESS 9552L -#define DNS_ERROR_INVALID_PROPERTY 9553L -#define DNS_ERROR_TRY_AGAIN_LATER 9554L -#define DNS_ERROR_NOT_UNIQUE 9555L -#define DNS_ERROR_NON_RFC_NAME 9556L -#define DNS_STATUS_FQDN 9557L -#define DNS_STATUS_DOTTED_NAME 9558L -#define DNS_STATUS_SINGLE_PART_NAME 9559L -#define DNS_ERROR_INVALID_NAME_CHAR 9560L -#define DNS_ERROR_NUMERIC_NAME 9561L -#define DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER 9562L -#define DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION 9563L -#define DNS_ERROR_CANNOT_FIND_ROOT_HINTS 9564L -#define DNS_ERROR_INCONSISTENT_ROOT_HINTS 9565L -#define DNS_ERROR_ZONE_BASE 9600 -#define DNS_ERROR_ZONE_DOES_NOT_EXIST 9601L -#define DNS_ERROR_NO_ZONE_INFO 9602L -#define DNS_ERROR_INVALID_ZONE_OPERATION 9603L -#define DNS_ERROR_ZONE_CONFIGURATION_ERROR 9604L -#define DNS_ERROR_ZONE_HAS_NO_SOA_RECORD 9605L -#define DNS_ERROR_ZONE_HAS_NO_NS_RECORDS 9606L -#define DNS_ERROR_ZONE_LOCKED 9607L -#define DNS_ERROR_ZONE_CREATION_FAILED 9608L -#define DNS_ERROR_ZONE_ALREADY_EXISTS 9609L -#define DNS_ERROR_AUTOZONE_ALREADY_EXISTS 9610L -#define DNS_ERROR_INVALID_ZONE_TYPE 9611L -#define DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP 9612L -#define DNS_ERROR_ZONE_NOT_SECONDARY 9613L -#define DNS_ERROR_NEED_SECONDARY_ADDRESSES 9614L -#define DNS_ERROR_WINS_INIT_FAILED 9615L -#define DNS_ERROR_NEED_WINS_SERVERS 9616L -#define DNS_ERROR_NBSTAT_INIT_FAILED 9617L -#define DNS_ERROR_SOA_DELETE_INVALID 9618L -#define DNS_ERROR_FORWARDER_ALREADY_EXISTS 9619L -#define DNS_ERROR_ZONE_REQUIRES_MASTER_IP 9620L -#define DNS_ERROR_ZONE_IS_SHUTDOWN 9621L -#define DNS_ERROR_DATAFILE_BASE 9650 -#define DNS_ERROR_PRIMARY_REQUIRES_DATAFILE 9651L -#define DNS_ERROR_INVALID_DATAFILE_NAME 9652L -#define DNS_ERROR_DATAFILE_OPEN_FAILURE 9653L -#define DNS_ERROR_FILE_WRITEBACK_FAILED 9654L -#define DNS_ERROR_DATAFILE_PARSING 9655L -#define DNS_ERROR_DATABASE_BASE 9700 -#define DNS_ERROR_RECORD_DOES_NOT_EXIST 9701L -#define DNS_ERROR_RECORD_FORMAT 9702L -#define DNS_ERROR_NODE_CREATION_FAILED 9703L -#define DNS_ERROR_UNKNOWN_RECORD_TYPE 9704L -#define DNS_ERROR_RECORD_TIMED_OUT 9705L -#define DNS_ERROR_NAME_NOT_IN_ZONE 9706L -#define DNS_ERROR_CNAME_LOOP 9707L -#define DNS_ERROR_NODE_IS_CNAME 9708L -#define DNS_ERROR_CNAME_COLLISION 9709L -#define DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT 9710L -#define DNS_ERROR_RECORD_ALREADY_EXISTS 9711L -#define DNS_ERROR_SECONDARY_DATA 9712L -#define DNS_ERROR_NO_CREATE_CACHE_DATA 9713L -#define DNS_ERROR_NAME_DOES_NOT_EXIST 9714L -#define DNS_WARNING_PTR_CREATE_FAILED 9715L -#define DNS_WARNING_DOMAIN_UNDELETED 9716L -#define DNS_ERROR_DS_UNAVAILABLE 9717L -#define DNS_ERROR_DS_ZONE_ALREADY_EXISTS 9718L -#define DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE 9719L -#define DNS_ERROR_OPERATION_BASE 9750 -#define DNS_INFO_AXFR_COMPLETE 9751L -#define DNS_ERROR_AXFR 9752L -#define DNS_INFO_ADDED_LOCAL_WINS 9753L -#define DNS_ERROR_SECURE_BASE 9800 -#define DNS_STATUS_CONTINUE_NEEDED 9801L -#define DNS_ERROR_SETUP_BASE 9850 -#define DNS_ERROR_NO_TCPIP 9851L -#define DNS_ERROR_NO_DNS_SERVERS 9852L -#define DNS_ERROR_DP_BASE 9900 -#define DNS_ERROR_DP_DOES_NOT_EXIST 9901L -#define DNS_ERROR_DP_ALREADY_EXISTS 9902L -#define DNS_ERROR_DP_NOT_ENLISTED 9903L -#define DNS_ERROR_DP_ALREADY_ENLISTED 9904L -#define DNS_ERROR_DP_NOT_AVAILABLE 9905L -#define DNS_ERROR_DP_FSMO_ERROR 9906L - -#ifndef WSABASEERR -#define WSABASEERR 10000 -#define WSAEINTR 10004L -#define WSAEBADF 10009L -#define WSAEACCES 10013L -#define WSAEFAULT 10014L -#define WSAEINVAL 10022L -#define WSAEMFILE 10024L -#define WSAEWOULDBLOCK 10035L -#define WSAEINPROGRESS 10036L -#define WSAEALREADY 10037L -#define WSAENOTSOCK 10038L -#define WSAEDESTADDRREQ 10039L -#define WSAEMSGSIZE 10040L -#define WSAEPROTOTYPE 10041L -#define WSAENOPROTOOPT 10042L -#define WSAEPROTONOSUPPORT 10043L -#define WSAESOCKTNOSUPPORT 10044L -#define WSAEOPNOTSUPP 10045L -#define WSAEPFNOSUPPORT 10046L -#define WSAEAFNOSUPPORT 10047L -#define WSAEADDRINUSE 10048L -#define WSAEADDRNOTAVAIL 10049L -#define WSAENETDOWN 10050L -#define WSAENETUNREACH 10051L -#define WSAENETRESET 10052L -#define WSAECONNABORTED 10053L -#define WSAECONNRESET 10054L -#define WSAENOBUFS 10055L -#define WSAEISCONN 10056L -#define WSAENOTCONN 10057L -#define WSAESHUTDOWN 10058L -#define WSAETOOMANYREFS 10059L -#define WSAETIMEDOUT 10060L -#define WSAECONNREFUSED 10061L -#define WSAELOOP 10062L -#define WSAENAMETOOLONG 10063L -#define WSAEHOSTDOWN 10064L -#define WSAEHOSTUNREACH 10065L -#define WSAENOTEMPTY 10066L -#define WSAEPROCLIM 10067L -#define WSAEUSERS 10068L -#define WSAEDQUOT 10069L -#define WSAESTALE 10070L -#define WSAEREMOTE 10071L -#define WSASYSNOTREADY 10091L -#define WSAVERNOTSUPPORTED 10092L -#define WSANOTINITIALISED 10093L -#define WSAEDISCON 10101L -#define WSAENOMORE 10102L -#define WSAECANCELLED 10103L -#define WSAEINVALIDPROCTABLE 10104L -#define WSAEINVALIDPROVIDER 10105L -#define WSAEPROVIDERFAILEDINIT 10106L -#define WSASYSCALLFAILURE 10107L -#define WSASERVICE_NOT_FOUND 10108L -#define WSATYPE_NOT_FOUND 10109L -#define WSA_E_NO_MORE 10110L -#define WSA_E_CANCELLED 10111L -#define WSAEREFUSED 10112L -#ifndef WSAHOST_NOT_FOUND -#define WSAHOST_NOT_FOUND 11001L -#endif -#ifndef WSATRY_AGAIN -#define WSATRY_AGAIN 11002L -#endif -#ifndef WSANO_RECOVERY -#define WSANO_RECOVERY 11003L -#endif -#ifndef WSANO_DATA -#define WSANO_DATA 11004L -#endif -#ifndef WSA_QOS_RECEIVERS -#define WSA_QOS_RECEIVERS 11005L -#endif -#ifndef WSA_QOS_SENDERS -#define WSA_QOS_SENDERS 11006L -#endif -#ifndef WSA_QOS_NO_SENDERS -#define WSA_QOS_NO_SENDERS 11007L -#endif -#ifndef WSA_QOS_NO_RECEIVERS -#define WSA_QOS_NO_RECEIVERS 11008L -#endif -#ifndef WSA_QOS_REQUEST_CONFIRMED -#define WSA_QOS_REQUEST_CONFIRMED 11009L -#endif -#ifndef WSA_QOS_ADMISSION_FAILURE -#define WSA_QOS_ADMISSION_FAILURE 11010L -#endif -#ifndef WSA_QOS_POLICY_FAILURE -#define WSA_QOS_POLICY_FAILURE 11011L -#endif -#ifndef WSA_QOS_BAD_STYLE -#define WSA_QOS_BAD_STYLE 11012L -#endif -#ifndef WSA_QOS_BAD_OBJECT -#define WSA_QOS_BAD_OBJECT 11013L -#endif -#ifndef WSA_QOS_TRAFFIC_CTRL_ERROR -#define WSA_QOS_TRAFFIC_CTRL_ERROR 11014L -#endif -#ifndef WSA_QOS_GENERIC_ERROR -#define WSA_QOS_GENERIC_ERROR 11015L -#endif -#ifndef WSA_QOS_ESERVICETYPE -#define WSA_QOS_ESERVICETYPE 11016L -#endif -#ifndef WSA_QOS_EFLOWSPEC -#define WSA_QOS_EFLOWSPEC 11017L -#endif -#ifndef WSA_QOS_EPROVSPECBUF -#define WSA_QOS_EPROVSPECBUF 11018L -#endif -#ifndef WSA_QOS_EFILTERSTYLE -#define WSA_QOS_EFILTERSTYLE 11019L -#endif -#ifndef WSA_QOS_EFILTERTYPE -#define WSA_QOS_EFILTERTYPE 11020L -#endif -#ifndef WSA_QOS_EFILTERCOUNT -#define WSA_QOS_EFILTERCOUNT 11021L -#endif -#ifndef WSA_QOS_EOBJLENGTH -#define WSA_QOS_EOBJLENGTH 11022L -#endif -#ifndef WSA_QOS_EFLOWCOUNT -#define WSA_QOS_EFLOWCOUNT 11023L -#endif -#ifndef WSA_QOS_EUNKNOWNPSOBJ -#define WSA_QOS_EUNKNOWNPSOBJ 11024L -#endif -#ifndef WSA_QOS_EPOLICYOBJ -#define WSA_QOS_EPOLICYOBJ 11025L -#endif -#ifndef WSA_QOS_EFLOWDESC -#define WSA_QOS_EFLOWDESC 11026L -#endif -#ifndef WSA_QOS_EPSFLOWSPEC -#define WSA_QOS_EPSFLOWSPEC 11027L -#endif -#ifndef WSA_QOS_EPSFILTERSPEC -#define WSA_QOS_EPSFILTERSPEC 11028L -#endif -#ifndef WSA_QOS_ESDMODEOBJ -#define WSA_QOS_ESDMODEOBJ 11029L -#endif -#ifndef WSA_QOS_ESHAPERATEOBJ -#define WSA_QOS_ESHAPERATEOBJ 11030L -#endif -#ifndef WSA_QOS_RESERVED_PETYPE -#define WSA_QOS_RESERVED_PETYPE 11031L -#endif -#endif /* WSABASEERR */ - -#define ERROR_SXS_SECTION_NOT_FOUND 14000L -#define ERROR_SXS_CANT_GEN_ACTCTX 14001L -#define ERROR_SXS_INVALID_ACTCTXDATA_FORMAT 14002L -#define ERROR_SXS_ASSEMBLY_NOT_FOUND 14003L -#define ERROR_SXS_MANIFEST_FORMAT_ERROR 14004L -#define ERROR_SXS_MANIFEST_PARSE_ERROR 14005L -#define ERROR_SXS_ACTIVATION_CONTEXT_DISABLED 14006L -#define ERROR_SXS_KEY_NOT_FOUND 14007L -#define ERROR_SXS_VERSION_CONFLICT 14008L -#define ERROR_SXS_WRONG_SECTION_TYPE 14009L -#define ERROR_SXS_THREAD_QUERIES_DISABLED 14010L -#define ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET 14011L -#define ERROR_SXS_UNKNOWN_ENCODING_GROUP 14012L -#define ERROR_SXS_UNKNOWN_ENCODING 14013L -#define ERROR_SXS_INVALID_XML_NAMESPACE_URI 14014L -#define ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED 14015L -#define ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED 14016L -#define ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE 14017L -#define ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE 14018L -#define ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE 14019L -#define ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT 14020L -#define ERROR_SXS_DUPLICATE_DLL_NAME 14021L -#define ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME 14022L -#define ERROR_SXS_DUPLICATE_CLSID 14023L -#define ERROR_SXS_DUPLICATE_IID 14024L -#define ERROR_SXS_DUPLICATE_TLBID 14025L -#define ERROR_SXS_DUPLICATE_PROGID 14026L -#define ERROR_SXS_DUPLICATE_ASSEMBLY_NAME 14027L -#define ERROR_SXS_FILE_HASH_MISMATCH 14028L -#define ERROR_SXS_POLICY_PARSE_ERROR 14029L -#define ERROR_SXS_XML_E_MISSINGQUOTE 14030L -#define ERROR_SXS_XML_E_COMMENTSYNTAX 14031L -#define ERROR_SXS_XML_E_BADSTARTNAMECHAR 14032L -#define ERROR_SXS_XML_E_BADNAMECHAR 14033L -#define ERROR_SXS_XML_E_BADCHARINSTRING 14034L -#define ERROR_SXS_XML_E_XMLDECLSYNTAX 14035L -#define ERROR_SXS_XML_E_BADCHARDATA 14036L -#define ERROR_SXS_XML_E_MISSINGWHITESPACE 14037L -#define ERROR_SXS_XML_E_EXPECTINGTAGEND 14038L -#define ERROR_SXS_XML_E_MISSINGSEMICOLON 14039L -#define ERROR_SXS_XML_E_UNBALANCEDPAREN 14040L -#define ERROR_SXS_XML_E_INTERNALERROR 14041L -#define ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE 14042L -#define ERROR_SXS_XML_E_INCOMPLETE_ENCODING 14043L -#define ERROR_SXS_XML_E_MISSING_PAREN 14044L -#define ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE 14045L -#define ERROR_SXS_XML_E_MULTIPLE_COLONS 14046L -#define ERROR_SXS_XML_E_INVALID_DECIMAL 14047L -#define ERROR_SXS_XML_E_INVALID_HEXIDECIMAL 14048L -#define ERROR_SXS_XML_E_INVALID_UNICODE 14049L -#define ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK 14050L -#define ERROR_SXS_XML_E_UNEXPECTEDENDTAG 14051L -#define ERROR_SXS_XML_E_UNCLOSEDTAG 14052L -#define ERROR_SXS_XML_E_DUPLICATEATTRIBUTE 14053L -#define ERROR_SXS_XML_E_MULTIPLEROOTS 14054L -#define ERROR_SXS_XML_E_INVALIDATROOTLEVEL 14055L -#define ERROR_SXS_XML_E_BADXMLDECL 14056L -#define ERROR_SXS_XML_E_MISSINGROOT 14057L -#define ERROR_SXS_XML_E_UNEXPECTEDEOF 14058L -#define ERROR_SXS_XML_E_BADPEREFINSUBSET 14059L -#define ERROR_SXS_XML_E_UNCLOSEDSTARTTAG 14060L -#define ERROR_SXS_XML_E_UNCLOSEDENDTAG 14061L -#define ERROR_SXS_XML_E_UNCLOSEDSTRING 14062L -#define ERROR_SXS_XML_E_UNCLOSEDCOMMENT 14063L -#define ERROR_SXS_XML_E_UNCLOSEDDECL 14064L -#define ERROR_SXS_XML_E_UNCLOSEDCDATA 14065L -#define ERROR_SXS_XML_E_RESERVEDNAMESPACE 14066L -#define ERROR_SXS_XML_E_INVALIDENCODING 14067L -#define ERROR_SXS_XML_E_INVALIDSWITCH 14068L -#define ERROR_SXS_XML_E_BADXMLCASE 14069L -#define ERROR_SXS_XML_E_INVALID_STANDALONE 14070L -#define ERROR_SXS_XML_E_UNEXPECTED_STANDALONE 14071L -#define ERROR_SXS_XML_E_INVALID_VERSION 14072L -#define ERROR_SXS_XML_E_MISSINGEQUALS 14073L -#define ERROR_SXS_PROTECTION_RECOVERY_FAILED 14074L -#define ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT 14075L -#define ERROR_SXS_PROTECTION_CATALOG_NOT_VALID 14076L -#define ERROR_SXS_UNTRANSLATABLE_HRESULT 14077L -#define ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING 14078L -#define ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE 14079L -#define ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME 14080L -#define ERROR_IPSEC_QM_POLICY_EXISTS 13000L -#define ERROR_IPSEC_QM_POLICY_NOT_FOUND 13001L -#define ERROR_IPSEC_QM_POLICY_IN_USE 13002L -#define ERROR_IPSEC_MM_POLICY_EXISTS 13003L -#define ERROR_IPSEC_MM_POLICY_NOT_FOUND 13004L -#define ERROR_IPSEC_MM_POLICY_IN_USE 13005L -#define ERROR_IPSEC_MM_FILTER_EXISTS 13006L -#define ERROR_IPSEC_MM_FILTER_NOT_FOUND 13007L -#define ERROR_IPSEC_TRANSPORT_FILTER_EXISTS 13008L -#define ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND 13009L -#define ERROR_IPSEC_MM_AUTH_EXISTS 13010L -#define ERROR_IPSEC_MM_AUTH_NOT_FOUND 13011L -#define ERROR_IPSEC_MM_AUTH_IN_USE 13012L -#define ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND 13013L -#define ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND 13014L -#define ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND 13015L -#define ERROR_IPSEC_TUNNEL_FILTER_EXISTS 13016L -#define ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND 13017L -#define ERROR_IPSEC_MM_FILTER_PENDING_DELETION 13018L -#define ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION 13019L -#define ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION 13020L -#define ERROR_IPSEC_MM_POLICY_PENDING_DELETION 13021L -#define ERROR_IPSEC_MM_AUTH_PENDING_DELETION 13022L -#define ERROR_IPSEC_QM_POLICY_PENDING_DELETION 13023L -#define WARNING_IPSEC_MM_POLICY_PRUNED 13024L -#define WARNING_IPSEC_QM_POLICY_PRUNED 13025L -#define ERROR_IPSEC_IKE_NEG_STATUS_BEGIN 13800L -#define ERROR_IPSEC_IKE_AUTH_FAIL 13801L -#define ERROR_IPSEC_IKE_ATTRIB_FAIL 13802L -#define ERROR_IPSEC_IKE_NEGOTIATION_PENDING 13803L -#define ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR 13804L -#define ERROR_IPSEC_IKE_TIMED_OUT 13805L -#define ERROR_IPSEC_IKE_NO_CERT 13806L -#define ERROR_IPSEC_IKE_SA_DELETED 13807L -#define ERROR_IPSEC_IKE_SA_REAPED 13808L -#define ERROR_IPSEC_IKE_MM_ACQUIRE_DROP 13809L -#define ERROR_IPSEC_IKE_QM_ACQUIRE_DROP 13810L -#define ERROR_IPSEC_IKE_QUEUE_DROP_MM 13811L -#define ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM 13812L -#define ERROR_IPSEC_IKE_DROP_NO_RESPONSE 13813L -#define ERROR_IPSEC_IKE_MM_DELAY_DROP 13814L -#define ERROR_IPSEC_IKE_QM_DELAY_DROP 13815L -#define ERROR_IPSEC_IKE_ERROR 13816L -#define ERROR_IPSEC_IKE_CRL_FAILED 13817L -#define ERROR_IPSEC_IKE_INVALID_KEY_USAGE 13818L -#define ERROR_IPSEC_IKE_INVALID_CERT_TYPE 13819L -#define ERROR_IPSEC_IKE_NO_PRIVATE_KEY 13820L -#define ERROR_IPSEC_IKE_DH_FAIL 13822L -#define ERROR_IPSEC_IKE_INVALID_HEADER 13824L -#define ERROR_IPSEC_IKE_NO_POLICY 13825L -#define ERROR_IPSEC_IKE_INVALID_SIGNATURE 13826L -#define ERROR_IPSEC_IKE_KERBEROS_ERROR 13827L -#define ERROR_IPSEC_IKE_NO_PUBLIC_KEY 13828L -#define ERROR_IPSEC_IKE_PROCESS_ERR 13829L -#define ERROR_IPSEC_IKE_PROCESS_ERR_SA 13830L -#define ERROR_IPSEC_IKE_PROCESS_ERR_PROP 13831L -#define ERROR_IPSEC_IKE_PROCESS_ERR_TRANS 13832L -#define ERROR_IPSEC_IKE_PROCESS_ERR_KE 13833L -#define ERROR_IPSEC_IKE_PROCESS_ERR_ID 13834L -#define ERROR_IPSEC_IKE_PROCESS_ERR_CERT 13835L -#define ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ 13836L -#define ERROR_IPSEC_IKE_PROCESS_ERR_HASH 13837L -#define ERROR_IPSEC_IKE_PROCESS_ERR_SIG 13838L -#define ERROR_IPSEC_IKE_PROCESS_ERR_NONCE 13839L -#define ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY 13840L -#define ERROR_IPSEC_IKE_PROCESS_ERR_DELETE 13841L -#define ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR 13842L -#define ERROR_IPSEC_IKE_INVALID_PAYLOAD 13843L -#define ERROR_IPSEC_IKE_LOAD_SOFT_SA 13844L -#define ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN 13845L -#define ERROR_IPSEC_IKE_INVALID_COOKIE 13846L -#define ERROR_IPSEC_IKE_NO_PEER_CERT 13847L -#define ERROR_IPSEC_IKE_PEER_CRL_FAILED 13848L -#define ERROR_IPSEC_IKE_POLICY_CHANGE 13849L -#define ERROR_IPSEC_IKE_NO_MM_POLICY 13850L -#define ERROR_IPSEC_IKE_NOTCBPRIV 13851L -#define ERROR_IPSEC_IKE_SECLOADFAIL 13852L -#define ERROR_IPSEC_IKE_FAILSSPINIT 13853L -#define ERROR_IPSEC_IKE_FAILQUERYSSP 13854L -#define ERROR_IPSEC_IKE_SRVACQFAIL 13855L -#define ERROR_IPSEC_IKE_SRVQUERYCRED 13856L -#define ERROR_IPSEC_IKE_GETSPIFAIL 13857L -#define ERROR_IPSEC_IKE_INVALID_FILTER 13858L -#define ERROR_IPSEC_IKE_OUT_OF_MEMORY 13859L -#define ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED 13860L -#define ERROR_IPSEC_IKE_INVALID_POLICY 13861L -#define ERROR_IPSEC_IKE_UNKNOWN_DOI 13862L -#define ERROR_IPSEC_IKE_INVALID_SITUATION 13863L -#define ERROR_IPSEC_IKE_DH_FAILURE 13864L -#define ERROR_IPSEC_IKE_INVALID_GROUP 13865L -#define ERROR_IPSEC_IKE_ENCRYPT 13866L -#define ERROR_IPSEC_IKE_DECRYPT 13867L -#define ERROR_IPSEC_IKE_POLICY_MATCH 13868L -#define ERROR_IPSEC_IKE_UNSUPPORTED_ID 13869L -#define ERROR_IPSEC_IKE_INVALID_HASH 13870L -#define ERROR_IPSEC_IKE_INVALID_HASH_ALG 13871L -#define ERROR_IPSEC_IKE_INVALID_HASH_SIZE 13872L -#define ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG 13873L -#define ERROR_IPSEC_IKE_INVALID_AUTH_ALG 13874L -#define ERROR_IPSEC_IKE_INVALID_SIG 13875L -#define ERROR_IPSEC_IKE_LOAD_FAILED 13876L -#define ERROR_IPSEC_IKE_RPC_DELETE 13877L -#define ERROR_IPSEC_IKE_BENIGN_REINIT 13878L -#define ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY 13879L -#define ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN 13881L -#define ERROR_IPSEC_IKE_MM_LIMIT 13882L -#define ERROR_IPSEC_IKE_NEGOTIATION_DISABLED 13883L -#define ERROR_IPSEC_IKE_NEG_STATUS_END 13884L -#define SEVERITY_SUCCESS 0 -#define SEVERITY_ERROR 1 -#define SUCCEEDED(hr) ((HRESULT)(hr) >= 0) -#define FAILED(hr) ((HRESULT)(hr) < 0) -#define IS_ERROR(Status) ((unsigned long)(Status) >> 31==SEVERITY_ERROR) -#define HRESULT_CODE(hr) ((hr) & 0xFFFF) -#define SCODE_CODE(sc) ((sc) & 0xFFFF) -#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) -#define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1fff) -#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1) -#define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1) -#define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) -#define MAKE_SCODE(sev,fac,code) ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) -#define FACILITY_NT_BIT 0x10000000 -#define __HRESULT_FROM_WIN32(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000))) -#ifdef INLINE_HRESULT_FROM_WIN32 -#ifndef _HRESULT_DEFINED -#define _HRESULT_DEFINED -typedef long HRESULT; -#endif -__CRT_INLINE HRESULT HRESULT_FROM_WIN32(long x) { return x <= 0 ? (HRESULT)x : (HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000);} -#else -#define HRESULT_FROM_WIN32(x) __HRESULT_FROM_WIN32(x) -#endif -#define HRESULT_FROM_NT(x) ((HRESULT) ((x) | FACILITY_NT_BIT)) -#define GetScode(hr) ((SCODE) (hr)) -#define ResultFromScode(sc) ((HRESULT) (sc)) -#define PropagateResult(hrPrevious,scBase) ((HRESULT) scBase) -#ifdef RC_INVOKED -#define _HRESULT_TYPEDEF_(_sc) _sc -#else -#define _HRESULT_TYPEDEF_(_sc) ((HRESULT)_sc) -#endif -#define NOERROR 0 -#define E_UNEXPECTED _HRESULT_TYPEDEF_(0x8000FFFFL) -#define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001L) -#define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000EL) -#define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L) -#define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002L) -#define E_POINTER _HRESULT_TYPEDEF_(0x80004003L) -#define E_HANDLE _HRESULT_TYPEDEF_(0x80070006L) -#define E_ABORT _HRESULT_TYPEDEF_(0x80004004L) -#define E_FAIL _HRESULT_TYPEDEF_(0x80004005L) -#define E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80070005L) -#define E_PENDING _HRESULT_TYPEDEF_(0x8000000AL) -#define CO_E_INIT_TLS _HRESULT_TYPEDEF_(0x80004006L) -#define CO_E_INIT_SHARED_ALLOCATOR _HRESULT_TYPEDEF_(0x80004007L) -#define CO_E_INIT_MEMORY_ALLOCATOR _HRESULT_TYPEDEF_(0x80004008L) -#define CO_E_INIT_CLASS_CACHE _HRESULT_TYPEDEF_(0x80004009L) -#define CO_E_INIT_RPC_CHANNEL _HRESULT_TYPEDEF_(0x8000400AL) -#define CO_E_INIT_TLS_SET_CHANNEL_CONTROL _HRESULT_TYPEDEF_(0x8000400BL) -#define CO_E_INIT_TLS_CHANNEL_CONTROL _HRESULT_TYPEDEF_(0x8000400CL) -#define CO_E_INIT_UNACCEPTED_USER_ALLOCATOR _HRESULT_TYPEDEF_(0x8000400DL) -#define CO_E_INIT_SCM_MUTEX_EXISTS _HRESULT_TYPEDEF_(0x8000400EL) -#define CO_E_INIT_SCM_FILE_MAPPING_EXISTS _HRESULT_TYPEDEF_(0x8000400FL) -#define CO_E_INIT_SCM_MAP_VIEW_OF_FILE _HRESULT_TYPEDEF_(0x80004010L) -#define CO_E_INIT_SCM_EXEC_FAILURE _HRESULT_TYPEDEF_(0x80004011L) -#define CO_E_INIT_ONLY_SINGLE_THREADED _HRESULT_TYPEDEF_(0x80004012L) -#define CO_E_CANT_REMOTE _HRESULT_TYPEDEF_(0x80004013L) -#define CO_E_BAD_SERVER_NAME _HRESULT_TYPEDEF_(0x80004014L) -#define CO_E_WRONG_SERVER_IDENTITY _HRESULT_TYPEDEF_(0x80004015L) -#define CO_E_OLE1DDE_DISABLED _HRESULT_TYPEDEF_(0x80004016L) -#define CO_E_RUNAS_SYNTAX _HRESULT_TYPEDEF_(0x80004017L) -#define CO_E_CREATEPROCESS_FAILURE _HRESULT_TYPEDEF_(0x80004018L) -#define CO_E_RUNAS_CREATEPROCESS_FAILURE _HRESULT_TYPEDEF_(0x80004019L) -#define CO_E_RUNAS_LOGON_FAILURE _HRESULT_TYPEDEF_(0x8000401AL) -#define CO_E_LAUNCH_PERMSSION_DENIED _HRESULT_TYPEDEF_(0x8000401BL) -#define CO_E_START_SERVICE_FAILURE _HRESULT_TYPEDEF_(0x8000401CL) -#define CO_E_REMOTE_COMMUNICATION_FAILURE _HRESULT_TYPEDEF_(0x8000401DL) -#define CO_E_SERVER_START_TIMEOUT _HRESULT_TYPEDEF_(0x8000401EL) -#define CO_E_CLSREG_INCONSISTENT _HRESULT_TYPEDEF_(0x8000401FL) -#define CO_E_IIDREG_INCONSISTENT _HRESULT_TYPEDEF_(0x80004020L) -#define CO_E_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80004021L) -#define CO_E_RELOAD_DLL _HRESULT_TYPEDEF_(0x80004022L) -#define CO_E_MSI_ERROR _HRESULT_TYPEDEF_(0x80004023L) -#define CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT _HRESULT_TYPEDEF_(0x80004024L) -#define CO_E_SERVER_PAUSED _HRESULT_TYPEDEF_(0x80004025L) -#define CO_E_SERVER_NOT_PAUSED _HRESULT_TYPEDEF_(0x80004026L) -#define CO_E_CLASS_DISABLED _HRESULT_TYPEDEF_(0x80004027L) -#define CO_E_CLRNOTAVAILABLE _HRESULT_TYPEDEF_(0x80004028L) -#define CO_E_ASYNC_WORK_REJECTED _HRESULT_TYPEDEF_(0x80004029L) -#define CO_E_SERVER_INIT_TIMEOUT _HRESULT_TYPEDEF_(0x8000402AL) -#define CO_E_NO_SECCTX_IN_ACTIVATE _HRESULT_TYPEDEF_(0x8000402BL) -#define CO_E_TRACKER_CONFIG _HRESULT_TYPEDEF_(0x80004030L) -#define CO_E_THREADPOOL_CONFIG _HRESULT_TYPEDEF_(0x80004031L) -#define CO_E_SXS_CONFIG _HRESULT_TYPEDEF_(0x80004032L) -#define CO_E_MALFORMED_SPN _HRESULT_TYPEDEF_(0x80004033L) -#define S_OK ((HRESULT)0x00000000L) -#define S_FALSE ((HRESULT)0x00000001L) -#define OLE_E_FIRST ((HRESULT)0x80040000L) -#define OLE_E_LAST ((HRESULT)0x800400FFL) -#define OLE_S_FIRST ((HRESULT)0x00040000L) -#define OLE_S_LAST ((HRESULT)0x000400FFL) -#define OLE_E_OLEVERB _HRESULT_TYPEDEF_(0x80040000L) -#define OLE_E_ADVF _HRESULT_TYPEDEF_(0x80040001L) -#define OLE_E_ENUM_NOMORE _HRESULT_TYPEDEF_(0x80040002L) -#define OLE_E_ADVISENOTSUPPORTED _HRESULT_TYPEDEF_(0x80040003L) -#define OLE_E_NOCONNECTION _HRESULT_TYPEDEF_(0x80040004L) -#define OLE_E_NOTRUNNING _HRESULT_TYPEDEF_(0x80040005L) -#define OLE_E_NOCACHE _HRESULT_TYPEDEF_(0x80040006L) -#define OLE_E_BLANK _HRESULT_TYPEDEF_(0x80040007L) -#define OLE_E_CLASSDIFF _HRESULT_TYPEDEF_(0x80040008L) -#define OLE_E_CANT_GETMONIKER _HRESULT_TYPEDEF_(0x80040009L) -#define OLE_E_CANT_BINDTOSOURCE _HRESULT_TYPEDEF_(0x8004000AL) -#define OLE_E_STATIC _HRESULT_TYPEDEF_(0x8004000BL) -#define OLE_E_PROMPTSAVECANCELLED _HRESULT_TYPEDEF_(0x8004000CL) -#define OLE_E_INVALIDRECT _HRESULT_TYPEDEF_(0x8004000DL) -#define OLE_E_WRONGCOMPOBJ _HRESULT_TYPEDEF_(0x8004000EL) -#define OLE_E_INVALIDHWND _HRESULT_TYPEDEF_(0x8004000FL) -#define OLE_E_NOT_INPLACEACTIVE _HRESULT_TYPEDEF_(0x80040010L) -#define OLE_E_CANTCONVERT _HRESULT_TYPEDEF_(0x80040011L) -#define OLE_E_NOSTORAGE _HRESULT_TYPEDEF_(0x80040012L) -#define DV_E_FORMATETC _HRESULT_TYPEDEF_(0x80040064L) -#define DV_E_DVTARGETDEVICE _HRESULT_TYPEDEF_(0x80040065L) -#define DV_E_STGMEDIUM _HRESULT_TYPEDEF_(0x80040066L) -#define DV_E_STATDATA _HRESULT_TYPEDEF_(0x80040067L) -#define DV_E_LINDEX _HRESULT_TYPEDEF_(0x80040068L) -#define DV_E_TYMED _HRESULT_TYPEDEF_(0x80040069L) -#define DV_E_CLIPFORMAT _HRESULT_TYPEDEF_(0x8004006AL) -#define DV_E_DVASPECT _HRESULT_TYPEDEF_(0x8004006BL) -#define DV_E_DVTARGETDEVICE_SIZE _HRESULT_TYPEDEF_(0x8004006CL) -#define DV_E_NOIVIEWOBJECT _HRESULT_TYPEDEF_(0x8004006DL) -#define DRAGDROP_E_FIRST 0x80040100L -#define DRAGDROP_E_LAST 0x8004010FL -#define DRAGDROP_S_FIRST 0x00040100L -#define DRAGDROP_S_LAST 0x0004010FL -#define DRAGDROP_E_NOTREGISTERED _HRESULT_TYPEDEF_(0x80040100L) -#define DRAGDROP_E_ALREADYREGISTERED _HRESULT_TYPEDEF_(0x80040101L) -#define DRAGDROP_E_INVALIDHWND _HRESULT_TYPEDEF_(0x80040102L) -#define CLASSFACTORY_E_FIRST 0x80040110L -#define CLASSFACTORY_E_LAST 0x8004011FL -#define CLASSFACTORY_S_FIRST 0x00040110L -#define CLASSFACTORY_S_LAST 0x0004011FL -#define CLASS_E_NOAGGREGATION _HRESULT_TYPEDEF_(0x80040110L) -#define CLASS_E_CLASSNOTAVAILABLE _HRESULT_TYPEDEF_(0x80040111L) -#define CLASS_E_NOTLICENSED _HRESULT_TYPEDEF_(0x80040112L) -#define MARSHAL_E_FIRST 0x80040120L -#define MARSHAL_E_LAST 0x8004012FL -#define MARSHAL_S_FIRST 0x00040120L -#define MARSHAL_S_LAST 0x0004012FL -#define DATA_E_FIRST 0x80040130L -#define DATA_E_LAST 0x8004013FL -#define DATA_S_FIRST 0x00040130L -#define DATA_S_LAST 0x0004013FL -#define VIEW_E_FIRST 0x80040140L -#define VIEW_E_LAST 0x8004014FL -#define VIEW_S_FIRST 0x00040140L -#define VIEW_S_LAST 0x0004014FL -#define VIEW_E_DRAW _HRESULT_TYPEDEF_(0x80040140L) -#define REGDB_E_FIRST 0x80040150L -#define REGDB_E_LAST 0x8004015FL -#define REGDB_S_FIRST 0x00040150L -#define REGDB_S_LAST 0x0004015FL -#define REGDB_E_READREGDB _HRESULT_TYPEDEF_(0x80040150L) -#define REGDB_E_WRITEREGDB _HRESULT_TYPEDEF_(0x80040151L) -#define REGDB_E_KEYMISSING _HRESULT_TYPEDEF_(0x80040152L) -#define REGDB_E_INVALIDVALUE _HRESULT_TYPEDEF_(0x80040153L) -#define REGDB_E_CLASSNOTREG _HRESULT_TYPEDEF_(0x80040154L) -#define REGDB_E_IIDNOTREG _HRESULT_TYPEDEF_(0x80040155L) -#define REGDB_E_BADTHREADINGMODEL _HRESULT_TYPEDEF_(0x80040156L) -#define CAT_E_FIRST 0x80040160L -#define CAT_E_LAST 0x80040161L -#define CAT_E_CATIDNOEXIST _HRESULT_TYPEDEF_(0x80040160L) -#define CAT_E_NODESCRIPTION _HRESULT_TYPEDEF_(0x80040161L) -#define CS_E_FIRST 0x80040164L -#define CS_E_LAST 0x8004016FL -#define CS_E_PACKAGE_NOTFOUND _HRESULT_TYPEDEF_(0x80040164L) -#define CS_E_NOT_DELETABLE _HRESULT_TYPEDEF_(0x80040165L) -#define CS_E_CLASS_NOTFOUND _HRESULT_TYPEDEF_(0x80040166L) -#define CS_E_INVALID_VERSION _HRESULT_TYPEDEF_(0x80040167L) -#define CS_E_NO_CLASSSTORE _HRESULT_TYPEDEF_(0x80040168L) -#define CS_E_OBJECT_NOTFOUND _HRESULT_TYPEDEF_(0x80040169L) -#define CS_E_OBJECT_ALREADY_EXISTS _HRESULT_TYPEDEF_(0x8004016AL) -#define CS_E_INVALID_PATH _HRESULT_TYPEDEF_(0x8004016BL) -#define CS_E_NETWORK_ERROR _HRESULT_TYPEDEF_(0x8004016CL) -#define CS_E_ADMIN_LIMIT_EXCEEDED _HRESULT_TYPEDEF_(0x8004016DL) -#define CS_E_SCHEMA_MISMATCH _HRESULT_TYPEDEF_(0x8004016EL) -#define CS_E_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x8004016FL) -#define CACHE_E_FIRST 0x80040170L -#define CACHE_E_LAST 0x8004017FL -#define CACHE_S_FIRST 0x00040170L -#define CACHE_S_LAST 0x0004017FL -#define CACHE_E_NOCACHE_UPDATED _HRESULT_TYPEDEF_(0x80040170L) -#define OLEOBJ_E_FIRST 0x80040180L -#define OLEOBJ_E_LAST 0x8004018FL -#define OLEOBJ_S_FIRST 0x00040180L -#define OLEOBJ_S_LAST 0x0004018FL -#define OLEOBJ_E_NOVERBS _HRESULT_TYPEDEF_(0x80040180L) -#define OLEOBJ_E_INVALIDVERB _HRESULT_TYPEDEF_(0x80040181L) -#define CLIENTSITE_E_FIRST 0x80040190L -#define CLIENTSITE_E_LAST 0x8004019FL -#define CLIENTSITE_S_FIRST 0x00040190L -#define CLIENTSITE_S_LAST 0x0004019FL -#define INPLACE_E_NOTUNDOABLE _HRESULT_TYPEDEF_(0x800401A0L) -#define INPLACE_E_NOTOOLSPACE _HRESULT_TYPEDEF_(0x800401A1L) -#define INPLACE_E_FIRST 0x800401A0L -#define INPLACE_E_LAST 0x800401AFL -#define INPLACE_S_FIRST 0x000401A0L -#define INPLACE_S_LAST 0x000401AFL -#define ENUM_E_FIRST 0x800401B0L -#define ENUM_E_LAST 0x800401BFL -#define ENUM_S_FIRST 0x000401B0L -#define ENUM_S_LAST 0x000401BFL -#define CONVERT10_E_FIRST 0x800401C0L -#define CONVERT10_E_LAST 0x800401CFL -#define CONVERT10_S_FIRST 0x000401C0L -#define CONVERT10_S_LAST 0x000401CFL -#define CONVERT10_E_OLESTREAM_GET _HRESULT_TYPEDEF_(0x800401C0L) -#define CONVERT10_E_OLESTREAM_PUT _HRESULT_TYPEDEF_(0x800401C1L) -#define CONVERT10_E_OLESTREAM_FMT _HRESULT_TYPEDEF_(0x800401C2L) -#define CONVERT10_E_OLESTREAM_BITMAP_TO_DIB _HRESULT_TYPEDEF_(0x800401C3L) -#define CONVERT10_E_STG_FMT _HRESULT_TYPEDEF_(0x800401C4L) -#define CONVERT10_E_STG_NO_STD_STREAM _HRESULT_TYPEDEF_(0x800401C5L) -#define CONVERT10_E_STG_DIB_TO_BITMAP _HRESULT_TYPEDEF_(0x800401C6L) -#define CLIPBRD_E_FIRST 0x800401D0L -#define CLIPBRD_E_LAST 0x800401DFL -#define CLIPBRD_S_FIRST 0x000401D0L -#define CLIPBRD_S_LAST 0x000401DFL -#define CLIPBRD_E_CANT_OPEN _HRESULT_TYPEDEF_(0x800401D0L) -#define CLIPBRD_E_CANT_EMPTY _HRESULT_TYPEDEF_(0x800401D1L) -#define CLIPBRD_E_CANT_SET _HRESULT_TYPEDEF_(0x800401D2L) -#define CLIPBRD_E_BAD_DATA _HRESULT_TYPEDEF_(0x800401D3L) -#define CLIPBRD_E_CANT_CLOSE _HRESULT_TYPEDEF_(0x800401D4L) -#define MK_E_FIRST 0x800401E0L -#define MK_E_LAST 0x800401EFL -#define MK_S_FIRST 0x000401E0L -#define MK_S_LAST 0x000401EFL -#define MK_E_CONNECTMANUALLY _HRESULT_TYPEDEF_(0x800401E0L) -#define MK_E_EXCEEDEDDEADLINE _HRESULT_TYPEDEF_(0x800401E1L) -#define MK_E_NEEDGENERIC _HRESULT_TYPEDEF_(0x800401E2L) -#define MK_E_UNAVAILABLE _HRESULT_TYPEDEF_(0x800401E3L) -#define MK_E_SYNTAX _HRESULT_TYPEDEF_(0x800401E4L) -#define MK_E_NOOBJECT _HRESULT_TYPEDEF_(0x800401E5L) -#define MK_E_INVALIDEXTENSION _HRESULT_TYPEDEF_(0x800401E6L) -#define MK_E_INTERMEDIATEINTERFACENOTSUPPORTED _HRESULT_TYPEDEF_(0x800401E7L) -#define MK_E_NOTBINDABLE _HRESULT_TYPEDEF_(0x800401E8L) -#define MK_E_NOTBOUND _HRESULT_TYPEDEF_(0x800401E9L) -#define MK_E_CANTOPENFILE _HRESULT_TYPEDEF_(0x800401EAL) -#define MK_E_MUSTBOTHERUSER _HRESULT_TYPEDEF_(0x800401EBL) -#define MK_E_NOINVERSE _HRESULT_TYPEDEF_(0x800401ECL) -#define MK_E_NOSTORAGE _HRESULT_TYPEDEF_(0x800401EDL) -#define MK_E_NOPREFIX _HRESULT_TYPEDEF_(0x800401EEL) -#define MK_E_ENUMERATION_FAILED _HRESULT_TYPEDEF_(0x800401EFL) -#define CO_E_FIRST 0x800401F0L -#define CO_E_LAST 0x800401FFL -#define CO_S_FIRST 0x000401F0L -#define CO_S_LAST 0x000401FFL -#define CO_E_NOTINITIALIZED _HRESULT_TYPEDEF_(0x800401F0L) -#define CO_E_ALREADYINITIALIZED _HRESULT_TYPEDEF_(0x800401F1L) -#define CO_E_CANTDETERMINECLASS _HRESULT_TYPEDEF_(0x800401F2L) -#define CO_E_CLASSSTRING _HRESULT_TYPEDEF_(0x800401F3L) -#define CO_E_IIDSTRING _HRESULT_TYPEDEF_(0x800401F4L) -#define CO_E_APPNOTFOUND _HRESULT_TYPEDEF_(0x800401F5L) -#define CO_E_APPSINGLEUSE _HRESULT_TYPEDEF_(0x800401F6L) -#define CO_E_ERRORINAPP _HRESULT_TYPEDEF_(0x800401F7L) -#define CO_E_DLLNOTFOUND _HRESULT_TYPEDEF_(0x800401F8L) -#define CO_E_ERRORINDLL _HRESULT_TYPEDEF_(0x800401F9L) -#define CO_E_WRONGOSFORAPP _HRESULT_TYPEDEF_(0x800401FAL) -#define CO_E_OBJNOTREG _HRESULT_TYPEDEF_(0x800401FBL) -#define CO_E_OBJISREG _HRESULT_TYPEDEF_(0x800401FCL) -#define CO_E_OBJNOTCONNECTED _HRESULT_TYPEDEF_(0x800401FDL) -#define CO_E_APPDIDNTREG _HRESULT_TYPEDEF_(0x800401FEL) -#define CO_E_RELEASED _HRESULT_TYPEDEF_(0x800401FFL) -#define EVENT_E_FIRST 0x80040200L -#define EVENT_E_LAST 0x8004021FL -#define EVENT_S_FIRST 0x00040200L -#define EVENT_S_LAST 0x0004021FL -#define EVENT_S_SOME_SUBSCRIBERS_FAILED _HRESULT_TYPEDEF_(0x00040200L) -#define EVENT_E_ALL_SUBSCRIBERS_FAILED _HRESULT_TYPEDEF_(0x80040201L) -#define EVENT_S_NOSUBSCRIBERS _HRESULT_TYPEDEF_(0x00040202L) -#define EVENT_E_QUERYSYNTAX _HRESULT_TYPEDEF_(0x80040203L) -#define EVENT_E_QUERYFIELD _HRESULT_TYPEDEF_(0x80040204L) -#define EVENT_E_INTERNALEXCEPTION _HRESULT_TYPEDEF_(0x80040205L) -#define EVENT_E_INTERNALERROR _HRESULT_TYPEDEF_(0x80040206L) -#define EVENT_E_INVALID_PER_USER_SID _HRESULT_TYPEDEF_(0x80040207L) -#define EVENT_E_USER_EXCEPTION _HRESULT_TYPEDEF_(0x80040208L) -#define EVENT_E_TOO_MANY_METHODS _HRESULT_TYPEDEF_(0x80040209L) -#define EVENT_E_MISSING_EVENTCLASS _HRESULT_TYPEDEF_(0x8004020AL) -#define EVENT_E_NOT_ALL_REMOVED _HRESULT_TYPEDEF_(0x8004020BL) -#define EVENT_E_COMPLUS_NOT_INSTALLED _HRESULT_TYPEDEF_(0x8004020CL) -#define EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020DL) -#define EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT _HRESULT_TYPEDEF_(0x8004020EL) -#define EVENT_E_INVALID_EVENT_CLASS_PARTITION _HRESULT_TYPEDEF_(0x8004020FL) -#define EVENT_E_PER_USER_SID_NOT_LOGGED_ON _HRESULT_TYPEDEF_(0x80040210L) -#define XACT_E_FIRST 0x8004D000 -#define XACT_E_LAST 0x8004D029 -#define XACT_S_FIRST 0x0004D000 -#define XACT_S_LAST 0x0004D010 -#define XACT_E_ALREADYOTHERSINGLEPHASE _HRESULT_TYPEDEF_(0x8004D000L) -#define XACT_E_CANTRETAIN _HRESULT_TYPEDEF_(0x8004D001L) -#define XACT_E_COMMITFAILED _HRESULT_TYPEDEF_(0x8004D002L) -#define XACT_E_COMMITPREVENTED _HRESULT_TYPEDEF_(0x8004D003L) -#define XACT_E_HEURISTICABORT _HRESULT_TYPEDEF_(0x8004D004L) -#define XACT_E_HEURISTICCOMMIT _HRESULT_TYPEDEF_(0x8004D005L) -#define XACT_E_HEURISTICDAMAGE _HRESULT_TYPEDEF_(0x8004D006L) -#define XACT_E_HEURISTICDANGER _HRESULT_TYPEDEF_(0x8004D007L) -#define XACT_E_ISOLATIONLEVEL _HRESULT_TYPEDEF_(0x8004D008L) -#define XACT_E_NOASYNC _HRESULT_TYPEDEF_(0x8004D009L) -#define XACT_E_NOENLIST _HRESULT_TYPEDEF_(0x8004D00AL) -#define XACT_E_NOISORETAIN _HRESULT_TYPEDEF_(0x8004D00BL) -#define XACT_E_NORESOURCE _HRESULT_TYPEDEF_(0x8004D00CL) -#define XACT_E_NOTCURRENT _HRESULT_TYPEDEF_(0x8004D00DL) -#define XACT_E_NOTRANSACTION _HRESULT_TYPEDEF_(0x8004D00EL) -#define XACT_E_NOTSUPPORTED _HRESULT_TYPEDEF_(0x8004D00FL) -#define XACT_E_UNKNOWNRMGRID _HRESULT_TYPEDEF_(0x8004D010L) -#define XACT_E_WRONGSTATE _HRESULT_TYPEDEF_(0x8004D011L) -#define XACT_E_WRONGUOW _HRESULT_TYPEDEF_(0x8004D012L) -#define XACT_E_XTIONEXISTS _HRESULT_TYPEDEF_(0x8004D013L) -#define XACT_E_NOIMPORTOBJECT _HRESULT_TYPEDEF_(0x8004D014L) -#define XACT_E_INVALIDCOOKIE _HRESULT_TYPEDEF_(0x8004D015L) -#define XACT_E_INDOUBT _HRESULT_TYPEDEF_(0x8004D016L) -#define XACT_E_NOTIMEOUT _HRESULT_TYPEDEF_(0x8004D017L) -#define XACT_E_ALREADYINPROGRESS _HRESULT_TYPEDEF_(0x8004D018L) -#define XACT_E_ABORTED _HRESULT_TYPEDEF_(0x8004D019L) -#define XACT_E_LOGFULL _HRESULT_TYPEDEF_(0x8004D01AL) -#define XACT_E_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004D01BL) -#define XACT_E_CONNECTION_DOWN _HRESULT_TYPEDEF_(0x8004D01CL) -#define XACT_E_CONNECTION_DENIED _HRESULT_TYPEDEF_(0x8004D01DL) -#define XACT_E_REENLISTTIMEOUT _HRESULT_TYPEDEF_(0x8004D01EL) -#define XACT_E_TIP_CONNECT_FAILED _HRESULT_TYPEDEF_(0x8004D01FL) -#define XACT_E_TIP_PROTOCOL_ERROR _HRESULT_TYPEDEF_(0x8004D020L) -#define XACT_E_TIP_PULL_FAILED _HRESULT_TYPEDEF_(0x8004D021L) -#define XACT_E_DEST_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004D022L) -#define XACT_E_TIP_DISABLED _HRESULT_TYPEDEF_(0x8004D023L) -#define XACT_E_NETWORK_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D024L) -#define XACT_E_PARTNER_NETWORK_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D025L) -#define XACT_E_XA_TX_DISABLED _HRESULT_TYPEDEF_(0x8004D026L) -#define XACT_E_UNABLE_TO_READ_DTC_CONFIG _HRESULT_TYPEDEF_(0x8004D027L) -#define XACT_E_UNABLE_TO_LOAD_DTC_PROXY _HRESULT_TYPEDEF_(0x8004D028L) -#define XACT_E_ABORTING _HRESULT_TYPEDEF_(0x8004D029L) -#define XACT_E_CLERKNOTFOUND _HRESULT_TYPEDEF_(0x8004D080L) -#define XACT_E_CLERKEXISTS _HRESULT_TYPEDEF_(0x8004D081L) -#define XACT_E_RECOVERYINPROGRESS _HRESULT_TYPEDEF_(0x8004D082L) -#define XACT_E_TRANSACTIONCLOSED _HRESULT_TYPEDEF_(0x8004D083L) -#define XACT_E_INVALIDLSN _HRESULT_TYPEDEF_(0x8004D084L) -#define XACT_E_REPLAYREQUEST _HRESULT_TYPEDEF_(0x8004D085L) -#define XACT_S_ASYNC _HRESULT_TYPEDEF_(0x0004D000L) -#define XACT_S_DEFECT _HRESULT_TYPEDEF_(0x0004D001L) -#define XACT_S_READONLY _HRESULT_TYPEDEF_(0x0004D002L) -#define XACT_S_SOMENORETAIN _HRESULT_TYPEDEF_(0x0004D003L) -#define XACT_S_OKINFORM _HRESULT_TYPEDEF_(0x0004D004L) -#define XACT_S_MADECHANGESCONTENT _HRESULT_TYPEDEF_(0x0004D005L) -#define XACT_S_MADECHANGESINFORM _HRESULT_TYPEDEF_(0x0004D006L) -#define XACT_S_ALLNORETAIN _HRESULT_TYPEDEF_(0x0004D007L) -#define XACT_S_ABORTING _HRESULT_TYPEDEF_(0x0004D008L) -#define XACT_S_SINGLEPHASE _HRESULT_TYPEDEF_(0x0004D009L) -#define XACT_S_LOCALLY_OK _HRESULT_TYPEDEF_(0x0004D00AL) -#define XACT_S_LASTRESOURCEMANAGER _HRESULT_TYPEDEF_(0x0004D010L) -#define CONTEXT_E_FIRST 0x8004E000L -#define CONTEXT_E_LAST 0x8004E02FL -#define CONTEXT_S_FIRST 0x0004E000L -#define CONTEXT_S_LAST 0x0004E02FL -#define CONTEXT_E_ABORTED _HRESULT_TYPEDEF_(0x8004E002L) -#define CONTEXT_E_ABORTING _HRESULT_TYPEDEF_(0x8004E003L) -#define CONTEXT_E_NOCONTEXT _HRESULT_TYPEDEF_(0x8004E004L) -#define CONTEXT_E_WOULD_DEADLOCK _HRESULT_TYPEDEF_(0x8004E005L) -#define CONTEXT_E_SYNCH_TIMEOUT _HRESULT_TYPEDEF_(0x8004E006L) -#define CONTEXT_E_OLDREF _HRESULT_TYPEDEF_(0x8004E007L) -#define CONTEXT_E_ROLENOTFOUND _HRESULT_TYPEDEF_(0x8004E00CL) -#define CONTEXT_E_TMNOTAVAILABLE _HRESULT_TYPEDEF_(0x8004E00FL) -#define CO_E_ACTIVATIONFAILED _HRESULT_TYPEDEF_(0x8004E021L) -#define CO_E_ACTIVATIONFAILED_EVENTLOGGED _HRESULT_TYPEDEF_(0x8004E022L) -#define CO_E_ACTIVATIONFAILED_CATALOGERROR _HRESULT_TYPEDEF_(0x8004E023L) -#define CO_E_ACTIVATIONFAILED_TIMEOUT _HRESULT_TYPEDEF_(0x8004E024L) -#define CO_E_INITIALIZATIONFAILED _HRESULT_TYPEDEF_(0x8004E025L) -#define CONTEXT_E_NOJIT _HRESULT_TYPEDEF_(0x8004E026L) -#define CONTEXT_E_NOTRANSACTION _HRESULT_TYPEDEF_(0x8004E027L) -#define CO_E_THREADINGMODEL_CHANGED _HRESULT_TYPEDEF_(0x8004E028L) -#define CO_E_NOIISINTRINSICS _HRESULT_TYPEDEF_(0x8004E029L) -#define CO_E_NOCOOKIES _HRESULT_TYPEDEF_(0x8004E02AL) -#define CO_E_DBERROR _HRESULT_TYPEDEF_(0x8004E02BL) -#define CO_E_NOTPOOLED _HRESULT_TYPEDEF_(0x8004E02CL) -#define CO_E_NOTCONSTRUCTED _HRESULT_TYPEDEF_(0x8004E02DL) -#define CO_E_NOSYNCHRONIZATION _HRESULT_TYPEDEF_(0x8004E02EL) -#define CO_E_ISOLEVELMISMATCH _HRESULT_TYPEDEF_(0x8004E02FL) -#define OLE_S_USEREG _HRESULT_TYPEDEF_(0x00040000L) -#define OLE_S_STATIC _HRESULT_TYPEDEF_(0x00040001L) -#define OLE_S_MAC_CLIPFORMAT _HRESULT_TYPEDEF_(0x00040002L) -#define DRAGDROP_S_DROP _HRESULT_TYPEDEF_(0x00040100L) -#define DRAGDROP_S_CANCEL _HRESULT_TYPEDEF_(0x00040101L) -#define DRAGDROP_S_USEDEFAULTCURSORS _HRESULT_TYPEDEF_(0x00040102L) -#define DATA_S_SAMEFORMATETC _HRESULT_TYPEDEF_(0x00040130L) -#define VIEW_S_ALREADY_FROZEN _HRESULT_TYPEDEF_(0x00040140L) -#define CACHE_S_FORMATETC_NOTSUPPORTED _HRESULT_TYPEDEF_(0x00040170L) -#define CACHE_S_SAMECACHE _HRESULT_TYPEDEF_(0x00040171L) -#define CACHE_S_SOMECACHES_NOTUPDATED _HRESULT_TYPEDEF_(0x00040172L) -#define OLEOBJ_S_INVALIDVERB _HRESULT_TYPEDEF_(0x00040180L) -#define OLEOBJ_S_CANNOT_DOVERB_NOW _HRESULT_TYPEDEF_(0x00040181L) -#define OLEOBJ_S_INVALIDHWND _HRESULT_TYPEDEF_(0x00040182L) -#define INPLACE_S_TRUNCATED _HRESULT_TYPEDEF_(0x000401A0L) -#define CONVERT10_S_NO_PRESENTATION _HRESULT_TYPEDEF_(0x000401C0L) -#define MK_S_REDUCED_TO_SELF _HRESULT_TYPEDEF_(0x000401E2L) -#define MK_S_ME _HRESULT_TYPEDEF_(0x000401E4L) -#define MK_S_HIM _HRESULT_TYPEDEF_(0x000401E5L) -#define MK_S_US _HRESULT_TYPEDEF_(0x000401E6L) -#define MK_S_MONIKERALREADYREGISTERED _HRESULT_TYPEDEF_(0x000401E7L) -#define SCHED_S_TASK_READY _HRESULT_TYPEDEF_(0x00041300L) -#define SCHED_S_TASK_RUNNING _HRESULT_TYPEDEF_(0x00041301L) -#define SCHED_S_TASK_DISABLED _HRESULT_TYPEDEF_(0x00041302L) -#define SCHED_S_TASK_HAS_NOT_RUN _HRESULT_TYPEDEF_(0x00041303L) -#define SCHED_S_TASK_NO_MORE_RUNS _HRESULT_TYPEDEF_(0x00041304L) -#define SCHED_S_TASK_NOT_SCHEDULED _HRESULT_TYPEDEF_(0x00041305L) -#define SCHED_S_TASK_TERMINATED _HRESULT_TYPEDEF_(0x00041306L) -#define SCHED_S_TASK_NO_VALID_TRIGGERS _HRESULT_TYPEDEF_(0x00041307L) -#define SCHED_S_EVENT_TRIGGER _HRESULT_TYPEDEF_(0x00041308L) -#define SCHED_E_TRIGGER_NOT_FOUND _HRESULT_TYPEDEF_(0x80041309L) -#define SCHED_E_TASK_NOT_READY _HRESULT_TYPEDEF_(0x8004130AL) -#define SCHED_E_TASK_NOT_RUNNING _HRESULT_TYPEDEF_(0x8004130BL) -#define SCHED_E_SERVICE_NOT_INSTALLED _HRESULT_TYPEDEF_(0x8004130CL) -#define SCHED_E_CANNOT_OPEN_TASK _HRESULT_TYPEDEF_(0x8004130DL) -#define SCHED_E_INVALID_TASK _HRESULT_TYPEDEF_(0x8004130EL) -#define SCHED_E_ACCOUNT_INFORMATION_NOT_SET _HRESULT_TYPEDEF_(0x8004130FL) -#define SCHED_E_ACCOUNT_NAME_NOT_FOUND _HRESULT_TYPEDEF_(0x80041310L) -#define SCHED_E_ACCOUNT_DBASE_CORRUPT _HRESULT_TYPEDEF_(0x80041311L) -#define SCHED_E_NO_SECURITY_SERVICES _HRESULT_TYPEDEF_(0x80041312L) -#define SCHED_E_UNKNOWN_OBJECT_VERSION _HRESULT_TYPEDEF_(0x80041313L) -#define SCHED_E_UNSUPPORTED_ACCOUNT_OPTION _HRESULT_TYPEDEF_(0x80041314L) -#define SCHED_E_SERVICE_NOT_RUNNING _HRESULT_TYPEDEF_(0x80041315L) -#define CO_E_CLASS_CREATE_FAILED _HRESULT_TYPEDEF_(0x80080001L) -#define CO_E_SCM_ERROR _HRESULT_TYPEDEF_(0x80080002L) -#define CO_E_SCM_RPC_FAILURE _HRESULT_TYPEDEF_(0x80080003L) -#define CO_E_BAD_PATH _HRESULT_TYPEDEF_(0x80080004L) -#define CO_E_SERVER_EXEC_FAILURE _HRESULT_TYPEDEF_(0x80080005L) -#define CO_E_OBJSRV_RPC_FAILURE _HRESULT_TYPEDEF_(0x80080006L) -#define MK_E_NO_NORMALIZED _HRESULT_TYPEDEF_(0x80080007L) -#define CO_E_SERVER_STOPPING _HRESULT_TYPEDEF_(0x80080008L) -#define MEM_E_INVALID_ROOT _HRESULT_TYPEDEF_(0x80080009L) -#define MEM_E_INVALID_LINK _HRESULT_TYPEDEF_(0x80080010L) -#define MEM_E_INVALID_SIZE _HRESULT_TYPEDEF_(0x80080011L) -#define CO_S_NOTALLINTERFACES _HRESULT_TYPEDEF_(0x00080012L) -#define CO_S_MACHINENAMENOTFOUND _HRESULT_TYPEDEF_(0x00080013L) -#define DISP_E_UNKNOWNINTERFACE _HRESULT_TYPEDEF_(0x80020001L) -#define DISP_E_MEMBERNOTFOUND _HRESULT_TYPEDEF_(0x80020003L) -#define DISP_E_PARAMNOTFOUND _HRESULT_TYPEDEF_(0x80020004L) -#define DISP_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80020005L) -#define DISP_E_UNKNOWNNAME _HRESULT_TYPEDEF_(0x80020006L) -#define DISP_E_NONAMEDARGS _HRESULT_TYPEDEF_(0x80020007L) -#define DISP_E_BADVARTYPE _HRESULT_TYPEDEF_(0x80020008L) -#define DISP_E_EXCEPTION _HRESULT_TYPEDEF_(0x80020009L) -#define DISP_E_OVERFLOW _HRESULT_TYPEDEF_(0x8002000AL) -#define DISP_E_BADINDEX _HRESULT_TYPEDEF_(0x8002000BL) -#define DISP_E_UNKNOWNLCID _HRESULT_TYPEDEF_(0x8002000CL) -#define DISP_E_ARRAYISLOCKED _HRESULT_TYPEDEF_(0x8002000DL) -#define DISP_E_BADPARAMCOUNT _HRESULT_TYPEDEF_(0x8002000EL) -#define DISP_E_PARAMNOTOPTIONAL _HRESULT_TYPEDEF_(0x8002000FL) -#define DISP_E_BADCALLEE _HRESULT_TYPEDEF_(0x80020010L) -#define DISP_E_NOTACOLLECTION _HRESULT_TYPEDEF_(0x80020011L) -#define DISP_E_DIVBYZERO _HRESULT_TYPEDEF_(0x80020012L) -#define DISP_E_BUFFERTOOSMALL _HRESULT_TYPEDEF_(0x80020013L) -#define TYPE_E_BUFFERTOOSMALL _HRESULT_TYPEDEF_(0x80028016L) -#define TYPE_E_FIELDNOTFOUND _HRESULT_TYPEDEF_(0x80028017L) -#define TYPE_E_INVDATAREAD _HRESULT_TYPEDEF_(0x80028018L) -#define TYPE_E_UNSUPFORMAT _HRESULT_TYPEDEF_(0x80028019L) -#define TYPE_E_REGISTRYACCESS _HRESULT_TYPEDEF_(0x8002801CL) -#define TYPE_E_LIBNOTREGISTERED _HRESULT_TYPEDEF_(0x8002801DL) -#define TYPE_E_UNDEFINEDTYPE _HRESULT_TYPEDEF_(0x80028027L) -#define TYPE_E_QUALIFIEDNAMEDISALLOWED _HRESULT_TYPEDEF_(0x80028028L) -#define TYPE_E_INVALIDSTATE _HRESULT_TYPEDEF_(0x80028029L) -#define TYPE_E_WRONGTYPEKIND _HRESULT_TYPEDEF_(0x8002802AL) -#define TYPE_E_ELEMENTNOTFOUND _HRESULT_TYPEDEF_(0x8002802BL) -#define TYPE_E_AMBIGUOUSNAME _HRESULT_TYPEDEF_(0x8002802CL) -#define TYPE_E_NAMECONFLICT _HRESULT_TYPEDEF_(0x8002802DL) -#define TYPE_E_UNKNOWNLCID _HRESULT_TYPEDEF_(0x8002802EL) -#define TYPE_E_DLLFUNCTIONNOTFOUND _HRESULT_TYPEDEF_(0x8002802FL) -#define TYPE_E_BADMODULEKIND _HRESULT_TYPEDEF_(0x800288BDL) -#define TYPE_E_SIZETOOBIG _HRESULT_TYPEDEF_(0x800288C5L) -#define TYPE_E_DUPLICATEID _HRESULT_TYPEDEF_(0x800288C6L) -#define TYPE_E_INVALIDID _HRESULT_TYPEDEF_(0x800288CFL) -#define TYPE_E_TYPEMISMATCH _HRESULT_TYPEDEF_(0x80028CA0L) -#define TYPE_E_OUTOFBOUNDS _HRESULT_TYPEDEF_(0x80028CA1L) -#define TYPE_E_IOERROR _HRESULT_TYPEDEF_(0x80028CA2L) -#define TYPE_E_CANTCREATETMPFILE _HRESULT_TYPEDEF_(0x80028CA3L) -#define TYPE_E_CANTLOADLIBRARY _HRESULT_TYPEDEF_(0x80029C4AL) -#define TYPE_E_INCONSISTENTPROPFUNCS _HRESULT_TYPEDEF_(0x80029C83L) -#define TYPE_E_CIRCULARTYPE _HRESULT_TYPEDEF_(0x80029C84L) -#define STG_E_INVALIDFUNCTION _HRESULT_TYPEDEF_(0x80030001L) -#define STG_E_FILENOTFOUND _HRESULT_TYPEDEF_(0x80030002L) -#define STG_E_PATHNOTFOUND _HRESULT_TYPEDEF_(0x80030003L) -#define STG_E_TOOMANYOPENFILES _HRESULT_TYPEDEF_(0x80030004L) -#define STG_E_ACCESSDENIED _HRESULT_TYPEDEF_(0x80030005L) -#define STG_E_INVALIDHANDLE _HRESULT_TYPEDEF_(0x80030006L) -#define STG_E_INSUFFICIENTMEMORY _HRESULT_TYPEDEF_(0x80030008L) -#define STG_E_INVALIDPOINTER _HRESULT_TYPEDEF_(0x80030009L) -#define STG_E_NOMOREFILES _HRESULT_TYPEDEF_(0x80030012L) -#define STG_E_DISKISWRITEPROTECTED _HRESULT_TYPEDEF_(0x80030013L) -#define STG_E_SEEKERROR _HRESULT_TYPEDEF_(0x80030019L) -#define STG_E_WRITEFAULT _HRESULT_TYPEDEF_(0x8003001DL) -#define STG_E_READFAULT _HRESULT_TYPEDEF_(0x8003001EL) -#define STG_E_SHAREVIOLATION _HRESULT_TYPEDEF_(0x80030020L) -#define STG_E_LOCKVIOLATION _HRESULT_TYPEDEF_(0x80030021L) -#define STG_E_FILEALREADYEXISTS _HRESULT_TYPEDEF_(0x80030050L) -#define STG_E_INVALIDPARAMETER _HRESULT_TYPEDEF_(0x80030057L) -#define STG_E_MEDIUMFULL _HRESULT_TYPEDEF_(0x80030070L) -#define STG_E_PROPSETMISMATCHED _HRESULT_TYPEDEF_(0x800300F0L) -#define STG_E_ABNORMALAPIEXIT _HRESULT_TYPEDEF_(0x800300FAL) -#define STG_E_INVALIDHEADER _HRESULT_TYPEDEF_(0x800300FBL) -#define STG_E_INVALIDNAME _HRESULT_TYPEDEF_(0x800300FCL) -#define STG_E_UNKNOWN _HRESULT_TYPEDEF_(0x800300FDL) -#define STG_E_UNIMPLEMENTEDFUNCTION _HRESULT_TYPEDEF_(0x800300FEL) -#define STG_E_INVALIDFLAG _HRESULT_TYPEDEF_(0x800300FFL) -#define STG_E_INUSE _HRESULT_TYPEDEF_(0x80030100L) -#define STG_E_NOTCURRENT _HRESULT_TYPEDEF_(0x80030101L) -#define STG_E_REVERTED _HRESULT_TYPEDEF_(0x80030102L) -#define STG_E_CANTSAVE _HRESULT_TYPEDEF_(0x80030103L) -#define STG_E_OLDFORMAT _HRESULT_TYPEDEF_(0x80030104L) -#define STG_E_OLDDLL _HRESULT_TYPEDEF_(0x80030105L) -#define STG_E_SHAREREQUIRED _HRESULT_TYPEDEF_(0x80030106L) -#define STG_E_NOTFILEBASEDSTORAGE _HRESULT_TYPEDEF_(0x80030107L) -#define STG_E_EXTANTMARSHALLINGS _HRESULT_TYPEDEF_(0x80030108L) -#define STG_E_DOCFILECORRUPT _HRESULT_TYPEDEF_(0x80030109L) -#define STG_E_BADBASEADDRESS _HRESULT_TYPEDEF_(0x80030110L) -#define STG_E_DOCFILETOOLARGE _HRESULT_TYPEDEF_(0x80030111L) -#define STG_E_NOTSIMPLEFORMAT _HRESULT_TYPEDEF_(0x80030112L) -#define STG_E_INCOMPLETE _HRESULT_TYPEDEF_(0x80030201L) -#define STG_E_TERMINATED _HRESULT_TYPEDEF_(0x80030202L) -#define STG_S_CONVERTED _HRESULT_TYPEDEF_(0x00030200L) -#define STG_S_BLOCK _HRESULT_TYPEDEF_(0x00030201L) -#define STG_S_RETRYNOW _HRESULT_TYPEDEF_(0x00030202L) -#define STG_S_MONITORING _HRESULT_TYPEDEF_(0x00030203L) -#define STG_S_MULTIPLEOPENS _HRESULT_TYPEDEF_(0x00030204L) -#define STG_S_CONSOLIDATIONFAILED _HRESULT_TYPEDEF_(0x00030205L) -#define STG_S_CANNOTCONSOLIDATE _HRESULT_TYPEDEF_(0x00030206L) -#define STG_E_STATUS_COPY_PROTECTION_FAILURE _HRESULT_TYPEDEF_(0x80030305L) -#define STG_E_CSS_AUTHENTICATION_FAILURE _HRESULT_TYPEDEF_(0x80030306L) -#define STG_E_CSS_KEY_NOT_PRESENT _HRESULT_TYPEDEF_(0x80030307L) -#define STG_E_CSS_KEY_NOT_ESTABLISHED _HRESULT_TYPEDEF_(0x80030308L) -#define STG_E_CSS_SCRAMBLED_SECTOR _HRESULT_TYPEDEF_(0x80030309L) -#define STG_E_CSS_REGION_MISMATCH _HRESULT_TYPEDEF_(0x8003030AL) -#define STG_E_RESETS_EXHAUSTED _HRESULT_TYPEDEF_(0x8003030BL) -#define RPC_E_CALL_REJECTED _HRESULT_TYPEDEF_(0x80010001L) -#define RPC_E_CALL_CANCELED _HRESULT_TYPEDEF_(0x80010002L) -#define RPC_E_CANTPOST_INSENDCALL _HRESULT_TYPEDEF_(0x80010003L) -#define RPC_E_CANTCALLOUT_INASYNCCALL _HRESULT_TYPEDEF_(0x80010004L) -#define RPC_E_CANTCALLOUT_INEXTERNALCALL _HRESULT_TYPEDEF_(0x80010005L) -#define RPC_E_CONNECTION_TERMINATED _HRESULT_TYPEDEF_(0x80010006L) -#define RPC_E_SERVER_DIED _HRESULT_TYPEDEF_(0x80010007L) -#define RPC_E_CLIENT_DIED _HRESULT_TYPEDEF_(0x80010008L) -#define RPC_E_INVALID_DATAPACKET _HRESULT_TYPEDEF_(0x80010009L) -#define RPC_E_CANTTRANSMIT_CALL _HRESULT_TYPEDEF_(0x8001000AL) -#define RPC_E_CLIENT_CANTMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000BL) -#define RPC_E_CLIENT_CANTUNMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000CL) -#define RPC_E_SERVER_CANTMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000DL) -#define RPC_E_SERVER_CANTUNMARSHAL_DATA _HRESULT_TYPEDEF_(0x8001000EL) -#define RPC_E_INVALID_DATA _HRESULT_TYPEDEF_(0x8001000FL) -#define RPC_E_INVALID_PARAMETER _HRESULT_TYPEDEF_(0x80010010L) -#define RPC_E_CANTCALLOUT_AGAIN _HRESULT_TYPEDEF_(0x80010011L) -#define RPC_E_SERVER_DIED_DNE _HRESULT_TYPEDEF_(0x80010012L) -#define RPC_E_SYS_CALL_FAILED _HRESULT_TYPEDEF_(0x80010100L) -#define RPC_E_OUT_OF_RESOURCES _HRESULT_TYPEDEF_(0x80010101L) -#define RPC_E_ATTEMPTED_MULTITHREAD _HRESULT_TYPEDEF_(0x80010102L) -#define RPC_E_NOT_REGISTERED _HRESULT_TYPEDEF_(0x80010103L) -#define RPC_E_FAULT _HRESULT_TYPEDEF_(0x80010104L) -#define RPC_E_SERVERFAULT _HRESULT_TYPEDEF_(0x80010105L) -#define RPC_E_CHANGED_MODE _HRESULT_TYPEDEF_(0x80010106L) -#define RPC_E_INVALIDMETHOD _HRESULT_TYPEDEF_(0x80010107L) -#define RPC_E_DISCONNECTED _HRESULT_TYPEDEF_(0x80010108L) -#define RPC_E_RETRY _HRESULT_TYPEDEF_(0x80010109L) -#define RPC_E_SERVERCALL_RETRYLATER _HRESULT_TYPEDEF_(0x8001010AL) -#define RPC_E_SERVERCALL_REJECTED _HRESULT_TYPEDEF_(0x8001010BL) -#define RPC_E_INVALID_CALLDATA _HRESULT_TYPEDEF_(0x8001010CL) -#define RPC_E_CANTCALLOUT_ININPUTSYNCCALL _HRESULT_TYPEDEF_(0x8001010DL) -#define RPC_E_WRONG_THREAD _HRESULT_TYPEDEF_(0x8001010EL) -#define RPC_E_THREAD_NOT_INIT _HRESULT_TYPEDEF_(0x8001010FL) -#define RPC_E_VERSION_MISMATCH _HRESULT_TYPEDEF_(0x80010110L) -#define RPC_E_INVALID_HEADER _HRESULT_TYPEDEF_(0x80010111L) -#define RPC_E_INVALID_EXTENSION _HRESULT_TYPEDEF_(0x80010112L) -#define RPC_E_INVALID_IPID _HRESULT_TYPEDEF_(0x80010113L) -#define RPC_E_INVALID_OBJECT _HRESULT_TYPEDEF_(0x80010114L) -#define RPC_S_CALLPENDING _HRESULT_TYPEDEF_(0x80010115L) -#define RPC_S_WAITONTIMER _HRESULT_TYPEDEF_(0x80010116L) -#define RPC_E_CALL_COMPLETE _HRESULT_TYPEDEF_(0x80010117L) -#define RPC_E_UNSECURE_CALL _HRESULT_TYPEDEF_(0x80010118L) -#define RPC_E_TOO_LATE _HRESULT_TYPEDEF_(0x80010119L) -#define RPC_E_NO_GOOD_SECURITY_PACKAGES _HRESULT_TYPEDEF_(0x8001011AL) -#define RPC_E_ACCESS_DENIED _HRESULT_TYPEDEF_(0x8001011BL) -#define RPC_E_REMOTE_DISABLED _HRESULT_TYPEDEF_(0x8001011CL) -#define RPC_E_INVALID_OBJREF _HRESULT_TYPEDEF_(0x8001011DL) -#define RPC_E_NO_CONTEXT _HRESULT_TYPEDEF_(0x8001011EL) -#define RPC_E_TIMEOUT _HRESULT_TYPEDEF_(0x8001011FL) -#define RPC_E_NO_SYNC _HRESULT_TYPEDEF_(0x80010120L) -#define RPC_E_FULLSIC_REQUIRED _HRESULT_TYPEDEF_(0x80010121L) -#define RPC_E_INVALID_STD_NAME _HRESULT_TYPEDEF_(0x80010122L) -#define CO_E_FAILEDTOIMPERSONATE _HRESULT_TYPEDEF_(0x80010123L) -#define CO_E_FAILEDTOGETSECCTX _HRESULT_TYPEDEF_(0x80010124L) -#define CO_E_FAILEDTOOPENTHREADTOKEN _HRESULT_TYPEDEF_(0x80010125L) -#define CO_E_FAILEDTOGETTOKENINFO _HRESULT_TYPEDEF_(0x80010126L) -#define CO_E_TRUSTEEDOESNTMATCHCLIENT _HRESULT_TYPEDEF_(0x80010127L) -#define CO_E_FAILEDTOQUERYCLIENTBLANKET _HRESULT_TYPEDEF_(0x80010128L) -#define CO_E_FAILEDTOSETDACL _HRESULT_TYPEDEF_(0x80010129L) -#define CO_E_ACCESSCHECKFAILED _HRESULT_TYPEDEF_(0x8001012AL) -#define CO_E_NETACCESSAPIFAILED _HRESULT_TYPEDEF_(0x8001012BL) -#define CO_E_WRONGTRUSTEENAMESYNTAX _HRESULT_TYPEDEF_(0x8001012CL) -#define CO_E_INVALIDSID _HRESULT_TYPEDEF_(0x8001012DL) -#define CO_E_CONVERSIONFAILED _HRESULT_TYPEDEF_(0x8001012EL) -#define CO_E_NOMATCHINGSIDFOUND _HRESULT_TYPEDEF_(0x8001012FL) -#define CO_E_LOOKUPACCSIDFAILED _HRESULT_TYPEDEF_(0x80010130L) -#define CO_E_NOMATCHINGNAMEFOUND _HRESULT_TYPEDEF_(0x80010131L) -#define CO_E_LOOKUPACCNAMEFAILED _HRESULT_TYPEDEF_(0x80010132L) -#define CO_E_SETSERLHNDLFAILED _HRESULT_TYPEDEF_(0x80010133L) -#define CO_E_FAILEDTOGETWINDIR _HRESULT_TYPEDEF_(0x80010134L) -#define CO_E_PATHTOOLONG _HRESULT_TYPEDEF_(0x80010135L) -#define CO_E_FAILEDTOGENUUID _HRESULT_TYPEDEF_(0x80010136L) -#define CO_E_FAILEDTOCREATEFILE _HRESULT_TYPEDEF_(0x80010137L) -#define CO_E_FAILEDTOCLOSEHANDLE _HRESULT_TYPEDEF_(0x80010138L) -#define CO_E_EXCEEDSYSACLLIMIT _HRESULT_TYPEDEF_(0x80010139L) -#define CO_E_ACESINWRONGORDER _HRESULT_TYPEDEF_(0x8001013AL) -#define CO_E_INCOMPATIBLESTREAMVERSION _HRESULT_TYPEDEF_(0x8001013BL) -#define CO_E_FAILEDTOOPENPROCESSTOKEN _HRESULT_TYPEDEF_(0x8001013CL) -#define CO_E_DECODEFAILED _HRESULT_TYPEDEF_(0x8001013DL) -#define CO_E_ACNOTINITIALIZED _HRESULT_TYPEDEF_(0x8001013FL) -#define CO_E_CANCEL_DISABLED _HRESULT_TYPEDEF_(0x80010140L) -#define RPC_E_UNEXPECTED _HRESULT_TYPEDEF_(0x8001FFFFL) -#define ERROR_AUDITING_DISABLED _HRESULT_TYPEDEF_(0xC0090001L) -#define ERROR_ALL_SIDS_FILTERED _HRESULT_TYPEDEF_(0xC0090002L) -#define NTE_BAD_UID _HRESULT_TYPEDEF_(0x80090001L) -#define NTE_BAD_HASH _HRESULT_TYPEDEF_(0x80090002L) -#define NTE_BAD_KEY _HRESULT_TYPEDEF_(0x80090003L) -#define NTE_BAD_LEN _HRESULT_TYPEDEF_(0x80090004L) -#define NTE_BAD_DATA _HRESULT_TYPEDEF_(0x80090005L) -#define NTE_BAD_SIGNATURE _HRESULT_TYPEDEF_(0x80090006L) -#define NTE_BAD_VER _HRESULT_TYPEDEF_(0x80090007L) -#define NTE_BAD_ALGID _HRESULT_TYPEDEF_(0x80090008L) -#define NTE_BAD_FLAGS _HRESULT_TYPEDEF_(0x80090009L) -#define NTE_BAD_TYPE _HRESULT_TYPEDEF_(0x8009000AL) -#define NTE_BAD_KEY_STATE _HRESULT_TYPEDEF_(0x8009000BL) -#define NTE_BAD_HASH_STATE _HRESULT_TYPEDEF_(0x8009000CL) -#define NTE_NO_KEY _HRESULT_TYPEDEF_(0x8009000DL) -#define NTE_NO_MEMORY _HRESULT_TYPEDEF_(0x8009000EL) -#define NTE_EXISTS _HRESULT_TYPEDEF_(0x8009000FL) -#define NTE_PERM _HRESULT_TYPEDEF_(0x80090010L) -#define NTE_NOT_FOUND _HRESULT_TYPEDEF_(0x80090011L) -#define NTE_DOUBLE_ENCRYPT _HRESULT_TYPEDEF_(0x80090012L) -#define NTE_BAD_PROVIDER _HRESULT_TYPEDEF_(0x80090013L) -#define NTE_BAD_PROV_TYPE _HRESULT_TYPEDEF_(0x80090014L) -#define NTE_BAD_PUBLIC_KEY _HRESULT_TYPEDEF_(0x80090015L) -#define NTE_BAD_KEYSET _HRESULT_TYPEDEF_(0x80090016L) -#define NTE_PROV_TYPE_NOT_DEF _HRESULT_TYPEDEF_(0x80090017L) -#define NTE_PROV_TYPE_ENTRY_BAD _HRESULT_TYPEDEF_(0x80090018L) -#define NTE_KEYSET_NOT_DEF _HRESULT_TYPEDEF_(0x80090019L) -#define NTE_KEYSET_ENTRY_BAD _HRESULT_TYPEDEF_(0x8009001AL) -#define NTE_PROV_TYPE_NO_MATCH _HRESULT_TYPEDEF_(0x8009001BL) -#define NTE_SIGNATURE_FILE_BAD _HRESULT_TYPEDEF_(0x8009001CL) -#define NTE_PROVIDER_DLL_FAIL _HRESULT_TYPEDEF_(0x8009001DL) -#define NTE_PROV_DLL_NOT_FOUND _HRESULT_TYPEDEF_(0x8009001EL) -#define NTE_BAD_KEYSET_PARAM _HRESULT_TYPEDEF_(0x8009001FL) -#define NTE_FAIL _HRESULT_TYPEDEF_(0x80090020L) -#define NTE_SYS_ERR _HRESULT_TYPEDEF_(0x80090021L) -#define NTE_SILENT_CONTEXT _HRESULT_TYPEDEF_(0x80090022L) -#define NTE_TOKEN_KEYSET_STORAGE_FULL _HRESULT_TYPEDEF_(0x80090023L) -#define NTE_TEMPORARY_PROFILE _HRESULT_TYPEDEF_(0x80090024L) -#define NTE_FIXEDPARAMETER _HRESULT_TYPEDEF_(0x80090025L) -#define SEC_E_INSUFFICIENT_MEMORY _HRESULT_TYPEDEF_(0x80090300L) -#define SEC_E_INVALID_HANDLE _HRESULT_TYPEDEF_(0x80090301L) -#define SEC_E_UNSUPPORTED_FUNCTION _HRESULT_TYPEDEF_(0x80090302L) -#define SEC_E_TARGET_UNKNOWN _HRESULT_TYPEDEF_(0x80090303L) -#define SEC_E_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x80090304L) -#define SEC_E_SECPKG_NOT_FOUND _HRESULT_TYPEDEF_(0x80090305L) -#define SEC_E_NOT_OWNER _HRESULT_TYPEDEF_(0x80090306L) -#define SEC_E_CANNOT_INSTALL _HRESULT_TYPEDEF_(0x80090307L) -#define SEC_E_INVALID_TOKEN _HRESULT_TYPEDEF_(0x80090308L) -#define SEC_E_CANNOT_PACK _HRESULT_TYPEDEF_(0x80090309L) -#define SEC_E_QOP_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009030AL) -#define SEC_E_NO_IMPERSONATION _HRESULT_TYPEDEF_(0x8009030BL) -#define SEC_E_LOGON_DENIED _HRESULT_TYPEDEF_(0x8009030CL) -#define SEC_E_UNKNOWN_CREDENTIALS _HRESULT_TYPEDEF_(0x8009030DL) -#define SEC_E_NO_CREDENTIALS _HRESULT_TYPEDEF_(0x8009030EL) -#define SEC_E_MESSAGE_ALTERED _HRESULT_TYPEDEF_(0x8009030FL) -#define SEC_E_OUT_OF_SEQUENCE _HRESULT_TYPEDEF_(0x80090310L) -#define SEC_E_NO_AUTHENTICATING_AUTHORITY _HRESULT_TYPEDEF_(0x80090311L) -#define SEC_I_CONTINUE_NEEDED _HRESULT_TYPEDEF_(0x00090312L) -#define SEC_I_COMPLETE_NEEDED _HRESULT_TYPEDEF_(0x00090313L) -#define SEC_I_COMPLETE_AND_CONTINUE _HRESULT_TYPEDEF_(0x00090314L) -#define SEC_I_LOCAL_LOGON _HRESULT_TYPEDEF_(0x00090315L) -#define SEC_E_BAD_PKGID _HRESULT_TYPEDEF_(0x80090316L) -#define SEC_E_CONTEXT_EXPIRED _HRESULT_TYPEDEF_(0x80090317L) -#define SEC_I_CONTEXT_EXPIRED _HRESULT_TYPEDEF_(0x00090317L) -#define SEC_E_INCOMPLETE_MESSAGE _HRESULT_TYPEDEF_(0x80090318L) -#define SEC_E_INCOMPLETE_CREDENTIALS _HRESULT_TYPEDEF_(0x80090320L) -#define SEC_E_BUFFER_TOO_SMALL _HRESULT_TYPEDEF_(0x80090321L) -#define SEC_I_INCOMPLETE_CREDENTIALS _HRESULT_TYPEDEF_(0x00090320L) -#define SEC_I_RENEGOTIATE _HRESULT_TYPEDEF_(0x00090321L) -#define SEC_E_WRONG_PRINCIPAL _HRESULT_TYPEDEF_(0x80090322L) -#define SEC_I_NO_LSA_CONTEXT _HRESULT_TYPEDEF_(0x00090323L) -#define SEC_E_TIME_SKEW _HRESULT_TYPEDEF_(0x80090324L) -#define SEC_E_UNTRUSTED_ROOT _HRESULT_TYPEDEF_(0x80090325L) -#define SEC_E_ILLEGAL_MESSAGE _HRESULT_TYPEDEF_(0x80090326L) -#define SEC_E_CERT_UNKNOWN _HRESULT_TYPEDEF_(0x80090327L) -#define SEC_E_CERT_EXPIRED _HRESULT_TYPEDEF_(0x80090328L) -#define SEC_E_ENCRYPT_FAILURE _HRESULT_TYPEDEF_(0x80090329L) -#define SEC_E_DECRYPT_FAILURE _HRESULT_TYPEDEF_(0x80090330L) -#define SEC_E_ALGORITHM_MISMATCH _HRESULT_TYPEDEF_(0x80090331L) -#define SEC_E_SECURITY_QOS_FAILED _HRESULT_TYPEDEF_(0x80090332L) -#define SEC_E_UNFINISHED_CONTEXT_DELETED _HRESULT_TYPEDEF_(0x80090333L) -#define SEC_E_NO_TGT_REPLY _HRESULT_TYPEDEF_(0x80090334L) -#define SEC_E_NO_IP_ADDRESSES _HRESULT_TYPEDEF_(0x80090335L) -#define SEC_E_WRONG_CREDENTIAL_HANDLE _HRESULT_TYPEDEF_(0x80090336L) -#define SEC_E_CRYPTO_SYSTEM_INVALID _HRESULT_TYPEDEF_(0x80090337L) -#define SEC_E_MAX_REFERRALS_EXCEEDED _HRESULT_TYPEDEF_(0x80090338L) -#define SEC_E_MUST_BE_KDC _HRESULT_TYPEDEF_(0x80090339L) -#define SEC_E_STRONG_CRYPTO_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009033AL) -#define SEC_E_TOO_MANY_PRINCIPALS _HRESULT_TYPEDEF_(0x8009033BL) -#define SEC_E_NO_PA_DATA _HRESULT_TYPEDEF_(0x8009033CL) -#define SEC_E_PKINIT_NAME_MISMATCH _HRESULT_TYPEDEF_(0x8009033DL) -#define SEC_E_SMARTCARD_LOGON_REQUIRED _HRESULT_TYPEDEF_(0x8009033EL) -#define SEC_E_SHUTDOWN_IN_PROGRESS _HRESULT_TYPEDEF_(0x8009033FL) -#define SEC_E_KDC_INVALID_REQUEST _HRESULT_TYPEDEF_(0x80090340L) -#define SEC_E_KDC_UNABLE_TO_REFER _HRESULT_TYPEDEF_(0x80090341L) -#define SEC_E_KDC_UNKNOWN_ETYPE _HRESULT_TYPEDEF_(0x80090342L) -#define SEC_E_UNSUPPORTED_PREAUTH _HRESULT_TYPEDEF_(0x80090343L) -#define SEC_E_DELEGATION_REQUIRED _HRESULT_TYPEDEF_(0x80090345L) -#define SEC_E_BAD_BINDINGS _HRESULT_TYPEDEF_(0x80090346L) -#define SEC_E_MULTIPLE_ACCOUNTS _HRESULT_TYPEDEF_(0x80090347L) -#define SEC_E_NO_KERB_KEY _HRESULT_TYPEDEF_(0x80090348L) -#define SEC_E_CERT_WRONG_USAGE _HRESULT_TYPEDEF_(0x80090349L) -#define SEC_E_DOWNGRADE_DETECTED _HRESULT_TYPEDEF_(0x80090350L) -#define SEC_E_SMARTCARD_CERT_REVOKED _HRESULT_TYPEDEF_(0x80090351L) -#define SEC_E_ISSUING_CA_UNTRUSTED _HRESULT_TYPEDEF_(0x80090352L) -#define SEC_E_REVOCATION_OFFLINE_C _HRESULT_TYPEDEF_(0x80090353L) -#define SEC_E_PKINIT_CLIENT_FAILURE _HRESULT_TYPEDEF_(0x80090354L) -#define SEC_E_SMARTCARD_CERT_EXPIRED _HRESULT_TYPEDEF_(0x80090355L) -#define SEC_E_NO_S4U_PROT_SUPPORT _HRESULT_TYPEDEF_(0x80090356L) -#define SEC_E_CROSSREALM_DELEGATION_FAILURE _HRESULT_TYPEDEF_(0x80090357L) -#define SEC_E_REVOCATION_OFFLINE_KDC _HRESULT_TYPEDEF_(0x80090358L) -#define SEC_E_ISSUING_CA_UNTRUSTED_KDC _HRESULT_TYPEDEF_(0x80090359L) -#define SEC_E_KDC_CERT_EXPIRED _HRESULT_TYPEDEF_(0x8009035AL) -#define SEC_E_KDC_CERT_REVOKED _HRESULT_TYPEDEF_(0x8009035BL) -#define SEC_E_NO_SPM SEC_E_INTERNAL_ERROR -#define SEC_E_NOT_SUPPORTED SEC_E_UNSUPPORTED_FUNCTION -#define CRYPT_E_MSG_ERROR _HRESULT_TYPEDEF_(0x80091001L) -#define CRYPT_E_UNKNOWN_ALGO _HRESULT_TYPEDEF_(0x80091002L) -#define CRYPT_E_OID_FORMAT _HRESULT_TYPEDEF_(0x80091003L) -#define CRYPT_E_INVALID_MSG_TYPE _HRESULT_TYPEDEF_(0x80091004L) -#define CRYPT_E_UNEXPECTED_ENCODING _HRESULT_TYPEDEF_(0x80091005L) -#define CRYPT_E_AUTH_ATTR_MISSING _HRESULT_TYPEDEF_(0x80091006L) -#define CRYPT_E_HASH_VALUE _HRESULT_TYPEDEF_(0x80091007L) -#define CRYPT_E_INVALID_INDEX _HRESULT_TYPEDEF_(0x80091008L) -#define CRYPT_E_ALREADY_DECRYPTED _HRESULT_TYPEDEF_(0x80091009L) -#define CRYPT_E_NOT_DECRYPTED _HRESULT_TYPEDEF_(0x8009100AL) -#define CRYPT_E_RECIPIENT_NOT_FOUND _HRESULT_TYPEDEF_(0x8009100BL) -#define CRYPT_E_CONTROL_TYPE _HRESULT_TYPEDEF_(0x8009100CL) -#define CRYPT_E_ISSUER_SERIALNUMBER _HRESULT_TYPEDEF_(0x8009100DL) -#define CRYPT_E_SIGNER_NOT_FOUND _HRESULT_TYPEDEF_(0x8009100EL) -#define CRYPT_E_ATTRIBUTES_MISSING _HRESULT_TYPEDEF_(0x8009100FL) -#define CRYPT_E_STREAM_MSG_NOT_READY _HRESULT_TYPEDEF_(0x80091010L) -#define CRYPT_E_STREAM_INSUFFICIENT_DATA _HRESULT_TYPEDEF_(0x80091011L) -#define CRYPT_I_NEW_PROTECTION_REQUIRED _HRESULT_TYPEDEF_(0x00091012L) -#define CRYPT_E_BAD_LEN _HRESULT_TYPEDEF_(0x80092001L) -#define CRYPT_E_BAD_ENCODE _HRESULT_TYPEDEF_(0x80092002L) -#define CRYPT_E_FILE_ERROR _HRESULT_TYPEDEF_(0x80092003L) -#define CRYPT_E_NOT_FOUND _HRESULT_TYPEDEF_(0x80092004L) -#define CRYPT_E_EXISTS _HRESULT_TYPEDEF_(0x80092005L) -#define CRYPT_E_NO_PROVIDER _HRESULT_TYPEDEF_(0x80092006L) -#define CRYPT_E_SELF_SIGNED _HRESULT_TYPEDEF_(0x80092007L) -#define CRYPT_E_DELETED_PREV _HRESULT_TYPEDEF_(0x80092008L) -#define CRYPT_E_NO_MATCH _HRESULT_TYPEDEF_(0x80092009L) -#define CRYPT_E_UNEXPECTED_MSG_TYPE _HRESULT_TYPEDEF_(0x8009200AL) -#define CRYPT_E_NO_KEY_PROPERTY _HRESULT_TYPEDEF_(0x8009200BL) -#define CRYPT_E_NO_DECRYPT_CERT _HRESULT_TYPEDEF_(0x8009200CL) -#define CRYPT_E_BAD_MSG _HRESULT_TYPEDEF_(0x8009200DL) -#define CRYPT_E_NO_SIGNER _HRESULT_TYPEDEF_(0x8009200EL) -#define CRYPT_E_PENDING_CLOSE _HRESULT_TYPEDEF_(0x8009200FL) -#define CRYPT_E_REVOKED _HRESULT_TYPEDEF_(0x80092010L) -#define CRYPT_E_NO_REVOCATION_DLL _HRESULT_TYPEDEF_(0x80092011L) -#define CRYPT_E_NO_REVOCATION_CHECK _HRESULT_TYPEDEF_(0x80092012L) -#define CRYPT_E_REVOCATION_OFFLINE _HRESULT_TYPEDEF_(0x80092013L) -#define CRYPT_E_NOT_IN_REVOCATION_DATABASE _HRESULT_TYPEDEF_(0x80092014L) -#define CRYPT_E_INVALID_NUMERIC_STRING _HRESULT_TYPEDEF_(0x80092020L) -#define CRYPT_E_INVALID_PRINTABLE_STRING _HRESULT_TYPEDEF_(0x80092021L) -#define CRYPT_E_INVALID_IA5_STRING _HRESULT_TYPEDEF_(0x80092022L) -#define CRYPT_E_INVALID_X500_STRING _HRESULT_TYPEDEF_(0x80092023L) -#define CRYPT_E_NOT_CHAR_STRING _HRESULT_TYPEDEF_(0x80092024L) -#define CRYPT_E_FILERESIZED _HRESULT_TYPEDEF_(0x80092025L) -#define CRYPT_E_SECURITY_SETTINGS _HRESULT_TYPEDEF_(0x80092026L) -#define CRYPT_E_NO_VERIFY_USAGE_DLL _HRESULT_TYPEDEF_(0x80092027L) -#define CRYPT_E_NO_VERIFY_USAGE_CHECK _HRESULT_TYPEDEF_(0x80092028L) -#define CRYPT_E_VERIFY_USAGE_OFFLINE _HRESULT_TYPEDEF_(0x80092029L) -#define CRYPT_E_NOT_IN_CTL _HRESULT_TYPEDEF_(0x8009202AL) -#define CRYPT_E_NO_TRUSTED_SIGNER _HRESULT_TYPEDEF_(0x8009202BL) -#define CRYPT_E_MISSING_PUBKEY_PARA _HRESULT_TYPEDEF_(0x8009202CL) -#define CRYPT_E_OSS_ERROR _HRESULT_TYPEDEF_(0x80093000L) -#define OSS_MORE_BUF _HRESULT_TYPEDEF_(0x80093001L) -#define OSS_NEGATIVE_UINTEGER _HRESULT_TYPEDEF_(0x80093002L) -#define OSS_PDU_RANGE _HRESULT_TYPEDEF_(0x80093003L) -#define OSS_MORE_INPUT _HRESULT_TYPEDEF_(0x80093004L) -#define OSS_DATA_ERROR _HRESULT_TYPEDEF_(0x80093005L) -#define OSS_BAD_ARG _HRESULT_TYPEDEF_(0x80093006L) -#define OSS_BAD_VERSION _HRESULT_TYPEDEF_(0x80093007L) -#define OSS_OUT_MEMORY _HRESULT_TYPEDEF_(0x80093008L) -#define OSS_PDU_MISMATCH _HRESULT_TYPEDEF_(0x80093009L) -#define OSS_LIMITED _HRESULT_TYPEDEF_(0x8009300AL) -#define OSS_BAD_PTR _HRESULT_TYPEDEF_(0x8009300BL) -#define OSS_BAD_TIME _HRESULT_TYPEDEF_(0x8009300CL) -#define OSS_INDEFINITE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009300DL) -#define OSS_MEM_ERROR _HRESULT_TYPEDEF_(0x8009300EL) -#define OSS_BAD_TABLE _HRESULT_TYPEDEF_(0x8009300FL) -#define OSS_TOO_LONG _HRESULT_TYPEDEF_(0x80093010L) -#define OSS_CONSTRAINT_VIOLATED _HRESULT_TYPEDEF_(0x80093011L) -#define OSS_FATAL_ERROR _HRESULT_TYPEDEF_(0x80093012L) -#define OSS_ACCESS_SERIALIZATION_ERROR _HRESULT_TYPEDEF_(0x80093013L) -#define OSS_NULL_TBL _HRESULT_TYPEDEF_(0x80093014L) -#define OSS_NULL_FCN _HRESULT_TYPEDEF_(0x80093015L) -#define OSS_BAD_ENCRULES _HRESULT_TYPEDEF_(0x80093016L) -#define OSS_UNAVAIL_ENCRULES _HRESULT_TYPEDEF_(0x80093017L) -#define OSS_CANT_OPEN_TRACE_WINDOW _HRESULT_TYPEDEF_(0x80093018L) -#define OSS_UNIMPLEMENTED _HRESULT_TYPEDEF_(0x80093019L) -#define OSS_OID_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009301AL) -#define OSS_CANT_OPEN_TRACE_FILE _HRESULT_TYPEDEF_(0x8009301BL) -#define OSS_TRACE_FILE_ALREADY_OPEN _HRESULT_TYPEDEF_(0x8009301CL) -#define OSS_TABLE_MISMATCH _HRESULT_TYPEDEF_(0x8009301DL) -#define OSS_TYPE_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x8009301EL) -#define OSS_REAL_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009301FL) -#define OSS_REAL_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093020L) -#define OSS_OUT_OF_RANGE _HRESULT_TYPEDEF_(0x80093021L) -#define OSS_COPIER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093022L) -#define OSS_CONSTRAINT_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093023L) -#define OSS_COMPARATOR_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093024L) -#define OSS_COMPARATOR_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093025L) -#define OSS_MEM_MGR_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093026L) -#define OSS_PDV_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093027L) -#define OSS_PDV_CODE_NOT_LINKED _HRESULT_TYPEDEF_(0x80093028L) -#define OSS_API_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x80093029L) -#define OSS_BERDER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009302AL) -#define OSS_PER_DLL_NOT_LINKED _HRESULT_TYPEDEF_(0x8009302BL) -#define OSS_OPEN_TYPE_ERROR _HRESULT_TYPEDEF_(0x8009302CL) -#define OSS_MUTEX_NOT_CREATED _HRESULT_TYPEDEF_(0x8009302DL) -#define OSS_CANT_CLOSE_TRACE_FILE _HRESULT_TYPEDEF_(0x8009302EL) -#define CRYPT_E_ASN1_ERROR _HRESULT_TYPEDEF_(0x80093100L) -#define CRYPT_E_ASN1_INTERNAL _HRESULT_TYPEDEF_(0x80093101L) -#define CRYPT_E_ASN1_EOD _HRESULT_TYPEDEF_(0x80093102L) -#define CRYPT_E_ASN1_CORRUPT _HRESULT_TYPEDEF_(0x80093103L) -#define CRYPT_E_ASN1_LARGE _HRESULT_TYPEDEF_(0x80093104L) -#define CRYPT_E_ASN1_CONSTRAINT _HRESULT_TYPEDEF_(0x80093105L) -#define CRYPT_E_ASN1_MEMORY _HRESULT_TYPEDEF_(0x80093106L) -#define CRYPT_E_ASN1_OVERFLOW _HRESULT_TYPEDEF_(0x80093107L) -#define CRYPT_E_ASN1_BADPDU _HRESULT_TYPEDEF_(0x80093108L) -#define CRYPT_E_ASN1_BADARGS _HRESULT_TYPEDEF_(0x80093109L) -#define CRYPT_E_ASN1_BADREAL _HRESULT_TYPEDEF_(0x8009310AL) -#define CRYPT_E_ASN1_BADTAG _HRESULT_TYPEDEF_(0x8009310BL) -#define CRYPT_E_ASN1_CHOICE _HRESULT_TYPEDEF_(0x8009310CL) -#define CRYPT_E_ASN1_RULE _HRESULT_TYPEDEF_(0x8009310DL) -#define CRYPT_E_ASN1_UTF8 _HRESULT_TYPEDEF_(0x8009310EL) -#define CRYPT_E_ASN1_PDU_TYPE _HRESULT_TYPEDEF_(0x80093133L) -#define CRYPT_E_ASN1_NYI _HRESULT_TYPEDEF_(0x80093134L) -#define CRYPT_E_ASN1_EXTENDED _HRESULT_TYPEDEF_(0x80093201L) -#define CRYPT_E_ASN1_NOEOD _HRESULT_TYPEDEF_(0x80093202L) -#define CERTSRV_E_BAD_REQUESTSUBJECT _HRESULT_TYPEDEF_(0x80094001L) -#define CERTSRV_E_NO_REQUEST _HRESULT_TYPEDEF_(0x80094002L) -#define CERTSRV_E_BAD_REQUESTSTATUS _HRESULT_TYPEDEF_(0x80094003L) -#define CERTSRV_E_PROPERTY_EMPTY _HRESULT_TYPEDEF_(0x80094004L) -#define CERTSRV_E_INVALID_CA_CERTIFICATE _HRESULT_TYPEDEF_(0x80094005L) -#define CERTSRV_E_SERVER_SUSPENDED _HRESULT_TYPEDEF_(0x80094006L) -#define CERTSRV_E_ENCODING_LENGTH _HRESULT_TYPEDEF_(0x80094007L) -#define CERTSRV_E_ROLECONFLICT _HRESULT_TYPEDEF_(0x80094008L) -#define CERTSRV_E_RESTRICTEDOFFICER _HRESULT_TYPEDEF_(0x80094009L) -#define CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED _HRESULT_TYPEDEF_(0x8009400AL) -#define CERTSRV_E_NO_VALID_KRA _HRESULT_TYPEDEF_(0x8009400BL) -#define CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL _HRESULT_TYPEDEF_(0x8009400CL) -#define CERTSRV_E_NO_CAADMIN_DEFINED _HRESULT_TYPEDEF_(0x8009400DL) -#define CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE _HRESULT_TYPEDEF_(0x8009400EL) -#define CERTSRV_E_NO_DB_SESSIONS _HRESULT_TYPEDEF_(0x8009400FL) -#define CERTSRV_E_ALIGNMENT_FAULT _HRESULT_TYPEDEF_(0x80094010L) -#define CERTSRV_E_ENROLL_DENIED _HRESULT_TYPEDEF_(0x80094011L) -#define CERTSRV_E_TEMPLATE_DENIED _HRESULT_TYPEDEF_(0x80094012L) -#define CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE _HRESULT_TYPEDEF_(0x80094013L) -#define CERTSRV_E_UNSUPPORTED_CERT_TYPE _HRESULT_TYPEDEF_(0x80094800L) -#define CERTSRV_E_NO_CERT_TYPE _HRESULT_TYPEDEF_(0x80094801L) -#define CERTSRV_E_TEMPLATE_CONFLICT _HRESULT_TYPEDEF_(0x80094802L) -#define CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED _HRESULT_TYPEDEF_(0x80094803L) -#define CERTSRV_E_ARCHIVED_KEY_REQUIRED _HRESULT_TYPEDEF_(0x80094804L) -#define CERTSRV_E_SMIME_REQUIRED _HRESULT_TYPEDEF_(0x80094805L) -#define CERTSRV_E_BAD_RENEWAL_SUBJECT _HRESULT_TYPEDEF_(0x80094806L) -#define CERTSRV_E_BAD_TEMPLATE_VERSION _HRESULT_TYPEDEF_(0x80094807L) -#define CERTSRV_E_TEMPLATE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x80094808L) -#define CERTSRV_E_SIGNATURE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x80094809L) -#define CERTSRV_E_SIGNATURE_COUNT _HRESULT_TYPEDEF_(0x8009480AL) -#define CERTSRV_E_SIGNATURE_REJECTED _HRESULT_TYPEDEF_(0x8009480BL) -#define CERTSRV_E_ISSUANCE_POLICY_REQUIRED _HRESULT_TYPEDEF_(0x8009480CL) -#define CERTSRV_E_SUBJECT_UPN_REQUIRED _HRESULT_TYPEDEF_(0x8009480DL) -#define CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED _HRESULT_TYPEDEF_(0x8009480EL) -#define CERTSRV_E_SUBJECT_DNS_REQUIRED _HRESULT_TYPEDEF_(0x8009480FL) -#define CERTSRV_E_ARCHIVED_KEY_UNEXPECTED _HRESULT_TYPEDEF_(0x80094810L) -#define CERTSRV_E_KEY_LENGTH _HRESULT_TYPEDEF_(0x80094811L) -#define CERTSRV_E_SUBJECT_EMAIL_REQUIRED _HRESULT_TYPEDEF_(0x80094812L) -#define CERTSRV_E_UNKNOWN_CERT_TYPE _HRESULT_TYPEDEF_(0x80094813L) -#define CERTSRV_E_CERT_TYPE_OVERLAP _HRESULT_TYPEDEF_(0x80094814L) -#define XENROLL_E_KEY_NOT_EXPORTABLE _HRESULT_TYPEDEF_(0x80095000L) -#define XENROLL_E_CANNOT_ADD_ROOT_CERT _HRESULT_TYPEDEF_(0x80095001L) -#define XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND _HRESULT_TYPEDEF_(0x80095002L) -#define XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH _HRESULT_TYPEDEF_(0x80095003L) -#define XENROLL_E_RESPONSE_KA_HASH_MISMATCH _HRESULT_TYPEDEF_(0x80095004L) -#define XENROLL_E_KEYSPEC_SMIME_MISMATCH _HRESULT_TYPEDEF_(0x80095005L) -#define TRUST_E_SYSTEM_ERROR _HRESULT_TYPEDEF_(0x80096001L) -#define TRUST_E_NO_SIGNER_CERT _HRESULT_TYPEDEF_(0x80096002L) -#define TRUST_E_COUNTER_SIGNER _HRESULT_TYPEDEF_(0x80096003L) -#define TRUST_E_CERT_SIGNATURE _HRESULT_TYPEDEF_(0x80096004L) -#define TRUST_E_TIME_STAMP _HRESULT_TYPEDEF_(0x80096005L) -#define TRUST_E_BAD_DIGEST _HRESULT_TYPEDEF_(0x80096010L) -#define TRUST_E_BASIC_CONSTRAINTS _HRESULT_TYPEDEF_(0x80096019L) -#define TRUST_E_FINANCIAL_CRITERIA _HRESULT_TYPEDEF_(0x8009601EL) -#define MSSIPOTF_E_OUTOFMEMRANGE _HRESULT_TYPEDEF_(0x80097001L) -#define MSSIPOTF_E_CANTGETOBJECT _HRESULT_TYPEDEF_(0x80097002L) -#define MSSIPOTF_E_NOHEADTABLE _HRESULT_TYPEDEF_(0x80097003L) -#define MSSIPOTF_E_BAD_MAGICNUMBER _HRESULT_TYPEDEF_(0x80097004L) -#define MSSIPOTF_E_BAD_OFFSET_TABLE _HRESULT_TYPEDEF_(0x80097005L) -#define MSSIPOTF_E_TABLE_TAGORDER _HRESULT_TYPEDEF_(0x80097006L) -#define MSSIPOTF_E_TABLE_LONGWORD _HRESULT_TYPEDEF_(0x80097007L) -#define MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT _HRESULT_TYPEDEF_(0x80097008L) -#define MSSIPOTF_E_TABLES_OVERLAP _HRESULT_TYPEDEF_(0x80097009L) -#define MSSIPOTF_E_TABLE_PADBYTES _HRESULT_TYPEDEF_(0x8009700AL) -#define MSSIPOTF_E_FILETOOSMALL _HRESULT_TYPEDEF_(0x8009700BL) -#define MSSIPOTF_E_TABLE_CHECKSUM _HRESULT_TYPEDEF_(0x8009700CL) -#define MSSIPOTF_E_FILE_CHECKSUM _HRESULT_TYPEDEF_(0x8009700DL) -#define MSSIPOTF_E_FAILED_POLICY _HRESULT_TYPEDEF_(0x80097010L) -#define MSSIPOTF_E_FAILED_HINTS_CHECK _HRESULT_TYPEDEF_(0x80097011L) -#define MSSIPOTF_E_NOT_OPENTYPE _HRESULT_TYPEDEF_(0x80097012L) -#define MSSIPOTF_E_FILE _HRESULT_TYPEDEF_(0x80097013L) -#define MSSIPOTF_E_CRYPT _HRESULT_TYPEDEF_(0x80097014L) -#define MSSIPOTF_E_BADVERSION _HRESULT_TYPEDEF_(0x80097015L) -#define MSSIPOTF_E_DSIG_STRUCTURE _HRESULT_TYPEDEF_(0x80097016L) -#define MSSIPOTF_E_PCONST_CHECK _HRESULT_TYPEDEF_(0x80097017L) -#define MSSIPOTF_E_STRUCTURE _HRESULT_TYPEDEF_(0x80097018L) -#define NTE_OP_OK 0 -#define TRUST_E_PROVIDER_UNKNOWN _HRESULT_TYPEDEF_(0x800B0001L) -#define TRUST_E_ACTION_UNKNOWN _HRESULT_TYPEDEF_(0x800B0002L) -#define TRUST_E_SUBJECT_FORM_UNKNOWN _HRESULT_TYPEDEF_(0x800B0003L) -#define TRUST_E_SUBJECT_NOT_TRUSTED _HRESULT_TYPEDEF_(0x800B0004L) -#define DIGSIG_E_ENCODE _HRESULT_TYPEDEF_(0x800B0005L) -#define DIGSIG_E_DECODE _HRESULT_TYPEDEF_(0x800B0006L) -#define DIGSIG_E_EXTENSIBILITY _HRESULT_TYPEDEF_(0x800B0007L) -#define DIGSIG_E_CRYPTO _HRESULT_TYPEDEF_(0x800B0008L) -#define PERSIST_E_SIZEDEFINITE _HRESULT_TYPEDEF_(0x800B0009L) -#define PERSIST_E_SIZEINDEFINITE _HRESULT_TYPEDEF_(0x800B000AL) -#define PERSIST_E_NOTSELFSIZING _HRESULT_TYPEDEF_(0x800B000BL) -#define TRUST_E_NOSIGNATURE _HRESULT_TYPEDEF_(0x800B0100L) -#define CERT_E_EXPIRED _HRESULT_TYPEDEF_(0x800B0101L) -#define CERT_E_VALIDITYPERIODNESTING _HRESULT_TYPEDEF_(0x800B0102L) -#define CERT_E_ROLE _HRESULT_TYPEDEF_(0x800B0103L) -#define CERT_E_PATHLENCONST _HRESULT_TYPEDEF_(0x800B0104L) -#define CERT_E_CRITICAL _HRESULT_TYPEDEF_(0x800B0105L) -#define CERT_E_PURPOSE _HRESULT_TYPEDEF_(0x800B0106L) -#define CERT_E_ISSUERCHAINING _HRESULT_TYPEDEF_(0x800B0107L) -#define CERT_E_MALFORMED _HRESULT_TYPEDEF_(0x800B0108L) -#define CERT_E_UNTRUSTEDROOT _HRESULT_TYPEDEF_(0x800B0109L) -#define CERT_E_CHAINING _HRESULT_TYPEDEF_(0x800B010AL) -#define TRUST_E_FAIL _HRESULT_TYPEDEF_(0x800B010BL) -#define CERT_E_REVOKED _HRESULT_TYPEDEF_(0x800B010CL) -#define CERT_E_UNTRUSTEDTESTROOT _HRESULT_TYPEDEF_(0x800B010DL) -#define CERT_E_REVOCATION_FAILURE _HRESULT_TYPEDEF_(0x800B010EL) -#define CERT_E_CN_NO_MATCH _HRESULT_TYPEDEF_(0x800B010FL) -#define CERT_E_WRONG_USAGE _HRESULT_TYPEDEF_(0x800B0110L) -#define TRUST_E_EXPLICIT_DISTRUST _HRESULT_TYPEDEF_(0x800B0111L) -#define CERT_E_UNTRUSTEDCA _HRESULT_TYPEDEF_(0x800B0112L) -#define CERT_E_INVALID_POLICY _HRESULT_TYPEDEF_(0x800B0113L) -#define CERT_E_INVALID_NAME _HRESULT_TYPEDEF_(0x800B0114L) -#define HRESULT_FROM_SETUPAPI(x) ((((x) & (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR))==(APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR)) ? ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_SETUPAPI << 16) | 0x80000000)) : HRESULT_FROM_WIN32(x)) -#define SPAPI_E_EXPECTED_SECTION_NAME _HRESULT_TYPEDEF_(0x800F0000L) -#define SPAPI_E_BAD_SECTION_NAME_LINE _HRESULT_TYPEDEF_(0x800F0001L) -#define SPAPI_E_SECTION_NAME_TOO_LONG _HRESULT_TYPEDEF_(0x800F0002L) -#define SPAPI_E_GENERAL_SYNTAX _HRESULT_TYPEDEF_(0x800F0003L) -#define SPAPI_E_WRONG_INF_STYLE _HRESULT_TYPEDEF_(0x800F0100L) -#define SPAPI_E_SECTION_NOT_FOUND _HRESULT_TYPEDEF_(0x800F0101L) -#define SPAPI_E_LINE_NOT_FOUND _HRESULT_TYPEDEF_(0x800F0102L) -#define SPAPI_E_NO_BACKUP _HRESULT_TYPEDEF_(0x800F0103L) -#define SPAPI_E_NO_ASSOCIATED_CLASS _HRESULT_TYPEDEF_(0x800F0200L) -#define SPAPI_E_CLASS_MISMATCH _HRESULT_TYPEDEF_(0x800F0201L) -#define SPAPI_E_DUPLICATE_FOUND _HRESULT_TYPEDEF_(0x800F0202L) -#define SPAPI_E_NO_DRIVER_SELECTED _HRESULT_TYPEDEF_(0x800F0203L) -#define SPAPI_E_KEY_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x800F0204L) -#define SPAPI_E_INVALID_DEVINST_NAME _HRESULT_TYPEDEF_(0x800F0205L) -#define SPAPI_E_INVALID_CLASS _HRESULT_TYPEDEF_(0x800F0206L) -#define SPAPI_E_DEVINST_ALREADY_EXISTS _HRESULT_TYPEDEF_(0x800F0207L) -#define SPAPI_E_DEVINFO_NOT_REGISTERED _HRESULT_TYPEDEF_(0x800F0208L) -#define SPAPI_E_INVALID_REG_PROPERTY _HRESULT_TYPEDEF_(0x800F0209L) -#define SPAPI_E_NO_INF _HRESULT_TYPEDEF_(0x800F020AL) -#define SPAPI_E_NO_SUCH_DEVINST _HRESULT_TYPEDEF_(0x800F020BL) -#define SPAPI_E_CANT_LOAD_CLASS_ICON _HRESULT_TYPEDEF_(0x800F020CL) -#define SPAPI_E_INVALID_CLASS_INSTALLER _HRESULT_TYPEDEF_(0x800F020DL) -#define SPAPI_E_DI_DO_DEFAULT _HRESULT_TYPEDEF_(0x800F020EL) -#define SPAPI_E_DI_NOFILECOPY _HRESULT_TYPEDEF_(0x800F020FL) -#define SPAPI_E_INVALID_HWPROFILE _HRESULT_TYPEDEF_(0x800F0210L) -#define SPAPI_E_NO_DEVICE_SELECTED _HRESULT_TYPEDEF_(0x800F0211L) -#define SPAPI_E_DEVINFO_LIST_LOCKED _HRESULT_TYPEDEF_(0x800F0212L) -#define SPAPI_E_DEVINFO_DATA_LOCKED _HRESULT_TYPEDEF_(0x800F0213L) -#define SPAPI_E_DI_BAD_PATH _HRESULT_TYPEDEF_(0x800F0214L) -#define SPAPI_E_NO_CLASSINSTALL_PARAMS _HRESULT_TYPEDEF_(0x800F0215L) -#define SPAPI_E_FILEQUEUE_LOCKED _HRESULT_TYPEDEF_(0x800F0216L) -#define SPAPI_E_BAD_SERVICE_INSTALLSECT _HRESULT_TYPEDEF_(0x800F0217L) -#define SPAPI_E_NO_CLASS_DRIVER_LIST _HRESULT_TYPEDEF_(0x800F0218L) -#define SPAPI_E_NO_ASSOCIATED_SERVICE _HRESULT_TYPEDEF_(0x800F0219L) -#define SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE _HRESULT_TYPEDEF_(0x800F021AL) -#define SPAPI_E_DEVICE_INTERFACE_ACTIVE _HRESULT_TYPEDEF_(0x800F021BL) -#define SPAPI_E_DEVICE_INTERFACE_REMOVED _HRESULT_TYPEDEF_(0x800F021CL) -#define SPAPI_E_BAD_INTERFACE_INSTALLSECT _HRESULT_TYPEDEF_(0x800F021DL) -#define SPAPI_E_NO_SUCH_INTERFACE_CLASS _HRESULT_TYPEDEF_(0x800F021EL) -#define SPAPI_E_INVALID_REFERENCE_STRING _HRESULT_TYPEDEF_(0x800F021FL) -#define SPAPI_E_INVALID_MACHINENAME _HRESULT_TYPEDEF_(0x800F0220L) -#define SPAPI_E_REMOTE_COMM_FAILURE _HRESULT_TYPEDEF_(0x800F0221L) -#define SPAPI_E_MACHINE_UNAVAILABLE _HRESULT_TYPEDEF_(0x800F0222L) -#define SPAPI_E_NO_CONFIGMGR_SERVICES _HRESULT_TYPEDEF_(0x800F0223L) -#define SPAPI_E_INVALID_PROPPAGE_PROVIDER _HRESULT_TYPEDEF_(0x800F0224L) -#define SPAPI_E_NO_SUCH_DEVICE_INTERFACE _HRESULT_TYPEDEF_(0x800F0225L) -#define SPAPI_E_DI_POSTPROCESSING_REQUIRED _HRESULT_TYPEDEF_(0x800F0226L) -#define SPAPI_E_INVALID_COINSTALLER _HRESULT_TYPEDEF_(0x800F0227L) -#define SPAPI_E_NO_COMPAT_DRIVERS _HRESULT_TYPEDEF_(0x800F0228L) -#define SPAPI_E_NO_DEVICE_ICON _HRESULT_TYPEDEF_(0x800F0229L) -#define SPAPI_E_INVALID_INF_LOGCONFIG _HRESULT_TYPEDEF_(0x800F022AL) -#define SPAPI_E_DI_DONT_INSTALL _HRESULT_TYPEDEF_(0x800F022BL) -#define SPAPI_E_INVALID_FILTER_DRIVER _HRESULT_TYPEDEF_(0x800F022CL) -#define SPAPI_E_NON_WINDOWS_NT_DRIVER _HRESULT_TYPEDEF_(0x800F022DL) -#define SPAPI_E_NON_WINDOWS_DRIVER _HRESULT_TYPEDEF_(0x800F022EL) -#define SPAPI_E_NO_CATALOG_FOR_OEM_INF _HRESULT_TYPEDEF_(0x800F022FL) -#define SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE _HRESULT_TYPEDEF_(0x800F0230L) -#define SPAPI_E_NOT_DISABLEABLE _HRESULT_TYPEDEF_(0x800F0231L) -#define SPAPI_E_CANT_REMOVE_DEVINST _HRESULT_TYPEDEF_(0x800F0232L) -#define SPAPI_E_INVALID_TARGET _HRESULT_TYPEDEF_(0x800F0233L) -#define SPAPI_E_DRIVER_NONNATIVE _HRESULT_TYPEDEF_(0x800F0234L) -#define SPAPI_E_IN_WOW64 _HRESULT_TYPEDEF_(0x800F0235L) -#define SPAPI_E_SET_SYSTEM_RESTORE_POINT _HRESULT_TYPEDEF_(0x800F0236L) -#define SPAPI_E_INCORRECTLY_COPIED_INF _HRESULT_TYPEDEF_(0x800F0237L) -#define SPAPI_E_SCE_DISABLED _HRESULT_TYPEDEF_(0x800F0238L) -#define SPAPI_E_UNKNOWN_EXCEPTION _HRESULT_TYPEDEF_(0x800F0239L) -#define SPAPI_E_PNP_REGISTRY_ERROR _HRESULT_TYPEDEF_(0x800F023AL) -#define SPAPI_E_REMOTE_REQUEST_UNSUPPORTED _HRESULT_TYPEDEF_(0x800F023BL) -#define SPAPI_E_NOT_AN_INSTALLED_OEM_INF _HRESULT_TYPEDEF_(0x800F023CL) -#define SPAPI_E_INF_IN_USE_BY_DEVICES _HRESULT_TYPEDEF_(0x800F023DL) -#define SPAPI_E_DI_FUNCTION_OBSOLETE _HRESULT_TYPEDEF_(0x800F023EL) -#define SPAPI_E_NO_AUTHENTICODE_CATALOG _HRESULT_TYPEDEF_(0x800F023FL) -#define SPAPI_E_AUTHENTICODE_DISALLOWED _HRESULT_TYPEDEF_(0x800F0240L) -#define SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER _HRESULT_TYPEDEF_(0x800F0241L) -#define SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED _HRESULT_TYPEDEF_(0x800F0242L) -#define SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED _HRESULT_TYPEDEF_(0x800F0243L) -#define SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH _HRESULT_TYPEDEF_(0x800F0244L) -#define SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE _HRESULT_TYPEDEF_(0x800F0245L) -#define SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW _HRESULT_TYPEDEF_(0x800F0300L) -#define SPAPI_E_ERROR_NOT_INSTALLED _HRESULT_TYPEDEF_(0x800F1000L) -#define SCARD_S_SUCCESS NO_ERROR -#define SCARD_F_INTERNAL_ERROR _HRESULT_TYPEDEF_(0x80100001L) -#define SCARD_E_CANCELLED _HRESULT_TYPEDEF_(0x80100002L) -#define SCARD_E_INVALID_HANDLE _HRESULT_TYPEDEF_(0x80100003L) -#define SCARD_E_INVALID_PARAMETER _HRESULT_TYPEDEF_(0x80100004L) -#define SCARD_E_INVALID_TARGET _HRESULT_TYPEDEF_(0x80100005L) -#define SCARD_E_NO_MEMORY _HRESULT_TYPEDEF_(0x80100006L) -#define SCARD_F_WAITED_TOO_LONG _HRESULT_TYPEDEF_(0x80100007L) -#define SCARD_E_INSUFFICIENT_BUFFER _HRESULT_TYPEDEF_(0x80100008L) -#define SCARD_E_UNKNOWN_READER _HRESULT_TYPEDEF_(0x80100009L) -#define SCARD_E_TIMEOUT _HRESULT_TYPEDEF_(0x8010000AL) -#define SCARD_E_SHARING_VIOLATION _HRESULT_TYPEDEF_(0x8010000BL) -#define SCARD_E_NO_SMARTCARD _HRESULT_TYPEDEF_(0x8010000CL) -#define SCARD_E_UNKNOWN_CARD _HRESULT_TYPEDEF_(0x8010000DL) -#define SCARD_E_CANT_DISPOSE _HRESULT_TYPEDEF_(0x8010000EL) -#define SCARD_E_PROTO_MISMATCH _HRESULT_TYPEDEF_(0x8010000FL) -#define SCARD_E_NOT_READY _HRESULT_TYPEDEF_(0x80100010L) -#define SCARD_E_INVALID_VALUE _HRESULT_TYPEDEF_(0x80100011L) -#define SCARD_E_SYSTEM_CANCELLED _HRESULT_TYPEDEF_(0x80100012L) -#define SCARD_F_COMM_ERROR _HRESULT_TYPEDEF_(0x80100013L) -#define SCARD_F_UNKNOWN_ERROR _HRESULT_TYPEDEF_(0x80100014L) -#define SCARD_E_INVALID_ATR _HRESULT_TYPEDEF_(0x80100015L) -#define SCARD_E_NOT_TRANSACTED _HRESULT_TYPEDEF_(0x80100016L) -#define SCARD_E_READER_UNAVAILABLE _HRESULT_TYPEDEF_(0x80100017L) -#define SCARD_P_SHUTDOWN _HRESULT_TYPEDEF_(0x80100018L) -#define SCARD_E_PCI_TOO_SMALL _HRESULT_TYPEDEF_(0x80100019L) -#define SCARD_E_READER_UNSUPPORTED _HRESULT_TYPEDEF_(0x8010001AL) -#define SCARD_E_DUPLICATE_READER _HRESULT_TYPEDEF_(0x8010001BL) -#define SCARD_E_CARD_UNSUPPORTED _HRESULT_TYPEDEF_(0x8010001CL) -#define SCARD_E_NO_SERVICE _HRESULT_TYPEDEF_(0x8010001DL) -#define SCARD_E_SERVICE_STOPPED _HRESULT_TYPEDEF_(0x8010001EL) -#define SCARD_E_UNEXPECTED _HRESULT_TYPEDEF_(0x8010001FL) -#define SCARD_E_ICC_INSTALLATION _HRESULT_TYPEDEF_(0x80100020L) -#define SCARD_E_ICC_CREATEORDER _HRESULT_TYPEDEF_(0x80100021L) -#define SCARD_E_UNSUPPORTED_FEATURE _HRESULT_TYPEDEF_(0x80100022L) -#define SCARD_E_DIR_NOT_FOUND _HRESULT_TYPEDEF_(0x80100023L) -#define SCARD_E_FILE_NOT_FOUND _HRESULT_TYPEDEF_(0x80100024L) -#define SCARD_E_NO_DIR _HRESULT_TYPEDEF_(0x80100025L) -#define SCARD_E_NO_FILE _HRESULT_TYPEDEF_(0x80100026L) -#define SCARD_E_NO_ACCESS _HRESULT_TYPEDEF_(0x80100027L) -#define SCARD_E_WRITE_TOO_MANY _HRESULT_TYPEDEF_(0x80100028L) -#define SCARD_E_BAD_SEEK _HRESULT_TYPEDEF_(0x80100029L) -#define SCARD_E_INVALID_CHV _HRESULT_TYPEDEF_(0x8010002AL) -#define SCARD_E_UNKNOWN_RES_MNG _HRESULT_TYPEDEF_(0x8010002BL) -#define SCARD_E_NO_SUCH_CERTIFICATE _HRESULT_TYPEDEF_(0x8010002CL) -#define SCARD_E_CERTIFICATE_UNAVAILABLE _HRESULT_TYPEDEF_(0x8010002DL) -#define SCARD_E_NO_READERS_AVAILABLE _HRESULT_TYPEDEF_(0x8010002EL) -#define SCARD_E_COMM_DATA_LOST _HRESULT_TYPEDEF_(0x8010002FL) -#define SCARD_E_NO_KEY_CONTAINER _HRESULT_TYPEDEF_(0x80100030L) -#define SCARD_E_SERVER_TOO_BUSY _HRESULT_TYPEDEF_(0x80100031L) -#define SCARD_W_UNSUPPORTED_CARD _HRESULT_TYPEDEF_(0x80100065L) -#define SCARD_W_UNRESPONSIVE_CARD _HRESULT_TYPEDEF_(0x80100066L) -#define SCARD_W_UNPOWERED_CARD _HRESULT_TYPEDEF_(0x80100067L) -#define SCARD_W_RESET_CARD _HRESULT_TYPEDEF_(0x80100068L) -#define SCARD_W_REMOVED_CARD _HRESULT_TYPEDEF_(0x80100069L) -#define SCARD_W_SECURITY_VIOLATION _HRESULT_TYPEDEF_(0x8010006AL) -#define SCARD_W_WRONG_CHV _HRESULT_TYPEDEF_(0x8010006BL) -#define SCARD_W_CHV_BLOCKED _HRESULT_TYPEDEF_(0x8010006CL) -#define SCARD_W_EOF _HRESULT_TYPEDEF_(0x8010006DL) -#define SCARD_W_CANCELLED_BY_USER _HRESULT_TYPEDEF_(0x8010006EL) -#define SCARD_W_CARD_NOT_AUTHENTICATED _HRESULT_TYPEDEF_(0x8010006FL) -#define COMADMIN_E_OBJECTERRORS _HRESULT_TYPEDEF_(0x80110401L) -#define COMADMIN_E_OBJECTINVALID _HRESULT_TYPEDEF_(0x80110402L) -#define COMADMIN_E_KEYMISSING _HRESULT_TYPEDEF_(0x80110403L) -#define COMADMIN_E_ALREADYINSTALLED _HRESULT_TYPEDEF_(0x80110404L) -#define COMADMIN_E_APP_FILE_WRITEFAIL _HRESULT_TYPEDEF_(0x80110407L) -#define COMADMIN_E_APP_FILE_READFAIL _HRESULT_TYPEDEF_(0x80110408L) -#define COMADMIN_E_APP_FILE_VERSION _HRESULT_TYPEDEF_(0x80110409L) -#define COMADMIN_E_BADPATH _HRESULT_TYPEDEF_(0x8011040AL) -#define COMADMIN_E_APPLICATIONEXISTS _HRESULT_TYPEDEF_(0x8011040BL) -#define COMADMIN_E_ROLEEXISTS _HRESULT_TYPEDEF_(0x8011040CL) -#define COMADMIN_E_CANTCOPYFILE _HRESULT_TYPEDEF_(0x8011040DL) -#define COMADMIN_E_NOUSER _HRESULT_TYPEDEF_(0x8011040FL) -#define COMADMIN_E_INVALIDUSERIDS _HRESULT_TYPEDEF_(0x80110410L) -#define COMADMIN_E_NOREGISTRYCLSID _HRESULT_TYPEDEF_(0x80110411L) -#define COMADMIN_E_BADREGISTRYPROGID _HRESULT_TYPEDEF_(0x80110412L) -#define COMADMIN_E_AUTHENTICATIONLEVEL _HRESULT_TYPEDEF_(0x80110413L) -#define COMADMIN_E_USERPASSWDNOTVALID _HRESULT_TYPEDEF_(0x80110414L) -#define COMADMIN_E_CLSIDORIIDMISMATCH _HRESULT_TYPEDEF_(0x80110418L) -#define COMADMIN_E_REMOTEINTERFACE _HRESULT_TYPEDEF_(0x80110419L) -#define COMADMIN_E_DLLREGISTERSERVER _HRESULT_TYPEDEF_(0x8011041AL) -#define COMADMIN_E_NOSERVERSHARE _HRESULT_TYPEDEF_(0x8011041BL) -#define COMADMIN_E_DLLLOADFAILED _HRESULT_TYPEDEF_(0x8011041DL) -#define COMADMIN_E_BADREGISTRYLIBID _HRESULT_TYPEDEF_(0x8011041EL) -#define COMADMIN_E_APPDIRNOTFOUND _HRESULT_TYPEDEF_(0x8011041FL) -#define COMADMIN_E_REGISTRARFAILED _HRESULT_TYPEDEF_(0x80110423L) -#define COMADMIN_E_COMPFILE_DOESNOTEXIST _HRESULT_TYPEDEF_(0x80110424L) -#define COMADMIN_E_COMPFILE_LOADDLLFAIL _HRESULT_TYPEDEF_(0x80110425L) -#define COMADMIN_E_COMPFILE_GETCLASSOBJ _HRESULT_TYPEDEF_(0x80110426L) -#define COMADMIN_E_COMPFILE_CLASSNOTAVAIL _HRESULT_TYPEDEF_(0x80110427L) -#define COMADMIN_E_COMPFILE_BADTLB _HRESULT_TYPEDEF_(0x80110428L) -#define COMADMIN_E_COMPFILE_NOTINSTALLABLE _HRESULT_TYPEDEF_(0x80110429L) -#define COMADMIN_E_NOTCHANGEABLE _HRESULT_TYPEDEF_(0x8011042AL) -#define COMADMIN_E_NOTDELETEABLE _HRESULT_TYPEDEF_(0x8011042BL) -#define COMADMIN_E_SESSION _HRESULT_TYPEDEF_(0x8011042CL) -#define COMADMIN_E_COMP_MOVE_LOCKED _HRESULT_TYPEDEF_(0x8011042DL) -#define COMADMIN_E_COMP_MOVE_BAD_DEST _HRESULT_TYPEDEF_(0x8011042EL) -#define COMADMIN_E_REGISTERTLB _HRESULT_TYPEDEF_(0x80110430L) -#define COMADMIN_E_SYSTEMAPP _HRESULT_TYPEDEF_(0x80110433L) -#define COMADMIN_E_COMPFILE_NOREGISTRAR _HRESULT_TYPEDEF_(0x80110434L) -#define COMADMIN_E_COREQCOMPINSTALLED _HRESULT_TYPEDEF_(0x80110435L) -#define COMADMIN_E_SERVICENOTINSTALLED _HRESULT_TYPEDEF_(0x80110436L) -#define COMADMIN_E_PROPERTYSAVEFAILED _HRESULT_TYPEDEF_(0x80110437L) -#define COMADMIN_E_OBJECTEXISTS _HRESULT_TYPEDEF_(0x80110438L) -#define COMADMIN_E_COMPONENTEXISTS _HRESULT_TYPEDEF_(0x80110439L) -#define COMADMIN_E_REGFILE_CORRUPT _HRESULT_TYPEDEF_(0x8011043BL) -#define COMADMIN_E_PROPERTY_OVERFLOW _HRESULT_TYPEDEF_(0x8011043CL) -#define COMADMIN_E_NOTINREGISTRY _HRESULT_TYPEDEF_(0x8011043EL) -#define COMADMIN_E_OBJECTNOTPOOLABLE _HRESULT_TYPEDEF_(0x8011043FL) -#define COMADMIN_E_APPLID_MATCHES_CLSID _HRESULT_TYPEDEF_(0x80110446L) -#define COMADMIN_E_ROLE_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x80110447L) -#define COMADMIN_E_START_APP_NEEDS_COMPONENTS _HRESULT_TYPEDEF_(0x80110448L) -#define COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM _HRESULT_TYPEDEF_(0x80110449L) -#define COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY _HRESULT_TYPEDEF_(0x8011044AL) -#define COMADMIN_E_CAN_NOT_START_APP _HRESULT_TYPEDEF_(0x8011044BL) -#define COMADMIN_E_CAN_NOT_EXPORT_SYS_APP _HRESULT_TYPEDEF_(0x8011044CL) -#define COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT _HRESULT_TYPEDEF_(0x8011044DL) -#define COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER _HRESULT_TYPEDEF_(0x8011044EL) -#define COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE _HRESULT_TYPEDEF_(0x8011044FL) -#define COMADMIN_E_BASE_PARTITION_ONLY _HRESULT_TYPEDEF_(0x80110450L) -#define COMADMIN_E_START_APP_DISABLED _HRESULT_TYPEDEF_(0x80110451L) -#define COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME _HRESULT_TYPEDEF_(0x80110457L) -#define COMADMIN_E_CAT_INVALID_PARTITION_NAME _HRESULT_TYPEDEF_(0x80110458L) -#define COMADMIN_E_CAT_PARTITION_IN_USE _HRESULT_TYPEDEF_(0x80110459L) -#define COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES _HRESULT_TYPEDEF_(0x8011045AL) -#define COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED _HRESULT_TYPEDEF_(0x8011045BL) -#define COMADMIN_E_AMBIGUOUS_APPLICATION_NAME _HRESULT_TYPEDEF_(0x8011045CL) -#define COMADMIN_E_AMBIGUOUS_PARTITION_NAME _HRESULT_TYPEDEF_(0x8011045DL) -#define COMADMIN_E_REGDB_NOTINITIALIZED _HRESULT_TYPEDEF_(0x80110472L) -#define COMADMIN_E_REGDB_NOTOPEN _HRESULT_TYPEDEF_(0x80110473L) -#define COMADMIN_E_REGDB_SYSTEMERR _HRESULT_TYPEDEF_(0x80110474L) -#define COMADMIN_E_REGDB_ALREADYRUNNING _HRESULT_TYPEDEF_(0x80110475L) -#define COMADMIN_E_MIG_VERSIONNOTSUPPORTED _HRESULT_TYPEDEF_(0x80110480L) -#define COMADMIN_E_MIG_SCHEMANOTFOUND _HRESULT_TYPEDEF_(0x80110481L) -#define COMADMIN_E_CAT_BITNESSMISMATCH _HRESULT_TYPEDEF_(0x80110482L) -#define COMADMIN_E_CAT_UNACCEPTABLEBITNESS _HRESULT_TYPEDEF_(0x80110483L) -#define COMADMIN_E_CAT_WRONGAPPBITNESS _HRESULT_TYPEDEF_(0x80110484L) -#define COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED _HRESULT_TYPEDEF_(0x80110485L) -#define COMADMIN_E_CAT_SERVERFAULT _HRESULT_TYPEDEF_(0x80110486L) -#define COMQC_E_APPLICATION_NOT_QUEUED _HRESULT_TYPEDEF_(0x80110600L) -#define COMQC_E_NO_QUEUEABLE_INTERFACES _HRESULT_TYPEDEF_(0x80110601L) -#define COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE _HRESULT_TYPEDEF_(0x80110602L) -#define COMQC_E_NO_IPERSISTSTREAM _HRESULT_TYPEDEF_(0x80110603L) -#define COMQC_E_BAD_MESSAGE _HRESULT_TYPEDEF_(0x80110604L) -#define COMQC_E_UNAUTHENTICATED _HRESULT_TYPEDEF_(0x80110605L) -#define COMQC_E_UNTRUSTED_ENQUEUER _HRESULT_TYPEDEF_(0x80110606L) -#define MSDTC_E_DUPLICATE_RESOURCE _HRESULT_TYPEDEF_(0x80110701L) -#define COMADMIN_E_OBJECT_PARENT_MISSING _HRESULT_TYPEDEF_(0x80110808L) -#define COMADMIN_E_OBJECT_DOES_NOT_EXIST _HRESULT_TYPEDEF_(0x80110809L) -#define COMADMIN_E_APP_NOT_RUNNING _HRESULT_TYPEDEF_(0x8011080AL) -#define COMADMIN_E_INVALID_PARTITION _HRESULT_TYPEDEF_(0x8011080BL) -#define COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE _HRESULT_TYPEDEF_(0x8011080DL) -#define COMADMIN_E_USER_IN_SET _HRESULT_TYPEDEF_(0x8011080EL) -#define COMADMIN_E_CANTRECYCLELIBRARYAPPS _HRESULT_TYPEDEF_(0x8011080FL) -#define COMADMIN_E_CANTRECYCLESERVICEAPPS _HRESULT_TYPEDEF_(0x80110811L) -#define COMADMIN_E_PROCESSALREADYRECYCLED _HRESULT_TYPEDEF_(0x80110812L) -#define COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED _HRESULT_TYPEDEF_(0x80110813L) -#define COMADMIN_E_CANTMAKEINPROCSERVICE _HRESULT_TYPEDEF_(0x80110814L) -#define COMADMIN_E_PROGIDINUSEBYCLSID _HRESULT_TYPEDEF_(0x80110815L) -#define COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET _HRESULT_TYPEDEF_(0x80110816L) -#define COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED _HRESULT_TYPEDEF_(0x80110817L) -#define COMADMIN_E_PARTITION_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110818L) -#define COMADMIN_E_PARTITION_MSI_ONLY _HRESULT_TYPEDEF_(0x80110819L) -#define COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT _HRESULT_TYPEDEF_(0x8011081AL) -#define COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS _HRESULT_TYPEDEF_(0x8011081BL) -#define COMADMIN_E_COMP_MOVE_SOURCE _HRESULT_TYPEDEF_(0x8011081CL) -#define COMADMIN_E_COMP_MOVE_DEST _HRESULT_TYPEDEF_(0x8011081DL) -#define COMADMIN_E_COMP_MOVE_PRIVATE _HRESULT_TYPEDEF_(0x8011081EL) -#define COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET _HRESULT_TYPEDEF_(0x8011081FL) -#define COMADMIN_E_CANNOT_ALIAS_EVENTCLASS _HRESULT_TYPEDEF_(0x80110820L) -#define COMADMIN_E_PRIVATE_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110821L) -#define COMADMIN_E_SAFERINVALID _HRESULT_TYPEDEF_(0x80110822L) -#define COMADMIN_E_REGISTRY_ACCESSDENIED _HRESULT_TYPEDEF_(0x80110823L) -#define COMADMIN_E_PARTITIONS_DISABLED _HRESULT_TYPEDEF_(0x80110824L) -#endif /* _WINERROR_ */ diff --git a/win32/include/winapi/wingdi.h b/win32/include/winapi/wingdi.h deleted file mode 100644 index 63d38917..00000000 --- a/win32/include/winapi/wingdi.h +++ /dev/null @@ -1,4080 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINGDI_ -#define _WINGDI_ - -#define WINGDIAPI DECLSPEC_IMPORT -#define WINSPOOLAPI DECLSPEC_IMPORT - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef WINVER -#define WINVER 0x0502 -#endif - -#ifndef NOGDI -#ifndef NORASTEROPS -#define R2_BLACK 1 -#define R2_NOTMERGEPEN 2 -#define R2_MASKNOTPEN 3 -#define R2_NOTCOPYPEN 4 -#define R2_MASKPENNOT 5 -#define R2_NOT 6 -#define R2_XORPEN 7 -#define R2_NOTMASKPEN 8 -#define R2_MASKPEN 9 -#define R2_NOTXORPEN 10 -#define R2_NOP 11 -#define R2_MERGENOTPEN 12 -#define R2_COPYPEN 13 -#define R2_MERGEPENNOT 14 -#define R2_MERGEPEN 15 -#define R2_WHITE 16 -#define R2_LAST 16 - -#define SRCCOPY (DWORD)0x00CC0020 -#define SRCPAINT (DWORD)0x00EE0086 -#define SRCAND (DWORD)0x008800C6 -#define SRCINVERT (DWORD)0x00660046 -#define SRCERASE (DWORD)0x00440328 -#define NOTSRCCOPY (DWORD)0x00330008 -#define NOTSRCERASE (DWORD)0x001100A6 -#define MERGECOPY (DWORD)0x00C000CA -#define MERGEPAINT (DWORD)0x00BB0226 -#define PATCOPY (DWORD)0x00F00021 -#define PATPAINT (DWORD)0x00FB0A09 -#define PATINVERT (DWORD)0x005A0049 -#define DSTINVERT (DWORD)0x00550009 -#define BLACKNESS (DWORD)0x00000042 -#define WHITENESS (DWORD)0x00FF0062 -#define NOMIRRORBITMAP (DWORD)0x80000000 -#define CAPTUREBLT (DWORD)0x40000000 -#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) -#endif - -#define GDI_ERROR (0xFFFFFFFFL) -#define HGDI_ERROR (LongToHandle(0xFFFFFFFFL)) - -#define ERROR 0 -#define NULLREGION 1 -#define SIMPLEREGION 2 -#define COMPLEXREGION 3 -#define RGN_ERROR ERROR - -#define RGN_AND 1 -#define RGN_OR 2 -#define RGN_XOR 3 -#define RGN_DIFF 4 -#define RGN_COPY 5 -#define RGN_MIN RGN_AND -#define RGN_MAX RGN_COPY - -#define BLACKONWHITE 1 -#define WHITEONBLACK 2 -#define COLORONCOLOR 3 -#define HALFTONE 4 -#define MAXSTRETCHBLTMODE 4 - -#define STRETCH_ANDSCANS BLACKONWHITE -#define STRETCH_ORSCANS WHITEONBLACK -#define STRETCH_DELETESCANS COLORONCOLOR -#define STRETCH_HALFTONE HALFTONE - -#define ALTERNATE 1 -#define WINDING 2 -#define POLYFILL_LAST 2 - -#define LAYOUT_RTL 0x00000001 -#define LAYOUT_BTT 0x00000002 -#define LAYOUT_VBH 0x00000004 -#define LAYOUT_ORIENTATIONMASK (LAYOUT_RTL | LAYOUT_BTT | LAYOUT_VBH) -#define LAYOUT_BITMAPORIENTATIONPRESERVED 0x00000008 - -#define TA_NOUPDATECP 0 -#define TA_UPDATECP 1 - -#define TA_LEFT 0 -#define TA_RIGHT 2 -#define TA_CENTER 6 - -#define TA_TOP 0 -#define TA_BOTTOM 8 -#define TA_BASELINE 24 -#define TA_RTLREADING 256 -#define TA_MASK (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING) - -#define VTA_BASELINE TA_BASELINE -#define VTA_LEFT TA_BOTTOM -#define VTA_RIGHT TA_TOP -#define VTA_CENTER TA_CENTER -#define VTA_BOTTOM TA_RIGHT -#define VTA_TOP TA_LEFT - -#define ETO_OPAQUE 0x0002 -#define ETO_CLIPPED 0x0004 -#define ETO_GLYPH_INDEX 0x0010 -#define ETO_RTLREADING 0x0080 -#define ETO_NUMERICSLOCAL 0x0400 -#define ETO_NUMERICSLATIN 0x0800 -#define ETO_IGNORELANGUAGE 0x1000 -#define ETO_PDY 0x2000 - -#define ASPECT_FILTERING 0x0001 - -#define DCB_RESET 0x0001 -#define DCB_ACCUMULATE 0x0002 -#define DCB_DIRTY DCB_ACCUMULATE -#define DCB_SET (DCB_RESET | DCB_ACCUMULATE) -#define DCB_ENABLE 0x0004 -#define DCB_DISABLE 0x0008 - -#ifndef NOMETAFILE - -#define META_SETBKCOLOR 0x0201 -#define META_SETBKMODE 0x0102 -#define META_SETMAPMODE 0x0103 -#define META_SETROP2 0x0104 -#define META_SETRELABS 0x0105 -#define META_SETPOLYFILLMODE 0x0106 -#define META_SETSTRETCHBLTMODE 0x0107 -#define META_SETTEXTCHAREXTRA 0x0108 -#define META_SETTEXTCOLOR 0x0209 -#define META_SETTEXTJUSTIFICATION 0x020A -#define META_SETWINDOWORG 0x020B -#define META_SETWINDOWEXT 0x020C -#define META_SETVIEWPORTORG 0x020D -#define META_SETVIEWPORTEXT 0x020E -#define META_OFFSETWINDOWORG 0x020F -#define META_SCALEWINDOWEXT 0x0410 -#define META_OFFSETVIEWPORTORG 0x0211 -#define META_SCALEVIEWPORTEXT 0x0412 -#define META_LINETO 0x0213 -#define META_MOVETO 0x0214 -#define META_EXCLUDECLIPRECT 0x0415 -#define META_INTERSECTCLIPRECT 0x0416 -#define META_ARC 0x0817 -#define META_ELLIPSE 0x0418 -#define META_FLOODFILL 0x0419 -#define META_PIE 0x081A -#define META_RECTANGLE 0x041B -#define META_ROUNDRECT 0x061C -#define META_PATBLT 0x061D -#define META_SAVEDC 0x001E -#define META_SETPIXEL 0x041F -#define META_OFFSETCLIPRGN 0x0220 -#define META_TEXTOUT 0x0521 -#define META_BITBLT 0x0922 -#define META_STRETCHBLT 0x0B23 -#define META_POLYGON 0x0324 -#define META_POLYLINE 0x0325 -#define META_ESCAPE 0x0626 -#define META_RESTOREDC 0x0127 -#define META_FILLREGION 0x0228 -#define META_FRAMEREGION 0x0429 -#define META_INVERTREGION 0x012A -#define META_PAINTREGION 0x012B -#define META_SELECTCLIPREGION 0x012C -#define META_SELECTOBJECT 0x012D -#define META_SETTEXTALIGN 0x012E -#define META_CHORD 0x0830 -#define META_SETMAPPERFLAGS 0x0231 -#define META_EXTTEXTOUT 0x0a32 -#define META_SETDIBTODEV 0x0d33 -#define META_SELECTPALETTE 0x0234 -#define META_REALIZEPALETTE 0x0035 -#define META_ANIMATEPALETTE 0x0436 -#define META_SETPALENTRIES 0x0037 -#define META_POLYPOLYGON 0x0538 -#define META_RESIZEPALETTE 0x0139 -#define META_DIBBITBLT 0x0940 -#define META_DIBSTRETCHBLT 0x0b41 -#define META_DIBCREATEPATTERNBRUSH 0x0142 -#define META_STRETCHDIB 0x0f43 -#define META_EXTFLOODFILL 0x0548 -#define META_SETLAYOUT 0x0149 -#define META_DELETEOBJECT 0x01f0 -#define META_CREATEPALETTE 0x00f7 -#define META_CREATEPATTERNBRUSH 0x01F9 -#define META_CREATEPENINDIRECT 0x02FA -#define META_CREATEFONTINDIRECT 0x02FB -#define META_CREATEBRUSHINDIRECT 0x02FC -#define META_CREATEREGION 0x06FF - - typedef struct _DRAWPATRECT { - POINT ptPosition; - POINT ptSize; - WORD wStyle; - WORD wPattern; - } DRAWPATRECT,*PDRAWPATRECT; -#endif - -#define NEWFRAME 1 -#define ABORTDOC 2 -#define NEXTBAND 3 -#define SETCOLORTABLE 4 -#define GETCOLORTABLE 5 -#define FLUSHOUTPUT 6 -#define DRAFTMODE 7 -#define QUERYESCSUPPORT 8 -#define SETABORTPROC 9 -#define STARTDOC 10 -#define ENDDOC 11 -#define GETPHYSPAGESIZE 12 -#define GETPRINTINGOFFSET 13 -#define GETSCALINGFACTOR 14 -#define MFCOMMENT 15 -#define GETPENWIDTH 16 -#define SETCOPYCOUNT 17 -#define SELECTPAPERSOURCE 18 -#define DEVICEDATA 19 -#define PASSTHROUGH 19 -#define GETTECHNOLGY 20 -#define GETTECHNOLOGY 20 -#define SETLINECAP 21 -#define SETLINEJOIN 22 -#define SETMITERLIMIT 23 -#define BANDINFO 24 -#define DRAWPATTERNRECT 25 -#define GETVECTORPENSIZE 26 -#define GETVECTORBRUSHSIZE 27 -#define ENABLEDUPLEX 28 -#define GETSETPAPERBINS 29 -#define GETSETPRINTORIENT 30 -#define ENUMPAPERBINS 31 -#define SETDIBSCALING 32 -#define EPSPRINTING 33 -#define ENUMPAPERMETRICS 34 -#define GETSETPAPERMETRICS 35 -#define POSTSCRIPT_DATA 37 -#define POSTSCRIPT_IGNORE 38 -#define MOUSETRAILS 39 -#define GETDEVICEUNITS 42 - -#define GETEXTENDEDTEXTMETRICS 256 -#define GETEXTENTTABLE 257 -#define GETPAIRKERNTABLE 258 -#define GETTRACKKERNTABLE 259 -#define EXTTEXTOUT 512 -#define GETFACENAME 513 -#define DOWNLOADFACE 514 -#define ENABLERELATIVEWIDTHS 768 -#define ENABLEPAIRKERNING 769 -#define SETKERNTRACK 770 -#define SETALLJUSTVALUES 771 -#define SETCHARSET 772 - -#define STRETCHBLT 2048 -#define METAFILE_DRIVER 2049 -#define GETSETSCREENPARAMS 3072 -#define QUERYDIBSUPPORT 3073 -#define BEGIN_PATH 4096 -#define CLIP_TO_PATH 4097 -#define END_PATH 4098 -#define EXT_DEVICE_CAPS 4099 -#define RESTORE_CTM 4100 -#define SAVE_CTM 4101 -#define SET_ARC_DIRECTION 4102 -#define SET_BACKGROUND_COLOR 4103 -#define SET_POLY_MODE 4104 -#define SET_SCREEN_ANGLE 4105 -#define SET_SPREAD 4106 -#define TRANSFORM_CTM 4107 -#define SET_CLIP_BOX 4108 -#define SET_BOUNDS 4109 -#define SET_MIRROR_MODE 4110 -#define OPENCHANNEL 4110 -#define DOWNLOADHEADER 4111 -#define CLOSECHANNEL 4112 -#define POSTSCRIPT_PASSTHROUGH 4115 -#define ENCAPSULATED_POSTSCRIPT 4116 - -#define POSTSCRIPT_IDENTIFY 4117 -#define POSTSCRIPT_INJECTION 4118 - -#define CHECKJPEGFORMAT 4119 -#define CHECKPNGFORMAT 4120 - -#define GET_PS_FEATURESETTING 4121 - -#define SPCLPASSTHROUGH2 4568 - -#define PSIDENT_GDICENTRIC 0 -#define PSIDENT_PSCENTRIC 1 - - typedef struct _PSINJECTDATA { - DWORD DataBytes; - WORD InjectionPoint; - WORD PageNumber; - } PSINJECTDATA,*PPSINJECTDATA; - -#define PSINJECT_BEGINSTREAM 1 -#define PSINJECT_PSADOBE 2 -#define PSINJECT_PAGESATEND 3 -#define PSINJECT_PAGES 4 - -#define PSINJECT_DOCNEEDEDRES 5 -#define PSINJECT_DOCSUPPLIEDRES 6 -#define PSINJECT_PAGEORDER 7 -#define PSINJECT_ORIENTATION 8 -#define PSINJECT_BOUNDINGBOX 9 -#define PSINJECT_DOCUMENTPROCESSCOLORS 10 - -#define PSINJECT_COMMENTS 11 -#define PSINJECT_BEGINDEFAULTS 12 -#define PSINJECT_ENDDEFAULTS 13 -#define PSINJECT_BEGINPROLOG 14 -#define PSINJECT_ENDPROLOG 15 -#define PSINJECT_BEGINSETUP 16 -#define PSINJECT_ENDSETUP 17 -#define PSINJECT_TRAILER 18 -#define PSINJECT_EOF 19 -#define PSINJECT_ENDSTREAM 20 -#define PSINJECT_DOCUMENTPROCESSCOLORSATEND 21 - -#define PSINJECT_PAGENUMBER 100 -#define PSINJECT_BEGINPAGESETUP 101 -#define PSINJECT_ENDPAGESETUP 102 -#define PSINJECT_PAGETRAILER 103 -#define PSINJECT_PLATECOLOR 104 - -#define PSINJECT_SHOWPAGE 105 -#define PSINJECT_PAGEBBOX 106 -#define PSINJECT_ENDPAGECOMMENTS 107 - -#define PSINJECT_VMSAVE 200 -#define PSINJECT_VMRESTORE 201 - -#define FEATURESETTING_NUP 0 -#define FEATURESETTING_OUTPUT 1 -#define FEATURESETTING_PSLEVEL 2 -#define FEATURESETTING_CUSTPAPER 3 -#define FEATURESETTING_MIRROR 4 -#define FEATURESETTING_NEGATIVE 5 -#define FEATURESETTING_PROTOCOL 6 - -#define FEATURESETTING_PRIVATE_BEGIN 0x1000 -#define FEATURESETTING_PRIVATE_END 0x1FFF - - typedef struct _PSFEATURE_OUTPUT { - WINBOOL bPageIndependent; - WINBOOL bSetPageDevice; - } PSFEATURE_OUTPUT,*PPSFEATURE_OUTPUT; - - typedef struct _PSFEATURE_CUSTPAPER { - LONG lOrientation; - LONG lWidth; - LONG lHeight; - LONG lWidthOffset; - LONG lHeightOffset; - } PSFEATURE_CUSTPAPER,*PPSFEATURE_CUSTPAPER; - -#define PSPROTOCOL_ASCII 0 -#define PSPROTOCOL_BCP 1 -#define PSPROTOCOL_TBCP 2 -#define PSPROTOCOL_BINARY 3 - -#define QDI_SETDIBITS 1 -#define QDI_GETDIBITS 2 -#define QDI_DIBTOSCREEN 4 -#define QDI_STRETCHDIB 8 - -#define SP_NOTREPORTED 0x4000 -#define SP_ERROR (-1) -#define SP_APPABORT (-2) -#define SP_USERABORT (-3) -#define SP_OUTOFDISK (-4) -#define SP_OUTOFMEMORY (-5) - -#define PR_JOBSTATUS 0x0000 - -#define OBJ_PEN 1 -#define OBJ_BRUSH 2 -#define OBJ_DC 3 -#define OBJ_METADC 4 -#define OBJ_PAL 5 -#define OBJ_FONT 6 -#define OBJ_BITMAP 7 -#define OBJ_REGION 8 -#define OBJ_METAFILE 9 -#define OBJ_MEMDC 10 -#define OBJ_EXTPEN 11 -#define OBJ_ENHMETADC 12 -#define OBJ_ENHMETAFILE 13 -#define OBJ_COLORSPACE 14 - -#define MWT_IDENTITY 1 -#define MWT_LEFTMULTIPLY 2 -#define MWT_RIGHTMULTIPLY 3 - -#define MWT_MIN MWT_IDENTITY -#define MWT_MAX MWT_RIGHTMULTIPLY - -#define _XFORM_ - typedef struct tagXFORM { - FLOAT eM11; - FLOAT eM12; - FLOAT eM21; - FLOAT eM22; - FLOAT eDx; - FLOAT eDy; - } XFORM,*PXFORM,*LPXFORM; - - typedef struct tagBITMAP { - LONG bmType; - LONG bmWidth; - LONG bmHeight; - LONG bmWidthBytes; - WORD bmPlanes; - WORD bmBitsPixel; - LPVOID bmBits; - } BITMAP,*PBITMAP,*NPBITMAP,*LPBITMAP; - -#include - typedef struct tagRGBTRIPLE { - BYTE rgbtBlue; - BYTE rgbtGreen; - BYTE rgbtRed; - } RGBTRIPLE; -#include - - typedef struct tagRGBQUAD { - BYTE rgbBlue; - BYTE rgbGreen; - BYTE rgbRed; - BYTE rgbReserved; - } RGBQUAD; - typedef RGBQUAD *LPRGBQUAD; - -#define CS_ENABLE 0x00000001L -#define CS_DISABLE 0x00000002L -#define CS_DELETE_TRANSFORM 0x00000003L - -//!__TINYC__: #define LCS_SIGNATURE 'PSOC' -//!__TINYC__: #define LCS_sRGB 'sRGB' -//!__TINYC__: #define LCS_WINDOWS_COLOR_SPACE 'Win ' - - typedef LONG LCSCSTYPE; -#define LCS_CALIBRATED_RGB 0x00000000L - - typedef LONG LCSGAMUTMATCH; -#define LCS_GM_BUSINESS 0x00000001L -#define LCS_GM_GRAPHICS 0x00000002L -#define LCS_GM_IMAGES 0x00000004L -#define LCS_GM_ABS_COLORIMETRIC 0x00000008L - -#define CM_OUT_OF_GAMUT 255 -#define CM_IN_GAMUT 0 - -#define ICM_ADDPROFILE 1 -#define ICM_DELETEPROFILE 2 -#define ICM_QUERYPROFILE 3 -#define ICM_SETDEFAULTPROFILE 4 -#define ICM_REGISTERICMATCHER 5 -#define ICM_UNREGISTERICMATCHER 6 -#define ICM_QUERYMATCH 7 - -#define GetKValue(cmyk) ((BYTE)(cmyk)) -#define GetYValue(cmyk) ((BYTE)((cmyk)>> 8)) -#define GetMValue(cmyk) ((BYTE)((cmyk)>>16)) -#define GetCValue(cmyk) ((BYTE)((cmyk)>>24)) - -#define CMYK(c,m,y,k) ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24))) - - typedef long FXPT16DOT16,*LPFXPT16DOT16; - typedef long FXPT2DOT30,*LPFXPT2DOT30; - - typedef struct tagCIEXYZ { - FXPT2DOT30 ciexyzX; - FXPT2DOT30 ciexyzY; - FXPT2DOT30 ciexyzZ; - } CIEXYZ; - typedef CIEXYZ *LPCIEXYZ; - - typedef struct tagICEXYZTRIPLE { - CIEXYZ ciexyzRed; - CIEXYZ ciexyzGreen; - CIEXYZ ciexyzBlue; - } CIEXYZTRIPLE; - - typedef CIEXYZTRIPLE *LPCIEXYZTRIPLE; - - typedef struct tagLOGCOLORSPACEA { - DWORD lcsSignature; - DWORD lcsVersion; - DWORD lcsSize; - LCSCSTYPE lcsCSType; - LCSGAMUTMATCH lcsIntent; - CIEXYZTRIPLE lcsEndpoints; - DWORD lcsGammaRed; - DWORD lcsGammaGreen; - DWORD lcsGammaBlue; - CHAR lcsFilename[MAX_PATH]; - } LOGCOLORSPACEA,*LPLOGCOLORSPACEA; - - typedef struct tagLOGCOLORSPACEW { - DWORD lcsSignature; - DWORD lcsVersion; - DWORD lcsSize; - LCSCSTYPE lcsCSType; - LCSGAMUTMATCH lcsIntent; - CIEXYZTRIPLE lcsEndpoints; - DWORD lcsGammaRed; - DWORD lcsGammaGreen; - DWORD lcsGammaBlue; - WCHAR lcsFilename[MAX_PATH]; - } LOGCOLORSPACEW,*LPLOGCOLORSPACEW; - -#ifdef UNICODE - typedef LOGCOLORSPACEW LOGCOLORSPACE; - typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE; -#else - typedef LOGCOLORSPACEA LOGCOLORSPACE; - typedef LPLOGCOLORSPACEA LPLOGCOLORSPACE; -#endif - - typedef struct tagBITMAPCOREHEADER { - DWORD bcSize; - WORD bcWidth; - WORD bcHeight; - WORD bcPlanes; - WORD bcBitCount; - } BITMAPCOREHEADER,*LPBITMAPCOREHEADER,*PBITMAPCOREHEADER; - - typedef struct tagBITMAPINFOHEADER { - DWORD biSize; - LONG biWidth; - LONG biHeight; - WORD biPlanes; - WORD biBitCount; - DWORD biCompression; - DWORD biSizeImage; - LONG biXPelsPerMeter; - LONG biYPelsPerMeter; - DWORD biClrUsed; - DWORD biClrImportant; - } BITMAPINFOHEADER,*LPBITMAPINFOHEADER,*PBITMAPINFOHEADER; - - typedef struct { - DWORD bV4Size; - LONG bV4Width; - LONG bV4Height; - WORD bV4Planes; - WORD bV4BitCount; - DWORD bV4V4Compression; - DWORD bV4SizeImage; - LONG bV4XPelsPerMeter; - LONG bV4YPelsPerMeter; - DWORD bV4ClrUsed; - DWORD bV4ClrImportant; - DWORD bV4RedMask; - DWORD bV4GreenMask; - DWORD bV4BlueMask; - DWORD bV4AlphaMask; - DWORD bV4CSType; - CIEXYZTRIPLE bV4Endpoints; - DWORD bV4GammaRed; - DWORD bV4GammaGreen; - DWORD bV4GammaBlue; - } BITMAPV4HEADER,*LPBITMAPV4HEADER,*PBITMAPV4HEADER; - - typedef struct { - DWORD bV5Size; - LONG bV5Width; - LONG bV5Height; - WORD bV5Planes; - WORD bV5BitCount; - DWORD bV5Compression; - DWORD bV5SizeImage; - LONG bV5XPelsPerMeter; - LONG bV5YPelsPerMeter; - DWORD bV5ClrUsed; - DWORD bV5ClrImportant; - DWORD bV5RedMask; - DWORD bV5GreenMask; - DWORD bV5BlueMask; - DWORD bV5AlphaMask; - DWORD bV5CSType; - CIEXYZTRIPLE bV5Endpoints; - DWORD bV5GammaRed; - DWORD bV5GammaGreen; - DWORD bV5GammaBlue; - DWORD bV5Intent; - DWORD bV5ProfileData; - DWORD bV5ProfileSize; - DWORD bV5Reserved; - } BITMAPV5HEADER,*LPBITMAPV5HEADER,*PBITMAPV5HEADER; - -//!__TINYC__: #define PROFILE_LINKED 'LINK' -//!__TINYC__: #define PROFILE_EMBEDDED 'MBED' - -#define BI_RGB 0L -#define BI_RLE8 1L -#define BI_RLE4 2L -#define BI_BITFIELDS 3L -#define BI_JPEG 4L -#define BI_PNG 5L - - typedef struct tagBITMAPINFO { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[1]; - } BITMAPINFO,*LPBITMAPINFO,*PBITMAPINFO; - - typedef struct tagBITMAPCOREINFO { - BITMAPCOREHEADER bmciHeader; - RGBTRIPLE bmciColors[1]; - } BITMAPCOREINFO,*LPBITMAPCOREINFO,*PBITMAPCOREINFO; - -#include - typedef struct tagBITMAPFILEHEADER { - WORD bfType; - DWORD bfSize; - WORD bfReserved1; - WORD bfReserved2; - DWORD bfOffBits; - } BITMAPFILEHEADER,*LPBITMAPFILEHEADER,*PBITMAPFILEHEADER; -#include - -#define MAKEPOINTS(l) (*((POINTS *)&(l))) - -#ifndef NOFONTSIG - typedef struct tagFONTSIGNATURE { - DWORD fsUsb[4]; - DWORD fsCsb[2]; - } FONTSIGNATURE,*PFONTSIGNATURE,*LPFONTSIGNATURE; - - typedef struct tagCHARSETINFO { - UINT ciCharset; - UINT ciACP; - FONTSIGNATURE fs; - } CHARSETINFO,*PCHARSETINFO,*NPCHARSETINFO,*LPCHARSETINFO; - -#define TCI_SRCCHARSET 1 -#define TCI_SRCCODEPAGE 2 -#define TCI_SRCFONTSIG 3 -#define TCI_SRCLOCALE 0x1000 - - typedef struct tagLOCALESIGNATURE { - DWORD lsUsb[4]; - DWORD lsCsbDefault[2]; - DWORD lsCsbSupported[2]; - } LOCALESIGNATURE,*PLOCALESIGNATURE,*LPLOCALESIGNATURE; -#endif - - -#ifndef NOMETAFILE - typedef struct tagHANDLETABLE { - HGDIOBJ objectHandle[1]; - } HANDLETABLE,*PHANDLETABLE,*LPHANDLETABLE; - - typedef struct tagMETARECORD { - DWORD rdSize; - WORD rdFunction; - WORD rdParm[1]; - } METARECORD; - typedef struct tagMETARECORD UNALIGNED *PMETARECORD; - typedef struct tagMETARECORD UNALIGNED *LPMETARECORD; - - typedef struct tagMETAFILEPICT { - LONG mm; - LONG xExt; - LONG yExt; - HMETAFILE hMF; - } METAFILEPICT,*LPMETAFILEPICT; - -#include - typedef struct tagMETAHEADER { - WORD mtType; - WORD mtHeaderSize; - WORD mtVersion; - DWORD mtSize; - WORD mtNoObjects; - DWORD mtMaxRecord; - WORD mtNoParameters; - } METAHEADER; - typedef struct tagMETAHEADER UNALIGNED *PMETAHEADER; - typedef struct tagMETAHEADER UNALIGNED *LPMETAHEADER; - -#include - - typedef struct tagENHMETARECORD { - DWORD iType; - DWORD nSize; - DWORD dParm[1]; - } ENHMETARECORD,*PENHMETARECORD,*LPENHMETARECORD; - - typedef struct tagENHMETAHEADER { - DWORD iType; - DWORD nSize; - RECTL rclBounds; - RECTL rclFrame; - DWORD dSignature; - DWORD nVersion; - DWORD nBytes; - DWORD nRecords; - WORD nHandles; - WORD sReserved; - DWORD nDescription; - DWORD offDescription; - DWORD nPalEntries; - SIZEL szlDevice; - SIZEL szlMillimeters; - DWORD cbPixelFormat; - DWORD offPixelFormat; - DWORD bOpenGL; - SIZEL szlMicrometers; - } ENHMETAHEADER,*PENHMETAHEADER,*LPENHMETAHEADER; -#endif - -#ifndef NOTEXTMETRIC -#define TMPF_FIXED_PITCH 0x01 -#define TMPF_VECTOR 0x02 -#define TMPF_DEVICE 0x08 -#define TMPF_TRUETYPE 0x04 - -#ifdef UNICODE - typedef WCHAR BCHAR; -#else - typedef BYTE BCHAR; -#endif - -#ifndef _TEXTMETRIC_DEFINED -#define _TEXTMETRIC_DEFINED - typedef struct tagTEXTMETRICA { - LONG tmHeight; - LONG tmAscent; - LONG tmDescent; - LONG tmInternalLeading; - LONG tmExternalLeading; - LONG tmAveCharWidth; - LONG tmMaxCharWidth; - LONG tmWeight; - LONG tmOverhang; - LONG tmDigitizedAspectX; - LONG tmDigitizedAspectY; - BYTE tmFirstChar; - BYTE tmLastChar; - BYTE tmDefaultChar; - BYTE tmBreakChar; - BYTE tmItalic; - BYTE tmUnderlined; - BYTE tmStruckOut; - BYTE tmPitchAndFamily; - BYTE tmCharSet; - } TEXTMETRICA,*PTEXTMETRICA,*NPTEXTMETRICA,*LPTEXTMETRICA; - - typedef struct tagTEXTMETRICW { - LONG tmHeight; - LONG tmAscent; - LONG tmDescent; - LONG tmInternalLeading; - LONG tmExternalLeading; - LONG tmAveCharWidth; - LONG tmMaxCharWidth; - LONG tmWeight; - LONG tmOverhang; - LONG tmDigitizedAspectX; - LONG tmDigitizedAspectY; - WCHAR tmFirstChar; - WCHAR tmLastChar; - WCHAR tmDefaultChar; - WCHAR tmBreakChar; - BYTE tmItalic; - BYTE tmUnderlined; - BYTE tmStruckOut; - BYTE tmPitchAndFamily; - BYTE tmCharSet; - } TEXTMETRICW,*PTEXTMETRICW,*NPTEXTMETRICW,*LPTEXTMETRICW; -#ifdef UNICODE - typedef TEXTMETRICW TEXTMETRIC; - typedef PTEXTMETRICW PTEXTMETRIC; - typedef NPTEXTMETRICW NPTEXTMETRIC; - typedef LPTEXTMETRICW LPTEXTMETRIC; -#else - typedef TEXTMETRICA TEXTMETRIC; - typedef PTEXTMETRICA PTEXTMETRIC; - typedef NPTEXTMETRICA NPTEXTMETRIC; - typedef LPTEXTMETRICA LPTEXTMETRIC; -#endif -#endif - -#define NTM_REGULAR 0x00000040L -#define NTM_BOLD 0x00000020L -#define NTM_ITALIC 0x00000001L - -#define NTM_NONNEGATIVE_AC 0x00010000 -#define NTM_PS_OPENTYPE 0x00020000 -#define NTM_TT_OPENTYPE 0x00040000 -#define NTM_MULTIPLEMASTER 0x00080000 -#define NTM_TYPE1 0x00100000 -#define NTM_DSIG 0x00200000 - -#include - typedef struct tagNEWTEXTMETRICA { - LONG tmHeight; - LONG tmAscent; - LONG tmDescent; - LONG tmInternalLeading; - LONG tmExternalLeading; - LONG tmAveCharWidth; - LONG tmMaxCharWidth; - LONG tmWeight; - LONG tmOverhang; - LONG tmDigitizedAspectX; - LONG tmDigitizedAspectY; - BYTE tmFirstChar; - BYTE tmLastChar; - BYTE tmDefaultChar; - BYTE tmBreakChar; - BYTE tmItalic; - BYTE tmUnderlined; - BYTE tmStruckOut; - BYTE tmPitchAndFamily; - BYTE tmCharSet; - DWORD ntmFlags; - UINT ntmSizeEM; - UINT ntmCellHeight; - UINT ntmAvgWidth; - } NEWTEXTMETRICA,*PNEWTEXTMETRICA,*NPNEWTEXTMETRICA,*LPNEWTEXTMETRICA; - - typedef struct tagNEWTEXTMETRICW { - LONG tmHeight; - LONG tmAscent; - LONG tmDescent; - LONG tmInternalLeading; - LONG tmExternalLeading; - LONG tmAveCharWidth; - LONG tmMaxCharWidth; - LONG tmWeight; - LONG tmOverhang; - LONG tmDigitizedAspectX; - LONG tmDigitizedAspectY; - WCHAR tmFirstChar; - WCHAR tmLastChar; - WCHAR tmDefaultChar; - WCHAR tmBreakChar; - BYTE tmItalic; - BYTE tmUnderlined; - BYTE tmStruckOut; - BYTE tmPitchAndFamily; - BYTE tmCharSet; - DWORD ntmFlags; - UINT ntmSizeEM; - UINT ntmCellHeight; - UINT ntmAvgWidth; - } NEWTEXTMETRICW,*PNEWTEXTMETRICW,*NPNEWTEXTMETRICW,*LPNEWTEXTMETRICW; -#ifdef UNICODE - typedef NEWTEXTMETRICW NEWTEXTMETRIC; - typedef PNEWTEXTMETRICW PNEWTEXTMETRIC; - typedef NPNEWTEXTMETRICW NPNEWTEXTMETRIC; - typedef LPNEWTEXTMETRICW LPNEWTEXTMETRIC; -#else - typedef NEWTEXTMETRICA NEWTEXTMETRIC; - typedef PNEWTEXTMETRICA PNEWTEXTMETRIC; - typedef NPNEWTEXTMETRICA NPNEWTEXTMETRIC; - typedef LPNEWTEXTMETRICA LPNEWTEXTMETRIC; -#endif -#include - - typedef struct tagNEWTEXTMETRICEXA { - NEWTEXTMETRICA ntmTm; - FONTSIGNATURE ntmFontSig; - } NEWTEXTMETRICEXA; - - typedef struct tagNEWTEXTMETRICEXW { - NEWTEXTMETRICW ntmTm; - FONTSIGNATURE ntmFontSig; - } NEWTEXTMETRICEXW; -#ifdef UNICODE - typedef NEWTEXTMETRICEXW NEWTEXTMETRICEX; -#else - typedef NEWTEXTMETRICEXA NEWTEXTMETRICEX; -#endif -#endif - - typedef struct tagPELARRAY { - LONG paXCount; - LONG paYCount; - LONG paXExt; - LONG paYExt; - BYTE paRGBs; - } PELARRAY,*PPELARRAY,*NPPELARRAY,*LPPELARRAY; - - typedef struct tagLOGBRUSH { - UINT lbStyle; - COLORREF lbColor; - ULONG_PTR lbHatch; - } LOGBRUSH,*PLOGBRUSH,*NPLOGBRUSH,*LPLOGBRUSH; - - typedef struct tagLOGBRUSH32 { - UINT lbStyle; - COLORREF lbColor; - ULONG lbHatch; - } LOGBRUSH32,*PLOGBRUSH32,*NPLOGBRUSH32,*LPLOGBRUSH32; - - typedef LOGBRUSH PATTERN; - typedef PATTERN *PPATTERN; - typedef PATTERN *NPPATTERN; - typedef PATTERN *LPPATTERN; - - typedef struct tagLOGPEN { - UINT lopnStyle; - POINT lopnWidth; - COLORREF lopnColor; - } LOGPEN,*PLOGPEN,*NPLOGPEN,*LPLOGPEN; - - typedef struct tagEXTLOGPEN { - DWORD elpPenStyle; - DWORD elpWidth; - UINT elpBrushStyle; - COLORREF elpColor; - ULONG_PTR elpHatch; - DWORD elpNumEntries; - DWORD elpStyleEntry[1]; - } EXTLOGPEN,*PEXTLOGPEN,*NPEXTLOGPEN,*LPEXTLOGPEN; - -#ifndef _PALETTEENTRY_DEFINED -#define _PALETTEENTRY_DEFINED - typedef struct tagPALETTEENTRY { - BYTE peRed; - BYTE peGreen; - BYTE peBlue; - BYTE peFlags; - } PALETTEENTRY,*PPALETTEENTRY,*LPPALETTEENTRY; -#endif - -#ifndef _LOGPALETTE_DEFINED -#define _LOGPALETTE_DEFINED - - typedef struct tagLOGPALETTE { - WORD palVersion; - WORD palNumEntries; - PALETTEENTRY palPalEntry[1]; - } LOGPALETTE,*PLOGPALETTE,*NPLOGPALETTE,*LPLOGPALETTE; -#endif - -#define LF_FACESIZE 32 - - typedef struct tagLOGFONTA { - LONG lfHeight; - LONG lfWidth; - LONG lfEscapement; - LONG lfOrientation; - LONG lfWeight; - BYTE lfItalic; - BYTE lfUnderline; - BYTE lfStrikeOut; - BYTE lfCharSet; - BYTE lfOutPrecision; - BYTE lfClipPrecision; - BYTE lfQuality; - BYTE lfPitchAndFamily; - CHAR lfFaceName[LF_FACESIZE]; - } LOGFONTA,*PLOGFONTA,*NPLOGFONTA,*LPLOGFONTA; - - typedef struct tagLOGFONTW { - LONG lfHeight; - LONG lfWidth; - LONG lfEscapement; - LONG lfOrientation; - LONG lfWeight; - BYTE lfItalic; - BYTE lfUnderline; - BYTE lfStrikeOut; - BYTE lfCharSet; - BYTE lfOutPrecision; - BYTE lfClipPrecision; - BYTE lfQuality; - BYTE lfPitchAndFamily; - WCHAR lfFaceName[LF_FACESIZE]; - } LOGFONTW,*PLOGFONTW,*NPLOGFONTW,*LPLOGFONTW; -#ifdef UNICODE - typedef LOGFONTW LOGFONT; - typedef PLOGFONTW PLOGFONT; - typedef NPLOGFONTW NPLOGFONT; - typedef LPLOGFONTW LPLOGFONT; -#else - typedef LOGFONTA LOGFONT; - typedef PLOGFONTA PLOGFONT; - typedef NPLOGFONTA NPLOGFONT; - typedef LPLOGFONTA LPLOGFONT; -#endif - -#define LF_FULLFACESIZE 64 - - typedef struct tagENUMLOGFONTA { - LOGFONTA elfLogFont; - BYTE elfFullName[LF_FULLFACESIZE]; - BYTE elfStyle[LF_FACESIZE]; - } ENUMLOGFONTA,*LPENUMLOGFONTA; - - typedef struct tagENUMLOGFONTW { - LOGFONTW elfLogFont; - WCHAR elfFullName[LF_FULLFACESIZE]; - WCHAR elfStyle[LF_FACESIZE]; - } ENUMLOGFONTW,*LPENUMLOGFONTW; -#ifdef UNICODE - typedef ENUMLOGFONTW ENUMLOGFONT; - typedef LPENUMLOGFONTW LPENUMLOGFONT; -#else - typedef ENUMLOGFONTA ENUMLOGFONT; - typedef LPENUMLOGFONTA LPENUMLOGFONT; -#endif - - typedef struct tagENUMLOGFONTEXA { - LOGFONTA elfLogFont; - BYTE elfFullName[LF_FULLFACESIZE]; - BYTE elfStyle[LF_FACESIZE]; - BYTE elfScript[LF_FACESIZE]; - } ENUMLOGFONTEXA,*LPENUMLOGFONTEXA; - - typedef struct tagENUMLOGFONTEXW { - LOGFONTW elfLogFont; - WCHAR elfFullName[LF_FULLFACESIZE]; - WCHAR elfStyle[LF_FACESIZE]; - WCHAR elfScript[LF_FACESIZE]; - } ENUMLOGFONTEXW,*LPENUMLOGFONTEXW; -#ifdef UNICODE - typedef ENUMLOGFONTEXW ENUMLOGFONTEX; - typedef LPENUMLOGFONTEXW LPENUMLOGFONTEX; -#else - typedef ENUMLOGFONTEXA ENUMLOGFONTEX; - typedef LPENUMLOGFONTEXA LPENUMLOGFONTEX; -#endif - -#define OUT_DEFAULT_PRECIS 0 -#define OUT_STRING_PRECIS 1 -#define OUT_CHARACTER_PRECIS 2 -#define OUT_STROKE_PRECIS 3 -#define OUT_TT_PRECIS 4 -#define OUT_DEVICE_PRECIS 5 -#define OUT_RASTER_PRECIS 6 -#define OUT_TT_ONLY_PRECIS 7 -#define OUT_OUTLINE_PRECIS 8 -#define OUT_SCREEN_OUTLINE_PRECIS 9 -#define OUT_PS_ONLY_PRECIS 10 - -#define CLIP_DEFAULT_PRECIS 0 -#define CLIP_CHARACTER_PRECIS 1 -#define CLIP_STROKE_PRECIS 2 -#define CLIP_MASK 0xf -#define CLIP_LH_ANGLES (1<<4) -#define CLIP_TT_ALWAYS (2<<4) -#define CLIP_DFA_DISABLE (4<<4) -#define CLIP_EMBEDDED (8<<4) - -#define DEFAULT_QUALITY 0 -#define DRAFT_QUALITY 1 -#define PROOF_QUALITY 2 -#define NONANTIALIASED_QUALITY 3 -#define ANTIALIASED_QUALITY 4 - -#define CLEARTYPE_QUALITY 5 -#define CLEARTYPE_NATURAL_QUALITY 6 - -#define DEFAULT_PITCH 0 -#define FIXED_PITCH 1 -#define VARIABLE_PITCH 2 -#define MONO_FONT 8 - -#define ANSI_CHARSET 0 -#define DEFAULT_CHARSET 1 -#define SYMBOL_CHARSET 2 -#define SHIFTJIS_CHARSET 128 -#define HANGEUL_CHARSET 129 -#define HANGUL_CHARSET 129 -#define GB2312_CHARSET 134 -#define CHINESEBIG5_CHARSET 136 -#define OEM_CHARSET 255 -#define JOHAB_CHARSET 130 -#define HEBREW_CHARSET 177 -#define ARABIC_CHARSET 178 -#define GREEK_CHARSET 161 -#define TURKISH_CHARSET 162 -#define VIETNAMESE_CHARSET 163 -#define THAI_CHARSET 222 -#define EASTEUROPE_CHARSET 238 -#define RUSSIAN_CHARSET 204 - -#define MAC_CHARSET 77 -#define BALTIC_CHARSET 186 - -#define FS_LATIN1 0x00000001L -#define FS_LATIN2 0x00000002L -#define FS_CYRILLIC 0x00000004L -#define FS_GREEK 0x00000008L -#define FS_TURKISH 0x00000010L -#define FS_HEBREW 0x00000020L -#define FS_ARABIC 0x00000040L -#define FS_BALTIC 0x00000080L -#define FS_VIETNAMESE 0x00000100L -#define FS_THAI 0x00010000L -#define FS_JISJAPAN 0x00020000L -#define FS_CHINESESIMP 0x00040000L -#define FS_WANSUNG 0x00080000L -#define FS_CHINESETRAD 0x00100000L -#define FS_JOHAB 0x00200000L -#define FS_SYMBOL 0x80000000L - -#define FF_DONTCARE (0<<4) -#define FF_ROMAN (1<<4) - -#define FF_SWISS (2<<4) - -#define FF_MODERN (3<<4) - -#define FF_SCRIPT (4<<4) -#define FF_DECORATIVE (5<<4) - -#define FW_DONTCARE 0 -#define FW_THIN 100 -#define FW_EXTRALIGHT 200 -#define FW_LIGHT 300 -#define FW_NORMAL 400 -#define FW_MEDIUM 500 -#define FW_SEMIBOLD 600 -#define FW_BOLD 700 -#define FW_EXTRABOLD 800 -#define FW_HEAVY 900 - -#define FW_ULTRALIGHT FW_EXTRALIGHT -#define FW_REGULAR FW_NORMAL -#define FW_DEMIBOLD FW_SEMIBOLD -#define FW_ULTRABOLD FW_EXTRABOLD -#define FW_BLACK FW_HEAVY - -#define PANOSE_COUNT 10 -#define PAN_FAMILYTYPE_INDEX 0 -#define PAN_SERIFSTYLE_INDEX 1 -#define PAN_WEIGHT_INDEX 2 -#define PAN_PROPORTION_INDEX 3 -#define PAN_CONTRAST_INDEX 4 -#define PAN_STROKEVARIATION_INDEX 5 -#define PAN_ARMSTYLE_INDEX 6 -#define PAN_LETTERFORM_INDEX 7 -#define PAN_MIDLINE_INDEX 8 -#define PAN_XHEIGHT_INDEX 9 - -#define PAN_CULTURE_LATIN 0 - - typedef struct tagPANOSE { - BYTE bFamilyType; - BYTE bSerifStyle; - BYTE bWeight; - BYTE bProportion; - BYTE bContrast; - BYTE bStrokeVariation; - BYTE bArmStyle; - BYTE bLetterform; - BYTE bMidline; - BYTE bXHeight; - } PANOSE,*LPPANOSE; - -#define PAN_ANY 0 -#define PAN_NO_FIT 1 - -#define PAN_FAMILY_TEXT_DISPLAY 2 -#define PAN_FAMILY_SCRIPT 3 -#define PAN_FAMILY_DECORATIVE 4 -#define PAN_FAMILY_PICTORIAL 5 - -#define PAN_SERIF_COVE 2 -#define PAN_SERIF_OBTUSE_COVE 3 -#define PAN_SERIF_SQUARE_COVE 4 -#define PAN_SERIF_OBTUSE_SQUARE_COVE 5 -#define PAN_SERIF_SQUARE 6 -#define PAN_SERIF_THIN 7 -#define PAN_SERIF_BONE 8 -#define PAN_SERIF_EXAGGERATED 9 -#define PAN_SERIF_TRIANGLE 10 -#define PAN_SERIF_NORMAL_SANS 11 -#define PAN_SERIF_OBTUSE_SANS 12 -#define PAN_SERIF_PERP_SANS 13 -#define PAN_SERIF_FLARED 14 -#define PAN_SERIF_ROUNDED 15 - -#define PAN_WEIGHT_VERY_LIGHT 2 -#define PAN_WEIGHT_LIGHT 3 -#define PAN_WEIGHT_THIN 4 -#define PAN_WEIGHT_BOOK 5 -#define PAN_WEIGHT_MEDIUM 6 -#define PAN_WEIGHT_DEMI 7 -#define PAN_WEIGHT_BOLD 8 -#define PAN_WEIGHT_HEAVY 9 -#define PAN_WEIGHT_BLACK 10 -#define PAN_WEIGHT_NORD 11 - -#define PAN_PROP_OLD_STYLE 2 -#define PAN_PROP_MODERN 3 -#define PAN_PROP_EVEN_WIDTH 4 -#define PAN_PROP_EXPANDED 5 -#define PAN_PROP_CONDENSED 6 -#define PAN_PROP_VERY_EXPANDED 7 -#define PAN_PROP_VERY_CONDENSED 8 -#define PAN_PROP_MONOSPACED 9 - -#define PAN_CONTRAST_NONE 2 -#define PAN_CONTRAST_VERY_LOW 3 -#define PAN_CONTRAST_LOW 4 -#define PAN_CONTRAST_MEDIUM_LOW 5 -#define PAN_CONTRAST_MEDIUM 6 -#define PAN_CONTRAST_MEDIUM_HIGH 7 -#define PAN_CONTRAST_HIGH 8 -#define PAN_CONTRAST_VERY_HIGH 9 - -#define PAN_STROKE_GRADUAL_DIAG 2 -#define PAN_STROKE_GRADUAL_TRAN 3 -#define PAN_STROKE_GRADUAL_VERT 4 -#define PAN_STROKE_GRADUAL_HORZ 5 -#define PAN_STROKE_RAPID_VERT 6 -#define PAN_STROKE_RAPID_HORZ 7 -#define PAN_STROKE_INSTANT_VERT 8 - -#define PAN_STRAIGHT_ARMS_HORZ 2 -#define PAN_STRAIGHT_ARMS_WEDGE 3 -#define PAN_STRAIGHT_ARMS_VERT 4 -#define PAN_STRAIGHT_ARMS_SINGLE_SERIF 5 -#define PAN_STRAIGHT_ARMS_DOUBLE_SERIF 6 -#define PAN_BENT_ARMS_HORZ 7 -#define PAN_BENT_ARMS_WEDGE 8 -#define PAN_BENT_ARMS_VERT 9 -#define PAN_BENT_ARMS_SINGLE_SERIF 10 -#define PAN_BENT_ARMS_DOUBLE_SERIF 11 - -#define PAN_LETT_NORMAL_CONTACT 2 -#define PAN_LETT_NORMAL_WEIGHTED 3 -#define PAN_LETT_NORMAL_BOXED 4 -#define PAN_LETT_NORMAL_FLATTENED 5 -#define PAN_LETT_NORMAL_ROUNDED 6 -#define PAN_LETT_NORMAL_OFF_CENTER 7 -#define PAN_LETT_NORMAL_SQUARE 8 -#define PAN_LETT_OBLIQUE_CONTACT 9 -#define PAN_LETT_OBLIQUE_WEIGHTED 10 -#define PAN_LETT_OBLIQUE_BOXED 11 -#define PAN_LETT_OBLIQUE_FLATTENED 12 -#define PAN_LETT_OBLIQUE_ROUNDED 13 -#define PAN_LETT_OBLIQUE_OFF_CENTER 14 -#define PAN_LETT_OBLIQUE_SQUARE 15 - -#define PAN_MIDLINE_STANDARD_TRIMMED 2 -#define PAN_MIDLINE_STANDARD_POINTED 3 -#define PAN_MIDLINE_STANDARD_SERIFED 4 -#define PAN_MIDLINE_HIGH_TRIMMED 5 -#define PAN_MIDLINE_HIGH_POINTED 6 -#define PAN_MIDLINE_HIGH_SERIFED 7 -#define PAN_MIDLINE_CONSTANT_TRIMMED 8 -#define PAN_MIDLINE_CONSTANT_POINTED 9 -#define PAN_MIDLINE_CONSTANT_SERIFED 10 -#define PAN_MIDLINE_LOW_TRIMMED 11 -#define PAN_MIDLINE_LOW_POINTED 12 -#define PAN_MIDLINE_LOW_SERIFED 13 - -#define PAN_XHEIGHT_CONSTANT_SMALL 2 -#define PAN_XHEIGHT_CONSTANT_STD 3 -#define PAN_XHEIGHT_CONSTANT_LARGE 4 -#define PAN_XHEIGHT_DUCKING_SMALL 5 -#define PAN_XHEIGHT_DUCKING_STD 6 -#define PAN_XHEIGHT_DUCKING_LARGE 7 - -#define ELF_VENDOR_SIZE 4 - - typedef struct tagEXTLOGFONTA { - LOGFONTA elfLogFont; - BYTE elfFullName[LF_FULLFACESIZE]; - BYTE elfStyle[LF_FACESIZE]; - DWORD elfVersion; - DWORD elfStyleSize; - DWORD elfMatch; - DWORD elfReserved; - BYTE elfVendorId[ELF_VENDOR_SIZE]; - DWORD elfCulture; - PANOSE elfPanose; - } EXTLOGFONTA,*PEXTLOGFONTA,*NPEXTLOGFONTA,*LPEXTLOGFONTA; - - typedef struct tagEXTLOGFONTW { - LOGFONTW elfLogFont; - WCHAR elfFullName[LF_FULLFACESIZE]; - WCHAR elfStyle[LF_FACESIZE]; - DWORD elfVersion; - DWORD elfStyleSize; - DWORD elfMatch; - DWORD elfReserved; - BYTE elfVendorId[ELF_VENDOR_SIZE]; - DWORD elfCulture; - PANOSE elfPanose; - } EXTLOGFONTW,*PEXTLOGFONTW,*NPEXTLOGFONTW,*LPEXTLOGFONTW; -#ifdef UNICODE - typedef EXTLOGFONTW EXTLOGFONT; - typedef PEXTLOGFONTW PEXTLOGFONT; - typedef NPEXTLOGFONTW NPEXTLOGFONT; - typedef LPEXTLOGFONTW LPEXTLOGFONT; -#else - typedef EXTLOGFONTA EXTLOGFONT; - typedef PEXTLOGFONTA PEXTLOGFONT; - typedef NPEXTLOGFONTA NPEXTLOGFONT; - typedef LPEXTLOGFONTA LPEXTLOGFONT; -#endif - -#define ELF_VERSION 0 -#define ELF_CULTURE_LATIN 0 - -#define RASTER_FONTTYPE 0x0001 -#define DEVICE_FONTTYPE 0x002 -#define TRUETYPE_FONTTYPE 0x004 - -#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) -#define PALETTERGB(r,g,b) (0x02000000 | RGB(r,g,b)) -#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (DWORD)(WORD)(i))) - -#define PC_RESERVED 0x01 -#define PC_EXPLICIT 0x02 -#define PC_NOCOLLAPSE 0x04 - -#define GetRValue(rgb) (LOBYTE(rgb)) -#define GetGValue(rgb) (LOBYTE(((WORD)(rgb)) >> 8)) -#define GetBValue(rgb) (LOBYTE((rgb)>>16)) - -#define TRANSPARENT 1 -#define OPAQUE 2 -#define BKMODE_LAST 2 - -#define GM_COMPATIBLE 1 -#define GM_ADVANCED 2 -#define GM_LAST 2 - -#define PT_CLOSEFIGURE 0x01 -#define PT_LINETO 0x02 -#define PT_BEZIERTO 0x04 -#define PT_MOVETO 0x06 - -#define MM_TEXT 1 -#define MM_LOMETRIC 2 -#define MM_HIMETRIC 3 -#define MM_LOENGLISH 4 -#define MM_HIENGLISH 5 -#define MM_TWIPS 6 -#define MM_ISOTROPIC 7 -#define MM_ANISOTROPIC 8 - -#define MM_MIN MM_TEXT -#define MM_MAX MM_ANISOTROPIC -#define MM_MAX_FIXEDSCALE MM_TWIPS - -#define ABSOLUTE 1 -#define RELATIVE 2 - -#define WHITE_BRUSH 0 -#define LTGRAY_BRUSH 1 -#define GRAY_BRUSH 2 -#define DKGRAY_BRUSH 3 -#define BLACK_BRUSH 4 -#define NULL_BRUSH 5 -#define HOLLOW_BRUSH NULL_BRUSH -#define WHITE_PEN 6 -#define BLACK_PEN 7 -#define NULL_PEN 8 -#define OEM_FIXED_FONT 10 -#define ANSI_FIXED_FONT 11 -#define ANSI_VAR_FONT 12 -#define SYSTEM_FONT 13 -#define DEVICE_DEFAULT_FONT 14 -#define DEFAULT_PALETTE 15 -#define SYSTEM_FIXED_FONT 16 - -#define DEFAULT_GUI_FONT 17 - -#define DC_BRUSH 18 -#define DC_PEN 19 - -#define STOCK_LAST 19 - -#define CLR_INVALID 0xFFFFFFFF - -#define BS_SOLID 0 -#define BS_NULL 1 -#define BS_HOLLOW BS_NULL -#define BS_HATCHED 2 -#define BS_PATTERN 3 -#define BS_INDEXED 4 -#define BS_DIBPATTERN 5 -#define BS_DIBPATTERNPT 6 -#define BS_PATTERN8X8 7 -#define BS_DIBPATTERN8X8 8 -#define BS_MONOPATTERN 9 - -#define HS_HORIZONTAL 0 -#define HS_VERTICAL 1 -#define HS_FDIAGONAL 2 -#define HS_BDIAGONAL 3 -#define HS_CROSS 4 -#define HS_DIAGCROSS 5 - -#define PS_SOLID 0 -#define PS_DASH 1 -#define PS_DOT 2 -#define PS_DASHDOT 3 -#define PS_DASHDOTDOT 4 -#define PS_NULL 5 -#define PS_INSIDEFRAME 6 -#define PS_USERSTYLE 7 -#define PS_ALTERNATE 8 -#define PS_STYLE_MASK 0x0000000F - -#define PS_ENDCAP_ROUND 0x00000000 -#define PS_ENDCAP_SQUARE 0x00000100 -#define PS_ENDCAP_FLAT 0x00000200 -#define PS_ENDCAP_MASK 0x00000F00 - -#define PS_JOIN_ROUND 0x00000000 -#define PS_JOIN_BEVEL 0x00001000 -#define PS_JOIN_MITER 0x00002000 -#define PS_JOIN_MASK 0x0000F000 - -#define PS_COSMETIC 0x00000000 -#define PS_GEOMETRIC 0x00010000 -#define PS_TYPE_MASK 0x000F0000 - -#define AD_COUNTERCLOCKWISE 1 -#define AD_CLOCKWISE 2 - -#define DRIVERVERSION 0 -#define TECHNOLOGY 2 -#define HORZSIZE 4 -#define VERTSIZE 6 -#define HORZRES 8 -#define VERTRES 10 -#define BITSPIXEL 12 -#define PLANES 14 -#define NUMBRUSHES 16 -#define NUMPENS 18 -#define NUMMARKERS 20 -#define NUMFONTS 22 -#define NUMCOLORS 24 -#define PDEVICESIZE 26 -#define CURVECAPS 28 -#define LINECAPS 30 -#define POLYGONALCAPS 32 -#define TEXTCAPS 34 -#define CLIPCAPS 36 -#define RASTERCAPS 38 -#define ASPECTX 40 -#define ASPECTY 42 -#define ASPECTXY 44 - -#define LOGPIXELSX 88 -#define LOGPIXELSY 90 - -#define SIZEPALETTE 104 -#define NUMRESERVED 106 -#define COLORRES 108 - -#define PHYSICALWIDTH 110 -#define PHYSICALHEIGHT 111 -#define PHYSICALOFFSETX 112 -#define PHYSICALOFFSETY 113 -#define SCALINGFACTORX 114 -#define SCALINGFACTORY 115 - -#define VREFRESH 116 - -#define DESKTOPVERTRES 117 - -#define DESKTOPHORZRES 118 - -#define BLTALIGNMENT 119 - -#define SHADEBLENDCAPS 120 -#define COLORMGMTCAPS 121 - -#ifndef NOGDICAPMASKS -#define DT_PLOTTER 0 -#define DT_RASDISPLAY 1 -#define DT_RASPRINTER 2 -#define DT_RASCAMERA 3 -#define DT_CHARSTREAM 4 -#define DT_METAFILE 5 -#define DT_DISPFILE 6 - -#define CC_NONE 0 -#define CC_CIRCLES 1 -#define CC_PIE 2 -#define CC_CHORD 4 -#define CC_ELLIPSES 8 -#define CC_WIDE 16 -#define CC_STYLED 32 -#define CC_WIDESTYLED 64 -#define CC_INTERIORS 128 -#define CC_ROUNDRECT 256 - -#define LC_NONE 0 -#define LC_POLYLINE 2 -#define LC_MARKER 4 -#define LC_POLYMARKER 8 -#define LC_WIDE 16 -#define LC_STYLED 32 -#define LC_WIDESTYLED 64 -#define LC_INTERIORS 128 - -#define PC_NONE 0 -#define PC_POLYGON 1 -#define PC_RECTANGLE 2 -#define PC_WINDPOLYGON 4 -#define PC_TRAPEZOID 4 -#define PC_SCANLINE 8 -#define PC_WIDE 16 -#define PC_STYLED 32 -#define PC_WIDESTYLED 64 -#define PC_INTERIORS 128 -#define PC_POLYPOLYGON 256 -#define PC_PATHS 512 - -#define CP_NONE 0 -#define CP_RECTANGLE 1 -#define CP_REGION 2 - -#define TC_OP_CHARACTER 0x00000001 -#define TC_OP_STROKE 0x00000002 -#define TC_CP_STROKE 0x00000004 -#define TC_CR_90 0x00000008 -#define TC_CR_ANY 0x00000010 -#define TC_SF_X_YINDEP 0x00000020 -#define TC_SA_DOUBLE 0x00000040 -#define TC_SA_INTEGER 0x00000080 -#define TC_SA_CONTIN 0x00000100 -#define TC_EA_DOUBLE 0x00000200 -#define TC_IA_ABLE 0x00000400 -#define TC_UA_ABLE 0x00000800 -#define TC_SO_ABLE 0x00001000 -#define TC_RA_ABLE 0x00002000 -#define TC_VA_ABLE 0x00004000 -#define TC_RESERVED 0x00008000 -#define TC_SCROLLBLT 0x00010000 -#endif - -#define RC_NONE -#define RC_BITBLT 1 -#define RC_BANDING 2 -#define RC_SCALING 4 -#define RC_BITMAP64 8 -#define RC_GDI20_OUTPUT 0x0010 -#define RC_GDI20_STATE 0x0020 -#define RC_SAVEBITMAP 0x0040 -#define RC_DI_BITMAP 0x0080 -#define RC_PALETTE 0x0100 -#define RC_DIBTODEV 0x0200 -#define RC_BIGFONT 0x0400 -#define RC_STRETCHBLT 0x0800 -#define RC_FLOODFILL 0x1000 -#define RC_STRETCHDIB 0x2000 -#define RC_OP_DX_OUTPUT 0x4000 -#define RC_DEVBITS 0x8000 - -#define SB_NONE 0x00000000 -#define SB_CONST_ALPHA 0x00000001 -#define SB_PIXEL_ALPHA 0x00000002 -#define SB_PREMULT_ALPHA 0x00000004 - -#define SB_GRAD_RECT 0x00000010 -#define SB_GRAD_TRI 0x00000020 - -#define CM_NONE 0x00000000 -#define CM_DEVICE_ICM 0x00000001 -#define CM_GAMMA_RAMP 0x00000002 -#define CM_CMYK_COLOR 0x00000004 - -#define DIB_RGB_COLORS 0 -#define DIB_PAL_COLORS 1 - -#define SYSPAL_ERROR 0 -#define SYSPAL_STATIC 1 -#define SYSPAL_NOSTATIC 2 -#define SYSPAL_NOSTATIC256 3 - -#define CBM_INIT 0x04L - -#define FLOODFILLBORDER 0 -#define FLOODFILLSURFACE 1 - -#define CCHDEVICENAME 32 - -#define CCHFORMNAME 32 - - typedef struct _devicemodeA { - BYTE dmDeviceName[CCHDEVICENAME]; - WORD dmSpecVersion; - WORD dmDriverVersion; - WORD dmSize; - WORD dmDriverExtra; - DWORD dmFields; - union { - struct { - short dmOrientation; - short dmPaperSize; - short dmPaperLength; - short dmPaperWidth; - short dmScale; - short dmCopies; - short dmDefaultSource; - short dmPrintQuality; - }; - struct { - POINTL dmPosition; - DWORD dmDisplayOrientation; - DWORD dmDisplayFixedOutput; - }; - }; - short dmColor; - short dmDuplex; - short dmYResolution; - short dmTTOption; - short dmCollate; - BYTE dmFormName[CCHFORMNAME]; - WORD dmLogPixels; - DWORD dmBitsPerPel; - DWORD dmPelsWidth; - DWORD dmPelsHeight; - union { - DWORD dmDisplayFlags; - DWORD dmNup; - }; - DWORD dmDisplayFrequency; - DWORD dmICMMethod; - DWORD dmICMIntent; - DWORD dmMediaType; - DWORD dmDitherType; - DWORD dmReserved1; - DWORD dmReserved2; - DWORD dmPanningWidth; - DWORD dmPanningHeight; - } DEVMODEA,*PDEVMODEA,*NPDEVMODEA,*LPDEVMODEA; - - typedef struct _devicemodeW { - WCHAR dmDeviceName[CCHDEVICENAME]; - WORD dmSpecVersion; - WORD dmDriverVersion; - WORD dmSize; - WORD dmDriverExtra; - DWORD dmFields; - union { - struct { - short dmOrientation; - short dmPaperSize; - short dmPaperLength; - short dmPaperWidth; - short dmScale; - short dmCopies; - short dmDefaultSource; - short dmPrintQuality; - }; - struct { - POINTL dmPosition; - DWORD dmDisplayOrientation; - DWORD dmDisplayFixedOutput; - }; - }; - short dmColor; - short dmDuplex; - short dmYResolution; - short dmTTOption; - short dmCollate; - WCHAR dmFormName[CCHFORMNAME]; - WORD dmLogPixels; - DWORD dmBitsPerPel; - DWORD dmPelsWidth; - DWORD dmPelsHeight; - union { - DWORD dmDisplayFlags; - DWORD dmNup; - }; - DWORD dmDisplayFrequency; - DWORD dmICMMethod; - DWORD dmICMIntent; - DWORD dmMediaType; - DWORD dmDitherType; - DWORD dmReserved1; - DWORD dmReserved2; - DWORD dmPanningWidth; - DWORD dmPanningHeight; - } DEVMODEW,*PDEVMODEW,*NPDEVMODEW,*LPDEVMODEW; -#ifdef UNICODE - typedef DEVMODEW DEVMODE; - typedef PDEVMODEW PDEVMODE; - typedef NPDEVMODEW NPDEVMODE; - typedef LPDEVMODEW LPDEVMODE; -#else - typedef DEVMODEA DEVMODE; - typedef PDEVMODEA PDEVMODE; - typedef NPDEVMODEA NPDEVMODE; - typedef LPDEVMODEA LPDEVMODE; -#endif - -#define DM_SPECVERSION 0x0401 - -#define DM_ORIENTATION 0x00000001L -#define DM_PAPERSIZE 0x00000002L -#define DM_PAPERLENGTH 0x00000004L -#define DM_PAPERWIDTH 0x00000008L -#define DM_SCALE 0x00000010L -#define DM_POSITION 0x00000020L -#define DM_NUP 0x00000040L -#define DM_DISPLAYORIENTATION 0x00000080L -#define DM_COPIES 0x00000100L -#define DM_DEFAULTSOURCE 0x00000200L -#define DM_PRINTQUALITY 0x00000400L -#define DM_COLOR 0x00000800L -#define DM_DUPLEX 0x00001000L -#define DM_YRESOLUTION 0x00002000L -#define DM_TTOPTION 0x00004000L -#define DM_COLLATE 0x00008000L -#define DM_FORMNAME 0x00010000L -#define DM_LOGPIXELS 0x00020000L -#define DM_BITSPERPEL 0x00040000L -#define DM_PELSWIDTH 0x00080000L -#define DM_PELSHEIGHT 0x00100000L -#define DM_DISPLAYFLAGS 0x00200000L -#define DM_DISPLAYFREQUENCY 0x00400000L -#define DM_ICMMETHOD 0x00800000L -#define DM_ICMINTENT 0x01000000L -#define DM_MEDIATYPE 0x02000000L -#define DM_DITHERTYPE 0x04000000L -#define DM_PANNINGWIDTH 0x08000000L -#define DM_PANNINGHEIGHT 0x10000000L -#define DM_DISPLAYFIXEDOUTPUT 0x20000000L - -#define DMORIENT_PORTRAIT 1 -#define DMORIENT_LANDSCAPE 2 - -#define DMPAPER_FIRST DMPAPER_LETTER -#define DMPAPER_LETTER 1 -#define DMPAPER_LETTERSMALL 2 -#define DMPAPER_TABLOID 3 -#define DMPAPER_LEDGER 4 -#define DMPAPER_LEGAL 5 -#define DMPAPER_STATEMENT 6 -#define DMPAPER_EXECUTIVE 7 -#define DMPAPER_A3 8 -#define DMPAPER_A4 9 -#define DMPAPER_A4SMALL 10 -#define DMPAPER_A5 11 -#define DMPAPER_B4 12 -#define DMPAPER_B5 13 -#define DMPAPER_FOLIO 14 -#define DMPAPER_QUARTO 15 -#define DMPAPER_10X14 16 -#define DMPAPER_11X17 17 -#define DMPAPER_NOTE 18 -#define DMPAPER_ENV_9 19 -#define DMPAPER_ENV_10 20 -#define DMPAPER_ENV_11 21 -#define DMPAPER_ENV_12 22 -#define DMPAPER_ENV_14 23 -#define DMPAPER_CSHEET 24 -#define DMPAPER_DSHEET 25 -#define DMPAPER_ESHEET 26 -#define DMPAPER_ENV_DL 27 -#define DMPAPER_ENV_C5 28 -#define DMPAPER_ENV_C3 29 -#define DMPAPER_ENV_C4 30 -#define DMPAPER_ENV_C6 31 -#define DMPAPER_ENV_C65 32 -#define DMPAPER_ENV_B4 33 -#define DMPAPER_ENV_B5 34 -#define DMPAPER_ENV_B6 35 -#define DMPAPER_ENV_ITALY 36 -#define DMPAPER_ENV_MONARCH 37 -#define DMPAPER_ENV_PERSONAL 38 -#define DMPAPER_FANFOLD_US 39 -#define DMPAPER_FANFOLD_STD_GERMAN 40 -#define DMPAPER_FANFOLD_LGL_GERMAN 41 -#define DMPAPER_ISO_B4 42 -#define DMPAPER_JAPANESE_POSTCARD 43 -#define DMPAPER_9X11 44 -#define DMPAPER_10X11 45 -#define DMPAPER_15X11 46 -#define DMPAPER_ENV_INVITE 47 -#define DMPAPER_RESERVED_48 48 -#define DMPAPER_RESERVED_49 49 -#define DMPAPER_LETTER_EXTRA 50 -#define DMPAPER_LEGAL_EXTRA 51 -#define DMPAPER_TABLOID_EXTRA 52 -#define DMPAPER_A4_EXTRA 53 -#define DMPAPER_LETTER_TRANSVERSE 54 -#define DMPAPER_A4_TRANSVERSE 55 -#define DMPAPER_LETTER_EXTRA_TRANSVERSE 56 -#define DMPAPER_A_PLUS 57 -#define DMPAPER_B_PLUS 58 -#define DMPAPER_LETTER_PLUS 59 -#define DMPAPER_A4_PLUS 60 -#define DMPAPER_A5_TRANSVERSE 61 -#define DMPAPER_B5_TRANSVERSE 62 -#define DMPAPER_A3_EXTRA 63 -#define DMPAPER_A5_EXTRA 64 -#define DMPAPER_B5_EXTRA 65 -#define DMPAPER_A2 66 -#define DMPAPER_A3_TRANSVERSE 67 -#define DMPAPER_A3_EXTRA_TRANSVERSE 68 -#define DMPAPER_DBL_JAPANESE_POSTCARD 69 -#define DMPAPER_A6 70 -#define DMPAPER_JENV_KAKU2 71 -#define DMPAPER_JENV_KAKU3 72 -#define DMPAPER_JENV_CHOU3 73 -#define DMPAPER_JENV_CHOU4 74 -#define DMPAPER_LETTER_ROTATED 75 -#define DMPAPER_A3_ROTATED 76 -#define DMPAPER_A4_ROTATED 77 -#define DMPAPER_A5_ROTATED 78 -#define DMPAPER_B4_JIS_ROTATED 79 -#define DMPAPER_B5_JIS_ROTATED 80 -#define DMPAPER_JAPANESE_POSTCARD_ROTATED 81 -#define DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED 82 -#define DMPAPER_A6_ROTATED 83 -#define DMPAPER_JENV_KAKU2_ROTATED 84 -#define DMPAPER_JENV_KAKU3_ROTATED 85 -#define DMPAPER_JENV_CHOU3_ROTATED 86 -#define DMPAPER_JENV_CHOU4_ROTATED 87 -#define DMPAPER_B6_JIS 88 -#define DMPAPER_B6_JIS_ROTATED 89 -#define DMPAPER_12X11 90 -#define DMPAPER_JENV_YOU4 91 -#define DMPAPER_JENV_YOU4_ROTATED 92 -#define DMPAPER_P16K 93 -#define DMPAPER_P32K 94 -#define DMPAPER_P32KBIG 95 -#define DMPAPER_PENV_1 96 -#define DMPAPER_PENV_2 97 -#define DMPAPER_PENV_3 98 -#define DMPAPER_PENV_4 99 -#define DMPAPER_PENV_5 100 -#define DMPAPER_PENV_6 101 -#define DMPAPER_PENV_7 102 -#define DMPAPER_PENV_8 103 -#define DMPAPER_PENV_9 104 -#define DMPAPER_PENV_10 105 -#define DMPAPER_P16K_ROTATED 106 -#define DMPAPER_P32K_ROTATED 107 -#define DMPAPER_P32KBIG_ROTATED 108 -#define DMPAPER_PENV_1_ROTATED 109 -#define DMPAPER_PENV_2_ROTATED 110 -#define DMPAPER_PENV_3_ROTATED 111 -#define DMPAPER_PENV_4_ROTATED 112 -#define DMPAPER_PENV_5_ROTATED 113 -#define DMPAPER_PENV_6_ROTATED 114 -#define DMPAPER_PENV_7_ROTATED 115 -#define DMPAPER_PENV_8_ROTATED 116 -#define DMPAPER_PENV_9_ROTATED 117 -#define DMPAPER_PENV_10_ROTATED 118 - -#define DMPAPER_LAST DMPAPER_PENV_10_ROTATED - -#define DMPAPER_USER 256 - -#define DMBIN_FIRST DMBIN_UPPER -#define DMBIN_UPPER 1 -#define DMBIN_ONLYONE 1 -#define DMBIN_LOWER 2 -#define DMBIN_MIDDLE 3 -#define DMBIN_MANUAL 4 -#define DMBIN_ENVELOPE 5 -#define DMBIN_ENVMANUAL 6 -#define DMBIN_AUTO 7 -#define DMBIN_TRACTOR 8 -#define DMBIN_SMALLFMT 9 -#define DMBIN_LARGEFMT 10 -#define DMBIN_LARGECAPACITY 11 -#define DMBIN_CASSETTE 14 -#define DMBIN_FORMSOURCE 15 -#define DMBIN_LAST DMBIN_FORMSOURCE - -#define DMBIN_USER 256 - -#define DMRES_DRAFT (-1) -#define DMRES_LOW (-2) -#define DMRES_MEDIUM (-3) -#define DMRES_HIGH (-4) - -#define DMCOLOR_MONOCHROME 1 -#define DMCOLOR_COLOR 2 - -#define DMDUP_SIMPLEX 1 -#define DMDUP_VERTICAL 2 -#define DMDUP_HORIZONTAL 3 - -#define DMTT_BITMAP 1 -#define DMTT_DOWNLOAD 2 -#define DMTT_SUBDEV 3 -#define DMTT_DOWNLOAD_OUTLINE 4 - -#define DMCOLLATE_FALSE 0 -#define DMCOLLATE_TRUE 1 - -#define DMDO_DEFAULT 0 -#define DMDO_90 1 -#define DMDO_180 2 -#define DMDO_270 3 - -#define DMDFO_DEFAULT 0 -#define DMDFO_STRETCH 1 -#define DMDFO_CENTER 2 - -#define DMDISPLAYFLAGS_TEXTMODE 0x00000004 - -#define DMNUP_SYSTEM 1 -#define DMNUP_ONEUP 2 - -#define DMICMMETHOD_NONE 1 -#define DMICMMETHOD_SYSTEM 2 -#define DMICMMETHOD_DRIVER 3 -#define DMICMMETHOD_DEVICE 4 - -#define DMICMMETHOD_USER 256 - -#define DMICM_SATURATE 1 -#define DMICM_CONTRAST 2 -#define DMICM_COLORIMETRIC 3 -#define DMICM_ABS_COLORIMETRIC 4 - -#define DMICM_USER 256 - -#define DMMEDIA_STANDARD 1 -#define DMMEDIA_TRANSPARENCY 2 -#define DMMEDIA_GLOSSY 3 - -#define DMMEDIA_USER 256 - -#define DMDITHER_NONE 1 -#define DMDITHER_COARSE 2 -#define DMDITHER_FINE 3 -#define DMDITHER_LINEART 4 -#define DMDITHER_ERRORDIFFUSION 5 -#define DMDITHER_RESERVED6 6 -#define DMDITHER_RESERVED7 7 -#define DMDITHER_RESERVED8 8 -#define DMDITHER_RESERVED9 9 -#define DMDITHER_GRAYSCALE 10 - -#define DMDITHER_USER 256 - - typedef struct _DISPLAY_DEVICEA { - DWORD cb; - CHAR DeviceName[32]; - CHAR DeviceString[128]; - DWORD StateFlags; - CHAR DeviceID[128]; - CHAR DeviceKey[128]; - } DISPLAY_DEVICEA,*PDISPLAY_DEVICEA,*LPDISPLAY_DEVICEA; - typedef struct _DISPLAY_DEVICEW { - DWORD cb; - WCHAR DeviceName[32]; - WCHAR DeviceString[128]; - DWORD StateFlags; - WCHAR DeviceID[128]; - WCHAR DeviceKey[128]; - } DISPLAY_DEVICEW,*PDISPLAY_DEVICEW,*LPDISPLAY_DEVICEW; -#ifdef UNICODE - typedef DISPLAY_DEVICEW DISPLAY_DEVICE; - typedef PDISPLAY_DEVICEW PDISPLAY_DEVICE; - typedef LPDISPLAY_DEVICEW LPDISPLAY_DEVICE; -#else - typedef DISPLAY_DEVICEA DISPLAY_DEVICE; - typedef PDISPLAY_DEVICEA PDISPLAY_DEVICE; - typedef LPDISPLAY_DEVICEA LPDISPLAY_DEVICE; -#endif - -#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001 -#define DISPLAY_DEVICE_MULTI_DRIVER 0x00000002 -#define DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004 -#define DISPLAY_DEVICE_MIRRORING_DRIVER 0x00000008 -#define DISPLAY_DEVICE_VGA_COMPATIBLE 0x00000010 -#define DISPLAY_DEVICE_REMOVABLE 0x00000020 -#define DISPLAY_DEVICE_MODESPRUNED 0x08000000 -#define DISPLAY_DEVICE_REMOTE 0x04000000 -#define DISPLAY_DEVICE_DISCONNECT 0x02000000 - -#define DISPLAY_DEVICE_ACTIVE 0x00000001 -#define DISPLAY_DEVICE_ATTACHED 0x00000002 - -#define RDH_RECTANGLES 1 - - typedef struct _RGNDATAHEADER { - DWORD dwSize; - DWORD iType; - DWORD nCount; - DWORD nRgnSize; - RECT rcBound; - } RGNDATAHEADER,*PRGNDATAHEADER; - - typedef struct _RGNDATA { - RGNDATAHEADER rdh; - char Buffer[1]; - } RGNDATA,*PRGNDATA,*NPRGNDATA,*LPRGNDATA; - -#define SYSRGN 4 - - typedef struct _ABC { - int abcA; - UINT abcB; - int abcC; - } ABC,*PABC,*NPABC,*LPABC; - - typedef struct _ABCFLOAT { - FLOAT abcfA; - FLOAT abcfB; - FLOAT abcfC; - } ABCFLOAT,*PABCFLOAT,*NPABCFLOAT,*LPABCFLOAT; - -#ifndef NOTEXTMETRIC - - typedef struct _OUTLINETEXTMETRICA { - UINT otmSize; - TEXTMETRICA otmTextMetrics; - BYTE otmFiller; - PANOSE otmPanoseNumber; - UINT otmfsSelection; - UINT otmfsType; - int otmsCharSlopeRise; - int otmsCharSlopeRun; - int otmItalicAngle; - UINT otmEMSquare; - int otmAscent; - int otmDescent; - UINT otmLineGap; - UINT otmsCapEmHeight; - UINT otmsXHeight; - RECT otmrcFontBox; - int otmMacAscent; - int otmMacDescent; - UINT otmMacLineGap; - UINT otmusMinimumPPEM; - POINT otmptSubscriptSize; - POINT otmptSubscriptOffset; - POINT otmptSuperscriptSize; - POINT otmptSuperscriptOffset; - UINT otmsStrikeoutSize; - int otmsStrikeoutPosition; - int otmsUnderscoreSize; - int otmsUnderscorePosition; - PSTR otmpFamilyName; - PSTR otmpFaceName; - PSTR otmpStyleName; - PSTR otmpFullName; - } OUTLINETEXTMETRICA,*POUTLINETEXTMETRICA,*NPOUTLINETEXTMETRICA,*LPOUTLINETEXTMETRICA; - - typedef struct _OUTLINETEXTMETRICW { - UINT otmSize; - TEXTMETRICW otmTextMetrics; - BYTE otmFiller; - PANOSE otmPanoseNumber; - UINT otmfsSelection; - UINT otmfsType; - int otmsCharSlopeRise; - int otmsCharSlopeRun; - int otmItalicAngle; - UINT otmEMSquare; - int otmAscent; - int otmDescent; - UINT otmLineGap; - UINT otmsCapEmHeight; - UINT otmsXHeight; - RECT otmrcFontBox; - int otmMacAscent; - int otmMacDescent; - UINT otmMacLineGap; - UINT otmusMinimumPPEM; - POINT otmptSubscriptSize; - POINT otmptSubscriptOffset; - POINT otmptSuperscriptSize; - POINT otmptSuperscriptOffset; - UINT otmsStrikeoutSize; - int otmsStrikeoutPosition; - int otmsUnderscoreSize; - int otmsUnderscorePosition; - PSTR otmpFamilyName; - PSTR otmpFaceName; - PSTR otmpStyleName; - PSTR otmpFullName; - } OUTLINETEXTMETRICW,*POUTLINETEXTMETRICW,*NPOUTLINETEXTMETRICW,*LPOUTLINETEXTMETRICW; -#ifdef UNICODE - typedef OUTLINETEXTMETRICW OUTLINETEXTMETRIC; - typedef POUTLINETEXTMETRICW POUTLINETEXTMETRIC; - typedef NPOUTLINETEXTMETRICW NPOUTLINETEXTMETRIC; - typedef LPOUTLINETEXTMETRICW LPOUTLINETEXTMETRIC; -#else - typedef OUTLINETEXTMETRICA OUTLINETEXTMETRIC; - typedef POUTLINETEXTMETRICA POUTLINETEXTMETRIC; - typedef NPOUTLINETEXTMETRICA NPOUTLINETEXTMETRIC; - typedef LPOUTLINETEXTMETRICA LPOUTLINETEXTMETRIC; -#endif -#endif - - typedef struct tagPOLYTEXTA { - int x; - int y; - UINT n; - LPCSTR lpstr; - UINT uiFlags; - RECT rcl; - int *pdx; - } POLYTEXTA,*PPOLYTEXTA,*NPPOLYTEXTA,*LPPOLYTEXTA; - - typedef struct tagPOLYTEXTW { - int x; - int y; - UINT n; - LPCWSTR lpstr; - UINT uiFlags; - RECT rcl; - int *pdx; - } POLYTEXTW,*PPOLYTEXTW,*NPPOLYTEXTW,*LPPOLYTEXTW; -#ifdef UNICODE - typedef POLYTEXTW POLYTEXT; - typedef PPOLYTEXTW PPOLYTEXT; - typedef NPPOLYTEXTW NPPOLYTEXT; - typedef LPPOLYTEXTW LPPOLYTEXT; -#else - typedef POLYTEXTA POLYTEXT; - typedef PPOLYTEXTA PPOLYTEXT; - typedef NPPOLYTEXTA NPPOLYTEXT; - typedef LPPOLYTEXTA LPPOLYTEXT; -#endif - - typedef struct _FIXED { - WORD fract; - short value; - } FIXED; - - typedef struct _MAT2 { - FIXED eM11; - FIXED eM12; - FIXED eM21; - FIXED eM22; - } MAT2,*LPMAT2; - - typedef struct _GLYPHMETRICS { - UINT gmBlackBoxX; - UINT gmBlackBoxY; - POINT gmptGlyphOrigin; - short gmCellIncX; - short gmCellIncY; - } GLYPHMETRICS,*LPGLYPHMETRICS; - -#define GGO_METRICS 0 -#define GGO_BITMAP 1 -#define GGO_NATIVE 2 -#define GGO_BEZIER 3 - -#define GGO_GRAY2_BITMAP 4 -#define GGO_GRAY4_BITMAP 5 -#define GGO_GRAY8_BITMAP 6 -#define GGO_GLYPH_INDEX 0x0080 -#define GGO_UNHINTED 0x0100 - -#define TT_POLYGON_TYPE 24 - -#define TT_PRIM_LINE 1 -#define TT_PRIM_QSPLINE 2 -#define TT_PRIM_CSPLINE 3 - - typedef struct tagPOINTFX { - FIXED x; - FIXED y; - } POINTFX,*LPPOINTFX; - - typedef struct tagTTPOLYCURVE { - WORD wType; - WORD cpfx; - POINTFX apfx[1]; - } TTPOLYCURVE,*LPTTPOLYCURVE; - - typedef struct tagTTPOLYGONHEADER { - DWORD cb; - DWORD dwType; - POINTFX pfxStart; - } TTPOLYGONHEADER,*LPTTPOLYGONHEADER; - -#define GCP_DBCS 0x0001 -#define GCP_REORDER 0x0002 -#define GCP_USEKERNING 0x0008 -#define GCP_GLYPHSHAPE 0x0010 -#define GCP_LIGATE 0x0020 - -#define GCP_DIACRITIC 0x0100 -#define GCP_KASHIDA 0x0400 -#define GCP_ERROR 0x8000 -#define FLI_MASK 0x103B - -#define GCP_JUSTIFY 0x00010000L - -#define FLI_GLYPHS 0x00040000L -#define GCP_CLASSIN 0x00080000L -#define GCP_MAXEXTENT 0x00100000L -#define GCP_JUSTIFYIN 0x00200000L -#define GCP_DISPLAYZWG 0x00400000L -#define GCP_SYMSWAPOFF 0x00800000L -#define GCP_NUMERICOVERRIDE 0x01000000L -#define GCP_NEUTRALOVERRIDE 0x02000000L -#define GCP_NUMERICSLATIN 0x04000000L -#define GCP_NUMERICSLOCAL 0x08000000L - -#define GCPCLASS_LATIN 1 -#define GCPCLASS_HEBREW 2 -#define GCPCLASS_ARABIC 2 -#define GCPCLASS_NEUTRAL 3 -#define GCPCLASS_LOCALNUMBER 4 -#define GCPCLASS_LATINNUMBER 5 -#define GCPCLASS_LATINNUMERICTERMINATOR 6 -#define GCPCLASS_LATINNUMERICSEPARATOR 7 -#define GCPCLASS_NUMERICSEPARATOR 8 -#define GCPCLASS_PREBOUNDLTR 0x80 -#define GCPCLASS_PREBOUNDRTL 0x40 -#define GCPCLASS_POSTBOUNDLTR 0x20 -#define GCPCLASS_POSTBOUNDRTL 0x10 - -#define GCPGLYPH_LINKBEFORE 0x8000 -#define GCPGLYPH_LINKAFTER 0x4000 - - typedef struct tagGCP_RESULTSA { - DWORD lStructSize; - LPSTR lpOutString; - UINT *lpOrder; - int *lpDx; - int *lpCaretPos; - LPSTR lpClass; - LPWSTR lpGlyphs; - UINT nGlyphs; - int nMaxFit; - } GCP_RESULTSA,*LPGCP_RESULTSA; - typedef struct tagGCP_RESULTSW { - DWORD lStructSize; - LPWSTR lpOutString; - UINT *lpOrder; - int *lpDx; - int *lpCaretPos; - LPSTR lpClass; - LPWSTR lpGlyphs; - UINT nGlyphs; - int nMaxFit; - } GCP_RESULTSW,*LPGCP_RESULTSW; -#ifdef UNICODE - typedef GCP_RESULTSW GCP_RESULTS; - typedef LPGCP_RESULTSW LPGCP_RESULTS; -#else - typedef GCP_RESULTSA GCP_RESULTS; - typedef LPGCP_RESULTSA LPGCP_RESULTS; -#endif - - typedef struct _RASTERIZER_STATUS { - short nSize; - short wFlags; - short nLanguageID; - } RASTERIZER_STATUS,*LPRASTERIZER_STATUS; - -#define TT_AVAILABLE 0x0001 -#define TT_ENABLED 0x0002 - - typedef struct tagPIXELFORMATDESCRIPTOR { - WORD nSize; - WORD nVersion; - DWORD dwFlags; - BYTE iPixelType; - BYTE cColorBits; - BYTE cRedBits; - BYTE cRedShift; - BYTE cGreenBits; - BYTE cGreenShift; - BYTE cBlueBits; - BYTE cBlueShift; - BYTE cAlphaBits; - BYTE cAlphaShift; - BYTE cAccumBits; - BYTE cAccumRedBits; - BYTE cAccumGreenBits; - BYTE cAccumBlueBits; - BYTE cAccumAlphaBits; - BYTE cDepthBits; - BYTE cStencilBits; - BYTE cAuxBuffers; - BYTE iLayerType; - BYTE bReserved; - DWORD dwLayerMask; - DWORD dwVisibleMask; - DWORD dwDamageMask; - } PIXELFORMATDESCRIPTOR,*PPIXELFORMATDESCRIPTOR,*LPPIXELFORMATDESCRIPTOR; - -#define PFD_TYPE_RGBA 0 -#define PFD_TYPE_COLORINDEX 1 - -#define PFD_MAIN_PLANE 0 -#define PFD_OVERLAY_PLANE 1 -#define PFD_UNDERLAY_PLANE (-1) - -#define PFD_DOUBLEBUFFER 0x00000001 -#define PFD_STEREO 0x00000002 -#define PFD_DRAW_TO_WINDOW 0x00000004 -#define PFD_DRAW_TO_BITMAP 0x00000008 -#define PFD_SUPPORT_GDI 0x00000010 -#define PFD_SUPPORT_OPENGL 0x00000020 -#define PFD_GENERIC_FORMAT 0x00000040 -#define PFD_NEED_PALETTE 0x00000080 -#define PFD_NEED_SYSTEM_PALETTE 0x00000100 -#define PFD_SWAP_EXCHANGE 0x00000200 -#define PFD_SWAP_COPY 0x00000400 -#define PFD_SWAP_LAYER_BUFFERS 0x00000800 -#define PFD_GENERIC_ACCELERATED 0x00001000 -#define PFD_SUPPORT_DIRECTDRAW 0x00002000 - -#define PFD_DEPTH_DONTCARE 0x20000000 -#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000 -#define PFD_STEREO_DONTCARE 0x80000000 - -#ifndef NOTEXTMETRIC - typedef int (CALLBACK *OLDFONTENUMPROCA)(CONST LOGFONTA *,CONST TEXTMETRICA *,DWORD,LPARAM); - typedef int (CALLBACK *OLDFONTENUMPROCW)(CONST LOGFONTW *,CONST TEXTMETRICW *,DWORD,LPARAM); -#ifdef UNICODE -#define OLDFONTENUMPROC OLDFONTENUMPROCW -#else -#define OLDFONTENUMPROC OLDFONTENUMPROCA -#endif -#else - typedef int (CALLBACK *OLDFONTENUMPROCA)(CONST LOGFONTA *,CONST VOID *,DWORD,LPARAM); - typedef int (CALLBACK *OLDFONTENUMPROCW)(CONST LOGFONTW *,CONST VOID *,DWORD,LPARAM); -#ifdef UNICODE -#define OLDFONTENUMPROC OLDFONTENUMPROCW -#else -#define OLDFONTENUMPROC OLDFONTENUMPROCA -#endif -#endif - - typedef OLDFONTENUMPROCA FONTENUMPROCA; - typedef OLDFONTENUMPROCW FONTENUMPROCW; -#ifdef UNICODE - typedef FONTENUMPROCW FONTENUMPROC; -#else - typedef FONTENUMPROCA FONTENUMPROC; -#endif - - typedef int (CALLBACK *GOBJENUMPROC)(LPVOID,LPARAM); - typedef VOID (CALLBACK *LINEDDAPROC)(int,int,LPARAM); - -#ifdef UNICODE -#define AddFontResource AddFontResourceW -#define CopyMetaFile CopyMetaFileW -#define CreateDC CreateDCW -#define CreateFontIndirect CreateFontIndirectW -#define CreateFont CreateFontW -#define CreateIC CreateICW -#define CreateMetaFile CreateMetaFileW -#define CreateScalableFontResource CreateScalableFontResourceW -#else -#define AddFontResource AddFontResourceA -#define CopyMetaFile CopyMetaFileA -#define CreateDC CreateDCA -#define CreateFontIndirect CreateFontIndirectA -#define CreateFont CreateFontA -#define CreateIC CreateICA -#define CreateMetaFile CreateMetaFileA -#define CreateScalableFontResource CreateScalableFontResourceA -#endif - - WINGDIAPI int WINAPI AddFontResourceA(LPCSTR); - WINGDIAPI int WINAPI AddFontResourceW(LPCWSTR); - WINGDIAPI WINBOOL WINAPI AnimatePalette(HPALETTE hPal,UINT iStartIndex,UINT cEntries,CONST PALETTEENTRY *ppe); - WINGDIAPI WINBOOL WINAPI Arc(HDC hdc,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4); - WINGDIAPI WINBOOL WINAPI BitBlt(HDC hdc,int x,int y,int cx,int cy,HDC hdcSrc,int x1,int y1,DWORD rop); - WINGDIAPI WINBOOL WINAPI CancelDC(HDC hdc); - WINGDIAPI WINBOOL WINAPI Chord(HDC hdc,int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4); - WINGDIAPI int WINAPI ChoosePixelFormat(HDC hdc,CONST PIXELFORMATDESCRIPTOR *ppfd); - WINGDIAPI HMETAFILE WINAPI CloseMetaFile(HDC hdc); - WINGDIAPI int WINAPI CombineRgn(HRGN hrgnDst,HRGN hrgnSrc1,HRGN hrgnSrc2,int iMode); - WINGDIAPI HMETAFILE WINAPI CopyMetaFileA(HMETAFILE,LPCSTR); - WINGDIAPI HMETAFILE WINAPI CopyMetaFileW(HMETAFILE,LPCWSTR); - WINGDIAPI HBITMAP WINAPI CreateBitmap(int nWidth,int nHeight,UINT nPlanes,UINT nBitCount,CONST VOID *lpBits); - WINGDIAPI HBITMAP WINAPI CreateBitmapIndirect(CONST BITMAP *pbm); - WINGDIAPI HBRUSH WINAPI CreateBrushIndirect(CONST LOGBRUSH *plbrush); - WINGDIAPI HBITMAP WINAPI CreateCompatibleBitmap(HDC hdc,int cx,int cy); - WINGDIAPI HBITMAP WINAPI CreateDiscardableBitmap(HDC hdc,int cx,int cy); - WINGDIAPI HDC WINAPI CreateCompatibleDC(HDC hdc); - WINGDIAPI HDC WINAPI CreateDCA(LPCSTR pwszDriver,LPCSTR pwszDevice,LPCSTR pszPort,CONST DEVMODEA *pdm); - WINGDIAPI HDC WINAPI CreateDCW(LPCWSTR pwszDriver,LPCWSTR pwszDevice,LPCWSTR pszPort,CONST DEVMODEW *pdm); - WINGDIAPI HBITMAP WINAPI CreateDIBitmap(HDC hdc,CONST BITMAPINFOHEADER *pbmih,DWORD flInit,CONST VOID *pjBits,CONST BITMAPINFO *pbmi,UINT iUsage); - WINGDIAPI HBRUSH WINAPI CreateDIBPatternBrush(HGLOBAL h,UINT iUsage); - WINGDIAPI HBRUSH WINAPI CreateDIBPatternBrushPt(CONST VOID *lpPackedDIB,UINT iUsage); - WINGDIAPI HRGN WINAPI CreateEllipticRgn(int x1,int y1,int x2,int y2); - WINGDIAPI HRGN WINAPI CreateEllipticRgnIndirect(CONST RECT *lprect); - WINGDIAPI HFONT WINAPI CreateFontIndirectA(CONST LOGFONTA *lplf); - WINGDIAPI HFONT WINAPI CreateFontIndirectW(CONST LOGFONTW *lplf); - WINGDIAPI HFONT WINAPI CreateFontA(int cHeight,int cWidth,int cEscapement,int cOrientation,int cWeight,DWORD bItalic,DWORD bUnderline,DWORD bStrikeOut,DWORD iCharSet,DWORD iOutPrecision,DWORD iClipPrecision,DWORD iQuality,DWORD iPitchAndFamily,LPCSTR pszFaceName); - WINGDIAPI HFONT WINAPI CreateFontW(int cHeight,int cWidth,int cEscapement,int cOrientation,int cWeight,DWORD bItalic,DWORD bUnderline,DWORD bStrikeOut,DWORD iCharSet,DWORD iOutPrecision,DWORD iClipPrecision,DWORD iQuality,DWORD iPitchAndFamily,LPCWSTR pszFaceName); - WINGDIAPI HBRUSH WINAPI CreateHatchBrush(int iHatch,COLORREF color); - WINGDIAPI HDC WINAPI CreateICA(LPCSTR pszDriver,LPCSTR pszDevice,LPCSTR pszPort,CONST DEVMODEA *pdm); - WINGDIAPI HDC WINAPI CreateICW(LPCWSTR pszDriver,LPCWSTR pszDevice,LPCWSTR pszPort,CONST DEVMODEW *pdm); - WINGDIAPI HDC WINAPI CreateMetaFileA(LPCSTR pszFile); - WINGDIAPI HDC WINAPI CreateMetaFileW(LPCWSTR pszFile); - WINGDIAPI HPALETTE WINAPI CreatePalette(CONST LOGPALETTE *plpal); - WINGDIAPI HPEN WINAPI CreatePen(int iStyle,int cWidth,COLORREF color); - WINGDIAPI HPEN WINAPI CreatePenIndirect(CONST LOGPEN *plpen); - WINGDIAPI HRGN WINAPI CreatePolyPolygonRgn(CONST POINT *pptl,CONST INT *pc,int cPoly,int iMode); - WINGDIAPI HBRUSH WINAPI CreatePatternBrush(HBITMAP hbm); - WINGDIAPI HRGN WINAPI CreateRectRgn(int x1,int y1,int x2,int y2); - WINGDIAPI HRGN WINAPI CreateRectRgnIndirect(CONST RECT *lprect); - WINGDIAPI HRGN WINAPI CreateRoundRectRgn(int x1,int y1,int x2,int y2,int w,int h); - WINGDIAPI WINBOOL WINAPI CreateScalableFontResourceA(DWORD fdwHidden,LPCSTR lpszFont,LPCSTR lpszFile,LPCSTR lpszPath); - WINGDIAPI WINBOOL WINAPI CreateScalableFontResourceW(DWORD fdwHidden,LPCWSTR lpszFont,LPCWSTR lpszFile,LPCWSTR lpszPath); - WINGDIAPI HBRUSH WINAPI CreateSolidBrush(COLORREF color); - WINGDIAPI WINBOOL WINAPI DeleteDC(HDC hdc); - WINGDIAPI WINBOOL WINAPI DeleteMetaFile(HMETAFILE hmf); - WINGDIAPI WINBOOL WINAPI DeleteObject(HGDIOBJ ho); - WINGDIAPI int WINAPI DescribePixelFormat(HDC hdc,int iPixelFormat,UINT nBytes,LPPIXELFORMATDESCRIPTOR ppfd); - - typedef UINT (CALLBACK *LPFNDEVMODE)(HWND,HMODULE,LPDEVMODE,LPSTR,LPSTR,LPDEVMODE,LPSTR,UINT); - typedef DWORD (CALLBACK *LPFNDEVCAPS)(LPSTR,LPSTR,UINT,LPSTR,LPDEVMODE); - -#define DM_UPDATE 1 -#define DM_COPY 2 -#define DM_PROMPT 4 -#define DM_MODIFY 8 - -#define DM_IN_BUFFER DM_MODIFY -#define DM_IN_PROMPT DM_PROMPT -#define DM_OUT_BUFFER DM_COPY -#define DM_OUT_DEFAULT DM_UPDATE - -#define DC_FIELDS 1 -#define DC_PAPERS 2 -#define DC_PAPERSIZE 3 -#define DC_MINEXTENT 4 -#define DC_MAXEXTENT 5 -#define DC_BINS 6 -#define DC_DUPLEX 7 -#define DC_SIZE 8 -#define DC_EXTRA 9 -#define DC_VERSION 10 -#define DC_DRIVER 11 -#define DC_BINNAMES 12 -#define DC_ENUMRESOLUTIONS 13 -#define DC_FILEDEPENDENCIES 14 -#define DC_TRUETYPE 15 -#define DC_PAPERNAMES 16 -#define DC_ORIENTATION 17 -#define DC_COPIES 18 -#define DC_BINADJUST 19 -#define DC_EMF_COMPLIANT 20 -#define DC_DATATYPE_PRODUCED 21 -#define DC_COLLATE 22 -#define DC_MANUFACTURER 23 -#define DC_MODEL 24 -#define DC_PERSONALITY 25 -#define DC_PRINTRATE 26 -#define DC_PRINTRATEUNIT 27 -#define PRINTRATEUNIT_PPM 1 -#define PRINTRATEUNIT_CPS 2 -#define PRINTRATEUNIT_LPM 3 -#define PRINTRATEUNIT_IPM 4 -#define DC_PRINTERMEM 28 -#define DC_MEDIAREADY 29 -#define DC_STAPLE 30 -#define DC_PRINTRATEPPM 31 -#define DC_COLORDEVICE 32 -#define DC_NUP 33 -#define DC_MEDIATYPENAMES 34 -#define DC_MEDIATYPES 35 - -#define DCTT_BITMAP 0x0000001L -#define DCTT_DOWNLOAD 0x0000002L -#define DCTT_SUBDEV 0x0000004L -#define DCTT_DOWNLOAD_OUTLINE 0x0000008L - -#define DCBA_FACEUPNONE 0x0000 -#define DCBA_FACEUPCENTER 0x0001 -#define DCBA_FACEUPLEFT 0x0002 -#define DCBA_FACEUPRIGHT 0x0003 -#define DCBA_FACEDOWNNONE 0x0100 -#define DCBA_FACEDOWNCENTER 0x0101 -#define DCBA_FACEDOWNLEFT 0x0102 -#define DCBA_FACEDOWNRIGHT 0x0103 - -#ifdef UNICODE -#define DeviceCapabilities DeviceCapabilitiesW -#define EnumFontFamiliesEx EnumFontFamiliesExW -#define EnumFontFamilies EnumFontFamiliesW -#define EnumFonts EnumFontsW -#define GetCharWidth GetCharWidthW -#define GetCharWidth32 GetCharWidth32W -#define GetCharWidthFloat GetCharWidthFloatW -#define GetCharABCWidths GetCharABCWidthsW -#define GetCharABCWidthsFloat GetCharABCWidthsFloatW -#define GetGlyphOutline GetGlyphOutlineW -#define GetMetaFile GetMetaFileW -#else -#define DeviceCapabilities DeviceCapabilitiesA -#define EnumFontFamiliesEx EnumFontFamiliesExA -#define EnumFontFamilies EnumFontFamiliesA -#define EnumFonts EnumFontsA -#define GetCharWidth GetCharWidthA -#define GetCharWidth32 GetCharWidth32A -#define GetCharWidthFloat GetCharWidthFloatA -#define GetCharABCWidths GetCharABCWidthsA -#define GetCharABCWidthsFloat GetCharABCWidthsFloatA -#define GetGlyphOutline GetGlyphOutlineA -#define GetMetaFile GetMetaFileA -#endif - - WINSPOOLAPI int WINAPI DeviceCapabilitiesA(LPCSTR pDevice,LPCSTR pPort,WORD fwCapability,LPSTR pOutput,CONST DEVMODEA *pDevMode); - WINSPOOLAPI int WINAPI DeviceCapabilitiesW(LPCWSTR pDevice,LPCWSTR pPort,WORD fwCapability,LPWSTR pOutput,CONST DEVMODEW *pDevMode); - WINGDIAPI int WINAPI DrawEscape(HDC hdc,int iEscape,int cjIn,LPCSTR lpIn); - WINGDIAPI WINBOOL WINAPI Ellipse(HDC hdc,int left,int top,int right,int bottom); - WINGDIAPI int WINAPI EnumFontFamiliesExA(HDC hdc,LPLOGFONTA lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam,DWORD dwFlags); - WINGDIAPI int WINAPI EnumFontFamiliesExW(HDC hdc,LPLOGFONTW lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam,DWORD dwFlags); - WINGDIAPI int WINAPI EnumFontFamiliesA(HDC hdc,LPCSTR lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam); - WINGDIAPI int WINAPI EnumFontFamiliesW(HDC hdc,LPCWSTR lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam); - WINGDIAPI int WINAPI EnumFontsA(HDC hdc,LPCSTR lpLogfont,FONTENUMPROCA lpProc,LPARAM lParam); - WINGDIAPI int WINAPI EnumFontsW(HDC hdc,LPCWSTR lpLogfont,FONTENUMPROCW lpProc,LPARAM lParam); - WINGDIAPI int WINAPI EnumObjects(HDC hdc,int nType,GOBJENUMPROC lpFunc,LPARAM lParam); - WINGDIAPI WINBOOL WINAPI EqualRgn(HRGN hrgn1,HRGN hrgn2); - WINGDIAPI int WINAPI Escape(HDC hdc,int iEscape,int cjIn,LPCSTR pvIn,LPVOID pvOut); - WINGDIAPI int WINAPI ExtEscape(HDC hdc,int iEscape,int cjInput,LPCSTR lpInData,int cjOutput,LPSTR lpOutData); - WINGDIAPI int WINAPI ExcludeClipRect(HDC hdc,int left,int top,int right,int bottom); - WINGDIAPI HRGN WINAPI ExtCreateRegion(CONST XFORM *lpx,DWORD nCount,CONST RGNDATA *lpData); - WINGDIAPI WINBOOL WINAPI ExtFloodFill(HDC hdc,int x,int y,COLORREF color,UINT type); - WINGDIAPI WINBOOL WINAPI FillRgn(HDC hdc,HRGN hrgn,HBRUSH hbr); - WINGDIAPI WINBOOL WINAPI FloodFill(HDC hdc,int x,int y,COLORREF color); - WINGDIAPI WINBOOL WINAPI FrameRgn(HDC hdc,HRGN hrgn,HBRUSH hbr,int w,int h); - WINGDIAPI int WINAPI GetROP2(HDC hdc); - WINGDIAPI WINBOOL WINAPI GetAspectRatioFilterEx(HDC hdc,LPSIZE lpsize); - WINGDIAPI COLORREF WINAPI GetBkColor(HDC hdc); - WINGDIAPI COLORREF WINAPI GetDCBrushColor(HDC hdc); - WINGDIAPI COLORREF WINAPI GetDCPenColor(HDC hdc); - WINGDIAPI int WINAPI GetBkMode(HDC hdc); - WINGDIAPI LONG WINAPI GetBitmapBits(HBITMAP hbit,LONG cb,LPVOID lpvBits); - WINGDIAPI WINBOOL WINAPI GetBitmapDimensionEx(HBITMAP hbit,LPSIZE lpsize); - WINGDIAPI UINT WINAPI GetBoundsRect(HDC hdc,LPRECT lprect,UINT flags); - WINGDIAPI WINBOOL WINAPI GetBrushOrgEx(HDC hdc,LPPOINT lppt); - WINGDIAPI WINBOOL WINAPI GetCharWidthA(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); - WINGDIAPI WINBOOL WINAPI GetCharWidthW(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); - WINGDIAPI WINBOOL WINAPI GetCharWidth32A(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); - WINGDIAPI WINBOOL WINAPI GetCharWidth32W(HDC hdc,UINT iFirst,UINT iLast,LPINT lpBuffer); - WINGDIAPI WINBOOL WINAPI GetCharWidthFloatA(HDC hdc,UINT iFirst,UINT iLast,PFLOAT lpBuffer); - WINGDIAPI WINBOOL WINAPI GetCharWidthFloatW(HDC hdc,UINT iFirst,UINT iLast,PFLOAT lpBuffer); - WINGDIAPI WINBOOL WINAPI GetCharABCWidthsA(HDC hdc,UINT wFirst,UINT wLast,LPABC lpABC); - WINGDIAPI WINBOOL WINAPI GetCharABCWidthsW(HDC hdc,UINT wFirst,UINT wLast,LPABC lpABC); - WINGDIAPI WINBOOL WINAPI GetCharABCWidthsFloatA(HDC hdc,UINT iFirst,UINT iLast,LPABCFLOAT lpABC); - WINGDIAPI WINBOOL WINAPI GetCharABCWidthsFloatW(HDC hdc,UINT iFirst,UINT iLast,LPABCFLOAT lpABC); - WINGDIAPI int WINAPI GetClipBox(HDC hdc,LPRECT lprect); - WINGDIAPI int WINAPI GetClipRgn(HDC hdc,HRGN hrgn); - WINGDIAPI int WINAPI GetMetaRgn(HDC hdc,HRGN hrgn); - WINGDIAPI HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type); - WINGDIAPI WINBOOL WINAPI GetCurrentPositionEx(HDC hdc,LPPOINT lppt); - WINGDIAPI int WINAPI GetDeviceCaps(HDC hdc,int index); - WINGDIAPI int WINAPI GetDIBits(HDC hdc,HBITMAP hbm,UINT start,UINT cLines,LPVOID lpvBits,LPBITMAPINFO lpbmi,UINT usage); - WINGDIAPI DWORD WINAPI GetFontData (HDC hdc,DWORD dwTable,DWORD dwOffset,PVOID pvBuffer,DWORD cjBuffer); - WINGDIAPI DWORD WINAPI GetGlyphOutlineA(HDC hdc,UINT uChar,UINT fuFormat,LPGLYPHMETRICS lpgm,DWORD cjBuffer,LPVOID pvBuffer,CONST MAT2 *lpmat2); - WINGDIAPI DWORD WINAPI GetGlyphOutlineW(HDC hdc,UINT uChar,UINT fuFormat,LPGLYPHMETRICS lpgm,DWORD cjBuffer,LPVOID pvBuffer,CONST MAT2 *lpmat2); - WINGDIAPI int WINAPI GetGraphicsMode(HDC hdc); - WINGDIAPI int WINAPI GetMapMode(HDC hdc); - WINGDIAPI UINT WINAPI GetMetaFileBitsEx(HMETAFILE hMF,UINT cbBuffer,LPVOID lpData); - WINGDIAPI HMETAFILE WINAPI GetMetaFileA(LPCSTR lpName); - WINGDIAPI HMETAFILE WINAPI GetMetaFileW(LPCWSTR lpName); - WINGDIAPI COLORREF WINAPI GetNearestColor(HDC hdc,COLORREF color); - WINGDIAPI UINT WINAPI GetNearestPaletteIndex(HPALETTE h,COLORREF color); - WINGDIAPI DWORD WINAPI GetObjectType(HGDIOBJ h); - -#ifndef NOTEXTMETRIC -#ifdef UNICODE -#define GetOutlineTextMetrics GetOutlineTextMetricsW -#else -#define GetOutlineTextMetrics GetOutlineTextMetricsA -#endif - - WINGDIAPI UINT WINAPI GetOutlineTextMetricsA(HDC hdc,UINT cjCopy,LPOUTLINETEXTMETRICA potm); - WINGDIAPI UINT WINAPI GetOutlineTextMetricsW(HDC hdc,UINT cjCopy,LPOUTLINETEXTMETRICW potm); -#endif - -#ifdef UNICODE -#define GetTextExtentPoint GetTextExtentPointW -#define GetTextExtentPoint32 GetTextExtentPoint32W -#define GetTextExtentExPoint GetTextExtentExPointW -#define GetCharacterPlacement GetCharacterPlacementW -#else -#define GetTextExtentPoint GetTextExtentPointA -#define GetTextExtentPoint32 GetTextExtentPoint32A -#define GetTextExtentExPoint GetTextExtentExPointA -#define GetCharacterPlacement GetCharacterPlacementA -#endif - - WINGDIAPI UINT WINAPI GetPaletteEntries(HPALETTE hpal,UINT iStart,UINT cEntries,LPPALETTEENTRY pPalEntries); - WINGDIAPI COLORREF WINAPI GetPixel(HDC hdc,int x,int y); - WINGDIAPI int WINAPI GetPixelFormat(HDC hdc); - WINGDIAPI int WINAPI GetPolyFillMode(HDC hdc); - WINGDIAPI WINBOOL WINAPI GetRasterizerCaps(LPRASTERIZER_STATUS lpraststat,UINT cjBytes); - WINGDIAPI int WINAPI GetRandomRgn (HDC hdc,HRGN hrgn,INT i); - WINGDIAPI DWORD WINAPI GetRegionData(HRGN hrgn,DWORD nCount,LPRGNDATA lpRgnData); - WINGDIAPI int WINAPI GetRgnBox(HRGN hrgn,LPRECT lprc); - WINGDIAPI HGDIOBJ WINAPI GetStockObject(int i); - WINGDIAPI int WINAPI GetStretchBltMode(HDC hdc); - WINGDIAPI UINT WINAPI GetSystemPaletteEntries(HDC hdc,UINT iStart,UINT cEntries,LPPALETTEENTRY pPalEntries); - WINGDIAPI UINT WINAPI GetSystemPaletteUse(HDC hdc); - WINGDIAPI int WINAPI GetTextCharacterExtra(HDC hdc); - WINGDIAPI UINT WINAPI GetTextAlign(HDC hdc); - WINGDIAPI COLORREF WINAPI GetTextColor(HDC hdc); - WINGDIAPI WINBOOL WINAPI GetTextExtentPointA(HDC hdc,LPCSTR lpString,int c,LPSIZE lpsz); - WINGDIAPI WINBOOL WINAPI GetTextExtentPointW(HDC hdc,LPCWSTR lpString,int c,LPSIZE lpsz); - WINGDIAPI WINBOOL WINAPI GetTextExtentPoint32A(HDC hdc,LPCSTR lpString,int c,LPSIZE psizl); - WINGDIAPI WINBOOL WINAPI GetTextExtentPoint32W(HDC hdc,LPCWSTR lpString,int c,LPSIZE psizl); - WINGDIAPI WINBOOL WINAPI GetTextExtentExPointA(HDC hdc,LPCSTR lpszString,int cchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); - WINGDIAPI WINBOOL WINAPI GetTextExtentExPointW(HDC hdc,LPCWSTR lpszString,int cchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); - WINGDIAPI int WINAPI GetTextCharset(HDC hdc); - WINGDIAPI int WINAPI GetTextCharsetInfo(HDC hdc,LPFONTSIGNATURE lpSig,DWORD dwFlags); - WINGDIAPI WINBOOL WINAPI TranslateCharsetInfo(DWORD *lpSrc,LPCHARSETINFO lpCs,DWORD dwFlags); - WINGDIAPI DWORD WINAPI GetFontLanguageInfo(HDC hdc); - WINGDIAPI DWORD WINAPI GetCharacterPlacementA(HDC hdc,LPCSTR lpString,int nCount,int nMexExtent,LPGCP_RESULTSA lpResults,DWORD dwFlags); - WINGDIAPI DWORD WINAPI GetCharacterPlacementW(HDC hdc,LPCWSTR lpString,int nCount,int nMexExtent,LPGCP_RESULTSW lpResults,DWORD dwFlags); - - typedef struct tagWCRANGE { - WCHAR wcLow; - USHORT cGlyphs; - } WCRANGE,*PWCRANGE,*LPWCRANGE; - - typedef struct tagGLYPHSET { - DWORD cbThis; - DWORD flAccel; - DWORD cGlyphsSupported; - DWORD cRanges; - WCRANGE ranges[1]; - } GLYPHSET,*PGLYPHSET,*LPGLYPHSET; - -#define GS_8BIT_INDICES 0x00000001 - -#define GGI_MARK_NONEXISTING_GLYPHS 0X0001 - -#ifdef UNICODE -#define GetGlyphIndices GetGlyphIndicesW -#else -#define GetGlyphIndices GetGlyphIndicesA -#endif - - WINGDIAPI DWORD WINAPI GetFontUnicodeRanges(HDC hdc,LPGLYPHSET lpgs); - WINGDIAPI DWORD WINAPI GetGlyphIndicesA(HDC hdc,LPCSTR lpstr,int c,LPWORD pgi,DWORD fl); - WINGDIAPI DWORD WINAPI GetGlyphIndicesW(HDC hdc,LPCWSTR lpstr,int c,LPWORD pgi,DWORD fl); - WINGDIAPI WINBOOL WINAPI GetTextExtentPointI(HDC hdc,LPWORD pgiIn,int cgi,LPSIZE psize); - WINGDIAPI WINBOOL WINAPI GetTextExtentExPointI (HDC hdc,LPWORD lpwszString,int cwchString,int nMaxExtent,LPINT lpnFit,LPINT lpnDx,LPSIZE lpSize); - WINGDIAPI WINBOOL WINAPI GetCharWidthI(HDC hdc,UINT giFirst,UINT cgi,LPWORD pgi,LPINT piWidths); - WINGDIAPI WINBOOL WINAPI GetCharABCWidthsI(HDC hdc,UINT giFirst,UINT cgi,LPWORD pgi,LPABC pabc); - -#define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8)) -#define STAMP_AXESLIST (0x8000000 + 'a' + ('l' << 8)) -#define MM_MAX_NUMAXES 16 - - typedef struct tagDESIGNVECTOR { - DWORD dvReserved; - DWORD dvNumAxes; - LONG dvValues[MM_MAX_NUMAXES]; - } DESIGNVECTOR,*PDESIGNVECTOR,*LPDESIGNVECTOR; - -#ifdef UNICODE -#define AddFontResourceEx AddFontResourceExW -#define RemoveFontResourceEx RemoveFontResourceExW -#else -#define AddFontResourceEx AddFontResourceExA -#define RemoveFontResourceEx RemoveFontResourceExA -#endif - - WINGDIAPI int WINAPI AddFontResourceExA(LPCSTR name,DWORD fl,PVOID res); - WINGDIAPI int WINAPI AddFontResourceExW(LPCWSTR name,DWORD fl,PVOID res); - WINGDIAPI WINBOOL WINAPI RemoveFontResourceExA(LPCSTR name,DWORD fl,PVOID pdv); - WINGDIAPI WINBOOL WINAPI RemoveFontResourceExW(LPCWSTR name,DWORD fl,PVOID pdv); - WINGDIAPI HANDLE WINAPI AddFontMemResourceEx(PVOID pFileView,DWORD cjSize,PVOID pvResrved,DWORD *pNumFonts); - WINGDIAPI WINBOOL WINAPI RemoveFontMemResourceEx(HANDLE h); - -#define FR_PRIVATE 0x10 -#define FR_NOT_ENUM 0x20 - -#define MM_MAX_AXES_NAMELEN 16 - - typedef struct tagAXISINFOA { - LONG axMinValue; - LONG axMaxValue; - BYTE axAxisName[MM_MAX_AXES_NAMELEN]; - } AXISINFOA,*PAXISINFOA,*LPAXISINFOA; - - typedef struct tagAXISINFOW { - LONG axMinValue; - LONG axMaxValue; - WCHAR axAxisName[MM_MAX_AXES_NAMELEN]; - } AXISINFOW,*PAXISINFOW,*LPAXISINFOW; -#ifdef UNICODE - typedef AXISINFOW AXISINFO; - typedef PAXISINFOW PAXISINFO; - typedef LPAXISINFOW LPAXISINFO; -#else - typedef AXISINFOA AXISINFO; - typedef PAXISINFOA PAXISINFO; - typedef LPAXISINFOA LPAXISINFO; -#endif - - typedef struct tagAXESLISTA { - DWORD axlReserved; - DWORD axlNumAxes; - AXISINFOA axlAxisInfo[MM_MAX_NUMAXES]; - } AXESLISTA,*PAXESLISTA,*LPAXESLISTA; - - typedef struct tagAXESLISTW { - DWORD axlReserved; - DWORD axlNumAxes; - AXISINFOW axlAxisInfo[MM_MAX_NUMAXES]; - } AXESLISTW,*PAXESLISTW,*LPAXESLISTW; -#ifdef UNICODE - typedef AXESLISTW AXESLIST; - typedef PAXESLISTW PAXESLIST; - typedef LPAXESLISTW LPAXESLIST; -#else - typedef AXESLISTA AXESLIST; - typedef PAXESLISTA PAXESLIST; - typedef LPAXESLISTA LPAXESLIST; -#endif - - typedef struct tagENUMLOGFONTEXDVA { - ENUMLOGFONTEXA elfEnumLogfontEx; - DESIGNVECTOR elfDesignVector; - } ENUMLOGFONTEXDVA,*PENUMLOGFONTEXDVA,*LPENUMLOGFONTEXDVA; - - typedef struct tagENUMLOGFONTEXDVW { - ENUMLOGFONTEXW elfEnumLogfontEx; - DESIGNVECTOR elfDesignVector; - } ENUMLOGFONTEXDVW,*PENUMLOGFONTEXDVW,*LPENUMLOGFONTEXDVW; -#ifdef UNICODE - typedef ENUMLOGFONTEXDVW ENUMLOGFONTEXDV; - typedef PENUMLOGFONTEXDVW PENUMLOGFONTEXDV; - typedef LPENUMLOGFONTEXDVW LPENUMLOGFONTEXDV; -#else - typedef ENUMLOGFONTEXDVA ENUMLOGFONTEXDV; - typedef PENUMLOGFONTEXDVA PENUMLOGFONTEXDV; - typedef LPENUMLOGFONTEXDVA LPENUMLOGFONTEXDV; -#endif - -#ifdef UNICODE -#define CreateFontIndirectEx CreateFontIndirectExW -#else -#define CreateFontIndirectEx CreateFontIndirectExA -#endif - - WINGDIAPI HFONT WINAPI CreateFontIndirectExA(CONST ENUMLOGFONTEXDVA *); - WINGDIAPI HFONT WINAPI CreateFontIndirectExW(CONST ENUMLOGFONTEXDVW *); - -#ifndef NOTEXTMETRIC - typedef struct tagENUMTEXTMETRICA { - NEWTEXTMETRICEXA etmNewTextMetricEx; - AXESLISTA etmAxesList; - } ENUMTEXTMETRICA,*PENUMTEXTMETRICA,*LPENUMTEXTMETRICA; - typedef struct tagENUMTEXTMETRICW - { - NEWTEXTMETRICEXW etmNewTextMetricEx; - AXESLISTW etmAxesList; - } ENUMTEXTMETRICW,*PENUMTEXTMETRICW,*LPENUMTEXTMETRICW; -#ifdef UNICODE - typedef ENUMTEXTMETRICW ENUMTEXTMETRIC; - typedef PENUMTEXTMETRICW PENUMTEXTMETRIC; - typedef LPENUMTEXTMETRICW LPENUMTEXTMETRIC; -#else - typedef ENUMTEXTMETRICA ENUMTEXTMETRIC; - typedef PENUMTEXTMETRICA PENUMTEXTMETRIC; - typedef LPENUMTEXTMETRICA LPENUMTEXTMETRIC; -#endif -#endif - -#ifdef UNICODE -#define ResetDC ResetDCW -#define RemoveFontResource RemoveFontResourceW -#else -#define ResetDC ResetDCA -#define RemoveFontResource RemoveFontResourceA -#endif - - WINGDIAPI WINBOOL WINAPI GetViewportExtEx(HDC hdc,LPSIZE lpsize); - WINGDIAPI WINBOOL WINAPI GetViewportOrgEx(HDC hdc,LPPOINT lppoint); - WINGDIAPI WINBOOL WINAPI GetWindowExtEx(HDC hdc,LPSIZE lpsize); - WINGDIAPI WINBOOL WINAPI GetWindowOrgEx(HDC hdc,LPPOINT lppoint); - WINGDIAPI int WINAPI IntersectClipRect(HDC hdc,int left,int top,int right,int bottom); - WINGDIAPI WINBOOL WINAPI InvertRgn(HDC hdc,HRGN hrgn); - WINGDIAPI WINBOOL WINAPI LineDDA(int xStart,int yStart,int xEnd,int yEnd,LINEDDAPROC lpProc,LPARAM data); - WINGDIAPI WINBOOL WINAPI LineTo(HDC hdc,int x,int y); - WINGDIAPI WINBOOL WINAPI MaskBlt(HDC hdcDest,int xDest,int yDest,int width,int height,HDC hdcSrc,int xSrc,int ySrc,HBITMAP hbmMask,int xMask,int yMask,DWORD rop); - WINGDIAPI WINBOOL WINAPI PlgBlt(HDC hdcDest,CONST POINT *lpPoint,HDC hdcSrc,int xSrc,int ySrc,int width,int height,HBITMAP hbmMask,int xMask,int yMask); - WINGDIAPI int WINAPI OffsetClipRgn(HDC hdc,int x,int y); - WINGDIAPI int WINAPI OffsetRgn(HRGN hrgn,int x,int y); - WINGDIAPI WINBOOL WINAPI PatBlt(HDC hdc,int x,int y,int w,int h,DWORD rop); - WINGDIAPI WINBOOL WINAPI Pie(HDC hdc,int left,int top,int right,int bottom,int xr1,int yr1,int xr2,int yr2); - WINGDIAPI WINBOOL WINAPI PlayMetaFile(HDC hdc,HMETAFILE hmf); - WINGDIAPI WINBOOL WINAPI PaintRgn(HDC hdc,HRGN hrgn); - WINGDIAPI WINBOOL WINAPI PolyPolygon(HDC hdc,CONST POINT *apt,CONST INT *asz,int csz); - WINGDIAPI WINBOOL WINAPI PtInRegion(HRGN hrgn,int x,int y); - WINGDIAPI WINBOOL WINAPI PtVisible(HDC hdc,int x,int y); - WINGDIAPI WINBOOL WINAPI RectInRegion(HRGN hrgn,CONST RECT *lprect); - WINGDIAPI WINBOOL WINAPI RectVisible(HDC hdc,CONST RECT *lprect); - WINGDIAPI WINBOOL WINAPI Rectangle(HDC hdc,int left,int top,int right,int bottom); - WINGDIAPI WINBOOL WINAPI RestoreDC(HDC hdc,int nSavedDC); - WINGDIAPI HDC WINAPI ResetDCA(HDC hdc,CONST DEVMODEA *lpdm); - WINGDIAPI HDC WINAPI ResetDCW(HDC hdc,CONST DEVMODEW *lpdm); - WINGDIAPI UINT WINAPI RealizePalette(HDC hdc); - WINGDIAPI WINBOOL WINAPI RemoveFontResourceA(LPCSTR lpFileName); - WINGDIAPI WINBOOL WINAPI RemoveFontResourceW(LPCWSTR lpFileName); - WINGDIAPI WINBOOL WINAPI RoundRect(HDC hdc,int left,int top,int right,int bottom,int width,int height); - WINGDIAPI WINBOOL WINAPI ResizePalette(HPALETTE hpal,UINT n); - WINGDIAPI int WINAPI SaveDC(HDC hdc); - WINGDIAPI int WINAPI SelectClipRgn(HDC hdc,HRGN hrgn); - WINGDIAPI int WINAPI ExtSelectClipRgn(HDC hdc,HRGN hrgn,int mode); - WINGDIAPI int WINAPI SetMetaRgn(HDC hdc); - WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC hdc,HGDIOBJ h); - WINGDIAPI HPALETTE WINAPI SelectPalette(HDC hdc,HPALETTE hPal,WINBOOL bForceBkgd); - WINGDIAPI COLORREF WINAPI SetBkColor(HDC hdc,COLORREF color); - WINGDIAPI COLORREF WINAPI SetDCBrushColor(HDC hdc,COLORREF color); - WINGDIAPI COLORREF WINAPI SetDCPenColor(HDC hdc,COLORREF color); - WINGDIAPI int WINAPI SetBkMode(HDC hdc,int mode); - WINGDIAPI LONG WINAPI SetBitmapBits(HBITMAP hbm,DWORD cb,CONST VOID *pvBits); - WINGDIAPI UINT WINAPI SetBoundsRect(HDC hdc,CONST RECT *lprect,UINT flags); - WINGDIAPI int WINAPI SetDIBits(HDC hdc,HBITMAP hbm,UINT start,UINT cLines,CONST VOID *lpBits,CONST BITMAPINFO *lpbmi,UINT ColorUse); - WINGDIAPI int WINAPI SetDIBitsToDevice(HDC hdc,int xDest,int yDest,DWORD w,DWORD h,int xSrc,int ySrc,UINT StartScan,UINT cLines,CONST VOID *lpvBits,CONST BITMAPINFO *lpbmi,UINT ColorUse); - WINGDIAPI DWORD WINAPI SetMapperFlags(HDC hdc,DWORD flags); - WINGDIAPI int WINAPI SetGraphicsMode(HDC hdc,int iMode); - WINGDIAPI int WINAPI SetMapMode(HDC hdc,int iMode); - WINGDIAPI DWORD WINAPI SetLayout(HDC hdc,DWORD l); - WINGDIAPI DWORD WINAPI GetLayout(HDC hdc); - WINGDIAPI HMETAFILE WINAPI SetMetaFileBitsEx(UINT cbBuffer,CONST BYTE *lpData); - WINGDIAPI UINT WINAPI SetPaletteEntries(HPALETTE hpal,UINT iStart,UINT cEntries,CONST PALETTEENTRY *pPalEntries); - WINGDIAPI COLORREF WINAPI SetPixel(HDC hdc,int x,int y,COLORREF color); - WINGDIAPI WINBOOL WINAPI SetPixelV(HDC hdc,int x,int y,COLORREF color); - WINGDIAPI WINBOOL WINAPI SetPixelFormat(HDC hdc,int format,CONST PIXELFORMATDESCRIPTOR *ppfd); - WINGDIAPI int WINAPI SetPolyFillMode(HDC hdc,int mode); - WINGDIAPI WINBOOL WINAPI StretchBlt(HDC hdcDest,int xDest,int yDest,int wDest,int hDest,HDC hdcSrc,int xSrc,int ySrc,int wSrc,int hSrc,DWORD rop); - WINGDIAPI WINBOOL WINAPI SetRectRgn(HRGN hrgn,int left,int top,int right,int bottom); - WINGDIAPI int WINAPI StretchDIBits(HDC hdc,int xDest,int yDest,int DestWidth,int DestHeight,int xSrc,int ySrc,int SrcWidth,int SrcHeight,CONST VOID *lpBits,CONST BITMAPINFO *lpbmi,UINT iUsage,DWORD rop); - WINGDIAPI int WINAPI SetROP2(HDC hdc,int rop2); - WINGDIAPI int WINAPI SetStretchBltMode(HDC hdc,int mode); - WINGDIAPI UINT WINAPI SetSystemPaletteUse(HDC hdc,UINT use); - WINGDIAPI int WINAPI SetTextCharacterExtra(HDC hdc,int extra); - WINGDIAPI COLORREF WINAPI SetTextColor(HDC hdc,COLORREF color); - WINGDIAPI UINT WINAPI SetTextAlign(HDC hdc,UINT align); - WINGDIAPI WINBOOL WINAPI SetTextJustification(HDC hdc,int extra,int count); - WINGDIAPI WINBOOL WINAPI UpdateColors(HDC hdc); - - typedef USHORT COLOR16; - - typedef struct _TRIVERTEX { - LONG x; - LONG y; - COLOR16 Red; - COLOR16 Green; - COLOR16 Blue; - COLOR16 Alpha; - } TRIVERTEX,*PTRIVERTEX,*LPTRIVERTEX; - - typedef struct _GRADIENT_TRIANGLE { - ULONG Vertex1; - ULONG Vertex2; - ULONG Vertex3; - } GRADIENT_TRIANGLE,*PGRADIENT_TRIANGLE,*LPGRADIENT_TRIANGLE; - - typedef struct _GRADIENT_RECT { - ULONG UpperLeft; - ULONG LowerRight; - } GRADIENT_RECT,*PGRADIENT_RECT,*LPGRADIENT_RECT; - - typedef struct _BLENDFUNCTION { - BYTE BlendOp; - BYTE BlendFlags; - BYTE SourceConstantAlpha; - BYTE AlphaFormat; - } BLENDFUNCTION,*PBLENDFUNCTION; - -#define AC_SRC_OVER 0x00 -#define AC_SRC_ALPHA 0x01 - - WINGDIAPI WINBOOL WINAPI AlphaBlend(HDC hdcDest,int xoriginDest,int yoriginDest,int wDest,int hDest,HDC hdcSrc,int xoriginSrc,int yoriginSrc,int wSrc,int hSrc,BLENDFUNCTION ftn); - WINGDIAPI WINBOOL WINAPI TransparentBlt(HDC hdcDest,int xoriginDest,int yoriginDest,int wDest,int hDest,HDC hdcSrc,int xoriginSrc,int yoriginSrc,int wSrc,int hSrc,UINT crTransparent); - -#define GRADIENT_FILL_RECT_H 0x00000000 -#define GRADIENT_FILL_RECT_V 0x00000001 -#define GRADIENT_FILL_TRIANGLE 0x00000002 -#define GRADIENT_FILL_OP_FLAG 0x000000ff - - WINGDIAPI WINBOOL WINAPI GradientFill(HDC hdc,PTRIVERTEX pVertex,ULONG nVertex,PVOID pMesh,ULONG nMesh,ULONG ulMode); - -#ifndef NOMETAFILE - -#ifdef UNICODE -#define CopyEnhMetaFile CopyEnhMetaFileW -#define CreateEnhMetaFile CreateEnhMetaFileW -#define GetEnhMetaFile GetEnhMetaFileW -#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionW -#else -#define CopyEnhMetaFile CopyEnhMetaFileA -#define CreateEnhMetaFile CreateEnhMetaFileA -#define GetEnhMetaFile GetEnhMetaFileA -#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionA -#endif - - WINGDIAPI WINBOOL WINAPI PlayMetaFileRecord(HDC hdc,LPHANDLETABLE lpHandleTable,LPMETARECORD lpMR,UINT noObjs); - - typedef int (CALLBACK *MFENUMPROC)(HDC hdc,HANDLETABLE *lpht,METARECORD *lpMR,int nObj,LPARAM param); - - WINGDIAPI WINBOOL WINAPI EnumMetaFile(HDC hdc,HMETAFILE hmf,MFENUMPROC proc,LPARAM param); - - typedef int (CALLBACK *ENHMFENUMPROC)(HDC hdc,HANDLETABLE *lpht,CONST ENHMETARECORD *lpmr,int hHandles,LPARAM data); - - WINGDIAPI HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc); - WINGDIAPI HENHMETAFILE WINAPI CopyEnhMetaFileA(HENHMETAFILE hEnh,LPCSTR lpFileName); - WINGDIAPI HENHMETAFILE WINAPI CopyEnhMetaFileW(HENHMETAFILE hEnh,LPCWSTR lpFileName); - WINGDIAPI HDC WINAPI CreateEnhMetaFileA(HDC hdc,LPCSTR lpFilename,CONST RECT *lprc,LPCSTR lpDesc); - WINGDIAPI HDC WINAPI CreateEnhMetaFileW(HDC hdc,LPCWSTR lpFilename,CONST RECT *lprc,LPCWSTR lpDesc); - WINGDIAPI WINBOOL WINAPI DeleteEnhMetaFile(HENHMETAFILE hmf); - WINGDIAPI WINBOOL WINAPI EnumEnhMetaFile(HDC hdc,HENHMETAFILE hmf,ENHMFENUMPROC proc,LPVOID param,CONST RECT *lpRect); - WINGDIAPI HENHMETAFILE WINAPI GetEnhMetaFileA(LPCSTR lpName); - WINGDIAPI HENHMETAFILE WINAPI GetEnhMetaFileW(LPCWSTR lpName); - WINGDIAPI UINT WINAPI GetEnhMetaFileBits(HENHMETAFILE hEMF,UINT nSize,LPBYTE lpData); - WINGDIAPI UINT WINAPI GetEnhMetaFileDescriptionA(HENHMETAFILE hemf,UINT cchBuffer,LPSTR lpDescription); - WINGDIAPI UINT WINAPI GetEnhMetaFileDescriptionW(HENHMETAFILE hemf,UINT cchBuffer,LPWSTR lpDescription); - WINGDIAPI UINT WINAPI GetEnhMetaFileHeader(HENHMETAFILE hemf,UINT nSize,LPENHMETAHEADER lpEnhMetaHeader); - WINGDIAPI UINT WINAPI GetEnhMetaFilePaletteEntries(HENHMETAFILE hemf,UINT nNumEntries,LPPALETTEENTRY lpPaletteEntries); - WINGDIAPI UINT WINAPI GetEnhMetaFilePixelFormat(HENHMETAFILE hemf,UINT cbBuffer,PIXELFORMATDESCRIPTOR *ppfd); - WINGDIAPI UINT WINAPI GetWinMetaFileBits(HENHMETAFILE hemf,UINT cbData16,LPBYTE pData16,INT iMapMode,HDC hdcRef); - WINGDIAPI WINBOOL WINAPI PlayEnhMetaFile(HDC hdc,HENHMETAFILE hmf,CONST RECT *lprect); - WINGDIAPI WINBOOL WINAPI PlayEnhMetaFileRecord(HDC hdc,LPHANDLETABLE pht,CONST ENHMETARECORD *pmr,UINT cht); - WINGDIAPI HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT nSize,CONST BYTE *pb); - WINGDIAPI HENHMETAFILE WINAPI SetWinMetaFileBits(UINT nSize,CONST BYTE *lpMeta16Data,HDC hdcRef,CONST METAFILEPICT *lpMFP); - WINGDIAPI WINBOOL WINAPI GdiComment(HDC hdc,UINT nSize,CONST BYTE *lpData); -#endif - -#ifndef NOTEXTMETRIC -#ifdef UNICODE -#define GetTextMetrics GetTextMetricsW -#else -#define GetTextMetrics GetTextMetricsA -#endif - - WINGDIAPI WINBOOL WINAPI GetTextMetricsA(HDC hdc,LPTEXTMETRICA lptm); - WINGDIAPI WINBOOL WINAPI GetTextMetricsW(HDC hdc,LPTEXTMETRICW lptm); -#endif - - typedef struct tagDIBSECTION { - BITMAP dsBm; - BITMAPINFOHEADER dsBmih; - DWORD dsBitfields[3]; - HANDLE dshSection; - DWORD dsOffset; - } DIBSECTION,*LPDIBSECTION,*PDIBSECTION; - - WINGDIAPI WINBOOL WINAPI AngleArc(HDC hdc,int x,int y,DWORD r,FLOAT StartAngle,FLOAT SweepAngle); - WINGDIAPI WINBOOL WINAPI PolyPolyline(HDC hdc,CONST POINT *apt,CONST DWORD *asz,DWORD csz); - WINGDIAPI WINBOOL WINAPI GetWorldTransform(HDC hdc,LPXFORM lpxf); - WINGDIAPI WINBOOL WINAPI SetWorldTransform(HDC hdc,CONST XFORM *lpxf); - WINGDIAPI WINBOOL WINAPI ModifyWorldTransform(HDC hdc,CONST XFORM *lpxf,DWORD mode); - WINGDIAPI WINBOOL WINAPI CombineTransform(LPXFORM lpxfOut,CONST XFORM *lpxf1,CONST XFORM *lpxf2); - WINGDIAPI HBITMAP WINAPI CreateDIBSection(HDC hdc,CONST BITMAPINFO *lpbmi,UINT usage,VOID **ppvBits,HANDLE hSection,DWORD offset); - WINGDIAPI UINT WINAPI GetDIBColorTable(HDC hdc,UINT iStart,UINT cEntries,RGBQUAD *prgbq); - WINGDIAPI UINT WINAPI SetDIBColorTable(HDC hdc,UINT iStart,UINT cEntries,CONST RGBQUAD *prgbq); - -#define CA_NEGATIVE 0x0001 -#define CA_LOG_FILTER 0x0002 - -#define ILLUMINANT_DEVICE_DEFAULT 0 -#define ILLUMINANT_A 1 -#define ILLUMINANT_B 2 -#define ILLUMINANT_C 3 -#define ILLUMINANT_D50 4 -#define ILLUMINANT_D55 5 -#define ILLUMINANT_D65 6 -#define ILLUMINANT_D75 7 -#define ILLUMINANT_F2 8 -#define ILLUMINANT_MAX_INDEX ILLUMINANT_F2 - -#define ILLUMINANT_TUNGSTEN ILLUMINANT_A -#define ILLUMINANT_DAYLIGHT ILLUMINANT_C -#define ILLUMINANT_FLUORESCENT ILLUMINANT_F2 -#define ILLUMINANT_NTSC ILLUMINANT_C - -#define RGB_GAMMA_MIN (WORD)02500 -#define RGB_GAMMA_MAX (WORD)65000 - -#define REFERENCE_WHITE_MIN (WORD)6000 -#define REFERENCE_WHITE_MAX (WORD)10000 -#define REFERENCE_BLACK_MIN (WORD)0 -#define REFERENCE_BLACK_MAX (WORD)4000 - -#define COLOR_ADJ_MIN (SHORT)-100 -#define COLOR_ADJ_MAX (SHORT)100 - - typedef struct tagCOLORADJUSTMENT { - WORD caSize; - WORD caFlags; - WORD caIlluminantIndex; - WORD caRedGamma; - WORD caGreenGamma; - WORD caBlueGamma; - WORD caReferenceBlack; - WORD caReferenceWhite; - SHORT caContrast; - SHORT caBrightness; - SHORT caColorfulness; - SHORT caRedGreenTint; - } COLORADJUSTMENT,*PCOLORADJUSTMENT,*LPCOLORADJUSTMENT; - - WINGDIAPI WINBOOL WINAPI SetColorAdjustment(HDC hdc,CONST COLORADJUSTMENT *lpca); - WINGDIAPI WINBOOL WINAPI GetColorAdjustment(HDC hdc,LPCOLORADJUSTMENT lpca); - WINGDIAPI HPALETTE WINAPI CreateHalftonePalette(HDC hdc); - - typedef WINBOOL (CALLBACK *ABORTPROC)(HDC,int); - - typedef struct _DOCINFOA { - int cbSize; - LPCSTR lpszDocName; - LPCSTR lpszOutput; - LPCSTR lpszDatatype; - DWORD fwType; - } DOCINFOA,*LPDOCINFOA; - - typedef struct _DOCINFOW { - int cbSize; - LPCWSTR lpszDocName; - LPCWSTR lpszOutput; - LPCWSTR lpszDatatype; - DWORD fwType; - } DOCINFOW,*LPDOCINFOW; - -#ifdef UNICODE - typedef DOCINFOW DOCINFO; - typedef LPDOCINFOW LPDOCINFO; -#else - typedef DOCINFOA DOCINFO; - typedef LPDOCINFOA LPDOCINFO; -#endif - -#define DI_APPBANDING 0x00000001 -#define DI_ROPS_READ_DESTINATION 0x00000002 - -#ifdef UNICODE -#define StartDoc StartDocW -#define GetObject GetObjectW -#define TextOut TextOutW -#define ExtTextOut ExtTextOutW -#define PolyTextOut PolyTextOutW -#define GetTextFace GetTextFaceW -#else -#define StartDoc StartDocA -#define GetObject GetObjectA -#define TextOut TextOutA -#define ExtTextOut ExtTextOutA -#define PolyTextOut PolyTextOutA -#define GetTextFace GetTextFaceA -#endif - - WINGDIAPI int WINAPI StartDocA(HDC hdc,CONST DOCINFOA *lpdi); - WINGDIAPI int WINAPI StartDocW(HDC hdc,CONST DOCINFOW *lpdi); - WINGDIAPI int WINAPI EndDoc(HDC hdc); - WINGDIAPI int WINAPI StartPage(HDC hdc); - WINGDIAPI int WINAPI EndPage(HDC hdc); - WINGDIAPI int WINAPI AbortDoc(HDC hdc); - WINGDIAPI int WINAPI SetAbortProc(HDC hdc,ABORTPROC proc); - WINGDIAPI WINBOOL WINAPI AbortPath(HDC hdc); - WINGDIAPI WINBOOL WINAPI ArcTo(HDC hdc,int left,int top,int right,int bottom,int xr1,int yr1,int xr2,int yr2); - WINGDIAPI WINBOOL WINAPI BeginPath(HDC hdc); - WINGDIAPI WINBOOL WINAPI CloseFigure(HDC hdc); - WINGDIAPI WINBOOL WINAPI EndPath(HDC hdc); - WINGDIAPI WINBOOL WINAPI FillPath(HDC hdc); - WINGDIAPI WINBOOL WINAPI FlattenPath(HDC hdc); - WINGDIAPI int WINAPI GetPath(HDC hdc,LPPOINT apt,LPBYTE aj,int cpt); - WINGDIAPI HRGN WINAPI PathToRegion(HDC hdc); - WINGDIAPI WINBOOL WINAPI PolyDraw(HDC hdc,CONST POINT *apt,CONST BYTE *aj,int cpt); - WINGDIAPI WINBOOL WINAPI SelectClipPath(HDC hdc,int mode); - WINGDIAPI int WINAPI SetArcDirection(HDC hdc,int dir); - WINGDIAPI WINBOOL WINAPI SetMiterLimit(HDC hdc,FLOAT limit,PFLOAT old); - WINGDIAPI WINBOOL WINAPI StrokeAndFillPath(HDC hdc); - WINGDIAPI WINBOOL WINAPI StrokePath(HDC hdc); - WINGDIAPI WINBOOL WINAPI WidenPath(HDC hdc); - WINGDIAPI HPEN WINAPI ExtCreatePen(DWORD iPenStyle,DWORD cWidth,CONST LOGBRUSH *plbrush,DWORD cStyle,CONST DWORD *pstyle); - WINGDIAPI WINBOOL WINAPI GetMiterLimit(HDC hdc,PFLOAT plimit); - WINGDIAPI int WINAPI GetArcDirection(HDC hdc); - WINGDIAPI int WINAPI GetObjectA(HANDLE h,int c,LPVOID pv); - WINGDIAPI int WINAPI GetObjectW(HANDLE h,int c,LPVOID pv); - WINGDIAPI WINBOOL WINAPI MoveToEx(HDC hdc,int x,int y,LPPOINT lppt); - WINGDIAPI WINBOOL WINAPI TextOutA(HDC hdc,int x,int y,LPCSTR lpString,int c); - WINGDIAPI WINBOOL WINAPI TextOutW(HDC hdc,int x,int y,LPCWSTR lpString,int c); - WINGDIAPI WINBOOL WINAPI ExtTextOutA(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCSTR lpString,UINT c,CONST INT *lpDx); - WINGDIAPI WINBOOL WINAPI ExtTextOutW(HDC hdc,int x,int y,UINT options,CONST RECT *lprect,LPCWSTR lpString,UINT c,CONST INT *lpDx); - WINGDIAPI WINBOOL WINAPI PolyTextOutA(HDC hdc,CONST POLYTEXTA *ppt,int nstrings); - WINGDIAPI WINBOOL WINAPI PolyTextOutW(HDC hdc,CONST POLYTEXTW *ppt,int nstrings); - WINGDIAPI HRGN WINAPI CreatePolygonRgn(CONST POINT *pptl,int cPoint,int iMode); - WINGDIAPI WINBOOL WINAPI DPtoLP(HDC hdc,LPPOINT lppt,int c); - WINGDIAPI WINBOOL WINAPI LPtoDP(HDC hdc,LPPOINT lppt,int c); - WINGDIAPI WINBOOL WINAPI Polygon(HDC hdc,CONST POINT *apt,int cpt); - WINGDIAPI WINBOOL WINAPI Polyline(HDC hdc,CONST POINT *apt,int cpt); - WINGDIAPI WINBOOL WINAPI PolyBezier(HDC hdc,CONST POINT *apt,DWORD cpt); - WINGDIAPI WINBOOL WINAPI PolyBezierTo(HDC hdc,CONST POINT *apt,DWORD cpt); - WINGDIAPI WINBOOL WINAPI PolylineTo(HDC hdc,CONST POINT *apt,DWORD cpt); - WINGDIAPI WINBOOL WINAPI SetViewportExtEx(HDC hdc,int x,int y,LPSIZE lpsz); - WINGDIAPI WINBOOL WINAPI SetViewportOrgEx(HDC hdc,int x,int y,LPPOINT lppt); - WINGDIAPI WINBOOL WINAPI SetWindowExtEx(HDC hdc,int x,int y,LPSIZE lpsz); - WINGDIAPI WINBOOL WINAPI SetWindowOrgEx(HDC hdc,int x,int y,LPPOINT lppt); - WINGDIAPI WINBOOL WINAPI OffsetViewportOrgEx(HDC hdc,int x,int y,LPPOINT lppt); - WINGDIAPI WINBOOL WINAPI OffsetWindowOrgEx(HDC hdc,int x,int y,LPPOINT lppt); - WINGDIAPI WINBOOL WINAPI ScaleViewportExtEx(HDC hdc,int xn,int dx,int yn,int yd,LPSIZE lpsz); - WINGDIAPI WINBOOL WINAPI ScaleWindowExtEx(HDC hdc,int xn,int xd,int yn,int yd,LPSIZE lpsz); - WINGDIAPI WINBOOL WINAPI SetBitmapDimensionEx(HBITMAP hbm,int w,int h,LPSIZE lpsz); - WINGDIAPI WINBOOL WINAPI SetBrushOrgEx(HDC hdc,int x,int y,LPPOINT lppt); - WINGDIAPI int WINAPI GetTextFaceA(HDC hdc,int c,LPSTR lpName); - WINGDIAPI int WINAPI GetTextFaceW(HDC hdc,int c,LPWSTR lpName); - -#define FONTMAPPER_MAX 10 - - typedef struct tagKERNINGPAIR { - WORD wFirst; - WORD wSecond; - int iKernAmount; - } KERNINGPAIR,*LPKERNINGPAIR; - -#ifdef UNICODE -#define GetKerningPairs GetKerningPairsW -#else -#define GetKerningPairs GetKerningPairsA -#endif - - WINGDIAPI DWORD WINAPI GetKerningPairsA(HDC hdc,DWORD nPairs,LPKERNINGPAIR lpKernPair); - WINGDIAPI DWORD WINAPI GetKerningPairsW(HDC hdc,DWORD nPairs,LPKERNINGPAIR lpKernPair); - WINGDIAPI WINBOOL WINAPI GetDCOrgEx(HDC hdc,LPPOINT lppt); - WINGDIAPI WINBOOL WINAPI FixBrushOrgEx(HDC hdc,int x,int y,LPPOINT ptl); - WINGDIAPI WINBOOL WINAPI UnrealizeObject(HGDIOBJ h); - WINGDIAPI WINBOOL WINAPI GdiFlush(); - WINGDIAPI DWORD WINAPI GdiSetBatchLimit(DWORD dw); - WINGDIAPI DWORD WINAPI GdiGetBatchLimit(); - -#define ICM_OFF 1 -#define ICM_ON 2 -#define ICM_QUERY 3 -#define ICM_DONE_OUTSIDEDC 4 - - typedef int (CALLBACK *ICMENUMPROCA)(LPSTR,LPARAM); - typedef int (CALLBACK *ICMENUMPROCW)(LPWSTR,LPARAM); - -#ifdef UNICODE -#define ICMENUMPROC ICMENUMPROCW -#define EnumICMProfiles EnumICMProfilesW -#define UpdateICMRegKey UpdateICMRegKeyW -#define GetLogColorSpace GetLogColorSpaceW -#define CreateColorSpace CreateColorSpaceW -#define GetICMProfile GetICMProfileW -#define SetICMProfile SetICMProfileW -#else -#define ICMENUMPROC ICMENUMPROCA -#define EnumICMProfiles EnumICMProfilesA -#define UpdateICMRegKey UpdateICMRegKeyA -#define GetLogColorSpace GetLogColorSpaceA -#define CreateColorSpace CreateColorSpaceA -#define GetICMProfile GetICMProfileA -#define SetICMProfile SetICMProfileA -#endif - - WINGDIAPI int WINAPI SetICMMode(HDC hdc,int mode); - WINGDIAPI WINBOOL WINAPI CheckColorsInGamut(HDC hdc,LPVOID lpRGBTriple,LPVOID dlpBuffer,DWORD nCount); - WINGDIAPI HCOLORSPACE WINAPI GetColorSpace(HDC hdc); - WINGDIAPI WINBOOL WINAPI GetLogColorSpaceA(HCOLORSPACE hColorSpace,LPLOGCOLORSPACEA lpBuffer,DWORD nSize); - WINGDIAPI WINBOOL WINAPI GetLogColorSpaceW(HCOLORSPACE hColorSpace,LPLOGCOLORSPACEW lpBuffer,DWORD nSize); - WINGDIAPI HCOLORSPACE WINAPI CreateColorSpaceA(LPLOGCOLORSPACEA lplcs); - WINGDIAPI HCOLORSPACE WINAPI CreateColorSpaceW(LPLOGCOLORSPACEW lplcs); - WINGDIAPI HCOLORSPACE WINAPI SetColorSpace(HDC hdc,HCOLORSPACE hcs); - WINGDIAPI WINBOOL WINAPI DeleteColorSpace(HCOLORSPACE hcs); - WINGDIAPI WINBOOL WINAPI GetICMProfileA(HDC hdc,LPDWORD pBufSize,LPSTR pszFilename); - WINGDIAPI WINBOOL WINAPI GetICMProfileW(HDC hdc,LPDWORD pBufSize,LPWSTR pszFilename); - WINGDIAPI WINBOOL WINAPI SetICMProfileA(HDC hdc,LPSTR lpFileName); - WINGDIAPI WINBOOL WINAPI SetICMProfileW(HDC hdc,LPWSTR lpFileName); - WINGDIAPI WINBOOL WINAPI GetDeviceGammaRamp(HDC hdc,LPVOID lpRamp); - WINGDIAPI WINBOOL WINAPI SetDeviceGammaRamp(HDC hdc,LPVOID lpRamp); - WINGDIAPI WINBOOL WINAPI ColorMatchToTarget(HDC hdc,HDC hdcTarget,DWORD action); - WINGDIAPI int WINAPI EnumICMProfilesA(HDC hdc,ICMENUMPROCA proc,LPARAM param); - WINGDIAPI int WINAPI EnumICMProfilesW(HDC hdc,ICMENUMPROCW proc,LPARAM param); - WINGDIAPI WINBOOL WINAPI UpdateICMRegKeyA(DWORD reserved,LPSTR lpszCMID,LPSTR lpszFileName,UINT command); - WINGDIAPI WINBOOL WINAPI UpdateICMRegKeyW(DWORD reserved,LPWSTR lpszCMID,LPWSTR lpszFileName,UINT command); - WINGDIAPI WINBOOL WINAPI ColorCorrectPalette(HDC hdc,HPALETTE hPal,DWORD deFirst,DWORD num); - -#ifndef NOMETAFILE - -#define ENHMETA_SIGNATURE 0x464D4520 -#define ENHMETA_STOCK_OBJECT 0x80000000 - -#define EMR_HEADER 1 -#define EMR_POLYBEZIER 2 -#define EMR_POLYGON 3 -#define EMR_POLYLINE 4 -#define EMR_POLYBEZIERTO 5 -#define EMR_POLYLINETO 6 -#define EMR_POLYPOLYLINE 7 -#define EMR_POLYPOLYGON 8 -#define EMR_SETWINDOWEXTEX 9 -#define EMR_SETWINDOWORGEX 10 -#define EMR_SETVIEWPORTEXTEX 11 -#define EMR_SETVIEWPORTORGEX 12 -#define EMR_SETBRUSHORGEX 13 -#define EMR_EOF 14 -#define EMR_SETPIXELV 15 -#define EMR_SETMAPPERFLAGS 16 -#define EMR_SETMAPMODE 17 -#define EMR_SETBKMODE 18 -#define EMR_SETPOLYFILLMODE 19 -#define EMR_SETROP2 20 -#define EMR_SETSTRETCHBLTMODE 21 -#define EMR_SETTEXTALIGN 22 -#define EMR_SETCOLORADJUSTMENT 23 -#define EMR_SETTEXTCOLOR 24 -#define EMR_SETBKCOLOR 25 -#define EMR_OFFSETCLIPRGN 26 -#define EMR_MOVETOEX 27 -#define EMR_SETMETARGN 28 -#define EMR_EXCLUDECLIPRECT 29 -#define EMR_INTERSECTCLIPRECT 30 -#define EMR_SCALEVIEWPORTEXTEX 31 -#define EMR_SCALEWINDOWEXTEX 32 -#define EMR_SAVEDC 33 -#define EMR_RESTOREDC 34 -#define EMR_SETWORLDTRANSFORM 35 -#define EMR_MODIFYWORLDTRANSFORM 36 -#define EMR_SELECTOBJECT 37 -#define EMR_CREATEPEN 38 -#define EMR_CREATEBRUSHINDIRECT 39 -#define EMR_DELETEOBJECT 40 -#define EMR_ANGLEARC 41 -#define EMR_ELLIPSE 42 -#define EMR_RECTANGLE 43 -#define EMR_ROUNDRECT 44 -#define EMR_ARC 45 -#define EMR_CHORD 46 -#define EMR_PIE 47 -#define EMR_SELECTPALETTE 48 -#define EMR_CREATEPALETTE 49 -#define EMR_SETPALETTEENTRIES 50 -#define EMR_RESIZEPALETTE 51 -#define EMR_REALIZEPALETTE 52 -#define EMR_EXTFLOODFILL 53 -#define EMR_LINETO 54 -#define EMR_ARCTO 55 -#define EMR_POLYDRAW 56 -#define EMR_SETARCDIRECTION 57 -#define EMR_SETMITERLIMIT 58 -#define EMR_BEGINPATH 59 -#define EMR_ENDPATH 60 -#define EMR_CLOSEFIGURE 61 -#define EMR_FILLPATH 62 -#define EMR_STROKEANDFILLPATH 63 -#define EMR_STROKEPATH 64 -#define EMR_FLATTENPATH 65 -#define EMR_WIDENPATH 66 -#define EMR_SELECTCLIPPATH 67 -#define EMR_ABORTPATH 68 - -#define EMR_GDICOMMENT 70 -#define EMR_FILLRGN 71 -#define EMR_FRAMERGN 72 -#define EMR_INVERTRGN 73 -#define EMR_PAINTRGN 74 -#define EMR_EXTSELECTCLIPRGN 75 -#define EMR_BITBLT 76 -#define EMR_STRETCHBLT 77 -#define EMR_MASKBLT 78 -#define EMR_PLGBLT 79 -#define EMR_SETDIBITSTODEVICE 80 -#define EMR_STRETCHDIBITS 81 -#define EMR_EXTCREATEFONTINDIRECTW 82 -#define EMR_EXTTEXTOUTA 83 -#define EMR_EXTTEXTOUTW 84 -#define EMR_POLYBEZIER16 85 -#define EMR_POLYGON16 86 -#define EMR_POLYLINE16 87 -#define EMR_POLYBEZIERTO16 88 -#define EMR_POLYLINETO16 89 -#define EMR_POLYPOLYLINE16 90 -#define EMR_POLYPOLYGON16 91 -#define EMR_POLYDRAW16 92 -#define EMR_CREATEMONOBRUSH 93 -#define EMR_CREATEDIBPATTERNBRUSHPT 94 -#define EMR_EXTCREATEPEN 95 -#define EMR_POLYTEXTOUTA 96 -#define EMR_POLYTEXTOUTW 97 - -#define EMR_SETICMMODE 98 -#define EMR_CREATECOLORSPACE 99 -#define EMR_SETCOLORSPACE 100 -#define EMR_DELETECOLORSPACE 101 -#define EMR_GLSRECORD 102 -#define EMR_GLSBOUNDEDRECORD 103 -#define EMR_PIXELFORMAT 104 -#define EMR_RESERVED_105 105 -#define EMR_RESERVED_106 106 -#define EMR_RESERVED_107 107 -#define EMR_RESERVED_108 108 -#define EMR_RESERVED_109 109 -#define EMR_RESERVED_110 110 -#define EMR_COLORCORRECTPALETTE 111 -#define EMR_SETICMPROFILEA 112 -#define EMR_SETICMPROFILEW 113 -#define EMR_ALPHABLEND 114 -#define EMR_SETLAYOUT 115 -#define EMR_TRANSPARENTBLT 116 -#define EMR_RESERVED_117 117 -#define EMR_GRADIENTFILL 118 -#define EMR_RESERVED_119 119 -#define EMR_RESERVED_120 120 -#define EMR_COLORMATCHTOTARGETW 121 -#define EMR_CREATECOLORSPACEW 122 - -#define EMR_MIN 1 - -#define EMR_MAX 122 - - typedef struct tagEMR { - DWORD iType; - DWORD nSize; - } EMR,*PEMR; - - typedef struct tagEMRTEXT { - POINTL ptlReference; - DWORD nChars; - DWORD offString; - DWORD fOptions; - RECTL rcl; - DWORD offDx; - } EMRTEXT,*PEMRTEXT; - - typedef struct tagABORTPATH { - EMR emr; - } EMRABORTPATH,*PEMRABORTPATH,EMRBEGINPATH,*PEMRBEGINPATH,EMRENDPATH,*PEMRENDPATH,EMRCLOSEFIGURE,*PEMRCLOSEFIGURE,EMRFLATTENPATH,*PEMRFLATTENPATH,EMRWIDENPATH,*PEMRWIDENPATH,EMRSETMETARGN,*PEMRSETMETARGN,EMRSAVEDC,*PEMRSAVEDC,EMRREALIZEPALETTE,*PEMRREALIZEPALETTE; - - typedef struct tagEMRSELECTCLIPPATH { - EMR emr; - DWORD iMode; - } EMRSELECTCLIPPATH,*PEMRSELECTCLIPPATH,EMRSETBKMODE,*PEMRSETBKMODE,EMRSETMAPMODE,*PEMRSETMAPMODE,EMRSETLAYOUT,*PEMRSETLAYOUT, - EMRSETPOLYFILLMODE,*PEMRSETPOLYFILLMODE,EMRSETROP2,*PEMRSETROP2,EMRSETSTRETCHBLTMODE,*PEMRSETSTRETCHBLTMODE,EMRSETICMMODE, - *PEMRSETICMMODE,EMRSETTEXTALIGN,*PEMRSETTEXTALIGN; - - typedef struct tagEMRSETMITERLIMIT { - EMR emr; - FLOAT eMiterLimit; - } EMRSETMITERLIMIT,*PEMRSETMITERLIMIT; - - typedef struct tagEMRRESTOREDC { - EMR emr; - LONG iRelative; - } EMRRESTOREDC,*PEMRRESTOREDC; - - typedef struct tagEMRSETARCDIRECTION { - EMR emr; - DWORD iArcDirection; - - } EMRSETARCDIRECTION,*PEMRSETARCDIRECTION; - - typedef struct tagEMRSETMAPPERFLAGS { - EMR emr; - DWORD dwFlags; - } EMRSETMAPPERFLAGS,*PEMRSETMAPPERFLAGS; - - typedef struct tagEMRSETTEXTCOLOR { - EMR emr; - COLORREF crColor; - } EMRSETBKCOLOR,*PEMRSETBKCOLOR,EMRSETTEXTCOLOR,*PEMRSETTEXTCOLOR; - - typedef struct tagEMRSELECTOBJECT { - EMR emr; - DWORD ihObject; - } EMRSELECTOBJECT,*PEMRSELECTOBJECT,EMRDELETEOBJECT,*PEMRDELETEOBJECT; - - typedef struct tagEMRSELECTPALETTE { - EMR emr; - DWORD ihPal; - } EMRSELECTPALETTE,*PEMRSELECTPALETTE; - - typedef struct tagEMRRESIZEPALETTE { - EMR emr; - DWORD ihPal; - DWORD cEntries; - } EMRRESIZEPALETTE,*PEMRRESIZEPALETTE; - - typedef struct tagEMRSETPALETTEENTRIES { - EMR emr; - DWORD ihPal; - DWORD iStart; - DWORD cEntries; - PALETTEENTRY aPalEntries[1]; - } EMRSETPALETTEENTRIES,*PEMRSETPALETTEENTRIES; - - typedef struct tagEMRSETCOLORADJUSTMENT { - EMR emr; - COLORADJUSTMENT ColorAdjustment; - } EMRSETCOLORADJUSTMENT,*PEMRSETCOLORADJUSTMENT; - - typedef struct tagEMRGDICOMMENT { - EMR emr; - DWORD cbData; - BYTE Data[1]; - } EMRGDICOMMENT,*PEMRGDICOMMENT; - - typedef struct tagEMREOF { - EMR emr; - DWORD nPalEntries; - DWORD offPalEntries; - DWORD nSizeLast; - } EMREOF,*PEMREOF; - - typedef struct tagEMRLINETO { - EMR emr; - POINTL ptl; - } EMRLINETO,*PEMRLINETO,EMRMOVETOEX,*PEMRMOVETOEX; - - typedef struct tagEMROFFSETCLIPRGN { - EMR emr; - POINTL ptlOffset; - } EMROFFSETCLIPRGN,*PEMROFFSETCLIPRGN; - - typedef struct tagEMRFILLPATH { - EMR emr; - RECTL rclBounds; - } EMRFILLPATH,*PEMRFILLPATH,EMRSTROKEANDFILLPATH,*PEMRSTROKEANDFILLPATH,EMRSTROKEPATH,*PEMRSTROKEPATH; - - typedef struct tagEMREXCLUDECLIPRECT { - EMR emr; - RECTL rclClip; - } EMREXCLUDECLIPRECT,*PEMREXCLUDECLIPRECT,EMRINTERSECTCLIPRECT,*PEMRINTERSECTCLIPRECT; - - typedef struct tagEMRSETVIEWPORTORGEX { - EMR emr; - POINTL ptlOrigin; - } EMRSETVIEWPORTORGEX,*PEMRSETVIEWPORTORGEX,EMRSETWINDOWORGEX,*PEMRSETWINDOWORGEX,EMRSETBRUSHORGEX,*PEMRSETBRUSHORGEX; - - typedef struct tagEMRSETVIEWPORTEXTEX { - EMR emr; - SIZEL szlExtent; - } EMRSETVIEWPORTEXTEX,*PEMRSETVIEWPORTEXTEX,EMRSETWINDOWEXTEX,*PEMRSETWINDOWEXTEX; - - typedef struct tagEMRSCALEVIEWPORTEXTEX { - EMR emr; - LONG xNum; - LONG xDenom; - LONG yNum; - LONG yDenom; - } EMRSCALEVIEWPORTEXTEX,*PEMRSCALEVIEWPORTEXTEX,EMRSCALEWINDOWEXTEX,*PEMRSCALEWINDOWEXTEX; - - typedef struct tagEMRSETWORLDTRANSFORM { - EMR emr; - XFORM xform; - } EMRSETWORLDTRANSFORM,*PEMRSETWORLDTRANSFORM; - - typedef struct tagEMRMODIFYWORLDTRANSFORM { - EMR emr; - XFORM xform; - DWORD iMode; - } EMRMODIFYWORLDTRANSFORM,*PEMRMODIFYWORLDTRANSFORM; - - typedef struct tagEMRSETPIXELV { - EMR emr; - POINTL ptlPixel; - COLORREF crColor; - } EMRSETPIXELV,*PEMRSETPIXELV; - - typedef struct tagEMREXTFLOODFILL { - EMR emr; - POINTL ptlStart; - COLORREF crColor; - DWORD iMode; - } EMREXTFLOODFILL,*PEMREXTFLOODFILL; - - typedef struct tagEMRELLIPSE { - EMR emr; - RECTL rclBox; - } EMRELLIPSE,*PEMRELLIPSE,EMRRECTANGLE,*PEMRRECTANGLE; - - typedef struct tagEMRROUNDRECT { - EMR emr; - RECTL rclBox; - SIZEL szlCorner; - } EMRROUNDRECT,*PEMRROUNDRECT; - - typedef struct tagEMRARC { - EMR emr; - RECTL rclBox; - POINTL ptlStart; - POINTL ptlEnd; - } EMRARC,*PEMRARC,EMRARCTO,*PEMRARCTO,EMRCHORD,*PEMRCHORD,EMRPIE,*PEMRPIE; - - typedef struct tagEMRANGLEARC { - EMR emr; - POINTL ptlCenter; - DWORD nRadius; - FLOAT eStartAngle; - FLOAT eSweepAngle; - } EMRANGLEARC,*PEMRANGLEARC; - - typedef struct tagEMRPOLYLINE { - EMR emr; - RECTL rclBounds; - DWORD cptl; - POINTL aptl[1]; - } EMRPOLYLINE,*PEMRPOLYLINE,EMRPOLYBEZIER,*PEMRPOLYBEZIER,EMRPOLYGON,*PEMRPOLYGON,EMRPOLYBEZIERTO,*PEMRPOLYBEZIERTO,EMRPOLYLINETO,*PEMRPOLYLINETO; - - typedef struct tagEMRPOLYLINE16 { - EMR emr; - RECTL rclBounds; - DWORD cpts; - POINTS apts[1]; - } EMRPOLYLINE16,*PEMRPOLYLINE16,EMRPOLYBEZIER16,*PEMRPOLYBEZIER16,EMRPOLYGON16,*PEMRPOLYGON16,EMRPOLYBEZIERTO16,*PEMRPOLYBEZIERTO16,EMRPOLYLINETO16,*PEMRPOLYLINETO16; - - typedef struct tagEMRPOLYDRAW { - EMR emr; - RECTL rclBounds; - DWORD cptl; - POINTL aptl[1]; - BYTE abTypes[1]; - } EMRPOLYDRAW,*PEMRPOLYDRAW; - - typedef struct tagEMRPOLYDRAW16 { - EMR emr; - RECTL rclBounds; - DWORD cpts; - POINTS apts[1]; - BYTE abTypes[1]; - } EMRPOLYDRAW16,*PEMRPOLYDRAW16; - - typedef struct tagEMRPOLYPOLYLINE { - EMR emr; - RECTL rclBounds; - DWORD nPolys; - DWORD cptl; - DWORD aPolyCounts[1]; - POINTL aptl[1]; - } EMRPOLYPOLYLINE,*PEMRPOLYPOLYLINE,EMRPOLYPOLYGON,*PEMRPOLYPOLYGON; - - typedef struct tagEMRPOLYPOLYLINE16 { - EMR emr; - RECTL rclBounds; - DWORD nPolys; - DWORD cpts; - DWORD aPolyCounts[1]; - POINTS apts[1]; - } EMRPOLYPOLYLINE16,*PEMRPOLYPOLYLINE16,EMRPOLYPOLYGON16,*PEMRPOLYPOLYGON16; - - typedef struct tagEMRINVERTRGN { - EMR emr; - RECTL rclBounds; - DWORD cbRgnData; - BYTE RgnData[1]; - } EMRINVERTRGN,*PEMRINVERTRGN,EMRPAINTRGN,*PEMRPAINTRGN; - - typedef struct tagEMRFILLRGN { - EMR emr; - RECTL rclBounds; - DWORD cbRgnData; - DWORD ihBrush; - BYTE RgnData[1]; - } EMRFILLRGN,*PEMRFILLRGN; - - typedef struct tagEMRFRAMERGN { - EMR emr; - RECTL rclBounds; - DWORD cbRgnData; - DWORD ihBrush; - SIZEL szlStroke; - BYTE RgnData[1]; - } EMRFRAMERGN,*PEMRFRAMERGN; - - typedef struct tagEMREXTSELECTCLIPRGN { - EMR emr; - DWORD cbRgnData; - DWORD iMode; - BYTE RgnData[1]; - } EMREXTSELECTCLIPRGN,*PEMREXTSELECTCLIPRGN; - - typedef struct tagEMREXTTEXTOUTA { - EMR emr; - RECTL rclBounds; - DWORD iGraphicsMode; - FLOAT exScale; - FLOAT eyScale; - EMRTEXT emrtext; - } EMREXTTEXTOUTA,*PEMREXTTEXTOUTA,EMREXTTEXTOUTW,*PEMREXTTEXTOUTW; - - typedef struct tagEMRPOLYTEXTOUTA { - EMR emr; - RECTL rclBounds; - DWORD iGraphicsMode; - FLOAT exScale; - FLOAT eyScale; - LONG cStrings; - EMRTEXT aemrtext[1]; - } EMRPOLYTEXTOUTA,*PEMRPOLYTEXTOUTA,EMRPOLYTEXTOUTW,*PEMRPOLYTEXTOUTW; - - typedef struct tagEMRBITBLT { - EMR emr; - RECTL rclBounds; - LONG xDest; - LONG yDest; - LONG cxDest; - LONG cyDest; - DWORD dwRop; - LONG xSrc; - LONG ySrc; - XFORM xformSrc; - COLORREF crBkColorSrc; - DWORD iUsageSrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - } EMRBITBLT,*PEMRBITBLT; - - typedef struct tagEMRSTRETCHBLT { - EMR emr; - RECTL rclBounds; - LONG xDest; - LONG yDest; - LONG cxDest; - LONG cyDest; - DWORD dwRop; - LONG xSrc; - LONG ySrc; - XFORM xformSrc; - COLORREF crBkColorSrc; - DWORD iUsageSrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - LONG cxSrc; - LONG cySrc; - } EMRSTRETCHBLT,*PEMRSTRETCHBLT; - - typedef struct tagEMRMASKBLT { - EMR emr; - RECTL rclBounds; - LONG xDest; - LONG yDest; - LONG cxDest; - LONG cyDest; - DWORD dwRop; - LONG xSrc; - LONG ySrc; - XFORM xformSrc; - COLORREF crBkColorSrc; - DWORD iUsageSrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - LONG xMask; - LONG yMask; - DWORD iUsageMask; - DWORD offBmiMask; - DWORD cbBmiMask; - DWORD offBitsMask; - DWORD cbBitsMask; - } EMRMASKBLT,*PEMRMASKBLT; - - typedef struct tagEMRPLGBLT { - EMR emr; - RECTL rclBounds; - POINTL aptlDest[3]; - LONG xSrc; - LONG ySrc; - LONG cxSrc; - LONG cySrc; - XFORM xformSrc; - COLORREF crBkColorSrc; - DWORD iUsageSrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - LONG xMask; - LONG yMask; - DWORD iUsageMask; - DWORD offBmiMask; - DWORD cbBmiMask; - DWORD offBitsMask; - DWORD cbBitsMask; - } EMRPLGBLT,*PEMRPLGBLT; - - typedef struct tagEMRSETDIBITSTODEVICE { - EMR emr; - RECTL rclBounds; - LONG xDest; - LONG yDest; - LONG xSrc; - LONG ySrc; - LONG cxSrc; - LONG cySrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - DWORD iUsageSrc; - DWORD iStartScan; - DWORD cScans; - } EMRSETDIBITSTODEVICE,*PEMRSETDIBITSTODEVICE; - - typedef struct tagEMRSTRETCHDIBITS { - EMR emr; - RECTL rclBounds; - LONG xDest; - LONG yDest; - LONG xSrc; - LONG ySrc; - LONG cxSrc; - LONG cySrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - DWORD iUsageSrc; - DWORD dwRop; - LONG cxDest; - LONG cyDest; - } EMRSTRETCHDIBITS,*PEMRSTRETCHDIBITS; - - typedef struct tagEMREXTCREATEFONTINDIRECTW { - EMR emr; - DWORD ihFont; - EXTLOGFONTW elfw; - } EMREXTCREATEFONTINDIRECTW,*PEMREXTCREATEFONTINDIRECTW; - - typedef struct tagEMRCREATEPALETTE { - EMR emr; - DWORD ihPal; - LOGPALETTE lgpl; - } EMRCREATEPALETTE,*PEMRCREATEPALETTE; - - typedef struct tagEMRCREATEPEN { - EMR emr; - DWORD ihPen; - LOGPEN lopn; - } EMRCREATEPEN,*PEMRCREATEPEN; - - typedef struct tagEMREXTCREATEPEN { - EMR emr; - DWORD ihPen; - DWORD offBmi; - DWORD cbBmi; - DWORD offBits; - DWORD cbBits; - EXTLOGPEN elp; - } EMREXTCREATEPEN,*PEMREXTCREATEPEN; - - typedef struct tagEMRCREATEBRUSHINDIRECT { - EMR emr; - DWORD ihBrush; - LOGBRUSH32 lb; - } EMRCREATEBRUSHINDIRECT,*PEMRCREATEBRUSHINDIRECT; - - typedef struct tagEMRCREATEMONOBRUSH { - EMR emr; - DWORD ihBrush; - DWORD iUsage; - DWORD offBmi; - DWORD cbBmi; - DWORD offBits; - DWORD cbBits; - } EMRCREATEMONOBRUSH,*PEMRCREATEMONOBRUSH; - - typedef struct tagEMRCREATEDIBPATTERNBRUSHPT { - EMR emr; - DWORD ihBrush; - DWORD iUsage; - DWORD offBmi; - DWORD cbBmi; - DWORD offBits; - DWORD cbBits; - } EMRCREATEDIBPATTERNBRUSHPT,*PEMRCREATEDIBPATTERNBRUSHPT; - - typedef struct tagEMRFORMAT { - DWORD dSignature; - DWORD nVersion; - DWORD cbData; - DWORD offData; - } EMRFORMAT,*PEMRFORMAT; - - typedef struct tagEMRGLSRECORD { - EMR emr; - DWORD cbData; - BYTE Data[1]; - } EMRGLSRECORD,*PEMRGLSRECORD; - - typedef struct tagEMRGLSBOUNDEDRECORD { - EMR emr; - RECTL rclBounds; - DWORD cbData; - BYTE Data[1]; - } EMRGLSBOUNDEDRECORD,*PEMRGLSBOUNDEDRECORD; - - typedef struct tagEMRPIXELFORMAT { - EMR emr; - PIXELFORMATDESCRIPTOR pfd; - } EMRPIXELFORMAT,*PEMRPIXELFORMAT; - - typedef struct tagEMRCREATECOLORSPACE { - EMR emr; - DWORD ihCS; - LOGCOLORSPACEA lcs; - } EMRCREATECOLORSPACE,*PEMRCREATECOLORSPACE; - - typedef struct tagEMRSETCOLORSPACE { - EMR emr; - DWORD ihCS; - } EMRSETCOLORSPACE,*PEMRSETCOLORSPACE,EMRSELECTCOLORSPACE,*PEMRSELECTCOLORSPACE,EMRDELETECOLORSPACE,*PEMRDELETECOLORSPACE; - - typedef struct tagEMREXTESCAPE { - EMR emr; - INT iEscape; - INT cbEscData; - BYTE EscData[1]; - } EMREXTESCAPE,*PEMREXTESCAPE,EMRDRAWESCAPE,*PEMRDRAWESCAPE; - - typedef struct tagEMRNAMEDESCAPE { - EMR emr; - INT iEscape; - INT cbDriver; - INT cbEscData; - BYTE EscData[1]; - } EMRNAMEDESCAPE,*PEMRNAMEDESCAPE; - -#define SETICMPROFILE_EMBEDED 0x00000001 - - typedef struct tagEMRSETICMPROFILE { - EMR emr; - DWORD dwFlags; - DWORD cbName; - DWORD cbData; - BYTE Data[1]; - } EMRSETICMPROFILE,*PEMRSETICMPROFILE,EMRSETICMPROFILEA,*PEMRSETICMPROFILEA,EMRSETICMPROFILEW,*PEMRSETICMPROFILEW; - -#define CREATECOLORSPACE_EMBEDED 0x00000001 - - typedef struct tagEMRCREATECOLORSPACEW { - EMR emr; - DWORD ihCS; - LOGCOLORSPACEW lcs; - DWORD dwFlags; - DWORD cbData; - BYTE Data[1]; - } EMRCREATECOLORSPACEW,*PEMRCREATECOLORSPACEW; - -#define COLORMATCHTOTARGET_EMBEDED 0x00000001 - - typedef struct tagCOLORMATCHTOTARGET { - EMR emr; - DWORD dwAction; - DWORD dwFlags; - DWORD cbName; - DWORD cbData; - BYTE Data[1]; - } EMRCOLORMATCHTOTARGET,*PEMRCOLORMATCHTOTARGET; - - typedef struct tagCOLORCORRECTPALETTE { - EMR emr; - DWORD ihPalette; - DWORD nFirstEntry; - DWORD nPalEntries; - DWORD nReserved; - } EMRCOLORCORRECTPALETTE,*PEMRCOLORCORRECTPALETTE; - - typedef struct tagEMRALPHABLEND { - EMR emr; - RECTL rclBounds; - LONG xDest; - LONG yDest; - LONG cxDest; - LONG cyDest; - DWORD dwRop; - LONG xSrc; - LONG ySrc; - XFORM xformSrc; - COLORREF crBkColorSrc; - DWORD iUsageSrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - LONG cxSrc; - LONG cySrc; - } EMRALPHABLEND,*PEMRALPHABLEND; - - typedef struct tagEMRGRADIENTFILL { - EMR emr; - RECTL rclBounds; - DWORD nVer; - DWORD nTri; - ULONG ulMode; - TRIVERTEX Ver[1]; - } EMRGRADIENTFILL,*PEMRGRADIENTFILL; - - typedef struct tagEMRTRANSPARENTBLT { - EMR emr; - RECTL rclBounds; - LONG xDest; - LONG yDest; - LONG cxDest; - LONG cyDest; - DWORD dwRop; - LONG xSrc; - LONG ySrc; - XFORM xformSrc; - COLORREF crBkColorSrc; - DWORD iUsageSrc; - DWORD offBmiSrc; - DWORD cbBmiSrc; - DWORD offBitsSrc; - DWORD cbBitsSrc; - LONG cxSrc; - LONG cySrc; - } EMRTRANSPARENTBLT,*PEMRTRANSPARENTBLT; - -#define GDICOMMENT_IDENTIFIER 0x43494447 -#define GDICOMMENT_WINDOWS_METAFILE 0x80000001 -#define GDICOMMENT_BEGINGROUP 0x00000002 -#define GDICOMMENT_ENDGROUP 0x00000003 -#define GDICOMMENT_MULTIFORMATS 0x40000004 -#define EPS_SIGNATURE 0x46535045 -#define GDICOMMENT_UNICODE_STRING 0x00000040 -#define GDICOMMENT_UNICODE_END 0x00000080 -#endif - -#ifdef UNICODE -#define wglUseFontBitmaps wglUseFontBitmapsW -#else -#define wglUseFontBitmaps wglUseFontBitmapsA -#endif - - WINGDIAPI WINBOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT); - WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); - WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int); - WINGDIAPI WINBOOL WINAPI wglDeleteContext(HGLRC); - WINGDIAPI HGLRC WINAPI wglGetCurrentContext(VOID); - WINGDIAPI HDC WINAPI wglGetCurrentDC(VOID); - WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); - WINGDIAPI WINBOOL WINAPI wglMakeCurrent(HDC,HGLRC); - WINGDIAPI WINBOOL WINAPI wglShareLists(HGLRC,HGLRC); - WINGDIAPI WINBOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD); - WINGDIAPI WINBOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD); - WINGDIAPI WINBOOL WINAPI SwapBuffers(HDC); - - typedef struct _POINTFLOAT { - FLOAT x; - FLOAT y; - } POINTFLOAT,*PPOINTFLOAT; - - typedef struct _GLYPHMETRICSFLOAT { - FLOAT gmfBlackBoxX; - FLOAT gmfBlackBoxY; - POINTFLOAT gmfptGlyphOrigin; - FLOAT gmfCellIncX; - FLOAT gmfCellIncY; - } GLYPHMETRICSFLOAT,*PGLYPHMETRICSFLOAT,*LPGLYPHMETRICSFLOAT; - -#define WGL_FONT_LINES 0 -#define WGL_FONT_POLYGONS 1 - -#ifdef UNICODE -#define wglUseFontOutlines wglUseFontOutlinesW -#else -#define wglUseFontOutlines wglUseFontOutlinesA -#endif - - WINGDIAPI WINBOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); - WINGDIAPI WINBOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); - - typedef struct tagLAYERPLANEDESCRIPTOR { - WORD nSize; - WORD nVersion; - DWORD dwFlags; - BYTE iPixelType; - BYTE cColorBits; - BYTE cRedBits; - BYTE cRedShift; - BYTE cGreenBits; - BYTE cGreenShift; - BYTE cBlueBits; - BYTE cBlueShift; - BYTE cAlphaBits; - BYTE cAlphaShift; - BYTE cAccumBits; - BYTE cAccumRedBits; - BYTE cAccumGreenBits; - BYTE cAccumBlueBits; - BYTE cAccumAlphaBits; - BYTE cDepthBits; - BYTE cStencilBits; - BYTE cAuxBuffers; - BYTE iLayerPlane; - BYTE bReserved; - COLORREF crTransparent; - } LAYERPLANEDESCRIPTOR,*PLAYERPLANEDESCRIPTOR,*LPLAYERPLANEDESCRIPTOR; - -#define LPD_DOUBLEBUFFER 0x00000001 -#define LPD_STEREO 0x00000002 -#define LPD_SUPPORT_GDI 0x00000010 -#define LPD_SUPPORT_OPENGL 0x00000020 -#define LPD_SHARE_DEPTH 0x00000040 -#define LPD_SHARE_STENCIL 0x00000080 -#define LPD_SHARE_ACCUM 0x00000100 -#define LPD_SWAP_EXCHANGE 0x00000200 -#define LPD_SWAP_COPY 0x00000400 -#define LPD_TRANSPARENT 0x00001000 - -#define LPD_TYPE_RGBA 0 -#define LPD_TYPE_COLORINDEX 1 - -#define WGL_SWAP_MAIN_PLANE 0x00000001 -#define WGL_SWAP_OVERLAY1 0x00000002 -#define WGL_SWAP_OVERLAY2 0x00000004 -#define WGL_SWAP_OVERLAY3 0x00000008 -#define WGL_SWAP_OVERLAY4 0x00000010 -#define WGL_SWAP_OVERLAY5 0x00000020 -#define WGL_SWAP_OVERLAY6 0x00000040 -#define WGL_SWAP_OVERLAY7 0x00000080 -#define WGL_SWAP_OVERLAY8 0x00000100 -#define WGL_SWAP_OVERLAY9 0x00000200 -#define WGL_SWAP_OVERLAY10 0x00000400 -#define WGL_SWAP_OVERLAY11 0x00000800 -#define WGL_SWAP_OVERLAY12 0x00001000 -#define WGL_SWAP_OVERLAY13 0x00002000 -#define WGL_SWAP_OVERLAY14 0x00004000 -#define WGL_SWAP_OVERLAY15 0x00008000 -#define WGL_SWAP_UNDERLAY1 0x00010000 -#define WGL_SWAP_UNDERLAY2 0x00020000 -#define WGL_SWAP_UNDERLAY3 0x00040000 -#define WGL_SWAP_UNDERLAY4 0x00080000 -#define WGL_SWAP_UNDERLAY5 0x00100000 -#define WGL_SWAP_UNDERLAY6 0x00200000 -#define WGL_SWAP_UNDERLAY7 0x00400000 -#define WGL_SWAP_UNDERLAY8 0x00800000 -#define WGL_SWAP_UNDERLAY9 0x01000000 -#define WGL_SWAP_UNDERLAY10 0x02000000 -#define WGL_SWAP_UNDERLAY11 0x04000000 -#define WGL_SWAP_UNDERLAY12 0x08000000 -#define WGL_SWAP_UNDERLAY13 0x10000000 -#define WGL_SWAP_UNDERLAY14 0x20000000 -#define WGL_SWAP_UNDERLAY15 0x40000000 - - WINGDIAPI WINBOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR); - WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,CONST COLORREF *); - WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF *); - WINGDIAPI WINBOOL WINAPI wglRealizeLayerPalette(HDC,int,WINBOOL); - WINGDIAPI WINBOOL WINAPI wglSwapLayerBuffers(HDC,UINT); - - typedef struct _WGLSWAP { - HDC hdc; - UINT uiFlags; - } WGLSWAP,*PWGLSWAP,*LPWGLSWAP; - -#define WGL_SWAPMULTIPLE_MAX 16 - - WINGDIAPI DWORD WINAPI wglSwapMultipleBuffers(UINT,CONST WGLSWAP *); -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/winnls.h b/win32/include/winapi/winnls.h deleted file mode 100644 index 296b4cb3..00000000 --- a/win32/include/winapi/winnls.h +++ /dev/null @@ -1,778 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINNLS_ -#define _WINNLS_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef NONLS - -#define MAX_LEADBYTES 12 -#define MAX_DEFAULTCHAR 2 - -#define MB_PRECOMPOSED 0x00000001 -#define MB_COMPOSITE 0x00000002 -#define MB_USEGLYPHCHARS 0x00000004 -#define MB_ERR_INVALID_CHARS 0x00000008 - -#define WC_COMPOSITECHECK 0x00000200 -#define WC_DISCARDNS 0x00000010 -#define WC_SEPCHARS 0x00000020 -#define WC_DEFAULTCHAR 0x00000040 -#define WC_NO_BEST_FIT_CHARS 0x00000400 - -#define CT_CTYPE1 0x00000001 -#define CT_CTYPE2 0x00000002 -#define CT_CTYPE3 0x00000004 - -#define C1_UPPER 0x0001 -#define C1_LOWER 0x0002 -#define C1_DIGIT 0x0004 -#define C1_SPACE 0x0008 -#define C1_PUNCT 0x0010 -#define C1_CNTRL 0x0020 -#define C1_BLANK 0x0040 -#define C1_XDIGIT 0x0080 -#define C1_ALPHA 0x0100 -#define C1_DEFINED 0x0200 - -#define C2_LEFTTORIGHT 0x0001 -#define C2_RIGHTTOLEFT 0x0002 - -#define C2_EUROPENUMBER 0x0003 -#define C2_EUROPESEPARATOR 0x0004 -#define C2_EUROPETERMINATOR 0x0005 -#define C2_ARABICNUMBER 0x0006 -#define C2_COMMONSEPARATOR 0x0007 - -#define C2_BLOCKSEPARATOR 0x0008 -#define C2_SEGMENTSEPARATOR 0x0009 -#define C2_WHITESPACE 0x000A -#define C2_OTHERNEUTRAL 0x000B - -#define C2_NOTAPPLICABLE 0x0000 - -#define C3_NONSPACING 0x0001 -#define C3_DIACRITIC 0x0002 -#define C3_VOWELMARK 0x0004 -#define C3_SYMBOL 0x0008 - -#define C3_KATAKANA 0x0010 -#define C3_HIRAGANA 0x0020 -#define C3_HALFWIDTH 0x0040 -#define C3_FULLWIDTH 0x0080 -#define C3_IDEOGRAPH 0x0100 -#define C3_KASHIDA 0x0200 -#define C3_LEXICAL 0x0400 - -#define C3_ALPHA 0x8000 - -#define C3_NOTAPPLICABLE 0x0000 - -#define NORM_IGNORECASE 0x00000001 -#define NORM_IGNORENONSPACE 0x00000002 -#define NORM_IGNORESYMBOLS 0x00000004 - -#define NORM_IGNOREKANATYPE 0x00010000 -#define NORM_IGNOREWIDTH 0x00020000 - -#define MAP_FOLDCZONE 0x00000010 -#define MAP_PRECOMPOSED 0x00000020 -#define MAP_COMPOSITE 0x00000040 -#define MAP_FOLDDIGITS 0x00000080 -#define MAP_EXPAND_LIGATURES 0x00002000 - -#define LCMAP_LOWERCASE 0x00000100 -#define LCMAP_UPPERCASE 0x00000200 -#define LCMAP_SORTKEY 0x00000400 -#define LCMAP_BYTEREV 0x00000800 - -#define LCMAP_HIRAGANA 0x00100000 -#define LCMAP_KATAKANA 0x00200000 -#define LCMAP_HALFWIDTH 0x00400000 -#define LCMAP_FULLWIDTH 0x00800000 - -#define LCMAP_LINGUISTIC_CASING 0x01000000 - -#define LCMAP_SIMPLIFIED_CHINESE 0x02000000 -#define LCMAP_TRADITIONAL_CHINESE 0x04000000 - -#define LGRPID_INSTALLED 0x00000001 -#define LGRPID_SUPPORTED 0x00000002 - -#define LCID_INSTALLED 0x00000001 -#define LCID_SUPPORTED 0x00000002 -#define LCID_ALTERNATE_SORTS 0x00000004 - -#define CP_INSTALLED 0x00000001 -#define CP_SUPPORTED 0x00000002 - -#define SORT_STRINGSORT 0x00001000 - -#define CSTR_LESS_THAN 1 -#define CSTR_EQUAL 2 -#define CSTR_GREATER_THAN 3 - -#define CP_ACP 0 -#define CP_OEMCP 1 -#define CP_MACCP 2 -#define CP_THREAD_ACP 3 -#define CP_SYMBOL 42 - -#define CP_UTF7 65000 -#define CP_UTF8 65001 - -#define CTRY_DEFAULT 0 - -#define CTRY_ALBANIA 355 -#define CTRY_ALGERIA 213 -#define CTRY_ARGENTINA 54 -#define CTRY_ARMENIA 374 -#define CTRY_AUSTRALIA 61 -#define CTRY_AUSTRIA 43 -#define CTRY_AZERBAIJAN 994 -#define CTRY_BAHRAIN 973 -#define CTRY_BELARUS 375 -#define CTRY_BELGIUM 32 -#define CTRY_BELIZE 501 -#define CTRY_BOLIVIA 591 -#define CTRY_BRAZIL 55 -#define CTRY_BRUNEI_DARUSSALAM 673 -#define CTRY_BULGARIA 359 -#define CTRY_CANADA 2 -#define CTRY_CARIBBEAN 1 -#define CTRY_CHILE 56 -#define CTRY_COLOMBIA 57 -#define CTRY_COSTA_RICA 506 -#define CTRY_CROATIA 385 -#define CTRY_CZECH 420 -#define CTRY_DENMARK 45 -#define CTRY_DOMINICAN_REPUBLIC 1 -#define CTRY_ECUADOR 593 -#define CTRY_EGYPT 20 -#define CTRY_EL_SALVADOR 503 -#define CTRY_ESTONIA 372 -#define CTRY_FAEROE_ISLANDS 298 -#define CTRY_FINLAND 358 -#define CTRY_FRANCE 33 -#define CTRY_GEORGIA 995 -#define CTRY_GERMANY 49 -#define CTRY_GREECE 30 -#define CTRY_GUATEMALA 502 -#define CTRY_HONDURAS 504 -#define CTRY_HONG_KONG 852 -#define CTRY_HUNGARY 36 -#define CTRY_ICELAND 354 -#define CTRY_INDIA 91 -#define CTRY_INDONESIA 62 -#define CTRY_IRAN 981 -#define CTRY_IRAQ 964 -#define CTRY_IRELAND 353 -#define CTRY_ISRAEL 972 -#define CTRY_ITALY 39 -#define CTRY_JAMAICA 1 -#define CTRY_JAPAN 81 -#define CTRY_JORDAN 962 -#define CTRY_KAZAKSTAN 7 -#define CTRY_KENYA 254 -#define CTRY_KUWAIT 965 -#define CTRY_KYRGYZSTAN 996 -#define CTRY_LATVIA 371 -#define CTRY_LEBANON 961 -#define CTRY_LIBYA 218 -#define CTRY_LIECHTENSTEIN 41 -#define CTRY_LITHUANIA 370 -#define CTRY_LUXEMBOURG 352 -#define CTRY_MACAU 853 -#define CTRY_MACEDONIA 389 -#define CTRY_MALAYSIA 60 -#define CTRY_MALDIVES 960 -#define CTRY_MEXICO 52 -#define CTRY_MONACO 33 -#define CTRY_MONGOLIA 976 -#define CTRY_MOROCCO 212 -#define CTRY_NETHERLANDS 31 -#define CTRY_NEW_ZEALAND 64 -#define CTRY_NICARAGUA 505 -#define CTRY_NORWAY 47 -#define CTRY_OMAN 968 -#define CTRY_PAKISTAN 92 -#define CTRY_PANAMA 507 -#define CTRY_PARAGUAY 595 -#define CTRY_PERU 51 -#define CTRY_PHILIPPINES 63 -#define CTRY_POLAND 48 -#define CTRY_PORTUGAL 351 -#define CTRY_PRCHINA 86 -#define CTRY_PUERTO_RICO 1 -#define CTRY_QATAR 974 -#define CTRY_ROMANIA 40 -#define CTRY_RUSSIA 7 -#define CTRY_SAUDI_ARABIA 966 -#define CTRY_SERBIA 381 -#define CTRY_SINGAPORE 65 -#define CTRY_SLOVAK 421 -#define CTRY_SLOVENIA 386 -#define CTRY_SOUTH_AFRICA 27 -#define CTRY_SOUTH_KOREA 82 -#define CTRY_SPAIN 34 -#define CTRY_SWEDEN 46 -#define CTRY_SWITZERLAND 41 -#define CTRY_SYRIA 963 -#define CTRY_TAIWAN 886 -#define CTRY_TATARSTAN 7 -#define CTRY_THAILAND 66 -#define CTRY_TRINIDAD_Y_TOBAGO 1 -#define CTRY_TUNISIA 216 -#define CTRY_TURKEY 90 -#define CTRY_UAE 971 -#define CTRY_UKRAINE 380 -#define CTRY_UNITED_KINGDOM 44 -#define CTRY_UNITED_STATES 1 -#define CTRY_URUGUAY 598 -#define CTRY_UZBEKISTAN 7 -#define CTRY_VENEZUELA 58 -#define CTRY_VIET_NAM 84 -#define CTRY_YEMEN 967 -#define CTRY_ZIMBABWE 263 - -#define LOCALE_NOUSEROVERRIDE 0x80000000 -#define LOCALE_USE_CP_ACP 0x40000000 -#define LOCALE_RETURN_NUMBER 0x20000000 - -#define LOCALE_ILANGUAGE 0x00000001 -#define LOCALE_SLANGUAGE 0x00000002 -#define LOCALE_SENGLANGUAGE 0x00001001 -#define LOCALE_SABBREVLANGNAME 0x00000003 -#define LOCALE_SNATIVELANGNAME 0x00000004 - -#define LOCALE_ICOUNTRY 0x00000005 -#define LOCALE_SCOUNTRY 0x00000006 -#define LOCALE_SENGCOUNTRY 0x00001002 -#define LOCALE_SABBREVCTRYNAME 0x00000007 -#define LOCALE_SNATIVECTRYNAME 0x00000008 - -#define LOCALE_IDEFAULTLANGUAGE 0x00000009 -#define LOCALE_IDEFAULTCOUNTRY 0x0000000A -#define LOCALE_IDEFAULTCODEPAGE 0x0000000B -#define LOCALE_IDEFAULTANSICODEPAGE 0x00001004 -#define LOCALE_IDEFAULTMACCODEPAGE 0x00001011 - -#define LOCALE_SLIST 0x0000000C -#define LOCALE_IMEASURE 0x0000000D - -#define LOCALE_SDECIMAL 0x0000000E -#define LOCALE_STHOUSAND 0x0000000F -#define LOCALE_SGROUPING 0x00000010 -#define LOCALE_IDIGITS 0x00000011 -#define LOCALE_ILZERO 0x00000012 -#define LOCALE_INEGNUMBER 0x00001010 -#define LOCALE_SNATIVEDIGITS 0x00000013 - -#define LOCALE_SCURRENCY 0x00000014 -#define LOCALE_SINTLSYMBOL 0x00000015 -#define LOCALE_SMONDECIMALSEP 0x00000016 -#define LOCALE_SMONTHOUSANDSEP 0x00000017 -#define LOCALE_SMONGROUPING 0x00000018 -#define LOCALE_ICURRDIGITS 0x00000019 -#define LOCALE_IINTLCURRDIGITS 0x0000001A -#define LOCALE_ICURRENCY 0x0000001B -#define LOCALE_INEGCURR 0x0000001C - -#define LOCALE_SDATE 0x0000001D -#define LOCALE_STIME 0x0000001E -#define LOCALE_SSHORTDATE 0x0000001F -#define LOCALE_SLONGDATE 0x00000020 -#define LOCALE_STIMEFORMAT 0x00001003 -#define LOCALE_IDATE 0x00000021 -#define LOCALE_ILDATE 0x00000022 -#define LOCALE_ITIME 0x00000023 -#define LOCALE_ITIMEMARKPOSN 0x00001005 -#define LOCALE_ICENTURY 0x00000024 -#define LOCALE_ITLZERO 0x00000025 -#define LOCALE_IDAYLZERO 0x00000026 -#define LOCALE_IMONLZERO 0x00000027 -#define LOCALE_S1159 0x00000028 -#define LOCALE_S2359 0x00000029 - -#define LOCALE_ICALENDARTYPE 0x00001009 -#define LOCALE_IOPTIONALCALENDAR 0x0000100B -#define LOCALE_IFIRSTDAYOFWEEK 0x0000100C -#define LOCALE_IFIRSTWEEKOFYEAR 0x0000100D - -#define LOCALE_SDAYNAME1 0x0000002A -#define LOCALE_SDAYNAME2 0x0000002B -#define LOCALE_SDAYNAME3 0x0000002C -#define LOCALE_SDAYNAME4 0x0000002D -#define LOCALE_SDAYNAME5 0x0000002E -#define LOCALE_SDAYNAME6 0x0000002F -#define LOCALE_SDAYNAME7 0x00000030 -#define LOCALE_SABBREVDAYNAME1 0x00000031 -#define LOCALE_SABBREVDAYNAME2 0x00000032 -#define LOCALE_SABBREVDAYNAME3 0x00000033 -#define LOCALE_SABBREVDAYNAME4 0x00000034 -#define LOCALE_SABBREVDAYNAME5 0x00000035 -#define LOCALE_SABBREVDAYNAME6 0x00000036 -#define LOCALE_SABBREVDAYNAME7 0x00000037 -#define LOCALE_SMONTHNAME1 0x00000038 -#define LOCALE_SMONTHNAME2 0x00000039 -#define LOCALE_SMONTHNAME3 0x0000003A -#define LOCALE_SMONTHNAME4 0x0000003B -#define LOCALE_SMONTHNAME5 0x0000003C -#define LOCALE_SMONTHNAME6 0x0000003D -#define LOCALE_SMONTHNAME7 0x0000003E -#define LOCALE_SMONTHNAME8 0x0000003F -#define LOCALE_SMONTHNAME9 0x00000040 -#define LOCALE_SMONTHNAME10 0x00000041 -#define LOCALE_SMONTHNAME11 0x00000042 -#define LOCALE_SMONTHNAME12 0x00000043 -#define LOCALE_SMONTHNAME13 0x0000100E -#define LOCALE_SABBREVMONTHNAME1 0x00000044 -#define LOCALE_SABBREVMONTHNAME2 0x00000045 -#define LOCALE_SABBREVMONTHNAME3 0x00000046 -#define LOCALE_SABBREVMONTHNAME4 0x00000047 -#define LOCALE_SABBREVMONTHNAME5 0x00000048 -#define LOCALE_SABBREVMONTHNAME6 0x00000049 -#define LOCALE_SABBREVMONTHNAME7 0x0000004A -#define LOCALE_SABBREVMONTHNAME8 0x0000004B -#define LOCALE_SABBREVMONTHNAME9 0x0000004C -#define LOCALE_SABBREVMONTHNAME10 0x0000004D -#define LOCALE_SABBREVMONTHNAME11 0x0000004E -#define LOCALE_SABBREVMONTHNAME12 0x0000004F -#define LOCALE_SABBREVMONTHNAME13 0x0000100F - -#define LOCALE_SPOSITIVESIGN 0x00000050 -#define LOCALE_SNEGATIVESIGN 0x00000051 -#define LOCALE_IPOSSIGNPOSN 0x00000052 -#define LOCALE_INEGSIGNPOSN 0x00000053 -#define LOCALE_IPOSSYMPRECEDES 0x00000054 -#define LOCALE_IPOSSEPBYSPACE 0x00000055 -#define LOCALE_INEGSYMPRECEDES 0x00000056 -#define LOCALE_INEGSEPBYSPACE 0x00000057 -#define LOCALE_FONTSIGNATURE 0x00000058 -#define LOCALE_SISO639LANGNAME 0x00000059 -#define LOCALE_SISO3166CTRYNAME 0x0000005A - -#define LOCALE_IDEFAULTEBCDICCODEPAGE 0x00001012 -#define LOCALE_IPAPERSIZE 0x0000100A -#define LOCALE_SENGCURRNAME 0x00001007 -#define LOCALE_SNATIVECURRNAME 0x00001008 -#define LOCALE_SYEARMONTH 0x00001006 -#define LOCALE_SSORTNAME 0x00001013 -#define LOCALE_IDIGITSUBSTITUTION 0x00001014 - -#define TIME_NOMINUTESORSECONDS 0x00000001 -#define TIME_NOSECONDS 0x00000002 -#define TIME_NOTIMEMARKER 0x00000004 -#define TIME_FORCE24HOURFORMAT 0x00000008 - -#define DATE_SHORTDATE 0x00000001 -#define DATE_LONGDATE 0x00000002 -#define DATE_USE_ALT_CALENDAR 0x00000004 -#define DATE_YEARMONTH 0x00000008 -#define DATE_LTRREADING 0x00000010 -#define DATE_RTLREADING 0x00000020 - -#define CAL_NOUSEROVERRIDE LOCALE_NOUSEROVERRIDE -#define CAL_USE_CP_ACP LOCALE_USE_CP_ACP -#define CAL_RETURN_NUMBER LOCALE_RETURN_NUMBER - -#define CAL_ICALINTVALUE 0x00000001 -#define CAL_SCALNAME 0x00000002 -#define CAL_IYEAROFFSETRANGE 0x00000003 -#define CAL_SERASTRING 0x00000004 -#define CAL_SSHORTDATE 0x00000005 -#define CAL_SLONGDATE 0x00000006 -#define CAL_SDAYNAME1 0x00000007 -#define CAL_SDAYNAME2 0x00000008 -#define CAL_SDAYNAME3 0x00000009 -#define CAL_SDAYNAME4 0x0000000a -#define CAL_SDAYNAME5 0x0000000b -#define CAL_SDAYNAME6 0x0000000c -#define CAL_SDAYNAME7 0x0000000d -#define CAL_SABBREVDAYNAME1 0x0000000e -#define CAL_SABBREVDAYNAME2 0x0000000f -#define CAL_SABBREVDAYNAME3 0x00000010 -#define CAL_SABBREVDAYNAME4 0x00000011 -#define CAL_SABBREVDAYNAME5 0x00000012 -#define CAL_SABBREVDAYNAME6 0x00000013 -#define CAL_SABBREVDAYNAME7 0x00000014 -#define CAL_SMONTHNAME1 0x00000015 -#define CAL_SMONTHNAME2 0x00000016 -#define CAL_SMONTHNAME3 0x00000017 -#define CAL_SMONTHNAME4 0x00000018 -#define CAL_SMONTHNAME5 0x00000019 -#define CAL_SMONTHNAME6 0x0000001a -#define CAL_SMONTHNAME7 0x0000001b -#define CAL_SMONTHNAME8 0x0000001c -#define CAL_SMONTHNAME9 0x0000001d -#define CAL_SMONTHNAME10 0x0000001e -#define CAL_SMONTHNAME11 0x0000001f -#define CAL_SMONTHNAME12 0x00000020 -#define CAL_SMONTHNAME13 0x00000021 -#define CAL_SABBREVMONTHNAME1 0x00000022 -#define CAL_SABBREVMONTHNAME2 0x00000023 -#define CAL_SABBREVMONTHNAME3 0x00000024 -#define CAL_SABBREVMONTHNAME4 0x00000025 -#define CAL_SABBREVMONTHNAME5 0x00000026 -#define CAL_SABBREVMONTHNAME6 0x00000027 -#define CAL_SABBREVMONTHNAME7 0x00000028 -#define CAL_SABBREVMONTHNAME8 0x00000029 -#define CAL_SABBREVMONTHNAME9 0x0000002a -#define CAL_SABBREVMONTHNAME10 0x0000002b -#define CAL_SABBREVMONTHNAME11 0x0000002c -#define CAL_SABBREVMONTHNAME12 0x0000002d -#define CAL_SABBREVMONTHNAME13 0x0000002e -#define CAL_SYEARMONTH 0x0000002f -#define CAL_ITWODIGITYEARMAX 0x00000030 - -#define ENUM_ALL_CALENDARS 0xffffffff - -#define CAL_GREGORIAN 1 -#define CAL_GREGORIAN_US 2 -#define CAL_JAPAN 3 -#define CAL_TAIWAN 4 -#define CAL_KOREA 5 -#define CAL_HIJRI 6 -#define CAL_THAI 7 -#define CAL_HEBREW 8 -#define CAL_GREGORIAN_ME_FRENCH 9 -#define CAL_GREGORIAN_ARABIC 10 -#define CAL_GREGORIAN_XLIT_ENGLISH 11 -#define CAL_GREGORIAN_XLIT_FRENCH 12 - -#define LGRPID_WESTERN_EUROPE 0x0001 -#define LGRPID_CENTRAL_EUROPE 0x0002 -#define LGRPID_BALTIC 0x0003 -#define LGRPID_GREEK 0x0004 -#define LGRPID_CYRILLIC 0x0005 -#define LGRPID_TURKISH 0x0006 -#define LGRPID_JAPANESE 0x0007 -#define LGRPID_KOREAN 0x0008 -#define LGRPID_TRADITIONAL_CHINESE 0x0009 -#define LGRPID_SIMPLIFIED_CHINESE 0x000a -#define LGRPID_THAI 0x000b -#define LGRPID_HEBREW 0x000c -#define LGRPID_ARABIC 0x000d -#define LGRPID_VIETNAMESE 0x000e -#define LGRPID_INDIC 0x000f -#define LGRPID_GEORGIAN 0x0010 -#define LGRPID_ARMENIAN 0x0011 - - typedef DWORD LGRPID; - typedef DWORD LCTYPE; - typedef DWORD CALTYPE; - typedef DWORD CALID; - - typedef struct _cpinfo { - UINT MaxCharSize; - BYTE DefaultChar[MAX_DEFAULTCHAR]; - BYTE LeadByte[MAX_LEADBYTES]; - } CPINFO,*LPCPINFO; - - typedef struct _cpinfoexA { - UINT MaxCharSize; - BYTE DefaultChar[MAX_DEFAULTCHAR]; - BYTE LeadByte[MAX_LEADBYTES]; - WCHAR UnicodeDefaultChar; - UINT CodePage; - CHAR CodePageName[MAX_PATH]; - } CPINFOEXA,*LPCPINFOEXA; - - typedef struct _cpinfoexW { - UINT MaxCharSize; - BYTE DefaultChar[MAX_DEFAULTCHAR]; - BYTE LeadByte[MAX_LEADBYTES]; - WCHAR UnicodeDefaultChar; - UINT CodePage; - WCHAR CodePageName[MAX_PATH]; - } CPINFOEXW,*LPCPINFOEXW; - -#ifdef UNICODE - typedef CPINFOEXW CPINFOEX; - typedef LPCPINFOEXW LPCPINFOEX; -#else - typedef CPINFOEXA CPINFOEX; - typedef LPCPINFOEXA LPCPINFOEX; -#endif - - typedef struct _numberfmtA { - UINT NumDigits; - UINT LeadingZero; - UINT Grouping; - LPSTR lpDecimalSep; - LPSTR lpThousandSep; - UINT NegativeOrder; - } NUMBERFMTA,*LPNUMBERFMTA; - - typedef struct _numberfmtW { - UINT NumDigits; - UINT LeadingZero; - UINT Grouping; - LPWSTR lpDecimalSep; - LPWSTR lpThousandSep; - UINT NegativeOrder; - } NUMBERFMTW,*LPNUMBERFMTW; - -#ifdef UNICODE - typedef NUMBERFMTW NUMBERFMT; - typedef LPNUMBERFMTW LPNUMBERFMT; -#else - typedef NUMBERFMTA NUMBERFMT; - typedef LPNUMBERFMTA LPNUMBERFMT; -#endif - - typedef struct _currencyfmtA { - UINT NumDigits; - UINT LeadingZero; - UINT Grouping; - LPSTR lpDecimalSep; - LPSTR lpThousandSep; - UINT NegativeOrder; - UINT PositiveOrder; - LPSTR lpCurrencySymbol; - } CURRENCYFMTA,*LPCURRENCYFMTA; - - typedef struct _currencyfmtW { - UINT NumDigits; - UINT LeadingZero; - UINT Grouping; - LPWSTR lpDecimalSep; - LPWSTR lpThousandSep; - UINT NegativeOrder; - UINT PositiveOrder; - LPWSTR lpCurrencySymbol; - } CURRENCYFMTW,*LPCURRENCYFMTW; - -#ifdef UNICODE - typedef CURRENCYFMTW CURRENCYFMT; - typedef LPCURRENCYFMTW LPCURRENCYFMT; -#else - typedef CURRENCYFMTA CURRENCYFMT; - typedef LPCURRENCYFMTA LPCURRENCYFMT; -#endif - - enum SYSNLS_FUNCTION { - COMPARE_STRING = 0x0001 - }; - - typedef DWORD NLS_FUNCTION; - - typedef struct _nlsversioninfo{ - DWORD dwNLSVersionInfoSize; - DWORD dwNLSVersion; - DWORD dwDefinedVersion; - } NLSVERSIONINFO,*LPNLSVERSIONINFO; - - typedef LONG GEOID; - typedef DWORD GEOTYPE; - typedef DWORD GEOCLASS; - -#define GEOID_NOT_AVAILABLE -1 - - enum SYSGEOTYPE { - GEO_NATION = 0x0001,GEO_LATITUDE = 0x0002,GEO_LONGITUDE = 0x0003,GEO_ISO2 = 0x0004,GEO_ISO3 = 0x0005,GEO_RFC1766 = 0x0006,GEO_LCID = 0x0007, - GEO_FRIENDLYNAME= 0x0008,GEO_OFFICIALNAME= 0x0009,GEO_TIMEZONES = 0x000A,GEO_OFFICIALLANGUAGES = 0x000B - }; - - enum SYSGEOCLASS { - GEOCLASS_NATION = 16,GEOCLASS_REGION = 14 - }; - - typedef enum _NORM_FORM { - NormalizationOther = 0, - NormalizationC = 0x1, - NormalizationD = 0x2, - NormalizationKC = 0x5, - NormalizationKD = 0x6 -} NORM_FORM; - - typedef WINBOOL (CALLBACK *LANGUAGEGROUP_ENUMPROCA)(LGRPID,LPSTR,LPSTR,DWORD,LONG_PTR); - typedef WINBOOL (CALLBACK *LANGGROUPLOCALE_ENUMPROCA)(LGRPID,LCID,LPSTR,LONG_PTR); - typedef WINBOOL (CALLBACK *UILANGUAGE_ENUMPROCA)(LPSTR,LONG_PTR); - typedef WINBOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR); - typedef WINBOOL (CALLBACK *CODEPAGE_ENUMPROCA)(LPSTR); - typedef WINBOOL (CALLBACK *DATEFMT_ENUMPROCA)(LPSTR); - typedef WINBOOL (CALLBACK *DATEFMT_ENUMPROCEXA)(LPSTR,CALID); - typedef WINBOOL (CALLBACK *TIMEFMT_ENUMPROCA)(LPSTR); - typedef WINBOOL (CALLBACK *CALINFO_ENUMPROCA)(LPSTR); - typedef WINBOOL (CALLBACK *CALINFO_ENUMPROCEXA)(LPSTR,CALID); - typedef WINBOOL (CALLBACK *LANGUAGEGROUP_ENUMPROCW)(LGRPID,LPWSTR,LPWSTR,DWORD,LONG_PTR); - typedef WINBOOL (CALLBACK *LANGGROUPLOCALE_ENUMPROCW)(LGRPID,LCID,LPWSTR,LONG_PTR); - typedef WINBOOL (CALLBACK *UILANGUAGE_ENUMPROCW)(LPWSTR,LONG_PTR); - typedef WINBOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR); - typedef WINBOOL (CALLBACK *CODEPAGE_ENUMPROCW)(LPWSTR); - typedef WINBOOL (CALLBACK *DATEFMT_ENUMPROCW)(LPWSTR); - typedef WINBOOL (CALLBACK *DATEFMT_ENUMPROCEXW)(LPWSTR,CALID); - typedef WINBOOL (CALLBACK *TIMEFMT_ENUMPROCW)(LPWSTR); - typedef WINBOOL (CALLBACK *CALINFO_ENUMPROCW)(LPWSTR); - typedef WINBOOL (CALLBACK *CALINFO_ENUMPROCEXW)(LPWSTR,CALID); - typedef WINBOOL (CALLBACK *GEO_ENUMPROC)(GEOID); - -#ifdef UNICODE -#define LANGUAGEGROUP_ENUMPROC LANGUAGEGROUP_ENUMPROCW -#define LANGGROUPLOCALE_ENUMPROC LANGGROUPLOCALE_ENUMPROCW -#define UILANGUAGE_ENUMPROC UILANGUAGE_ENUMPROCW -#define LOCALE_ENUMPROC LOCALE_ENUMPROCW -#define CODEPAGE_ENUMPROC CODEPAGE_ENUMPROCW -#define DATEFMT_ENUMPROC DATEFMT_ENUMPROCW -#define DATEFMT_ENUMPROCEX DATEFMT_ENUMPROCEXW -#define TIMEFMT_ENUMPROC TIMEFMT_ENUMPROCW -#define CALINFO_ENUMPROC CALINFO_ENUMPROCW -#define CALINFO_ENUMPROCEX CALINFO_ENUMPROCEXW -#else -#define LANGUAGEGROUP_ENUMPROC LANGUAGEGROUP_ENUMPROCA -#define LANGGROUPLOCALE_ENUMPROC LANGGROUPLOCALE_ENUMPROCA -#define UILANGUAGE_ENUMPROC UILANGUAGE_ENUMPROCA -#define LOCALE_ENUMPROC LOCALE_ENUMPROCA -#define CODEPAGE_ENUMPROC CODEPAGE_ENUMPROCA -#define DATEFMT_ENUMPROC DATEFMT_ENUMPROCA -#define DATEFMT_ENUMPROCEX DATEFMT_ENUMPROCEXA -#define TIMEFMT_ENUMPROC TIMEFMT_ENUMPROCA -#define CALINFO_ENUMPROC CALINFO_ENUMPROCA -#define CALINFO_ENUMPROCEX CALINFO_ENUMPROCEXA -#endif - -#ifdef UNICODE -#define GetCPInfoEx GetCPInfoExW -#define CompareString CompareStringW -#define LCMapString LCMapStringW -#define GetLocaleInfo GetLocaleInfoW -#define SetLocaleInfo SetLocaleInfoW -#define GetCalendarInfo GetCalendarInfoW -#define SetCalendarInfo SetCalendarInfoW -#define GetTimeFormat GetTimeFormatW -#define GetDateFormat GetDateFormatW -#define GetNumberFormat GetNumberFormatW -#define GetCurrencyFormat GetCurrencyFormatW -#define EnumCalendarInfo EnumCalendarInfoW -#define EnumCalendarInfoEx EnumCalendarInfoExW -#define EnumTimeFormats EnumTimeFormatsW -#define EnumDateFormats EnumDateFormatsW -#define EnumDateFormatsEx EnumDateFormatsExW -#define GetGeoInfo GetGeoInfoW -#define GetStringTypeEx GetStringTypeExW -#define FoldString FoldStringW -#define EnumSystemLanguageGroups EnumSystemLanguageGroupsW -#define EnumLanguageGroupLocales EnumLanguageGroupLocalesW -#define EnumUILanguages EnumUILanguagesW -#define EnumSystemLocales EnumSystemLocalesW -#define EnumSystemCodePages EnumSystemCodePagesW -#else -#define GetCPInfoEx GetCPInfoExA -#define CompareString CompareStringA -#define LCMapString LCMapStringA -#define GetLocaleInfo GetLocaleInfoA -#define SetLocaleInfo SetLocaleInfoA -#define GetCalendarInfo GetCalendarInfoA -#define SetCalendarInfo SetCalendarInfoA -#define GetTimeFormat GetTimeFormatA -#define GetDateFormat GetDateFormatA -#define GetNumberFormat GetNumberFormatA -#define GetCurrencyFormat GetCurrencyFormatA -#define EnumCalendarInfo EnumCalendarInfoA -#define EnumCalendarInfoEx EnumCalendarInfoExA -#define EnumTimeFormats EnumTimeFormatsA -#define EnumDateFormats EnumDateFormatsA -#define EnumDateFormatsEx EnumDateFormatsExA -#define GetGeoInfo GetGeoInfoA -#define GetStringTypeEx GetStringTypeExA -#define FoldString FoldStringA -#define EnumSystemLanguageGroups EnumSystemLanguageGroupsA -#define EnumLanguageGroupLocales EnumLanguageGroupLocalesA -#define EnumUILanguages EnumUILanguagesA -#define EnumSystemLocales EnumSystemLocalesA -#define EnumSystemCodePages EnumSystemCodePagesA -#endif - - WINBASEAPI WINBOOL WINAPI IsValidCodePage(UINT CodePage); - WINBASEAPI UINT WINAPI GetACP(void); - WINBASEAPI UINT WINAPI GetOEMCP(void); - WINBASEAPI WINBOOL WINAPI GetCPInfo(UINT CodePage,LPCPINFO lpCPInfo); - WINBASEAPI WINBOOL WINAPI GetCPInfoExA(UINT CodePage,DWORD dwFlags,LPCPINFOEXA lpCPInfoEx); - WINBASEAPI WINBOOL WINAPI GetCPInfoExW(UINT CodePage,DWORD dwFlags,LPCPINFOEXW lpCPInfoEx); - WINBASEAPI WINBOOL WINAPI IsDBCSLeadByte(BYTE TestChar); - WINBASEAPI WINBOOL WINAPI IsDBCSLeadByteEx(UINT CodePage,BYTE TestChar); - WINBASEAPI int WINAPI MultiByteToWideChar(UINT CodePage,DWORD dwFlags,LPCSTR lpMultiByteStr,int cbMultiByte,LPWSTR lpWideCharStr,int cchWideChar); - WINBASEAPI int WINAPI WideCharToMultiByte(UINT CodePage,DWORD dwFlags,LPCWSTR lpWideCharStr,int cchWideChar,LPSTR lpMultiByteStr,int cbMultiByte,LPCSTR lpDefaultChar,LPBOOL lpUsedDefaultChar); - WINBASEAPI int WINAPI CompareStringA(LCID Locale,DWORD dwCmpFlags,LPCSTR lpString1,int cchCount1,LPCSTR lpString2,int cchCount2); - WINBASEAPI int WINAPI CompareStringW(LCID Locale,DWORD dwCmpFlags,LPCWSTR lpString1,int cchCount1,LPCWSTR lpString2,int cchCount2); - WINBASEAPI int WINAPI LCMapStringA(LCID Locale,DWORD dwMapFlags,LPCSTR lpSrcStr,int cchSrc,LPSTR lpDestStr,int cchDest); - WINBASEAPI int WINAPI LCMapStringW(LCID Locale,DWORD dwMapFlags,LPCWSTR lpSrcStr,int cchSrc,LPWSTR lpDestStr,int cchDest); - WINBASEAPI int WINAPI GetLocaleInfoA(LCID Locale,LCTYPE LCType,LPSTR lpLCData,int cchData); - WINBASEAPI int WINAPI GetLocaleInfoW(LCID Locale,LCTYPE LCType,LPWSTR lpLCData,int cchData); - WINBASEAPI WINBOOL WINAPI SetLocaleInfoA(LCID Locale,LCTYPE LCType,LPCSTR lpLCData); - WINBASEAPI WINBOOL WINAPI SetLocaleInfoW(LCID Locale,LCTYPE LCType,LPCWSTR lpLCData); - WINBASEAPI int WINAPI GetCalendarInfoA(LCID Locale,CALID Calendar,CALTYPE CalType,LPSTR lpCalData,int cchData,LPDWORD lpValue); - WINBASEAPI int WINAPI GetCalendarInfoW(LCID Locale,CALID Calendar,CALTYPE CalType,LPWSTR lpCalData,int cchData,LPDWORD lpValue); - WINBASEAPI WINBOOL WINAPI SetCalendarInfoA(LCID Locale,CALID Calendar,CALTYPE CalType,LPCSTR lpCalData); - WINBASEAPI WINBOOL WINAPI SetCalendarInfoW(LCID Locale,CALID Calendar,CALTYPE CalType,LPCWSTR lpCalData); - WINBASEAPI int WINAPI GetTimeFormatA(LCID Locale,DWORD dwFlags,CONST SYSTEMTIME *lpTime,LPCSTR lpFormat,LPSTR lpTimeStr,int cchTime); - WINBASEAPI int WINAPI GetTimeFormatW(LCID Locale,DWORD dwFlags,CONST SYSTEMTIME *lpTime,LPCWSTR lpFormat,LPWSTR lpTimeStr,int cchTime); - WINBASEAPI int WINAPI GetDateFormatA(LCID Locale,DWORD dwFlags,CONST SYSTEMTIME *lpDate,LPCSTR lpFormat,LPSTR lpDateStr,int cchDate); - WINBASEAPI int WINAPI GetDateFormatW(LCID Locale,DWORD dwFlags,CONST SYSTEMTIME *lpDate,LPCWSTR lpFormat,LPWSTR lpDateStr,int cchDate); - WINBASEAPI int WINAPI GetNumberFormatA(LCID Locale,DWORD dwFlags,LPCSTR lpValue,CONST NUMBERFMTA *lpFormat,LPSTR lpNumberStr,int cchNumber); - WINBASEAPI int WINAPI GetNumberFormatW(LCID Locale,DWORD dwFlags,LPCWSTR lpValue,CONST NUMBERFMTW *lpFormat,LPWSTR lpNumberStr,int cchNumber); - WINBASEAPI int WINAPI GetCurrencyFormatA(LCID Locale,DWORD dwFlags,LPCSTR lpValue,CONST CURRENCYFMTA *lpFormat,LPSTR lpCurrencyStr,int cchCurrency); - WINBASEAPI int WINAPI GetCurrencyFormatW(LCID Locale,DWORD dwFlags,LPCWSTR lpValue,CONST CURRENCYFMTW *lpFormat,LPWSTR lpCurrencyStr,int cchCurrency); - WINBASEAPI WINBOOL WINAPI EnumCalendarInfoA(CALINFO_ENUMPROCA lpCalInfoEnumProc,LCID Locale,CALID Calendar,CALTYPE CalType); - WINBASEAPI WINBOOL WINAPI EnumCalendarInfoW(CALINFO_ENUMPROCW lpCalInfoEnumProc,LCID Locale,CALID Calendar,CALTYPE CalType); - WINBASEAPI WINBOOL WINAPI EnumCalendarInfoExA(CALINFO_ENUMPROCEXA lpCalInfoEnumProcEx,LCID Locale,CALID Calendar,CALTYPE CalType); - WINBASEAPI WINBOOL WINAPI EnumCalendarInfoExW(CALINFO_ENUMPROCEXW lpCalInfoEnumProcEx,LCID Locale,CALID Calendar,CALTYPE CalType); - WINBASEAPI WINBOOL WINAPI EnumTimeFormatsA(TIMEFMT_ENUMPROCA lpTimeFmtEnumProc,LCID Locale,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumTimeFormatsW(TIMEFMT_ENUMPROCW lpTimeFmtEnumProc,LCID Locale,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumDateFormatsA(DATEFMT_ENUMPROCA lpDateFmtEnumProc,LCID Locale,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumDateFormatsW(DATEFMT_ENUMPROCW lpDateFmtEnumProc,LCID Locale,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumDateFormatsExA(DATEFMT_ENUMPROCEXA lpDateFmtEnumProcEx,LCID Locale,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumDateFormatsExW(DATEFMT_ENUMPROCEXW lpDateFmtEnumProcEx,LCID Locale,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI IsValidLanguageGroup(LGRPID LanguageGroup,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI GetNLSVersion(NLS_FUNCTION Function,LCID Locale,LPNLSVERSIONINFO lpVersionInformation); - WINBASEAPI WINBOOL WINAPI IsNLSDefinedString(NLS_FUNCTION Function,DWORD dwFlags,LPNLSVERSIONINFO lpVersionInformation,LPCWSTR lpString,INT cchStr); - WINBASEAPI WINBOOL WINAPI IsValidLocale(LCID Locale,DWORD dwFlags); - WINBASEAPI int WINAPI GetGeoInfoA(GEOID Location,GEOTYPE GeoType,LPSTR lpGeoData,int cchData,LANGID LangId); - WINBASEAPI int WINAPI GetGeoInfoW(GEOID Location,GEOTYPE GeoType,LPWSTR lpGeoData,int cchData,LANGID LangId); - WINBASEAPI WINBOOL WINAPI EnumSystemGeoID(GEOCLASS GeoClass,GEOID ParentGeoId,GEO_ENUMPROC lpGeoEnumProc); - WINBASEAPI GEOID WINAPI GetUserGeoID(GEOCLASS GeoClass); - WINBASEAPI WINBOOL WINAPI SetUserGeoID(GEOID GeoId); - WINBASEAPI LCID WINAPI ConvertDefaultLocale(LCID Locale); - WINBASEAPI LCID WINAPI GetThreadLocale(void); - WINBASEAPI WINBOOL WINAPI SetThreadLocale(LCID Locale); - WINBASEAPI LANGID WINAPI GetSystemDefaultUILanguage(void); - WINBASEAPI LANGID WINAPI GetUserDefaultUILanguage(void); - WINBASEAPI LANGID WINAPI GetSystemDefaultLangID(void); - WINBASEAPI LANGID WINAPI GetUserDefaultLangID(void); - WINBASEAPI LCID WINAPI GetSystemDefaultLCID(void); - WINBASEAPI LCID WINAPI GetUserDefaultLCID(void); - WINBASEAPI WINBOOL WINAPI GetStringTypeExA(LCID Locale,DWORD dwInfoType,LPCSTR lpSrcStr,int cchSrc,LPWORD lpCharType); - WINBASEAPI WINBOOL WINAPI GetStringTypeExW(LCID Locale,DWORD dwInfoType,LPCWSTR lpSrcStr,int cchSrc,LPWORD lpCharType); - WINBASEAPI WINBOOL WINAPI GetStringTypeA(LCID Locale,DWORD dwInfoType,LPCSTR lpSrcStr,int cchSrc,LPWORD lpCharType); - WINBASEAPI WINBOOL WINAPI GetStringTypeW(DWORD dwInfoType,LPCWSTR lpSrcStr,int cchSrc,LPWORD lpCharType); - WINBASEAPI int WINAPI FoldStringA(DWORD dwMapFlags,LPCSTR lpSrcStr,int cchSrc,LPSTR lpDestStr,int cchDest); - WINBASEAPI int WINAPI FoldStringW(DWORD dwMapFlags,LPCWSTR lpSrcStr,int cchSrc,LPWSTR lpDestStr,int cchDest); - WINBASEAPI WINBOOL WINAPI EnumSystemLanguageGroupsA(LANGUAGEGROUP_ENUMPROCA lpLanguageGroupEnumProc,DWORD dwFlags,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumSystemLanguageGroupsW(LANGUAGEGROUP_ENUMPROCW lpLanguageGroupEnumProc,DWORD dwFlags,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumLanguageGroupLocalesA(LANGGROUPLOCALE_ENUMPROCA lpLangGroupLocaleEnumProc,LGRPID LanguageGroup,DWORD dwFlags,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumLanguageGroupLocalesW(LANGGROUPLOCALE_ENUMPROCW lpLangGroupLocaleEnumProc,LGRPID LanguageGroup,DWORD dwFlags,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumUILanguagesA(UILANGUAGE_ENUMPROCA lpUILanguageEnumProc,DWORD dwFlags,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumUILanguagesW(UILANGUAGE_ENUMPROCW lpUILanguageEnumProc,DWORD dwFlags,LONG_PTR lParam); - WINBASEAPI WINBOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA lpLocaleEnumProc,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpLocaleEnumProc,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumSystemCodePagesA(CODEPAGE_ENUMPROCA lpCodePageEnumProc,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI EnumSystemCodePagesW(CODEPAGE_ENUMPROCW lpCodePageEnumProc,DWORD dwFlags); - WINBASEAPI WINBOOL WINAPI IsNormalizedString(NORM_FORM NormForm,LPCWSTR lpString,int cwLength); - WINBASEAPI int WINAPI NormalizeString(NORM_FORM NormForm,LPCWSTR lpSrcString,int cwSrcLength,LPWSTR lpDstString,int cwDstLength); - WINBASEAPI int WINAPI IdnToAscii(DWORD dwFlags,LPCWSTR lpUnicodeCharStr,int cchUnicodeChar,LPWSTR lpASCIICharStr,int cchASCIIChar); - WINBASEAPI int WINAPI IdnToNameprepUnicode(DWORD dwFlags,LPCWSTR lpUnicodeCharStr,int cchUnicodeChar,LPWSTR lpNameprepCharStr,int cchNameprepChar); - WINBASEAPI int WINAPI IdnToUnicode(DWORD dwFlags,LPCWSTR lpASCIICharStr,int cchASCIIChar,LPWSTR lpUnicodeCharStr,int cchUnicodeChar); - -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/winnt.h b/win32/include/winapi/winnt.h deleted file mode 100644 index fb90d216..00000000 --- a/win32/include/winapi/winnt.h +++ /dev/null @@ -1,5837 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINNT_ -#define _WINNT_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#define ANYSIZE_ARRAY 1 - -//gr #include - -#define RESTRICTED_POINTER - -#ifndef __CRT_UNALIGNED -#define __CRT_UNALIGNED -#endif - -#if defined(__ia64__) || defined(__x86_64) -#define UNALIGNED __CRT_UNALIGNED -#ifdef _WIN64 -#define UNALIGNED64 __CRT_UNALIGNED -#else -#define UNALIGNED64 -#endif -#else -#define UNALIGNED -#define UNALIGNED64 -#endif - -#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && (defined(_X86_) && !defined(__x86_64)) -#define I_X86_ -#endif - -#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(__x86_64) -#define _AMD64_ -#endif - -#if !defined(I_X86_) && !(defined(_X86_) && !defined(__x86_64)) && !defined(_AMD64_) && defined(__ia64__) -#if !defined(_IA64_) -#define _IA64_ -#endif -#endif - - -#ifdef _WIN64 -#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) -#define MEMORY_ALLOCATION_ALIGNMENT 16 -#else -#define MAX_NATURAL_ALIGNMENT sizeof(DWORD) -#define MEMORY_ALLOCATION_ALIGNMENT 8 -#endif - -#ifdef __cplusplus -#define TYPE_ALIGNMENT(t) __alignof__ (t) -#else -#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; },test) -#endif - -#ifdef _WIN64 -#ifdef _AMD64_ -#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD) -#elif defined(_IA64_) -#define PROBE_ALIGNMENT(_s) (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD)) -#else -#error No Target Architecture -#endif -#define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD) -#else -#define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD) -#endif - -#define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1] - -#include - -#if defined(_X86_) || defined(__ia64__) || defined(__x86_64) -#define DECLSPEC_IMPORT __declspec(dllimport) -#else -#define DECLSPEC_IMPORT -#endif - -#ifndef DECLSPEC_NORETURN -#define DECLSPEC_NORETURN __declspec(noreturn) -#endif - -#ifndef DECLSPEC_ALIGN -#define DECLSPEC_ALIGN(x) __attribute__ ((aligned(x))) -#endif - -#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE -#if defined(_AMD64_) || defined(I_X86_) -#define SYSTEM_CACHE_ALIGNMENT_SIZE 64 -#else -#define SYSTEM_CACHE_ALIGNMENT_SIZE 128 -#endif -#endif - -#ifndef DECLSPEC_CACHEALIGN -#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE) -#endif - -#ifndef DECLSPEC_UUID -#define DECLSPEC_UUID(x) -#endif - -#ifndef DECLSPEC_NOVTABLE -#define DECLSPEC_NOVTABLE -#endif - -#ifndef DECLSPEC_SELECTANY -#define DECLSPEC_SELECTANY __declspec(selectany) -#endif - -#ifndef NOP_FUNCTION -#define NOP_FUNCTION (void)0 -#endif - -#ifndef DECLSPEC_NOINLINE -#define DECLSPEC_NOINLINE -#endif - -#ifndef FORCEINLINE -#define FORCEINLINE static __inline__ -#endif - -#ifndef DECLSPEC_DEPRECATED -#define DECLSPEC_DEPRECATED __declspec(deprecated) -#define DEPRECATE_SUPPORTED -#endif - -#define DECLSPEC_DEPRECATED_DDK -#define PRAGMA_DEPRECATED_DDK 0 - - typedef void *PVOID; - typedef void *PVOID64; - -#define NTAPI __stdcall -#define NTSYSAPI DECLSPEC_IMPORT -#define NTSYSCALLAPI DECLSPEC_IMPORT - -#ifndef VOID -#define VOID void - typedef char CHAR; - typedef short SHORT; - typedef long LONG; -#endif - - typedef wchar_t WCHAR; - typedef WCHAR *PWCHAR,*LPWCH,*PWCH; - typedef CONST WCHAR *LPCWCH,*PCWCH; - typedef WCHAR *NWPSTR,*LPWSTR,*PWSTR; - typedef PWSTR *PZPWSTR; - typedef CONST PWSTR *PCZPWSTR; - typedef WCHAR UNALIGNED *LPUWSTR,*PUWSTR; - typedef CONST WCHAR *LPCWSTR,*PCWSTR; - typedef PCWSTR *PZPCWSTR; - typedef CONST WCHAR UNALIGNED *LPCUWSTR,*PCUWSTR; - typedef CHAR *PCHAR,*LPCH,*PCH; - typedef CONST CHAR *LPCCH,*PCCH; - typedef CHAR *NPSTR,*LPSTR,*PSTR; - typedef PSTR *PZPSTR; - typedef CONST PSTR *PCZPSTR; - typedef CONST CHAR *LPCSTR,*PCSTR; - typedef PCSTR *PZPCSTR; - -#ifdef UNICODE -#ifndef _TCHAR_DEFINED -#define _TCHAR_DEFINED - typedef WCHAR TCHAR,*PTCHAR; - typedef WCHAR TBYTE ,*PTBYTE; -#endif - - typedef LPWSTR LPTCH,PTCH; - typedef LPWSTR PTSTR,LPTSTR; - typedef LPCWSTR PCTSTR,LPCTSTR; - typedef LPUWSTR PUTSTR,LPUTSTR; - typedef LPCUWSTR PCUTSTR,LPCUTSTR; - typedef LPWSTR LP; -#define __TEXT(quote) L##quote -#else -#ifndef _TCHAR_DEFINED -#define _TCHAR_DEFINED - typedef char TCHAR,*PTCHAR; - typedef unsigned char TBYTE ,*PTBYTE; -#endif - - typedef LPSTR LPTCH,PTCH; - typedef LPSTR PTSTR,LPTSTR,PUTSTR,LPUTSTR; - typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR; -#define __TEXT(quote) quote -#endif - -#define TEXT(quote) __TEXT(quote) - - typedef SHORT *PSHORT; - typedef LONG *PLONG; - - typedef void *HANDLE; -#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name - typedef HANDLE *PHANDLE; - - typedef BYTE FCHAR; - typedef WORD FSHORT; - typedef DWORD FLONG; - -#ifndef _HRESULT_DEFINED -#define _HRESULT_DEFINED - typedef LONG HRESULT; -#endif - -#ifdef __cplusplus -#define EXTERN_C extern "C" -#else -#define EXTERN_C extern -#endif - -#define STDMETHODCALLTYPE WINAPI -#define STDMETHODVCALLTYPE __cdecl -#define STDAPICALLTYPE WINAPI -#define STDAPIVCALLTYPE __cdecl -#define STDAPI EXTERN_C HRESULT WINAPI -#define STDAPI_(type) EXTERN_C type WINAPI -#define STDMETHODIMP HRESULT WINAPI -#define STDMETHODIMP_(type) type WINAPI -#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE -#define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE -#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE -#define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE - - typedef char CCHAR; -#ifndef _LCID_DEFINED -#define _LCID_DEFINED -typedef DWORD LCID; -#endif - typedef PDWORD PLCID; -#ifndef _LANGID_DEFINED -#define _LANGID_DEFINED - typedef WORD LANGID; -#endif -#define APPLICATION_ERROR_MASK 0x20000000 -#define ERROR_SEVERITY_SUCCESS 0x00000000 -#define ERROR_SEVERITY_INFORMATIONAL 0x40000000 -#define ERROR_SEVERITY_WARNING 0x80000000 -#define ERROR_SEVERITY_ERROR 0xC0000000 - -#ifdef __ia64__ - __declspec(align(16)) -#endif - typedef struct _FLOAT128 { - __int64 LowPart; - __int64 HighPart; - } FLOAT128; - - typedef FLOAT128 *PFLOAT128; - -#define _ULONGLONG_ -#if((!(defined(_X86_) && !defined(__x86_64)) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))) - typedef __int64 LONGLONG; - typedef unsigned __int64 ULONGLONG; - -#define MAXLONGLONG (0x7fffffffffffffff) -#else - - typedef double LONGLONG; - typedef double ULONGLONG; -#endif - - typedef LONGLONG *PLONGLONG; - typedef ULONGLONG *PULONGLONG; - - typedef LONGLONG USN; - - typedef union _LARGE_INTEGER { - struct { - DWORD LowPart; - LONG HighPart; - }; - struct { - DWORD LowPart; - LONG HighPart; - } u; - LONGLONG QuadPart; - } LARGE_INTEGER; - - typedef LARGE_INTEGER *PLARGE_INTEGER; - - typedef union _ULARGE_INTEGER { - struct { - DWORD LowPart; - DWORD HighPart; - }; - struct { - DWORD LowPart; - DWORD HighPart; - } u; - ULONGLONG QuadPart; - } ULARGE_INTEGER; - - typedef ULARGE_INTEGER *PULARGE_INTEGER; - - typedef struct _LUID { - DWORD LowPart; - LONG HighPart; - } LUID,*PLUID; - -#define _DWORDLONG_ - typedef ULONGLONG DWORDLONG; - typedef DWORDLONG *PDWORDLONG; - -#ifdef RC_INVOKED -#define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b))) -#define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b))) -#define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b)) -#elif (defined(_X86_) && !defined(__x86_64)) -#define Int32x32To64(a,b) (LONGLONG)((LONGLONG)(LONG)(a) *(LONG)(b)) -#define UInt32x32To64(a,b) (ULONGLONG)((ULONGLONG)(DWORD)(a) *(DWORD)(b)) -#define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b)) -#elif defined(__ia64__) || defined(__x86_64) -#define Int32x32To64(a,b) ((LONGLONG)((LONG)(a)) *(LONGLONG)((LONG)(b))) -#define UInt32x32To64(a,b) ((ULONGLONG)((DWORD)(a)) *(ULONGLONG)((DWORD)(b))) -#define Int64ShrlMod32(a,b) ((ULONGLONG)(a) >> (b)) -#else -#error Must define a target architecture. -#endif - -#define Int64ShraMod32(a,b) ((LONGLONG)(a) >> (b)) -#define Int64ShllMod32(a,b) ((ULONGLONG)(a) << (b)) - -#ifdef __cplusplus - extern "C" { -#endif - -#ifdef __x86_64 - -#define RotateLeft8 _rotl8 -#define RotateLeft16 _rotl16 -#define RotateRight8 _rotr8 -#define RotateRight16 _rotr16 - - unsigned char __cdecl _rotl8(unsigned char Value,unsigned char Shift); - unsigned short __cdecl _rotl16(unsigned short Value,unsigned char Shift); - unsigned char __cdecl _rotr8(unsigned char Value,unsigned char Shift); - unsigned short __cdecl _rotr16(unsigned short Value,unsigned char Shift); -#endif - -#define RotateLeft32 _rotl -#define RotateLeft64 _rotl64 -#define RotateRight32 _rotr -#define RotateRight64 _rotr64 - - unsigned int __cdecl _rotl(unsigned int Value,int Shift); - unsigned __int64 __cdecl _rotl64(unsigned __int64 Value,int Shift); - unsigned int __cdecl _rotr(unsigned int Value,int Shift); - unsigned __int64 __cdecl _rotr64(unsigned __int64 Value,int Shift); -#ifdef __cplusplus - } -#endif - -#define ANSI_NULL ((CHAR)0) -#define UNICODE_NULL ((WCHAR)0) -#define UNICODE_STRING_MAX_BYTES ((WORD) 65534) -#define UNICODE_STRING_MAX_CHARS (32767) - -#ifndef _BOOLEAN_ -#define _BOOLEAN_ - typedef BYTE BOOLEAN; -#endif - typedef BOOLEAN *PBOOLEAN; - - typedef struct _LIST_ENTRY { - struct _LIST_ENTRY *Flink; - struct _LIST_ENTRY *Blink; - } LIST_ENTRY,*PLIST_ENTRY,*RESTRICTED_POINTER PRLIST_ENTRY; - - typedef struct _SINGLE_LIST_ENTRY { - struct _SINGLE_LIST_ENTRY *Next; - } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY; - - typedef struct LIST_ENTRY32 { - DWORD Flink; - DWORD Blink; - } LIST_ENTRY32; - typedef LIST_ENTRY32 *PLIST_ENTRY32; - - typedef struct LIST_ENTRY64 { - ULONGLONG Flink; - ULONGLONG Blink; - } LIST_ENTRY64; - typedef LIST_ENTRY64 *PLIST_ENTRY64; - -#include - -#ifndef __OBJECTID_DEFINED -#define __OBJECTID_DEFINED - typedef struct _OBJECTID { - GUID Lineage; - DWORD Uniquifier; - } OBJECTID; -#endif - -#define MINCHAR 0x80 -#define MAXCHAR 0x7f -#define MINSHORT 0x8000 -#define MAXSHORT 0x7fff -#define MINLONG 0x80000000 -#define MAXLONG 0x7fffffff -#define MAXBYTE 0xff -#define MAXWORD 0xffff -#define MAXDWORD 0xffffffff - -#define FIELD_OFFSET(type,field) ((LONG)(LONG_PTR)&(((type *)0)->field)) -#define RTL_FIELD_SIZE(type,field) (sizeof(((type *)0)->field)) -#define RTL_SIZEOF_THROUGH_FIELD(type,field) (FIELD_OFFSET(type,field) + RTL_FIELD_SIZE(type,field)) -#define RTL_CONTAINS_FIELD(Struct,Size,Field) ((((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size))) -#define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0])) -#define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A) - -#ifdef ENABLE_RTL_NUMBER_OF_V2 -#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A) -#else -#define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A) -#endif - -#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A) -#define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A) - -#define RTL_FIELD_TYPE(type,field) (((type*)0)->field) -#define RTL_NUMBER_OF_FIELD(type,field) (RTL_NUMBER_OF(RTL_FIELD_TYPE(type,field))) -#define RTL_PADDING_BETWEEN_FIELDS(T,F1,F2) ((FIELD_OFFSET(T,F2) > FIELD_OFFSET(T,F1)) ? (FIELD_OFFSET(T,F2) - FIELD_OFFSET(T,F1) - RTL_FIELD_SIZE(T,F1)) : (FIELD_OFFSET(T,F1) - FIELD_OFFSET(T,F2) - RTL_FIELD_SIZE(T,F2))) - -#ifdef __cplusplus -#define RTL_CONST_CAST(type) const_cast -#else -#define RTL_CONST_CAST(type) (type) -#endif - -#define RTL_BITS_OF(sizeOfArg) (sizeof(sizeOfArg) *8) -#define RTL_BITS_OF_FIELD(type,field) (RTL_BITS_OF(RTL_FIELD_TYPE(type,field))) -#define CONTAINING_RECORD(address,type,field) ((type *)((PCHAR)(address) - (ULONG_PTR)(&((type *)0)->field))) - -#define VER_SERVER_NT 0x80000000 -#define VER_WORKSTATION_NT 0x40000000 -#define VER_SUITE_SMALLBUSINESS 0x00000001 -#define VER_SUITE_ENTERPRISE 0x00000002 -#define VER_SUITE_BACKOFFICE 0x00000004 -#define VER_SUITE_COMMUNICATIONS 0x00000008 -#define VER_SUITE_TERMINAL 0x00000010 -#define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020 -#define VER_SUITE_EMBEDDEDNT 0x00000040 -#define VER_SUITE_DATACENTER 0x00000080 -#define VER_SUITE_SINGLEUSERTS 0x00000100 -#define VER_SUITE_PERSONAL 0x00000200 -#define VER_SUITE_BLADE 0x00000400 -#define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800 -#define VER_SUITE_SECURITY_APPLIANCE 0x00001000 -#define VER_SUITE_STORAGE_SERVER 0x00002000 -#define VER_SUITE_COMPUTE_SERVER 0x00004000 - -#define PRODUCT_UNDEFINED 0x0 - -#define PRODUCT_ULTIMATE 0x1 -#define PRODUCT_HOME_BASIC 0x2 -#define PRODUCT_HOME_PREMIUM 0x3 -#define PRODUCT_ENTERPRISE 0x4 -#define PRODUCT_HOME_BASIC_N 0x5 -#define PRODUCT_BUSINESS 0x6 -#define PRODUCT_STANDARD_SERVER 0x7 -#define PRODUCT_DATACENTER_SERVER 0x8 -#define PRODUCT_SMALLBUSINESS_SERVER 0x9 -#define PRODUCT_ENTERPRISE_SERVER 0xa -#define PRODUCT_STARTER 0xb -#define PRODUCT_DATACENTER_SERVER_CORE 0xc -#define PRODUCT_STANDARD_SERVER_CORE 0xd -#define PRODUCT_ENTERPRISE_SERVER_CORE 0xe -#define PRODUCT_ENTERPRISE_SERVER_IA64 0xf -#define PRODUCT_BUSINESS_N 0x10 -#define PRODUCT_WEB_SERVER 0x11 -#define PRODUCT_CLUSTER_SERVER 0x12 -#define PRODUCT_HOME_SERVER 0x13 -#define PRODUCT_STORAGE_EXPRESS_SERVER 0x14 -#define PRODUCT_STORAGE_STANDARD_SERVER 0x15 -#define PRODUCT_STORAGE_WORKGROUP_SERVER 0x16 -#define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x17 -#define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x18 -#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x19 - -#define PRODUCT_UNLICENSED 0xabcdabcd - -#define LANG_NEUTRAL 0x00 -#define LANG_INVARIANT 0x7f - -#define LANG_AFRIKAANS 0x36 -#define LANG_ALBANIAN 0x1c -#define LANG_ALSATIAN 0x84 -#define LANG_AMHARIC 0x5e -#define LANG_ARABIC 0x01 -#define LANG_ARMENIAN 0x2b -#define LANG_ASSAMESE 0x4d -#define LANG_AZERI 0x2c -#define LANG_BASHKIR 0x6d -#define LANG_BASQUE 0x2d -#define LANG_BELARUSIAN 0x23 -#define LANG_BENGALI 0x45 -#define LANG_BRETON 0x7e -#define LANG_BOSNIAN 0x1a -#define LANG_BOSNIAN_NEUTRAL 0x781a -#define LANG_BULGARIAN 0x02 -#define LANG_CATALAN 0x03 -#define LANG_CHINESE 0x04 -#define LANG_CHINESE_SIMPLIFIED 0x04 -#define LANG_CHINESE_TRADITIONAL 0x7c04 -#define LANG_CORSICAN 0x83 -#define LANG_CROATIAN 0x1a -#define LANG_CZECH 0x05 -#define LANG_DANISH 0x06 -#define LANG_DARI 0x8c -#define LANG_DIVEHI 0x65 -#define LANG_DUTCH 0x13 -#define LANG_ENGLISH 0x09 -#define LANG_ESTONIAN 0x25 -#define LANG_FAEROESE 0x38 -#define LANG_FARSI 0x29 -#define LANG_FILIPINO 0x64 -#define LANG_FINNISH 0x0b -#define LANG_FRENCH 0x0c -#define LANG_FRISIAN 0x62 -#define LANG_GALICIAN 0x56 -#define LANG_GEORGIAN 0x37 -#define LANG_GERMAN 0x07 -#define LANG_GREEK 0x08 -#define LANG_GREENLANDIC 0x6f -#define LANG_GUJARATI 0x47 -#define LANG_HAUSA 0x68 -#define LANG_HEBREW 0x0d -#define LANG_HINDI 0x39 -#define LANG_HUNGARIAN 0x0e -#define LANG_ICELANDIC 0x0f -#define LANG_IGBO 0x70 -#define LANG_INDONESIAN 0x21 -#define LANG_INUKTITUT 0x5d -#define LANG_IRISH 0x3c -#define LANG_ITALIAN 0x10 -#define LANG_JAPANESE 0x11 -#define LANG_KANNADA 0x4b -#define LANG_KASHMIRI 0x60 -#define LANG_KAZAK 0x3f -#define LANG_KHMER 0x53 -#define LANG_KICHE 0x86 -#define LANG_KINYARWANDA 0x87 -#define LANG_KONKANI 0x57 -#define LANG_KOREAN 0x12 -#define LANG_KYRGYZ 0x40 -#define LANG_LAO 0x54 -#define LANG_LATVIAN 0x26 -#define LANG_LITHUANIAN 0x27 -#define LANG_LOWER_SORBIAN 0x2e -#define LANG_LUXEMBOURGISH 0x6e -#define LANG_MACEDONIAN 0x2f -#define LANG_MALAY 0x3e -#define LANG_MALAYALAM 0x4c -#define LANG_MALTESE 0x3a -#define LANG_MANIPURI 0x58 -#define LANG_MAORI 0x81 -#define LANG_MAPUDUNGUN 0x7a -#define LANG_MARATHI 0x4e -#define LANG_MOHAWK 0x7c -#define LANG_MONGOLIAN 0x50 -#define LANG_NEPALI 0x61 -#define LANG_NORWEGIAN 0x14 -#define LANG_OCCITAN 0x82 -#define LANG_ORIYA 0x48 -#define LANG_PASHTO 0x63 -#define LANG_PERSIAN 0x29 -#define LANG_POLISH 0x15 -#define LANG_PORTUGUESE 0x16 -#define LANG_PUNJABI 0x46 -#define LANG_QUECHUA 0x6b -#define LANG_ROMANIAN 0x18 -#define LANG_RUSSIAN 0x19 -#define LANG_SAMI 0x3b -#define LANG_ROMANSH 0x17 -#define LANG_SANSKRIT 0x4f -#define LANG_SERBIAN 0x1a -#define LANG_SERBIAN_NEUTRAL 0x7c1a -#define LANG_SINDHI 0x59 -#define LANG_SINHALESE 0x5b -#define LANG_SLOVAK 0x1b -#define LANG_SLOVENIAN 0x24 -#define LANG_SOTHO 0x6c -#define LANG_SPANISH 0x0a -#define LANG_SWAHILI 0x41 -#define LANG_SWEDISH 0x1d -#define LANG_SYRIAC 0x5a -#define LANG_TAJIK 0x28 -#define LANG_TAMAZIGHT 0x5f -#define LANG_TAMIL 0x49 -#define LANG_TATAR 0x44 -#define LANG_TELUGU 0x4a -#define LANG_THAI 0x1e -#define LANG_TIBETAN 0x51 -#define LANG_TIGRIGNA 0x73 -#define LANG_TSWANA 0x32 -#define LANG_TURKISH 0x1f -#define LANG_TURKMEN 0x42 -#define LANG_UIGHUR 0x80 -#define LANG_UKRAINIAN 0x22 -#define LANG_UPPER_SORBIAN 0x2e -#define LANG_URDU 0x20 -#define LANG_UZBEK 0x43 -#define LANG_VIETNAMESE 0x2a -#define LANG_WELSH 0x52 -#define LANG_WOLOF 0x88 -#define LANG_XHOSA 0x34 -#define LANG_YAKUT 0x85 -#define LANG_YI 0x78 -#define LANG_YORUBA 0x6a -#define LANG_ZULU 0x35 - -#define SUBLANG_NEUTRAL 0x0 -#define SUBLANG_DEFAULT 0x1 -#define SUBLANG_SYS_DEFAULT 0x2 -#define SUBLANG_CUSTOM_DEFAULT 0x3 -#define SUBLANG_CUSTOM_UNSPECIFIED 0x4 -#define SUBLANG_UI_CUSTOM_DEFAULT 0x5 - -#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 -#define SUBLANG_ARABIC_IRAQ 0x02 -#define SUBLANG_ARABIC_EGYPT 0x03 -#define SUBLANG_ARABIC_LIBYA 0x04 -#define SUBLANG_ARABIC_ALGERIA 0x05 -#define SUBLANG_ARABIC_MOROCCO 0x06 -#define SUBLANG_ARABIC_TUNISIA 0x07 -#define SUBLANG_ARABIC_OMAN 0x08 -#define SUBLANG_ARABIC_YEMEN 0x09 -#define SUBLANG_ARABIC_SYRIA 0x0a -#define SUBLANG_ARABIC_JORDAN 0x0b -#define SUBLANG_ARABIC_LEBANON 0x0c -#define SUBLANG_ARABIC_KUWAIT 0x0d -#define SUBLANG_ARABIC_UAE 0x0e -#define SUBLANG_ARABIC_BAHRAIN 0x0f -#define SUBLANG_ARABIC_QATAR 0x10 -#define SUBLANG_AZERI_LATIN 0x01 -#define SUBLANG_AZERI_CYRILLIC 0x02 -#define SUBLANG_CHINESE_TRADITIONAL 0x01 -#define SUBLANG_CHINESE_SIMPLIFIED 0x02 -#define SUBLANG_CHINESE_HONGKONG 0x03 -#define SUBLANG_CHINESE_SINGAPORE 0x04 -#define SUBLANG_CHINESE_MACAU 0x05 -#define SUBLANG_DUTCH 0x01 -#define SUBLANG_DUTCH_BELGIAN 0x02 -#define SUBLANG_ENGLISH_US 0x01 -#define SUBLANG_ENGLISH_UK 0x02 -#define SUBLANG_ENGLISH_AUS 0x03 -#define SUBLANG_ENGLISH_CAN 0x04 -#define SUBLANG_ENGLISH_NZ 0x05 -#define SUBLANG_ENGLISH_EIRE 0x06 -#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 -#define SUBLANG_ENGLISH_JAMAICA 0x08 -#define SUBLANG_ENGLISH_CARIBBEAN 0x09 -#define SUBLANG_ENGLISH_BELIZE 0x0a -#define SUBLANG_ENGLISH_TRINIDAD 0x0b -#define SUBLANG_ENGLISH_ZIMBABWE 0x0c -#define SUBLANG_ENGLISH_PHILIPPINES 0x0d -#define SUBLANG_FRENCH 0x01 -#define SUBLANG_FRENCH_BELGIAN 0x02 -#define SUBLANG_FRENCH_CANADIAN 0x03 -#define SUBLANG_FRENCH_SWISS 0x04 -#define SUBLANG_FRENCH_LUXEMBOURG 0x05 -#define SUBLANG_FRENCH_MONACO 0x06 -#define SUBLANG_GERMAN 0x01 -#define SUBLANG_GERMAN_SWISS 0x02 -#define SUBLANG_GERMAN_AUSTRIAN 0x03 -#define SUBLANG_GERMAN_LUXEMBOURG 0x04 -#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 -#define SUBLANG_ITALIAN 0x01 -#define SUBLANG_ITALIAN_SWISS 0x02 -#define SUBLANG_KASHMIRI_SASIA 0x02 -#define SUBLANG_KASHMIRI_INDIA 0x02 -#define SUBLANG_KOREAN 0x01 -#define SUBLANG_LITHUANIAN 0x01 -#define SUBLANG_MALAY_MALAYSIA 0x01 -#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 -#define SUBLANG_NEPALI_INDIA 0x02 -#define SUBLANG_NORWEGIAN_BOKMAL 0x01 -#define SUBLANG_NORWEGIAN_NYNORSK 0x02 -#define SUBLANG_PORTUGUESE 0x02 -#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 -#define SUBLANG_SERBIAN_LATIN 0x02 -#define SUBLANG_SERBIAN_CYRILLIC 0x03 -#define SUBLANG_SPANISH 0x01 -#define SUBLANG_SPANISH_MEXICAN 0x02 -#define SUBLANG_SPANISH_MODERN 0x03 -#define SUBLANG_SPANISH_GUATEMALA 0x04 -#define SUBLANG_SPANISH_COSTA_RICA 0x05 -#define SUBLANG_SPANISH_PANAMA 0x06 -#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 -#define SUBLANG_SPANISH_VENEZUELA 0x08 -#define SUBLANG_SPANISH_COLOMBIA 0x09 -#define SUBLANG_SPANISH_PERU 0x0a -#define SUBLANG_SPANISH_ARGENTINA 0x0b -#define SUBLANG_SPANISH_ECUADOR 0x0c -#define SUBLANG_SPANISH_CHILE 0x0d -#define SUBLANG_SPANISH_URUGUAY 0x0e -#define SUBLANG_SPANISH_PARAGUAY 0x0f -#define SUBLANG_SPANISH_BOLIVIA 0x10 -#define SUBLANG_SPANISH_EL_SALVADOR 0x11 -#define SUBLANG_SPANISH_HONDURAS 0x12 -#define SUBLANG_SPANISH_NICARAGUA 0x13 -#define SUBLANG_SPANISH_PUERTO_RICO 0x14 -#define SUBLANG_SWEDISH 0x01 -#define SUBLANG_SWEDISH_FINLAND 0x02 -#define SUBLANG_URDU_PAKISTAN 0x01 -#define SUBLANG_URDU_INDIA 0x02 -#define SUBLANG_UZBEK_LATIN 0x01 -#define SUBLANG_UZBEK_CYRILLIC 0x02 - -#define SORT_DEFAULT 0x0 -#define SORT_INVARIANT_MATH 0x1 - -#define SORT_JAPANESE_XJIS 0x0 -#define SORT_JAPANESE_UNICODE 0x1 -#define SORT_JAPANESE_RADICALSTROKE 0x4 - -#define SORT_CHINESE_BIG5 0x0 -#define SORT_CHINESE_PRCP 0x0 -#define SORT_CHINESE_UNICODE 0x1 -#define SORT_CHINESE_PRC 0x2 -#define SORT_CHINESE_BOPOMOFO 0x3 - -#define SORT_KOREAN_KSC 0x0 -#define SORT_KOREAN_UNICODE 0x1 - -#define SORT_GERMAN_PHONE_BOOK 0x1 - -#define SORT_HUNGARIAN_DEFAULT 0x0 -#define SORT_HUNGARIAN_TECHNICAL 0x1 - -#define SORT_GEORGIAN_TRADITIONAL 0x0 -#define SORT_GEORGIAN_MODERN 0x1 - -#define MAKELANGID(p,s) ((((WORD)(s)) << 10) | (WORD)(p)) -#define PRIMARYLANGID(lgid) ((WORD)(lgid) & 0x3ff) -#define SUBLANGID(lgid) ((WORD)(lgid) >> 10) - -#define NLS_VALID_LOCALE_MASK 0x000fffff - -#define MAKELCID(lgid,srtid) ((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid))))) -#define MAKESORTLCID(lgid,srtid,ver) ((DWORD)((MAKELCID(lgid,srtid)) | (((DWORD)((WORD)(ver))) << 20))) -#define LANGIDFROMLCID(lcid) ((WORD)(lcid)) -#define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0xf)) -#define SORTVERSIONFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 20) & 0xf)) - -#define LOCALE_NAME_MAX_LENGTH 85 -#define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)) -#define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)) - -#define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT,SORT_DEFAULT)) -#define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT,SORT_DEFAULT)) - -#define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)) - -#define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT)) -#define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT)) -#define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT)) - -#define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT)) - -#define UNREFERENCED_PARAMETER(P) (P) -#define DBG_UNREFERENCED_PARAMETER(P) (P) -#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V) - -#define DEFAULT_UNREACHABLE - -#ifndef WIN32_NO_STATUS -#define STATUS_WAIT_0 ((DWORD)0x00000000L) -#define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080L) -#define STATUS_USER_APC ((DWORD)0x000000C0L) -#define STATUS_TIMEOUT ((DWORD)0x00000102L) -#define STATUS_PENDING ((DWORD)0x00000103L) -#define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001L) -#define DBG_CONTINUE ((DWORD)0x00010002L) -#define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005L) -#define DBG_TERMINATE_THREAD ((DWORD)0x40010003L) -#define DBG_TERMINATE_PROCESS ((DWORD)0x40010004L) -#define DBG_CONTROL_C ((DWORD)0x40010005L) -#define DBG_CONTROL_BREAK ((DWORD)0x40010008L) -#define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009L) -#define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001L) -#define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002L) -#define STATUS_BREAKPOINT ((DWORD)0x80000003L) -#define STATUS_SINGLE_STEP ((DWORD)0x80000004L) -#define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001L) -#define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005L) -#define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006L) -#define STATUS_INVALID_HANDLE ((DWORD)0xC0000008L) -#define STATUS_NO_MEMORY ((DWORD)0xC0000017L) -#define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001DL) -#define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025L) -#define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026L) -#define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008CL) -#define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008DL) -#define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008EL) -#define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008FL) -#define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090L) -#define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091L) -#define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092L) -#define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093L) -#define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094L) -#define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095L) -#define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096L) -#define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FDL) -#define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013AL) -#define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4L) -#define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5L) -#define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9L) -#define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000FL) -#define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010L) -#endif - -#define MAXIMUM_WAIT_OBJECTS 64 -#define MAXIMUM_SUSPEND_COUNT MAXCHAR - - typedef ULONG_PTR KSPIN_LOCK; - typedef KSPIN_LOCK *PKSPIN_LOCK; - -#ifdef _AMD64_ - -#if defined(__x86_64) && !defined(RC_INVOKED) - -#ifdef __cplusplus - extern "C" { -#endif - -#define BitTest _bittest -#define BitTestAndComplement _bittestandcomplement -#define BitTestAndSet _bittestandset -#define BitTestAndReset _bittestandreset -#define InterlockedBitTestAndSet _interlockedbittestandset -#define InterlockedBitTestAndReset _interlockedbittestandreset -#define BitTest64 _bittest64 -#define BitTestAndComplement64 _bittestandcomplement64 -#define BitTestAndSet64 _bittestandset64 -#define BitTestAndReset64 _bittestandreset64 -#define InterlockedBitTestAndSet64 _interlockedbittestandset64 -#define InterlockedBitTestAndReset64 _interlockedbittestandreset64 - - __CRT_INLINE BOOLEAN _bittest(LONG const *Base,LONG Offset) { - int old = 0; - __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _bittestandcomplement(LONG *Base,LONG Offset) { - int old = 0; - __asm__ __volatile__("btcl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) { - int old = 0; - __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Bit)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _bittestandset(LONG *Base,LONG Offset) { - int old = 0; - __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _bittestandreset(LONG *Base,LONG Offset) { - int old = 0; - __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _interlockedbittestandset(LONG *Base,LONG Offset) { - int old = 0; - __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _interlockedbittestandreset(LONG *Base,LONG Offset) { - int old = 0; - __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _bittest64(LONG64 const *Base,LONG64 Offset) { - int old = 0; - __asm__ __volatile__("btq %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _bittestandcomplement64(LONG64 *Base,LONG64 Offset) { - int old = 0; - __asm__ __volatile__("btcq %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _bittestandset64(LONG64 *Base,LONG64 Offset) { - int old = 0; - __asm__ __volatile__("btsq %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _bittestandreset64(LONG64 *Base,LONG64 Offset) { - int old = 0; - __asm__ __volatile__("btrq %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _interlockedbittestandset64(LONG64 *Base,LONG64 Offset) { - int old = 0; - __asm__ __volatile__("lock ; btsq %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } - __CRT_INLINE BOOLEAN _interlockedbittestandreset64(LONG64 *Base,LONG64 Offset) { - int old = 0; - __asm__ __volatile__("lock ; btrq %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long long *) Base)) - :"Ir" (Offset)); - return (BOOLEAN) (old!=0); - } -#define BitScanForward _BitScanForward -#define BitScanReverse _BitScanReverse -#define BitScanForward64 _BitScanForward64 -#define BitScanReverse64 _BitScanReverse64 - - __CRT_INLINE BOOLEAN _BitScanForward(DWORD *Index,DWORD Mask) { - __asm__ __volatile__("bsfl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index))); - return Mask!=0; - } - __CRT_INLINE BOOLEAN _BitScanReverse(DWORD *Index,DWORD Mask) { - __asm__ __volatile__("bsrl %1,%0" : "=r" (Mask),"=m" ((*(volatile long *)Index))); - return Mask!=0; - } - __CRT_INLINE BOOLEAN _BitScanForward64(DWORD *Index,DWORD64 Mask) { - __asm__ __volatile__("bsfq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index))); - return Mask!=0; - } - __CRT_INLINE BOOLEAN _BitScanReverse64(DWORD *Index,DWORD64 Mask) { - __asm__ __volatile__("bsrq %1,%0" : "=r" (Mask),"=m" ((*(volatile long long *)Index))); - return Mask!=0; - } - -#define InterlockedIncrement16 _InterlockedIncrement16 -#define InterlockedDecrement16 _InterlockedDecrement16 -#define InterlockedCompareExchange16 _InterlockedCompareExchange16 - -#define InterlockedAnd _InterlockedAnd -#define InterlockedOr _InterlockedOr -#define InterlockedXor _InterlockedXor -#define InterlockedIncrement _InterlockedIncrement -#define InterlockedIncrementAcquire InterlockedIncrement -#define InterlockedIncrementRelease InterlockedIncrement -#define InterlockedDecrement _InterlockedDecrement -#define InterlockedDecrementAcquire InterlockedDecrement -#define InterlockedDecrementRelease InterlockedDecrement -#define InterlockedAdd _InterlockedAdd -#define InterlockedExchange _InterlockedExchange -#define InterlockedExchangeAdd _InterlockedExchangeAdd -#define InterlockedCompareExchange _InterlockedCompareExchange -#define InterlockedCompareExchangeAcquire InterlockedCompareExchange -#define InterlockedCompareExchangeRelease InterlockedCompareExchange - -#define InterlockedAnd64 _InterlockedAnd64 -#define InterlockedAndAffinity InterlockedAnd64 -#define InterlockedOr64 _InterlockedOr64 -#define InterlockedOrAffinity InterlockedOr64 -#define InterlockedXor64 _InterlockedXor64 -#define InterlockedIncrement64 _InterlockedIncrement64 -#define InterlockedDecrement64 _InterlockedDecrement64 -#define InterlockedAdd64 _InterlockedAdd64 -#define InterlockedExchange64 _InterlockedExchange64 -#define InterlockedExchangeAcquire64 InterlockedExchange64 -#define InterlockedExchangeAdd64 _InterlockedExchangeAdd64 -#define InterlockedCompareExchange64 _InterlockedCompareExchange64 -#define InterlockedCompareExchangeAcquire64 InterlockedCompareExchange64 -#define InterlockedCompareExchangeRelease64 InterlockedCompareExchange64 - -#define InterlockedExchangePointer _InterlockedExchangePointer -#define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerAcquire _InterlockedCompareExchangePointer -#define InterlockedCompareExchangePointerRelease _InterlockedCompareExchangePointer - -#define InterlockedExchangeAddSizeT(a,b) InterlockedExchangeAdd64((LONG64 *)a,b) -#define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONG64 *)a) -#define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONG64 *)a) - - __CRT_INLINE SHORT InterlockedIncrement16(SHORT volatile *Addend) { - unsigned char c; - unsigned char s; - __asm__ __volatile__( - "lock ; addw $1,%0; sete %1 ; sets %2" - :"=m" (*Addend), "=qm" (c), "=qm" (s) - :"m" (*Addend) : "memory"); - return (c != 0 ? 0 : (s != 0 ? -1 : 1)); - } - __CRT_INLINE SHORT InterlockedDecrement16(SHORT volatile *Addend) { - unsigned char c; - unsigned char s; - __asm__ __volatile__( - "lock ; subw $1,%0; sete %1 ; sets %2" - :"=m" (*Addend), "=qm" (c), "=qm" (s) - :"m" (*Addend) : "memory"); - return (c != 0 ? 0 : (s != 0 ? -1 : 1)); - } - __CRT_INLINE SHORT InterlockedCompareExchange16(SHORT volatile *Destination,SHORT ExChange,SHORT Comperand) { - SHORT prev; - __asm__ __volatile__("lock ; cmpxchgw %w1,%2" - :"=a"(prev) - :"q"(ExChange), "m"(*Destination), "0"(Comperand) - : "memory"); - return prev; - } - __CRT_INLINE LONG InterlockedAnd(LONG volatile *Destination,LONG Value) { - __asm__ __volatile__("lock ; andl %0,%1" - : :"r"(Value),"m"(*Destination) - : "memory"); - return *Destination; - } - __CRT_INLINE LONG InterlockedOr(LONG volatile *Destination,LONG Value) { - __asm__ __volatile__("lock ; orl %0,%1" - : : "r"(Value),"m"(*Destination) : "memory"); - return *Destination; - } - __CRT_INLINE LONG InterlockedXor(LONG volatile *Destination,LONG Value) { - __asm__ __volatile__("lock ; xorl %0,%1" - : : "r"(Value),"m"(*Destination) : "memory"); - return *Destination; - } - // $$$$ - __CRT_INLINE LONG64 InterlockedAnd64(LONG64 volatile *Destination,LONG64 Value) { - __asm__ __volatile__("lock ; andq %0,%1" - : : "r"(Value),"m"(*Destination) : "memory"); - return *Destination; - } - __CRT_INLINE LONG64 InterlockedOr64(LONG64 volatile *Destination,LONG64 Value) { - __asm__ __volatile__("lock ; orq %0,%1" - : : "r"(Value),"m"(*Destination) : "memory"); - return *Destination; - } - __CRT_INLINE LONG64 InterlockedXor64(LONG64 volatile *Destination,LONG64 Value) { - __asm__ __volatile__("lock ; xorq %0,%1" - : : "r"(Value),"m"(*Destination) : "memory"); - return *Destination; - } - __CRT_INLINE LONG InterlockedIncrement(LONG volatile *Addend) { - unsigned char c; - unsigned char s; - __asm__ __volatile__( - "lock ; addl $1,%0; sete %1 ; sets %2" - :"=m" (*Addend), "=qm" (c), "=qm" (s) - :"m" (*Addend) : "memory"); - return (c != 0 ? 0 : (s != 0 ? -1 : 1)); - } - __CRT_INLINE LONG InterlockedDecrement(LONG volatile *Addend) { - unsigned char c; - unsigned char s; - __asm__ __volatile__( - "lock ; subl $1,%0; sete %1 ; sets %2" - :"=m" (*Addend), "=qm" (c), "=qm" (s) - :"m" (*Addend) : "memory"); - return (c != 0 ? 0 : (s != 0 ? -1 : 1)); - } - __CRT_INLINE LONG InterlockedExchange(LONG volatile *Target,LONG Value) { - __asm__ __volatile("lock ; xchgl %0,%1" - : "=r"(Value) - : "m"(*Target),"0"(Value) - : "memory"); - return Value; - } - LONG InterlockedExchangeAdd(LONG volatile *Addend,LONG Value); - -#ifndef _X86AMD64_ - __CRT_INLINE LONG InterlockedAdd(LONG volatile *Addend,LONG Value) { return InterlockedExchangeAdd(Addend,Value) + Value; } -#endif - __CRT_INLINE LONG InterlockedCompareExchange(LONG volatile *Destination,LONG ExChange,LONG Comperand) { - LONG prev; - __asm__ __volatile__("lock ; cmpxchgl %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); - return prev; - } - __CRT_INLINE LONG64 InterlockedIncrement64(LONG64 volatile *Addend) { - unsigned char c; - unsigned char s; - __asm__ __volatile__( - "lock ; addq $1,%0; sete %1 ; sets %2" - :"=m" (*Addend), "=qm" (c), "=qm" (s) - :"m" (*Addend) : "memory"); - return (c != 0 ? 0 : (s != 0 ? -1 : 1)); - } - __CRT_INLINE LONG64 InterlockedDecrement64(LONG64 volatile *Addend) { - unsigned char c; - unsigned char s; - __asm__ __volatile__( - "lock ; subq $1,%0; sete %1 ; sets %2" - :"=m" (*Addend), "=qm" (c), "=qm" (s) - :"m" (*Addend) : "memory"); - return (c != 0 ? 0 : (s != 0 ? -1 : 1)); - } - __CRT_INLINE LONG64 InterlockedExchange64(LONG64 volatile *Target,LONG64 Value) { - __asm__ __volatile("lock ; xchgq %0,%1" - : "=r"(Value) - : "m"(*Target),"0"(Value) - : "memory"); - return Value; - } - LONG64 InterlockedExchangeAdd64(LONG64 volatile *Addend,LONG64 Value); - -#ifndef _X86AMD64_ - __CRT_INLINE LONG64 InterlockedAdd64(LONG64 volatile *Addend,LONG64 Value) { return InterlockedExchangeAdd64(Addend,Value) + Value; } -#endif - - __CRT_INLINE LONG64 InterlockedCompareExchange64(LONG64 volatile *Destination,LONG64 ExChange,LONG64 Comperand) { - LONG64 prev; - __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); - return prev; - } - __CRT_INLINE PVOID InterlockedCompareExchangePointer(PVOID volatile *Destination,PVOID ExChange,PVOID Comperand) { - PVOID prev; - __asm__ __volatile__("lock ; cmpxchgq %1,%2" : "=a" (prev) : "q" (ExChange),"m" (*Destination), "0" (Comperand) : "memory"); - return prev; - } - __CRT_INLINE PVOID InterlockedExchangePointer(PVOID volatile *Target,PVOID Value) { - __asm__ __volatile("lock ; xchgq %0,%1" - : "=r"(Value) - : "m"(*Target),"0"(Value) - : "memory"); - return Value; - } - -#define CacheLineFlush(Address) _mm_clflush(Address) - - VOID _ReadWriteBarrier(VOID); - -#define FastFence __faststorefence -#define LoadFence _mm_lfence -#define MemoryFence _mm_mfence -#define StoreFence _mm_sfence - - VOID __faststorefence(VOID); - VOID _m_prefetchw(volatile CONST VOID *Source); - -//!__TINYC__: #include - -#define YieldProcessor _mm_pause -#define MemoryBarrier __faststorefence -#define PreFetchCacheLine(l,a) _mm_prefetch((CHAR CONST *) a,l) -#define PrefetchForWrite(p) _m_prefetchw(p) -#define ReadForWriteAccess(p) (_m_prefetchw(p),*(p)) - -#define PF_TEMPORAL_LEVEL_1 _MM_HINT_T0 -#define PF_TEMPORAL_LEVEL_2 _MM_HINT_T1 -#define PF_TEMPORAL_LEVEL_3 _MM_HINT_T2 -#define PF_NON_TEMPORAL_LEVEL_ALL _MM_HINT_NTA - -#define ReadMxCsr _mm_getcsr -#define WriteMxCsr _mm_setcsr - - VOID __int2c(VOID); - -#define DbgRaiseAssertionFailure() __int2c() -#define GetCallersEflags() __getcallerseflags() - - unsigned __int32 __getcallerseflags(VOID); - -#define GetSegmentLimit __segmentlimit - - DWORD __segmentlimit(DWORD Selector); - -#define ReadTimeStampCounter() __rdtsc() - - DWORD64 __rdtsc(VOID); - VOID __movsb(PBYTE Destination,BYTE const *Source,SIZE_T Count); - VOID __movsw(PWORD Destination,WORD const *Source,SIZE_T Count); - VOID __movsd(PDWORD Destination,DWORD const *Source,SIZE_T Count); - VOID __movsq(PDWORD64 Destination,DWORD64 const *Source,SIZE_T Count); - VOID __stosb(PBYTE Destination,BYTE Value,SIZE_T Count); - VOID __stosw(PWORD Destination,WORD Value,SIZE_T Count); - VOID __stosd(PDWORD Destination,DWORD Value,SIZE_T Count); - VOID __stosq(PDWORD64 Destination,DWORD64 Value,SIZE_T Count); - -#define MultiplyHigh __mulh -#define UnsignedMultiplyHigh __umulh - - LONGLONG MultiplyHigh(LONGLONG Multiplier,LONGLONG Multiplicand); - ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand); - -#define ShiftLeft128 __shiftleft128 -#define ShiftRight128 __shiftright128 - - DWORD64 ShiftLeft128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift); - DWORD64 ShiftRight128(DWORD64 LowPart,DWORD64 HighPart,BYTE Shift); - -#define Multiply128 _mul128 - - LONG64 Multiply128(LONG64 Multiplier,LONG64 Multiplicand,LONG64 *HighProduct); - -#define UnsignedMultiply128 _umul128 - - DWORD64 UnsignedMultiply128(DWORD64 Multiplier,DWORD64 Multiplicand,DWORD64 *HighProduct); - - __CRT_INLINE LONG64 MultiplyExtract128(LONG64 Multiplier,LONG64 Multiplicand,BYTE Shift) { - LONG64 extractedProduct; - LONG64 highProduct; - LONG64 lowProduct; - lowProduct = Multiply128(Multiplier,Multiplicand,&highProduct); - extractedProduct = (LONG64)ShiftRight128((LONG64)lowProduct,(LONG64)highProduct,Shift); - return extractedProduct; - } - - __CRT_INLINE DWORD64 UnsignedMultiplyExtract128(DWORD64 Multiplier,DWORD64 Multiplicand,BYTE Shift) { - DWORD64 extractedProduct; - DWORD64 highProduct; - DWORD64 lowProduct; - lowProduct = UnsignedMultiply128(Multiplier,Multiplicand,&highProduct); - extractedProduct = ShiftRight128(lowProduct,highProduct,Shift); - return extractedProduct; - } - - __CRT_INLINE BYTE __readgsbyte(DWORD Offset) { - BYTE ret; - __asm__ volatile ("movb %%gs:%1,%0" - : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - return ret; - } - __CRT_INLINE WORD __readgsword(DWORD Offset) { - WORD ret; - __asm__ volatile ("movw %%gs:%1,%0" - : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - return ret; - } - __CRT_INLINE DWORD __readgsdword(DWORD Offset) { - DWORD ret; - __asm__ volatile ("movl %%gs:%1,%0" - : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - return ret; - } - __CRT_INLINE DWORD64 __readgsqword(DWORD Offset) { - void *ret; - __asm__ volatile ("movq %%gs:%1,%0" - : "=r" (ret) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - return (DWORD64) ret; - } - __CRT_INLINE VOID __writegsbyte(DWORD Offset,BYTE Data) { - __asm__ volatile ("movb %0,%%gs:%1" - : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - } - __CRT_INLINE VOID __writegsword(DWORD Offset,WORD Data) { - __asm__ volatile ("movw %0,%%gs:%1" - : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - } - __CRT_INLINE VOID __writegsdword(DWORD Offset,DWORD Data) { - __asm__ volatile ("movl %0,%%gs:%1" - : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - } - __CRT_INLINE VOID __writegsqword(DWORD Offset,DWORD64 Data) { - __asm__ volatile ("movq %0,%%gs:%1" - : "=r" (Data) ,"=m" ((*(volatile long *) (DWORD64) Offset))); - } - -#ifdef __cplusplus - } -#endif -#endif - -#define EXCEPTION_READ_FAULT 0 -#define EXCEPTION_WRITE_FAULT 1 -#define EXCEPTION_EXECUTE_FAULT 8 - -#if !defined(RC_INVOKED) - -#define CONTEXT_AMD64 0x100000 - -#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L) -#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L) -#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L) -#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L) -#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L) - -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) -#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) - -#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 -#define CONTEXT_SERVICE_ACTIVE 0x10000000 -#define CONTEXT_EXCEPTION_REQUEST 0x40000000 -#define CONTEXT_EXCEPTION_REPORTING 0x80000000 -#endif - -#define INITIAL_MXCSR 0x1f80 -#define INITIAL_FPCSR 0x027f - - typedef struct DECLSPEC_ALIGN(16) _M128A { - ULONGLONG Low; - LONGLONG High; - } M128A,*PM128A; - - typedef struct _XMM_SAVE_AREA32 { - WORD ControlWord; - WORD StatusWord; - BYTE TagWord; - BYTE Reserved1; - WORD ErrorOpcode; - DWORD ErrorOffset; - WORD ErrorSelector; - WORD Reserved2; - DWORD DataOffset; - WORD DataSelector; - WORD Reserved3; - DWORD MxCsr; - DWORD MxCsr_Mask; - M128A FloatRegisters[8]; - M128A XmmRegisters[16]; - BYTE Reserved4[96]; - } XMM_SAVE_AREA32,*PXMM_SAVE_AREA32; - -#define LEGACY_SAVE_AREA_LENGTH sizeof(XMM_SAVE_AREA32) - - typedef struct DECLSPEC_ALIGN(16) _CONTEXT { - DWORD64 P1Home; - DWORD64 P2Home; - DWORD64 P3Home; - DWORD64 P4Home; - DWORD64 P5Home; - DWORD64 P6Home; - DWORD ContextFlags; - DWORD MxCsr; - WORD SegCs; - WORD SegDs; - WORD SegEs; - WORD SegFs; - WORD SegGs; - WORD SegSs; - DWORD EFlags; - DWORD64 Dr0; - DWORD64 Dr1; - DWORD64 Dr2; - DWORD64 Dr3; - DWORD64 Dr6; - DWORD64 Dr7; - DWORD64 Rax; - DWORD64 Rcx; - DWORD64 Rdx; - DWORD64 Rbx; - DWORD64 Rsp; - DWORD64 Rbp; - DWORD64 Rsi; - DWORD64 Rdi; - DWORD64 R8; - DWORD64 R9; - DWORD64 R10; - DWORD64 R11; - DWORD64 R12; - DWORD64 R13; - DWORD64 R14; - DWORD64 R15; - DWORD64 Rip; - union { - XMM_SAVE_AREA32 FltSave; - XMM_SAVE_AREA32 FloatSave; - struct { - M128A Header[2]; - M128A Legacy[8]; - M128A Xmm0; - M128A Xmm1; - M128A Xmm2; - M128A Xmm3; - M128A Xmm4; - M128A Xmm5; - M128A Xmm6; - M128A Xmm7; - M128A Xmm8; - M128A Xmm9; - M128A Xmm10; - M128A Xmm11; - M128A Xmm12; - M128A Xmm13; - M128A Xmm14; - M128A Xmm15; - }; - }; - M128A VectorRegister[26]; - DWORD64 VectorControl; - DWORD64 DebugControl; - DWORD64 LastBranchToRip; - DWORD64 LastBranchFromRip; - DWORD64 LastExceptionToRip; - DWORD64 LastExceptionFromRip; - } CONTEXT,*PCONTEXT; - -#define RUNTIME_FUNCTION_INDIRECT 0x1 - - typedef struct _RUNTIME_FUNCTION { - DWORD BeginAddress; - DWORD EndAddress; - DWORD UnwindData; - } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION; - - typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context); - typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions); - -#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback" - - NTSYSAPI VOID __cdecl RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord); - NTSYSAPI BOOLEAN __cdecl RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,DWORD64 BaseAddress); - NTSYSAPI BOOLEAN __cdecl RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll); - NTSYSAPI BOOLEAN __cdecl RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable); -#endif - -#ifdef I_X86_ -#if(defined(_X86_) && !defined(__x86_64)) && !defined(RC_INVOKED) -#ifdef __cplusplus - extern "C" { -#endif - - __CRT_INLINE BOOLEAN InterlockedBitTestAndSet(LONG *Base,LONG Bit) { - int old = 0; - __asm__ __volatile__("lock ; btsl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Bit)); - return (BOOLEAN) (old!=0); - } - - __CRT_INLINE BOOLEAN InterlockedBitTestAndReset(LONG *Base,LONG Bit) { - int old = 0; - __asm__ __volatile__("lock ; btrl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Bit)); - return (BOOLEAN) (old!=0); - } - - __CRT_INLINE BOOLEAN InterlockedBitTestAndComplement(LONG *Base,LONG Bit) { - int old = 0; - __asm__ __volatile__("lock ; btcl %2,%1\n\tsbbl %0,%0 " - :"=r" (old),"=m" ((*(volatile long *) Base)) - :"Ir" (Bit)); - return (BOOLEAN) (old!=0); - } - -#ifdef _PREFIX_ - BYTE __readfsbyte(DWORD Offset); - WORD __readfsword(DWORD Offset); - DWORD __readfsdword(DWORD Offset); - VOID __writefsbyte(DWORD Offset,BYTE Data); - VOID __writefsword(DWORD Offset,WORD Data); - VOID __writefsdword(DWORD Offset,DWORD Data); -#endif - -#ifdef __cplusplus - } -#endif -#endif - -#if(defined(_X86_) && !defined(__x86_64)) - __CRT_INLINE VOID MemoryBarrier(VOID) { - LONG Barrier; - __asm__ __volatile__("xchgl %%eax,%0 " - :"=r" (Barrier)); - } -#define YieldProcessor() __asm__ __volatile__("rep nop "); - -#define PreFetchCacheLine(l,a) -#define ReadForWriteAccess(p) (*(p)) - -#define PF_TEMPORAL_LEVEL_1 -#define PF_NON_TEMPORAL_LEVEL_ALL - - __CRT_INLINE VOID DbgRaiseAssertionFailure(void) { - __asm__ __volatile__("int $0x2c "); - } - PVOID GetCurrentFiber(void); - __CRT_INLINE PVOID GetCurrentFiber(void) - { - void *ret; - __asm__ volatile ("movl %%fs:0x10,%0" - : "=r" (ret)); - return ret; - } - PVOID GetFiberData(void); - __CRT_INLINE PVOID GetFiberData(void) - { - void *ret; - __asm__ volatile ("movl %%fs:0x10,%0\n" - "movl (%0),%0" - : "=r" (ret)); - return ret; - } -#endif - -#define EXCEPTION_READ_FAULT 0 -#define EXCEPTION_WRITE_FAULT 1 -#define EXCEPTION_EXECUTE_FAULT 8 - -#define SIZE_OF_80387_REGISTERS 80 - -#if !defined(RC_INVOKED) - -#define CONTEXT_i386 0x00010000 -#define CONTEXT_i486 0x00010000 - -#define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) -#define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) -#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) -#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) -#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) -#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x00000020L) - -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) - -#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS) -#endif - -#define MAXIMUM_SUPPORTED_EXTENSION 512 - - typedef struct _FLOATING_SAVE_AREA { - DWORD ControlWord; - DWORD StatusWord; - DWORD TagWord; - DWORD ErrorOffset; - DWORD ErrorSelector; - DWORD DataOffset; - DWORD DataSelector; - BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; - DWORD Cr0NpxState; - } FLOATING_SAVE_AREA; - - typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA; - - typedef struct _CONTEXT { - DWORD ContextFlags; - DWORD Dr0; - DWORD Dr1; - DWORD Dr2; - DWORD Dr3; - DWORD Dr6; - DWORD Dr7; - FLOATING_SAVE_AREA FloatSave; - DWORD SegGs; - DWORD SegFs; - DWORD SegEs; - DWORD SegDs; - - DWORD Edi; - DWORD Esi; - DWORD Ebx; - DWORD Edx; - DWORD Ecx; - DWORD Eax; - DWORD Ebp; - DWORD Eip; - DWORD SegCs; - DWORD EFlags; - DWORD Esp; - DWORD SegSs; - BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; - } CONTEXT; - - typedef CONTEXT *PCONTEXT; -#endif - -#ifndef _LDT_ENTRY_DEFINED -#define _LDT_ENTRY_DEFINED - - typedef struct _LDT_ENTRY { - WORD LimitLow; - WORD BaseLow; - union { - struct { - BYTE BaseMid; - BYTE Flags1; - BYTE Flags2; - BYTE BaseHi; - } Bytes; - struct { - DWORD BaseMid : 8; - DWORD Type : 5; - DWORD Dpl : 2; - DWORD Pres : 1; - DWORD LimitHi : 4; - DWORD Sys : 1; - DWORD Reserved_0 : 1; - DWORD Default_Big : 1; - DWORD Granularity : 1; - DWORD BaseHi : 8; - } Bits; - } HighWord; - } LDT_ENTRY,*PLDT_ENTRY; -#endif - -#if defined(__ia64__) && !defined(RC_INVOKED) - -#ifdef __cplusplus - extern "C" { -#endif - - BOOLEAN BitScanForward64(DWORD *Index,DWORD64 Mask); - BOOLEAN BitScanReverse64(DWORD *Index,DWORD64 Mask); - -#ifdef __cplusplus - } -#endif -#endif - -#if !defined(GENUTIL) && !defined(_GENIA64_) && defined(_IA64_) - - void *_cdecl _rdteb(void); -#ifdef __ia64__ - -#define NtCurrentTeb() ((struct _TEB *)_rdteb()) -#define GetCurrentFiber() (((PNT_TIB)NtCurrentTeb())->FiberData) -#define GetFiberData() (*(PVOID *)(GetCurrentFiber())) - -#ifdef __cplusplus - extern "C" { -#endif - - void __break(int); - void __yield(void); - void __mf(void); - void __lfetch(int Level,VOID CONST *Address); - void __lfetchfault(int Level,VOID CONST *Address); - void __lfetch_excl(int Level,VOID CONST *Address); - void __lfetchfault_excl(int Level,VOID CONST *Address); - -#define MD_LFHINT_NONE 0x00 -#define MD_LFHINT_NT1 0x01 -#define MD_LFHINT_NT2 0x02 -#define MD_LFHINT_NTA 0x03 - -#ifdef __cplusplus - } -#endif - -#define YieldProcessor __yield -#define MemoryBarrier __mf -#define PreFetchCacheLine __lfetch -#define ReadForWriteAccess(p) (*(p)) -#define DbgRaiseAssertionFailure() __break(ASSERT_BREAKPOINT) - -#define PF_TEMPORAL_LEVEL_1 MD_LFHINT_NONE -#define PF_NON_TEMPORAL_LEVEL_ALL MD_LFHINT_NTA - -#define UnsignedMultiplyHigh __UMULH - - ULONGLONG UnsignedMultiplyHigh(ULONGLONG Multiplier,ULONGLONG Multiplicand); -#else - struct _TEB *NtCurrentTeb(void); -#endif -#endif - -#ifdef _IA64_ - -#define EXCEPTION_READ_FAULT 0 -#define EXCEPTION_WRITE_FAULT 1 -#define EXCEPTION_EXECUTE_FAULT 2 - -#if !defined(RC_INVOKED) - -#define CONTEXT_IA64 0x00080000 - -#define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001L) -#define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002L) -#define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004L) -#define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008L) -#define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010L) -#define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020L) - -#define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT) -#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL) -#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL) - -#define CONTEXT_EXCEPTION_ACTIVE 0x8000000 -#define CONTEXT_SERVICE_ACTIVE 0x10000000 -#define CONTEXT_EXCEPTION_REQUEST 0x40000000 -#define CONTEXT_EXCEPTION_REPORTING 0x80000000 -#endif - - typedef struct _CONTEXT { - DWORD ContextFlags; - DWORD Fill1[3]; - ULONGLONG DbI0; - ULONGLONG DbI1; - ULONGLONG DbI2; - ULONGLONG DbI3; - ULONGLONG DbI4; - ULONGLONG DbI5; - ULONGLONG DbI6; - ULONGLONG DbI7; - ULONGLONG DbD0; - ULONGLONG DbD1; - ULONGLONG DbD2; - ULONGLONG DbD3; - ULONGLONG DbD4; - ULONGLONG DbD5; - ULONGLONG DbD6; - ULONGLONG DbD7; - FLOAT128 FltS0; - FLOAT128 FltS1; - FLOAT128 FltS2; - FLOAT128 FltS3; - FLOAT128 FltT0; - FLOAT128 FltT1; - FLOAT128 FltT2; - FLOAT128 FltT3; - FLOAT128 FltT4; - FLOAT128 FltT5; - FLOAT128 FltT6; - FLOAT128 FltT7; - FLOAT128 FltT8; - FLOAT128 FltT9; - FLOAT128 FltS4; - FLOAT128 FltS5; - FLOAT128 FltS6; - FLOAT128 FltS7; - FLOAT128 FltS8; - FLOAT128 FltS9; - FLOAT128 FltS10; - FLOAT128 FltS11; - FLOAT128 FltS12; - FLOAT128 FltS13; - FLOAT128 FltS14; - FLOAT128 FltS15; - FLOAT128 FltS16; - FLOAT128 FltS17; - FLOAT128 FltS18; - FLOAT128 FltS19; - FLOAT128 FltF32; - FLOAT128 FltF33; - FLOAT128 FltF34; - FLOAT128 FltF35; - FLOAT128 FltF36; - FLOAT128 FltF37; - FLOAT128 FltF38; - FLOAT128 FltF39; - FLOAT128 FltF40; - FLOAT128 FltF41; - FLOAT128 FltF42; - FLOAT128 FltF43; - FLOAT128 FltF44; - FLOAT128 FltF45; - FLOAT128 FltF46; - FLOAT128 FltF47; - FLOAT128 FltF48; - FLOAT128 FltF49; - FLOAT128 FltF50; - FLOAT128 FltF51; - FLOAT128 FltF52; - FLOAT128 FltF53; - FLOAT128 FltF54; - FLOAT128 FltF55; - FLOAT128 FltF56; - FLOAT128 FltF57; - FLOAT128 FltF58; - FLOAT128 FltF59; - FLOAT128 FltF60; - FLOAT128 FltF61; - FLOAT128 FltF62; - FLOAT128 FltF63; - FLOAT128 FltF64; - FLOAT128 FltF65; - FLOAT128 FltF66; - FLOAT128 FltF67; - FLOAT128 FltF68; - FLOAT128 FltF69; - FLOAT128 FltF70; - FLOAT128 FltF71; - FLOAT128 FltF72; - FLOAT128 FltF73; - FLOAT128 FltF74; - FLOAT128 FltF75; - FLOAT128 FltF76; - FLOAT128 FltF77; - FLOAT128 FltF78; - FLOAT128 FltF79; - FLOAT128 FltF80; - FLOAT128 FltF81; - FLOAT128 FltF82; - FLOAT128 FltF83; - FLOAT128 FltF84; - FLOAT128 FltF85; - FLOAT128 FltF86; - FLOAT128 FltF87; - FLOAT128 FltF88; - FLOAT128 FltF89; - FLOAT128 FltF90; - FLOAT128 FltF91; - FLOAT128 FltF92; - FLOAT128 FltF93; - FLOAT128 FltF94; - FLOAT128 FltF95; - FLOAT128 FltF96; - FLOAT128 FltF97; - FLOAT128 FltF98; - FLOAT128 FltF99; - FLOAT128 FltF100; - FLOAT128 FltF101; - FLOAT128 FltF102; - FLOAT128 FltF103; - FLOAT128 FltF104; - FLOAT128 FltF105; - FLOAT128 FltF106; - FLOAT128 FltF107; - FLOAT128 FltF108; - FLOAT128 FltF109; - FLOAT128 FltF110; - FLOAT128 FltF111; - FLOAT128 FltF112; - FLOAT128 FltF113; - FLOAT128 FltF114; - FLOAT128 FltF115; - FLOAT128 FltF116; - FLOAT128 FltF117; - FLOAT128 FltF118; - FLOAT128 FltF119; - FLOAT128 FltF120; - FLOAT128 FltF121; - FLOAT128 FltF122; - FLOAT128 FltF123; - FLOAT128 FltF124; - FLOAT128 FltF125; - FLOAT128 FltF126; - FLOAT128 FltF127; - ULONGLONG StFPSR; - ULONGLONG IntGp; - ULONGLONG IntT0; - ULONGLONG IntT1; - ULONGLONG IntS0; - ULONGLONG IntS1; - ULONGLONG IntS2; - ULONGLONG IntS3; - ULONGLONG IntV0; - ULONGLONG IntT2; - ULONGLONG IntT3; - ULONGLONG IntT4; - ULONGLONG IntSp; - ULONGLONG IntTeb; - ULONGLONG IntT5; - ULONGLONG IntT6; - ULONGLONG IntT7; - ULONGLONG IntT8; - ULONGLONG IntT9; - ULONGLONG IntT10; - ULONGLONG IntT11; - ULONGLONG IntT12; - ULONGLONG IntT13; - ULONGLONG IntT14; - ULONGLONG IntT15; - ULONGLONG IntT16; - ULONGLONG IntT17; - ULONGLONG IntT18; - ULONGLONG IntT19; - ULONGLONG IntT20; - ULONGLONG IntT21; - ULONGLONG IntT22; - ULONGLONG IntNats; - ULONGLONG Preds; - ULONGLONG BrRp; - ULONGLONG BrS0; - ULONGLONG BrS1; - ULONGLONG BrS2; - ULONGLONG BrS3; - ULONGLONG BrS4; - ULONGLONG BrT0; - ULONGLONG BrT1; - ULONGLONG ApUNAT; - ULONGLONG ApLC; - ULONGLONG ApEC; - ULONGLONG ApCCV; - ULONGLONG ApDCR; - ULONGLONG RsPFS; - ULONGLONG RsBSP; - ULONGLONG RsBSPSTORE; - ULONGLONG RsRSC; - ULONGLONG RsRNAT; - ULONGLONG StIPSR; - ULONGLONG StIIP; - ULONGLONG StIFS; - ULONGLONG StFCR; - ULONGLONG Eflag; - ULONGLONG SegCSD; - ULONGLONG SegSSD; - ULONGLONG Cflag; - ULONGLONG StFSR; - ULONGLONG StFIR; - ULONGLONG StFDR; - ULONGLONG UNUSEDPACK; - } CONTEXT,*PCONTEXT; - - typedef struct _PLABEL_DESCRIPTOR { - ULONGLONG EntryPoint; - ULONGLONG GlobalPointer; - } PLABEL_DESCRIPTOR,*PPLABEL_DESCRIPTOR; - - typedef struct _RUNTIME_FUNCTION { - DWORD BeginAddress; - DWORD EndAddress; - DWORD UnwindInfoAddress; - } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION; - - typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context); - typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions); - -#define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback" - - BOOLEAN RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,DWORD EntryCount,ULONGLONG BaseAddress,ULONGLONG TargetGp); - BOOLEAN RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,DWORD64 BaseAddress,DWORD Length,DWORD64 TargetGp,PGET_RUNTIME_FUNCTION_CALLBACK Callback,PVOID Context,PCWSTR OutOfProcessCallbackDll); - BOOLEAN RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable); - VOID RtlRestoreContext (PCONTEXT ContextRecord,struct _EXCEPTION_RECORD *ExceptionRecord); - VOID __jump_unwind(ULONGLONG TargetMsFrame,ULONGLONG TargetBsFrame,ULONGLONG TargetPc); -#endif - -#define EXCEPTION_NONCONTINUABLE 0x1 -#define EXCEPTION_MAXIMUM_PARAMETERS 15 - - typedef struct _EXCEPTION_RECORD { - DWORD ExceptionCode; - DWORD ExceptionFlags; - struct _EXCEPTION_RECORD *ExceptionRecord; - PVOID ExceptionAddress; - DWORD NumberParameters; - ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; - } EXCEPTION_RECORD; - - typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; - - typedef struct _EXCEPTION_RECORD32 { - DWORD ExceptionCode; - DWORD ExceptionFlags; - DWORD ExceptionRecord; - DWORD ExceptionAddress; - DWORD NumberParameters; - DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; - } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32; - - typedef struct _EXCEPTION_RECORD64 { - DWORD ExceptionCode; - DWORD ExceptionFlags; - DWORD64 ExceptionRecord; - DWORD64 ExceptionAddress; - DWORD NumberParameters; - DWORD __unusedAlignment; - DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; - } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64; - - typedef struct _EXCEPTION_POINTERS { - PEXCEPTION_RECORD ExceptionRecord; - PCONTEXT ContextRecord; - } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS; - -#ifdef __x86_64 - - typedef EXCEPTION_DISPOSITION NTAPI EXCEPTION_ROUTINE (struct _EXCEPTION_RECORD *ExceptionRecord, PVOID EstablisherFrame, struct _CONTEXT *ContextRecord, PVOID DispatcherContext); -#ifndef __PEXCEPTION_ROUTINE_DEFINED -#define __PEXCEPTION_ROUTINE_DEFINED - typedef EXCEPTION_ROUTINE *PEXCEPTION_ROUTINE; -#endif - - /* http://msdn.microsoft.com/en-us/library/ms680597(VS.85).aspx */ - -#define UNWIND_HISTORY_TABLE_SIZE 12 - - typedef struct _UNWIND_HISTORY_TABLE_ENTRY { - ULONG64 ImageBase; - PRUNTIME_FUNCTION FunctionEntry; - } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY; - -#define UNWIND_HISTORY_TABLE_NONE 0 -#define UNWIND_HISTORY_TABLE_GLOBAL 1 -#define UNWIND_HISTORY_TABLE_LOCAL 2 - - typedef struct _UNWIND_HISTORY_TABLE { - ULONG Count; - UCHAR Search; - ULONG64 LowAddress; - ULONG64 HighAddress; - UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE]; - } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE; - - /* http://msdn.microsoft.com/en-us/library/b6sf5kbd(VS.80).aspx */ - - struct _DISPATCHER_CONTEXT; - typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT; - typedef struct _DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT; - - struct _DISPATCHER_CONTEXT { - ULONG64 ControlPc; - ULONG64 ImageBase; - PRUNTIME_FUNCTION FunctionEntry; - ULONG64 EstablisherFrame; - ULONG64 TargetIp; - PCONTEXT ContextRecord; - PEXCEPTION_ROUTINE LanguageHandler; - PVOID HandlerData; - /* http://www.nynaeve.net/?p=99 */ - PUNWIND_HISTORY_TABLE HistoryTable; - ULONG ScopeIndex; - ULONG Fill0; - }; - - /* http://msdn.microsoft.com/en-us/library/ms680617(VS.85).aspx */ - - typedef struct _KNONVOLATILE_CONTEXT_POINTERS - { - PM128A FloatingContext[16]; - PULONG64 IntegerContext[16]; - } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; -#endif /* defined(__x86_64) */ - - typedef PVOID PACCESS_TOKEN; - typedef PVOID PSECURITY_DESCRIPTOR; - typedef PVOID PSID; - - typedef DWORD ACCESS_MASK; - typedef ACCESS_MASK *PACCESS_MASK; - -#define DELETE (0x00010000L) -#define READ_CONTROL (0x00020000L) -#define WRITE_DAC (0x00040000L) -#define WRITE_OWNER (0x00080000L) -#define SYNCHRONIZE (0x00100000L) - -#define STANDARD_RIGHTS_REQUIRED (0x000F0000L) -#define STANDARD_RIGHTS_READ (READ_CONTROL) -#define STANDARD_RIGHTS_WRITE (READ_CONTROL) -#define STANDARD_RIGHTS_EXECUTE (READ_CONTROL) -#define STANDARD_RIGHTS_ALL (0x001F0000L) - -#define SPECIFIC_RIGHTS_ALL (0x0000FFFFL) - -#define ACCESS_SYSTEM_SECURITY (0x01000000L) - -#define MAXIMUM_ALLOWED (0x02000000L) - -#define GENERIC_READ (0x80000000L) -#define GENERIC_WRITE (0x40000000L) -#define GENERIC_EXECUTE (0x20000000L) -#define GENERIC_ALL (0x10000000L) - - typedef struct _GENERIC_MAPPING { - ACCESS_MASK GenericRead; - ACCESS_MASK GenericWrite; - ACCESS_MASK GenericExecute; - ACCESS_MASK GenericAll; - } GENERIC_MAPPING; - typedef GENERIC_MAPPING *PGENERIC_MAPPING; - -#include - - typedef struct _LUID_AND_ATTRIBUTES { - LUID Luid; - DWORD Attributes; - } LUID_AND_ATTRIBUTES,*PLUID_AND_ATTRIBUTES; - typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; - typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; - -#include - -#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED -#define SID_IDENTIFIER_AUTHORITY_DEFINED - typedef struct _SID_IDENTIFIER_AUTHORITY { - BYTE Value[6]; - } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY; -#endif - -#ifndef SID_DEFINED -#define SID_DEFINED - typedef struct _SID { - BYTE Revision; - BYTE SubAuthorityCount; - SID_IDENTIFIER_AUTHORITY IdentifierAuthority; - DWORD SubAuthority[ANYSIZE_ARRAY]; - } SID,*PISID; -#endif - -#define SID_REVISION (1) -#define SID_MAX_SUB_AUTHORITIES (15) -#define SID_RECOMMENDED_SUB_AUTHORITIES (1) - -#define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES *sizeof(DWORD))) - - typedef enum _SID_NAME_USE { - SidTypeUser = 1,SidTypeGroup,SidTypeDomain,SidTypeAlias,SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,SidTypeUnknown,SidTypeComputer - } SID_NAME_USE,*PSID_NAME_USE; - - typedef struct _SID_AND_ATTRIBUTES { - PSID Sid; - DWORD Attributes; - } SID_AND_ATTRIBUTES,*PSID_AND_ATTRIBUTES; - - typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; - typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; - -#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} -#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} -#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} -#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} -#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4} -#define SECURITY_RESOURCE_MANAGER_AUTHORITY {0,0,0,0,0,9} - -#define SECURITY_NULL_RID (0x00000000L) -#define SECURITY_WORLD_RID (0x00000000L) -#define SECURITY_LOCAL_RID (0x00000000L) - -#define SECURITY_CREATOR_OWNER_RID (0x00000000L) -#define SECURITY_CREATOR_GROUP_RID (0x00000001L) - -#define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L) -#define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L) - -#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} - -#define SECURITY_DIALUP_RID (0x00000001L) -#define SECURITY_NETWORK_RID (0x00000002L) -#define SECURITY_BATCH_RID (0x00000003L) -#define SECURITY_INTERACTIVE_RID (0x00000004L) -#define SECURITY_LOGON_IDS_RID (0x00000005L) -#define SECURITY_LOGON_IDS_RID_COUNT (3L) -#define SECURITY_SERVICE_RID (0x00000006L) -#define SECURITY_ANONYMOUS_LOGON_RID (0x00000007L) -#define SECURITY_PROXY_RID (0x00000008L) -#define SECURITY_ENTERPRISE_CONTROLLERS_RID (0x00000009L) -#define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID -#define SECURITY_PRINCIPAL_SELF_RID (0x0000000AL) -#define SECURITY_AUTHENTICATED_USER_RID (0x0000000BL) -#define SECURITY_RESTRICTED_CODE_RID (0x0000000CL) -#define SECURITY_TERMINAL_SERVER_RID (0x0000000DL) -#define SECURITY_REMOTE_LOGON_RID (0x0000000EL) -#define SECURITY_THIS_ORGANIZATION_RID (0x0000000FL) -#define SECURITY_IUSER_RID (0x00000011L) - -#define SECURITY_LOCAL_SYSTEM_RID (0x00000012L) -#define SECURITY_LOCAL_SERVICE_RID (0x00000013L) -#define SECURITY_NETWORK_SERVICE_RID (0x00000014L) - -#define SECURITY_NT_NON_UNIQUE (0x00000015L) -#define SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT (3L) - -#define SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID (0x00000016L) - -#define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L) -#define SECURITY_WRITE_RESTRICTED_CODE_RID (0x00000021L) - -#define SECURITY_PACKAGE_BASE_RID (0x00000040L) -#define SECURITY_PACKAGE_RID_COUNT (2L) -#define SECURITY_PACKAGE_NTLM_RID (0x0000000AL) -#define SECURITY_PACKAGE_SCHANNEL_RID (0x0000000EL) -#define SECURITY_PACKAGE_DIGEST_RID (0x00000015L) - -#define SECURITY_SERVICE_ID_BASE_RID (0x00000050L) -#define SECURITY_SERVICE_ID_RID_COUNT (6L) - -#define SECURITY_RESERVED_ID_BASE_RID (0x00000051L) - -#define SECURITY_MAX_ALWAYS_FILTERED (0x000003E7L) -#define SECURITY_MIN_NEVER_FILTERED (0x000003E8L) - -#define SECURITY_OTHER_ORGANIZATION_RID (0x000003E8L) - -#define FOREST_USER_RID_MAX (0x000001F3L) - -#define DOMAIN_USER_RID_ADMIN (0x000001F4L) -#define DOMAIN_USER_RID_GUEST (0x000001F5L) -#define DOMAIN_USER_RID_KRBTGT (0x000001F6L) - -#define DOMAIN_USER_RID_MAX (0x000003E7L) - -#define DOMAIN_GROUP_RID_ADMINS (0x00000200L) -#define DOMAIN_GROUP_RID_USERS (0x00000201L) -#define DOMAIN_GROUP_RID_GUESTS (0x00000202L) -#define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L) -#define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L) -#define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L) -#define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L) -#define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L) -#define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L) -#define DOMAIN_GROUP_RID_READONLY_CONTROLLERS (0x00000209L) - -#define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) -#define DOMAIN_ALIAS_RID_USERS (0x00000221L) -#define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) -#define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) - -#define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) -#define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) -#define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) -#define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) - -#define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) -#define DOMAIN_ALIAS_RID_RAS_SERVERS (0x00000229L) -#define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS (0x0000022AL) -#define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS (0x0000022BL) -#define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS (0x0000022CL) -#define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS (0x0000022DL) - -#define DOMAIN_ALIAS_RID_MONITORING_USERS (0x0000022EL) -#define DOMAIN_ALIAS_RID_LOGGING_USERS (0x0000022FL) -#define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS (0x00000230L) -#define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS (0x00000231L) -#define DOMAIN_ALIAS_RID_DCOM_USERS (0x00000232L) - -#define DOMAIN_ALIAS_RID_IUSERS (0x00000238L) -#define DOMAIN_ALIAS_RID_CRYPTO_OPERATORS (0x00000239L) -#define DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP (0x0000023BL) -#define DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP (0x0000023CL) -#define DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP (0x0000023DL) - -#define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16} -#define SECURITY_MANDATORY_UNTRUSTED_RID (0x00000000L) -#define SECURITY_MANDATORY_LOW_RID (0x00001000L) -#define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L) -#define SECURITY_MANDATORY_HIGH_RID (0x00003000L) -#define SECURITY_MANDATORY_SYSTEM_RID (0x00004000L) -#define SECURITY_MANDATORY_PROTECTED_PROCESS_RID (0x00005000L) - -#define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID - -#define MANDATORY_LEVEL_TO_MANDATORY_RID(IL) (IL * 0x1000) - - typedef enum { - WinNullSid = 0,WinWorldSid = 1,WinLocalSid = 2,WinCreatorOwnerSid = 3,WinCreatorGroupSid = 4,WinCreatorOwnerServerSid = 5,WinCreatorGroupServerSid = 6,WinNtAuthoritySid = 7,WinDialupSid = 8,WinNetworkSid = 9,WinBatchSid = 10,WinInteractiveSid = 11,WinServiceSid = 12,WinAnonymousSid = 13,WinProxySid = 14,WinEnterpriseControllersSid = 15,WinSelfSid = 16,WinAuthenticatedUserSid = 17,WinRestrictedCodeSid = 18,WinTerminalServerSid = 19,WinRemoteLogonIdSid = 20,WinLogonIdsSid = 21,WinLocalSystemSid = 22,WinLocalServiceSid = 23,WinNetworkServiceSid = 24,WinBuiltinDomainSid = 25,WinBuiltinAdministratorsSid = 26,WinBuiltinUsersSid = 27,WinBuiltinGuestsSid = 28,WinBuiltinPowerUsersSid = 29,WinBuiltinAccountOperatorsSid = 30,WinBuiltinSystemOperatorsSid = 31,WinBuiltinPrintOperatorsSid = 32,WinBuiltinBackupOperatorsSid = 33,WinBuiltinReplicatorSid = 34,WinBuiltinPreWindows2000CompatibleAccessSid = 35,WinBuiltinRemoteDesktopUsersSid = 36,WinBuiltinNetworkConfigurationOperatorsSid = 37,WinAccountAdministratorSid = 38,WinAccountGuestSid = 39,WinAccountKrbtgtSid = 40,WinAccountDomainAdminsSid = 41,WinAccountDomainUsersSid = 42,WinAccountDomainGuestsSid = 43,WinAccountComputersSid = 44,WinAccountControllersSid = 45,WinAccountCertAdminsSid = 46,WinAccountSchemaAdminsSid = 47,WinAccountEnterpriseAdminsSid = 48,WinAccountPolicyAdminsSid = 49,WinAccountRasAndIasServersSid = 50,WinNTLMAuthenticationSid = 51,WinDigestAuthenticationSid = 52,WinSChannelAuthenticationSid = 53,WinThisOrganizationSid = 54,WinOtherOrganizationSid = 55,WinBuiltinIncomingForestTrustBuildersSid = 56,WinBuiltinPerfMonitoringUsersSid = 57,WinBuiltinPerfLoggingUsersSid = 58,WinBuiltinAuthorizationAccessSid = 59,WinBuiltinTerminalServerLicenseServersSid = 60,WinBuiltinDCOMUsersSid = 61 - } WELL_KNOWN_SID_TYPE; - -#define SYSTEM_LUID { 0x3E7,0x0 } -#define ANONYMOUS_LOGON_LUID { 0x3e6,0x0 } -#define LOCALSERVICE_LUID { 0x3e5,0x0 } -#define NETWORKSERVICE_LUID { 0x3e4,0x0 } -#define IUSER_LUID { 0x3e3, 0x0 } - -#define SE_GROUP_MANDATORY (0x00000001L) -#define SE_GROUP_ENABLED_BY_DEFAULT (0x00000002L) -#define SE_GROUP_ENABLED (0x00000004L) -#define SE_GROUP_OWNER (0x00000008L) -#define SE_GROUP_USE_FOR_DENY_ONLY (0x00000010L) -#define SE_GROUP_INTEGRITY (0x00000020L) -#define SE_GROUP_INTEGRITY_ENABLED (0x00000040L) -#define SE_GROUP_LOGON_ID (0xC0000000L) -#define SE_GROUP_RESOURCE (0x20000000L) - -#define ACL_REVISION (2) -#define ACL_REVISION_DS (4) - -#define ACL_REVISION1 (1) -#define MIN_ACL_REVISION ACL_REVISION2 -#define ACL_REVISION2 (2) -#define ACL_REVISION3 (3) -#define ACL_REVISION4 (4) -#define MAX_ACL_REVISION ACL_REVISION4 - - typedef struct _ACL { - BYTE AclRevision; - BYTE Sbz1; - WORD AclSize; - WORD AceCount; - WORD Sbz2; - } ACL; - typedef ACL *PACL; - - typedef struct _ACE_HEADER { - BYTE AceType; - BYTE AceFlags; - WORD AceSize; - } ACE_HEADER; - typedef ACE_HEADER *PACE_HEADER; - -#define ACCESS_MIN_MS_ACE_TYPE (0x0) -#define ACCESS_ALLOWED_ACE_TYPE (0x0) -#define ACCESS_DENIED_ACE_TYPE (0x1) -#define SYSTEM_AUDIT_ACE_TYPE (0x2) -#define SYSTEM_ALARM_ACE_TYPE (0x3) -#define ACCESS_MAX_MS_V2_ACE_TYPE (0x3) - -#define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4) -#define ACCESS_MAX_MS_V3_ACE_TYPE (0x4) - -#define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5) -#define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5) -#define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6) -#define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7) -#define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8) -#define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8) - -#define ACCESS_MAX_MS_V4_ACE_TYPE (0x8) -#define ACCESS_MAX_MS_ACE_TYPE (0x8) - -#define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9) -#define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA) -#define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB) -#define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC) -#define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD) -#define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE) -#define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF) -#define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10) - -#define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11) -#define ACCESS_MAX_MS_V5_ACE_TYPE (0x11) - -#define OBJECT_INHERIT_ACE (0x1) -#define CONTAINER_INHERIT_ACE (0x2) -#define NO_PROPAGATE_INHERIT_ACE (0x4) -#define INHERIT_ONLY_ACE (0x8) -#define INHERITED_ACE (0x10) -#define VALID_INHERIT_FLAGS (0x1F) - -#define SUCCESSFUL_ACCESS_ACE_FLAG (0x40) -#define FAILED_ACCESS_ACE_FLAG (0x80) - - typedef struct _ACCESS_ALLOWED_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - } ACCESS_ALLOWED_ACE; - - typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE; - - typedef struct _ACCESS_DENIED_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - } ACCESS_DENIED_ACE; - typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE; - - typedef struct _SYSTEM_AUDIT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - } SYSTEM_AUDIT_ACE; - typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; - - typedef struct _SYSTEM_ALARM_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - } SYSTEM_ALARM_ACE; - typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE; - - typedef struct _ACCESS_ALLOWED_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE; - - typedef struct _ACCESS_DENIED_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE; - - typedef struct _SYSTEM_AUDIT_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE; - - typedef struct _SYSTEM_ALARM_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE; - - typedef struct _ACCESS_ALLOWED_CALLBACK_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - - } ACCESS_ALLOWED_CALLBACK_ACE,*PACCESS_ALLOWED_CALLBACK_ACE; - - typedef struct _ACCESS_DENIED_CALLBACK_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - - } ACCESS_DENIED_CALLBACK_ACE,*PACCESS_DENIED_CALLBACK_ACE; - - typedef struct _SYSTEM_AUDIT_CALLBACK_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - - } SYSTEM_AUDIT_CALLBACK_ACE,*PSYSTEM_AUDIT_CALLBACK_ACE; - - typedef struct _SYSTEM_ALARM_CALLBACK_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD SidStart; - - } SYSTEM_ALARM_CALLBACK_ACE,*PSYSTEM_ALARM_CALLBACK_ACE; - - typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - - } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE,*PACCESS_ALLOWED_CALLBACK_OBJECT_ACE; - - typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - - } ACCESS_DENIED_CALLBACK_OBJECT_ACE,*PACCESS_DENIED_CALLBACK_OBJECT_ACE; - - typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - - } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE,*PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE; - - typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE { - ACE_HEADER Header; - ACCESS_MASK Mask; - DWORD Flags; - GUID ObjectType; - GUID InheritedObjectType; - DWORD SidStart; - - } SYSTEM_ALARM_CALLBACK_OBJECT_ACE,*PSYSTEM_ALARM_CALLBACK_OBJECT_ACE; - -#define ACE_OBJECT_TYPE_PRESENT 0x1 -#define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2 - - typedef enum _ACL_INFORMATION_CLASS { - AclRevisionInformation = 1,AclSizeInformation - } ACL_INFORMATION_CLASS; - - typedef struct _ACL_REVISION_INFORMATION { - DWORD AclRevision; - } ACL_REVISION_INFORMATION; - typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION; - - typedef struct _ACL_SIZE_INFORMATION { - DWORD AceCount; - DWORD AclBytesInUse; - DWORD AclBytesFree; - } ACL_SIZE_INFORMATION; - typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION; - -#define SECURITY_DESCRIPTOR_REVISION (1) -#define SECURITY_DESCRIPTOR_REVISION1 (1) - -#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR)) - - typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL; - -#define SE_OWNER_DEFAULTED (0x0001) -#define SE_GROUP_DEFAULTED (0x0002) -#define SE_DACL_PRESENT (0x0004) -#define SE_DACL_DEFAULTED (0x0008) -#define SE_SACL_PRESENT (0x0010) -#define SE_SACL_DEFAULTED (0x0020) -#define SE_DACL_AUTO_INHERIT_REQ (0x0100) -#define SE_SACL_AUTO_INHERIT_REQ (0x0200) -#define SE_DACL_AUTO_INHERITED (0x0400) -#define SE_SACL_AUTO_INHERITED (0x0800) -#define SE_DACL_PROTECTED (0x1000) -#define SE_SACL_PROTECTED (0x2000) -#define SE_RM_CONTROL_VALID (0x4000) -#define SE_SELF_RELATIVE (0x8000) - - typedef struct _SECURITY_DESCRIPTOR_RELATIVE { - BYTE Revision; - BYTE Sbz1; - SECURITY_DESCRIPTOR_CONTROL Control; - DWORD Owner; - DWORD Group; - DWORD Sacl; - DWORD Dacl; - } SECURITY_DESCRIPTOR_RELATIVE,*PISECURITY_DESCRIPTOR_RELATIVE; - - typedef struct _SECURITY_DESCRIPTOR { - BYTE Revision; - BYTE Sbz1; - SECURITY_DESCRIPTOR_CONTROL Control; - PSID Owner; - PSID Group; - PACL Sacl; - PACL Dacl; - - } SECURITY_DESCRIPTOR,*PISECURITY_DESCRIPTOR; - - typedef struct _OBJECT_TYPE_LIST { - WORD Level; - WORD Sbz; - GUID *ObjectType; - } OBJECT_TYPE_LIST,*POBJECT_TYPE_LIST; - -#define ACCESS_OBJECT_GUID 0 -#define ACCESS_PROPERTY_SET_GUID 1 -#define ACCESS_PROPERTY_GUID 2 - -#define ACCESS_MAX_LEVEL 4 - - typedef enum _AUDIT_EVENT_TYPE { - AuditEventObjectAccess,AuditEventDirectoryServiceAccess - } AUDIT_EVENT_TYPE,*PAUDIT_EVENT_TYPE; - -#define AUDIT_ALLOW_NO_PRIVILEGE 0x1 - -#define ACCESS_DS_SOURCE_A "DS" -#define ACCESS_DS_SOURCE_W L"DS" -#define ACCESS_DS_OBJECT_TYPE_NAME_A "Directory Service Object" -#define ACCESS_DS_OBJECT_TYPE_NAME_W L"Directory Service Object" - -#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L) -#define SE_PRIVILEGE_ENABLED (0x00000002L) -#define SE_PRIVILEGE_REMOVED (0X00000004L) -#define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L) - -#define PRIVILEGE_SET_ALL_NECESSARY (1) - - typedef struct _PRIVILEGE_SET { - DWORD PrivilegeCount; - DWORD Control; - LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; - } PRIVILEGE_SET,*PPRIVILEGE_SET; - -#define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege") -#define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege") -#define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege") -#define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege") -#define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege") -#define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege") -#define SE_TCB_NAME TEXT("SeTcbPrivilege") -#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege") -#define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege") -#define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege") -#define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege") -#define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege") -#define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege") -#define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege") -#define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege") -#define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege") -#define SE_BACKUP_NAME TEXT("SeBackupPrivilege") -#define SE_RESTORE_NAME TEXT("SeRestorePrivilege") -#define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege") -#define SE_DEBUG_NAME TEXT("SeDebugPrivilege") -#define SE_AUDIT_NAME TEXT("SeAuditPrivilege") -#define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege") -#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege") -#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege") -#define SE_UNDOCK_NAME TEXT("SeUndockPrivilege") -#define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege") -#define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege") -#define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege") -#define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege") -#define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege") - - typedef enum _SECURITY_IMPERSONATION_LEVEL { - SecurityAnonymous,SecurityIdentification,SecurityImpersonation,SecurityDelegation - } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL; - -#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation -#define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous -#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation -#define VALID_IMPERSONATION_LEVEL(L) (((L) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((L) <= SECURITY_MAX_IMPERSONATION_LEVEL)) - -#define TOKEN_ASSIGN_PRIMARY (0x0001) -#define TOKEN_DUPLICATE (0x0002) -#define TOKEN_IMPERSONATE (0x0004) -#define TOKEN_QUERY (0x0008) -#define TOKEN_QUERY_SOURCE (0x0010) -#define TOKEN_ADJUST_PRIVILEGES (0x0020) -#define TOKEN_ADJUST_GROUPS (0x0040) -#define TOKEN_ADJUST_DEFAULT (0x0080) -#define TOKEN_ADJUST_SESSIONID (0x0100) - -#define TOKEN_ALL_ACCESS_P (STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT) -#define TOKEN_ALL_ACCESS (TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID) -#define TOKEN_READ (STANDARD_RIGHTS_READ | TOKEN_QUERY) - -#define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT) - -#define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE) - - typedef enum _TOKEN_TYPE { - TokenPrimary = 1,TokenImpersonation - } TOKEN_TYPE; - typedef TOKEN_TYPE *PTOKEN_TYPE; - - typedef enum _TOKEN_INFORMATION_CLASS { - TokenUser = 1,TokenGroups,TokenPrivileges,TokenOwner,TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,TokenImpersonationLevel, - TokenStatistics,TokenRestrictedSids,TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,TokenSandBoxInert,TokenAuditPolicy, - TokenOrigin,MaxTokenInfoClass - } TOKEN_INFORMATION_CLASS,*PTOKEN_INFORMATION_CLASS; - - typedef struct _TOKEN_USER { - SID_AND_ATTRIBUTES User; - } TOKEN_USER,*PTOKEN_USER; - - typedef struct _TOKEN_GROUPS { - DWORD GroupCount; - SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; - } TOKEN_GROUPS,*PTOKEN_GROUPS; - - typedef struct _TOKEN_PRIVILEGES { - DWORD PrivilegeCount; - LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; - } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES; - - typedef struct _TOKEN_OWNER { - PSID Owner; - } TOKEN_OWNER,*PTOKEN_OWNER; - - typedef struct _TOKEN_PRIMARY_GROUP { - PSID PrimaryGroup; - } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP; - - typedef struct _TOKEN_DEFAULT_DACL { - PACL DefaultDacl; - } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL; - - typedef struct _TOKEN_GROUPS_AND_PRIVILEGES { - DWORD SidCount; - DWORD SidLength; - PSID_AND_ATTRIBUTES Sids; - DWORD RestrictedSidCount; - DWORD RestrictedSidLength; - PSID_AND_ATTRIBUTES RestrictedSids; - DWORD PrivilegeCount; - DWORD PrivilegeLength; - PLUID_AND_ATTRIBUTES Privileges; - LUID AuthenticationId; - } TOKEN_GROUPS_AND_PRIVILEGES,*PTOKEN_GROUPS_AND_PRIVILEGES; - -#define TOKEN_AUDIT_SUCCESS_INCLUDE 0x1 -#define TOKEN_AUDIT_SUCCESS_EXCLUDE 0x2 -#define TOKEN_AUDIT_FAILURE_INCLUDE 0x4 -#define TOKEN_AUDIT_FAILURE_EXCLUDE 0x8 - -#define VALID_AUDIT_POLICY_BITS (TOKEN_AUDIT_SUCCESS_INCLUDE | TOKEN_AUDIT_SUCCESS_EXCLUDE | TOKEN_AUDIT_FAILURE_INCLUDE | TOKEN_AUDIT_FAILURE_EXCLUDE) -#define VALID_TOKEN_AUDIT_POLICY_ELEMENT(P) ((((P).PolicyMask & ~VALID_AUDIT_POLICY_BITS)==0) && ((P).Category <= AuditEventMaxType)) - - typedef struct _TOKEN_AUDIT_POLICY_ELEMENT { - DWORD Category; - DWORD PolicyMask; - } TOKEN_AUDIT_POLICY_ELEMENT,*PTOKEN_AUDIT_POLICY_ELEMENT; - - typedef struct _TOKEN_AUDIT_POLICY { - DWORD PolicyCount; - TOKEN_AUDIT_POLICY_ELEMENT Policy[ANYSIZE_ARRAY]; - } TOKEN_AUDIT_POLICY,*PTOKEN_AUDIT_POLICY; - -#define PER_USER_AUDITING_POLICY_SIZE(p) (sizeof(TOKEN_AUDIT_POLICY) + (((p)->PolicyCount > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((p)->PolicyCount - ANYSIZE_ARRAY)) : 0)) -#define PER_USER_AUDITING_POLICY_SIZE_BY_COUNT(C) (sizeof(TOKEN_AUDIT_POLICY) + (((C) > ANYSIZE_ARRAY) ? (sizeof(TOKEN_AUDIT_POLICY_ELEMENT) *((C) - ANYSIZE_ARRAY)) : 0)) - -#define TOKEN_SOURCE_LENGTH 8 - - typedef struct _TOKEN_SOURCE { - CHAR SourceName[TOKEN_SOURCE_LENGTH]; - LUID SourceIdentifier; - } TOKEN_SOURCE,*PTOKEN_SOURCE; - - typedef struct _TOKEN_STATISTICS { - LUID TokenId; - LUID AuthenticationId; - LARGE_INTEGER ExpirationTime; - TOKEN_TYPE TokenType; - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; - DWORD DynamicCharged; - DWORD DynamicAvailable; - DWORD GroupCount; - DWORD PrivilegeCount; - LUID ModifiedId; - } TOKEN_STATISTICS,*PTOKEN_STATISTICS; - - typedef struct _TOKEN_CONTROL { - LUID TokenId; - LUID AuthenticationId; - LUID ModifiedId; - TOKEN_SOURCE TokenSource; - } TOKEN_CONTROL,*PTOKEN_CONTROL; - - typedef struct _TOKEN_ORIGIN { - LUID OriginatingLogonSession; - } TOKEN_ORIGIN,*PTOKEN_ORIGIN; - -#define SECURITY_DYNAMIC_TRACKING (TRUE) -#define SECURITY_STATIC_TRACKING (FALSE) - - typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE; - - typedef struct _SECURITY_QUALITY_OF_SERVICE { - DWORD Length; - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; - SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; - BOOLEAN EffectiveOnly; - } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE; - - typedef struct _SE_IMPERSONATION_STATE { - PACCESS_TOKEN Token; - BOOLEAN CopyOnOpen; - BOOLEAN EffectiveOnly; - SECURITY_IMPERSONATION_LEVEL Level; - } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE; - -#define DISABLE_MAX_PRIVILEGE 0x1 -#define SANDBOX_INERT 0x2 - - typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION; - -#define OWNER_SECURITY_INFORMATION (0x00000001L) -#define GROUP_SECURITY_INFORMATION (0x00000002L) -#define DACL_SECURITY_INFORMATION (0x00000004L) -#define SACL_SECURITY_INFORMATION (0x00000008L) - -#define PROTECTED_DACL_SECURITY_INFORMATION (0x80000000L) -#define PROTECTED_SACL_SECURITY_INFORMATION (0x40000000L) -#define UNPROTECTED_DACL_SECURITY_INFORMATION (0x20000000L) -#define UNPROTECTED_SACL_SECURITY_INFORMATION (0x10000000L) - -#define PROCESS_TERMINATE (0x0001) -#define PROCESS_CREATE_THREAD (0x0002) -#define PROCESS_SET_SESSIONID (0x0004) -#define PROCESS_VM_OPERATION (0x0008) -#define PROCESS_VM_READ (0x0010) -#define PROCESS_VM_WRITE (0x0020) -#define PROCESS_DUP_HANDLE (0x0040) -#define PROCESS_CREATE_PROCESS (0x0080) -#define PROCESS_SET_QUOTA (0x0100) -#define PROCESS_SET_INFORMATION (0x0200) -#define PROCESS_QUERY_INFORMATION (0x0400) -#define PROCESS_SUSPEND_RESUME (0x0800) -#define PROCESS_QUERY_LIMITED_INFORMATION (0x1000) -#define PROCESS_SET_LIMITED_INFORMATION (0x2000) -#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF) - -#ifdef _WIN64 -#define MAXIMUM_PROCESSORS 64 -#else -#define MAXIMUM_PROCESSORS 32 -#endif - -#define THREAD_TERMINATE (0x0001) -#define THREAD_SUSPEND_RESUME (0x0002) -#define THREAD_GET_CONTEXT (0x0008) -#define THREAD_SET_CONTEXT (0x0010) -#define THREAD_SET_INFORMATION (0x0020) -#define THREAD_QUERY_INFORMATION (0x0040) -#define THREAD_SET_THREAD_TOKEN (0x0080) -#define THREAD_IMPERSONATE (0x0100) -#define THREAD_DIRECT_IMPERSONATION (0x0200) - -#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3FF) - -#define JOB_OBJECT_ASSIGN_PROCESS (0x0001) -#define JOB_OBJECT_SET_ATTRIBUTES (0x0002) -#define JOB_OBJECT_QUERY (0x0004) -#define JOB_OBJECT_TERMINATE (0x0008) -#define JOB_OBJECT_SET_SECURITY_ATTRIBUTES (0x0010) -#define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1F) - - typedef struct _JOB_SET_ARRAY { - HANDLE JobHandle; - DWORD MemberLevel; - DWORD Flags; - } JOB_SET_ARRAY,*PJOB_SET_ARRAY; - -#define FLS_MAXIMUM_AVAILABLE 128 -#define TLS_MINIMUM_AVAILABLE 64 - -#ifndef _NT_TIB_DEFINED -#define _NT_TIB_DEFINED - typedef struct _NT_TIB { - struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; - PVOID StackBase; - PVOID StackLimit; - PVOID SubSystemTib; - union { - PVOID FiberData; - DWORD Version; - }; - PVOID ArbitraryUserPointer; - struct _NT_TIB *Self; - } NT_TIB; - typedef NT_TIB *PNT_TIB; -#endif - - typedef struct _NT_TIB32 { - DWORD ExceptionList; - DWORD StackBase; - DWORD StackLimit; - DWORD SubSystemTib; - union { - DWORD FiberData; - DWORD Version; - }; - DWORD ArbitraryUserPointer; - DWORD Self; - } NT_TIB32,*PNT_TIB32; - - typedef struct _NT_TIB64 { - DWORD64 ExceptionList; - DWORD64 StackBase; - DWORD64 StackLimit; - DWORD64 SubSystemTib; - union { - DWORD64 FiberData; - DWORD Version; - }; - DWORD64 ArbitraryUserPointer; - DWORD64 Self; - } NT_TIB64,*PNT_TIB64; - -#if !defined(I_X86_) && !defined(_IA64_) && !defined(_AMD64_) -#define WX86 -#endif - -#define THREAD_BASE_PRIORITY_LOWRT 15 -#define THREAD_BASE_PRIORITY_MAX 2 -#define THREAD_BASE_PRIORITY_MIN (-2) -#define THREAD_BASE_PRIORITY_IDLE (-15) - - typedef struct _QUOTA_LIMITS { - SIZE_T PagedPoolLimit; - SIZE_T NonPagedPoolLimit; - SIZE_T MinimumWorkingSetSize; - SIZE_T MaximumWorkingSetSize; - SIZE_T PagefileLimit; - LARGE_INTEGER TimeLimit; - } QUOTA_LIMITS,*PQUOTA_LIMITS; - -#define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001 -#define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002 -#define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004 -#define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008 - - typedef struct _QUOTA_LIMITS_EX { - SIZE_T PagedPoolLimit; - SIZE_T NonPagedPoolLimit; - SIZE_T MinimumWorkingSetSize; - SIZE_T MaximumWorkingSetSize; - SIZE_T PagefileLimit; - LARGE_INTEGER TimeLimit; - SIZE_T Reserved1; - SIZE_T Reserved2; - SIZE_T Reserved3; - SIZE_T Reserved4; - DWORD Flags; - DWORD Reserved5; - } QUOTA_LIMITS_EX,*PQUOTA_LIMITS_EX; - - typedef struct _IO_COUNTERS { - ULONGLONG ReadOperationCount; - ULONGLONG WriteOperationCount; - ULONGLONG OtherOperationCount; - ULONGLONG ReadTransferCount; - ULONGLONG WriteTransferCount; - ULONGLONG OtherTransferCount; - } IO_COUNTERS; - typedef IO_COUNTERS *PIO_COUNTERS; - - typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { - LARGE_INTEGER TotalUserTime; - LARGE_INTEGER TotalKernelTime; - LARGE_INTEGER ThisPeriodTotalUserTime; - LARGE_INTEGER ThisPeriodTotalKernelTime; - DWORD TotalPageFaultCount; - DWORD TotalProcesses; - DWORD ActiveProcesses; - DWORD TotalTerminatedProcesses; - } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION; - - typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION { - LARGE_INTEGER PerProcessUserTimeLimit; - LARGE_INTEGER PerJobUserTimeLimit; - DWORD LimitFlags; - SIZE_T MinimumWorkingSetSize; - SIZE_T MaximumWorkingSetSize; - DWORD ActiveProcessLimit; - ULONG_PTR Affinity; - DWORD PriorityClass; - DWORD SchedulingClass; - } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION; - - typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION { - JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; - IO_COUNTERS IoInfo; - SIZE_T ProcessMemoryLimit; - SIZE_T JobMemoryLimit; - SIZE_T PeakProcessMemoryUsed; - SIZE_T PeakJobMemoryUsed; - } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION; - - typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST { - DWORD NumberOfAssignedProcesses; - DWORD NumberOfProcessIdsInList; - ULONG_PTR ProcessIdList[1]; - } JOBOBJECT_BASIC_PROCESS_ID_LIST,*PJOBOBJECT_BASIC_PROCESS_ID_LIST; - - typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS { - DWORD UIRestrictionsClass; - } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS; - - typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION { - DWORD SecurityLimitFlags; - HANDLE JobToken; - PTOKEN_GROUPS SidsToDisable; - PTOKEN_PRIVILEGES PrivilegesToDelete; - PTOKEN_GROUPS RestrictedSids; - } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION; - - typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION { - DWORD EndOfJobTimeAction; - } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION; - - typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT { - PVOID CompletionKey; - HANDLE CompletionPort; - } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT; - - typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { - JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo; - IO_COUNTERS IoInfo; - } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; - - typedef struct _JOBOBJECT_JOBSET_INFORMATION { - DWORD MemberLevel; - } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION; - -#define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0 -#define JOB_OBJECT_POST_AT_END_OF_JOB 1 - -#define JOB_OBJECT_MSG_END_OF_JOB_TIME 1 -#define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2 -#define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3 -#define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4 -#define JOB_OBJECT_MSG_NEW_PROCESS 6 -#define JOB_OBJECT_MSG_EXIT_PROCESS 7 -#define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8 -#define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9 -#define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10 - -#define JOB_OBJECT_LIMIT_WORKINGSET 0x00000001 -#define JOB_OBJECT_LIMIT_PROCESS_TIME 0x00000002 -#define JOB_OBJECT_LIMIT_JOB_TIME 0x00000004 -#define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x00000008 -#define JOB_OBJECT_LIMIT_AFFINITY 0x00000010 -#define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x00000020 -#define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x00000040 -#define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x00000080 - -#define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x00000100 -#define JOB_OBJECT_LIMIT_JOB_MEMORY 0x00000200 -#define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x00000400 -#define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x00000800 -#define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x00001000 -#define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000 - -#define JOB_OBJECT_LIMIT_RESERVED2 0x00004000 -#define JOB_OBJECT_LIMIT_RESERVED3 0x00008000 -#define JOB_OBJECT_LIMIT_RESERVED4 0x00010000 -#define JOB_OBJECT_LIMIT_RESERVED5 0x00020000 -#define JOB_OBJECT_LIMIT_RESERVED6 0x00040000 - -#define JOB_OBJECT_LIMIT_VALID_FLAGS 0x0007ffff - -#define JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS 0x000000ff -#define JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS 0x00003fff -#define JOB_OBJECT_RESERVED_LIMIT_VALID_FLAGS 0x0007ffff - -#define JOB_OBJECT_UILIMIT_NONE 0x00000000 - -#define JOB_OBJECT_UILIMIT_HANDLES 0x00000001 -#define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x00000002 -#define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x00000004 -#define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x00000008 -#define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x00000010 -#define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x00000020 -#define JOB_OBJECT_UILIMIT_DESKTOP 0x00000040 -#define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x00000080 - -#define JOB_OBJECT_UILIMIT_ALL 0x000000FF - -#define JOB_OBJECT_UI_VALID_FLAGS 0x000000FF - -#define JOB_OBJECT_SECURITY_NO_ADMIN 0x00000001 -#define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x00000002 -#define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x00000004 -#define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x00000008 - -#define JOB_OBJECT_SECURITY_VALID_FLAGS 0x0000000f - - typedef enum _JOBOBJECTINFOCLASS { - JobObjectBasicAccountingInformation = 1,JobObjectBasicLimitInformation,JobObjectBasicProcessIdList,JobObjectBasicUIRestrictions, - JobObjectSecurityLimitInformation,JobObjectEndOfJobTimeInformation,JobObjectAssociateCompletionPortInformation, - JobObjectBasicAndIoAccountingInformation,JobObjectExtendedLimitInformation,JobObjectJobSetInformation,MaxJobObjectInfoClass - } JOBOBJECTINFOCLASS; - -#define EVENT_MODIFY_STATE 0x0002 -#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) - -#define MUTANT_QUERY_STATE 0x0001 - -#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| MUTANT_QUERY_STATE) -#define SEMAPHORE_MODIFY_STATE 0x0002 -#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) - -#define TIMER_QUERY_STATE 0x0001 -#define TIMER_MODIFY_STATE 0x0002 - -#define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE| TIMER_QUERY_STATE|TIMER_MODIFY_STATE) - -#define TIME_ZONE_ID_UNKNOWN 0 -#define TIME_ZONE_ID_STANDARD 1 -#define TIME_ZONE_ID_DAYLIGHT 2 - - typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP { - RelationProcessorCore,RelationNumaNode,RelationCache - } LOGICAL_PROCESSOR_RELATIONSHIP; - -#define LTP_PC_SMT 0x1 - - typedef enum _PROCESSOR_CACHE_TYPE { - CacheUnified,CacheInstruction,CacheData,CacheTrace - } PROCESSOR_CACHE_TYPE; - -#define CACHE_FULLY_ASSOCIATIVE 0xFF - - typedef struct _CACHE_DESCRIPTOR { - BYTE Level; - BYTE Associativity; - WORD LineSize; - DWORD Size; - PROCESSOR_CACHE_TYPE Type; - } CACHE_DESCRIPTOR,*PCACHE_DESCRIPTOR; - - typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION { - ULONG_PTR ProcessorMask; - LOGICAL_PROCESSOR_RELATIONSHIP Relationship; - union { - struct { - BYTE Flags; - } ProcessorCore; - struct { - DWORD NodeNumber; - } NumaNode; - CACHE_DESCRIPTOR Cache; - ULONGLONG Reserved[2]; - }; - } SYSTEM_LOGICAL_PROCESSOR_INFORMATION,*PSYSTEM_LOGICAL_PROCESSOR_INFORMATION; - -#define PROCESSOR_INTEL_386 386 -#define PROCESSOR_INTEL_486 486 -#define PROCESSOR_INTEL_PENTIUM 586 -#define PROCESSOR_INTEL_IA64 2200 -#define PROCESSOR_AMD_X8664 8664 -#define PROCESSOR_MIPS_R4000 4000 -#define PROCESSOR_ALPHA_21064 21064 -#define PROCESSOR_PPC_601 601 -#define PROCESSOR_PPC_603 603 -#define PROCESSOR_PPC_604 604 -#define PROCESSOR_PPC_620 620 -#define PROCESSOR_HITACHI_SH3 10003 -#define PROCESSOR_HITACHI_SH3E 10004 -#define PROCESSOR_HITACHI_SH4 10005 -#define PROCESSOR_MOTOROLA_821 821 -#define PROCESSOR_SHx_SH3 103 -#define PROCESSOR_SHx_SH4 104 -#define PROCESSOR_STRONGARM 2577 -#define PROCESSOR_ARM720 1824 -#define PROCESSOR_ARM820 2080 -#define PROCESSOR_ARM920 2336 -#define PROCESSOR_ARM_7TDMI 70001 -#define PROCESSOR_OPTIL 0x494f - -#define PROCESSOR_ARCHITECTURE_INTEL 0 -#define PROCESSOR_ARCHITECTURE_MIPS 1 -#define PROCESSOR_ARCHITECTURE_ALPHA 2 -#define PROCESSOR_ARCHITECTURE_PPC 3 -#define PROCESSOR_ARCHITECTURE_SHX 4 -#define PROCESSOR_ARCHITECTURE_ARM 5 -#define PROCESSOR_ARCHITECTURE_IA64 6 -#define PROCESSOR_ARCHITECTURE_ALPHA64 7 -#define PROCESSOR_ARCHITECTURE_MSIL 8 -#define PROCESSOR_ARCHITECTURE_AMD64 9 -#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10 - -#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF - -#define PF_FLOATING_POINT_PRECISION_ERRATA 0 -#define PF_FLOATING_POINT_EMULATED 1 -#define PF_COMPARE_EXCHANGE_DOUBLE 2 -#define PF_MMX_INSTRUCTIONS_AVAILABLE 3 -#define PF_PPC_MOVEMEM_64BIT_OK 4 -#define PF_ALPHA_BYTE_INSTRUCTIONS 5 -#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 -#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 -#define PF_RDTSC_INSTRUCTION_AVAILABLE 8 -#define PF_PAE_ENABLED 9 -#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 -#define PF_SSE_DAZ_MODE_AVAILABLE 11 -#define PF_NX_ENABLED 12 - - typedef struct _MEMORY_BASIC_INFORMATION { - PVOID BaseAddress; - PVOID AllocationBase; - DWORD AllocationProtect; - SIZE_T RegionSize; - DWORD State; - DWORD Protect; - DWORD Type; - } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION; - - typedef struct _MEMORY_BASIC_INFORMATION32 { - DWORD BaseAddress; - DWORD AllocationBase; - DWORD AllocationProtect; - DWORD RegionSize; - DWORD State; - DWORD Protect; - DWORD Type; - } MEMORY_BASIC_INFORMATION32,*PMEMORY_BASIC_INFORMATION32; - - typedef struct DECLSPEC_ALIGN(16) _MEMORY_BASIC_INFORMATION64 { - ULONGLONG BaseAddress; - ULONGLONG AllocationBase; - DWORD AllocationProtect; - DWORD __alignment1; - ULONGLONG RegionSize; - DWORD State; - DWORD Protect; - DWORD Type; - DWORD __alignment2; - } MEMORY_BASIC_INFORMATION64,*PMEMORY_BASIC_INFORMATION64; - -#define SECTION_QUERY 0x0001 -#define SECTION_MAP_WRITE 0x0002 -#define SECTION_MAP_READ 0x0004 -#define SECTION_MAP_EXECUTE 0x0008 -#define SECTION_EXTEND_SIZE 0x0010 -#define SECTION_MAP_EXECUTE_EXPLICIT 0x0020 - -#define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY| SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE) -#define PAGE_NOACCESS 0x01 -#define PAGE_READONLY 0x02 -#define PAGE_READWRITE 0x04 -#define PAGE_WRITECOPY 0x08 -#define PAGE_EXECUTE 0x10 -#define PAGE_EXECUTE_READ 0x20 -#define PAGE_EXECUTE_READWRITE 0x40 -#define PAGE_EXECUTE_WRITECOPY 0x80 -#define PAGE_GUARD 0x100 -#define PAGE_NOCACHE 0x200 -#define PAGE_WRITECOMBINE 0x400 -#define MEM_COMMIT 0x1000 -#define MEM_RESERVE 0x2000 -#define MEM_DECOMMIT 0x4000 -#define MEM_RELEASE 0x8000 -#define MEM_FREE 0x10000 -#define MEM_PRIVATE 0x20000 -#define MEM_MAPPED 0x40000 -#define MEM_RESET 0x80000 -#define MEM_TOP_DOWN 0x100000 -#define MEM_WRITE_WATCH 0x200000 -#define MEM_PHYSICAL 0x400000 -#define MEM_LARGE_PAGES 0x20000000 -#define MEM_4MB_PAGES 0x80000000 -#define SEC_FILE 0x800000 -#define SEC_IMAGE 0x1000000 -#define SEC_RESERVE 0x4000000 -#define SEC_COMMIT 0x8000000 -#define SEC_NOCACHE 0x10000000 -#define SEC_LARGE_PAGES 0x80000000 -#define MEM_IMAGE SEC_IMAGE -#define WRITE_WATCH_FLAG_RESET 0x01 - -#define FILE_READ_DATA (0x0001) -#define FILE_LIST_DIRECTORY (0x0001) - -#define FILE_WRITE_DATA (0x0002) -#define FILE_ADD_FILE (0x0002) - -#define FILE_APPEND_DATA (0x0004) -#define FILE_ADD_SUBDIRECTORY (0x0004) -#define FILE_CREATE_PIPE_INSTANCE (0x0004) - -#define FILE_READ_EA (0x0008) - -#define FILE_WRITE_EA (0x0010) - -#define FILE_EXECUTE (0x0020) -#define FILE_TRAVERSE (0x0020) - -#define FILE_DELETE_CHILD (0x0040) - -#define FILE_READ_ATTRIBUTES (0x0080) - -#define FILE_WRITE_ATTRIBUTES (0x0100) - -#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) -#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE) -#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE) -#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE) - -#define FILE_SHARE_READ 0x00000001 -#define FILE_SHARE_WRITE 0x00000002 -#define FILE_SHARE_DELETE 0x00000004 -#define FILE_ATTRIBUTE_READONLY 0x00000001 -#define FILE_ATTRIBUTE_HIDDEN 0x00000002 -#define FILE_ATTRIBUTE_SYSTEM 0x00000004 -#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 -#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 -#define FILE_ATTRIBUTE_DEVICE 0x00000040 -#define FILE_ATTRIBUTE_NORMAL 0x00000080 -#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 -#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 -#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 -#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 -#define FILE_ATTRIBUTE_OFFLINE 0x00001000 -#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 -#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 -#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 -#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 -#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 -#define FILE_NOTIFY_CHANGE_SIZE 0x00000008 -#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 -#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 -#define FILE_NOTIFY_CHANGE_CREATION 0x00000040 -#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 -#define FILE_ACTION_ADDED 0x00000001 -#define FILE_ACTION_REMOVED 0x00000002 -#define FILE_ACTION_MODIFIED 0x00000003 -#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 -#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 -#define MAILSLOT_NO_MESSAGE ((DWORD)-1) -#define MAILSLOT_WAIT_FOREVER ((DWORD)-1) -#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 -#define FILE_CASE_PRESERVED_NAMES 0x00000002 -#define FILE_UNICODE_ON_DISK 0x00000004 -#define FILE_PERSISTENT_ACLS 0x00000008 -#define FILE_FILE_COMPRESSION 0x00000010 -#define FILE_VOLUME_QUOTAS 0x00000020 -#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 -#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 -#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 -#define FILE_VOLUME_IS_COMPRESSED 0x00008000 -#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 -#define FILE_SUPPORTS_ENCRYPTION 0x00020000 -#define FILE_NAMED_STREAMS 0x00040000 -#define FILE_READ_ONLY_VOLUME 0x00080000 - - typedef struct _FILE_NOTIFY_INFORMATION { - DWORD NextEntryOffset; - DWORD Action; - DWORD FileNameLength; - WCHAR FileName[1]; - } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION; - - typedef union _FILE_SEGMENT_ELEMENT { - PVOID64 Buffer; - ULONGLONG Alignment; - }FILE_SEGMENT_ELEMENT,*PFILE_SEGMENT_ELEMENT; - - typedef struct _REPARSE_GUID_DATA_BUFFER { - DWORD ReparseTag; - WORD ReparseDataLength; - WORD Reserved; - GUID ReparseGuid; - struct { - BYTE DataBuffer[1]; - } GenericReparseBuffer; - } REPARSE_GUID_DATA_BUFFER,*PREPARSE_GUID_DATA_BUFFER; - -#define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER,GenericReparseBuffer) - -#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE (16 *1024) - -#define IO_REPARSE_TAG_RESERVED_ZERO (0) -#define IO_REPARSE_TAG_RESERVED_ONE (1) - -#define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE - -#define IsReparseTagMicrosoft(_tag) (((_tag) & 0x80000000)) -#define IsReparseTagNameSurrogate(_tag) (((_tag) & 0x20000000)) - -#define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L) -#define IO_REPARSE_TAG_HSM (0xC0000004L) -#define IO_REPARSE_TAG_SIS (0x80000007L) -#define IO_REPARSE_TAG_DFS (0x8000000AL) -#define IO_REPARSE_TAG_FILTER_MANAGER (0x8000000BL) -#define IO_COMPLETION_MODIFY_STATE 0x0002 -#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) -#define DUPLICATE_CLOSE_SOURCE 0x00000001 -#define DUPLICATE_SAME_ACCESS 0x00000002 - - typedef enum _SYSTEM_POWER_STATE { - PowerSystemUnspecified = 0,PowerSystemWorking = 1,PowerSystemSleeping1 = 2,PowerSystemSleeping2 = 3,PowerSystemSleeping3 = 4,PowerSystemHibernate = 5,PowerSystemShutdown = 6,PowerSystemMaximum = 7 - } SYSTEM_POWER_STATE,*PSYSTEM_POWER_STATE; - -#define POWER_SYSTEM_MAXIMUM 7 - - typedef enum { - PowerActionNone = 0,PowerActionReserved,PowerActionSleep,PowerActionHibernate,PowerActionShutdown,PowerActionShutdownReset,PowerActionShutdownOff,PowerActionWarmEject - } POWER_ACTION,*PPOWER_ACTION; - - typedef enum _DEVICE_POWER_STATE { - PowerDeviceUnspecified = 0,PowerDeviceD0,PowerDeviceD1,PowerDeviceD2,PowerDeviceD3,PowerDeviceMaximum - } DEVICE_POWER_STATE,*PDEVICE_POWER_STATE; - -#define ES_SYSTEM_REQUIRED ((DWORD)0x00000001) -#define ES_DISPLAY_REQUIRED ((DWORD)0x00000002) -#define ES_USER_PRESENT ((DWORD)0x00000004) -#define ES_CONTINUOUS ((DWORD)0x80000000) - - typedef DWORD EXECUTION_STATE; - - typedef enum { - LT_DONT_CARE,LT_LOWEST_LATENCY - } LATENCY_TIME; - -#define PDCAP_D0_SUPPORTED 0x00000001 -#define PDCAP_D1_SUPPORTED 0x00000002 -#define PDCAP_D2_SUPPORTED 0x00000004 -#define PDCAP_D3_SUPPORTED 0x00000008 -#define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010 -#define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020 -#define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040 -#define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080 -#define PDCAP_WARM_EJECT_SUPPORTED 0x00000100 - - typedef struct CM_Power_Data_s { - DWORD PD_Size; - DEVICE_POWER_STATE PD_MostRecentPowerState; - DWORD PD_Capabilities; - DWORD PD_D1Latency; - DWORD PD_D2Latency; - DWORD PD_D3Latency; - DEVICE_POWER_STATE PD_PowerStateMapping[POWER_SYSTEM_MAXIMUM]; - SYSTEM_POWER_STATE PD_DeepestSystemWake; - } CM_POWER_DATA,*PCM_POWER_DATA; - - typedef enum { - SystemPowerPolicyAc,SystemPowerPolicyDc,VerifySystemPolicyAc,VerifySystemPolicyDc,SystemPowerCapabilities,SystemBatteryState,SystemPowerStateHandler,ProcessorStateHandler,SystemPowerPolicyCurrent,AdministratorPowerPolicy,SystemReserveHiberFile,ProcessorInformation,SystemPowerInformation,ProcessorStateHandler2,LastWakeTime,LastSleepTime,SystemExecutionState,SystemPowerStateNotifyHandler,ProcessorPowerPolicyAc,ProcessorPowerPolicyDc,VerifyProcessorPowerPolicyAc,VerifyProcessorPowerPolicyDc,ProcessorPowerPolicyCurrent,SystemPowerStateLogging,SystemPowerLoggingEntry - } POWER_INFORMATION_LEVEL; - - typedef struct { - DWORD Granularity; - DWORD Capacity; - } BATTERY_REPORTING_SCALE,*PBATTERY_REPORTING_SCALE; - - typedef struct { - POWER_ACTION Action; - DWORD Flags; - DWORD EventCode; - } POWER_ACTION_POLICY,*PPOWER_ACTION_POLICY; - -#define POWER_ACTION_QUERY_ALLOWED 0x00000001 -#define POWER_ACTION_UI_ALLOWED 0x00000002 -#define POWER_ACTION_OVERRIDE_APPS 0x00000004 -#define POWER_ACTION_LIGHTEST_FIRST 0x10000000 -#define POWER_ACTION_LOCK_CONSOLE 0x20000000 -#define POWER_ACTION_DISABLE_WAKES 0x40000000 -#define POWER_ACTION_CRITICAL 0x80000000 - -#define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001 -#define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002 -#define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004 -#define POWER_USER_NOTIFY_BUTTON 0x00000008 -#define POWER_USER_NOTIFY_SHUTDOWN 0x00000010 -#define POWER_FORCE_TRIGGER_RESET 0x80000000 - - typedef struct { - BOOLEAN Enable; - BYTE Spare[3]; - DWORD BatteryLevel; - POWER_ACTION_POLICY PowerPolicy; - SYSTEM_POWER_STATE MinSystemState; - } SYSTEM_POWER_LEVEL,*PSYSTEM_POWER_LEVEL; - -#define NUM_DISCHARGE_POLICIES 4 -#define DISCHARGE_POLICY_CRITICAL 0 -#define DISCHARGE_POLICY_LOW 1 - -#define PO_THROTTLE_NONE 0 -#define PO_THROTTLE_CONSTANT 1 -#define PO_THROTTLE_DEGRADE 2 -#define PO_THROTTLE_ADAPTIVE 3 -#define PO_THROTTLE_MAXIMUM 4 - - typedef struct _SYSTEM_POWER_POLICY { - DWORD Revision; - POWER_ACTION_POLICY PowerButton; - POWER_ACTION_POLICY SleepButton; - POWER_ACTION_POLICY LidClose; - SYSTEM_POWER_STATE LidOpenWake; - DWORD Reserved; - POWER_ACTION_POLICY Idle; - DWORD IdleTimeout; - BYTE IdleSensitivity; - BYTE DynamicThrottle; - BYTE Spare2[2]; - SYSTEM_POWER_STATE MinSleep; - SYSTEM_POWER_STATE MaxSleep; - SYSTEM_POWER_STATE ReducedLatencySleep; - DWORD WinLogonFlags; - DWORD Spare3; - DWORD DozeS4Timeout; - DWORD BroadcastCapacityResolution; - SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]; - DWORD VideoTimeout; - BOOLEAN VideoDimDisplay; - DWORD VideoReserved[3]; - DWORD SpindownTimeout; - BOOLEAN OptimizeForPower; - BYTE FanThrottleTolerance; - BYTE ForcedThrottle; - BYTE MinThrottle; - POWER_ACTION_POLICY OverThrottled; - } SYSTEM_POWER_POLICY,*PSYSTEM_POWER_POLICY; - - typedef struct _PROCESSOR_POWER_POLICY_INFO { - DWORD TimeCheck; - DWORD DemoteLimit; - DWORD PromoteLimit; - BYTE DemotePercent; - BYTE PromotePercent; - BYTE Spare[2]; - DWORD AllowDemotion:1; - DWORD AllowPromotion:1; - DWORD Reserved:30; - } PROCESSOR_POWER_POLICY_INFO,*PPROCESSOR_POWER_POLICY_INFO; - - typedef struct _PROCESSOR_POWER_POLICY { - DWORD Revision; - BYTE DynamicThrottle; - BYTE Spare[3]; - DWORD DisableCStates:1; - DWORD Reserved:31; - DWORD PolicyCount; - PROCESSOR_POWER_POLICY_INFO Policy[3]; - } PROCESSOR_POWER_POLICY,*PPROCESSOR_POWER_POLICY; - - typedef struct _ADMINISTRATOR_POWER_POLICY { - SYSTEM_POWER_STATE MinSleep; - SYSTEM_POWER_STATE MaxSleep; - DWORD MinVideoTimeout; - DWORD MaxVideoTimeout; - DWORD MinSpindownTimeout; - DWORD MaxSpindownTimeout; - } ADMINISTRATOR_POWER_POLICY,*PADMINISTRATOR_POWER_POLICY; - - typedef struct { - BOOLEAN PowerButtonPresent; - BOOLEAN SleepButtonPresent; - BOOLEAN LidPresent; - BOOLEAN SystemS1; - BOOLEAN SystemS2; - BOOLEAN SystemS3; - BOOLEAN SystemS4; - BOOLEAN SystemS5; - BOOLEAN HiberFilePresent; - BOOLEAN FullWake; - BOOLEAN VideoDimPresent; - BOOLEAN ApmPresent; - BOOLEAN UpsPresent; - BOOLEAN ThermalControl; - BOOLEAN ProcessorThrottle; - BYTE ProcessorMinThrottle; - BYTE ProcessorMaxThrottle; - BYTE spare2[4]; - BOOLEAN DiskSpinDown; - BYTE spare3[8]; - BOOLEAN SystemBatteriesPresent; - BOOLEAN BatteriesAreShortTerm; - BATTERY_REPORTING_SCALE BatteryScale[3]; - SYSTEM_POWER_STATE AcOnLineWake; - SYSTEM_POWER_STATE SoftLidWake; - SYSTEM_POWER_STATE RtcWake; - SYSTEM_POWER_STATE MinDeviceWakeState; - SYSTEM_POWER_STATE DefaultLowLatencyWake; - } SYSTEM_POWER_CAPABILITIES,*PSYSTEM_POWER_CAPABILITIES; - - typedef struct { - BOOLEAN AcOnLine; - BOOLEAN BatteryPresent; - BOOLEAN Charging; - BOOLEAN Discharging; - BOOLEAN Spare1[4]; - DWORD MaxCapacity; - DWORD RemainingCapacity; - DWORD Rate; - DWORD EstimatedTime; - DWORD DefaultAlert1; - DWORD DefaultAlert2; - } SYSTEM_BATTERY_STATE,*PSYSTEM_BATTERY_STATE; - -#include "pshpack4.h" - -#define IMAGE_DOS_SIGNATURE 0x5A4D -#define IMAGE_OS2_SIGNATURE 0x454E -#define IMAGE_OS2_SIGNATURE_LE 0x454C -#define IMAGE_VXD_SIGNATURE 0x454C -#define IMAGE_NT_SIGNATURE 0x00004550 - -#include "pshpack2.h" - - typedef struct _IMAGE_DOS_HEADER { - WORD e_magic; - WORD e_cblp; - WORD e_cp; - WORD e_crlc; - WORD e_cparhdr; - WORD e_minalloc; - WORD e_maxalloc; - WORD e_ss; - WORD e_sp; - WORD e_csum; - WORD e_ip; - WORD e_cs; - WORD e_lfarlc; - WORD e_ovno; - WORD e_res[4]; - WORD e_oemid; - WORD e_oeminfo; - WORD e_res2[10]; - LONG e_lfanew; - } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER; - - typedef struct _IMAGE_OS2_HEADER { - WORD ne_magic; - CHAR ne_ver; - CHAR ne_rev; - WORD ne_enttab; - WORD ne_cbenttab; - LONG ne_crc; - WORD ne_flags; - WORD ne_autodata; - WORD ne_heap; - WORD ne_stack; - LONG ne_csip; - LONG ne_sssp; - WORD ne_cseg; - WORD ne_cmod; - WORD ne_cbnrestab; - WORD ne_segtab; - WORD ne_rsrctab; - WORD ne_restab; - WORD ne_modtab; - WORD ne_imptab; - LONG ne_nrestab; - WORD ne_cmovent; - WORD ne_align; - WORD ne_cres; - BYTE ne_exetyp; - BYTE ne_flagsothers; - WORD ne_pretthunks; - WORD ne_psegrefbytes; - WORD ne_swaparea; - WORD ne_expver; - } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER; - - typedef struct _IMAGE_VXD_HEADER { - WORD e32_magic; - BYTE e32_border; - BYTE e32_worder; - DWORD e32_level; - WORD e32_cpu; - WORD e32_os; - DWORD e32_ver; - DWORD e32_mflags; - DWORD e32_mpages; - DWORD e32_startobj; - DWORD e32_eip; - DWORD e32_stackobj; - DWORD e32_esp; - DWORD e32_pagesize; - DWORD e32_lastpagesize; - DWORD e32_fixupsize; - DWORD e32_fixupsum; - DWORD e32_ldrsize; - DWORD e32_ldrsum; - DWORD e32_objtab; - DWORD e32_objcnt; - DWORD e32_objmap; - DWORD e32_itermap; - DWORD e32_rsrctab; - DWORD e32_rsrccnt; - DWORD e32_restab; - DWORD e32_enttab; - DWORD e32_dirtab; - DWORD e32_dircnt; - DWORD e32_fpagetab; - DWORD e32_frectab; - DWORD e32_impmod; - DWORD e32_impmodcnt; - DWORD e32_impproc; - DWORD e32_pagesum; - DWORD e32_datapage; - DWORD e32_preload; - DWORD e32_nrestab; - DWORD e32_cbnrestab; - DWORD e32_nressum; - DWORD e32_autodata; - DWORD e32_debuginfo; - DWORD e32_debuglen; - DWORD e32_instpreload; - DWORD e32_instdemand; - DWORD e32_heapsize; - BYTE e32_res3[12]; - DWORD e32_winresoff; - DWORD e32_winreslen; - WORD e32_devid; - WORD e32_ddkver; - } IMAGE_VXD_HEADER,*PIMAGE_VXD_HEADER; - -#include "poppack.h" - - typedef struct _IMAGE_FILE_HEADER { - WORD Machine; - WORD NumberOfSections; - DWORD TimeDateStamp; - DWORD PointerToSymbolTable; - DWORD NumberOfSymbols; - WORD SizeOfOptionalHeader; - WORD Characteristics; - } IMAGE_FILE_HEADER,*PIMAGE_FILE_HEADER; - -#define IMAGE_SIZEOF_FILE_HEADER 20 - -#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 -#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 -#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 -#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 -#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 -#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 -#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 -#define IMAGE_FILE_32BIT_MACHINE 0x0100 -#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 -#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 -#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 -#define IMAGE_FILE_SYSTEM 0x1000 -#define IMAGE_FILE_DLL 0x2000 -#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 -#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 - -#define IMAGE_FILE_MACHINE_UNKNOWN 0 -#define IMAGE_FILE_MACHINE_I386 0x014c -#define IMAGE_FILE_MACHINE_R3000 0x0162 -#define IMAGE_FILE_MACHINE_R4000 0x0166 -#define IMAGE_FILE_MACHINE_R10000 0x0168 -#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 -#define IMAGE_FILE_MACHINE_ALPHA 0x0184 -#define IMAGE_FILE_MACHINE_SH3 0x01a2 -#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 -#define IMAGE_FILE_MACHINE_SH3E 0x01a4 -#define IMAGE_FILE_MACHINE_SH4 0x01a6 -#define IMAGE_FILE_MACHINE_SH5 0x01a8 -#define IMAGE_FILE_MACHINE_ARM 0x01c0 -#define IMAGE_FILE_MACHINE_THUMB 0x01c2 -#define IMAGE_FILE_MACHINE_AM33 0x01d3 -#define IMAGE_FILE_MACHINE_POWERPC 0x01F0 -#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 -#define IMAGE_FILE_MACHINE_IA64 0x0200 -#define IMAGE_FILE_MACHINE_MIPS16 0x0266 -#define IMAGE_FILE_MACHINE_ALPHA64 0x0284 -#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 -#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 -#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64 -#define IMAGE_FILE_MACHINE_TRICORE 0x0520 -#define IMAGE_FILE_MACHINE_CEF 0x0CEF -#define IMAGE_FILE_MACHINE_EBC 0x0EBC -#define IMAGE_FILE_MACHINE_AMD64 0x8664 -#define IMAGE_FILE_MACHINE_M32R 0x9041 -#define IMAGE_FILE_MACHINE_CEE 0xC0EE - - typedef struct _IMAGE_DATA_DIRECTORY { - DWORD VirtualAddress; - DWORD Size; - } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY; - -#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 - - typedef struct _IMAGE_OPTIONAL_HEADER { - - WORD Magic; - BYTE MajorLinkerVersion; - BYTE MinorLinkerVersion; - DWORD SizeOfCode; - DWORD SizeOfInitializedData; - DWORD SizeOfUninitializedData; - DWORD AddressOfEntryPoint; - DWORD BaseOfCode; - DWORD BaseOfData; - DWORD ImageBase; - DWORD SectionAlignment; - DWORD FileAlignment; - WORD MajorOperatingSystemVersion; - WORD MinorOperatingSystemVersion; - WORD MajorImageVersion; - WORD MinorImageVersion; - WORD MajorSubsystemVersion; - WORD MinorSubsystemVersion; - DWORD Win32VersionValue; - DWORD SizeOfImage; - DWORD SizeOfHeaders; - DWORD CheckSum; - WORD Subsystem; - WORD DllCharacteristics; - DWORD SizeOfStackReserve; - DWORD SizeOfStackCommit; - DWORD SizeOfHeapReserve; - DWORD SizeOfHeapCommit; - DWORD LoaderFlags; - DWORD NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; - } IMAGE_OPTIONAL_HEADER32,*PIMAGE_OPTIONAL_HEADER32; - - typedef struct _IMAGE_ROM_OPTIONAL_HEADER { - WORD Magic; - BYTE MajorLinkerVersion; - BYTE MinorLinkerVersion; - DWORD SizeOfCode; - DWORD SizeOfInitializedData; - DWORD SizeOfUninitializedData; - DWORD AddressOfEntryPoint; - DWORD BaseOfCode; - DWORD BaseOfData; - DWORD BaseOfBss; - DWORD GprMask; - DWORD CprMask[4]; - DWORD GpValue; - } IMAGE_ROM_OPTIONAL_HEADER,*PIMAGE_ROM_OPTIONAL_HEADER; - - typedef struct _IMAGE_OPTIONAL_HEADER64 { - WORD Magic; - BYTE MajorLinkerVersion; - BYTE MinorLinkerVersion; - DWORD SizeOfCode; - DWORD SizeOfInitializedData; - DWORD SizeOfUninitializedData; - DWORD AddressOfEntryPoint; - DWORD BaseOfCode; - ULONGLONG ImageBase; - DWORD SectionAlignment; - DWORD FileAlignment; - WORD MajorOperatingSystemVersion; - WORD MinorOperatingSystemVersion; - WORD MajorImageVersion; - WORD MinorImageVersion; - WORD MajorSubsystemVersion; - WORD MinorSubsystemVersion; - DWORD Win32VersionValue; - DWORD SizeOfImage; - DWORD SizeOfHeaders; - DWORD CheckSum; - WORD Subsystem; - WORD DllCharacteristics; - ULONGLONG SizeOfStackReserve; - ULONGLONG SizeOfStackCommit; - ULONGLONG SizeOfHeapReserve; - ULONGLONG SizeOfHeapCommit; - DWORD LoaderFlags; - DWORD NumberOfRvaAndSizes; - IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; - } IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64; - -#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 -#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 -#define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224 -#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240 - -#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b -#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b -#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 - -#ifdef _WIN64 - typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; - typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER; -#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER -#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC -#else - typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER; - typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER; -#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER -#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC -#endif - - typedef struct _IMAGE_NT_HEADERS64 { - DWORD Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER64 OptionalHeader; - } IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64; - - typedef struct _IMAGE_NT_HEADERS { - DWORD Signature; - IMAGE_FILE_HEADER FileHeader; - IMAGE_OPTIONAL_HEADER32 OptionalHeader; - } IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32; - - typedef struct _IMAGE_ROM_HEADERS { - IMAGE_FILE_HEADER FileHeader; - IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; - } IMAGE_ROM_HEADERS,*PIMAGE_ROM_HEADERS; - -#ifdef _WIN64 - typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; - typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; -#else - typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS; - typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; -#endif - -#define IMAGE_FIRST_SECTION(ntheader) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)ntheader + FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader) + ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader)) - -#define IMAGE_SUBSYSTEM_UNKNOWN 0 -#define IMAGE_SUBSYSTEM_NATIVE 1 -#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 -#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 -#define IMAGE_SUBSYSTEM_OS2_CUI 5 -#define IMAGE_SUBSYSTEM_POSIX_CUI 7 -#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 -#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 -#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 -#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 -#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 -#define IMAGE_SUBSYSTEM_EFI_ROM 13 -#define IMAGE_SUBSYSTEM_XBOX 14 - -#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 -#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 -#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 -#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 -#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 - -#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 -#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 -#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 -#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 -#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 -#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 -#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 - -#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7 -#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 -#define IMAGE_DIRECTORY_ENTRY_TLS 9 -#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 -#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 -#define IMAGE_DIRECTORY_ENTRY_IAT 12 -#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 -#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 - - typedef struct ANON_OBJECT_HEADER { - WORD Sig1; - WORD Sig2; - WORD Version; - WORD Machine; - DWORD TimeDateStamp; - CLSID ClassID; - DWORD SizeOfData; - } ANON_OBJECT_HEADER; - -#define IMAGE_SIZEOF_SHORT_NAME 8 - - typedef struct _IMAGE_SECTION_HEADER { - BYTE Name[IMAGE_SIZEOF_SHORT_NAME]; - union { - DWORD PhysicalAddress; - DWORD VirtualSize; - } Misc; - DWORD VirtualAddress; - DWORD SizeOfRawData; - DWORD PointerToRawData; - DWORD PointerToRelocations; - DWORD PointerToLinenumbers; - WORD NumberOfRelocations; - WORD NumberOfLinenumbers; - DWORD Characteristics; - } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER; - -#define IMAGE_SIZEOF_SECTION_HEADER 40 - -#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - -#define IMAGE_SCN_CNT_CODE 0x00000020 -#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 -#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 -#define IMAGE_SCN_LNK_OTHER 0x00000100 -#define IMAGE_SCN_LNK_INFO 0x00000200 -#define IMAGE_SCN_LNK_REMOVE 0x00000800 -#define IMAGE_SCN_LNK_COMDAT 0x00001000 -#define IMAGE_SCN_NO_DEFER_SPEC_EXC 0x00004000 -#define IMAGE_SCN_GPREL 0x00008000 -#define IMAGE_SCN_MEM_FARDATA 0x00008000 -#define IMAGE_SCN_MEM_PURGEABLE 0x00020000 -#define IMAGE_SCN_MEM_16BIT 0x00020000 -#define IMAGE_SCN_MEM_LOCKED 0x00040000 -#define IMAGE_SCN_MEM_PRELOAD 0x00080000 - -#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 -#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 -#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 -#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 -#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 -#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 -#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 -#define IMAGE_SCN_ALIGN_128BYTES 0x00800000 -#define IMAGE_SCN_ALIGN_256BYTES 0x00900000 -#define IMAGE_SCN_ALIGN_512BYTES 0x00A00000 -#define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000 -#define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000 -#define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000 -#define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000 - -#define IMAGE_SCN_ALIGN_MASK 0x00F00000 - -#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 -#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 -#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 -#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 -#define IMAGE_SCN_MEM_SHARED 0x10000000 -#define IMAGE_SCN_MEM_EXECUTE 0x20000000 -#define IMAGE_SCN_MEM_READ 0x40000000 -#define IMAGE_SCN_MEM_WRITE 0x80000000 - -#define IMAGE_SCN_SCALE_INDEX 0x00000001 - -#include "pshpack2.h" - - typedef struct _IMAGE_SYMBOL { - union { - BYTE ShortName[8]; - struct { - DWORD Short; - DWORD Long; - } Name; - DWORD LongName[2]; - } N; - DWORD Value; - SHORT SectionNumber; - WORD Type; - BYTE StorageClass; - BYTE NumberOfAuxSymbols; - } IMAGE_SYMBOL; - typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL; - -#define IMAGE_SIZEOF_SYMBOL 18 - -#define IMAGE_SYM_UNDEFINED (SHORT)0 -#define IMAGE_SYM_ABSOLUTE (SHORT)-1 -#define IMAGE_SYM_DEBUG (SHORT)-2 -#define IMAGE_SYM_SECTION_MAX 0xFEFF - -#define IMAGE_SYM_TYPE_NULL 0x0000 -#define IMAGE_SYM_TYPE_VOID 0x0001 -#define IMAGE_SYM_TYPE_CHAR 0x0002 -#define IMAGE_SYM_TYPE_SHORT 0x0003 -#define IMAGE_SYM_TYPE_INT 0x0004 -#define IMAGE_SYM_TYPE_LONG 0x0005 -#define IMAGE_SYM_TYPE_FLOAT 0x0006 -#define IMAGE_SYM_TYPE_DOUBLE 0x0007 -#define IMAGE_SYM_TYPE_STRUCT 0x0008 -#define IMAGE_SYM_TYPE_UNION 0x0009 -#define IMAGE_SYM_TYPE_ENUM 0x000A -#define IMAGE_SYM_TYPE_MOE 0x000B -#define IMAGE_SYM_TYPE_BYTE 0x000C -#define IMAGE_SYM_TYPE_WORD 0x000D -#define IMAGE_SYM_TYPE_UINT 0x000E -#define IMAGE_SYM_TYPE_DWORD 0x000F -#define IMAGE_SYM_TYPE_PCODE 0x8000 - -#define IMAGE_SYM_DTYPE_NULL 0 -#define IMAGE_SYM_DTYPE_POINTER 1 -#define IMAGE_SYM_DTYPE_FUNCTION 2 -#define IMAGE_SYM_DTYPE_ARRAY 3 - -#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE)-1 -#define IMAGE_SYM_CLASS_NULL 0x0000 -#define IMAGE_SYM_CLASS_AUTOMATIC 0x0001 -#define IMAGE_SYM_CLASS_EXTERNAL 0x0002 -#define IMAGE_SYM_CLASS_STATIC 0x0003 -#define IMAGE_SYM_CLASS_REGISTER 0x0004 -#define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005 -#define IMAGE_SYM_CLASS_LABEL 0x0006 -#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007 -#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008 -#define IMAGE_SYM_CLASS_ARGUMENT 0x0009 -#define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A -#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B -#define IMAGE_SYM_CLASS_UNION_TAG 0x000C -#define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D -#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E -#define IMAGE_SYM_CLASS_ENUM_TAG 0x000F -#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010 -#define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011 -#define IMAGE_SYM_CLASS_BIT_FIELD 0x0012 -#define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044 -#define IMAGE_SYM_CLASS_BLOCK 0x0064 -#define IMAGE_SYM_CLASS_FUNCTION 0x0065 -#define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066 -#define IMAGE_SYM_CLASS_FILE 0x0067 -#define IMAGE_SYM_CLASS_SECTION 0x0068 -#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069 -#define IMAGE_SYM_CLASS_CLR_TOKEN 0x006B - -#define N_BTMASK 0x000F -#define N_TMASK 0x0030 -#define N_TMASK1 0x00C0 -#define N_TMASK2 0x00F0 -#define N_BTSHFT 4 -#define N_TSHIFT 2 - -#define BTYPE(x) ((x) & N_BTMASK) - -#ifndef ISPTR -#define ISPTR(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_POINTER << N_BTSHFT)) -#endif - -#ifndef ISFCN -#define ISFCN(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT)) -#endif - -#ifndef ISARY -#define ISARY(x) (((x) & N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT)) -#endif - -#ifndef ISTAG -#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG) -#endif - -#ifndef INCREF -#define INCREF(x) ((((x)&~N_BTMASK)<>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) -#endif - - typedef union _IMAGE_AUX_SYMBOL { - struct { - DWORD TagIndex; - union { - struct { - WORD Linenumber; - WORD Size; - } LnSz; - DWORD TotalSize; - } Misc; - union { - struct { - DWORD PointerToLinenumber; - DWORD PointerToNextFunction; - } Function; - struct { - WORD Dimension[4]; - } Array; - } FcnAry; - WORD TvIndex; - } Sym; - struct { - BYTE Name[IMAGE_SIZEOF_SYMBOL]; - } File; - struct { - DWORD Length; - WORD NumberOfRelocations; - WORD NumberOfLinenumbers; - DWORD CheckSum; - SHORT Number; - BYTE Selection; - } Section; - } IMAGE_AUX_SYMBOL; - typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL; - -#define IMAGE_SIZEOF_AUX_SYMBOL 18 - - typedef enum IMAGE_AUX_SYMBOL_TYPE { - IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1 - } IMAGE_AUX_SYMBOL_TYPE; - -#include - - typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF { - BYTE bAuxType; - BYTE bReserved; - DWORD SymbolTableIndex; - BYTE rgbReserved[12]; - } IMAGE_AUX_SYMBOL_TOKEN_DEF; - - typedef IMAGE_AUX_SYMBOL_TOKEN_DEF UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF; - -#include - -#define IMAGE_COMDAT_SELECT_NODUPLICATES 1 -#define IMAGE_COMDAT_SELECT_ANY 2 -#define IMAGE_COMDAT_SELECT_SAME_SIZE 3 -#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 -#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 -#define IMAGE_COMDAT_SELECT_LARGEST 6 -#define IMAGE_COMDAT_SELECT_NEWEST 7 - -#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 -#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 -#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 - - typedef struct _IMAGE_RELOCATION { - union { - DWORD VirtualAddress; - DWORD RelocCount; - }; - DWORD SymbolTableIndex; - WORD Type; - } IMAGE_RELOCATION; - typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION; - -#define IMAGE_SIZEOF_RELOCATION 10 - -#define IMAGE_REL_I386_ABSOLUTE 0x0000 -#define IMAGE_REL_I386_DIR16 0x0001 -#define IMAGE_REL_I386_REL16 0x0002 -#define IMAGE_REL_I386_DIR32 0x0006 -#define IMAGE_REL_I386_DIR32NB 0x0007 -#define IMAGE_REL_I386_SEG12 0x0009 -#define IMAGE_REL_I386_SECTION 0x000A -#define IMAGE_REL_I386_SECREL 0x000B -#define IMAGE_REL_I386_TOKEN 0x000C -#define IMAGE_REL_I386_SECREL7 0x000D -#define IMAGE_REL_I386_REL32 0x0014 - -#define IMAGE_REL_MIPS_ABSOLUTE 0x0000 -#define IMAGE_REL_MIPS_REFHALF 0x0001 -#define IMAGE_REL_MIPS_REFWORD 0x0002 -#define IMAGE_REL_MIPS_JMPADDR 0x0003 -#define IMAGE_REL_MIPS_REFHI 0x0004 -#define IMAGE_REL_MIPS_REFLO 0x0005 -#define IMAGE_REL_MIPS_GPREL 0x0006 -#define IMAGE_REL_MIPS_LITERAL 0x0007 -#define IMAGE_REL_MIPS_SECTION 0x000A -#define IMAGE_REL_MIPS_SECREL 0x000B -#define IMAGE_REL_MIPS_SECRELLO 0x000C -#define IMAGE_REL_MIPS_SECRELHI 0x000D -#define IMAGE_REL_MIPS_TOKEN 0x000E -#define IMAGE_REL_MIPS_JMPADDR16 0x0010 -#define IMAGE_REL_MIPS_REFWORDNB 0x0022 -#define IMAGE_REL_MIPS_PAIR 0x0025 - -#define IMAGE_REL_ALPHA_ABSOLUTE 0x0000 -#define IMAGE_REL_ALPHA_REFLONG 0x0001 -#define IMAGE_REL_ALPHA_REFQUAD 0x0002 -#define IMAGE_REL_ALPHA_GPREL32 0x0003 -#define IMAGE_REL_ALPHA_LITERAL 0x0004 -#define IMAGE_REL_ALPHA_LITUSE 0x0005 -#define IMAGE_REL_ALPHA_GPDISP 0x0006 -#define IMAGE_REL_ALPHA_BRADDR 0x0007 -#define IMAGE_REL_ALPHA_HINT 0x0008 -#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009 -#define IMAGE_REL_ALPHA_REFHI 0x000A -#define IMAGE_REL_ALPHA_REFLO 0x000B -#define IMAGE_REL_ALPHA_PAIR 0x000C -#define IMAGE_REL_ALPHA_MATCH 0x000D -#define IMAGE_REL_ALPHA_SECTION 0x000E -#define IMAGE_REL_ALPHA_SECREL 0x000F -#define IMAGE_REL_ALPHA_REFLONGNB 0x0010 -#define IMAGE_REL_ALPHA_SECRELLO 0x0011 -#define IMAGE_REL_ALPHA_SECRELHI 0x0012 -#define IMAGE_REL_ALPHA_REFQ3 0x0013 -#define IMAGE_REL_ALPHA_REFQ2 0x0014 -#define IMAGE_REL_ALPHA_REFQ1 0x0015 -#define IMAGE_REL_ALPHA_GPRELLO 0x0016 -#define IMAGE_REL_ALPHA_GPRELHI 0x0017 - -#define IMAGE_REL_PPC_ABSOLUTE 0x0000 -#define IMAGE_REL_PPC_ADDR64 0x0001 -#define IMAGE_REL_PPC_ADDR32 0x0002 -#define IMAGE_REL_PPC_ADDR24 0x0003 -#define IMAGE_REL_PPC_ADDR16 0x0004 -#define IMAGE_REL_PPC_ADDR14 0x0005 -#define IMAGE_REL_PPC_REL24 0x0006 -#define IMAGE_REL_PPC_REL14 0x0007 -#define IMAGE_REL_PPC_TOCREL16 0x0008 -#define IMAGE_REL_PPC_TOCREL14 0x0009 -#define IMAGE_REL_PPC_ADDR32NB 0x000A -#define IMAGE_REL_PPC_SECREL 0x000B -#define IMAGE_REL_PPC_SECTION 0x000C -#define IMAGE_REL_PPC_IFGLUE 0x000D -#define IMAGE_REL_PPC_IMGLUE 0x000E -#define IMAGE_REL_PPC_SECREL16 0x000F -#define IMAGE_REL_PPC_REFHI 0x0010 -#define IMAGE_REL_PPC_REFLO 0x0011 -#define IMAGE_REL_PPC_PAIR 0x0012 -#define IMAGE_REL_PPC_SECRELLO 0x0013 -#define IMAGE_REL_PPC_SECRELHI 0x0014 -#define IMAGE_REL_PPC_GPREL 0x0015 -#define IMAGE_REL_PPC_TOKEN 0x0016 -#define IMAGE_REL_PPC_TYPEMASK 0x00FF -#define IMAGE_REL_PPC_NEG 0x0100 -#define IMAGE_REL_PPC_BRTAKEN 0x0200 -#define IMAGE_REL_PPC_BRNTAKEN 0x0400 -#define IMAGE_REL_PPC_TOCDEFN 0x0800 - -#define IMAGE_REL_SH3_ABSOLUTE 0x0000 -#define IMAGE_REL_SH3_DIRECT16 0x0001 -#define IMAGE_REL_SH3_DIRECT32 0x0002 -#define IMAGE_REL_SH3_DIRECT8 0x0003 -#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004 -#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005 -#define IMAGE_REL_SH3_DIRECT4 0x0006 -#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007 -#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008 -#define IMAGE_REL_SH3_PCREL8_WORD 0x0009 -#define IMAGE_REL_SH3_PCREL8_LONG 0x000A -#define IMAGE_REL_SH3_PCREL12_WORD 0x000B -#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C -#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D -#define IMAGE_REL_SH3_SECTION 0x000E -#define IMAGE_REL_SH3_SECREL 0x000F -#define IMAGE_REL_SH3_DIRECT32_NB 0x0010 -#define IMAGE_REL_SH3_GPREL4_LONG 0x0011 -#define IMAGE_REL_SH3_TOKEN 0x0012 - -#define IMAGE_REL_SHM_PCRELPT 0x0013 -#define IMAGE_REL_SHM_REFLO 0x0014 -#define IMAGE_REL_SHM_REFHALF 0x0015 -#define IMAGE_REL_SHM_RELLO 0x0016 -#define IMAGE_REL_SHM_RELHALF 0x0017 -#define IMAGE_REL_SHM_PAIR 0x0018 - -#define IMAGE_REL_SH_NOMODE 0x8000 - -#define IMAGE_REL_ARM_ABSOLUTE 0x0000 -#define IMAGE_REL_ARM_ADDR32 0x0001 -#define IMAGE_REL_ARM_ADDR32NB 0x0002 -#define IMAGE_REL_ARM_BRANCH24 0x0003 -#define IMAGE_REL_ARM_BRANCH11 0x0004 -#define IMAGE_REL_ARM_TOKEN 0x0005 -#define IMAGE_REL_ARM_GPREL12 0x0006 -#define IMAGE_REL_ARM_GPREL7 0x0007 -#define IMAGE_REL_ARM_BLX24 0x0008 -#define IMAGE_REL_ARM_BLX11 0x0009 -#define IMAGE_REL_ARM_SECTION 0x000E -#define IMAGE_REL_ARM_SECREL 0x000F - -#define IMAGE_REL_AM_ABSOLUTE 0x0000 -#define IMAGE_REL_AM_ADDR32 0x0001 -#define IMAGE_REL_AM_ADDR32NB 0x0002 -#define IMAGE_REL_AM_CALL32 0x0003 -#define IMAGE_REL_AM_FUNCINFO 0x0004 -#define IMAGE_REL_AM_REL32_1 0x0005 -#define IMAGE_REL_AM_REL32_2 0x0006 -#define IMAGE_REL_AM_SECREL 0x0007 -#define IMAGE_REL_AM_SECTION 0x0008 -#define IMAGE_REL_AM_TOKEN 0x0009 - -#define IMAGE_REL_AMD64_ABSOLUTE 0x0000 -#define IMAGE_REL_AMD64_ADDR64 0x0001 -#define IMAGE_REL_AMD64_ADDR32 0x0002 -#define IMAGE_REL_AMD64_ADDR32NB 0x0003 -#define IMAGE_REL_AMD64_REL32 0x0004 -#define IMAGE_REL_AMD64_REL32_1 0x0005 -#define IMAGE_REL_AMD64_REL32_2 0x0006 -#define IMAGE_REL_AMD64_REL32_3 0x0007 -#define IMAGE_REL_AMD64_REL32_4 0x0008 -#define IMAGE_REL_AMD64_REL32_5 0x0009 -#define IMAGE_REL_AMD64_SECTION 0x000A -#define IMAGE_REL_AMD64_SECREL 0x000B -#define IMAGE_REL_AMD64_SECREL7 0x000C -#define IMAGE_REL_AMD64_TOKEN 0x000D -#define IMAGE_REL_AMD64_SREL32 0x000E -#define IMAGE_REL_AMD64_PAIR 0x000F -#define IMAGE_REL_AMD64_SSPAN32 0x0010 - -#define IMAGE_REL_IA64_ABSOLUTE 0x0000 -#define IMAGE_REL_IA64_IMM14 0x0001 -#define IMAGE_REL_IA64_IMM22 0x0002 -#define IMAGE_REL_IA64_IMM64 0x0003 -#define IMAGE_REL_IA64_DIR32 0x0004 -#define IMAGE_REL_IA64_DIR64 0x0005 -#define IMAGE_REL_IA64_PCREL21B 0x0006 -#define IMAGE_REL_IA64_PCREL21M 0x0007 -#define IMAGE_REL_IA64_PCREL21F 0x0008 -#define IMAGE_REL_IA64_GPREL22 0x0009 -#define IMAGE_REL_IA64_LTOFF22 0x000A -#define IMAGE_REL_IA64_SECTION 0x000B -#define IMAGE_REL_IA64_SECREL22 0x000C -#define IMAGE_REL_IA64_SECREL64I 0x000D -#define IMAGE_REL_IA64_SECREL32 0x000E - -#define IMAGE_REL_IA64_DIR32NB 0x0010 -#define IMAGE_REL_IA64_SREL14 0x0011 -#define IMAGE_REL_IA64_SREL22 0x0012 -#define IMAGE_REL_IA64_SREL32 0x0013 -#define IMAGE_REL_IA64_UREL32 0x0014 -#define IMAGE_REL_IA64_PCREL60X 0x0015 -#define IMAGE_REL_IA64_PCREL60B 0x0016 -#define IMAGE_REL_IA64_PCREL60F 0x0017 -#define IMAGE_REL_IA64_PCREL60I 0x0018 -#define IMAGE_REL_IA64_PCREL60M 0x0019 -#define IMAGE_REL_IA64_IMMGPREL64 0x001A -#define IMAGE_REL_IA64_TOKEN 0x001B -#define IMAGE_REL_IA64_GPREL32 0x001C -#define IMAGE_REL_IA64_ADDEND 0x001F - -#define IMAGE_REL_CEF_ABSOLUTE 0x0000 -#define IMAGE_REL_CEF_ADDR32 0x0001 -#define IMAGE_REL_CEF_ADDR64 0x0002 -#define IMAGE_REL_CEF_ADDR32NB 0x0003 -#define IMAGE_REL_CEF_SECTION 0x0004 -#define IMAGE_REL_CEF_SECREL 0x0005 -#define IMAGE_REL_CEF_TOKEN 0x0006 - -#define IMAGE_REL_CEE_ABSOLUTE 0x0000 -#define IMAGE_REL_CEE_ADDR32 0x0001 -#define IMAGE_REL_CEE_ADDR64 0x0002 -#define IMAGE_REL_CEE_ADDR32NB 0x0003 -#define IMAGE_REL_CEE_SECTION 0x0004 -#define IMAGE_REL_CEE_SECREL 0x0005 -#define IMAGE_REL_CEE_TOKEN 0x0006 - -#define IMAGE_REL_M32R_ABSOLUTE 0x0000 -#define IMAGE_REL_M32R_ADDR32 0x0001 -#define IMAGE_REL_M32R_ADDR32NB 0x0002 -#define IMAGE_REL_M32R_ADDR24 0x0003 -#define IMAGE_REL_M32R_GPREL16 0x0004 -#define IMAGE_REL_M32R_PCREL24 0x0005 -#define IMAGE_REL_M32R_PCREL16 0x0006 -#define IMAGE_REL_M32R_PCREL8 0x0007 -#define IMAGE_REL_M32R_REFHALF 0x0008 -#define IMAGE_REL_M32R_REFHI 0x0009 -#define IMAGE_REL_M32R_REFLO 0x000A -#define IMAGE_REL_M32R_PAIR 0x000B -#define IMAGE_REL_M32R_SECTION 0x000C -#define IMAGE_REL_M32R_SECREL32 0x000D -#define IMAGE_REL_M32R_TOKEN 0x000E - -#define EXT_IMM64(Value,Address,Size,InstPos,ValPos) Value |= (((ULONGLONG)((*(Address) >> InstPos) & (((ULONGLONG)1 << Size) - 1))) << ValPos) -#define INS_IMM64(Value,Address,Size,InstPos,ValPos) *(PDWORD)Address = (*(PDWORD)Address & ~(((1 << Size) - 1) << InstPos)) | ((DWORD)((((ULONGLONG)Value >> ValPos) & (((ULONGLONG)1 << Size) - 1))) << InstPos) - -#define EMARCH_ENC_I17_IMM7B_INST_WORD_X 3 -#define EMARCH_ENC_I17_IMM7B_SIZE_X 7 -#define EMARCH_ENC_I17_IMM7B_INST_WORD_POS_X 4 -#define EMARCH_ENC_I17_IMM7B_VAL_POS_X 0 - -#define EMARCH_ENC_I17_IMM9D_INST_WORD_X 3 -#define EMARCH_ENC_I17_IMM9D_SIZE_X 9 -#define EMARCH_ENC_I17_IMM9D_INST_WORD_POS_X 18 -#define EMARCH_ENC_I17_IMM9D_VAL_POS_X 7 - -#define EMARCH_ENC_I17_IMM5C_INST_WORD_X 3 -#define EMARCH_ENC_I17_IMM5C_SIZE_X 5 -#define EMARCH_ENC_I17_IMM5C_INST_WORD_POS_X 13 -#define EMARCH_ENC_I17_IMM5C_VAL_POS_X 16 - -#define EMARCH_ENC_I17_IC_INST_WORD_X 3 -#define EMARCH_ENC_I17_IC_SIZE_X 1 -#define EMARCH_ENC_I17_IC_INST_WORD_POS_X 12 -#define EMARCH_ENC_I17_IC_VAL_POS_X 21 - -#define EMARCH_ENC_I17_IMM41a_INST_WORD_X 1 -#define EMARCH_ENC_I17_IMM41a_SIZE_X 10 -#define EMARCH_ENC_I17_IMM41a_INST_WORD_POS_X 14 -#define EMARCH_ENC_I17_IMM41a_VAL_POS_X 22 - -#define EMARCH_ENC_I17_IMM41b_INST_WORD_X 1 -#define EMARCH_ENC_I17_IMM41b_SIZE_X 8 -#define EMARCH_ENC_I17_IMM41b_INST_WORD_POS_X 24 -#define EMARCH_ENC_I17_IMM41b_VAL_POS_X 32 - -#define EMARCH_ENC_I17_IMM41c_INST_WORD_X 2 -#define EMARCH_ENC_I17_IMM41c_SIZE_X 23 -#define EMARCH_ENC_I17_IMM41c_INST_WORD_POS_X 0 -#define EMARCH_ENC_I17_IMM41c_VAL_POS_X 40 - -#define EMARCH_ENC_I17_SIGN_INST_WORD_X 3 -#define EMARCH_ENC_I17_SIGN_SIZE_X 1 -#define EMARCH_ENC_I17_SIGN_INST_WORD_POS_X 27 -#define EMARCH_ENC_I17_SIGN_VAL_POS_X 63 - -#define X3_OPCODE_INST_WORD_X 3 -#define X3_OPCODE_SIZE_X 4 -#define X3_OPCODE_INST_WORD_POS_X 28 -#define X3_OPCODE_SIGN_VAL_POS_X 0 - -#define X3_I_INST_WORD_X 3 -#define X3_I_SIZE_X 1 -#define X3_I_INST_WORD_POS_X 27 -#define X3_I_SIGN_VAL_POS_X 59 - -#define X3_D_WH_INST_WORD_X 3 -#define X3_D_WH_SIZE_X 3 -#define X3_D_WH_INST_WORD_POS_X 24 -#define X3_D_WH_SIGN_VAL_POS_X 0 - -#define X3_IMM20_INST_WORD_X 3 -#define X3_IMM20_SIZE_X 20 -#define X3_IMM20_INST_WORD_POS_X 4 -#define X3_IMM20_SIGN_VAL_POS_X 0 - -#define X3_IMM39_1_INST_WORD_X 2 -#define X3_IMM39_1_SIZE_X 23 -#define X3_IMM39_1_INST_WORD_POS_X 0 -#define X3_IMM39_1_SIGN_VAL_POS_X 36 - -#define X3_IMM39_2_INST_WORD_X 1 -#define X3_IMM39_2_SIZE_X 16 -#define X3_IMM39_2_INST_WORD_POS_X 16 -#define X3_IMM39_2_SIGN_VAL_POS_X 20 - -#define X3_P_INST_WORD_X 3 -#define X3_P_SIZE_X 4 -#define X3_P_INST_WORD_POS_X 0 -#define X3_P_SIGN_VAL_POS_X 0 - -#define X3_TMPLT_INST_WORD_X 0 -#define X3_TMPLT_SIZE_X 4 -#define X3_TMPLT_INST_WORD_POS_X 0 -#define X3_TMPLT_SIGN_VAL_POS_X 0 - -#define X3_BTYPE_QP_INST_WORD_X 2 -#define X3_BTYPE_QP_SIZE_X 9 -#define X3_BTYPE_QP_INST_WORD_POS_X 23 -#define X3_BTYPE_QP_INST_VAL_POS_X 0 - -#define X3_EMPTY_INST_WORD_X 1 -#define X3_EMPTY_SIZE_X 2 -#define X3_EMPTY_INST_WORD_POS_X 14 -#define X3_EMPTY_INST_VAL_POS_X 0 - - typedef struct _IMAGE_LINENUMBER { - union { - DWORD SymbolTableIndex; - DWORD VirtualAddress; - } Type; - WORD Linenumber; - } IMAGE_LINENUMBER; - typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER; - -#define IMAGE_SIZEOF_LINENUMBER 6 - -#include "poppack.h" - - typedef struct _IMAGE_BASE_RELOCATION { - DWORD VirtualAddress; - DWORD SizeOfBlock; - - } IMAGE_BASE_RELOCATION; - typedef IMAGE_BASE_RELOCATION UNALIGNED *PIMAGE_BASE_RELOCATION; - -#define IMAGE_SIZEOF_BASE_RELOCATION 8 - -#define IMAGE_REL_BASED_ABSOLUTE 0 -#define IMAGE_REL_BASED_HIGH 1 -#define IMAGE_REL_BASED_LOW 2 -#define IMAGE_REL_BASED_HIGHLOW 3 -#define IMAGE_REL_BASED_HIGHADJ 4 -#define IMAGE_REL_BASED_MIPS_JMPADDR 5 -#define IMAGE_REL_BASED_MIPS_JMPADDR16 9 -#define IMAGE_REL_BASED_IA64_IMM64 9 -#define IMAGE_REL_BASED_DIR64 10 - -#define IMAGE_ARCHIVE_START_SIZE 8 -#define IMAGE_ARCHIVE_START "!\n" -#define IMAGE_ARCHIVE_END "`\n" -#define IMAGE_ARCHIVE_PAD "\n" -#define IMAGE_ARCHIVE_LINKER_MEMBER "/ " -#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " - - typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { - BYTE Name[16]; - BYTE Date[12]; - BYTE UserID[6]; - BYTE GroupID[6]; - BYTE Mode[8]; - BYTE Size[10]; - BYTE EndHeader[2]; - } IMAGE_ARCHIVE_MEMBER_HEADER,*PIMAGE_ARCHIVE_MEMBER_HEADER; - -#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 - - typedef struct _IMAGE_EXPORT_DIRECTORY { - DWORD Characteristics; - DWORD TimeDateStamp; - WORD MajorVersion; - WORD MinorVersion; - DWORD Name; - DWORD Base; - DWORD NumberOfFunctions; - DWORD NumberOfNames; - DWORD AddressOfFunctions; - DWORD AddressOfNames; - DWORD AddressOfNameOrdinals; - } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY; - - typedef struct _IMAGE_IMPORT_BY_NAME { - WORD Hint; - BYTE Name[1]; - } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME; - -#include "pshpack8.h" - - typedef struct _IMAGE_THUNK_DATA64 { - union { - ULONGLONG ForwarderString; - ULONGLONG Function; - ULONGLONG Ordinal; - ULONGLONG AddressOfData; - } u1; - } IMAGE_THUNK_DATA64; - typedef IMAGE_THUNK_DATA64 *PIMAGE_THUNK_DATA64; - -#include "poppack.h" - - typedef struct _IMAGE_THUNK_DATA32 { - union { - DWORD ForwarderString; - DWORD Function; - DWORD Ordinal; - DWORD AddressOfData; - } u1; - } IMAGE_THUNK_DATA32; - typedef IMAGE_THUNK_DATA32 *PIMAGE_THUNK_DATA32; - -#define IMAGE_ORDINAL_FLAG64 0x8000000000000000ull -#define IMAGE_ORDINAL_FLAG32 0x80000000 -#define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffffull) -#define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff) -#define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64)!=0) -#define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32)!=0) - - typedef VOID - (NTAPI *PIMAGE_TLS_CALLBACK)(PVOID DllHandle,DWORD Reason,PVOID Reserved); - - typedef struct _IMAGE_TLS_DIRECTORY64 { - ULONGLONG StartAddressOfRawData; - ULONGLONG EndAddressOfRawData; - ULONGLONG AddressOfIndex; - ULONGLONG AddressOfCallBacks; - DWORD SizeOfZeroFill; - DWORD Characteristics; - } IMAGE_TLS_DIRECTORY64; - typedef IMAGE_TLS_DIRECTORY64 *PIMAGE_TLS_DIRECTORY64; - - typedef struct _IMAGE_TLS_DIRECTORY32 { - DWORD StartAddressOfRawData; - DWORD EndAddressOfRawData; - DWORD AddressOfIndex; - DWORD AddressOfCallBacks; - DWORD SizeOfZeroFill; - DWORD Characteristics; - } IMAGE_TLS_DIRECTORY32; - typedef IMAGE_TLS_DIRECTORY32 *PIMAGE_TLS_DIRECTORY32; - -#ifdef _WIN64 -#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64 -#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal) - typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; - typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA; -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal) - typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; - typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY; -#else -#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32 -#define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal) - typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA; - typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA; -#define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal) - typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY; - typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY; -#endif - - typedef struct _IMAGE_IMPORT_DESCRIPTOR { - union { - DWORD Characteristics; - DWORD OriginalFirstThunk; - }; - DWORD TimeDateStamp; - - DWORD ForwarderChain; - DWORD Name; - DWORD FirstThunk; - } IMAGE_IMPORT_DESCRIPTOR; - typedef IMAGE_IMPORT_DESCRIPTOR UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR; - - typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR { - DWORD TimeDateStamp; - WORD OffsetModuleName; - WORD NumberOfModuleForwarderRefs; - } IMAGE_BOUND_IMPORT_DESCRIPTOR,*PIMAGE_BOUND_IMPORT_DESCRIPTOR; - - typedef struct _IMAGE_BOUND_FORWARDER_REF { - DWORD TimeDateStamp; - WORD OffsetModuleName; - WORD Reserved; - } IMAGE_BOUND_FORWARDER_REF,*PIMAGE_BOUND_FORWARDER_REF; - - typedef struct _IMAGE_RESOURCE_DIRECTORY { - DWORD Characteristics; - DWORD TimeDateStamp; - WORD MajorVersion; - WORD MinorVersion; - WORD NumberOfNamedEntries; - WORD NumberOfIdEntries; - } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY; - -#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000 -#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000 - - typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { - union { - struct { - DWORD NameOffset:31; - DWORD NameIsString:1; - }; - DWORD Name; - WORD Id; - }; - union { - DWORD OffsetToData; - struct { - DWORD OffsetToDirectory:31; - DWORD DataIsDirectory:1; - }; - }; - } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY; - - typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { - WORD Length; - CHAR NameString[1]; - } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING; - - typedef struct _IMAGE_RESOURCE_DIR_STRING_U { - WORD Length; - WCHAR NameString[1]; - } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U; - - typedef struct _IMAGE_RESOURCE_DATA_ENTRY { - DWORD OffsetToData; - DWORD Size; - DWORD CodePage; - DWORD Reserved; - } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY; - - typedef struct { - DWORD Size; - DWORD TimeDateStamp; - WORD MajorVersion; - WORD MinorVersion; - DWORD GlobalFlagsClear; - DWORD GlobalFlagsSet; - DWORD CriticalSectionDefaultTimeout; - DWORD DeCommitFreeBlockThreshold; - DWORD DeCommitTotalFreeThreshold; - DWORD LockPrefixTable; - DWORD MaximumAllocationSize; - DWORD VirtualMemoryThreshold; - DWORD ProcessHeapFlags; - DWORD ProcessAffinityMask; - WORD CSDVersion; - WORD Reserved1; - DWORD EditList; - DWORD SecurityCookie; - DWORD SEHandlerTable; - DWORD SEHandlerCount; - } IMAGE_LOAD_CONFIG_DIRECTORY32,*PIMAGE_LOAD_CONFIG_DIRECTORY32; - - typedef struct { - DWORD Size; - DWORD TimeDateStamp; - WORD MajorVersion; - WORD MinorVersion; - DWORD GlobalFlagsClear; - DWORD GlobalFlagsSet; - DWORD CriticalSectionDefaultTimeout; - ULONGLONG DeCommitFreeBlockThreshold; - ULONGLONG DeCommitTotalFreeThreshold; - ULONGLONG LockPrefixTable; - ULONGLONG MaximumAllocationSize; - ULONGLONG VirtualMemoryThreshold; - ULONGLONG ProcessAffinityMask; - DWORD ProcessHeapFlags; - WORD CSDVersion; - WORD Reserved1; - ULONGLONG EditList; - ULONGLONG SecurityCookie; - ULONGLONG SEHandlerTable; - ULONGLONG SEHandlerCount; - } IMAGE_LOAD_CONFIG_DIRECTORY64,*PIMAGE_LOAD_CONFIG_DIRECTORY64; - -#ifdef _WIN64 - typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY; - typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY; -#else - typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY; - typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY; -#endif - - typedef struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY { - DWORD FuncStart; - DWORD PrologLen : 8; - DWORD FuncLen : 22; - DWORD ThirtyTwoBit : 1; - DWORD ExceptionFlag : 1; - } IMAGE_CE_RUNTIME_FUNCTION_ENTRY,*PIMAGE_CE_RUNTIME_FUNCTION_ENTRY; - - typedef struct _IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY { - ULONGLONG BeginAddress; - ULONGLONG EndAddress; - ULONGLONG ExceptionHandler; - ULONGLONG HandlerData; - ULONGLONG PrologEndAddress; - } IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY; - - typedef struct _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY { - DWORD BeginAddress; - DWORD EndAddress; - DWORD ExceptionHandler; - DWORD HandlerData; - DWORD PrologEndAddress; - } IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY,*PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY; - - typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { - DWORD BeginAddress; - DWORD EndAddress; - DWORD UnwindInfoAddress; - } _IMAGE_RUNTIME_FUNCTION_ENTRY,*_PIMAGE_RUNTIME_FUNCTION_ENTRY; - - typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_IA64_RUNTIME_FUNCTION_ENTRY; - typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY; - - typedef _IMAGE_RUNTIME_FUNCTION_ENTRY IMAGE_RUNTIME_FUNCTION_ENTRY; - typedef _PIMAGE_RUNTIME_FUNCTION_ENTRY PIMAGE_RUNTIME_FUNCTION_ENTRY; - - typedef struct _IMAGE_DEBUG_DIRECTORY { - DWORD Characteristics; - DWORD TimeDateStamp; - WORD MajorVersion; - WORD MinorVersion; - DWORD Type; - DWORD SizeOfData; - DWORD AddressOfRawData; - DWORD PointerToRawData; - } IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY; - -#define IMAGE_DEBUG_TYPE_UNKNOWN 0 -#define IMAGE_DEBUG_TYPE_COFF 1 -#define IMAGE_DEBUG_TYPE_CODEVIEW 2 -#define IMAGE_DEBUG_TYPE_FPO 3 -#define IMAGE_DEBUG_TYPE_MISC 4 -#define IMAGE_DEBUG_TYPE_EXCEPTION 5 -#define IMAGE_DEBUG_TYPE_FIXUP 6 -#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7 -#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8 -#define IMAGE_DEBUG_TYPE_BORLAND 9 -#define IMAGE_DEBUG_TYPE_RESERVED10 10 -#define IMAGE_DEBUG_TYPE_CLSID 11 - - typedef struct _IMAGE_COFF_SYMBOLS_HEADER { - DWORD NumberOfSymbols; - DWORD LvaToFirstSymbol; - DWORD NumberOfLinenumbers; - DWORD LvaToFirstLinenumber; - DWORD RvaToFirstByteOfCode; - DWORD RvaToLastByteOfCode; - DWORD RvaToFirstByteOfData; - DWORD RvaToLastByteOfData; - } IMAGE_COFF_SYMBOLS_HEADER,*PIMAGE_COFF_SYMBOLS_HEADER; - -#define FRAME_FPO 0 -#define FRAME_TRAP 1 -#define FRAME_TSS 2 -#define FRAME_NONFPO 3 - - typedef struct _FPO_DATA { - DWORD ulOffStart; - DWORD cbProcSize; - DWORD cdwLocals; - WORD cdwParams; - WORD cbProlog : 8; - WORD cbRegs : 3; - WORD fHasSEH : 1; - WORD fUseBP : 1; - WORD reserved : 1; - WORD cbFrame : 2; - } FPO_DATA,*PFPO_DATA; -#define SIZEOF_RFPO_DATA 16 - -#define IMAGE_DEBUG_MISC_EXENAME 1 - - typedef struct _IMAGE_DEBUG_MISC { - DWORD DataType; - DWORD Length; - BOOLEAN Unicode; - BYTE Reserved[3]; - BYTE Data[1]; - } IMAGE_DEBUG_MISC,*PIMAGE_DEBUG_MISC; - - typedef struct _IMAGE_FUNCTION_ENTRY { - DWORD StartingAddress; - DWORD EndingAddress; - DWORD EndOfPrologue; - } IMAGE_FUNCTION_ENTRY,*PIMAGE_FUNCTION_ENTRY; - - typedef struct _IMAGE_FUNCTION_ENTRY64 { - ULONGLONG StartingAddress; - ULONGLONG EndingAddress; - union { - ULONGLONG EndOfPrologue; - ULONGLONG UnwindInfoAddress; - }; - } IMAGE_FUNCTION_ENTRY64,*PIMAGE_FUNCTION_ENTRY64; - - typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { - WORD Signature; - WORD Flags; - WORD Machine; - WORD Characteristics; - DWORD TimeDateStamp; - DWORD CheckSum; - DWORD ImageBase; - DWORD SizeOfImage; - DWORD NumberOfSections; - DWORD ExportedNamesSize; - DWORD DebugDirectorySize; - DWORD SectionAlignment; - DWORD Reserved[2]; - } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER; - - typedef struct _NON_PAGED_DEBUG_INFO { - WORD Signature; - WORD Flags; - DWORD Size; - WORD Machine; - WORD Characteristics; - DWORD TimeDateStamp; - DWORD CheckSum; - DWORD SizeOfImage; - ULONGLONG ImageBase; - - } NON_PAGED_DEBUG_INFO,*PNON_PAGED_DEBUG_INFO; - -#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 -#define NON_PAGED_DEBUG_SIGNATURE 0x494E - -#define IMAGE_SEPARATE_DEBUG_FLAGS_MASK 0x8000 -#define IMAGE_SEPARATE_DEBUG_MISMATCH 0x8000 - - typedef struct _ImageArchitectureHeader { - unsigned int AmaskValue: 1; - int Adummy1 :7; - unsigned int AmaskShift: 8; - int Adummy2 :16; - DWORD FirstEntryRVA; - } IMAGE_ARCHITECTURE_HEADER,*PIMAGE_ARCHITECTURE_HEADER; - - typedef struct _ImageArchitectureEntry { - DWORD FixupInstRVA; - DWORD NewInst; - } IMAGE_ARCHITECTURE_ENTRY,*PIMAGE_ARCHITECTURE_ENTRY; - -#include "poppack.h" - -#define IMPORT_OBJECT_HDR_SIG2 0xffff - - typedef struct IMPORT_OBJECT_HEADER { - WORD Sig1; - WORD Sig2; - WORD Version; - WORD Machine; - DWORD TimeDateStamp; - DWORD SizeOfData; - union { - WORD Ordinal; - WORD Hint; - }; - WORD Type : 2; - WORD NameType : 3; - WORD Reserved : 11; - } IMPORT_OBJECT_HEADER; - - typedef enum IMPORT_OBJECT_TYPE { - IMPORT_OBJECT_CODE = 0,IMPORT_OBJECT_DATA = 1,IMPORT_OBJECT_CONST = 2 - } IMPORT_OBJECT_TYPE; - - typedef enum IMPORT_OBJECT_NAME_TYPE { - IMPORT_OBJECT_ORDINAL = 0,IMPORT_OBJECT_NAME = 1,IMPORT_OBJECT_NAME_NO_PREFIX = 2,IMPORT_OBJECT_NAME_UNDECORATE = 3 - } IMPORT_OBJECT_NAME_TYPE; - -#ifndef __IMAGE_COR20_HEADER_DEFINED__ -#define __IMAGE_COR20_HEADER_DEFINED__ - typedef enum ReplacesCorHdrNumericDefines { - COMIMAGE_FLAGS_ILONLY =0x00000001,COMIMAGE_FLAGS_32BITREQUIRED =0x00000002,COMIMAGE_FLAGS_IL_LIBRARY =0x00000004, - COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008,COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000,COR_VERSION_MAJOR_V2 =2, - COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2,COR_VERSION_MINOR =0,COR_DELETED_NAME_LENGTH =8,COR_VTABLEGAP_NAME_LENGTH =8, - NATIVE_TYPE_MAX_CB =1,COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF,IMAGE_COR_MIH_METHODRVA =0x01,IMAGE_COR_MIH_EHRVA =0x02, - IMAGE_COR_MIH_BASICBLOCK =0x08,COR_VTABLE_32BIT =0x01,COR_VTABLE_64BIT =0x02,COR_VTABLE_FROM_UNMANAGED =0x04, - COR_VTABLE_CALL_MOST_DERIVED =0x10,IMAGE_COR_EATJ_THUNK_SIZE =32,MAX_CLASS_NAME =1024,MAX_PACKAGE_NAME =1024 - } ReplacesCorHdrNumericDefines; - - typedef struct IMAGE_COR20_HEADER { - DWORD cb; - WORD MajorRuntimeVersion; - WORD MinorRuntimeVersion; - IMAGE_DATA_DIRECTORY MetaData; - DWORD Flags; - DWORD EntryPointToken; - IMAGE_DATA_DIRECTORY Resources; - IMAGE_DATA_DIRECTORY StrongNameSignature; - IMAGE_DATA_DIRECTORY CodeManagerTable; - IMAGE_DATA_DIRECTORY VTableFixups; - IMAGE_DATA_DIRECTORY ExportAddressTableJumps; - IMAGE_DATA_DIRECTORY ManagedNativeHeader; - } IMAGE_COR20_HEADER,*PIMAGE_COR20_HEADER; -#endif - -#if defined (__x86_64) - NTSYSAPI PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry (DWORD64 ControlPc, PDWORD64 ImageBase, PUNWIND_HISTORY_TABLE HistoryTable); - NTSYSAPI VOID NTAPI RtlUnwindEx (PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable); -#endif - -#include - -#ifndef _SLIST_HEADER_ -#define _SLIST_HEADER_ - -#ifdef _WIN64 - typedef struct _SLIST_ENTRY *PSLIST_ENTRY; - typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY { - PSLIST_ENTRY Next; - } SLIST_ENTRY; -#else - -#define SLIST_ENTRY SINGLE_LIST_ENTRY -#define _SLIST_ENTRY _SINGLE_LIST_ENTRY -#define PSLIST_ENTRY PSINGLE_LIST_ENTRY -#endif - -#if defined(_WIN64) - - typedef struct DECLSPEC_ALIGN(16) _SLIST_HEADER { - ULONGLONG Alignment; - ULONGLONG Region; - } SLIST_HEADER; - - typedef struct _SLIST_HEADER *PSLIST_HEADER; -#else - - typedef union _SLIST_HEADER { - ULONGLONG Alignment; - struct { - SLIST_ENTRY Next; - WORD Depth; - WORD Sequence; - }; - } SLIST_HEADER,*PSLIST_HEADER; -#endif -#endif - - NTSYSAPI VOID NTAPI RtlInitializeSListHead(PSLIST_HEADER ListHead); - NTSYSAPI PSLIST_ENTRY NTAPI RtlFirstEntrySList(const SLIST_HEADER *ListHead); - NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPopEntrySList(PSLIST_HEADER ListHead); - NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedPushEntrySList(PSLIST_HEADER ListHead,PSLIST_ENTRY ListEntry); - NTSYSAPI PSLIST_ENTRY NTAPI RtlInterlockedFlushSList(PSLIST_HEADER ListHead); - NTSYSAPI WORD NTAPI RtlQueryDepthSList(PSLIST_HEADER ListHead); - -#define HEAP_NO_SERIALIZE 0x00000001 -#define HEAP_GROWABLE 0x00000002 -#define HEAP_GENERATE_EXCEPTIONS 0x00000004 -#define HEAP_ZERO_MEMORY 0x00000008 -#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010 -#define HEAP_TAIL_CHECKING_ENABLED 0x00000020 -#define HEAP_FREE_CHECKING_ENABLED 0x00000040 -#define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 -#define HEAP_CREATE_ALIGN_16 0x00010000 -#define HEAP_CREATE_ENABLE_TRACING 0x00020000 -#define HEAP_CREATE_ENABLE_EXECUTE 0x00040000 -#define HEAP_MAXIMUM_TAG 0x0FFF -#define HEAP_PSEUDO_TAG_FLAG 0x8000 -#define HEAP_TAG_SHIFT 18 -#define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b) + ((o) << 18))) - - NTSYSAPI VOID NTAPI RtlCaptureContext(PCONTEXT ContextRecord); - -#define IS_TEXT_UNICODE_ASCII16 0x0001 -#define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010 - -#define IS_TEXT_UNICODE_STATISTICS 0x0002 -#define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020 - -#define IS_TEXT_UNICODE_CONTROLS 0x0004 -#define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040 - -#define IS_TEXT_UNICODE_SIGNATURE 0x0008 -#define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080 - -#define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100 -#define IS_TEXT_UNICODE_ODD_LENGTH 0x0200 -#define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400 -#define IS_TEXT_UNICODE_NULL_BYTES 0x1000 - -#define IS_TEXT_UNICODE_UNICODE_MASK 0x000F -#define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0 -#define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00 -#define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000 - -#define COMPRESSION_FORMAT_NONE (0x0000) -#define COMPRESSION_FORMAT_DEFAULT (0x0001) -#define COMPRESSION_FORMAT_LZNT1 (0x0002) -#define COMPRESSION_ENGINE_STANDARD (0x0000) -#define COMPRESSION_ENGINE_MAXIMUM (0x0100) -#define COMPRESSION_ENGINE_HIBER (0x0200) - -#if _DBG_MEMCPY_INLINE_ && !defined(_MEMCPY_INLINE_) && !defined(_CRTBLD) -#define _MEMCPY_INLINE_ - __CRT_INLINE PVOID __cdecl memcpy_inline(void *dst,const void *src,size_t size) { - if(((char *)dst > (char *)src) && ((char *)dst < ((char *)src + size))) { - __debugbreak(); - } - return memcpy(dst,src,size); - } -#define memcpy memcpy_inline -#endif - - NTSYSAPI SIZE_T NTAPI RtlCompareMemory(const VOID *Source1,const VOID *Source2,SIZE_T Length); - -#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))) -#define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length)) -#define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) -#define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) -#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length)) - - __CRT_INLINE PVOID RtlSecureZeroMemory(PVOID ptr,SIZE_T cnt) { - volatile char *vptr =(volatile char *)ptr; -#ifdef __x86_64 - __stosb((PBYTE)((DWORD64)vptr),0,cnt); -#else - while(cnt) { - *vptr = 0; - vptr++; - cnt--; - } -#endif - return ptr; - } - - typedef struct _MESSAGE_RESOURCE_ENTRY { - WORD Length; - WORD Flags; - BYTE Text[1]; - } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY; - -#define MESSAGE_RESOURCE_UNICODE 0x0001 - - typedef struct _MESSAGE_RESOURCE_BLOCK { - DWORD LowId; - DWORD HighId; - DWORD OffsetToEntries; - } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK; - - typedef struct _MESSAGE_RESOURCE_DATA { - DWORD NumberOfBlocks; - MESSAGE_RESOURCE_BLOCK Blocks[1]; - } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA; - - typedef struct _OSVERSIONINFOA { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - CHAR szCSDVersion[128]; - } OSVERSIONINFOA,*POSVERSIONINFOA,*LPOSVERSIONINFOA; - - typedef struct _OSVERSIONINFOW { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - WCHAR szCSDVersion[128]; - } OSVERSIONINFOW,*POSVERSIONINFOW,*LPOSVERSIONINFOW,RTL_OSVERSIONINFOW,*PRTL_OSVERSIONINFOW; - -#ifdef UNICODE - typedef OSVERSIONINFOW OSVERSIONINFO; - typedef POSVERSIONINFOW POSVERSIONINFO; - typedef LPOSVERSIONINFOW LPOSVERSIONINFO; -#else - typedef OSVERSIONINFOA OSVERSIONINFO; - typedef POSVERSIONINFOA POSVERSIONINFO; - typedef LPOSVERSIONINFOA LPOSVERSIONINFO; -#endif - - typedef struct _OSVERSIONINFOEXA { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - CHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; - } OSVERSIONINFOEXA,*POSVERSIONINFOEXA,*LPOSVERSIONINFOEXA; - - typedef struct _OSVERSIONINFOEXW { - DWORD dwOSVersionInfoSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - DWORD dwPlatformId; - WCHAR szCSDVersion[128]; - WORD wServicePackMajor; - WORD wServicePackMinor; - WORD wSuiteMask; - BYTE wProductType; - BYTE wReserved; - } OSVERSIONINFOEXW,*POSVERSIONINFOEXW,*LPOSVERSIONINFOEXW,RTL_OSVERSIONINFOEXW,*PRTL_OSVERSIONINFOEXW; -#ifdef UNICODE - typedef OSVERSIONINFOEXW OSVERSIONINFOEX; - typedef POSVERSIONINFOEXW POSVERSIONINFOEX; - typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX; -#else - typedef OSVERSIONINFOEXA OSVERSIONINFOEX; - typedef POSVERSIONINFOEXA POSVERSIONINFOEX; - typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX; -#endif - -#define VER_EQUAL 1 -#define VER_GREATER 2 -#define VER_GREATER_EQUAL 3 -#define VER_LESS 4 -#define VER_LESS_EQUAL 5 -#define VER_AND 6 -#define VER_OR 7 - -#define VER_CONDITION_MASK 7 -#define VER_NUM_BITS_PER_CONDITION_MASK 3 - -#define VER_MINORVERSION 0x0000001 -#define VER_MAJORVERSION 0x0000002 -#define VER_BUILDNUMBER 0x0000004 -#define VER_PLATFORMID 0x0000008 -#define VER_SERVICEPACKMINOR 0x0000010 -#define VER_SERVICEPACKMAJOR 0x0000020 -#define VER_SUITENAME 0x0000040 -#define VER_PRODUCT_TYPE 0x0000080 - -#define VER_NT_WORKSTATION 0x0000001 -#define VER_NT_DOMAIN_CONTROLLER 0x0000002 -#define VER_NT_SERVER 0x0000003 - -#define VER_PLATFORM_WIN32s 0 -#define VER_PLATFORM_WIN32_WINDOWS 1 -#define VER_PLATFORM_WIN32_NT 2 - -#define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_))) - - NTSYSAPI ULONGLONG NTAPI VerSetConditionMask(ULONGLONG ConditionMask,DWORD TypeMask,BYTE Condition); - - typedef struct _RTL_CRITICAL_SECTION_DEBUG { - WORD Type; - WORD CreatorBackTraceIndex; - struct _RTL_CRITICAL_SECTION *CriticalSection; - LIST_ENTRY ProcessLocksList; - DWORD EntryCount; - DWORD ContentionCount; - DWORD Spare[2]; - } RTL_CRITICAL_SECTION_DEBUG,*PRTL_CRITICAL_SECTION_DEBUG,RTL_RESOURCE_DEBUG,*PRTL_RESOURCE_DEBUG; - -#define RTL_CRITSECT_TYPE 0 -#define RTL_RESOURCE_TYPE 1 - - typedef struct _RTL_CRITICAL_SECTION { - PRTL_CRITICAL_SECTION_DEBUG DebugInfo; - LONG LockCount; - LONG RecursionCount; - HANDLE OwningThread; - HANDLE LockSemaphore; - ULONG_PTR SpinCount; - } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION; - - typedef VOID (NTAPI *RTL_VERIFIER_DLL_LOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved); - typedef VOID (NTAPI *RTL_VERIFIER_DLL_UNLOAD_CALLBACK) (PWSTR DllName,PVOID DllBase,SIZE_T DllSize,PVOID Reserved); - typedef VOID (NTAPI *RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK)(PVOID AllocationBase,SIZE_T AllocationSize); - - typedef struct _RTL_VERIFIER_THUNK_DESCRIPTOR { - PCHAR ThunkName; - PVOID ThunkOldAddress; - PVOID ThunkNewAddress; - } RTL_VERIFIER_THUNK_DESCRIPTOR,*PRTL_VERIFIER_THUNK_DESCRIPTOR; - - typedef struct _RTL_VERIFIER_DLL_DESCRIPTOR { - PWCHAR DllName; - DWORD DllFlags; - PVOID DllAddress; - PRTL_VERIFIER_THUNK_DESCRIPTOR DllThunks; - } RTL_VERIFIER_DLL_DESCRIPTOR,*PRTL_VERIFIER_DLL_DESCRIPTOR; - - typedef struct _RTL_VERIFIER_PROVIDER_DESCRIPTOR { - DWORD Length; - PRTL_VERIFIER_DLL_DESCRIPTOR ProviderDlls; - RTL_VERIFIER_DLL_LOAD_CALLBACK ProviderDllLoadCallback; - RTL_VERIFIER_DLL_UNLOAD_CALLBACK ProviderDllUnloadCallback; - PWSTR VerifierImage; - DWORD VerifierFlags; - DWORD VerifierDebug; - PVOID RtlpGetStackTraceAddress; - PVOID RtlpDebugPageHeapCreate; - PVOID RtlpDebugPageHeapDestroy; - RTL_VERIFIER_NTDLLHEAPFREE_CALLBACK ProviderNtdllHeapFreeCallback; - } RTL_VERIFIER_PROVIDER_DESCRIPTOR,*PRTL_VERIFIER_PROVIDER_DESCRIPTOR; - -#define RTL_VRF_FLG_FULL_PAGE_HEAP 0x00000001 -#define RTL_VRF_FLG_RESERVED_DONOTUSE 0x00000002 -#define RTL_VRF_FLG_HANDLE_CHECKS 0x00000004 -#define RTL_VRF_FLG_STACK_CHECKS 0x00000008 -#define RTL_VRF_FLG_APPCOMPAT_CHECKS 0x00000010 -#define RTL_VRF_FLG_TLS_CHECKS 0x00000020 -#define RTL_VRF_FLG_DIRTY_STACKS 0x00000040 -#define RTL_VRF_FLG_RPC_CHECKS 0x00000080 -#define RTL_VRF_FLG_COM_CHECKS 0x00000100 -#define RTL_VRF_FLG_DANGEROUS_APIS 0x00000200 -#define RTL_VRF_FLG_RACE_CHECKS 0x00000400 -#define RTL_VRF_FLG_DEADLOCK_CHECKS 0x00000800 -#define RTL_VRF_FLG_FIRST_CHANCE_EXCEPTION_CHECKS 0x00001000 -#define RTL_VRF_FLG_VIRTUAL_MEM_CHECKS 0x00002000 -#define RTL_VRF_FLG_ENABLE_LOGGING 0x00004000 -#define RTL_VRF_FLG_FAST_FILL_HEAP 0x00008000 -#define RTL_VRF_FLG_VIRTUAL_SPACE_TRACKING 0x00010000 -#define RTL_VRF_FLG_ENABLED_SYSTEM_WIDE 0x00020000 -#define RTL_VRF_FLG_MISCELLANEOUS_CHECKS 0x00020000 -#define RTL_VRF_FLG_LOCK_CHECKS 0x00040000 - -#define APPLICATION_VERIFIER_INTERNAL_ERROR 0x80000000 -#define APPLICATION_VERIFIER_INTERNAL_WARNING 0x40000000 -#define APPLICATION_VERIFIER_NO_BREAK 0x20000000 -#define APPLICATION_VERIFIER_CONTINUABLE_BREAK 0x10000000 - -#define APPLICATION_VERIFIER_UNKNOWN_ERROR 0x0001 -#define APPLICATION_VERIFIER_ACCESS_VIOLATION 0x0002 -#define APPLICATION_VERIFIER_UNSYNCHRONIZED_ACCESS 0x0003 -#define APPLICATION_VERIFIER_EXTREME_SIZE_REQUEST 0x0004 -#define APPLICATION_VERIFIER_BAD_HEAP_HANDLE 0x0005 -#define APPLICATION_VERIFIER_SWITCHED_HEAP_HANDLE 0x0006 -#define APPLICATION_VERIFIER_DOUBLE_FREE 0x0007 -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK 0x0008 -#define APPLICATION_VERIFIER_DESTROY_PROCESS_HEAP 0x0009 -#define APPLICATION_VERIFIER_UNEXPECTED_EXCEPTION 0x000A -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_HEADER 0x000B -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_EXCEPTION_RAISED_FOR_PROBING 0x000C -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_HEADER 0x000D -#define APPLICATION_VERIFIER_CORRUPTED_FREED_HEAP_BLOCK 0x000E -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_SUFFIX 0x000F -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_START_STAMP 0x0010 -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_END_STAMP 0x0011 -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_BLOCK_PREFIX 0x0012 -#define APPLICATION_VERIFIER_FIRST_CHANCE_ACCESS_VIOLATION 0x0013 -#define APPLICATION_VERIFIER_CORRUPTED_HEAP_LIST 0x0014 - -#define APPLICATION_VERIFIER_TERMINATE_THREAD_CALL 0x0100 -#define APPLICATION_VERIFIER_STACK_OVERFLOW 0x0101 -#define APPLICATION_VERIFIER_INVALID_EXIT_PROCESS_CALL 0x0102 - -#define APPLICATION_VERIFIER_EXIT_THREAD_OWNS_LOCK 0x0200 -#define APPLICATION_VERIFIER_LOCK_IN_UNLOADED_DLL 0x0201 -#define APPLICATION_VERIFIER_LOCK_IN_FREED_HEAP 0x0202 -#define APPLICATION_VERIFIER_LOCK_DOUBLE_INITIALIZE 0x0203 -#define APPLICATION_VERIFIER_LOCK_IN_FREED_MEMORY 0x0204 -#define APPLICATION_VERIFIER_LOCK_CORRUPTED 0x0205 -#define APPLICATION_VERIFIER_LOCK_INVALID_OWNER 0x0206 -#define APPLICATION_VERIFIER_LOCK_INVALID_RECURSION_COUNT 0x0207 -#define APPLICATION_VERIFIER_LOCK_INVALID_LOCK_COUNT 0x0208 -#define APPLICATION_VERIFIER_LOCK_OVER_RELEASED 0x0209 -#define APPLICATION_VERIFIER_LOCK_NOT_INITIALIZED 0x0210 -#define APPLICATION_VERIFIER_LOCK_ALREADY_INITIALIZED 0x0211 -#define APPLICATION_VERIFIER_LOCK_IN_FREED_VMEM 0x0212 -#define APPLICATION_VERIFIER_LOCK_IN_UNMAPPED_MEM 0x0213 -#define APPLICATION_VERIFIER_THREAD_NOT_LOCK_OWNER 0x0214 - -#define APPLICATION_VERIFIER_INVALID_HANDLE 0x0300 -#define APPLICATION_VERIFIER_INVALID_TLS_VALUE 0x0301 -#define APPLICATION_VERIFIER_INCORRECT_WAIT_CALL 0x0302 -#define APPLICATION_VERIFIER_NULL_HANDLE 0x0303 -#define APPLICATION_VERIFIER_WAIT_IN_DLLMAIN 0x0304 - -#define APPLICATION_VERIFIER_COM_ERROR 0x0400 -#define APPLICATION_VERIFIER_COM_API_IN_DLLMAIN 0x0401 -#define APPLICATION_VERIFIER_COM_UNHANDLED_EXCEPTION 0x0402 -#define APPLICATION_VERIFIER_COM_UNBALANCED_COINIT 0x0403 -#define APPLICATION_VERIFIER_COM_UNBALANCED_OLEINIT 0x0404 -#define APPLICATION_VERIFIER_COM_UNBALANCED_SWC 0x0405 -#define APPLICATION_VERIFIER_COM_NULL_DACL 0x0406 -#define APPLICATION_VERIFIER_COM_UNSAFE_IMPERSONATION 0x0407 -#define APPLICATION_VERIFIER_COM_SMUGGLED_WRAPPER 0x0408 -#define APPLICATION_VERIFIER_COM_SMUGGLED_PROXY 0x0409 -#define APPLICATION_VERIFIER_COM_CF_SUCCESS_WITH_NULL 0x040A -#define APPLICATION_VERIFIER_COM_GCO_SUCCESS_WITH_NULL 0x040B -#define APPLICATION_VERIFIER_COM_OBJECT_IN_FREED_MEMORY 0x040C -#define APPLICATION_VERIFIER_COM_OBJECT_IN_UNLOADED_DLL 0x040D -#define APPLICATION_VERIFIER_COM_VTBL_IN_FREED_MEMORY 0x040E -#define APPLICATION_VERIFIER_COM_VTBL_IN_UNLOADED_DLL 0x040F -#define APPLICATION_VERIFIER_COM_HOLDING_LOCKS_ON_CALL 0x0410 - -#define APPLICATION_VERIFIER_RPC_ERROR 0x0500 - -#define APPLICATION_VERIFIER_INVALID_FREEMEM 0x0600 -#define APPLICATION_VERIFIER_INVALID_ALLOCMEM 0x0601 -#define APPLICATION_VERIFIER_INVALID_MAPVIEW 0x0602 -#define APPLICATION_VERIFIER_PROBE_INVALID_ADDRESS 0x0603 -#define APPLICATION_VERIFIER_PROBE_FREE_MEM 0x0604 -#define APPLICATION_VERIFIER_PROBE_GUARD_PAGE 0x0605 -#define APPLICATION_VERIFIER_PROBE_NULL 0x0606 -#define APPLICATION_VERIFIER_PROBE_INVALID_START_OR_SIZE 0x0607 -#define APPLICATION_VERIFIER_SIZE_HEAP_UNEXPECTED_EXCEPTION 0x0618 - -#define VERIFIER_STOP(Code,Msg,P1,S1,P2,S2,P3,S3,P4,S4) { RtlApplicationVerifierStop ((Code),(Msg),(ULONG_PTR)(P1),(S1),(ULONG_PTR)(P2),(S2),(ULONG_PTR)(P3),(S3),(ULONG_PTR)(P4),(S4)); } - - VOID NTAPI RtlApplicationVerifierStop(ULONG_PTR Code,PSTR Message,ULONG_PTR Param1,PSTR Description1,ULONG_PTR Param2,PSTR Description2,ULONG_PTR Param3,PSTR Description3,ULONG_PTR Param4,PSTR Description4); - - typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(struct _EXCEPTION_POINTERS *ExceptionInfo); -#define SEF_DACL_AUTO_INHERIT 0x01 -#define SEF_SACL_AUTO_INHERIT 0x02 -#define SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT 0x04 -#define SEF_AVOID_PRIVILEGE_CHECK 0x08 -#define SEF_AVOID_OWNER_CHECK 0x10 -#define SEF_DEFAULT_OWNER_FROM_PARENT 0x20 -#define SEF_DEFAULT_GROUP_FROM_PARENT 0x40 - - typedef enum _HEAP_INFORMATION_CLASS { - HeapCompatibilityInformation - } HEAP_INFORMATION_CLASS; - - NTSYSAPI DWORD NTAPI RtlSetHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength); - NTSYSAPI DWORD NTAPI RtlQueryHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength); - DWORD NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD Flags,SIZE_T Size,DWORD Count,PVOID *Array); - DWORD NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD Flags,DWORD Count,PVOID *Array); - -#define WT_EXECUTEDEFAULT 0x00000000 -#define WT_EXECUTEINIOTHREAD 0x00000001 -#define WT_EXECUTEINUITHREAD 0x00000002 -#define WT_EXECUTEINWAITTHREAD 0x00000004 -#define WT_EXECUTEONLYONCE 0x00000008 -#define WT_EXECUTEINTIMERTHREAD 0x00000020 -#define WT_EXECUTELONGFUNCTION 0x00000010 -#define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040 -#define WT_EXECUTEINPERSISTENTTHREAD 0x00000080 -#define WT_TRANSFER_IMPERSONATION 0x00000100 -#define WT_SET_MAX_THREADPOOL_THREADS(Flags,Limit) ((Flags) |= (Limit)<<16) - typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN); - typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID); - typedef VOID (NTAPI *APC_CALLBACK_FUNCTION)(DWORD ,PVOID,PVOID); - typedef - VOID - (NTAPI *PFLS_CALLBACK_FUNCTION)(PVOID lpFlsData); -#define WT_EXECUTEINLONGTHREAD 0x00000010 -#define WT_EXECUTEDELETEWAIT 0x00000008 - - typedef enum _ACTIVATION_CONTEXT_INFO_CLASS { - ActivationContextBasicInformation = 1,ActivationContextDetailedInformation = 2,AssemblyDetailedInformationInActivationContext = 3,FileInformationInAssemblyOfAssemblyInActivationContext = 4,MaxActivationContextInfoClass,AssemblyDetailedInformationInActivationContxt = 3,FileInformationInAssemblyOfAssemblyInActivationContxt = 4 - } ACTIVATION_CONTEXT_INFO_CLASS; - -#define ACTIVATIONCONTEXTINFOCLASS ACTIVATION_CONTEXT_INFO_CLASS - - typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX { - DWORD ulAssemblyIndex; - DWORD ulFileIndexInAssembly; - } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX; - - typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX; - -#define ACTIVATION_CONTEXT_PATH_TYPE_NONE (1) -#define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE (2) -#define ACTIVATION_CONTEXT_PATH_TYPE_URL (3) -#define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF (4) - - typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION { - DWORD ulFlags; - DWORD ulFilenameLength; - DWORD ulPathLength; - - PCWSTR lpFileName; - PCWSTR lpFilePath; - } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION; - typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION; - -#define _ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION _ASSEMBLY_FILE_DETAILED_INFORMATION -#define ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION ASSEMBLY_FILE_DETAILED_INFORMATION -#define PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PASSEMBLY_FILE_DETAILED_INFORMATION -#define PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION PCASSEMBLY_FILE_DETAILED_INFORMATION - - typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION { - DWORD ulFlags; - DWORD ulEncodedAssemblyIdentityLength; - DWORD ulManifestPathType; - DWORD ulManifestPathLength; - LARGE_INTEGER liManifestLastWriteTime; - DWORD ulPolicyPathType; - DWORD ulPolicyPathLength; - LARGE_INTEGER liPolicyLastWriteTime; - DWORD ulMetadataSatelliteRosterIndex; - DWORD ulManifestVersionMajor; - DWORD ulManifestVersionMinor; - DWORD ulPolicyVersionMajor; - DWORD ulPolicyVersionMinor; - DWORD ulAssemblyDirectoryNameLength; - PCWSTR lpAssemblyEncodedAssemblyIdentity; - PCWSTR lpAssemblyManifestPath; - PCWSTR lpAssemblyPolicyPath; - PCWSTR lpAssemblyDirectoryName; - DWORD ulFileCount; - } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; - - typedef const struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; - - typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION { - DWORD dwFlags; - DWORD ulFormatVersion; - DWORD ulAssemblyCount; - DWORD ulRootManifestPathType; - DWORD ulRootManifestPathChars; - DWORD ulRootConfigurationPathType; - DWORD ulRootConfigurationPathChars; - DWORD ulAppDirPathType; - DWORD ulAppDirPathChars; - PCWSTR lpRootManifestPath; - PCWSTR lpRootConfigurationPath; - PCWSTR lpAppDirPath; - } ACTIVATION_CONTEXT_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_DETAILED_INFORMATION; - - typedef const struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION; - -#define DLL_PROCESS_ATTACH 1 -#define DLL_THREAD_ATTACH 2 -#define DLL_THREAD_DETACH 3 -#define DLL_PROCESS_DETACH 0 -#define DLL_PROCESS_VERIFIER 4 - -#define EVENTLOG_SEQUENTIAL_READ 0x0001 -#define EVENTLOG_SEEK_READ 0x0002 -#define EVENTLOG_FORWARDS_READ 0x0004 -#define EVENTLOG_BACKWARDS_READ 0x0008 - -#define EVENTLOG_SUCCESS 0x0000 -#define EVENTLOG_ERROR_TYPE 0x0001 -#define EVENTLOG_WARNING_TYPE 0x0002 -#define EVENTLOG_INFORMATION_TYPE 0x0004 -#define EVENTLOG_AUDIT_SUCCESS 0x0008 -#define EVENTLOG_AUDIT_FAILURE 0x0010 - -#define EVENTLOG_START_PAIRED_EVENT 0x0001 -#define EVENTLOG_END_PAIRED_EVENT 0x0002 -#define EVENTLOG_END_ALL_PAIRED_EVENTS 0x0004 -#define EVENTLOG_PAIRED_EVENT_ACTIVE 0x0008 -#define EVENTLOG_PAIRED_EVENT_INACTIVE 0x0010 - - typedef struct _EVENTLOGRECORD { - DWORD Length; - DWORD Reserved; - DWORD RecordNumber; - DWORD TimeGenerated; - DWORD TimeWritten; - DWORD EventID; - WORD EventType; - WORD NumStrings; - WORD EventCategory; - WORD ReservedFlags; - DWORD ClosingRecordNumber; - DWORD StringOffset; - DWORD UserSidLength; - DWORD UserSidOffset; - DWORD DataLength; - DWORD DataOffset; - } EVENTLOGRECORD,*PEVENTLOGRECORD; - -#define MAXLOGICALLOGNAMESIZE 256 - - typedef struct _EVENTSFORLOGFILE{ - DWORD ulSize; - WCHAR szLogicalLogFile[MAXLOGICALLOGNAMESIZE]; - DWORD ulNumRecords; - EVENTLOGRECORD pEventLogRecords[]; - } EVENTSFORLOGFILE,*PEVENTSFORLOGFILE; - - typedef struct _PACKEDEVENTINFO{ - DWORD ulSize; - DWORD ulNumEventsForLogFile; - DWORD ulOffsets[]; - } PACKEDEVENTINFO,*PPACKEDEVENTINFO; - -#define KEY_QUERY_VALUE (0x0001) -#define KEY_SET_VALUE (0x0002) -#define KEY_CREATE_SUB_KEY (0x0004) -#define KEY_ENUMERATE_SUB_KEYS (0x0008) -#define KEY_NOTIFY (0x0010) -#define KEY_CREATE_LINK (0x0020) -#define KEY_WOW64_32KEY (0x0200) -#define KEY_WOW64_64KEY (0x0100) -#define KEY_WOW64_RES (0x0300) - -#define KEY_READ ((STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY) & (~SYNCHRONIZE)) -#define KEY_WRITE ((STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE)) -#define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE)) -#define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & (~SYNCHRONIZE)) -#define REG_OPTION_RESERVED (0x00000000L) - -#define REG_OPTION_NON_VOLATILE (0x00000000L) -#define REG_OPTION_VOLATILE (0x00000001L) -#define REG_OPTION_CREATE_LINK (0x00000002L) -#define REG_OPTION_BACKUP_RESTORE (0x00000004L) -#define REG_OPTION_OPEN_LINK (0x00000008L) -#define REG_LEGAL_OPTION (REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK) -#define REG_CREATED_NEW_KEY (0x00000001L) -#define REG_OPENED_EXISTING_KEY (0x00000002L) -#define REG_STANDARD_FORMAT 1 -#define REG_LATEST_FORMAT 2 -#define REG_NO_COMPRESSION 4 -#define REG_WHOLE_HIVE_VOLATILE (0x00000001L) -#define REG_REFRESH_HIVE (0x00000002L) -#define REG_NO_LAZY_FLUSH (0x00000004L) -#define REG_FORCE_RESTORE (0x00000008L) -#define REG_FORCE_UNLOAD 1 - -#define REG_NOTIFY_CHANGE_NAME (0x00000001L) -#define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L) -#define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L) -#define REG_NOTIFY_CHANGE_SECURITY (0x00000008L) - -#define REG_LEGAL_CHANGE_FILTER (REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY) - -#define REG_NONE (0) -#define REG_SZ (1) -#define REG_EXPAND_SZ (2) - -#define REG_BINARY (3) -#define REG_DWORD (4) -#define REG_DWORD_LITTLE_ENDIAN (4) -#define REG_DWORD_BIG_ENDIAN (5) -#define REG_LINK (6) -#define REG_MULTI_SZ (7) -#define REG_RESOURCE_LIST (8) -#define REG_FULL_RESOURCE_DESCRIPTOR (9) -#define REG_RESOURCE_REQUIREMENTS_LIST (10) -#define REG_QWORD (11) -#define REG_QWORD_LITTLE_ENDIAN (11) - -#define SERVICE_KERNEL_DRIVER 0x00000001 -#define SERVICE_FILE_SYSTEM_DRIVER 0x00000002 -#define SERVICE_ADAPTER 0x00000004 -#define SERVICE_RECOGNIZER_DRIVER 0x00000008 - -#define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER) - -#define SERVICE_WIN32_OWN_PROCESS 0x00000010 -#define SERVICE_WIN32_SHARE_PROCESS 0x00000020 -#define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS) - -#define SERVICE_INTERACTIVE_PROCESS 0x00000100 - -#define SERVICE_TYPE_ALL (SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS) - -#define SERVICE_BOOT_START 0x00000000 -#define SERVICE_SYSTEM_START 0x00000001 -#define SERVICE_AUTO_START 0x00000002 -#define SERVICE_DEMAND_START 0x00000003 -#define SERVICE_DISABLED 0x00000004 - -#define SERVICE_ERROR_IGNORE 0x00000000 -#define SERVICE_ERROR_NORMAL 0x00000001 -#define SERVICE_ERROR_SEVERE 0x00000002 -#define SERVICE_ERROR_CRITICAL 0x00000003 - - typedef enum _CM_SERVICE_NODE_TYPE { - DriverType = SERVICE_KERNEL_DRIVER,FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, - Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,AdapterType = SERVICE_ADAPTER,RecognizerType = SERVICE_RECOGNIZER_DRIVER - } SERVICE_NODE_TYPE; - - typedef enum _CM_SERVICE_LOAD_TYPE { - BootLoad = SERVICE_BOOT_START,SystemLoad = SERVICE_SYSTEM_START,AutoLoad = SERVICE_AUTO_START,DemandLoad = SERVICE_DEMAND_START, - DisableLoad = SERVICE_DISABLED - } SERVICE_LOAD_TYPE; - - typedef enum _CM_ERROR_CONTROL_TYPE { - IgnoreError = SERVICE_ERROR_IGNORE,NormalError = SERVICE_ERROR_NORMAL,SevereError = SERVICE_ERROR_SEVERE,CriticalError = SERVICE_ERROR_CRITICAL - } SERVICE_ERROR_TYPE; - -#define TAPE_ERASE_SHORT 0L -#define TAPE_ERASE_LONG 1L - - typedef struct _TAPE_ERASE { - DWORD Type; - BOOLEAN Immediate; - } TAPE_ERASE,*PTAPE_ERASE; - -#define TAPE_LOAD 0L -#define TAPE_UNLOAD 1L -#define TAPE_TENSION 2L -#define TAPE_LOCK 3L -#define TAPE_UNLOCK 4L -#define TAPE_FORMAT 5L - - typedef struct _TAPE_PREPARE { - DWORD Operation; - BOOLEAN Immediate; - } TAPE_PREPARE,*PTAPE_PREPARE; - -#define TAPE_SETMARKS 0L -#define TAPE_FILEMARKS 1L -#define TAPE_SHORT_FILEMARKS 2L -#define TAPE_LONG_FILEMARKS 3L - - typedef struct _TAPE_WRITE_MARKS { - DWORD Type; - DWORD Count; - BOOLEAN Immediate; - } TAPE_WRITE_MARKS,*PTAPE_WRITE_MARKS; - -#define TAPE_ABSOLUTE_POSITION 0L -#define TAPE_LOGICAL_POSITION 1L -#define TAPE_PSEUDO_LOGICAL_POSITION 2L - - typedef struct _TAPE_GET_POSITION { - DWORD Type; - DWORD Partition; - LARGE_INTEGER Offset; - } TAPE_GET_POSITION,*PTAPE_GET_POSITION; - -#define TAPE_REWIND 0L -#define TAPE_ABSOLUTE_BLOCK 1L -#define TAPE_LOGICAL_BLOCK 2L -#define TAPE_PSEUDO_LOGICAL_BLOCK 3L -#define TAPE_SPACE_END_OF_DATA 4L -#define TAPE_SPACE_RELATIVE_BLOCKS 5L -#define TAPE_SPACE_FILEMARKS 6L -#define TAPE_SPACE_SEQUENTIAL_FMKS 7L -#define TAPE_SPACE_SETMARKS 8L -#define TAPE_SPACE_SEQUENTIAL_SMKS 9L - - typedef struct _TAPE_SET_POSITION { - DWORD Method; - DWORD Partition; - LARGE_INTEGER Offset; - BOOLEAN Immediate; - } TAPE_SET_POSITION,*PTAPE_SET_POSITION; - -#define TAPE_DRIVE_FIXED 0x00000001 -#define TAPE_DRIVE_SELECT 0x00000002 -#define TAPE_DRIVE_INITIATOR 0x00000004 - -#define TAPE_DRIVE_ERASE_SHORT 0x00000010 -#define TAPE_DRIVE_ERASE_LONG 0x00000020 -#define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040 -#define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080 - -#define TAPE_DRIVE_TAPE_CAPACITY 0x00000100 -#define TAPE_DRIVE_TAPE_REMAINING 0x00000200 -#define TAPE_DRIVE_FIXED_BLOCK 0x00000400 -#define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800 - -#define TAPE_DRIVE_WRITE_PROTECT 0x00001000 -#define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000 - -#define TAPE_DRIVE_ECC 0x00010000 -#define TAPE_DRIVE_COMPRESSION 0x00020000 -#define TAPE_DRIVE_PADDING 0x00040000 -#define TAPE_DRIVE_REPORT_SMKS 0x00080000 - -#define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000 -#define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000 -#define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000 - -#define TAPE_DRIVE_EJECT_MEDIA 0x01000000 -#define TAPE_DRIVE_CLEAN_REQUESTS 0x02000000 -#define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x04000000 - -#define TAPE_DRIVE_RESERVED_BIT 0x80000000 - -#define TAPE_DRIVE_LOAD_UNLOAD 0x80000001 -#define TAPE_DRIVE_TENSION 0x80000002 -#define TAPE_DRIVE_LOCK_UNLOCK 0x80000004 -#define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008 - -#define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010 -#define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020 -#define TAPE_DRIVE_TENSION_IMMED 0x80000040 -#define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080 - -#define TAPE_DRIVE_SET_ECC 0x80000100 -#define TAPE_DRIVE_SET_COMPRESSION 0x80000200 -#define TAPE_DRIVE_SET_PADDING 0x80000400 -#define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800 - -#define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000 -#define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000 -#define TAPE_DRIVE_LOGICAL_BLK 0x80004000 -#define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000 - -#define TAPE_DRIVE_END_OF_DATA 0x80010000 -#define TAPE_DRIVE_RELATIVE_BLKS 0x80020000 -#define TAPE_DRIVE_FILEMARKS 0x80040000 -#define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000 - -#define TAPE_DRIVE_SETMARKS 0x80100000 -#define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000 -#define TAPE_DRIVE_REVERSE_POSITION 0x80400000 -#define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000 - -#define TAPE_DRIVE_WRITE_SETMARKS 0x81000000 -#define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000 -#define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000 -#define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000 - -#define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000 -#define TAPE_DRIVE_FORMAT 0xA0000000 -#define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000 -#define TAPE_DRIVE_HIGH_FEATURES 0x80000000 - - typedef struct _TAPE_GET_DRIVE_PARAMETERS { - BOOLEAN ECC; - BOOLEAN Compression; - BOOLEAN DataPadding; - BOOLEAN ReportSetmarks; - DWORD DefaultBlockSize; - DWORD MaximumBlockSize; - DWORD MinimumBlockSize; - DWORD MaximumPartitionCount; - DWORD FeaturesLow; - DWORD FeaturesHigh; - DWORD EOTWarningZoneSize; - } TAPE_GET_DRIVE_PARAMETERS,*PTAPE_GET_DRIVE_PARAMETERS; - - typedef struct _TAPE_SET_DRIVE_PARAMETERS { - BOOLEAN ECC; - BOOLEAN Compression; - BOOLEAN DataPadding; - BOOLEAN ReportSetmarks; - DWORD EOTWarningZoneSize; - } TAPE_SET_DRIVE_PARAMETERS,*PTAPE_SET_DRIVE_PARAMETERS; - - typedef struct _TAPE_GET_MEDIA_PARAMETERS { - LARGE_INTEGER Capacity; - LARGE_INTEGER Remaining; - DWORD BlockSize; - DWORD PartitionCount; - BOOLEAN WriteProtected; - } TAPE_GET_MEDIA_PARAMETERS,*PTAPE_GET_MEDIA_PARAMETERS; - - typedef struct _TAPE_SET_MEDIA_PARAMETERS { - DWORD BlockSize; - } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS; - -#define TAPE_FIXED_PARTITIONS 0L -#define TAPE_SELECT_PARTITIONS 1L -#define TAPE_INITIATOR_PARTITIONS 2L - - typedef struct _TAPE_CREATE_PARTITION { - DWORD Method; - DWORD Count; - DWORD Size; - } TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION; - -#define TAPE_QUERY_DRIVE_PARAMETERS 0L -#define TAPE_QUERY_MEDIA_CAPACITY 1L -#define TAPE_CHECK_FOR_DRIVE_PROBLEM 2L -#define TAPE_QUERY_IO_ERROR_DATA 3L -#define TAPE_QUERY_DEVICE_ERROR_DATA 4L - - typedef struct _TAPE_WMI_OPERATIONS { - DWORD Method; - DWORD DataBufferSize; - PVOID DataBuffer; - } TAPE_WMI_OPERATIONS,*PTAPE_WMI_OPERATIONS; - - typedef enum _TAPE_DRIVE_PROBLEM_TYPE { - TapeDriveProblemNone,TapeDriveReadWriteWarning,TapeDriveReadWriteError,TapeDriveReadWarning,TapeDriveWriteWarning,TapeDriveReadError,TapeDriveWriteError,TapeDriveHardwareError,TapeDriveUnsupportedMedia,TapeDriveScsiConnectionError,TapeDriveTimetoClean,TapeDriveCleanDriveNow,TapeDriveMediaLifeExpired,TapeDriveSnappedTape - } TAPE_DRIVE_PROBLEM_TYPE; - -#if defined(__x86_64) - __CRT_INLINE struct _TEB *NtCurrentTeb(VOID) { return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB,Self)); } - __CRT_INLINE PVOID GetCurrentFiber(VOID) { return(PVOID)__readgsqword(FIELD_OFFSET(NT_TIB,FiberData)); } - __CRT_INLINE PVOID GetFiberData(VOID) { - return *(PVOID *)GetCurrentFiber(); - } -#endif - -#if(defined(_X86_) && !defined(__x86_64)) -#define PcTeb 0x18 - __CRT_INLINE struct _TEB *NtCurrentTeb(void) { - struct _TEB *ret; - __asm__ volatile ("movl %%fs:0x18,%0" - : "=r" (ret)); - return ret; - } -#endif - -#define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION (1) -#define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION (2) -#define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION (3) -#define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION (4) -#define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION (5) -#define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION (6) -#define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION (7) -#define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE (8) -#define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES (9) -#define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS (10) - -#ifdef __cplusplus - } -#endif -#endif diff --git a/win32/include/winapi/winreg.h b/win32/include/winapi/winreg.h deleted file mode 100644 index f158d282..00000000 --- a/win32/include/winapi/winreg.h +++ /dev/null @@ -1,272 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINREG_ -#define _WINREG_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef WINVER -#define WINVER 0x0502 -#endif - -#define RRF_RT_REG_NONE 0x00000001 -#define RRF_RT_REG_SZ 0x00000002 -#define RRF_RT_REG_EXPAND_SZ 0x00000004 -#define RRF_RT_REG_BINARY 0x00000008 -#define RRF_RT_REG_DWORD 0x00000010 -#define RRF_RT_REG_MULTI_SZ 0x00000020 -#define RRF_RT_REG_QWORD 0x00000040 - -#define RRF_RT_DWORD (RRF_RT_REG_BINARY | RRF_RT_REG_DWORD) -#define RRF_RT_QWORD (RRF_RT_REG_BINARY | RRF_RT_REG_QWORD) -#define RRF_RT_ANY 0x0000ffff - -#define RRF_NOEXPAND 0x10000000 -#define RRF_ZEROONFAILURE 0x20000000 - - typedef ACCESS_MASK REGSAM; - -#define HKEY_CLASSES_ROOT ((HKEY) (ULONG_PTR)((LONG)0x80000000)) -#define HKEY_CURRENT_USER ((HKEY) (ULONG_PTR)((LONG)0x80000001)) -#define HKEY_LOCAL_MACHINE ((HKEY) (ULONG_PTR)((LONG)0x80000002)) -#define HKEY_USERS ((HKEY) (ULONG_PTR)((LONG)0x80000003)) -#define HKEY_PERFORMANCE_DATA ((HKEY) (ULONG_PTR)((LONG)0x80000004)) -#define HKEY_PERFORMANCE_TEXT ((HKEY) (ULONG_PTR)((LONG)0x80000050)) -#define HKEY_PERFORMANCE_NLSTEXT ((HKEY) (ULONG_PTR)((LONG)0x80000060)) -#define HKEY_CURRENT_CONFIG ((HKEY) (ULONG_PTR)((LONG)0x80000005)) -#define HKEY_DYN_DATA ((HKEY) (ULONG_PTR)((LONG)0x80000006)) - -#define REG_SECURE_CONNECTION 1 - -#ifndef _PROVIDER_STRUCTS_DEFINED -#define _PROVIDER_STRUCTS_DEFINED - -#define PROVIDER_KEEPS_VALUE_LENGTH 0x1 - struct val_context { - int valuelen; - LPVOID value_context; - LPVOID val_buff_ptr; - }; - - typedef struct val_context *PVALCONTEXT; - - typedef struct pvalueA { - LPSTR pv_valuename; - int pv_valuelen; - LPVOID pv_value_context; - DWORD pv_type; - }PVALUEA,*PPVALUEA; - - typedef struct pvalueW { - LPWSTR pv_valuename; - int pv_valuelen; - LPVOID pv_value_context; - DWORD pv_type; - }PVALUEW,*PPVALUEW; - -#ifdef UNICODE - typedef PVALUEW PVALUE; - typedef PPVALUEW PPVALUE; -#else - typedef PVALUEA PVALUE; - typedef PPVALUEA PPVALUE; -#endif - - typedef DWORD __cdecl QUERYHANDLER(LPVOID keycontext,PVALCONTEXT val_list,DWORD num_vals,LPVOID outputbuffer,DWORD *total_outlen,DWORD input_blen); - - typedef QUERYHANDLER *PQUERYHANDLER; - - typedef struct provider_info { - PQUERYHANDLER pi_R0_1val; - PQUERYHANDLER pi_R0_allvals; - PQUERYHANDLER pi_R3_1val; - PQUERYHANDLER pi_R3_allvals; - DWORD pi_flags; - LPVOID pi_key_context; - } REG_PROVIDER; - - typedef struct provider_info *PPROVIDER; - - typedef struct value_entA { - LPSTR ve_valuename; - DWORD ve_valuelen; - DWORD_PTR ve_valueptr; - DWORD ve_type; - } VALENTA,*PVALENTA; - - typedef struct value_entW { - LPWSTR ve_valuename; - DWORD ve_valuelen; - DWORD_PTR ve_valueptr; - DWORD ve_type; - } VALENTW,*PVALENTW; - -#ifdef UNICODE - typedef VALENTW VALENT; - typedef PVALENTW PVALENT; -#else - typedef VALENTA VALENT; - typedef PVALENTA PVALENT; -#endif -#endif - -#define WIN31_CLASS NULL - -#ifdef UNICODE -#define RegConnectRegistry RegConnectRegistryW -#define RegConnectRegistryEx RegConnectRegistryExW -#define RegCreateKey RegCreateKeyW -#define RegCreateKeyEx RegCreateKeyExW -#define RegDeleteKey RegDeleteKeyW -#define RegDeleteKeyEx RegDeleteKeyExW -#define RegDeleteValue RegDeleteValueW -#define RegEnumKey RegEnumKeyW -#define RegEnumKeyEx RegEnumKeyExW -#define RegEnumValue RegEnumValueW -#define RegLoadKey RegLoadKeyW -#define RegOpenKey RegOpenKeyW -#define RegOpenKeyEx RegOpenKeyExW -#define RegQueryInfoKey RegQueryInfoKeyW -#define RegQueryValue RegQueryValueW -#define RegQueryMultipleValues RegQueryMultipleValuesW -#define RegQueryValueEx RegQueryValueExW -#define RegReplaceKey RegReplaceKeyW -#define RegRestoreKey RegRestoreKeyW -#define RegSaveKey RegSaveKeyW -#define RegSetValue RegSetValueW -#define RegSetValueEx RegSetValueExW -#define RegUnLoadKey RegUnLoadKeyW -#define RegGetValue RegGetValueW -#define InitiateSystemShutdown InitiateSystemShutdownW -#define AbortSystemShutdown AbortSystemShutdownW -#else -#define RegConnectRegistry RegConnectRegistryA -#define RegConnectRegistryEx RegConnectRegistryExA -#define RegCreateKey RegCreateKeyA -#define RegCreateKeyEx RegCreateKeyExA -#define RegDeleteKey RegDeleteKeyA -#define RegDeleteKeyEx RegDeleteKeyExA -#define RegDeleteValue RegDeleteValueA -#define RegEnumKey RegEnumKeyA -#define RegEnumKeyEx RegEnumKeyExA -#define RegEnumValue RegEnumValueA -#define RegLoadKey RegLoadKeyA -#define RegOpenKey RegOpenKeyA -#define RegOpenKeyEx RegOpenKeyExA -#define RegQueryInfoKey RegQueryInfoKeyA -#define RegQueryValue RegQueryValueA -#define RegQueryMultipleValues RegQueryMultipleValuesA -#define RegQueryValueEx RegQueryValueExA -#define RegReplaceKey RegReplaceKeyA -#define RegRestoreKey RegRestoreKeyA -#define RegSaveKey RegSaveKeyA -#define RegSetValue RegSetValueA -#define RegSetValueEx RegSetValueExA -#define RegUnLoadKey RegUnLoadKeyA -#define RegGetValue RegGetValueA -#define InitiateSystemShutdown InitiateSystemShutdownA -#define AbortSystemShutdown AbortSystemShutdownA -#endif - - WINADVAPI LONG WINAPI RegCloseKey(HKEY hKey); - WINADVAPI LONG WINAPI RegOverridePredefKey(HKEY hKey,HKEY hNewHKey); - WINADVAPI LONG WINAPI RegOpenUserClassesRoot(HANDLE hToken,DWORD dwOptions,REGSAM samDesired,PHKEY phkResult); - WINADVAPI LONG WINAPI RegOpenCurrentUser(REGSAM samDesired,PHKEY phkResult); - WINADVAPI LONG WINAPI RegDisablePredefinedCache(); - WINADVAPI LONG WINAPI RegConnectRegistryA(LPCSTR lpMachineName,HKEY hKey,PHKEY phkResult); - WINADVAPI LONG WINAPI RegConnectRegistryW(LPCWSTR lpMachineName,HKEY hKey,PHKEY phkResult); - WINADVAPI LONG WINAPI RegConnectRegistryExA(LPCSTR lpMachineName,HKEY hKey,ULONG Flags,PHKEY phkResult); - WINADVAPI LONG WINAPI RegConnectRegistryExW(LPCWSTR lpMachineName,HKEY hKey,ULONG Flags,PHKEY phkResult); - WINADVAPI LONG WINAPI RegCreateKeyA(HKEY hKey,LPCSTR lpSubKey,PHKEY phkResult); - WINADVAPI LONG WINAPI RegCreateKeyW(HKEY hKey,LPCWSTR lpSubKey,PHKEY phkResult); - WINADVAPI LONG WINAPI RegCreateKeyExA(HKEY hKey,LPCSTR lpSubKey,DWORD Reserved,LPSTR lpClass,DWORD dwOptions,REGSAM samDesired,LPSECURITY_ATTRIBUTES lpSecurityAttributes,PHKEY phkResult,LPDWORD lpdwDisposition); - WINADVAPI LONG WINAPI RegCreateKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD Reserved,LPWSTR lpClass,DWORD dwOptions,REGSAM samDesired,LPSECURITY_ATTRIBUTES lpSecurityAttributes,PHKEY phkResult,LPDWORD lpdwDisposition); - WINADVAPI LONG WINAPI RegDeleteKeyA(HKEY hKey,LPCSTR lpSubKey); - WINADVAPI LONG WINAPI RegDeleteKeyW(HKEY hKey,LPCWSTR lpSubKey); - WINADVAPI LONG WINAPI RegDeleteKeyExA(HKEY hKey,LPCSTR lpSubKey,REGSAM samDesired,DWORD Reserved); - WINADVAPI LONG WINAPI RegDeleteKeyExW(HKEY hKey,LPCWSTR lpSubKey,REGSAM samDesired,DWORD Reserved); - WINADVAPI LONG WINAPI RegDisableReflectionKey(HKEY hBase); - WINADVAPI LONG WINAPI RegEnableReflectionKey(HKEY hBase); - WINADVAPI LONG WINAPI RegQueryReflectionKey(HKEY hBase,WINBOOL *bIsReflectionDisabled); - WINADVAPI LONG WINAPI RegDeleteValueA(HKEY hKey,LPCSTR lpValueName); - WINADVAPI LONG WINAPI RegDeleteValueW(HKEY hKey,LPCWSTR lpValueName); - WINADVAPI LONG WINAPI RegEnumKeyA(HKEY hKey,DWORD dwIndex,LPSTR lpName,DWORD cchName); - WINADVAPI LONG WINAPI RegEnumKeyW(HKEY hKey,DWORD dwIndex,LPWSTR lpName,DWORD cchName); - WINADVAPI LONG WINAPI RegEnumKeyExA(HKEY hKey,DWORD dwIndex,LPSTR lpName,LPDWORD lpcchName,LPDWORD lpReserved,LPSTR lpClass,LPDWORD lpcchClass,PFILETIME lpftLastWriteTime); - WINADVAPI LONG WINAPI RegEnumKeyExW(HKEY hKey,DWORD dwIndex,LPWSTR lpName,LPDWORD lpcchName,LPDWORD lpReserved,LPWSTR lpClass,LPDWORD lpcchClass,PFILETIME lpftLastWriteTime); - WINADVAPI LONG WINAPI RegEnumValueA(HKEY hKey,DWORD dwIndex,LPSTR lpValueName,LPDWORD lpcchValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); - WINADVAPI LONG WINAPI RegEnumValueW(HKEY hKey,DWORD dwIndex,LPWSTR lpValueName,LPDWORD lpcchValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); - WINADVAPI LONG WINAPI RegFlushKey(HKEY hKey); - WINADVAPI LONG WINAPI RegGetKeySecurity(HKEY hKey,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor,LPDWORD lpcbSecurityDescriptor); - WINADVAPI LONG WINAPI RegLoadKeyA(HKEY hKey,LPCSTR lpSubKey,LPCSTR lpFile); - WINADVAPI LONG WINAPI RegLoadKeyW(HKEY hKey,LPCWSTR lpSubKey,LPCWSTR lpFile); - WINADVAPI LONG WINAPI RegNotifyChangeKeyValue(HKEY hKey,WINBOOL bWatchSubtree,DWORD dwNotifyFilter,HANDLE hEvent,WINBOOL fAsynchronous); - WINADVAPI LONG WINAPI RegOpenKeyA(HKEY hKey,LPCSTR lpSubKey,PHKEY phkResult); - WINADVAPI LONG WINAPI RegOpenKeyW(HKEY hKey,LPCWSTR lpSubKey,PHKEY phkResult); - WINADVAPI LONG WINAPI RegOpenKeyExA(HKEY hKey,LPCSTR lpSubKey,DWORD ulOptions,REGSAM samDesired,PHKEY phkResult); - WINADVAPI LONG WINAPI RegOpenKeyExW(HKEY hKey,LPCWSTR lpSubKey,DWORD ulOptions,REGSAM samDesired,PHKEY phkResult); - WINADVAPI LONG WINAPI RegQueryInfoKeyA(HKEY hKey,LPSTR lpClass,LPDWORD lpcchClass,LPDWORD lpReserved,LPDWORD lpcSubKeys,LPDWORD lpcbMaxSubKeyLen,LPDWORD lpcbMaxClassLen,LPDWORD lpcValues,LPDWORD lpcbMaxValueNameLen,LPDWORD lpcbMaxValueLen,LPDWORD lpcbSecurityDescriptor,PFILETIME lpftLastWriteTime); - WINADVAPI LONG WINAPI RegQueryInfoKeyW(HKEY hKey,LPWSTR lpClass,LPDWORD lpcchClass,LPDWORD lpReserved,LPDWORD lpcSubKeys,LPDWORD lpcbMaxSubKeyLen,LPDWORD lpcbMaxClassLen,LPDWORD lpcValues,LPDWORD lpcbMaxValueNameLen,LPDWORD lpcbMaxValueLen,LPDWORD lpcbSecurityDescriptor,PFILETIME lpftLastWriteTime); - WINADVAPI LONG WINAPI RegQueryValueA(HKEY hKey,LPCSTR lpSubKey,LPSTR lpData,PLONG lpcbData); - WINADVAPI LONG WINAPI RegQueryValueW(HKEY hKey,LPCWSTR lpSubKey,LPWSTR lpData,PLONG lpcbData); - WINADVAPI LONG WINAPI RegQueryMultipleValuesA(HKEY hKey,PVALENTA val_list,DWORD num_vals,LPSTR lpValueBuf,LPDWORD ldwTotsize); - WINADVAPI LONG WINAPI RegQueryMultipleValuesW(HKEY hKey,PVALENTW val_list,DWORD num_vals,LPWSTR lpValueBuf,LPDWORD ldwTotsize); - WINADVAPI LONG WINAPI RegQueryValueExA(HKEY hKey,LPCSTR lpValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); - WINADVAPI LONG WINAPI RegQueryValueExW(HKEY hKey,LPCWSTR lpValueName,LPDWORD lpReserved,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData); - WINADVAPI LONG WINAPI RegReplaceKeyA(HKEY hKey,LPCSTR lpSubKey,LPCSTR lpNewFile,LPCSTR lpOldFile); - WINADVAPI LONG WINAPI RegReplaceKeyW(HKEY hKey,LPCWSTR lpSubKey,LPCWSTR lpNewFile,LPCWSTR lpOldFile); - WINADVAPI LONG WINAPI RegRestoreKeyA(HKEY hKey,LPCSTR lpFile,DWORD dwFlags); - WINADVAPI LONG WINAPI RegRestoreKeyW(HKEY hKey,LPCWSTR lpFile,DWORD dwFlags); - WINADVAPI LONG WINAPI RegSaveKeyA(HKEY hKey,LPCSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINADVAPI LONG WINAPI RegSaveKeyW(HKEY hKey,LPCWSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes); - WINADVAPI LONG WINAPI RegSetKeySecurity(HKEY hKey,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor); - WINADVAPI LONG WINAPI RegSetValueA(HKEY hKey,LPCSTR lpSubKey,DWORD dwType,LPCSTR lpData,DWORD cbData); - WINADVAPI LONG WINAPI RegSetValueW(HKEY hKey,LPCWSTR lpSubKey,DWORD dwType,LPCWSTR lpData,DWORD cbData); - WINADVAPI LONG WINAPI RegSetValueExA(HKEY hKey,LPCSTR lpValueName,DWORD Reserved,DWORD dwType,CONST BYTE *lpData,DWORD cbData); - WINADVAPI LONG WINAPI RegSetValueExW(HKEY hKey,LPCWSTR lpValueName,DWORD Reserved,DWORD dwType,CONST BYTE *lpData,DWORD cbData); - WINADVAPI LONG WINAPI RegUnLoadKeyA(HKEY hKey,LPCSTR lpSubKey); - WINADVAPI LONG WINAPI RegUnLoadKeyW(HKEY hKey,LPCWSTR lpSubKey); - WINADVAPI LONG WINAPI RegGetValueA(HKEY hkey,LPCSTR lpSubKey,LPCSTR lpValue,DWORD dwFlags,LPDWORD pdwType,PVOID pvData,LPDWORD pcbData); - WINADVAPI LONG WINAPI RegGetValueW(HKEY hkey,LPCWSTR lpSubKey,LPCWSTR lpValue,DWORD dwFlags,LPDWORD pdwType,PVOID pvData,LPDWORD pcbData); - WINADVAPI WINBOOL WINAPI InitiateSystemShutdownA(LPSTR lpMachineName,LPSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown); - WINADVAPI WINBOOL WINAPI InitiateSystemShutdownW(LPWSTR lpMachineName,LPWSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown); - WINADVAPI WINBOOL WINAPI AbortSystemShutdownA(LPSTR lpMachineName); - WINADVAPI WINBOOL WINAPI AbortSystemShutdownW(LPWSTR lpMachineName); - -//gr #include - -#define REASON_SWINSTALL SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_INSTALLATION -#define REASON_HWINSTALL SHTDN_REASON_MAJOR_HARDWARE|SHTDN_REASON_MINOR_INSTALLATION -#define REASON_SERVICEHANG SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_HUNG -#define REASON_UNSTABLE SHTDN_REASON_MAJOR_SYSTEM|SHTDN_REASON_MINOR_UNSTABLE -#define REASON_SWHWRECONF SHTDN_REASON_MAJOR_SOFTWARE|SHTDN_REASON_MINOR_RECONFIG -#define REASON_OTHER SHTDN_REASON_MAJOR_OTHER|SHTDN_REASON_MINOR_OTHER -#define REASON_UNKNOWN SHTDN_REASON_UNKNOWN -#define REASON_LEGACY_API SHTDN_REASON_LEGACY_API -#define REASON_PLANNED_FLAG SHTDN_REASON_FLAG_PLANNED - -#define MAX_SHUTDOWN_TIMEOUT (10*365*24*60*60) - -#ifdef UNICODE -#define InitiateSystemShutdownEx InitiateSystemShutdownExW -#define RegSaveKeyEx RegSaveKeyExW -#else -#define InitiateSystemShutdownEx InitiateSystemShutdownExA -#define RegSaveKeyEx RegSaveKeyExA -#endif - - WINADVAPI WINBOOL WINAPI InitiateSystemShutdownExA(LPSTR lpMachineName,LPSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown,DWORD dwReason); - WINADVAPI WINBOOL WINAPI InitiateSystemShutdownExW(LPWSTR lpMachineName,LPWSTR lpMessage,DWORD dwTimeout,WINBOOL bForceAppsClosed,WINBOOL bRebootAfterShutdown,DWORD dwReason); - WINADVAPI LONG WINAPI RegSaveKeyExA(HKEY hKey,LPCSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD Flags); - WINADVAPI LONG WINAPI RegSaveKeyExW(HKEY hKey,LPCWSTR lpFile,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD Flags); - WINADVAPI LONG WINAPI Wow64Win32ApiEntry (DWORD dwFuncNumber,DWORD dwFlag,DWORD dwRes); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/winsock2.h b/win32/include/winapi/winsock2.h deleted file mode 100644 index 365ace64..00000000 --- a/win32/include/winapi/winsock2.h +++ /dev/null @@ -1,1474 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ - -#ifndef _WINSOCK2API_ -#define _WINSOCK2API_ - -#ifndef INCL_WINSOCK_API_TYPEDEFS -#define INCL_WINSOCK_API_TYPEDEFS 0 -#endif - -#ifndef _INC_WINDOWS -#include -#endif - -#ifndef MAKEWORD -#define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8)) -#endif - -#ifndef WINSOCK_VERSION -#define WINSOCK_VERSION MAKEWORD(2,2) -#endif - -#ifndef WINSOCK_API_LINKAGE -#ifdef DECLSPEC_IMPORT -#define WINSOCK_API_LINKAGE DECLSPEC_IMPORT -#else -#define WINSOCK_API_LINKAGE -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _WINSOCK_SOCKET_DEFINED -#define _WINSOCK_SOCKET_DEFINED - typedef unsigned char u_char; - typedef unsigned short u_short; - typedef unsigned int u_int; - typedef unsigned long u_long; - __MINGW_EXTENSION typedef unsigned __int64 u_int64; - typedef INT_PTR SOCKET; -#endif - -#ifndef FD_SETSIZE -#define FD_SETSIZE 64 -#endif - - typedef struct fd_set { - u_int fd_count; - SOCKET fd_array[FD_SETSIZE]; - } fd_set; - - extern int WINAPI __WSAFDIsSet(SOCKET,fd_set *); - -#define FD_CLR(fd,set) do { u_int __i; for(__i = 0;__i < ((fd_set *)(set))->fd_count;__i++) { if (((fd_set *)(set))->fd_array[__i]==fd) { while (__i < ((fd_set *)(set))->fd_count-1) { ((fd_set *)(set))->fd_array[__i] = ((fd_set *)(set))->fd_array[__i+1]; __i++; } ((fd_set *)(set))->fd_count--; break; } } } while(0) -#define FD_SET(fd,set) do { u_int __i; for(__i = 0;__i < ((fd_set *)(set))->fd_count;__i++) { if (((fd_set *)(set))->fd_array[__i]==(fd)) { break; } } if (__i==((fd_set *)(set))->fd_count) { if (((fd_set *)(set))->fd_count < FD_SETSIZE) { ((fd_set *)(set))->fd_array[__i] = (fd); ((fd_set *)(set))->fd_count++; } } } while(0) -#define FD_ZERO(set) (((fd_set *)(set))->fd_count=0) -#define FD_ISSET(fd,set) __WSAFDIsSet((SOCKET)(fd),(fd_set *)(set)) - -#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ -#define _TIMEVAL_DEFINED - struct timeval { - long tv_sec; - long tv_usec; - }; - -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timercmp(tvp,uvp,cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || (tvp)->tv_sec==(uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) -#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 -#endif /* _TIMEVAL_DEFINED */ - -#define IOCPARM_MASK 0x7f -#define IOC_VOID 0x20000000 -#define IOC_OUT 0x40000000 -#define IOC_IN 0x80000000 -#define IOC_INOUT (IOC_IN|IOC_OUT) - -#define _IO(x,y) (IOC_VOID|((x)<<8)|(y)) -#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) -#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) - -#define FIONREAD _IOR('f',127,u_long) -#define FIONBIO _IOW('f',126,u_long) -#define FIOASYNC _IOW('f',125,u_long) - -#define SIOCSHIWAT _IOW('s',0,u_long) -#define SIOCGHIWAT _IOR('s',1,u_long) -#define SIOCSLOWAT _IOW('s',2,u_long) -#define SIOCGLOWAT _IOR('s',3,u_long) -#define SIOCATMARK _IOR('s',7,u_long) - -#define h_addr h_addr_list[0] - - struct hostent { - char *h_name; - char **h_aliases; - short h_addrtype; - short h_length; - char **h_addr_list; - }; - - struct netent { - char *n_name; - char **n_aliases; - short n_addrtype; - u_long n_net; - }; - - struct servent { - char *s_name; - char **s_aliases; -#ifdef _WIN64 - char *s_proto; - short s_port; -#else - short s_port; - char *s_proto; -#endif - }; - - struct protoent { - char *p_name; - char **p_aliases; - short p_proto; - }; - -#define IPPROTO_IP 0 -#define IPPROTO_HOPOPTS 0 -#define IPPROTO_ICMP 1 -#define IPPROTO_IGMP 2 -#define IPPROTO_GGP 3 -#define IPPROTO_IPV4 4 -#define IPPROTO_TCP 6 -#define IPPROTO_PUP 12 -#define IPPROTO_UDP 17 -#define IPPROTO_IDP 22 -#define IPPROTO_IPV6 41 -#define IPPROTO_ROUTING 43 -#define IPPROTO_FRAGMENT 44 -#define IPPROTO_ESP 50 -#define IPPROTO_AH 51 -#define IPPROTO_ICMPV6 58 -#define IPPROTO_NONE 59 -#define IPPROTO_DSTOPTS 60 -#define IPPROTO_ND 77 -#define IPPROTO_ICLFXBM 78 - -#define IPPROTO_RAW 255 -#define IPPROTO_MAX 256 - -#define IPPORT_ECHO 7 -#define IPPORT_DISCARD 9 -#define IPPORT_SYSTAT 11 -#define IPPORT_DAYTIME 13 -#define IPPORT_NETSTAT 15 -#define IPPORT_FTP 21 -#define IPPORT_TELNET 23 -#define IPPORT_SMTP 25 -#define IPPORT_TIMESERVER 37 -#define IPPORT_NAMESERVER 42 -#define IPPORT_WHOIS 43 -#define IPPORT_MTP 57 - -#define IPPORT_TFTP 69 -#define IPPORT_RJE 77 -#define IPPORT_FINGER 79 -#define IPPORT_TTYLINK 87 -#define IPPORT_SUPDUP 95 - -#define IPPORT_EXECSERVER 512 -#define IPPORT_LOGINSERVER 513 -#define IPPORT_CMDSERVER 514 -#define IPPORT_EFSSERVER 520 - -#define IPPORT_BIFFUDP 512 -#define IPPORT_WHOSERVER 513 -#define IPPORT_ROUTESERVER 520 - -#define IPPORT_RESERVED 1024 - -#define IMPLINK_IP 155 -#define IMPLINK_LOWEXPER 156 -#define IMPLINK_HIGHEXPER 158 - -#ifndef s_addr - - struct in_addr { - union { - struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; - struct { u_short s_w1,s_w2; } S_un_w; - u_long S_addr; - } S_un; - }; - -#define s_addr S_un.S_addr -#define s_host S_un.S_un_b.s_b2 -#define s_net S_un.S_un_b.s_b1 -#define s_imp S_un.S_un_w.s_w2 -#define s_impno S_un.S_un_b.s_b4 -#define s_lh S_un.S_un_b.s_b3 - -#endif - -#define IN_CLASSA(i) (((long)(i) & 0x80000000)==0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff -#define IN_CLASSA_MAX 128 - -#define IN_CLASSB(i) (((long)(i) & 0xc0000000)==0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff -#define IN_CLASSB_MAX 65536 - -#define IN_CLASSC(i) (((long)(i) & 0xe0000000)==0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff - -#define IN_CLASSD(i) (((long)(i) & 0xf0000000)==0xe0000000) -#define IN_CLASSD_NET 0xf0000000 -#define IN_CLASSD_NSHIFT 28 -#define IN_CLASSD_HOST 0x0fffffff -#define IN_MULTICAST(i) IN_CLASSD(i) - -#define INADDR_ANY (u_long)0x00000000 -#define INADDR_LOOPBACK 0x7f000001 -#define INADDR_BROADCAST (u_long)0xffffffff -#define INADDR_NONE 0xffffffff - -#define ADDR_ANY INADDR_ANY - - struct sockaddr_in { - short sin_family; - u_short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; - }; - -#define WSADESCRIPTION_LEN 256 -#define WSASYS_STATUS_LEN 128 - - typedef struct WSAData { - WORD wVersion; - WORD wHighVersion; -#ifdef _WIN64 - unsigned short iMaxSockets; - unsigned short iMaxUdpDg; - char *lpVendorInfo; - char szDescription[WSADESCRIPTION_LEN+1]; - char szSystemStatus[WSASYS_STATUS_LEN+1]; -#else - char szDescription[WSADESCRIPTION_LEN+1]; - char szSystemStatus[WSASYS_STATUS_LEN+1]; - unsigned short iMaxSockets; - unsigned short iMaxUdpDg; - char *lpVendorInfo; -#endif - } WSADATA,*LPWSADATA; - -#define INVALID_SOCKET (SOCKET)(~0) -#define SOCKET_ERROR (-1) - -#define FROM_PROTOCOL_INFO (-1) - -#define SOCK_STREAM 1 -#define SOCK_DGRAM 2 -#define SOCK_RAW 3 -#define SOCK_RDM 4 -#define SOCK_SEQPACKET 5 - -#define SO_DEBUG 0x0001 -#define SO_ACCEPTCONN 0x0002 -#define SO_REUSEADDR 0x0004 -#define SO_KEEPALIVE 0x0008 -#define SO_DONTROUTE 0x0010 -#define SO_BROADCAST 0x0020 -#define SO_USELOOPBACK 0x0040 -#define SO_LINGER 0x0080 -#define SO_OOBINLINE 0x0100 - -#define SO_DONTLINGER (int)(~SO_LINGER) -#define SO_EXCLUSIVEADDRUSE ((int)(~SO_REUSEADDR)) - -#define SO_SNDBUF 0x1001 -#define SO_RCVBUF 0x1002 -#define SO_SNDLOWAT 0x1003 -#define SO_RCVLOWAT 0x1004 -#define SO_SNDTIMEO 0x1005 -#define SO_RCVTIMEO 0x1006 -#define SO_ERROR 0x1007 -#define SO_TYPE 0x1008 - -#define SO_GROUP_ID 0x2001 -#define SO_GROUP_PRIORITY 0x2002 -#define SO_MAX_MSG_SIZE 0x2003 -#define SO_PROTOCOL_INFOA 0x2004 -#define SO_PROTOCOL_INFOW 0x2005 -#ifdef UNICODE -#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOW -#else -#define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA -#endif -#define PVD_CONFIG 0x3001 -#define SO_CONDITIONAL_ACCEPT 0x3002 - -#define TCP_NODELAY 0x0001 - -#define AF_UNSPEC 0 - -#define AF_UNIX 1 -#define AF_INET 2 -#define AF_IMPLINK 3 -#define AF_PUP 4 -#define AF_CHAOS 5 -#define AF_NS 6 -#define AF_IPX AF_NS -#define AF_ISO 7 -#define AF_OSI AF_ISO -#define AF_ECMA 8 -#define AF_DATAKIT 9 -#define AF_CCITT 10 -#define AF_SNA 11 -#define AF_DECnet 12 -#define AF_DLI 13 -#define AF_LAT 14 -#define AF_HYLINK 15 -#define AF_APPLETALK 16 -#define AF_NETBIOS 17 -#define AF_VOICEVIEW 18 -#define AF_FIREFOX 19 -#define AF_UNKNOWN1 20 -#define AF_BAN 21 -#define AF_ATM 22 -#define AF_INET6 23 -#define AF_CLUSTER 24 -#define AF_12844 25 -#define AF_IRDA 26 -#define AF_NETDES 28 -#define AF_TCNPROCESS 29 -#define AF_TCNMESSAGE 30 -#define AF_ICLFXBM 31 - -#define AF_MAX 32 - - struct sockaddr { - u_short sa_family; - char sa_data[14]; - }; - -#define _SS_MAXSIZE 128 -#define _SS_ALIGNSIZE (8) - -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (short)) -#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (short) + _SS_PAD1SIZE + _SS_ALIGNSIZE)) - - struct sockaddr_storage { - short ss_family; - char __ss_pad1[_SS_PAD1SIZE]; - - __MINGW_EXTENSION __int64 __ss_align; - char __ss_pad2[_SS_PAD2SIZE]; - - }; - - struct sockproto { - u_short sp_family; - u_short sp_protocol; - }; - -#define PF_UNSPEC AF_UNSPEC -#define PF_UNIX AF_UNIX -#define PF_INET AF_INET -#define PF_IMPLINK AF_IMPLINK -#define PF_PUP AF_PUP -#define PF_CHAOS AF_CHAOS -#define PF_NS AF_NS -#define PF_IPX AF_IPX -#define PF_ISO AF_ISO -#define PF_OSI AF_OSI -#define PF_ECMA AF_ECMA -#define PF_DATAKIT AF_DATAKIT -#define PF_CCITT AF_CCITT -#define PF_SNA AF_SNA -#define PF_DECnet AF_DECnet -#define PF_DLI AF_DLI -#define PF_LAT AF_LAT -#define PF_HYLINK AF_HYLINK -#define PF_APPLETALK AF_APPLETALK -#define PF_VOICEVIEW AF_VOICEVIEW -#define PF_FIREFOX AF_FIREFOX -#define PF_UNKNOWN1 AF_UNKNOWN1 -#define PF_BAN AF_BAN -#define PF_ATM AF_ATM -#define PF_INET6 AF_INET6 - -#define PF_MAX AF_MAX - - struct linger { - u_short l_onoff; - u_short l_linger; - }; - -#define SOL_SOCKET 0xffff - -#define SOMAXCONN 0x7fffffff - -#define MSG_OOB 0x1 -#define MSG_PEEK 0x2 -#define MSG_DONTROUTE 0x4 -#define MSG_WAITALL 0x8 - -#define MSG_PARTIAL 0x8000 - -#define MSG_INTERRUPT 0x10 - -#define MSG_MAXIOVLEN 16 - -#define MAXGETHOSTSTRUCT 1024 - -#define FD_READ_BIT 0 -#define FD_READ (1 << FD_READ_BIT) - -#define FD_WRITE_BIT 1 -#define FD_WRITE (1 << FD_WRITE_BIT) - -#define FD_OOB_BIT 2 -#define FD_OOB (1 << FD_OOB_BIT) - -#define FD_ACCEPT_BIT 3 -#define FD_ACCEPT (1 << FD_ACCEPT_BIT) - -#define FD_CONNECT_BIT 4 -#define FD_CONNECT (1 << FD_CONNECT_BIT) - -#define FD_CLOSE_BIT 5 -#define FD_CLOSE (1 << FD_CLOSE_BIT) - -#define FD_QOS_BIT 6 -#define FD_QOS (1 << FD_QOS_BIT) - -#define FD_GROUP_QOS_BIT 7 -#define FD_GROUP_QOS (1 << FD_GROUP_QOS_BIT) - -#define FD_ROUTING_INTERFACE_CHANGE_BIT 8 -#define FD_ROUTING_INTERFACE_CHANGE (1 << FD_ROUTING_INTERFACE_CHANGE_BIT) - -#define FD_ADDRESS_LIST_CHANGE_BIT 9 -#define FD_ADDRESS_LIST_CHANGE (1 << FD_ADDRESS_LIST_CHANGE_BIT) - -#define FD_MAX_EVENTS 10 -#define FD_ALL_EVENTS ((1 << FD_MAX_EVENTS) - 1) - -#ifndef WSABASEERR - -#define WSABASEERR 10000 - -#define WSAEINTR (WSABASEERR+4) -#define WSAEBADF (WSABASEERR+9) -#define WSAEACCES (WSABASEERR+13) -#define WSAEFAULT (WSABASEERR+14) -#define WSAEINVAL (WSABASEERR+22) -#define WSAEMFILE (WSABASEERR+24) - -#define WSAEWOULDBLOCK (WSABASEERR+35) -#define WSAEINPROGRESS (WSABASEERR+36) -#define WSAEALREADY (WSABASEERR+37) -#define WSAENOTSOCK (WSABASEERR+38) -#define WSAEDESTADDRREQ (WSABASEERR+39) -#define WSAEMSGSIZE (WSABASEERR+40) -#define WSAEPROTOTYPE (WSABASEERR+41) -#define WSAENOPROTOOPT (WSABASEERR+42) -#define WSAEPROTONOSUPPORT (WSABASEERR+43) -#define WSAESOCKTNOSUPPORT (WSABASEERR+44) -#define WSAEOPNOTSUPP (WSABASEERR+45) -#define WSAEPFNOSUPPORT (WSABASEERR+46) -#define WSAEAFNOSUPPORT (WSABASEERR+47) -#define WSAEADDRINUSE (WSABASEERR+48) -#define WSAEADDRNOTAVAIL (WSABASEERR+49) -#define WSAENETDOWN (WSABASEERR+50) -#define WSAENETUNREACH (WSABASEERR+51) -#define WSAENETRESET (WSABASEERR+52) -#define WSAECONNABORTED (WSABASEERR+53) -#define WSAECONNRESET (WSABASEERR+54) -#define WSAENOBUFS (WSABASEERR+55) -#define WSAEISCONN (WSABASEERR+56) -#define WSAENOTCONN (WSABASEERR+57) -#define WSAESHUTDOWN (WSABASEERR+58) -#define WSAETOOMANYREFS (WSABASEERR+59) -#define WSAETIMEDOUT (WSABASEERR+60) -#define WSAECONNREFUSED (WSABASEERR+61) -#define WSAELOOP (WSABASEERR+62) -#define WSAENAMETOOLONG (WSABASEERR+63) -#define WSAEHOSTDOWN (WSABASEERR+64) -#define WSAEHOSTUNREACH (WSABASEERR+65) -#define WSAENOTEMPTY (WSABASEERR+66) -#define WSAEPROCLIM (WSABASEERR+67) -#define WSAEUSERS (WSABASEERR+68) -#define WSAEDQUOT (WSABASEERR+69) -#define WSAESTALE (WSABASEERR+70) -#define WSAEREMOTE (WSABASEERR+71) - -#define WSASYSNOTREADY (WSABASEERR+91) -#define WSAVERNOTSUPPORTED (WSABASEERR+92) -#define WSANOTINITIALISED (WSABASEERR+93) -#define WSAEDISCON (WSABASEERR+101) -#ifndef WSAHOST_NOT_FOUND -#define WSAHOST_NOT_FOUND (WSABASEERR+1001) -#endif -#ifndef WSATRY_AGAIN -#define WSATRY_AGAIN (WSABASEERR+1002) -#endif -#ifndef WSANO_RECOVERY -#define WSANO_RECOVERY (WSABASEERR+1003) -#endif -#ifndef WSANO_DATA -#define WSANO_DATA (WSABASEERR+1004) -#endif - -#define WSAENOMORE (WSABASEERR+102) -#define WSAECANCELLED (WSABASEERR+103) -#define WSAEINVALIDPROCTABLE (WSABASEERR+104) -#define WSAEINVALIDPROVIDER (WSABASEERR+105) -#define WSAEPROVIDERFAILEDINIT (WSABASEERR+106) -#define WSASYSCALLFAILURE (WSABASEERR+107) -#define WSASERVICE_NOT_FOUND (WSABASEERR+108) -#define WSATYPE_NOT_FOUND (WSABASEERR+109) -#define WSA_E_NO_MORE (WSABASEERR+110) -#define WSA_E_CANCELLED (WSABASEERR+111) -#define WSAEREFUSED (WSABASEERR+112) -#ifndef WSA_QOS_RECEIVERS -#define WSA_QOS_RECEIVERS (WSABASEERR + 1005) -#endif -#ifndef WSA_QOS_SENDERS -#define WSA_QOS_SENDERS (WSABASEERR + 1006) -#endif -#ifndef WSA_QOS_NO_SENDERS -#define WSA_QOS_NO_SENDERS (WSABASEERR + 1007) -#define WSA_QOS_NO_RECEIVERS (WSABASEERR + 1008) -#define WSA_QOS_REQUEST_CONFIRMED (WSABASEERR + 1009) -#define WSA_QOS_ADMISSION_FAILURE (WSABASEERR + 1010) -#define WSA_QOS_POLICY_FAILURE (WSABASEERR + 1011) -#define WSA_QOS_BAD_STYLE (WSABASEERR + 1012) -#define WSA_QOS_BAD_OBJECT (WSABASEERR + 1013) -#define WSA_QOS_TRAFFIC_CTRL_ERROR (WSABASEERR + 1014) -#define WSA_QOS_GENERIC_ERROR (WSABASEERR + 1015) -#define WSA_QOS_ESERVICETYPE (WSABASEERR + 1016) -#define WSA_QOS_EFLOWSPEC (WSABASEERR + 1017) -#define WSA_QOS_EPROVSPECBUF (WSABASEERR + 1018) -#endif -#ifndef WSA_QOS_EFILTERSTYLE -#define WSA_QOS_EFILTERSTYLE (WSABASEERR + 1019) -#endif -#ifndef WSA_QOS_EFILTERTYPE -#define WSA_QOS_EFILTERTYPE (WSABASEERR + 1020) -#endif -#ifndef WSA_QOS_EFILTERCOUNT -#define WSA_QOS_EFILTERCOUNT (WSABASEERR + 1021) -#endif -#ifndef WSA_QOS_EOBJLENGTH -#define WSA_QOS_EOBJLENGTH (WSABASEERR + 1022) -#endif -#ifndef WSA_QOS_EFLOWCOUNT -#define WSA_QOS_EFLOWCOUNT (WSABASEERR + 1023) -#endif -#ifndef WSA_QOS_EUNKNOWNPSOBJ -#define WSA_QOS_EUNKNOWNPSOBJ (WSABASEERR + 1024) -#endif -#ifndef WSA_QOS_EPOLICYOBJ -#define WSA_QOS_EPOLICYOBJ (WSABASEERR + 1025) -#endif -#ifndef WSA_QOS_EFLOWDESC -#define WSA_QOS_EFLOWDESC (WSABASEERR + 1026) -#endif -#ifndef WSA_QOS_EPSFLOWSPEC -#define WSA_QOS_EPSFLOWSPEC (WSABASEERR + 1027) -#endif -#ifndef WSA_QOS_EPSFILTERSPEC -#define WSA_QOS_EPSFILTERSPEC (WSABASEERR + 1028) -#endif -#ifndef WSA_QOS_ESDMODEOBJ -#define WSA_QOS_ESDMODEOBJ (WSABASEERR + 1029) -#endif -#ifndef WSA_QOS_ESHAPERATEOBJ -#define WSA_QOS_ESHAPERATEOBJ (WSABASEERR + 1030) -#endif -#ifndef WSA_QOS_RESERVED_PETYPE -#define WSA_QOS_RESERVED_PETYPE (WSABASEERR + 1031) -#endif -#endif // WSABASEERR - -#define h_errno WSAGetLastError() -#define HOST_NOT_FOUND WSAHOST_NOT_FOUND -#define TRY_AGAIN WSATRY_AGAIN -#define NO_RECOVERY WSANO_RECOVERY -#define NO_DATA WSANO_DATA - -#define WSANO_ADDRESS WSANO_DATA -#define NO_ADDRESS WSANO_ADDRESS - -#if 0 -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EINPROGRESS WSAEINPROGRESS -#define EALREADY WSAEALREADY -#define ENOTSOCK WSAENOTSOCK -#define EDESTADDRREQ WSAEDESTADDRREQ -#define EMSGSIZE WSAEMSGSIZE -#define EPROTOTYPE WSAEPROTOTYPE -#define ENOPROTOOPT WSAENOPROTOOPT -#define EPROTONOSUPPORT WSAEPROTONOSUPPORT -#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT -#define EOPNOTSUPP WSAEOPNOTSUPP -#define EPFNOSUPPORT WSAEPFNOSUPPORT -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define EADDRINUSE WSAEADDRINUSE -#define EADDRNOTAVAIL WSAEADDRNOTAVAIL -#define ENETDOWN WSAENETDOWN -#define ENETUNREACH WSAENETUNREACH -#define ENETRESET WSAENETRESET -#define ECONNABORTED WSAECONNABORTED -#define ECONNRESET WSAECONNRESET -#define ENOBUFS WSAENOBUFS -#define EISCONN WSAEISCONN -#define ENOTCONN WSAENOTCONN -#define ESHUTDOWN WSAESHUTDOWN -#define ETOOMANYREFS WSAETOOMANYREFS -#define ETIMEDOUT WSAETIMEDOUT -#define ECONNREFUSED WSAECONNREFUSED -#define ELOOP WSAELOOP -#define ENAMETOOLONG WSAENAMETOOLONG -#define EHOSTDOWN WSAEHOSTDOWN -#define EHOSTUNREACH WSAEHOSTUNREACH -#define ENOTEMPTY WSAENOTEMPTY -#define EPROCLIM WSAEPROCLIM -#define EUSERS WSAEUSERS -#define EDQUOT WSAEDQUOT -#define ESTALE WSAESTALE -#define EREMOTE WSAEREMOTE -#endif - -#define WSAAPI WINAPI -#define WSAEVENT HANDLE -#define LPWSAEVENT LPHANDLE -#define WSAOVERLAPPED OVERLAPPED - typedef struct _OVERLAPPED *LPWSAOVERLAPPED; - -#define WSA_IO_PENDING (ERROR_IO_PENDING) -#define WSA_IO_INCOMPLETE (ERROR_IO_INCOMPLETE) -#define WSA_INVALID_HANDLE (ERROR_INVALID_HANDLE) -#define WSA_INVALID_PARAMETER (ERROR_INVALID_PARAMETER) -#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY) -#define WSA_OPERATION_ABORTED (ERROR_OPERATION_ABORTED) - -#define WSA_INVALID_EVENT ((WSAEVENT)NULL) -#define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS) -#define WSA_WAIT_FAILED (WAIT_FAILED) -#define WSA_WAIT_EVENT_0 (WAIT_OBJECT_0) -#define WSA_WAIT_IO_COMPLETION (WAIT_IO_COMPLETION) -#define WSA_WAIT_TIMEOUT (WAIT_TIMEOUT) -#define WSA_INFINITE (INFINITE) - - typedef struct _WSABUF { - u_long len; - char *buf; - } WSABUF,*LPWSABUF; - -#include - - typedef struct _QualityOfService { - FLOWSPEC SendingFlowspec; - FLOWSPEC ReceivingFlowspec; - WSABUF ProviderSpecific; - } QOS,*LPQOS; - -#define CF_ACCEPT 0x0000 -#define CF_REJECT 0x0001 -#define CF_DEFER 0x0002 - -#define SD_RECEIVE 0x00 -#define SD_SEND 0x01 -#define SD_BOTH 0x02 - - typedef unsigned int GROUP; - -#define SG_UNCONSTRAINED_GROUP 0x01 -#define SG_CONSTRAINED_GROUP 0x02 - - typedef struct _WSANETWORKEVENTS { - long lNetworkEvents; - int iErrorCode[FD_MAX_EVENTS]; - } WSANETWORKEVENTS,*LPWSANETWORKEVENTS; - -#ifndef GUID_DEFINED -#include -#endif - -#define MAX_PROTOCOL_CHAIN 7 - -#define BASE_PROTOCOL 1 -#define LAYERED_PROTOCOL 0 - - typedef struct _WSAPROTOCOLCHAIN { - int ChainLen; - - DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; - } WSAPROTOCOLCHAIN,*LPWSAPROTOCOLCHAIN; - -#define WSAPROTOCOL_LEN 255 - - typedef struct _WSAPROTOCOL_INFOA { - DWORD dwServiceFlags1; - DWORD dwServiceFlags2; - DWORD dwServiceFlags3; - DWORD dwServiceFlags4; - DWORD dwProviderFlags; - GUID ProviderId; - DWORD dwCatalogEntryId; - WSAPROTOCOLCHAIN ProtocolChain; - int iVersion; - int iAddressFamily; - int iMaxSockAddr; - int iMinSockAddr; - int iSocketType; - int iProtocol; - int iProtocolMaxOffset; - int iNetworkByteOrder; - int iSecurityScheme; - DWORD dwMessageSize; - DWORD dwProviderReserved; - CHAR szProtocol[WSAPROTOCOL_LEN+1]; - } WSAPROTOCOL_INFOA,*LPWSAPROTOCOL_INFOA; - typedef struct _WSAPROTOCOL_INFOW { - DWORD dwServiceFlags1; - DWORD dwServiceFlags2; - DWORD dwServiceFlags3; - DWORD dwServiceFlags4; - DWORD dwProviderFlags; - GUID ProviderId; - DWORD dwCatalogEntryId; - WSAPROTOCOLCHAIN ProtocolChain; - int iVersion; - int iAddressFamily; - int iMaxSockAddr; - int iMinSockAddr; - int iSocketType; - int iProtocol; - int iProtocolMaxOffset; - int iNetworkByteOrder; - int iSecurityScheme; - DWORD dwMessageSize; - DWORD dwProviderReserved; - WCHAR szProtocol[WSAPROTOCOL_LEN+1]; - } WSAPROTOCOL_INFOW,*LPWSAPROTOCOL_INFOW; -#ifdef UNICODE - typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO; - typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO; -#else - typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO; - typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO; -#endif - -#define PFL_MULTIPLE_PROTO_ENTRIES 0x00000001 -#define PFL_RECOMMENDED_PROTO_ENTRY 0x00000002 -#define PFL_HIDDEN 0x00000004 -#define PFL_MATCHES_PROTOCOL_ZERO 0x00000008 - -#define XP1_CONNECTIONLESS 0x00000001 -#define XP1_GUARANTEED_DELIVERY 0x00000002 -#define XP1_GUARANTEED_ORDER 0x00000004 -#define XP1_MESSAGE_ORIENTED 0x00000008 -#define XP1_PSEUDO_STREAM 0x00000010 -#define XP1_GRACEFUL_CLOSE 0x00000020 -#define XP1_EXPEDITED_DATA 0x00000040 -#define XP1_CONNECT_DATA 0x00000080 -#define XP1_DISCONNECT_DATA 0x00000100 -#define XP1_SUPPORT_BROADCAST 0x00000200 -#define XP1_SUPPORT_MULTIPOINT 0x00000400 -#define XP1_MULTIPOINT_CONTROL_PLANE 0x00000800 -#define XP1_MULTIPOINT_DATA_PLANE 0x00001000 -#define XP1_QOS_SUPPORTED 0x00002000 -#define XP1_INTERRUPT 0x00004000 -#define XP1_UNI_SEND 0x00008000 -#define XP1_UNI_RECV 0x00010000 -#define XP1_IFS_HANDLES 0x00020000 -#define XP1_PARTIAL_MESSAGE 0x00040000 - -#define BIGENDIAN 0x0000 -#define LITTLEENDIAN 0x0001 - -#define SECURITY_PROTOCOL_NONE 0x0000 - -#define JL_SENDER_ONLY 0x01 -#define JL_RECEIVER_ONLY 0x02 -#define JL_BOTH 0x04 - -#define WSA_FLAG_OVERLAPPED 0x01 -#define WSA_FLAG_MULTIPOINT_C_ROOT 0x02 -#define WSA_FLAG_MULTIPOINT_C_LEAF 0x04 -#define WSA_FLAG_MULTIPOINT_D_ROOT 0x08 -#define WSA_FLAG_MULTIPOINT_D_LEAF 0x10 - -#define IOC_UNIX 0x00000000 -#define IOC_WS2 0x08000000 -#define IOC_PROTOCOL 0x10000000 -#define IOC_VENDOR 0x18000000 - -#define _WSAIO(x,y) (IOC_VOID|(x)|(y)) -#define _WSAIOR(x,y) (IOC_OUT|(x)|(y)) -#define _WSAIOW(x,y) (IOC_IN|(x)|(y)) -#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y)) - -#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1) -#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2) -#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3) -#define SIO_FLUSH _WSAIO(IOC_WS2,4) -#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5) -#define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6) -#define SIO_GET_QOS _WSAIORW(IOC_WS2,7) -#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8) -#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9) -#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10) -#define SIO_SET_QOS _WSAIOW(IOC_WS2,11) -#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12) -#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13) -#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20) -#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21) -#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22) -#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23) -#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24) -#define SIO_ADDRESS_LIST_SORT _WSAIORW(IOC_WS2,25) - - typedef int (CALLBACK *LPCONDITIONPROC)(LPWSABUF lpCallerId,LPWSABUF lpCallerData,LPQOS lpSQOS,LPQOS lpGQOS,LPWSABUF lpCalleeId,LPWSABUF lpCalleeData,GROUP *g,DWORD_PTR dwCallbackData); - typedef void (CALLBACK *LPWSAOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwError,DWORD cbTransferred,LPWSAOVERLAPPED lpOverlapped,DWORD dwFlags); - -#define SIO_NSP_NOTIFY_CHANGE _WSAIOW(IOC_WS2,25) - - typedef enum _WSACOMPLETIONTYPE { - NSP_NOTIFY_IMMEDIATELY = 0,NSP_NOTIFY_HWND,NSP_NOTIFY_EVENT,NSP_NOTIFY_PORT,NSP_NOTIFY_APC - } WSACOMPLETIONTYPE,*PWSACOMPLETIONTYPE,*LPWSACOMPLETIONTYPE; - - typedef struct _WSACOMPLETION { - WSACOMPLETIONTYPE Type; - union { - struct { - HWND hWnd; - UINT uMsg; - WPARAM context; - } WindowMessage; - struct { - LPWSAOVERLAPPED lpOverlapped; - } Event; - struct { - LPWSAOVERLAPPED lpOverlapped; - LPWSAOVERLAPPED_COMPLETION_ROUTINE lpfnCompletionProc; - } Apc; - struct { - LPWSAOVERLAPPED lpOverlapped; - HANDLE hPort; - ULONG_PTR Key; - } Port; - } Parameters; - } WSACOMPLETION,*PWSACOMPLETION,*LPWSACOMPLETION; - -#define TH_NETDEV 0x00000001 -#define TH_TAPI 0x00000002 - - typedef struct sockaddr SOCKADDR; - typedef struct sockaddr *PSOCKADDR; - typedef struct sockaddr *LPSOCKADDR; - typedef struct sockaddr_storage SOCKADDR_STORAGE; - typedef struct sockaddr_storage *PSOCKADDR_STORAGE; - typedef struct sockaddr_storage *LPSOCKADDR_STORAGE; - -#ifndef _tagBLOB_DEFINED -#define _tagBLOB_DEFINED -#define _BLOB_DEFINED -#define _LPBLOB_DEFINED - typedef struct _BLOB { - ULONG cbSize; - BYTE *pBlobData; - } BLOB,*LPBLOB; -#endif - -#define SERVICE_MULTIPLE (0x00000001) - -#define NS_ALL (0) - -#define NS_SAP (1) -#define NS_NDS (2) -#define NS_PEER_BROWSE (3) -#define NS_SLP (5) -#define NS_DHCP (6) - -#define NS_TCPIP_LOCAL (10) -#define NS_TCPIP_HOSTS (11) -#define NS_DNS (12) -#define NS_NETBT (13) -#define NS_WINS (14) -#define NS_NLA (15) - -#define NS_NBP (20) - -#define NS_MS (30) -#define NS_STDA (31) -#define NS_NTDS (32) - -#define NS_X500 (40) -#define NS_NIS (41) -#define NS_NISPLUS (42) - -#define NS_WRQ (50) - -#define NS_NETDES (60) - -#define RES_UNUSED_1 (0x00000001) -#define RES_FLUSH_CACHE (0x00000002) -#ifndef RES_SERVICE -#define RES_SERVICE (0x00000004) -#endif - -#define SERVICE_TYPE_VALUE_IPXPORTA "IpxSocket" -#define SERVICE_TYPE_VALUE_IPXPORTW L"IpxSocket" -#define SERVICE_TYPE_VALUE_SAPIDA "SapId" -#define SERVICE_TYPE_VALUE_SAPIDW L"SapId" - -#define SERVICE_TYPE_VALUE_TCPPORTA "TcpPort" -#define SERVICE_TYPE_VALUE_TCPPORTW L"TcpPort" - -#define SERVICE_TYPE_VALUE_UDPPORTA "UdpPort" -#define SERVICE_TYPE_VALUE_UDPPORTW L"UdpPort" - -#define SERVICE_TYPE_VALUE_OBJECTIDA "ObjectId" -#define SERVICE_TYPE_VALUE_OBJECTIDW L"ObjectId" - -#ifdef UNICODE - -#define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDW -#define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTW -#define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTW -#define SERVICE_TYPE_VALUE_OBJECTID SERVICE_TYPE_VALUE_OBJECTIDW -#else - -#define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDA -#define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTA -#define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTA -#define SERVICE_TYPE_VALUE_OBJECTID SERVICE_TYPE_VALUE_OBJECTIDA -#endif - -#ifndef __CSADDR_DEFINED__ -#define __CSADDR_DEFINED__ - - typedef struct _SOCKET_ADDRESS { - LPSOCKADDR lpSockaddr; - INT iSockaddrLength; - } SOCKET_ADDRESS,*PSOCKET_ADDRESS,*LPSOCKET_ADDRESS; - - typedef struct _CSADDR_INFO { - SOCKET_ADDRESS LocalAddr; - SOCKET_ADDRESS RemoteAddr; - INT iSocketType; - INT iProtocol; - } CSADDR_INFO,*PCSADDR_INFO,*LPCSADDR_INFO; -#endif - - typedef struct _SOCKET_ADDRESS_LIST { - INT iAddressCount; - SOCKET_ADDRESS Address[1]; - } SOCKET_ADDRESS_LIST,*LPSOCKET_ADDRESS_LIST; - - typedef struct _AFPROTOCOLS { - INT iAddressFamily; - INT iProtocol; - } AFPROTOCOLS,*PAFPROTOCOLS,*LPAFPROTOCOLS; - - typedef enum _WSAEcomparator { - COMP_EQUAL = 0,COMP_NOTLESS - } WSAECOMPARATOR,*PWSAECOMPARATOR,*LPWSAECOMPARATOR; - - typedef struct _WSAVersion { - DWORD dwVersion; - WSAECOMPARATOR ecHow; - } WSAVERSION,*PWSAVERSION,*LPWSAVERSION; - - typedef struct _WSAQuerySetA { - DWORD dwSize; - LPSTR lpszServiceInstanceName; - LPGUID lpServiceClassId; - LPWSAVERSION lpVersion; - LPSTR lpszComment; - DWORD dwNameSpace; - LPGUID lpNSProviderId; - LPSTR lpszContext; - DWORD dwNumberOfProtocols; - LPAFPROTOCOLS lpafpProtocols; - LPSTR lpszQueryString; - DWORD dwNumberOfCsAddrs; - LPCSADDR_INFO lpcsaBuffer; - DWORD dwOutputFlags; - LPBLOB lpBlob; - } WSAQUERYSETA,*PWSAQUERYSETA,*LPWSAQUERYSETA; - - typedef struct _WSAQuerySetW { - DWORD dwSize; - LPWSTR lpszServiceInstanceName; - LPGUID lpServiceClassId; - LPWSAVERSION lpVersion; - LPWSTR lpszComment; - DWORD dwNameSpace; - LPGUID lpNSProviderId; - LPWSTR lpszContext; - DWORD dwNumberOfProtocols; - LPAFPROTOCOLS lpafpProtocols; - LPWSTR lpszQueryString; - DWORD dwNumberOfCsAddrs; - LPCSADDR_INFO lpcsaBuffer; - DWORD dwOutputFlags; - LPBLOB lpBlob; - } WSAQUERYSETW,*PWSAQUERYSETW,*LPWSAQUERYSETW; - -#ifdef UNICODE - typedef WSAQUERYSETW WSAQUERYSET; - typedef PWSAQUERYSETW PWSAQUERYSET; - typedef LPWSAQUERYSETW LPWSAQUERYSET; -#else - typedef WSAQUERYSETA WSAQUERYSET; - typedef PWSAQUERYSETA PWSAQUERYSET; - typedef LPWSAQUERYSETA LPWSAQUERYSET; -#endif - -#define LUP_DEEP 0x0001 -#define LUP_CONTAINERS 0x0002 -#define LUP_NOCONTAINERS 0x0004 -#define LUP_NEAREST 0x0008 -#define LUP_RETURN_NAME 0x0010 -#define LUP_RETURN_TYPE 0x0020 -#define LUP_RETURN_VERSION 0x0040 -#define LUP_RETURN_COMMENT 0x0080 -#define LUP_RETURN_ADDR 0x0100 -#define LUP_RETURN_BLOB 0x0200 -#define LUP_RETURN_ALIASES 0x0400 -#define LUP_RETURN_QUERY_STRING 0x0800 -#define LUP_RETURN_ALL 0x0FF0 -#define LUP_RES_SERVICE 0x8000 - -#define LUP_FLUSHCACHE 0x1000 -#define LUP_FLUSHPREVIOUS 0x2000 - -#define RESULT_IS_ALIAS 0x0001 -#define RESULT_IS_ADDED 0x0010 -#define RESULT_IS_CHANGED 0x0020 -#define RESULT_IS_DELETED 0x0040 - - typedef enum _WSAESETSERVICEOP { - RNRSERVICE_REGISTER=0,RNRSERVICE_DEREGISTER,RNRSERVICE_DELETE - } WSAESETSERVICEOP,*PWSAESETSERVICEOP,*LPWSAESETSERVICEOP; - - typedef struct _WSANSClassInfoA { - LPSTR lpszName; - DWORD dwNameSpace; - DWORD dwValueType; - DWORD dwValueSize; - LPVOID lpValue; - } WSANSCLASSINFOA,*PWSANSCLASSINFOA,*LPWSANSCLASSINFOA; - - typedef struct _WSANSClassInfoW { - LPWSTR lpszName; - DWORD dwNameSpace; - DWORD dwValueType; - DWORD dwValueSize; - LPVOID lpValue; - } WSANSCLASSINFOW,*PWSANSCLASSINFOW,*LPWSANSCLASSINFOW; - -#ifdef UNICODE - typedef WSANSCLASSINFOW WSANSCLASSINFO; - typedef PWSANSCLASSINFOW PWSANSCLASSINFO; - typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO; -#else - typedef WSANSCLASSINFOA WSANSCLASSINFO; - typedef PWSANSCLASSINFOA PWSANSCLASSINFO; - typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO; -#endif - - typedef struct _WSAServiceClassInfoA { - LPGUID lpServiceClassId; - LPSTR lpszServiceClassName; - DWORD dwCount; - LPWSANSCLASSINFOA lpClassInfos; - } WSASERVICECLASSINFOA,*PWSASERVICECLASSINFOA,*LPWSASERVICECLASSINFOA; - - typedef struct _WSAServiceClassInfoW { - LPGUID lpServiceClassId; - LPWSTR lpszServiceClassName; - DWORD dwCount; - LPWSANSCLASSINFOW lpClassInfos; - } WSASERVICECLASSINFOW,*PWSASERVICECLASSINFOW,*LPWSASERVICECLASSINFOW; - -#ifdef UNICODE - typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO; - typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO; - typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO; -#else - typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO; - typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO; - typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO; -#endif - - typedef struct _WSANAMESPACE_INFOA { - GUID NSProviderId; - DWORD dwNameSpace; - WINBOOL fActive; - DWORD dwVersion; - LPSTR lpszIdentifier; - } WSANAMESPACE_INFOA,*PWSANAMESPACE_INFOA,*LPWSANAMESPACE_INFOA; - - typedef struct _WSANAMESPACE_INFOW { - GUID NSProviderId; - DWORD dwNameSpace; - WINBOOL fActive; - DWORD dwVersion; - LPWSTR lpszIdentifier; - } WSANAMESPACE_INFOW,*PWSANAMESPACE_INFOW,*LPWSANAMESPACE_INFOW; - -#ifdef UNICODE - typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO; - typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO; - typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO; -#else - typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO; - typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO; - typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO; -#endif - -#if INCL_WINSOCK_API_TYPEDEFS -#ifdef UNICODE -#define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETW -#define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSW -#define LPFN_WSASOCKET LPFN_WSASOCKETW -#define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGW -#define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSW -#define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINW -#define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTW -#define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSW -#define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOW -#define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSW -#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW -#define LPFN_WSASETSERVICE LPFN_WSASETSERVICEW -#else -#define LPFN_WSADUPLICATESOCKET LPFN_WSADUPLICATESOCKETA -#define LPFN_WSAENUMPROTOCOLS LPFN_WSAENUMPROTOCOLSA -#define LPFN_WSASOCKET LPFN_WSASOCKETA -#define LPFN_WSAADDRESSTOSTRING LPFN_WSAADDRESSTOSTRINGA -#define LPFN_WSASTRINGTOADDRESS LPFN_WSASTRINGTOADDRESSA -#define LPFN_WSALOOKUPSERVICEBEGIN LPFN_WSALOOKUPSERVICEBEGINA -#define LPFN_WSALOOKUPSERVICENEXT LPFN_WSALOOKUPSERVICENEXTA -#define LPFN_WSAINSTALLSERVICECLASS LPFN_WSAINSTALLSERVICECLASSA -#define LPFN_WSAGETSERVICECLASSINFO LPFN_WSAGETSERVICECLASSINFOA -#define LPFN_WSAENUMNAMESPACEPROVIDERS LPFN_WSAENUMNAMESPACEPROVIDERSA -#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA -#define LPFN_WSASETSERVICE LPFN_WSASETSERVICEA -#endif - - typedef SOCKET (WSAAPI *LPFN_ACCEPT)(SOCKET s,struct sockaddr *addr,int *addrlen); - typedef int (WSAAPI *LPFN_BIND)(SOCKET s,const struct sockaddr *name,int namelen); - typedef int (WSAAPI *LPFN_CLOSESOCKET)(SOCKET s); - typedef int (WSAAPI *LPFN_CONNECT)(SOCKET s,const struct sockaddr *name,int namelen); - typedef int (WSAAPI *LPFN_IOCTLSOCKET)(SOCKET s,long cmd,u_long *argp); - typedef int (WSAAPI *LPFN_GETPEERNAME)(SOCKET s,struct sockaddr *name,int *namelen); - typedef int (WSAAPI *LPFN_GETSOCKNAME)(SOCKET s,struct sockaddr *name,int *namelen); - typedef int (WSAAPI *LPFN_GETSOCKOPT)(SOCKET s,int level,int optname,char *optval,int *optlen); - typedef u_long (WSAAPI *LPFN_HTONL)(u_long hostlong); - typedef u_short (WSAAPI *LPFN_HTONS)(u_short hostshort); - typedef unsigned long (WSAAPI *LPFN_INET_ADDR)(const char *cp); - typedef char *(WSAAPI *LPFN_INET_NTOA)(struct in_addr in); - typedef int (WSAAPI *LPFN_LISTEN)(SOCKET s,int backlog); - typedef u_long (WSAAPI *LPFN_NTOHL)(u_long netlong); - typedef u_short (WSAAPI *LPFN_NTOHS)(u_short netshort); - typedef int (WSAAPI *LPFN_RECV)(SOCKET s,char *buf,int len,int flags); - typedef int (WSAAPI *LPFN_RECVFROM)(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen); - typedef int (WSAAPI *LPFN_SELECT)(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const struct timeval *timeout); - typedef int (WSAAPI *LPFN_SEND)(SOCKET s,const char *buf,int len,int flags); - typedef int (WSAAPI *LPFN_SENDTO)(SOCKET s,const char *buf,int len,int flags,const struct sockaddr *to,int tolen); - typedef int (WSAAPI *LPFN_SETSOCKOPT)(SOCKET s,int level,int optname,const char *optval,int optlen); - typedef int (WSAAPI *LPFN_SHUTDOWN)(SOCKET s,int how); - typedef SOCKET (WSAAPI *LPFN_SOCKET)(int af,int type,int protocol); - typedef struct hostent *(WSAAPI *LPFN_GETHOSTBYADDR)(const char *addr,int len,int type); - typedef struct hostent *(WSAAPI *LPFN_GETHOSTBYNAME)(const char *name); - typedef int (WSAAPI *LPFN_GETHOSTNAME)(char *name,int namelen); - typedef struct servent *(WSAAPI *LPFN_GETSERVBYPORT)(int port,const char *proto); - typedef struct servent *(WSAAPI *LPFN_GETSERVBYNAME)(const char *name,const char *proto); - typedef struct protoent *(WSAAPI *LPFN_GETPROTOBYNUMBER)(int number); - typedef struct protoent *(WSAAPI *LPFN_GETPROTOBYNAME)(const char *name); - typedef int (WSAAPI *LPFN_WSASTARTUP)(WORD wVersionRequested,LPWSADATA lpWSAData); - typedef int (WSAAPI *LPFN_WSACLEANUP)(void); - typedef void (WSAAPI *LPFN_WSASETLASTERROR)(int iError); - typedef int (WSAAPI *LPFN_WSAGETLASTERROR)(void); - typedef WINBOOL (WSAAPI *LPFN_WSAISBLOCKING)(void); - typedef int (WSAAPI *LPFN_WSAUNHOOKBLOCKINGHOOK)(void); - typedef FARPROC (WSAAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC lpBlockFunc); - typedef int (WSAAPI *LPFN_WSACANCELBLOCKINGCALL)(void); - typedef HANDLE (WSAAPI *LPFN_WSAASYNCGETSERVBYNAME)(HWND hWnd,u_int wMsg,const char *name,const char *proto,char *buf,int buflen); - typedef HANDLE (WSAAPI *LPFN_WSAASYNCGETSERVBYPORT)(HWND hWnd,u_int wMsg,int port,const char *proto,char *buf,int buflen); - typedef HANDLE (WSAAPI *LPFN_WSAASYNCGETPROTOBYNAME)(HWND hWnd,u_int wMsg,const char *name,char *buf,int buflen); - typedef HANDLE (WSAAPI *LPFN_WSAASYNCGETPROTOBYNUMBER)(HWND hWnd,u_int wMsg,int number,char *buf,int buflen); - typedef HANDLE (WSAAPI *LPFN_WSAASYNCGETHOSTBYNAME)(HWND hWnd,u_int wMsg,const char *name,char *buf,int buflen); - typedef HANDLE (WSAAPI *LPFN_WSAASYNCGETHOSTBYADDR)(HWND hWnd,u_int wMsg,const char *addr,int len,int type,char *buf,int buflen); - typedef int (WSAAPI *LPFN_WSACANCELASYNCREQUEST)(HANDLE hAsyncTaskHandle); - typedef int (WSAAPI *LPFN_WSAASYNCSELECT)(SOCKET s,HWND hWnd,u_int wMsg,long lEvent); - typedef SOCKET (WSAAPI *LPFN_WSAACCEPT)(SOCKET s,struct sockaddr *addr,LPINT addrlen,LPCONDITIONPROC lpfnCondition,DWORD_PTR dwCallbackData); - typedef WINBOOL (WSAAPI *LPFN_WSACLOSEEVENT)(WSAEVENT hEvent); - typedef int (WSAAPI *LPFN_WSACONNECT)(SOCKET s,const struct sockaddr *name,int namelen,LPWSABUF lpCallerData,LPWSABUF lpCalleeData,LPQOS lpSQOS,LPQOS lpGQOS); - typedef WSAEVENT (WSAAPI *LPFN_WSACREATEEVENT)(void); - typedef int (WSAAPI *LPFN_WSADUPLICATESOCKETA)(SOCKET s,DWORD dwProcessId,LPWSAPROTOCOL_INFOA lpProtocolInfo); - typedef int (WSAAPI *LPFN_WSADUPLICATESOCKETW)(SOCKET s,DWORD dwProcessId,LPWSAPROTOCOL_INFOW lpProtocolInfo); - typedef int (WSAAPI *LPFN_WSAENUMNETWORKEVENTS)(SOCKET s,WSAEVENT hEventObject,LPWSANETWORKEVENTS lpNetworkEvents); - typedef int (WSAAPI *LPFN_WSAENUMPROTOCOLSA)(LPINT lpiProtocols,LPWSAPROTOCOL_INFOA lpProtocolBuffer,LPDWORD lpdwBufferLength); - typedef int (WSAAPI *LPFN_WSAENUMPROTOCOLSW)(LPINT lpiProtocols,LPWSAPROTOCOL_INFOW lpProtocolBuffer,LPDWORD lpdwBufferLength); - typedef int (WSAAPI *LPFN_WSAEVENTSELECT)(SOCKET s,WSAEVENT hEventObject,long lNetworkEvents); - typedef WINBOOL (WSAAPI *LPFN_WSAGETOVERLAPPEDRESULT)(SOCKET s,LPWSAOVERLAPPED lpOverlapped,LPDWORD lpcbTransfer,WINBOOL fWait,LPDWORD lpdwFlags); - typedef WINBOOL (WSAAPI *LPFN_WSAGETQOSBYNAME)(SOCKET s,LPWSABUF lpQOSName,LPQOS lpQOS); - typedef int (WSAAPI *LPFN_WSAHTONL)(SOCKET s,u_long hostlong,u_long *lpnetlong); - typedef int (WSAAPI *LPFN_WSAHTONS)(SOCKET s,u_short hostshort,u_short *lpnetshort); - typedef int (WSAAPI *LPFN_WSAIOCTL)(SOCKET s,DWORD dwIoControlCode,LPVOID lpvInBuffer,DWORD cbInBuffer,LPVOID lpvOutBuffer,DWORD cbOutBuffer,LPDWORD lpcbBytesReturned,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - typedef SOCKET (WSAAPI *LPFN_WSAJOINLEAF)(SOCKET s,const struct sockaddr *name,int namelen,LPWSABUF lpCallerData,LPWSABUF lpCalleeData,LPQOS lpSQOS,LPQOS lpGQOS,DWORD dwFlags); - typedef int (WSAAPI *LPFN_WSANTOHL)(SOCKET s,u_long netlong,u_long *lphostlong); - typedef int (WSAAPI *LPFN_WSANTOHS)(SOCKET s,u_short netshort,u_short *lphostshort); - typedef int (WSAAPI *LPFN_WSARECV)(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesRecvd,LPDWORD lpFlags,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - typedef int (WSAAPI *LPFN_WSARECVDISCONNECT)(SOCKET s,LPWSABUF lpInboundDisconnectData); - typedef int (WSAAPI *LPFN_WSARECVFROM)(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesRecvd,LPDWORD lpFlags,struct sockaddr *lpFrom,LPINT lpFromlen,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - typedef WINBOOL (WSAAPI *LPFN_WSARESETEVENT)(WSAEVENT hEvent); - typedef int (WSAAPI *LPFN_WSASEND)(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesSent,DWORD dwFlags,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - typedef int (WSAAPI *LPFN_WSASENDDISCONNECT)(SOCKET s,LPWSABUF lpOutboundDisconnectData); - typedef int (WSAAPI *LPFN_WSASENDTO)(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesSent,DWORD dwFlags,const struct sockaddr *lpTo,int iTolen,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - typedef WINBOOL (WSAAPI *LPFN_WSASETEVENT)(WSAEVENT hEvent); - typedef SOCKET (WSAAPI *LPFN_WSASOCKETA)(int af,int type,int protocol,LPWSAPROTOCOL_INFOA lpProtocolInfo,GROUP g,DWORD dwFlags); - typedef SOCKET (WSAAPI *LPFN_WSASOCKETW)(int af,int type,int protocol,LPWSAPROTOCOL_INFOW lpProtocolInfo,GROUP g,DWORD dwFlags); - typedef DWORD (WSAAPI *LPFN_WSAWAITFORMULTIPLEEVENTS)(DWORD cEvents,const WSAEVENT *lphEvents,WINBOOL fWaitAll,DWORD dwTimeout,WINBOOL fAlertable); - typedef INT (WSAAPI *LPFN_WSAADDRESSTOSTRINGA)(LPSOCKADDR lpsaAddress,DWORD dwAddressLength,LPWSAPROTOCOL_INFOA lpProtocolInfo,LPSTR lpszAddressString,LPDWORD lpdwAddressStringLength); - typedef INT (WSAAPI *LPFN_WSAADDRESSTOSTRINGW)(LPSOCKADDR lpsaAddress,DWORD dwAddressLength,LPWSAPROTOCOL_INFOW lpProtocolInfo,LPWSTR lpszAddressString,LPDWORD lpdwAddressStringLength); - typedef INT (WSAAPI *LPFN_WSASTRINGTOADDRESSA)(LPSTR AddressString,INT AddressFamily,LPWSAPROTOCOL_INFOA lpProtocolInfo,LPSOCKADDR lpAddress,LPINT lpAddressLength); - typedef INT (WSAAPI *LPFN_WSASTRINGTOADDRESSW)(LPWSTR AddressString,INT AddressFamily,LPWSAPROTOCOL_INFOW lpProtocolInfo,LPSOCKADDR lpAddress,LPINT lpAddressLength); - typedef INT (WSAAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA lpqsRestrictions,DWORD dwControlFlags,LPHANDLE lphLookup); - typedef INT (WSAAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW lpqsRestrictions,DWORD dwControlFlags,LPHANDLE lphLookup); - typedef INT (WSAAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE hLookup,DWORD dwControlFlags,LPDWORD lpdwBufferLength,LPWSAQUERYSETA lpqsResults); - typedef INT (WSAAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE hLookup,DWORD dwControlFlags,LPDWORD lpdwBufferLength,LPWSAQUERYSETW lpqsResults); - typedef INT (WSAAPI *LPFN_WSANSPIOCTL)(HANDLE hLookup,DWORD dwControlCode,LPVOID lpvInBuffer,DWORD cbInBuffer,LPVOID lpvOutBuffer,DWORD cbOutBuffer,LPDWORD lpcbBytesReturned,LPWSACOMPLETION lpCompletion); - typedef INT (WSAAPI *LPFN_WSALOOKUPSERVICEEND)(HANDLE hLookup); - typedef INT (WSAAPI *LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA lpServiceClassInfo); - typedef INT (WSAAPI *LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW lpServiceClassInfo); - typedef INT (WSAAPI *LPFN_WSAREMOVESERVICECLASS)(LPGUID lpServiceClassId); - typedef INT (WSAAPI *LPFN_WSAGETSERVICECLASSINFOA)(LPGUID lpProviderId,LPGUID lpServiceClassId,LPDWORD lpdwBufSize,LPWSASERVICECLASSINFOA lpServiceClassInfo); - typedef INT (WSAAPI *LPFN_WSAGETSERVICECLASSINFOW)(LPGUID lpProviderId,LPGUID lpServiceClassId,LPDWORD lpdwBufSize,LPWSASERVICECLASSINFOW lpServiceClassInfo); - typedef INT (WSAAPI *LPFN_WSAENUMNAMESPACEPROVIDERSA)(LPDWORD lpdwBufferLength,LPWSANAMESPACE_INFOA lpnspBuffer); - typedef INT (WSAAPI *LPFN_WSAENUMNAMESPACEPROVIDERSW)(LPDWORD lpdwBufferLength,LPWSANAMESPACE_INFOW lpnspBuffer); - typedef INT (WSAAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID lpServiceClassId,LPSTR lpszServiceClassName,LPDWORD lpdwBufferLength); - typedef INT (WSAAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID lpServiceClassId,LPWSTR lpszServiceClassName,LPDWORD lpdwBufferLength); - typedef INT (WSAAPI *LPFN_WSASETSERVICEA)(LPWSAQUERYSETA lpqsRegInfo,WSAESETSERVICEOP essoperation,DWORD dwControlFlags); - typedef INT (WSAAPI *LPFN_WSASETSERVICEW)(LPWSAQUERYSETW lpqsRegInfo,WSAESETSERVICEOP essoperation,DWORD dwControlFlags); - typedef INT (WSAAPI *LPFN_WSAPROVIDERCONFIGCHANGE)(LPHANDLE lpNotificationHandle,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); -#endif - -#ifdef UNICODE -#define WSADuplicateSocket WSADuplicateSocketW -#define WSAEnumProtocols WSAEnumProtocolsW -#define WSAAddressToString WSAAddressToStringW -#define WSASocket WSASocketW -#define WSAStringToAddress WSAStringToAddressW -#define WSALookupServiceBegin WSALookupServiceBeginW -#define WSALookupServiceNext WSALookupServiceNextW -#define WSAInstallServiceClass WSAInstallServiceClassW -#define WSAGetServiceClassInfo WSAGetServiceClassInfoW -#define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersW -#define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdW -#define WSASetService WSASetServiceW -#else -#define WSADuplicateSocket WSADuplicateSocketA -#define WSAEnumProtocols WSAEnumProtocolsA -#define WSASocket WSASocketA -#define WSAAddressToString WSAAddressToStringA -#define WSAStringToAddress WSAStringToAddressA -#define WSALookupServiceBegin WSALookupServiceBeginA -#define WSALookupServiceNext WSALookupServiceNextA -#define WSAInstallServiceClass WSAInstallServiceClassA -#define WSAGetServiceClassInfo WSAGetServiceClassInfoA -#define WSAEnumNameSpaceProviders WSAEnumNameSpaceProvidersA -#define WSAGetServiceClassNameByClassId WSAGetServiceClassNameByClassIdA -#define WSASetService WSASetServiceA -#endif - - WINSOCK_API_LINKAGE SOCKET WSAAPI accept(SOCKET s,struct sockaddr *addr,int *addrlen); - WINSOCK_API_LINKAGE int WSAAPI bind(SOCKET s,const struct sockaddr *name,int namelen); - WINSOCK_API_LINKAGE int WSAAPI closesocket(SOCKET s); - WINSOCK_API_LINKAGE int WSAAPI connect(SOCKET s,const struct sockaddr *name,int namelen); - WINSOCK_API_LINKAGE int WSAAPI ioctlsocket(SOCKET s,long cmd,u_long *argp); - WINSOCK_API_LINKAGE int WSAAPI getpeername(SOCKET s,struct sockaddr *name,int *namelen); - WINSOCK_API_LINKAGE int WSAAPI getsockname(SOCKET s,struct sockaddr *name,int *namelen); - WINSOCK_API_LINKAGE int WSAAPI getsockopt(SOCKET s,int level,int optname,char *optval,int *optlen); - WINSOCK_API_LINKAGE u_long WSAAPI htonl(u_long hostlong); - WINSOCK_API_LINKAGE u_short WSAAPI htons(u_short hostshort); - WINSOCK_API_LINKAGE unsigned long WSAAPI inet_addr(const char *cp); - WINSOCK_API_LINKAGE char *WSAAPI inet_ntoa(struct in_addr in); - WINSOCK_API_LINKAGE int WSAAPI listen(SOCKET s,int backlog); - WINSOCK_API_LINKAGE u_long WSAAPI ntohl(u_long netlong); - WINSOCK_API_LINKAGE u_short WSAAPI ntohs(u_short netshort); - WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags); - WINSOCK_API_LINKAGE int WSAAPI recvfrom(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen); - WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const struct timeval *timeout); - WINSOCK_API_LINKAGE int WSAAPI send(SOCKET s,const char *buf,int len,int flags); - WINSOCK_API_LINKAGE int WSAAPI sendto(SOCKET s,const char *buf,int len,int flags,const struct sockaddr *to,int tolen); - WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int optname,const char *optval,int optlen); - WINSOCK_API_LINKAGE int WSAAPI shutdown(SOCKET s,int how); - WINSOCK_API_LINKAGE SOCKET WSAAPI socket(int af,int type,int protocol); - WINSOCK_API_LINKAGE struct hostent *WSAAPI gethostbyaddr(const char *addr,int len,int type); - WINSOCK_API_LINKAGE struct hostent *WSAAPI gethostbyname(const char *name); - WINSOCK_API_LINKAGE int WSAAPI gethostname(char *name,int namelen); - WINSOCK_API_LINKAGE struct servent *WSAAPI getservbyport(int port,const char *proto); - WINSOCK_API_LINKAGE struct servent *WSAAPI getservbyname(const char *name,const char *proto); - WINSOCK_API_LINKAGE struct protoent *WSAAPI getprotobynumber(int number); - WINSOCK_API_LINKAGE struct protoent *WSAAPI getprotobyname(const char *name); - WINSOCK_API_LINKAGE int WSAAPI WSAStartup(WORD wVersionRequested,LPWSADATA lpWSAData); - WINSOCK_API_LINKAGE int WSAAPI WSACleanup(void); - WINSOCK_API_LINKAGE void WSAAPI WSASetLastError(int iError); - WINSOCK_API_LINKAGE int WSAAPI WSAGetLastError(void); - WINSOCK_API_LINKAGE WINBOOL WSAAPI WSAIsBlocking(void); - WINSOCK_API_LINKAGE int WSAAPI WSAUnhookBlockingHook(void); - WINSOCK_API_LINKAGE FARPROC WSAAPI WSASetBlockingHook(FARPROC lpBlockFunc); - WINSOCK_API_LINKAGE int WSAAPI WSACancelBlockingCall(void); - WINSOCK_API_LINKAGE HANDLE WSAAPI WSAAsyncGetServByName(HWND hWnd,u_int wMsg,const char *name,const char *proto,char *buf,int buflen); - WINSOCK_API_LINKAGE HANDLE WSAAPI WSAAsyncGetServByPort(HWND hWnd,u_int wMsg,int port,const char *proto,char *buf,int buflen); - WINSOCK_API_LINKAGE HANDLE WSAAPI WSAAsyncGetProtoByName(HWND hWnd,u_int wMsg,const char *name,char *buf,int buflen); - WINSOCK_API_LINKAGE HANDLE WSAAPI WSAAsyncGetProtoByNumber(HWND hWnd,u_int wMsg,int number,char *buf,int buflen); - WINSOCK_API_LINKAGE HANDLE WSAAPI WSAAsyncGetHostByName(HWND hWnd,u_int wMsg,const char *name,char *buf,int buflen); - WINSOCK_API_LINKAGE HANDLE WSAAPI WSAAsyncGetHostByAddr(HWND hWnd,u_int wMsg,const char *addr,int len,int type,char *buf,int buflen); - WINSOCK_API_LINKAGE int WSAAPI WSACancelAsyncRequest(HANDLE hAsyncTaskHandle); - WINSOCK_API_LINKAGE int WSAAPI WSAAsyncSelect(SOCKET s,HWND hWnd,u_int wMsg,long lEvent); - WINSOCK_API_LINKAGE SOCKET WSAAPI WSAAccept(SOCKET s,struct sockaddr *addr,LPINT addrlen,LPCONDITIONPROC lpfnCondition,DWORD_PTR dwCallbackData); - WINSOCK_API_LINKAGE WINBOOL WSAAPI WSACloseEvent(WSAEVENT hEvent); - WINSOCK_API_LINKAGE int WSAAPI WSAConnect(SOCKET s,const struct sockaddr *name,int namelen,LPWSABUF lpCallerData,LPWSABUF lpCalleeData,LPQOS lpSQOS,LPQOS lpGQOS); - WINSOCK_API_LINKAGE WSAEVENT WSAAPI WSACreateEvent(void); - WINSOCK_API_LINKAGE int WSAAPI WSADuplicateSocketA(SOCKET s,DWORD dwProcessId,LPWSAPROTOCOL_INFOA lpProtocolInfo); - WINSOCK_API_LINKAGE int WSAAPI WSADuplicateSocketW(SOCKET s,DWORD dwProcessId,LPWSAPROTOCOL_INFOW lpProtocolInfo); - WINSOCK_API_LINKAGE int WSAAPI WSAEnumNetworkEvents(SOCKET s,WSAEVENT hEventObject,LPWSANETWORKEVENTS lpNetworkEvents); - WINSOCK_API_LINKAGE int WSAAPI WSAEnumProtocolsA(LPINT lpiProtocols,LPWSAPROTOCOL_INFOA lpProtocolBuffer,LPDWORD lpdwBufferLength); - WINSOCK_API_LINKAGE int WSAAPI WSAEnumProtocolsW(LPINT lpiProtocols,LPWSAPROTOCOL_INFOW lpProtocolBuffer,LPDWORD lpdwBufferLength); - WINSOCK_API_LINKAGE int WSAAPI WSAEventSelect(SOCKET s,WSAEVENT hEventObject,long lNetworkEvents); - WINSOCK_API_LINKAGE WINBOOL WSAAPI WSAGetOverlappedResult(SOCKET s,LPWSAOVERLAPPED lpOverlapped,LPDWORD lpcbTransfer,WINBOOL fWait,LPDWORD lpdwFlags); - WINSOCK_API_LINKAGE WINBOOL WSAAPI WSAGetQOSByName(SOCKET s,LPWSABUF lpQOSName,LPQOS lpQOS); - WINSOCK_API_LINKAGE int WSAAPI WSAHtonl(SOCKET s,u_long hostlong,u_long *lpnetlong); - WINSOCK_API_LINKAGE int WSAAPI WSAHtons(SOCKET s,u_short hostshort,u_short *lpnetshort); - WINSOCK_API_LINKAGE int WSAAPI WSAIoctl(SOCKET s,DWORD dwIoControlCode,LPVOID lpvInBuffer,DWORD cbInBuffer,LPVOID lpvOutBuffer,DWORD cbOutBuffer,LPDWORD lpcbBytesReturned,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINSOCK_API_LINKAGE SOCKET WSAAPI WSAJoinLeaf(SOCKET s,const struct sockaddr *name,int namelen,LPWSABUF lpCallerData,LPWSABUF lpCalleeData,LPQOS lpSQOS,LPQOS lpGQOS,DWORD dwFlags); - WINSOCK_API_LINKAGE int WSAAPI WSANtohl(SOCKET s,u_long netlong,u_long *lphostlong); - WINSOCK_API_LINKAGE int WSAAPI WSANtohs(SOCKET s,u_short netshort,u_short *lphostshort); - WINSOCK_API_LINKAGE int WSAAPI WSARecv(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesRecvd,LPDWORD lpFlags,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINSOCK_API_LINKAGE int WSAAPI WSARecvDisconnect(SOCKET s,LPWSABUF lpInboundDisconnectData); - WINSOCK_API_LINKAGE int WSAAPI WSARecvFrom(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesRecvd,LPDWORD lpFlags,struct sockaddr *lpFrom,LPINT lpFromlen,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINSOCK_API_LINKAGE WINBOOL WSAAPI WSAResetEvent(WSAEVENT hEvent); - WINSOCK_API_LINKAGE int WSAAPI WSASend(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesSent,DWORD dwFlags,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINSOCK_API_LINKAGE int WSAAPI WSASendDisconnect(SOCKET s,LPWSABUF lpOutboundDisconnectData); - WINSOCK_API_LINKAGE int WSAAPI WSASendTo(SOCKET s,LPWSABUF lpBuffers,DWORD dwBufferCount,LPDWORD lpNumberOfBytesSent,DWORD dwFlags,const struct sockaddr *lpTo,int iTolen,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - WINSOCK_API_LINKAGE WINBOOL WSAAPI WSASetEvent(WSAEVENT hEvent); - WINSOCK_API_LINKAGE SOCKET WSAAPI WSASocketA(int af,int type,int protocol,LPWSAPROTOCOL_INFOA lpProtocolInfo,GROUP g,DWORD dwFlags); - WINSOCK_API_LINKAGE SOCKET WSAAPI WSASocketW(int af,int type,int protocol,LPWSAPROTOCOL_INFOW lpProtocolInfo,GROUP g,DWORD dwFlags); - WINSOCK_API_LINKAGE DWORD WSAAPI WSAWaitForMultipleEvents(DWORD cEvents,const WSAEVENT *lphEvents,WINBOOL fWaitAll,DWORD dwTimeout,WINBOOL fAlertable); - WINSOCK_API_LINKAGE INT WSAAPI WSAAddressToStringA(LPSOCKADDR lpsaAddress,DWORD dwAddressLength,LPWSAPROTOCOL_INFOA lpProtocolInfo,LPSTR lpszAddressString,LPDWORD lpdwAddressStringLength); - WINSOCK_API_LINKAGE INT WSAAPI WSAAddressToStringW(LPSOCKADDR lpsaAddress,DWORD dwAddressLength,LPWSAPROTOCOL_INFOW lpProtocolInfo,LPWSTR lpszAddressString,LPDWORD lpdwAddressStringLength); - WINSOCK_API_LINKAGE INT WSAAPI WSAStringToAddressA(LPSTR AddressString,INT AddressFamily,LPWSAPROTOCOL_INFOA lpProtocolInfo,LPSOCKADDR lpAddress,LPINT lpAddressLength); - WINSOCK_API_LINKAGE INT WSAAPI WSAStringToAddressW(LPWSTR AddressString,INT AddressFamily,LPWSAPROTOCOL_INFOW lpProtocolInfo,LPSOCKADDR lpAddress,LPINT lpAddressLength); - WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceBeginA(LPWSAQUERYSETA lpqsRestrictions,DWORD dwControlFlags,LPHANDLE lphLookup); - WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceBeginW(LPWSAQUERYSETW lpqsRestrictions,DWORD dwControlFlags,LPHANDLE lphLookup); - WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceNextA(HANDLE hLookup,DWORD dwControlFlags,LPDWORD lpdwBufferLength,LPWSAQUERYSETA lpqsResults); - WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceNextW(HANDLE hLookup,DWORD dwControlFlags,LPDWORD lpdwBufferLength,LPWSAQUERYSETW lpqsResults); - WINSOCK_API_LINKAGE INT WSAAPI WSANSPIoctl(HANDLE hLookup,DWORD dwControlCode,LPVOID lpvInBuffer,DWORD cbInBuffer,LPVOID lpvOutBuffer,DWORD cbOutBuffer,LPDWORD lpcbBytesReturned,LPWSACOMPLETION lpCompletion); - WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceEnd(HANDLE hLookup); - WINSOCK_API_LINKAGE INT WSAAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA lpServiceClassInfo); - WINSOCK_API_LINKAGE INT WSAAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW lpServiceClassInfo); - WINSOCK_API_LINKAGE INT WSAAPI WSARemoveServiceClass(LPGUID lpServiceClassId); - WINSOCK_API_LINKAGE INT WSAAPI WSAGetServiceClassInfoA(LPGUID lpProviderId,LPGUID lpServiceClassId,LPDWORD lpdwBufSize,LPWSASERVICECLASSINFOA lpServiceClassInfo); - WINSOCK_API_LINKAGE INT WSAAPI WSAGetServiceClassInfoW(LPGUID lpProviderId,LPGUID lpServiceClassId,LPDWORD lpdwBufSize,LPWSASERVICECLASSINFOW lpServiceClassInfo); - WINSOCK_API_LINKAGE INT WSAAPI WSAEnumNameSpaceProvidersA(LPDWORD lpdwBufferLength,LPWSANAMESPACE_INFOA lpnspBuffer); - WINSOCK_API_LINKAGE INT WSAAPI WSAEnumNameSpaceProvidersW(LPDWORD lpdwBufferLength,LPWSANAMESPACE_INFOW lpnspBuffer); - WINSOCK_API_LINKAGE INT WSAAPI WSAGetServiceClassNameByClassIdA(LPGUID lpServiceClassId,LPSTR lpszServiceClassName,LPDWORD lpdwBufferLength); - WINSOCK_API_LINKAGE INT WSAAPI WSAGetServiceClassNameByClassIdW(LPGUID lpServiceClassId,LPWSTR lpszServiceClassName,LPDWORD lpdwBufferLength); - WINSOCK_API_LINKAGE INT WSAAPI WSASetServiceA(LPWSAQUERYSETA lpqsRegInfo,WSAESETSERVICEOP essoperation,DWORD dwControlFlags); - WINSOCK_API_LINKAGE INT WSAAPI WSASetServiceW(LPWSAQUERYSETW lpqsRegInfo,WSAESETSERVICEOP essoperation,DWORD dwControlFlags); - WINSOCK_API_LINKAGE INT WSAAPI WSAProviderConfigChange(LPHANDLE lpNotificationHandle,LPWSAOVERLAPPED lpOverlapped,LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); - - typedef struct sockaddr_in SOCKADDR_IN; - typedef struct sockaddr_in *PSOCKADDR_IN; - typedef struct sockaddr_in *LPSOCKADDR_IN; - - typedef struct linger LINGER; - typedef struct linger *PLINGER; - typedef struct linger *LPLINGER; - - typedef struct in_addr IN_ADDR; - typedef struct in_addr *PIN_ADDR; - typedef struct in_addr *LPIN_ADDR; - - typedef struct fd_set FD_SET; - typedef struct fd_set *PFD_SET; - typedef struct fd_set *LPFD_SET; - - typedef struct hostent HOSTENT; - typedef struct hostent *PHOSTENT; - typedef struct hostent *LPHOSTENT; - - typedef struct servent SERVENT; - typedef struct servent *PSERVENT; - typedef struct servent *LPSERVENT; - - typedef struct protoent PROTOENT; - typedef struct protoent *PPROTOENT; - typedef struct protoent *LPPROTOENT; - - typedef struct timeval TIMEVAL; - typedef struct timeval *PTIMEVAL; - typedef struct timeval *LPTIMEVAL; - -#define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error) -#define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error) -#define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam) -#define WSAGETASYNCERROR(lParam) HIWORD(lParam) -#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) -#define WSAGETSELECTERROR(lParam) HIWORD(lParam) - -/* #if (_WIN32_WINNT >= 0x0600) */ -#define POLLRDNORM 0x0100 -#define POLLRDBAND 0x0200 -#define POLLIN (POLLRDNORM | POLLRDBAND) -#define POLLPRI 0x0400 - -#define POLLWRNORM 0x0010 -#define POLLOUT (POLLWRNORM) -#define POLLWRBAND 0x0020 - -#define POLLERR 0x0001 -#define POLLHUP 0x0002 -#define POLLNVAL 0x0004 - -typedef struct pollfd { - SOCKET fd; - SHORT events; - SHORT revents; -} WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD; - -WINSOCK_API_LINKAGE int WSAAPI WSAPoll(LPWSAPOLLFD fdArray, ULONG fds, INT timeout); -/* #endif // (_WIN32_WINNT >= 0x0600) */ - -#ifdef __cplusplus -} -#endif - -#ifdef _NEED_POPPACK -#include -#endif - -#ifdef IPV6STRICT -#include -#endif - -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ -#endif - -#ifdef _INC_WINSOCK_H -#include -#endif - -#endif diff --git a/win32/include/winapi/winuser.h b/win32/include/winapi/winuser.h deleted file mode 100644 index 4cd9ffb5..00000000 --- a/win32/include/winapi/winuser.h +++ /dev/null @@ -1,5651 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WINUSER_ -#define _WINUSER_ - -#define WINUSERAPI DECLSPEC_IMPORT - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef WINVER -#define WINVER 0x0502 -#endif - -#include - -#ifndef NOUSER - typedef HANDLE HDWP; - typedef VOID MENUTEMPLATEA; - typedef VOID MENUTEMPLATEW; - typedef PVOID LPMENUTEMPLATEA; - typedef PVOID LPMENUTEMPLATEW; - -#ifdef UNICODE - typedef MENUTEMPLATEW MENUTEMPLATE; - typedef LPMENUTEMPLATEW LPMENUTEMPLATE; -#else - typedef MENUTEMPLATEA MENUTEMPLATE; - typedef LPMENUTEMPLATEA LPMENUTEMPLATE; -#endif - - typedef LRESULT (CALLBACK *WNDPROC)(HWND,UINT,WPARAM,LPARAM); - typedef INT_PTR (CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM); - typedef VOID (CALLBACK *TIMERPROC)(HWND,UINT,UINT_PTR,DWORD); - typedef WINBOOL (CALLBACK *GRAYSTRINGPROC)(HDC,LPARAM,int); - typedef WINBOOL (CALLBACK *WNDENUMPROC)(HWND,LPARAM); - typedef LRESULT (CALLBACK *HOOKPROC)(int code,WPARAM wParam,LPARAM lParam); - typedef VOID (CALLBACK *SENDASYNCPROC)(HWND,UINT,ULONG_PTR,LRESULT); - typedef WINBOOL (CALLBACK *PROPENUMPROCA)(HWND,LPCSTR,HANDLE); - typedef WINBOOL (CALLBACK *PROPENUMPROCW)(HWND,LPCWSTR,HANDLE); - typedef WINBOOL (CALLBACK *PROPENUMPROCEXA)(HWND,LPSTR,HANDLE,ULONG_PTR); - typedef WINBOOL (CALLBACK *PROPENUMPROCEXW)(HWND,LPWSTR,HANDLE,ULONG_PTR); - typedef int (CALLBACK *EDITWORDBREAKPROCA)(LPSTR lpch,int ichCurrent,int cch,int code); - typedef int (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR lpch,int ichCurrent,int cch,int code); - typedef WINBOOL (CALLBACK *DRAWSTATEPROC)(HDC hdc,LPARAM lData,WPARAM wData,int cx,int cy); - -#ifdef UNICODE - typedef PROPENUMPROCW PROPENUMPROC; - typedef PROPENUMPROCEXW PROPENUMPROCEX; - typedef EDITWORDBREAKPROCW EDITWORDBREAKPROC; -#else - typedef PROPENUMPROCA PROPENUMPROC; - typedef PROPENUMPROCEXA PROPENUMPROCEX; - typedef EDITWORDBREAKPROCA EDITWORDBREAKPROC; -#endif - - typedef WINBOOL (CALLBACK *NAMEENUMPROCA)(LPSTR,LPARAM); - typedef WINBOOL (CALLBACK *NAMEENUMPROCW)(LPWSTR,LPARAM); - typedef NAMEENUMPROCA WINSTAENUMPROCA; - typedef NAMEENUMPROCA DESKTOPENUMPROCA; - typedef NAMEENUMPROCW WINSTAENUMPROCW; - typedef NAMEENUMPROCW DESKTOPENUMPROCW; - -#ifdef UNICODE - typedef WINSTAENUMPROCW WINSTAENUMPROC; - typedef DESKTOPENUMPROCW DESKTOPENUMPROC; -#else - typedef WINSTAENUMPROCA WINSTAENUMPROC; - typedef DESKTOPENUMPROCA DESKTOPENUMPROC; -#endif - -#define IS_INTRESOURCE(_r) ((((ULONG_PTR)(_r)) >> 16)==0) -#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i)))) -#define MAKEINTRESOURCEW(i) ((LPWSTR)((ULONG_PTR)((WORD)(i)))) -#ifdef UNICODE -#define MAKEINTRESOURCE MAKEINTRESOURCEW -#else -#define MAKEINTRESOURCE MAKEINTRESOURCEA -#endif - -#ifndef NORESOURCE - -#define RT_CURSOR MAKEINTRESOURCE(1) -#define RT_BITMAP MAKEINTRESOURCE(2) -#define RT_ICON MAKEINTRESOURCE(3) -#define RT_MENU MAKEINTRESOURCE(4) -#define RT_DIALOG MAKEINTRESOURCE(5) -#define RT_STRING MAKEINTRESOURCE(6) -#define RT_FONTDIR MAKEINTRESOURCE(7) -#define RT_FONT MAKEINTRESOURCE(8) -#define RT_ACCELERATOR MAKEINTRESOURCE(9) -#define RT_RCDATA MAKEINTRESOURCE(10) -#define RT_MESSAGETABLE MAKEINTRESOURCE(11) - -#define DIFFERENCE 11 -#define RT_GROUP_CURSOR MAKEINTRESOURCE((ULONG_PTR)RT_CURSOR + DIFFERENCE) -#define RT_GROUP_ICON MAKEINTRESOURCE((ULONG_PTR)RT_ICON + DIFFERENCE) -#define RT_VERSION MAKEINTRESOURCE(16) -#define RT_DLGINCLUDE MAKEINTRESOURCE(17) -#define RT_PLUGPLAY MAKEINTRESOURCE(19) -#define RT_VXD MAKEINTRESOURCE(20) -#define RT_ANICURSOR MAKEINTRESOURCE(21) -#define RT_ANIICON MAKEINTRESOURCE(22) -#define RT_HTML MAKEINTRESOURCE(23) -#ifdef RC_INVOKED -#define RT_MANIFEST 24 -#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 -#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 -#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3 -#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID 1 -#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID 16 -#else -#define RT_MANIFEST MAKEINTRESOURCE(24) -#define CREATEPROCESS_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(1) -#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(2) -#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(3) -#define MINIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(1) -#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID MAKEINTRESOURCE(16) -#endif -#endif - -#ifdef UNICODE -#define wvsprintf wvsprintfW -#define wsprintf wsprintfW -#else -#define wvsprintf wvsprintfA -#define wsprintf wsprintfA -#endif - - WINUSERAPI int WINAPI wvsprintfA(LPSTR,LPCSTR,va_list arglist); - WINUSERAPI int WINAPI wvsprintfW(LPWSTR,LPCWSTR,va_list arglist); - WINUSERAPI int WINAPIV wsprintfA(LPSTR,LPCSTR,...); - WINUSERAPI int WINAPIV wsprintfW(LPWSTR,LPCWSTR,...); - -#define SETWALLPAPER_DEFAULT ((LPWSTR)-1) - -#ifndef NOSCROLL -#define SB_HORZ 0 -#define SB_VERT 1 -#define SB_CTL 2 -#define SB_BOTH 3 - -#define SB_LINEUP 0 -#define SB_LINELEFT 0 -#define SB_LINEDOWN 1 -#define SB_LINERIGHT 1 -#define SB_PAGEUP 2 -#define SB_PAGELEFT 2 -#define SB_PAGEDOWN 3 -#define SB_PAGERIGHT 3 -#define SB_THUMBPOSITION 4 -#define SB_THUMBTRACK 5 -#define SB_TOP 6 -#define SB_LEFT 6 -#define SB_BOTTOM 7 -#define SB_RIGHT 7 -#define SB_ENDSCROLL 8 -#endif - -#ifndef NOSHOWWINDOW -#define SW_HIDE 0 -#define SW_SHOWNORMAL 1 -#define SW_NORMAL 1 -#define SW_SHOWMINIMIZED 2 -#define SW_SHOWMAXIMIZED 3 -#define SW_MAXIMIZE 3 -#define SW_SHOWNOACTIVATE 4 -#define SW_SHOW 5 -#define SW_MINIMIZE 6 -#define SW_SHOWMINNOACTIVE 7 -#define SW_SHOWNA 8 -#define SW_RESTORE 9 -#define SW_SHOWDEFAULT 10 -#define SW_FORCEMINIMIZE 11 -#define SW_MAX 11 - -#define HIDE_WINDOW 0 -#define SHOW_OPENWINDOW 1 -#define SHOW_ICONWINDOW 2 -#define SHOW_FULLSCREEN 3 -#define SHOW_OPENNOACTIVATE 4 - -#define SW_PARENTCLOSING 1 -#define SW_OTHERZOOM 2 -#define SW_PARENTOPENING 3 -#define SW_OTHERUNZOOM 4 -#endif - -#define AW_HOR_POSITIVE 0x00000001 -#define AW_HOR_NEGATIVE 0x00000002 -#define AW_VER_POSITIVE 0x00000004 -#define AW_VER_NEGATIVE 0x00000008 -#define AW_CENTER 0x00000010 -#define AW_HIDE 0x00010000 -#define AW_ACTIVATE 0x00020000 -#define AW_SLIDE 0x00040000 -#define AW_BLEND 0x00080000 - -#define KF_EXTENDED 0x0100 -#define KF_DLGMODE 0x0800 -#define KF_MENUMODE 0x1000 -#define KF_ALTDOWN 0x2000 -#define KF_REPEAT 0x4000 -#define KF_UP 0x8000 - -#ifndef NOVIRTUALKEYCODES - -#define VK_LBUTTON 0x01 -#define VK_RBUTTON 0x02 -#define VK_CANCEL 0x03 -#define VK_MBUTTON 0x04 -#define VK_XBUTTON1 0x05 -#define VK_XBUTTON2 0x06 -#define VK_BACK 0x08 -#define VK_TAB 0x09 -#define VK_CLEAR 0x0C -#define VK_RETURN 0x0D -#define VK_SHIFT 0x10 -#define VK_CONTROL 0x11 -#define VK_MENU 0x12 -#define VK_PAUSE 0x13 -#define VK_CAPITAL 0x14 -#define VK_KANA 0x15 -#define VK_HANGEUL 0x15 -#define VK_HANGUL 0x15 -#define VK_JUNJA 0x17 -#define VK_FINAL 0x18 -#define VK_HANJA 0x19 -#define VK_KANJI 0x19 -#define VK_ESCAPE 0x1B -#define VK_CONVERT 0x1C -#define VK_NONCONVERT 0x1D -#define VK_ACCEPT 0x1E -#define VK_MODECHANGE 0x1F -#define VK_SPACE 0x20 -#define VK_PRIOR 0x21 -#define VK_NEXT 0x22 -#define VK_END 0x23 -#define VK_HOME 0x24 -#define VK_LEFT 0x25 -#define VK_UP 0x26 -#define VK_RIGHT 0x27 -#define VK_DOWN 0x28 -#define VK_SELECT 0x29 -#define VK_PRINT 0x2A -#define VK_EXECUTE 0x2B -#define VK_SNAPSHOT 0x2C -#define VK_INSERT 0x2D -#define VK_DELETE 0x2E -#define VK_HELP 0x2F - -#define VK_LWIN 0x5B -#define VK_RWIN 0x5C -#define VK_APPS 0x5D -#define VK_SLEEP 0x5F -#define VK_NUMPAD0 0x60 -#define VK_NUMPAD1 0x61 -#define VK_NUMPAD2 0x62 -#define VK_NUMPAD3 0x63 -#define VK_NUMPAD4 0x64 -#define VK_NUMPAD5 0x65 -#define VK_NUMPAD6 0x66 -#define VK_NUMPAD7 0x67 -#define VK_NUMPAD8 0x68 -#define VK_NUMPAD9 0x69 -#define VK_MULTIPLY 0x6A -#define VK_ADD 0x6B -#define VK_SEPARATOR 0x6C -#define VK_SUBTRACT 0x6D -#define VK_DECIMAL 0x6E -#define VK_DIVIDE 0x6F -#define VK_F1 0x70 -#define VK_F2 0x71 -#define VK_F3 0x72 -#define VK_F4 0x73 -#define VK_F5 0x74 -#define VK_F6 0x75 -#define VK_F7 0x76 -#define VK_F8 0x77 -#define VK_F9 0x78 -#define VK_F10 0x79 -#define VK_F11 0x7A -#define VK_F12 0x7B -#define VK_F13 0x7C -#define VK_F14 0x7D -#define VK_F15 0x7E -#define VK_F16 0x7F -#define VK_F17 0x80 -#define VK_F18 0x81 -#define VK_F19 0x82 -#define VK_F20 0x83 -#define VK_F21 0x84 -#define VK_F22 0x85 -#define VK_F23 0x86 -#define VK_F24 0x87 -#define VK_NUMLOCK 0x90 -#define VK_SCROLL 0x91 -#define VK_OEM_NEC_EQUAL 0x92 -#define VK_OEM_FJ_JISHO 0x92 -#define VK_OEM_FJ_MASSHOU 0x93 -#define VK_OEM_FJ_TOUROKU 0x94 -#define VK_OEM_FJ_LOYA 0x95 -#define VK_OEM_FJ_ROYA 0x96 -#define VK_LSHIFT 0xA0 -#define VK_RSHIFT 0xA1 -#define VK_LCONTROL 0xA2 -#define VK_RCONTROL 0xA3 -#define VK_LMENU 0xA4 -#define VK_RMENU 0xA5 -#define VK_BROWSER_BACK 0xA6 -#define VK_BROWSER_FORWARD 0xA7 -#define VK_BROWSER_REFRESH 0xA8 -#define VK_BROWSER_STOP 0xA9 -#define VK_BROWSER_SEARCH 0xAA -#define VK_BROWSER_FAVORITES 0xAB -#define VK_BROWSER_HOME 0xAC -#define VK_VOLUME_MUTE 0xAD -#define VK_VOLUME_DOWN 0xAE -#define VK_VOLUME_UP 0xAF -#define VK_MEDIA_NEXT_TRACK 0xB0 -#define VK_MEDIA_PREV_TRACK 0xB1 -#define VK_MEDIA_STOP 0xB2 -#define VK_MEDIA_PLAY_PAUSE 0xB3 -#define VK_LAUNCH_MAIL 0xB4 -#define VK_LAUNCH_MEDIA_SELECT 0xB5 -#define VK_LAUNCH_APP1 0xB6 -#define VK_LAUNCH_APP2 0xB7 -#define VK_OEM_1 0xBA -#define VK_OEM_PLUS 0xBB -#define VK_OEM_COMMA 0xBC -#define VK_OEM_MINUS 0xBD -#define VK_OEM_PERIOD 0xBE -#define VK_OEM_2 0xBF -#define VK_OEM_3 0xC0 -#define VK_OEM_4 0xDB -#define VK_OEM_5 0xDC -#define VK_OEM_6 0xDD -#define VK_OEM_7 0xDE -#define VK_OEM_8 0xDF -#define VK_OEM_AX 0xE1 -#define VK_OEM_102 0xE2 -#define VK_ICO_HELP 0xE3 -#define VK_ICO_00 0xE4 -#define VK_PROCESSKEY 0xE5 -#define VK_ICO_CLEAR 0xE6 -#define VK_PACKET 0xE7 -#define VK_OEM_RESET 0xE9 -#define VK_OEM_JUMP 0xEA -#define VK_OEM_PA1 0xEB -#define VK_OEM_PA2 0xEC -#define VK_OEM_PA3 0xED -#define VK_OEM_WSCTRL 0xEE -#define VK_OEM_CUSEL 0xEF -#define VK_OEM_ATTN 0xF0 -#define VK_OEM_FINISH 0xF1 -#define VK_OEM_COPY 0xF2 -#define VK_OEM_AUTO 0xF3 -#define VK_OEM_ENLW 0xF4 -#define VK_OEM_BACKTAB 0xF5 -#define VK_ATTN 0xF6 -#define VK_CRSEL 0xF7 -#define VK_EXSEL 0xF8 -#define VK_EREOF 0xF9 -#define VK_PLAY 0xFA -#define VK_ZOOM 0xFB -#define VK_NONAME 0xFC -#define VK_PA1 0xFD -#define VK_OEM_CLEAR 0xFE -#endif - -#ifndef NOWH - -#define WH_MIN (-1) -#define WH_MSGFILTER (-1) -#define WH_JOURNALRECORD 0 -#define WH_JOURNALPLAYBACK 1 -#define WH_KEYBOARD 2 -#define WH_GETMESSAGE 3 -#define WH_CALLWNDPROC 4 -#define WH_CBT 5 -#define WH_SYSMSGFILTER 6 -#define WH_MOUSE 7 -#define WH_HARDWARE 8 -#define WH_DEBUG 9 -#define WH_SHELL 10 -#define WH_FOREGROUNDIDLE 11 -#define WH_CALLWNDPROCRET 12 - -#define WH_KEYBOARD_LL 13 -#define WH_MOUSE_LL 14 - -#define WH_MAX 14 - -#define WH_MINHOOK WH_MIN -#define WH_MAXHOOK WH_MAX - -#define HC_ACTION 0 -#define HC_GETNEXT 1 -#define HC_SKIP 2 -#define HC_NOREMOVE 3 -#define HC_NOREM HC_NOREMOVE -#define HC_SYSMODALON 4 -#define HC_SYSMODALOFF 5 - -#define HCBT_MOVESIZE 0 -#define HCBT_MINMAX 1 -#define HCBT_QS 2 -#define HCBT_CREATEWND 3 -#define HCBT_DESTROYWND 4 -#define HCBT_ACTIVATE 5 -#define HCBT_CLICKSKIPPED 6 -#define HCBT_KEYSKIPPED 7 -#define HCBT_SYSCOMMAND 8 -#define HCBT_SETFOCUS 9 - - typedef struct tagCBT_CREATEWNDA { - struct tagCREATESTRUCTA *lpcs; - HWND hwndInsertAfter; - } CBT_CREATEWNDA,*LPCBT_CREATEWNDA; - - typedef struct tagCBT_CREATEWNDW { - struct tagCREATESTRUCTW *lpcs; - HWND hwndInsertAfter; - } CBT_CREATEWNDW,*LPCBT_CREATEWNDW; -#ifdef UNICODE - typedef CBT_CREATEWNDW CBT_CREATEWND; - typedef LPCBT_CREATEWNDW LPCBT_CREATEWND; -#else - typedef CBT_CREATEWNDA CBT_CREATEWND; - typedef LPCBT_CREATEWNDA LPCBT_CREATEWND; -#endif - - typedef struct tagCBTACTIVATESTRUCT - { - WINBOOL fMouse; - HWND hWndActive; - } CBTACTIVATESTRUCT,*LPCBTACTIVATESTRUCT; - - typedef struct tagWTSSESSION_NOTIFICATION { - DWORD cbSize; - DWORD dwSessionId; - - } WTSSESSION_NOTIFICATION,*PWTSSESSION_NOTIFICATION; - -#define WTS_CONSOLE_CONNECT 0x1 -#define WTS_CONSOLE_DISCONNECT 0x2 -#define WTS_REMOTE_CONNECT 0x3 -#define WTS_REMOTE_DISCONNECT 0x4 -#define WTS_SESSION_LOGON 0x5 -#define WTS_SESSION_LOGOFF 0x6 -#define WTS_SESSION_LOCK 0x7 -#define WTS_SESSION_UNLOCK 0x8 -#define WTS_SESSION_REMOTE_CONTROL 0x9 - -#define MSGF_DIALOGBOX 0 -#define MSGF_MESSAGEBOX 1 -#define MSGF_MENU 2 -#define MSGF_SCROLLBAR 5 -#define MSGF_NEXTWINDOW 6 -#define MSGF_MAX 8 -#define MSGF_USER 4096 - -#define HSHELL_WINDOWCREATED 1 -#define HSHELL_WINDOWDESTROYED 2 -#define HSHELL_ACTIVATESHELLWINDOW 3 - -#define HSHELL_WINDOWACTIVATED 4 -#define HSHELL_GETMINRECT 5 -#define HSHELL_REDRAW 6 -#define HSHELL_TASKMAN 7 -#define HSHELL_LANGUAGE 8 -#define HSHELL_SYSMENU 9 -#define HSHELL_ENDTASK 10 -#define HSHELL_ACCESSIBILITYSTATE 11 -#define HSHELL_APPCOMMAND 12 -#define HSHELL_WINDOWREPLACED 13 -#define HSHELL_WINDOWREPLACING 14 -#define HSHELL_HIGHBIT 0x8000 -#define HSHELL_FLASH (HSHELL_REDRAW|HSHELL_HIGHBIT) -#define HSHELL_RUDEAPPACTIVATED (HSHELL_WINDOWACTIVATED|HSHELL_HIGHBIT) - -#define ACCESS_STICKYKEYS 0x0001 -#define ACCESS_FILTERKEYS 0x0002 -#define ACCESS_MOUSEKEYS 0x0003 - -#define APPCOMMAND_BROWSER_BACKWARD 1 -#define APPCOMMAND_BROWSER_FORWARD 2 -#define APPCOMMAND_BROWSER_REFRESH 3 -#define APPCOMMAND_BROWSER_STOP 4 -#define APPCOMMAND_BROWSER_SEARCH 5 -#define APPCOMMAND_BROWSER_FAVORITES 6 -#define APPCOMMAND_BROWSER_HOME 7 -#define APPCOMMAND_VOLUME_MUTE 8 -#define APPCOMMAND_VOLUME_DOWN 9 -#define APPCOMMAND_VOLUME_UP 10 -#define APPCOMMAND_MEDIA_NEXTTRACK 11 -#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12 -#define APPCOMMAND_MEDIA_STOP 13 -#define APPCOMMAND_MEDIA_PLAY_PAUSE 14 -#define APPCOMMAND_LAUNCH_MAIL 15 -#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16 -#define APPCOMMAND_LAUNCH_APP1 17 -#define APPCOMMAND_LAUNCH_APP2 18 -#define APPCOMMAND_BASS_DOWN 19 -#define APPCOMMAND_BASS_BOOST 20 -#define APPCOMMAND_BASS_UP 21 -#define APPCOMMAND_TREBLE_DOWN 22 -#define APPCOMMAND_TREBLE_UP 23 -#define APPCOMMAND_MICROPHONE_VOLUME_MUTE 24 -#define APPCOMMAND_MICROPHONE_VOLUME_DOWN 25 -#define APPCOMMAND_MICROPHONE_VOLUME_UP 26 -#define APPCOMMAND_HELP 27 -#define APPCOMMAND_FIND 28 -#define APPCOMMAND_NEW 29 -#define APPCOMMAND_OPEN 30 -#define APPCOMMAND_CLOSE 31 -#define APPCOMMAND_SAVE 32 -#define APPCOMMAND_PRINT 33 -#define APPCOMMAND_UNDO 34 -#define APPCOMMAND_REDO 35 -#define APPCOMMAND_COPY 36 -#define APPCOMMAND_CUT 37 -#define APPCOMMAND_PASTE 38 -#define APPCOMMAND_REPLY_TO_MAIL 39 -#define APPCOMMAND_FORWARD_MAIL 40 -#define APPCOMMAND_SEND_MAIL 41 -#define APPCOMMAND_SPELL_CHECK 42 -#define APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE 43 -#define APPCOMMAND_MIC_ON_OFF_TOGGLE 44 -#define APPCOMMAND_CORRECTION_LIST 45 -#define APPCOMMAND_MEDIA_PLAY 46 -#define APPCOMMAND_MEDIA_PAUSE 47 -#define APPCOMMAND_MEDIA_RECORD 48 -#define APPCOMMAND_MEDIA_FAST_FORWARD 49 -#define APPCOMMAND_MEDIA_REWIND 50 -#define APPCOMMAND_MEDIA_CHANNEL_UP 51 -#define APPCOMMAND_MEDIA_CHANNEL_DOWN 52 - -#define FAPPCOMMAND_MOUSE 0x8000 -#define FAPPCOMMAND_KEY 0 -#define FAPPCOMMAND_OEM 0x1000 -#define FAPPCOMMAND_MASK 0xF000 - -#define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK)) -#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK)) -#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM -#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam)) -#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam) - - typedef struct { - HWND hwnd; - RECT rc; - } SHELLHOOKINFO,*LPSHELLHOOKINFO; - - typedef struct tagEVENTMSG { - UINT message; - UINT paramL; - UINT paramH; - DWORD time; - HWND hwnd; - } EVENTMSG,*PEVENTMSGMSG,*NPEVENTMSGMSG,*LPEVENTMSGMSG; - - typedef struct tagEVENTMSG *PEVENTMSG,*NPEVENTMSG,*LPEVENTMSG; - - typedef struct tagCWPSTRUCT { - LPARAM lParam; - WPARAM wParam; - UINT message; - HWND hwnd; - } CWPSTRUCT,*PCWPSTRUCT,*NPCWPSTRUCT,*LPCWPSTRUCT; - - typedef struct tagCWPRETSTRUCT { - LRESULT lResult; - LPARAM lParam; - WPARAM wParam; - UINT message; - HWND hwnd; - } CWPRETSTRUCT,*PCWPRETSTRUCT,*NPCWPRETSTRUCT,*LPCWPRETSTRUCT; - -#define LLKHF_EXTENDED (KF_EXTENDED >> 8) -#define LLKHF_INJECTED 0x00000010 -#define LLKHF_ALTDOWN (KF_ALTDOWN >> 8) -#define LLKHF_UP (KF_UP >> 8) - -#define LLMHF_INJECTED 0x00000001 - - typedef struct tagKBDLLHOOKSTRUCT { - DWORD vkCode; - DWORD scanCode; - DWORD flags; - DWORD time; - ULONG_PTR dwExtraInfo; - } KBDLLHOOKSTRUCT,*LPKBDLLHOOKSTRUCT,*PKBDLLHOOKSTRUCT; - - typedef struct tagMSLLHOOKSTRUCT { - POINT pt; - DWORD mouseData; - DWORD flags; - DWORD time; - ULONG_PTR dwExtraInfo; - } MSLLHOOKSTRUCT,*LPMSLLHOOKSTRUCT,*PMSLLHOOKSTRUCT; - - typedef struct tagDEBUGHOOKINFO { - DWORD idThread; - DWORD idThreadInstaller; - LPARAM lParam; - WPARAM wParam; - int code; - } DEBUGHOOKINFO,*PDEBUGHOOKINFO,*NPDEBUGHOOKINFO,*LPDEBUGHOOKINFO; - - typedef struct tagMOUSEHOOKSTRUCT { - POINT pt; - HWND hwnd; - UINT wHitTestCode; - ULONG_PTR dwExtraInfo; - } MOUSEHOOKSTRUCT,*LPMOUSEHOOKSTRUCT,*PMOUSEHOOKSTRUCT; - -#ifdef __cplusplus - typedef struct tagMOUSEHOOKSTRUCTEX : public tagMOUSEHOOKSTRUCT { - DWORD mouseData; - } MOUSEHOOKSTRUCTEX,*LPMOUSEHOOKSTRUCTEX,*PMOUSEHOOKSTRUCTEX; -#else - typedef struct tagMOUSEHOOKSTRUCTEX { - MOUSEHOOKSTRUCT _unnamed; - DWORD mouseData; - } MOUSEHOOKSTRUCTEX,*LPMOUSEHOOKSTRUCTEX,*PMOUSEHOOKSTRUCTEX; -#endif - - typedef struct tagHARDWAREHOOKSTRUCT { - HWND hwnd; - UINT message; - WPARAM wParam; - LPARAM lParam; - } HARDWAREHOOKSTRUCT,*LPHARDWAREHOOKSTRUCT,*PHARDWAREHOOKSTRUCT; -#endif - -#define HKL_PREV 0 -#define HKL_NEXT 1 - -#define KLF_ACTIVATE 0x00000001 -#define KLF_SUBSTITUTE_OK 0x00000002 -#define KLF_REORDER 0x00000008 -#define KLF_REPLACELANG 0x00000010 -#define KLF_NOTELLSHELL 0x00000080 -#define KLF_SETFORPROCESS 0x00000100 -#define KLF_SHIFTLOCK 0x00010000 -#define KLF_RESET 0x40000000 - -#define INPUTLANGCHANGE_SYSCHARSET 0x0001 -#define INPUTLANGCHANGE_FORWARD 0x0002 -#define INPUTLANGCHANGE_BACKWARD 0x0004 - -#define KL_NAMELENGTH 9 - -#ifdef UNICODE -#define LoadKeyboardLayout LoadKeyboardLayoutW -#define GetKeyboardLayoutName GetKeyboardLayoutNameW -#else -#define LoadKeyboardLayout LoadKeyboardLayoutA -#define GetKeyboardLayoutName GetKeyboardLayoutNameA -#endif - - WINUSERAPI HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID,UINT Flags); - WINUSERAPI HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID,UINT Flags); - WINUSERAPI HKL WINAPI ActivateKeyboardLayout(HKL hkl,UINT Flags); - WINUSERAPI int WINAPI ToUnicodeEx(UINT wVirtKey,UINT wScanCode,CONST BYTE *lpKeyState,LPWSTR pwszBuff,int cchBuff,UINT wFlags,HKL dwhkl); - WINUSERAPI WINBOOL WINAPI UnloadKeyboardLayout(HKL hkl); - WINUSERAPI WINBOOL WINAPI GetKeyboardLayoutNameA(LPSTR pwszKLID); - WINUSERAPI WINBOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID); - WINUSERAPI int WINAPI GetKeyboardLayoutList(int nBuff,HKL *lpList); - WINUSERAPI HKL WINAPI GetKeyboardLayout(DWORD idThread); - - typedef struct tagMOUSEMOVEPOINT { - int x; - int y; - DWORD time; - ULONG_PTR dwExtraInfo; - } MOUSEMOVEPOINT,*PMOUSEMOVEPOINT,*LPMOUSEMOVEPOINT; - -#define GMMP_USE_DISPLAY_POINTS 1 -#define GMMP_USE_HIGH_RESOLUTION_POINTS 2 - - WINUSERAPI int WINAPI GetMouseMovePointsEx(UINT cbSize,LPMOUSEMOVEPOINT lppt,LPMOUSEMOVEPOINT lpptBuf,int nBufPoints,DWORD resolution); - -#ifndef NODESKTOP - -#define DESKTOP_READOBJECTS 0x0001L -#define DESKTOP_CREATEWINDOW 0x0002L -#define DESKTOP_CREATEMENU 0x0004L -#define DESKTOP_HOOKCONTROL 0x0008L -#define DESKTOP_JOURNALRECORD 0x0010L -#define DESKTOP_JOURNALPLAYBACK 0x0020L -#define DESKTOP_ENUMERATE 0x0040L -#define DESKTOP_WRITEOBJECTS 0x0080L -#define DESKTOP_SWITCHDESKTOP 0x0100L - -#define DF_ALLOWOTHERACCOUNTHOOK 0x0001L - -#ifdef _WINGDI_ -#ifndef NOGDI -#ifdef UNICODE -#define CreateDesktop CreateDesktopW -#else -#define CreateDesktop CreateDesktopA -#endif - - WINUSERAPI HDESK WINAPI CreateDesktopA(LPCSTR lpszDesktop,LPCSTR lpszDevice,LPDEVMODEA pDevmode,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); - WINUSERAPI HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop,LPCWSTR lpszDevice,LPDEVMODEW pDevmode,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); -#endif -#endif - -#ifdef UNICODE -#define OpenDesktop OpenDesktopW -#define EnumDesktops EnumDesktopsW -#else -#define OpenDesktop OpenDesktopA -#define EnumDesktops EnumDesktopsA -#endif - - WINUSERAPI HDESK WINAPI OpenDesktopA(LPCSTR lpszDesktop,DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); - WINUSERAPI HDESK WINAPI OpenDesktopW(LPCWSTR lpszDesktop,DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); - WINUSERAPI HDESK WINAPI OpenInputDesktop(DWORD dwFlags,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); - WINUSERAPI WINBOOL WINAPI EnumDesktopsA(HWINSTA hwinsta,DESKTOPENUMPROCA lpEnumFunc,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI EnumDesktopsW(HWINSTA hwinsta,DESKTOPENUMPROCW lpEnumFunc,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI EnumDesktopWindows(HDESK hDesktop,WNDENUMPROC lpfn,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI SwitchDesktop(HDESK hDesktop); - WINUSERAPI WINBOOL WINAPI SetThreadDesktop(HDESK hDesktop); - WINUSERAPI WINBOOL WINAPI CloseDesktop(HDESK hDesktop); - WINUSERAPI HDESK WINAPI GetThreadDesktop(DWORD dwThreadId); -#endif - -#ifndef NOWINDOWSTATION -#define WINSTA_ENUMDESKTOPS 0x0001L -#define WINSTA_READATTRIBUTES 0x0002L -#define WINSTA_ACCESSCLIPBOARD 0x0004L -#define WINSTA_CREATEDESKTOP 0x0008L -#define WINSTA_WRITEATTRIBUTES 0x0010L -#define WINSTA_ACCESSGLOBALATOMS 0x0020L -#define WINSTA_EXITWINDOWS 0x0040L -#define WINSTA_ENUMERATE 0x0100L -#define WINSTA_READSCREEN 0x0200L -#define WINSTA_ALL_ACCESS (WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES | WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | WINSTA_WRITEATTRIBUTES | WINSTA_ACCESSGLOBALATOMS | WINSTA_EXITWINDOWS | WINSTA_ENUMERATE | WINSTA_READSCREEN) - -#define CWF_CREATE_ONLY 0x0001L - -#define WSF_VISIBLE 0x0001L - -#ifdef UNICODE -#define CreateWindowStation CreateWindowStationW -#define OpenWindowStation OpenWindowStationW -#define EnumWindowStations EnumWindowStationsW -#else -#define CreateWindowStation CreateWindowStationA -#define OpenWindowStation OpenWindowStationA -#define EnumWindowStations EnumWindowStationsA -#endif - - WINUSERAPI HWINSTA WINAPI CreateWindowStationA(LPCSTR lpwinsta,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); - WINUSERAPI HWINSTA WINAPI CreateWindowStationW(LPCWSTR lpwinsta,DWORD dwFlags,ACCESS_MASK dwDesiredAccess,LPSECURITY_ATTRIBUTES lpsa); - WINUSERAPI HWINSTA WINAPI OpenWindowStationA(LPCSTR lpszWinSta,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); - WINUSERAPI HWINSTA WINAPI OpenWindowStationW(LPCWSTR lpszWinSta,WINBOOL fInherit,ACCESS_MASK dwDesiredAccess); - WINUSERAPI WINBOOL WINAPI EnumWindowStationsA(WINSTAENUMPROCA lpEnumFunc,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI EnumWindowStationsW(WINSTAENUMPROCW lpEnumFunc,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI CloseWindowStation(HWINSTA hWinSta); - WINUSERAPI WINBOOL WINAPI SetProcessWindowStation(HWINSTA hWinSta); - WINUSERAPI HWINSTA WINAPI GetProcessWindowStation(VOID); -#endif - -#ifndef NOSECURITY - WINUSERAPI WINBOOL WINAPI SetUserObjectSecurity(HANDLE hObj,PSECURITY_INFORMATION pSIRequested,PSECURITY_DESCRIPTOR pSID); - WINUSERAPI WINBOOL WINAPI GetUserObjectSecurity(HANDLE hObj,PSECURITY_INFORMATION pSIRequested,PSECURITY_DESCRIPTOR pSID,DWORD nLength,LPDWORD lpnLengthNeeded); - -#define UOI_FLAGS 1 -#define UOI_NAME 2 -#define UOI_TYPE 3 -#define UOI_USER_SID 4 - - typedef struct tagUSEROBJECTFLAGS { - WINBOOL fInherit; - WINBOOL fReserved; - DWORD dwFlags; - } USEROBJECTFLAGS,*PUSEROBJECTFLAGS; - -#ifdef UNICODE -#define GetUserObjectInformation GetUserObjectInformationW -#define SetUserObjectInformation SetUserObjectInformationW -#else -#define GetUserObjectInformation GetUserObjectInformationA -#define SetUserObjectInformation SetUserObjectInformationA -#endif - - WINUSERAPI WINBOOL WINAPI GetUserObjectInformationA(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded); - WINUSERAPI WINBOOL WINAPI GetUserObjectInformationW(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded); - WINUSERAPI WINBOOL WINAPI SetUserObjectInformationA(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength); - WINUSERAPI WINBOOL WINAPI SetUserObjectInformationW(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength); -#endif - - typedef struct tagWNDCLASSEXA { - UINT cbSize; - UINT style; - WNDPROC lpfnWndProc; - int cbClsExtra; - int cbWndExtra; - HINSTANCE hInstance; - HICON hIcon; - HCURSOR hCursor; - HBRUSH hbrBackground; - LPCSTR lpszMenuName; - LPCSTR lpszClassName; - HICON hIconSm; - } WNDCLASSEXA,*PWNDCLASSEXA,*NPWNDCLASSEXA,*LPWNDCLASSEXA; - - typedef struct tagWNDCLASSEXW { - UINT cbSize; - UINT style; - WNDPROC lpfnWndProc; - int cbClsExtra; - int cbWndExtra; - HINSTANCE hInstance; - HICON hIcon; - HCURSOR hCursor; - HBRUSH hbrBackground; - LPCWSTR lpszMenuName; - LPCWSTR lpszClassName; - - HICON hIconSm; - } WNDCLASSEXW,*PWNDCLASSEXW,*NPWNDCLASSEXW,*LPWNDCLASSEXW; - -#ifdef UNICODE - typedef WNDCLASSEXW WNDCLASSEX; - typedef PWNDCLASSEXW PWNDCLASSEX; - typedef NPWNDCLASSEXW NPWNDCLASSEX; - typedef LPWNDCLASSEXW LPWNDCLASSEX; -#else - typedef WNDCLASSEXA WNDCLASSEX; - typedef PWNDCLASSEXA PWNDCLASSEX; - typedef NPWNDCLASSEXA NPWNDCLASSEX; - typedef LPWNDCLASSEXA LPWNDCLASSEX; -#endif - - typedef struct tagWNDCLASSA { - UINT style; - WNDPROC lpfnWndProc; - int cbClsExtra; - int cbWndExtra; - HINSTANCE hInstance; - HICON hIcon; - HCURSOR hCursor; - HBRUSH hbrBackground; - LPCSTR lpszMenuName; - LPCSTR lpszClassName; - } WNDCLASSA,*PWNDCLASSA,*NPWNDCLASSA,*LPWNDCLASSA; - - typedef struct tagWNDCLASSW { - UINT style; - WNDPROC lpfnWndProc; - int cbClsExtra; - int cbWndExtra; - HINSTANCE hInstance; - HICON hIcon; - HCURSOR hCursor; - HBRUSH hbrBackground; - LPCWSTR lpszMenuName; - LPCWSTR lpszClassName; - } WNDCLASSW,*PWNDCLASSW,*NPWNDCLASSW,*LPWNDCLASSW; - -#ifdef UNICODE - typedef WNDCLASSW WNDCLASS; - typedef PWNDCLASSW PWNDCLASS; - typedef NPWNDCLASSW NPWNDCLASS; - typedef LPWNDCLASSW LPWNDCLASS; -#else - typedef WNDCLASSA WNDCLASS; - typedef PWNDCLASSA PWNDCLASS; - typedef NPWNDCLASSA NPWNDCLASS; - typedef LPWNDCLASSA LPWNDCLASS; -#endif - - WINUSERAPI WINBOOL WINAPI IsHungAppWindow(HWND hwnd); - WINUSERAPI VOID WINAPI DisableProcessWindowsGhosting(VOID); - -#ifndef NOMSG - typedef struct tagMSG { - HWND hwnd; - UINT message; - WPARAM wParam; - LPARAM lParam; - DWORD time; - POINT pt; - } MSG,*PMSG,*NPMSG,*LPMSG; - -#define POINTSTOPOINT(pt,pts) { (pt).x = (LONG)(SHORT)LOWORD(*(LONG*)&pts); (pt).y = (LONG)(SHORT)HIWORD(*(LONG*)&pts); } - -#define POINTTOPOINTS(pt) (MAKELONG((short)((pt).x),(short)((pt).y))) -#define MAKEWPARAM(l,h) ((WPARAM)(DWORD)MAKELONG(l,h)) -#define MAKELPARAM(l,h) ((LPARAM)(DWORD)MAKELONG(l,h)) -#define MAKELRESULT(l,h) ((LRESULT)(DWORD)MAKELONG(l,h)) -#endif - -#ifndef NOWINOFFSETS -#define GWL_WNDPROC (-4) -#define GWL_HINSTANCE (-6) -#define GWL_HWNDPARENT (-8) -#define GWL_STYLE (-16) -#define GWL_EXSTYLE (-20) -#define GWL_USERDATA (-21) -#define GWL_ID (-12) - -#ifdef _WIN64 -#undef GWL_WNDPROC -#undef GWL_HINSTANCE -#undef GWL_HWNDPARENT -#undef GWL_USERDATA -#endif - -#define GWLP_WNDPROC (-4) -#define GWLP_HINSTANCE (-6) -#define GWLP_HWNDPARENT (-8) -#define GWLP_USERDATA (-21) -#define GWLP_ID (-12) - -#define GCL_MENUNAME (-8) -#define GCL_HBRBACKGROUND (-10) -#define GCL_HCURSOR (-12) -#define GCL_HICON (-14) -#define GCL_HMODULE (-16) -#define GCL_CBWNDEXTRA (-18) -#define GCL_CBCLSEXTRA (-20) -#define GCL_WNDPROC (-24) -#define GCL_STYLE (-26) -#define GCW_ATOM (-32) -#define GCL_HICONSM (-34) - -#ifdef _WIN64 - -#undef GCL_MENUNAME -#undef GCL_HBRBACKGROUND -#undef GCL_HCURSOR -#undef GCL_HICON -#undef GCL_HMODULE -#undef GCL_WNDPROC -#undef GCL_HICONSM -#endif - -#define GCLP_MENUNAME (-8) -#define GCLP_HBRBACKGROUND (-10) -#define GCLP_HCURSOR (-12) -#define GCLP_HICON (-14) -#define GCLP_HMODULE (-16) -#define GCLP_WNDPROC (-24) -#define GCLP_HICONSM (-34) -#endif - -#ifndef NOWINMESSAGES - -#define WM_NULL 0x0000 -#define WM_CREATE 0x0001 -#define WM_DESTROY 0x0002 -#define WM_MOVE 0x0003 -#define WM_SIZE 0x0005 - -#define WM_ACTIVATE 0x0006 - -#define WA_INACTIVE 0 -#define WA_ACTIVE 1 -#define WA_CLICKACTIVE 2 - -#define WM_SETFOCUS 0x0007 -#define WM_KILLFOCUS 0x0008 -#define WM_ENABLE 0x000A -#define WM_SETREDRAW 0x000B -#define WM_SETTEXT 0x000C -#define WM_GETTEXT 0x000D -#define WM_GETTEXTLENGTH 0x000E -#define WM_PAINT 0x000F -#define WM_CLOSE 0x0010 -#ifndef _WIN32_WCE -#define WM_QUERYENDSESSION 0x0011 -#define WM_QUERYOPEN 0x0013 -#define WM_ENDSESSION 0x0016 -#endif -#define WM_QUIT 0x0012 -#define WM_ERASEBKGND 0x0014 -#define WM_SYSCOLORCHANGE 0x0015 -#define WM_SHOWWINDOW 0x0018 -#define WM_WININICHANGE 0x001A -#define WM_SETTINGCHANGE WM_WININICHANGE -#define WM_DEVMODECHANGE 0x001B -#define WM_ACTIVATEAPP 0x001C -#define WM_FONTCHANGE 0x001D -#define WM_TIMECHANGE 0x001E -#define WM_CANCELMODE 0x001F -#define WM_SETCURSOR 0x0020 -#define WM_MOUSEACTIVATE 0x0021 -#define WM_CHILDACTIVATE 0x0022 -#define WM_QUEUESYNC 0x0023 - -#define WM_GETMINMAXINFO 0x0024 - - typedef struct tagMINMAXINFO { - POINT ptReserved; - POINT ptMaxSize; - POINT ptMaxPosition; - POINT ptMinTrackSize; - POINT ptMaxTrackSize; - } MINMAXINFO,*PMINMAXINFO,*LPMINMAXINFO; - -#define WM_PAINTICON 0x0026 -#define WM_ICONERASEBKGND 0x0027 -#define WM_NEXTDLGCTL 0x0028 -#define WM_SPOOLERSTATUS 0x002A -#define WM_DRAWITEM 0x002B -#define WM_MEASUREITEM 0x002C -#define WM_DELETEITEM 0x002D -#define WM_VKEYTOITEM 0x002E -#define WM_CHARTOITEM 0x002F -#define WM_SETFONT 0x0030 -#define WM_GETFONT 0x0031 -#define WM_SETHOTKEY 0x0032 -#define WM_GETHOTKEY 0x0033 -#define WM_QUERYDRAGICON 0x0037 -#define WM_COMPAREITEM 0x0039 -#ifndef _WIN32_WCE -#define WM_GETOBJECT 0x003D -#endif -#define WM_COMPACTING 0x0041 -#define WM_COMMNOTIFY 0x0044 -#define WM_WINDOWPOSCHANGING 0x0046 -#define WM_WINDOWPOSCHANGED 0x0047 - -#define WM_POWER 0x0048 - -#define PWR_OK 1 -#define PWR_FAIL (-1) -#define PWR_SUSPENDREQUEST 1 -#define PWR_SUSPENDRESUME 2 -#define PWR_CRITICALRESUME 3 - -#define WM_COPYDATA 0x004A -#define WM_CANCELJOURNAL 0x004B - - typedef struct tagCOPYDATASTRUCT { - ULONG_PTR dwData; - DWORD cbData; - PVOID lpData; - } COPYDATASTRUCT,*PCOPYDATASTRUCT; - - typedef struct tagMDINEXTMENU { - HMENU hmenuIn; - HMENU hmenuNext; - HWND hwndNext; - } MDINEXTMENU,*PMDINEXTMENU,*LPMDINEXTMENU; - -#define WM_NOTIFY 0x004E -#define WM_INPUTLANGCHANGEREQUEST 0x0050 -#define WM_INPUTLANGCHANGE 0x0051 -#define WM_TCARD 0x0052 -#define WM_HELP 0x0053 -#define WM_USERCHANGED 0x0054 -#define WM_NOTIFYFORMAT 0x0055 - -#define NFR_ANSI 1 -#define NFR_UNICODE 2 -#define NF_QUERY 3 -#define NF_REQUERY 4 - -#define WM_CONTEXTMENU 0x007B -#define WM_STYLECHANGING 0x007C -#define WM_STYLECHANGED 0x007D -#define WM_DISPLAYCHANGE 0x007E -#define WM_GETICON 0x007F -#define WM_SETICON 0x0080 - -#define WM_NCCREATE 0x0081 -#define WM_NCDESTROY 0x0082 -#define WM_NCCALCSIZE 0x0083 -#define WM_NCHITTEST 0x0084 -#define WM_NCPAINT 0x0085 -#define WM_NCACTIVATE 0x0086 -#define WM_GETDLGCODE 0x0087 -#ifndef _WIN32_WCE -#define WM_SYNCPAINT 0x0088 -#endif -#define WM_NCMOUSEMOVE 0x00A0 -#define WM_NCLBUTTONDOWN 0x00A1 -#define WM_NCLBUTTONUP 0x00A2 -#define WM_NCLBUTTONDBLCLK 0x00A3 -#define WM_NCRBUTTONDOWN 0x00A4 -#define WM_NCRBUTTONUP 0x00A5 -#define WM_NCRBUTTONDBLCLK 0x00A6 -#define WM_NCMBUTTONDOWN 0x00A7 -#define WM_NCMBUTTONUP 0x00A8 -#define WM_NCMBUTTONDBLCLK 0x00A9 - -#define WM_NCXBUTTONDOWN 0x00AB -#define WM_NCXBUTTONUP 0x00AC -#define WM_NCXBUTTONDBLCLK 0x00AD -#define WM_INPUT 0x00FF -#define WM_KEYFIRST 0x0100 -#define WM_KEYDOWN 0x0100 -#define WM_KEYUP 0x0101 -#define WM_CHAR 0x0102 -#define WM_DEADCHAR 0x0103 -#define WM_SYSKEYDOWN 0x0104 -#define WM_SYSKEYUP 0x0105 -#define WM_SYSCHAR 0x0106 -#define WM_SYSDEADCHAR 0x0107 -#define WM_UNICHAR 0x0109 -#define WM_KEYLAST 0x0109 -#define UNICODE_NOCHAR 0xFFFF -#define WM_IME_STARTCOMPOSITION 0x010D -#define WM_IME_ENDCOMPOSITION 0x010E -#define WM_IME_COMPOSITION 0x010F -#define WM_IME_KEYLAST 0x010F -#define WM_INITDIALOG 0x0110 -#define WM_COMMAND 0x0111 -#define WM_SYSCOMMAND 0x0112 -#define WM_TIMER 0x0113 -#define WM_HSCROLL 0x0114 -#define WM_VSCROLL 0x0115 -#define WM_INITMENU 0x0116 -#define WM_INITMENUPOPUP 0x0117 -#define WM_MENUSELECT 0x011F -#define WM_MENUCHAR 0x0120 -#define WM_ENTERIDLE 0x0121 -#ifndef _WIN32_WCE -#define WM_MENURBUTTONUP 0x0122 -#define WM_MENUDRAG 0x0123 -#define WM_MENUGETOBJECT 0x0124 -#define WM_UNINITMENUPOPUP 0x0125 -#define WM_MENUCOMMAND 0x0126 - -#ifndef _WIN32_WCE -#define WM_CHANGEUISTATE 0x0127 -#define WM_UPDATEUISTATE 0x0128 -#define WM_QUERYUISTATE 0x0129 - -#define UIS_SET 1 -#define UIS_CLEAR 2 -#define UIS_INITIALIZE 3 - -#define UISF_HIDEFOCUS 0x1 -#define UISF_HIDEACCEL 0x2 -#define UISF_ACTIVE 0x4 -#endif -#endif - -#define WM_CTLCOLORMSGBOX 0x0132 -#define WM_CTLCOLOREDIT 0x0133 -#define WM_CTLCOLORLISTBOX 0x0134 -#define WM_CTLCOLORBTN 0x0135 -#define WM_CTLCOLORDLG 0x0136 -#define WM_CTLCOLORSCROLLBAR 0x0137 -#define WM_CTLCOLORSTATIC 0x0138 -#define MN_GETHMENU 0x01E1 - -#define WM_MOUSEFIRST 0x0200 -#define WM_MOUSEMOVE 0x0200 -#define WM_LBUTTONDOWN 0x0201 -#define WM_LBUTTONUP 0x0202 -#define WM_LBUTTONDBLCLK 0x0203 -#define WM_RBUTTONDOWN 0x0204 -#define WM_RBUTTONUP 0x0205 -#define WM_RBUTTONDBLCLK 0x0206 -#define WM_MBUTTONDOWN 0x0207 -#define WM_MBUTTONUP 0x0208 -#define WM_MBUTTONDBLCLK 0x0209 -#define WM_MOUSEWHEEL 0x020A -#define WM_XBUTTONDOWN 0x020B -#define WM_XBUTTONUP 0x020C -#define WM_XBUTTONDBLCLK 0x020D -#define WM_MOUSELAST 0x020D - -#define WHEEL_DELTA 120 -#define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) - -#define WHEEL_PAGESCROLL (UINT_MAX) - -#define GET_KEYSTATE_WPARAM(wParam) (LOWORD(wParam)) -#define GET_NCHITTEST_WPARAM(wParam) ((short)LOWORD(wParam)) -#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) - -#define XBUTTON1 0x0001 -#define XBUTTON2 0x0002 - -#define WM_PARENTNOTIFY 0x0210 -#define WM_ENTERMENULOOP 0x0211 -#define WM_EXITMENULOOP 0x0212 - -#define WM_NEXTMENU 0x0213 -#define WM_SIZING 0x0214 -#define WM_CAPTURECHANGED 0x0215 -#define WM_MOVING 0x0216 - -#define WM_POWERBROADCAST 0x0218 - -#ifndef _WIN32_WCE -#define PBT_APMQUERYSUSPEND 0x0000 -#define PBT_APMQUERYSTANDBY 0x0001 - -#define PBT_APMQUERYSUSPENDFAILED 0x0002 -#define PBT_APMQUERYSTANDBYFAILED 0x0003 - -#define PBT_APMSUSPEND 0x0004 -#define PBT_APMSTANDBY 0x0005 - -#define PBT_APMRESUMECRITICAL 0x0006 -#define PBT_APMRESUMESUSPEND 0x0007 -#define PBT_APMRESUMESTANDBY 0x0008 - -#define PBTF_APMRESUMEFROMFAILURE 0x00000001 - -#define PBT_APMBATTERYLOW 0x0009 -#define PBT_APMPOWERSTATUSCHANGE 0x000A - -#define PBT_APMOEMEVENT 0x000B -#define PBT_APMRESUMEAUTOMATIC 0x0012 -#endif - -#define WM_DEVICECHANGE 0x0219 - -#define WM_MDICREATE 0x0220 -#define WM_MDIDESTROY 0x0221 -#define WM_MDIACTIVATE 0x0222 -#define WM_MDIRESTORE 0x0223 -#define WM_MDINEXT 0x0224 -#define WM_MDIMAXIMIZE 0x0225 -#define WM_MDITILE 0x0226 -#define WM_MDICASCADE 0x0227 -#define WM_MDIICONARRANGE 0x0228 -#define WM_MDIGETACTIVE 0x0229 - -#define WM_MDISETMENU 0x0230 -#define WM_ENTERSIZEMOVE 0x0231 -#define WM_EXITSIZEMOVE 0x0232 -#define WM_DROPFILES 0x0233 -#define WM_MDIREFRESHMENU 0x0234 - -#define WM_IME_SETCONTEXT 0x0281 -#define WM_IME_NOTIFY 0x0282 -#define WM_IME_CONTROL 0x0283 -#define WM_IME_COMPOSITIONFULL 0x0284 -#define WM_IME_SELECT 0x0285 -#define WM_IME_CHAR 0x0286 -#define WM_IME_REQUEST 0x0288 -#define WM_IME_KEYDOWN 0x0290 -#define WM_IME_KEYUP 0x0291 - -#define WM_MOUSEHOVER 0x02A1 -#define WM_MOUSELEAVE 0x02A3 -#define WM_NCMOUSEHOVER 0x02A0 -#define WM_NCMOUSELEAVE 0x02A2 -#define WM_WTSSESSION_CHANGE 0x02B1 -#define WM_TABLET_FIRST 0x02c0 -#define WM_TABLET_LAST 0x02df -#define WM_CUT 0x0300 -#define WM_COPY 0x0301 -#define WM_PASTE 0x0302 -#define WM_CLEAR 0x0303 -#define WM_UNDO 0x0304 -#define WM_RENDERFORMAT 0x0305 -#define WM_RENDERALLFORMATS 0x0306 -#define WM_DESTROYCLIPBOARD 0x0307 -#define WM_DRAWCLIPBOARD 0x0308 -#define WM_PAINTCLIPBOARD 0x0309 -#define WM_VSCROLLCLIPBOARD 0x030A -#define WM_SIZECLIPBOARD 0x030B -#define WM_ASKCBFORMATNAME 0x030C -#define WM_CHANGECBCHAIN 0x030D -#define WM_HSCROLLCLIPBOARD 0x030E -#define WM_QUERYNEWPALETTE 0x030F -#define WM_PALETTEISCHANGING 0x0310 -#define WM_PALETTECHANGED 0x0311 -#define WM_HOTKEY 0x0312 -#define WM_PRINT 0x0317 -#define WM_PRINTCLIENT 0x0318 -#define WM_APPCOMMAND 0x0319 -#define WM_THEMECHANGED 0x031A -#define WM_HANDHELDFIRST 0x0358 -#define WM_HANDHELDLAST 0x035F -#define WM_AFXFIRST 0x0360 -#define WM_AFXLAST 0x037F -#define WM_PENWINFIRST 0x0380 -#define WM_PENWINLAST 0x038F -#define WM_APP 0x8000 -#define WM_USER 0x0400 - -#define WMSZ_LEFT 1 -#define WMSZ_RIGHT 2 -#define WMSZ_TOP 3 -#define WMSZ_TOPLEFT 4 -#define WMSZ_TOPRIGHT 5 -#define WMSZ_BOTTOM 6 -#define WMSZ_BOTTOMLEFT 7 -#define WMSZ_BOTTOMRIGHT 8 - -#ifndef NONCMESSAGES - -#define HTERROR (-2) -#define HTTRANSPARENT (-1) -#define HTNOWHERE 0 -#define HTCLIENT 1 -#define HTCAPTION 2 -#define HTSYSMENU 3 -#define HTGROWBOX 4 -#define HTSIZE HTGROWBOX -#define HTMENU 5 -#define HTHSCROLL 6 -#define HTVSCROLL 7 -#define HTMINBUTTON 8 -#define HTMAXBUTTON 9 -#define HTLEFT 10 -#define HTRIGHT 11 -#define HTTOP 12 -#define HTTOPLEFT 13 -#define HTTOPRIGHT 14 -#define HTBOTTOM 15 -#define HTBOTTOMLEFT 16 -#define HTBOTTOMRIGHT 17 -#define HTBORDER 18 -#define HTREDUCE HTMINBUTTON -#define HTZOOM HTMAXBUTTON -#define HTSIZEFIRST HTLEFT -#define HTSIZELAST HTBOTTOMRIGHT -#define HTOBJECT 19 -#define HTCLOSE 20 -#define HTHELP 21 - -#define SMTO_NORMAL 0x0000 -#define SMTO_BLOCK 0x0001 -#define SMTO_ABORTIFHUNG 0x0002 -#define SMTO_NOTIMEOUTIFNOTHUNG 0x0008 -#endif - -#define MA_ACTIVATE 1 -#define MA_ACTIVATEANDEAT 2 -#define MA_NOACTIVATE 3 -#define MA_NOACTIVATEANDEAT 4 - -#define ICON_SMALL 0 -#define ICON_BIG 1 -#define ICON_SMALL2 2 - -#ifdef UNICODE -#define RegisterWindowMessage RegisterWindowMessageW -#else -#define RegisterWindowMessage RegisterWindowMessageA -#endif - - WINUSERAPI UINT WINAPI RegisterWindowMessageA(LPCSTR lpString); - WINUSERAPI UINT WINAPI RegisterWindowMessageW(LPCWSTR lpString); - -#define SIZE_RESTORED 0 -#define SIZE_MINIMIZED 1 -#define SIZE_MAXIMIZED 2 -#define SIZE_MAXSHOW 3 -#define SIZE_MAXHIDE 4 - -#define SIZENORMAL SIZE_RESTORED -#define SIZEICONIC SIZE_MINIMIZED -#define SIZEFULLSCREEN SIZE_MAXIMIZED -#define SIZEZOOMSHOW SIZE_MAXSHOW -#define SIZEZOOMHIDE SIZE_MAXHIDE - - typedef struct tagWINDOWPOS { - HWND hwnd; - HWND hwndInsertAfter; - int x; - int y; - int cx; - int cy; - UINT flags; - } WINDOWPOS,*LPWINDOWPOS,*PWINDOWPOS; - - typedef struct tagNCCALCSIZE_PARAMS { - RECT rgrc[3]; - PWINDOWPOS lppos; - } NCCALCSIZE_PARAMS,*LPNCCALCSIZE_PARAMS; - -#define WVR_ALIGNTOP 0x0010 -#define WVR_ALIGNLEFT 0x0020 -#define WVR_ALIGNBOTTOM 0x0040 -#define WVR_ALIGNRIGHT 0x0080 -#define WVR_HREDRAW 0x0100 -#define WVR_VREDRAW 0x0200 -#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW) -#define WVR_VALIDRECTS 0x0400 - -#ifndef NOKEYSTATES - -#define MK_LBUTTON 0x0001 -#define MK_RBUTTON 0x0002 -#define MK_SHIFT 0x0004 -#define MK_CONTROL 0x0008 -#define MK_MBUTTON 0x0010 -#define MK_XBUTTON1 0x0020 -#define MK_XBUTTON2 0x0040 -#endif - -#ifndef NOTRACKMOUSEEVENT -#define TME_HOVER 0x00000001 -#define TME_LEAVE 0x00000002 -#define TME_NONCLIENT 0x00000010 -#define TME_QUERY 0x40000000 -#define TME_CANCEL 0x80000000 - -#define HOVER_DEFAULT 0xFFFFFFFF -#endif - - typedef struct tagTRACKMOUSEEVENT { - DWORD cbSize; - DWORD dwFlags; - HWND hwndTrack; - DWORD dwHoverTime; - } TRACKMOUSEEVENT,*LPTRACKMOUSEEVENT; - - WINUSERAPI WINBOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack); -#endif - -#ifndef NOWINSTYLES - -#define WS_OVERLAPPED 0x00000000L -#define WS_POPUP 0x80000000L -#define WS_CHILD 0x40000000L -#define WS_MINIMIZE 0x20000000L -#define WS_VISIBLE 0x10000000L -#define WS_DISABLED 0x08000000L -#define WS_CLIPSIBLINGS 0x04000000L -#define WS_CLIPCHILDREN 0x02000000L -#define WS_MAXIMIZE 0x01000000L -#define WS_CAPTION 0x00C00000L -#define WS_BORDER 0x00800000L -#define WS_DLGFRAME 0x00400000L -#define WS_VSCROLL 0x00200000L -#define WS_HSCROLL 0x00100000L -#define WS_SYSMENU 0x00080000L -#define WS_THICKFRAME 0x00040000L -#define WS_GROUP 0x00020000L -#define WS_TABSTOP 0x00010000L -#define WS_MINIMIZEBOX 0x00020000L -#define WS_MAXIMIZEBOX 0x00010000L -#define WS_TILED WS_OVERLAPPED -#define WS_ICONIC WS_MINIMIZE -#define WS_SIZEBOX WS_THICKFRAME -#define WS_TILEDWINDOW WS_OVERLAPPEDWINDOW -#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX) -#define WS_POPUPWINDOW (WS_POPUP | WS_BORDER | WS_SYSMENU) -#define WS_CHILDWINDOW (WS_CHILD) - -#define WS_EX_DLGMODALFRAME 0x00000001L -#define WS_EX_NOPARENTNOTIFY 0x00000004L -#define WS_EX_TOPMOST 0x00000008L -#define WS_EX_ACCEPTFILES 0x00000010L -#define WS_EX_TRANSPARENT 0x00000020L -#define WS_EX_MDICHILD 0x00000040L -#define WS_EX_TOOLWINDOW 0x00000080L -#define WS_EX_WINDOWEDGE 0x00000100L -#define WS_EX_CLIENTEDGE 0x00000200L -#define WS_EX_CONTEXTHELP 0x00000400L -#define WS_EX_RIGHT 0x00001000L -#define WS_EX_LEFT 0x00000000L -#define WS_EX_RTLREADING 0x00002000L -#define WS_EX_LTRREADING 0x00000000L -#define WS_EX_LEFTSCROLLBAR 0x00004000L -#define WS_EX_RIGHTSCROLLBAR 0x00000000L -#define WS_EX_CONTROLPARENT 0x00010000L -#define WS_EX_STATICEDGE 0x00020000L -#define WS_EX_APPWINDOW 0x00040000L -#define WS_EX_OVERLAPPEDWINDOW (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE) -#define WS_EX_PALETTEWINDOW (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST) -#define WS_EX_LAYERED 0x00080000 -#define WS_EX_NOINHERITLAYOUT 0x00100000L -#define WS_EX_LAYOUTRTL 0x00400000L -#define WS_EX_COMPOSITED 0x02000000L -#define WS_EX_NOACTIVATE 0x08000000L - -#define CS_VREDRAW 0x0001 -#define CS_HREDRAW 0x0002 -#define CS_DBLCLKS 0x0008 -#define CS_OWNDC 0x0020 -#define CS_CLASSDC 0x0040 -#define CS_PARENTDC 0x0080 -#define CS_NOCLOSE 0x0200 -#define CS_SAVEBITS 0x0800 -#define CS_BYTEALIGNCLIENT 0x1000 -#define CS_BYTEALIGNWINDOW 0x2000 -#define CS_GLOBALCLASS 0x4000 -#define CS_IME 0x00010000 -#define CS_DROPSHADOW 0x00020000 -#endif - -#define PRF_CHECKVISIBLE 0x00000001L -#define PRF_NONCLIENT 0x00000002L -#define PRF_CLIENT 0x00000004L -#define PRF_ERASEBKGND 0x00000008L -#define PRF_CHILDREN 0x00000010L -#define PRF_OWNED 0x00000020L - -#define BDR_RAISEDOUTER 0x0001 -#define BDR_SUNKENOUTER 0x0002 -#define BDR_RAISEDINNER 0x0004 -#define BDR_SUNKENINNER 0x0008 - -#define BDR_OUTER (BDR_RAISEDOUTER | BDR_SUNKENOUTER) -#define BDR_INNER (BDR_RAISEDINNER | BDR_SUNKENINNER) -#define BDR_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER) -#define BDR_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER) - -#define EDGE_RAISED (BDR_RAISEDOUTER | BDR_RAISEDINNER) -#define EDGE_SUNKEN (BDR_SUNKENOUTER | BDR_SUNKENINNER) -#define EDGE_ETCHED (BDR_SUNKENOUTER | BDR_RAISEDINNER) -#define EDGE_BUMP (BDR_RAISEDOUTER | BDR_SUNKENINNER) - -#define BF_LEFT 0x0001 -#define BF_TOP 0x0002 -#define BF_RIGHT 0x0004 -#define BF_BOTTOM 0x0008 - -#define BF_TOPLEFT (BF_TOP | BF_LEFT) -#define BF_TOPRIGHT (BF_TOP | BF_RIGHT) -#define BF_BOTTOMLEFT (BF_BOTTOM | BF_LEFT) -#define BF_BOTTOMRIGHT (BF_BOTTOM | BF_RIGHT) -#define BF_RECT (BF_LEFT | BF_TOP | BF_RIGHT | BF_BOTTOM) - -#define BF_DIAGONAL 0x0010 - -#define BF_DIAGONAL_ENDTOPRIGHT (BF_DIAGONAL | BF_TOP | BF_RIGHT) -#define BF_DIAGONAL_ENDTOPLEFT (BF_DIAGONAL | BF_TOP | BF_LEFT) -#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT) -#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT) - -#define BF_MIDDLE 0x0800 -#define BF_SOFT 0x1000 -#define BF_ADJUST 0x2000 -#define BF_FLAT 0x4000 -#define BF_MONO 0x8000 - - WINUSERAPI WINBOOL WINAPI DrawEdge(HDC hdc,LPRECT qrc,UINT edge,UINT grfFlags); - -#define DFC_CAPTION 1 -#define DFC_MENU 2 -#define DFC_SCROLL 3 -#define DFC_BUTTON 4 -#define DFC_POPUPMENU 5 - -#define DFCS_CAPTIONCLOSE 0x0000 -#define DFCS_CAPTIONMIN 0x0001 -#define DFCS_CAPTIONMAX 0x0002 -#define DFCS_CAPTIONRESTORE 0x0003 -#define DFCS_CAPTIONHELP 0x0004 - -#define DFCS_MENUARROW 0x0000 -#define DFCS_MENUCHECK 0x0001 -#define DFCS_MENUBULLET 0x0002 -#define DFCS_MENUARROWRIGHT 0x0004 -#define DFCS_SCROLLUP 0x0000 -#define DFCS_SCROLLDOWN 0x0001 -#define DFCS_SCROLLLEFT 0x0002 -#define DFCS_SCROLLRIGHT 0x0003 -#define DFCS_SCROLLCOMBOBOX 0x0005 -#define DFCS_SCROLLSIZEGRIP 0x0008 -#define DFCS_SCROLLSIZEGRIPRIGHT 0x0010 - -#define DFCS_BUTTONCHECK 0x0000 -#define DFCS_BUTTONRADIOIMAGE 0x0001 -#define DFCS_BUTTONRADIOMASK 0x0002 -#define DFCS_BUTTONRADIO 0x0004 -#define DFCS_BUTTON3STATE 0x0008 -#define DFCS_BUTTONPUSH 0x0010 - -#define DFCS_INACTIVE 0x0100 -#define DFCS_PUSHED 0x0200 -#define DFCS_CHECKED 0x0400 - -#define DFCS_TRANSPARENT 0x0800 -#define DFCS_HOT 0x1000 - -#define DFCS_ADJUSTRECT 0x2000 -#define DFCS_FLAT 0x4000 -#define DFCS_MONO 0x8000 - - WINUSERAPI WINBOOL WINAPI DrawFrameControl(HDC,LPRECT,UINT,UINT); - -#define DC_ACTIVE 0x0001 -#define DC_SMALLCAP 0x0002 -#define DC_ICON 0x0004 -#define DC_TEXT 0x0008 -#define DC_INBUTTON 0x0010 -#define DC_GRADIENT 0x0020 -#define DC_BUTTONS 0x1000 - - WINUSERAPI WINBOOL WINAPI DrawCaption(HWND hwnd,HDC hdc,CONST RECT *lprect,UINT flags); - -#define IDANI_OPEN 1 -#define IDANI_CAPTION 3 - - WINUSERAPI WINBOOL WINAPI DrawAnimatedRects(HWND hwnd,int idAni,CONST RECT *lprcFrom,CONST RECT *lprcTo); - -#ifndef NOCLIPBOARD - -#define CF_TEXT 1 -#define CF_BITMAP 2 -#define CF_METAFILEPICT 3 -#define CF_SYLK 4 -#define CF_DIF 5 -#define CF_TIFF 6 -#define CF_OEMTEXT 7 -#define CF_DIB 8 -#define CF_PALETTE 9 -#define CF_PENDATA 10 -#define CF_RIFF 11 -#define CF_WAVE 12 -#define CF_UNICODETEXT 13 -#define CF_ENHMETAFILE 14 -#define CF_HDROP 15 -#define CF_LOCALE 16 -#define CF_DIBV5 17 -#define CF_MAX 18 - -#define CF_OWNERDISPLAY 0x0080 -#define CF_DSPTEXT 0x0081 -#define CF_DSPBITMAP 0x0082 -#define CF_DSPMETAFILEPICT 0x0083 -#define CF_DSPENHMETAFILE 0x008E - -#define CF_PRIVATEFIRST 0x0200 -#define CF_PRIVATELAST 0x02FF - -#define CF_GDIOBJFIRST 0x0300 -#define CF_GDIOBJLAST 0x03FF -#endif - -#define FVIRTKEY TRUE -#define FNOINVERT 0x02 -#define FSHIFT 0x04 -#define FCONTROL 0x08 -#define FALT 0x10 - - typedef struct tagACCEL { - BYTE fVirt; - WORD key; - WORD cmd; - } ACCEL,*LPACCEL; - - typedef struct tagPAINTSTRUCT { - HDC hdc; - WINBOOL fErase; - RECT rcPaint; - WINBOOL fRestore; - WINBOOL fIncUpdate; - BYTE rgbReserved[32]; - } PAINTSTRUCT,*PPAINTSTRUCT,*NPPAINTSTRUCT,*LPPAINTSTRUCT; - - typedef struct tagCREATESTRUCTA { - LPVOID lpCreateParams; - HINSTANCE hInstance; - HMENU hMenu; - HWND hwndParent; - int cy; - int cx; - int y; - int x; - LONG style; - LPCSTR lpszName; - LPCSTR lpszClass; - DWORD dwExStyle; - } CREATESTRUCTA,*LPCREATESTRUCTA; - - typedef struct tagCREATESTRUCTW { - LPVOID lpCreateParams; - HINSTANCE hInstance; - HMENU hMenu; - HWND hwndParent; - int cy; - int cx; - int y; - int x; - LONG style; - LPCWSTR lpszName; - LPCWSTR lpszClass; - DWORD dwExStyle; - } CREATESTRUCTW,*LPCREATESTRUCTW; - -#ifdef UNICODE - typedef CREATESTRUCTW CREATESTRUCT; - typedef LPCREATESTRUCTW LPCREATESTRUCT; -#else - typedef CREATESTRUCTA CREATESTRUCT; - typedef LPCREATESTRUCTA LPCREATESTRUCT; -#endif - - typedef struct tagWINDOWPLACEMENT { - UINT length; - UINT flags; - UINT showCmd; - POINT ptMinPosition; - POINT ptMaxPosition; - RECT rcNormalPosition; - } WINDOWPLACEMENT; - typedef WINDOWPLACEMENT *PWINDOWPLACEMENT,*LPWINDOWPLACEMENT; - -#define WPF_SETMINPOSITION 0x0001 -#define WPF_RESTORETOMAXIMIZED 0x0002 -#define WPF_ASYNCWINDOWPLACEMENT 0x0004 - - typedef struct tagNMHDR { - HWND hwndFrom; - UINT_PTR idFrom; - UINT code; - } NMHDR; - - typedef NMHDR *LPNMHDR; - - typedef struct tagSTYLESTRUCT { - DWORD styleOld; - DWORD styleNew; - } STYLESTRUCT,*LPSTYLESTRUCT; - -#define ODT_MENU 1 -#define ODT_LISTBOX 2 -#define ODT_COMBOBOX 3 -#define ODT_BUTTON 4 -#define ODT_STATIC 5 - -#define ODA_DRAWENTIRE 0x0001 -#define ODA_SELECT 0x0002 -#define ODA_FOCUS 0x0004 - -#define ODS_SELECTED 0x0001 -#define ODS_GRAYED 0x0002 -#define ODS_DISABLED 0x0004 -#define ODS_CHECKED 0x0008 -#define ODS_FOCUS 0x0010 -#define ODS_DEFAULT 0x0020 -#define ODS_COMBOBOXEDIT 0x1000 -#define ODS_HOTLIGHT 0x0040 -#define ODS_INACTIVE 0x0080 -#define ODS_NOACCEL 0x0100 -#define ODS_NOFOCUSRECT 0x0200 - - typedef struct tagMEASUREITEMSTRUCT { - UINT CtlType; - UINT CtlID; - UINT itemID; - UINT itemWidth; - UINT itemHeight; - ULONG_PTR itemData; - } MEASUREITEMSTRUCT,*PMEASUREITEMSTRUCT,*LPMEASUREITEMSTRUCT; - - typedef struct tagDRAWITEMSTRUCT { - UINT CtlType; - UINT CtlID; - UINT itemID; - UINT itemAction; - UINT itemState; - HWND hwndItem; - HDC hDC; - RECT rcItem; - ULONG_PTR itemData; - } DRAWITEMSTRUCT,*PDRAWITEMSTRUCT,*LPDRAWITEMSTRUCT; - - typedef struct tagDELETEITEMSTRUCT { - UINT CtlType; - UINT CtlID; - UINT itemID; - HWND hwndItem; - ULONG_PTR itemData; - } DELETEITEMSTRUCT,*PDELETEITEMSTRUCT,*LPDELETEITEMSTRUCT; - - typedef struct tagCOMPAREITEMSTRUCT { - UINT CtlType; - UINT CtlID; - HWND hwndItem; - UINT itemID1; - ULONG_PTR itemData1; - UINT itemID2; - ULONG_PTR itemData2; - DWORD dwLocaleId; - } COMPAREITEMSTRUCT,*PCOMPAREITEMSTRUCT,*LPCOMPAREITEMSTRUCT; - -#ifndef NOMSG -#ifdef UNICODE -#define GetMessage GetMessageW -#define DispatchMessage DispatchMessageW -#define PeekMessage PeekMessageW -#else -#define GetMessage GetMessageA -#define DispatchMessage DispatchMessageA -#define PeekMessage PeekMessageA -#endif - - WINUSERAPI WINBOOL WINAPI GetMessageA(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax); - WINUSERAPI WINBOOL WINAPI GetMessageW(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax); - WINUSERAPI WINBOOL WINAPI TranslateMessage(CONST MSG *lpMsg); - WINUSERAPI LRESULT WINAPI DispatchMessageA(CONST MSG *lpMsg); - WINUSERAPI LRESULT WINAPI DispatchMessageW(CONST MSG *lpMsg); - WINUSERAPI WINBOOL WINAPI SetMessageQueue(int cMessagesMax); - WINUSERAPI WINBOOL WINAPI PeekMessageA(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg); - WINUSERAPI WINBOOL WINAPI PeekMessageW(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg); - -#define PM_NOREMOVE 0x0000 -#define PM_REMOVE 0x0001 -#define PM_NOYIELD 0x0002 -#define PM_QS_INPUT (QS_INPUT << 16) -#define PM_QS_POSTMESSAGE ((QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16) -#define PM_QS_PAINT (QS_PAINT << 16) -#define PM_QS_SENDMESSAGE (QS_SENDMESSAGE << 16) -#endif - - WINUSERAPI WINBOOL WINAPI RegisterHotKey(HWND hWnd,int id,UINT fsModifiers,UINT vk); - WINUSERAPI WINBOOL WINAPI UnregisterHotKey(HWND hWnd,int id); - -#define MOD_ALT 0x0001 -#define MOD_CONTROL 0x0002 -#define MOD_SHIFT 0x0004 -#define MOD_WIN 0x0008 - -#define IDHOT_SNAPWINDOW (-1) -#define IDHOT_SNAPDESKTOP (-2) - -#ifdef WIN_INTERNAL -#ifndef LSTRING -#define NOLSTRING -#endif -#ifndef LFILEIO -#define NOLFILEIO -#endif -#endif - -#define ENDSESSION_LOGOFF 0x80000000 - -#define EWX_LOGOFF 0 -#define EWX_SHUTDOWN 0x00000001 -#define EWX_REBOOT 0x00000002 -#define EWX_FORCE 0x00000004 -#define EWX_POWEROFF 0x00000008 -#define EWX_FORCEIFHUNG 0x00000010 - -#define ExitWindows(dwReserved,Code) ExitWindowsEx(EWX_LOGOFF,0xFFFFFFFF) - -#ifdef UNICODE -#define SendMessage SendMessageW -#define SendMessageTimeout SendMessageTimeoutW -#define SendNotifyMessage SendNotifyMessageW -#define SendMessageCallback SendMessageCallbackW -#else -#define SendMessage SendMessageA -#define SendMessageTimeout SendMessageTimeoutA -#define SendNotifyMessage SendNotifyMessageA -#define SendMessageCallback SendMessageCallbackA -#endif - - WINUSERAPI WINBOOL WINAPI ExitWindowsEx(UINT uFlags,DWORD dwReason); - WINUSERAPI WINBOOL WINAPI SwapMouseButton(WINBOOL fSwap); - WINUSERAPI DWORD WINAPI GetMessagePos(VOID); - WINUSERAPI LONG WINAPI GetMessageTime(VOID); - WINUSERAPI LPARAM WINAPI GetMessageExtraInfo(VOID); - WINUSERAPI WINBOOL WINAPI IsWow64Message(VOID); - WINUSERAPI LPARAM WINAPI SetMessageExtraInfo(LPARAM lParam); - WINUSERAPI LRESULT WINAPI SendMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI SendMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI SendMessageTimeoutA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,UINT fuFlags,UINT uTimeout,PDWORD_PTR lpdwResult); - WINUSERAPI LRESULT WINAPI SendMessageTimeoutW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,UINT fuFlags,UINT uTimeout,PDWORD_PTR lpdwResult); - WINUSERAPI WINBOOL WINAPI SendNotifyMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI SendNotifyMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI SendMessageCallbackA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,SENDASYNCPROC lpResultCallBack,ULONG_PTR dwData); - WINUSERAPI WINBOOL WINAPI SendMessageCallbackW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam,SENDASYNCPROC lpResultCallBack,ULONG_PTR dwData); - - typedef struct { - UINT cbSize; - HDESK hdesk; - HWND hwnd; - LUID luid; - } BSMINFO,*PBSMINFO; - -#ifdef UNICODE -#define BroadcastSystemMessageEx BroadcastSystemMessageExW -#define BroadcastSystemMessage BroadcastSystemMessageW -#else -#define BroadcastSystemMessageEx BroadcastSystemMessageExA -#define BroadcastSystemMessage BroadcastSystemMessageA -#endif - - WINUSERAPI long WINAPI BroadcastSystemMessageExA(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam,PBSMINFO pbsmInfo); - WINUSERAPI long WINAPI BroadcastSystemMessageExW(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam,PBSMINFO pbsmInfo); - WINUSERAPI long WINAPI BroadcastSystemMessageA(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI long WINAPI BroadcastSystemMessageW(DWORD flags,LPDWORD lpInfo,UINT Msg,WPARAM wParam,LPARAM lParam); - -#define BSM_ALLCOMPONENTS 0x00000000 -#define BSM_VXDS 0x00000001 -#define BSM_NETDRIVER 0x00000002 -#define BSM_INSTALLABLEDRIVERS 0x00000004 -#define BSM_APPLICATIONS 0x00000008 -#define BSM_ALLDESKTOPS 0x00000010 - -#define BSF_QUERY 0x00000001 -#define BSF_IGNORECURRENTTASK 0x00000002 -#define BSF_FLUSHDISK 0x00000004 -#define BSF_NOHANG 0x00000008 -#define BSF_POSTMESSAGE 0x00000010 -#define BSF_FORCEIFHUNG 0x00000020 -#define BSF_NOTIMEOUTIFNOTHUNG 0x00000040 -#define BSF_ALLOWSFW 0x00000080 -#define BSF_SENDNOTIFYMESSAGE 0x00000100 -#define BSF_RETURNHDESK 0x00000200 -#define BSF_LUID 0x00000400 - -#define BROADCAST_QUERY_DENY 0x424D5144 - - typedef PVOID HDEVNOTIFY; - typedef HDEVNOTIFY *PHDEVNOTIFY; - -#define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000 -#define DEVICE_NOTIFY_SERVICE_HANDLE 0x00000001 -#define DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 0x00000004 - -#ifdef UNICODE -#define RegisterDeviceNotification RegisterDeviceNotificationW -#define PostMessage PostMessageW -#define PostThreadMessage PostThreadMessageW -#define PostAppMessage PostAppMessageW -#define DefWindowProc DefWindowProcW -#define CallWindowProc CallWindowProcW -#define RegisterClass RegisterClassW -#define UnregisterClass UnregisterClassW -#define GetClassInfo GetClassInfoW -#define RegisterClassEx RegisterClassExW -#define GetClassInfoEx GetClassInfoExW -#else -#define RegisterDeviceNotification RegisterDeviceNotificationA -#define PostMessage PostMessageA -#define PostThreadMessage PostThreadMessageA -#define PostAppMessage PostAppMessageA -#define DefWindowProc DefWindowProcA -#define CallWindowProc CallWindowProcA -#define RegisterClass RegisterClassA -#define UnregisterClass UnregisterClassA -#define GetClassInfo GetClassInfoA -#define RegisterClassEx RegisterClassExA -#define GetClassInfoEx GetClassInfoExA -#endif - - WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationA(HANDLE hRecipient,LPVOID NotificationFilter,DWORD Flags); - WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE hRecipient,LPVOID NotificationFilter,DWORD Flags); - WINUSERAPI WINBOOL WINAPI UnregisterDeviceNotification(HDEVNOTIFY Handle); - WINUSERAPI WINBOOL WINAPI PostMessageA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI PostMessageW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI PostThreadMessageA(DWORD idThread,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI PostThreadMessageW(DWORD idThread,UINT Msg,WPARAM wParam,LPARAM lParam); -#define PostAppMessageA(idThread,wMsg,wParam,lParam) PostThreadMessageA((DWORD)idThread,wMsg,wParam,lParam) -#define PostAppMessageW(idThread,wMsg,wParam,lParam) PostThreadMessageW((DWORD)idThread,wMsg,wParam,lParam) - -#define HWND_BROADCAST ((HWND)0xffff) -#define HWND_MESSAGE ((HWND)-3) - - WINUSERAPI WINBOOL WINAPI AttachThreadInput(DWORD idAttach,DWORD idAttachTo,WINBOOL fAttach); - WINUSERAPI WINBOOL WINAPI ReplyMessage(LRESULT lResult); - WINUSERAPI WINBOOL WINAPI WaitMessage(VOID); - WINUSERAPI DWORD WINAPI WaitForInputIdle(HANDLE hProcess,DWORD dwMilliseconds); - WINUSERAPI LRESULT WINAPI DefWindowProcA(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI DefWindowProcW(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI VOID WINAPI PostQuitMessage(int nExitCode); - WINUSERAPI LRESULT WINAPI CallWindowProcA(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI CallWindowProcW(WNDPROC lpPrevWndFunc,HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI InSendMessage(VOID); - WINUSERAPI DWORD WINAPI InSendMessageEx(LPVOID lpReserved); - -#define ISMEX_NOSEND 0x00000000 -#define ISMEX_SEND 0x00000001 -#define ISMEX_NOTIFY 0x00000002 -#define ISMEX_CALLBACK 0x00000004 -#define ISMEX_REPLIED 0x00000008 - - WINUSERAPI UINT WINAPI GetDoubleClickTime(VOID); - WINUSERAPI WINBOOL WINAPI SetDoubleClickTime(UINT); - WINUSERAPI ATOM WINAPI RegisterClassA(CONST WNDCLASSA *lpWndClass); - WINUSERAPI ATOM WINAPI RegisterClassW(CONST WNDCLASSW *lpWndClass); - WINUSERAPI WINBOOL WINAPI UnregisterClassA(LPCSTR lpClassName,HINSTANCE hInstance); - WINUSERAPI WINBOOL WINAPI UnregisterClassW(LPCWSTR lpClassName,HINSTANCE hInstance); - WINUSERAPI WINBOOL WINAPI GetClassInfoA(HINSTANCE hInstance,LPCSTR lpClassName,LPWNDCLASSA lpWndClass); - WINUSERAPI WINBOOL WINAPI GetClassInfoW(HINSTANCE hInstance,LPCWSTR lpClassName,LPWNDCLASSW lpWndClass); - WINUSERAPI ATOM WINAPI RegisterClassExA(CONST WNDCLASSEXA *); - WINUSERAPI ATOM WINAPI RegisterClassExW(CONST WNDCLASSEXW *); - WINUSERAPI WINBOOL WINAPI GetClassInfoExA(HINSTANCE hInstance,LPCSTR lpszClass,LPWNDCLASSEXA lpwcx); - WINUSERAPI WINBOOL WINAPI GetClassInfoExW(HINSTANCE hInstance,LPCWSTR lpszClass,LPWNDCLASSEXW lpwcx); - -#define CW_USEDEFAULT ((int)0x80000000) - -#define HWND_DESKTOP ((HWND)0) - - typedef BOOLEAN (WINAPI *PREGISTERCLASSNAMEW)(LPCWSTR); - -#ifdef UNICODE -#define CreateWindowEx CreateWindowExW -#define CreateWindow CreateWindowW -#else -#define CreateWindowEx CreateWindowExA -#define CreateWindow CreateWindowA -#endif - - WINUSERAPI HWND WINAPI CreateWindowExA(DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam); - WINUSERAPI HWND WINAPI CreateWindowExW(DWORD dwExStyle,LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam); -#define CreateWindowA(lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) CreateWindowExA(0L,lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) -#define CreateWindowW(lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) CreateWindowExW(0L,lpClassName,lpWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam) - WINUSERAPI WINBOOL WINAPI IsWindow(HWND hWnd); - WINUSERAPI WINBOOL WINAPI IsMenu(HMENU hMenu); - WINUSERAPI WINBOOL WINAPI IsChild(HWND hWndParent,HWND hWnd); - WINUSERAPI WINBOOL WINAPI DestroyWindow(HWND hWnd); - WINUSERAPI WINBOOL WINAPI ShowWindow(HWND hWnd,int nCmdShow); - WINUSERAPI WINBOOL WINAPI AnimateWindow(HWND hWnd,DWORD dwTime,DWORD dwFlags); - -#if defined(_WINGDI_) && !defined(NOGDI) - WINUSERAPI WINBOOL WINAPI UpdateLayeredWindow(HWND hWnd,HDC hdcDst,POINT *pptDst,SIZE *psize,HDC hdcSrc,POINT *pptSrc,COLORREF crKey,BLENDFUNCTION *pblend,DWORD dwFlags); - - typedef struct tagUPDATELAYEREDWINDOWINFO { - DWORD cbSize; - HDC hdcDst; - POINT CONST *pptDst; - SIZE CONST *psize; - HDC hdcSrc; - POINT CONST *pptSrc; - COLORREF crKey; - BLENDFUNCTION CONST *pblend; - DWORD dwFlags; - RECT CONST *prcDirty; - } UPDATELAYEREDWINDOWINFO,*PUPDATELAYEREDWINDOWINFO; - - WINUSERAPI WINBOOL WINAPI UpdateLayeredWindowIndirect(HWND hWnd,UPDATELAYEREDWINDOWINFO CONST *pULWInfo); - WINUSERAPI WINBOOL WINAPI GetLayeredWindowAttributes(HWND hwnd,COLORREF *pcrKey,BYTE *pbAlpha,DWORD *pdwFlags); - -#define PW_CLIENTONLY 0x00000001 - - WINUSERAPI WINBOOL WINAPI PrintWindow(HWND hwnd,HDC hdcBlt,UINT nFlags); - WINUSERAPI WINBOOL WINAPI SetLayeredWindowAttributes(HWND hwnd,COLORREF crKey,BYTE bAlpha,DWORD dwFlags); - -#define LWA_COLORKEY 0x00000001 -#define LWA_ALPHA 0x00000002 - -#define ULW_COLORKEY 0x00000001 -#define ULW_ALPHA 0x00000002 -#define ULW_OPAQUE 0x00000004 - -#define ULW_EX_NORESIZE 0x00000008 - - WINUSERAPI WINBOOL WINAPI ShowWindowAsync(HWND hWnd,int nCmdShow); - WINUSERAPI WINBOOL WINAPI FlashWindow(HWND hWnd,WINBOOL bInvert); - - typedef struct { - UINT cbSize; - HWND hwnd; - DWORD dwFlags; - UINT uCount; - DWORD dwTimeout; - } FLASHWINFO,*PFLASHWINFO; - - WINUSERAPI WINBOOL WINAPI FlashWindowEx(PFLASHWINFO pfwi); - -#define FLASHW_STOP 0 -#define FLASHW_CAPTION 0x00000001 -#define FLASHW_TRAY 0x00000002 -#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY) -#define FLASHW_TIMER 0x00000004 -#define FLASHW_TIMERNOFG 0x0000000C - - WINUSERAPI WINBOOL WINAPI ShowOwnedPopups(HWND hWnd,WINBOOL fShow); - WINUSERAPI WINBOOL WINAPI OpenIcon(HWND hWnd); - WINUSERAPI WINBOOL WINAPI CloseWindow(HWND hWnd); - WINUSERAPI WINBOOL WINAPI MoveWindow(HWND hWnd,int X,int Y,int nWidth,int nHeight,WINBOOL bRepaint); - WINUSERAPI WINBOOL WINAPI SetWindowPos(HWND hWnd,HWND hWndInsertAfter,int X,int Y,int cx,int cy,UINT uFlags); - WINUSERAPI WINBOOL WINAPI GetWindowPlacement(HWND hWnd,WINDOWPLACEMENT *lpwndpl); - WINUSERAPI WINBOOL WINAPI SetWindowPlacement(HWND hWnd,CONST WINDOWPLACEMENT *lpwndpl); - -#ifndef NODEFERWINDOWPOS - WINUSERAPI HDWP WINAPI BeginDeferWindowPos(int nNumWindows); - WINUSERAPI HDWP WINAPI DeferWindowPos(HDWP hWinPosInfo,HWND hWnd,HWND hWndInsertAfter,int x,int y,int cx,int cy,UINT uFlags); - WINUSERAPI WINBOOL WINAPI EndDeferWindowPos(HDWP hWinPosInfo); -#endif - - WINUSERAPI WINBOOL WINAPI IsWindowVisible(HWND hWnd); - WINUSERAPI WINBOOL WINAPI IsIconic(HWND hWnd); - WINUSERAPI WINBOOL WINAPI AnyPopup(VOID); - WINUSERAPI WINBOOL WINAPI BringWindowToTop(HWND hWnd); - WINUSERAPI WINBOOL WINAPI IsZoomed(HWND hWnd); - -#define SWP_NOSIZE 0x0001 -#define SWP_NOMOVE 0x0002 -#define SWP_NOZORDER 0x0004 -#define SWP_NOREDRAW 0x0008 -#define SWP_NOACTIVATE 0x0010 -#define SWP_FRAMECHANGED 0x0020 -#define SWP_SHOWWINDOW 0x0040 -#define SWP_HIDEWINDOW 0x0080 -#define SWP_NOCOPYBITS 0x0100 -#define SWP_NOOWNERZORDER 0x0200 -#define SWP_NOSENDCHANGING 0x0400 - -#define SWP_DRAWFRAME SWP_FRAMECHANGED -#define SWP_NOREPOSITION SWP_NOOWNERZORDER -#define SWP_DEFERERASE 0x2000 -#define SWP_ASYNCWINDOWPOS 0x4000 - -#define HWND_TOP ((HWND)0) -#define HWND_BOTTOM ((HWND)1) -#define HWND_TOPMOST ((HWND)-1) -#define HWND_NOTOPMOST ((HWND)-2) - -#ifndef NOCTLMGR - -#include - - typedef struct { - DWORD style; - DWORD dwExtendedStyle; - WORD cdit; - short x; - short y; - short cx; - short cy; - } DLGTEMPLATE; - - typedef DLGTEMPLATE *LPDLGTEMPLATEA; - typedef DLGTEMPLATE *LPDLGTEMPLATEW; - -#ifdef UNICODE - typedef LPDLGTEMPLATEW LPDLGTEMPLATE; -#else - typedef LPDLGTEMPLATEA LPDLGTEMPLATE; -#endif - - typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEA; - typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEW; - -#ifdef UNICODE - typedef LPCDLGTEMPLATEW LPCDLGTEMPLATE; -#else - typedef LPCDLGTEMPLATEA LPCDLGTEMPLATE; -#endif - - typedef struct { - DWORD style; - DWORD dwExtendedStyle; - short x; - short y; - short cx; - short cy; - WORD id; - } DLGITEMTEMPLATE; - - typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEA; - typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEW; - -#ifdef UNICODE - typedef PDLGITEMTEMPLATEW PDLGITEMTEMPLATE; -#else - typedef PDLGITEMTEMPLATEA PDLGITEMTEMPLATE; -#endif - - typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA; - typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW; - -#ifdef UNICODE - typedef LPDLGITEMTEMPLATEW LPDLGITEMTEMPLATE; -#else - typedef LPDLGITEMTEMPLATEA LPDLGITEMTEMPLATE; -#endif - -#include - -#ifdef UNICODE -#define CreateDialogParam CreateDialogParamW -#define CreateDialogIndirectParam CreateDialogIndirectParamW -#define CreateDialog CreateDialogW -#define CreateDialogIndirect CreateDialogIndirectW -#define DialogBoxParam DialogBoxParamW -#define DialogBoxIndirectParam DialogBoxIndirectParamW -#define DialogBox DialogBoxW -#define DialogBoxIndirect DialogBoxIndirectW -#define SetDlgItemText SetDlgItemTextW -#define GetDlgItemText GetDlgItemTextW -#define SendDlgItemMessage SendDlgItemMessageW -#define DefDlgProc DefDlgProcW -#else -#define CreateDialogParam CreateDialogParamA -#define CreateDialogIndirectParam CreateDialogIndirectParamA -#define CreateDialog CreateDialogA -#define CreateDialogIndirect CreateDialogIndirectA -#define DialogBoxParam DialogBoxParamA -#define DialogBoxIndirectParam DialogBoxIndirectParamA -#define DialogBox DialogBoxA -#define DialogBoxIndirect DialogBoxIndirectA -#define SetDlgItemText SetDlgItemTextA -#define GetDlgItemText GetDlgItemTextA -#define SendDlgItemMessage SendDlgItemMessageA -#define DefDlgProc DefDlgProcA -#endif - - WINUSERAPI HWND WINAPI CreateDialogParamA(HINSTANCE hInstance,LPCSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); - WINUSERAPI HWND WINAPI CreateDialogParamW(HINSTANCE hInstance,LPCWSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); - WINUSERAPI HWND WINAPI CreateDialogIndirectParamA(HINSTANCE hInstance,LPCDLGTEMPLATEA lpTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); - WINUSERAPI HWND WINAPI CreateDialogIndirectParamW(HINSTANCE hInstance,LPCDLGTEMPLATEW lpTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); -#define CreateDialogA(hInstance,lpName,hWndParent,lpDialogFunc) CreateDialogParamA(hInstance,lpName,hWndParent,lpDialogFunc,0L) -#define CreateDialogW(hInstance,lpName,hWndParent,lpDialogFunc) CreateDialogParamW(hInstance,lpName,hWndParent,lpDialogFunc,0L) -#define CreateDialogIndirectA(hInstance,lpTemplate,hWndParent,lpDialogFunc) CreateDialogIndirectParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) -#define CreateDialogIndirectW(hInstance,lpTemplate,hWndParent,lpDialogFunc) CreateDialogIndirectParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) - WINUSERAPI INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance,LPCSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); - WINUSERAPI INT_PTR WINAPI DialogBoxParamW(HINSTANCE hInstance,LPCWSTR lpTemplateName,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); - WINUSERAPI INT_PTR WINAPI DialogBoxIndirectParamA(HINSTANCE hInstance,LPCDLGTEMPLATEA hDialogTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); - WINUSERAPI INT_PTR WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance,LPCDLGTEMPLATEW hDialogTemplate,HWND hWndParent,DLGPROC lpDialogFunc,LPARAM dwInitParam); -#define DialogBoxA(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) -#define DialogBoxW(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) -#define DialogBoxIndirectA(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxIndirectParamA(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) -#define DialogBoxIndirectW(hInstance,lpTemplate,hWndParent,lpDialogFunc) DialogBoxIndirectParamW(hInstance,lpTemplate,hWndParent,lpDialogFunc,0L) - WINUSERAPI WINBOOL WINAPI EndDialog(HWND hDlg,INT_PTR nResult); - WINUSERAPI HWND WINAPI GetDlgItem(HWND hDlg,int nIDDlgItem); - WINUSERAPI WINBOOL WINAPI SetDlgItemInt(HWND hDlg,int nIDDlgItem,UINT uValue,WINBOOL bSigned); - WINUSERAPI UINT WINAPI GetDlgItemInt(HWND hDlg,int nIDDlgItem,WINBOOL *lpTranslated,WINBOOL bSigned); - WINUSERAPI WINBOOL WINAPI SetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPCSTR lpString); - WINUSERAPI WINBOOL WINAPI SetDlgItemTextW(HWND hDlg,int nIDDlgItem,LPCWSTR lpString); - WINUSERAPI UINT WINAPI GetDlgItemTextA(HWND hDlg,int nIDDlgItem,LPSTR lpString,int cchMax); - WINUSERAPI UINT WINAPI GetDlgItemTextW(HWND hDlg,int nIDDlgItem,LPWSTR lpString,int cchMax); - WINUSERAPI WINBOOL WINAPI CheckDlgButton(HWND hDlg,int nIDButton,UINT uCheck); - WINUSERAPI WINBOOL WINAPI CheckRadioButton(HWND hDlg,int nIDFirstButton,int nIDLastButton,int nIDCheckButton); - WINUSERAPI UINT WINAPI IsDlgButtonChecked(HWND hDlg,int nIDButton); - WINUSERAPI LRESULT WINAPI SendDlgItemMessageA(HWND hDlg,int nIDDlgItem,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI SendDlgItemMessageW(HWND hDlg,int nIDDlgItem,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI HWND WINAPI GetNextDlgGroupItem(HWND hDlg,HWND hCtl,WINBOOL bPrevious); - WINUSERAPI HWND WINAPI GetNextDlgTabItem(HWND hDlg,HWND hCtl,WINBOOL bPrevious); - WINUSERAPI int WINAPI GetDlgCtrlID(HWND hWnd); - WINUSERAPI long WINAPI GetDialogBaseUnits(VOID); - WINUSERAPI LRESULT WINAPI DefDlgProcA(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI DefDlgProcW(HWND hDlg,UINT Msg,WPARAM wParam,LPARAM lParam); - -#define DLGWINDOWEXTRA 30 -#endif - -#ifndef NOMSG - -#ifdef UNICODE -#define CallMsgFilter CallMsgFilterW -#else -#define CallMsgFilter CallMsgFilterA -#endif - - WINUSERAPI WINBOOL WINAPI CallMsgFilterA(LPMSG lpMsg,int nCode); - WINUSERAPI WINBOOL WINAPI CallMsgFilterW(LPMSG lpMsg,int nCode); -#endif - -#ifndef NOCLIPBOARD - -#ifdef UNICODE -#define RegisterClipboardFormat RegisterClipboardFormatW -#define GetClipboardFormatName GetClipboardFormatNameW -#else -#define RegisterClipboardFormat RegisterClipboardFormatA -#define GetClipboardFormatName GetClipboardFormatNameA -#endif - - WINUSERAPI WINBOOL WINAPI OpenClipboard(HWND hWndNewOwner); - WINUSERAPI WINBOOL WINAPI CloseClipboard(VOID); - WINUSERAPI DWORD WINAPI GetClipboardSequenceNumber(VOID); - WINUSERAPI HWND WINAPI GetClipboardOwner(VOID); - WINUSERAPI HWND WINAPI SetClipboardViewer(HWND hWndNewViewer); - WINUSERAPI HWND WINAPI GetClipboardViewer(VOID); - WINUSERAPI WINBOOL WINAPI ChangeClipboardChain(HWND hWndRemove,HWND hWndNewNext); - WINUSERAPI HANDLE WINAPI SetClipboardData(UINT uFormat,HANDLE hMem); - WINUSERAPI HANDLE WINAPI GetClipboardData(UINT uFormat); - WINUSERAPI UINT WINAPI RegisterClipboardFormatA(LPCSTR lpszFormat); - WINUSERAPI UINT WINAPI RegisterClipboardFormatW(LPCWSTR lpszFormat); - WINUSERAPI int WINAPI CountClipboardFormats(VOID); - WINUSERAPI UINT WINAPI EnumClipboardFormats(UINT format); - WINUSERAPI int WINAPI GetClipboardFormatNameA(UINT format,LPSTR lpszFormatName,int cchMaxCount); - WINUSERAPI int WINAPI GetClipboardFormatNameW(UINT format,LPWSTR lpszFormatName,int cchMaxCount); - WINUSERAPI WINBOOL WINAPI EmptyClipboard(VOID); - WINUSERAPI WINBOOL WINAPI IsClipboardFormatAvailable(UINT format); - WINUSERAPI int WINAPI GetPriorityClipboardFormat(UINT *paFormatPriorityList,int cFormats); - WINUSERAPI HWND WINAPI GetOpenClipboardWindow(VOID); -#endif - -#ifdef UNICODE -#define CharToOem CharToOemW -#define OemToChar OemToCharW -#define CharToOemBuff CharToOemBuffW -#define OemToCharBuff OemToCharBuffW -#define CharUpper CharUpperW -#define CharUpperBuff CharUpperBuffW -#define CharLower CharLowerW -#define CharLowerBuff CharLowerBuffW -#define CharNext CharNextW -#define CharPrev CharPrevW -#else -#define CharToOem CharToOemA -#define OemToChar OemToCharA -#define CharToOemBuff CharToOemBuffA -#define OemToCharBuff OemToCharBuffA -#define CharUpper CharUpperA -#define CharUpperBuff CharUpperBuffA -#define CharLower CharLowerA -#define CharLowerBuff CharLowerBuffA -#define CharNext CharNextA -#define CharPrev CharPrevA -#endif - - WINUSERAPI WINBOOL WINAPI CharToOemA(LPCSTR lpszSrc,LPSTR lpszDst); - WINUSERAPI WINBOOL WINAPI CharToOemW(LPCWSTR lpszSrc,LPSTR lpszDst); - WINUSERAPI WINBOOL WINAPI OemToCharA(LPCSTR lpszSrc,LPSTR lpszDst); - WINUSERAPI WINBOOL WINAPI OemToCharW(LPCSTR lpszSrc,LPWSTR lpszDst); - WINUSERAPI WINBOOL WINAPI CharToOemBuffA(LPCSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); - WINUSERAPI WINBOOL WINAPI CharToOemBuffW(LPCWSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); - WINUSERAPI WINBOOL WINAPI OemToCharBuffA(LPCSTR lpszSrc,LPSTR lpszDst,DWORD cchDstLength); - WINUSERAPI WINBOOL WINAPI OemToCharBuffW(LPCSTR lpszSrc,LPWSTR lpszDst,DWORD cchDstLength); - WINUSERAPI LPSTR WINAPI CharUpperA(LPSTR lpsz); - WINUSERAPI LPWSTR WINAPI CharUpperW(LPWSTR lpsz); - WINUSERAPI DWORD WINAPI CharUpperBuffA(LPSTR lpsz,DWORD cchLength); - WINUSERAPI DWORD WINAPI CharUpperBuffW(LPWSTR lpsz,DWORD cchLength); - WINUSERAPI LPSTR WINAPI CharLowerA(LPSTR lpsz); - WINUSERAPI LPWSTR WINAPI CharLowerW(LPWSTR lpsz); - WINUSERAPI DWORD WINAPI CharLowerBuffA(LPSTR lpsz,DWORD cchLength); - WINUSERAPI DWORD WINAPI CharLowerBuffW(LPWSTR lpsz,DWORD cchLength); - WINUSERAPI LPSTR WINAPI CharNextA(LPCSTR lpsz); - WINUSERAPI LPWSTR WINAPI CharNextW(LPCWSTR lpsz); - WINUSERAPI LPSTR WINAPI CharPrevA(LPCSTR lpszStart,LPCSTR lpszCurrent); - WINUSERAPI LPWSTR WINAPI CharPrevW(LPCWSTR lpszStart,LPCWSTR lpszCurrent); - WINUSERAPI LPSTR WINAPI CharNextExA(WORD CodePage,LPCSTR lpCurrentChar,DWORD dwFlags); - WINUSERAPI LPSTR WINAPI CharPrevExA(WORD CodePage,LPCSTR lpStart,LPCSTR lpCurrentChar,DWORD dwFlags); - -#define AnsiToOem CharToOemA -#define OemToAnsi OemToCharA -#define AnsiToOemBuff CharToOemBuffA -#define OemToAnsiBuff OemToCharBuffA -#define AnsiUpper CharUpperA -#define AnsiUpperBuff CharUpperBuffA -#define AnsiLower CharLowerA -#define AnsiLowerBuff CharLowerBuffA -#define AnsiNext CharNextA -#define AnsiPrev CharPrevA - -#ifndef NOLANGUAGE - -#ifdef UNICODE -#define IsCharAlpha IsCharAlphaW -#define IsCharAlphaNumeric IsCharAlphaNumericW -#define IsCharUpper IsCharUpperW -#define IsCharLower IsCharLowerW -#else -#define IsCharAlpha IsCharAlphaA -#define IsCharAlphaNumeric IsCharAlphaNumericA -#define IsCharUpper IsCharUpperA -#define IsCharLower IsCharLowerA -#endif - - WINUSERAPI WINBOOL WINAPI IsCharAlphaA(CHAR ch); - WINUSERAPI WINBOOL WINAPI IsCharAlphaW(WCHAR ch); - WINUSERAPI WINBOOL WINAPI IsCharAlphaNumericA(CHAR ch); - WINUSERAPI WINBOOL WINAPI IsCharAlphaNumericW(WCHAR ch); - WINUSERAPI WINBOOL WINAPI IsCharUpperA(CHAR ch); - WINUSERAPI WINBOOL WINAPI IsCharUpperW(WCHAR ch); - WINUSERAPI WINBOOL WINAPI IsCharLowerA(CHAR ch); - WINUSERAPI WINBOOL WINAPI IsCharLowerW(WCHAR ch); -#endif - -#ifdef UNICODE -#define GetKeyNameText GetKeyNameTextW -#define VkKeyScan VkKeyScanW -#define VkKeyScanEx VkKeyScanExW -#else -#define GetKeyNameText GetKeyNameTextA -#define VkKeyScan VkKeyScanA -#define VkKeyScanEx VkKeyScanExA -#endif - - WINUSERAPI HWND WINAPI SetFocus(HWND hWnd); - WINUSERAPI HWND WINAPI GetActiveWindow(VOID); - WINUSERAPI HWND WINAPI GetFocus(VOID); - WINUSERAPI UINT WINAPI GetKBCodePage(VOID); - WINUSERAPI SHORT WINAPI GetKeyState(int nVirtKey); - WINUSERAPI SHORT WINAPI GetAsyncKeyState(int vKey); - WINUSERAPI WINBOOL WINAPI GetKeyboardState(PBYTE lpKeyState); - WINUSERAPI WINBOOL WINAPI SetKeyboardState(LPBYTE lpKeyState); - WINUSERAPI int WINAPI GetKeyNameTextA(LONG lParam,LPSTR lpString,int cchSize); - WINUSERAPI int WINAPI GetKeyNameTextW(LONG lParam,LPWSTR lpString,int cchSize); - WINUSERAPI int WINAPI GetKeyboardType(int nTypeFlag); - WINUSERAPI int WINAPI ToAscii(UINT uVirtKey,UINT uScanCode,CONST BYTE *lpKeyState,LPWORD lpChar,UINT uFlags); - WINUSERAPI int WINAPI ToAsciiEx(UINT uVirtKey,UINT uScanCode,CONST BYTE *lpKeyState,LPWORD lpChar,UINT uFlags,HKL dwhkl); - WINUSERAPI int WINAPI ToUnicode(UINT wVirtKey,UINT wScanCode,CONST BYTE *lpKeyState,LPWSTR pwszBuff,int cchBuff,UINT wFlags); - WINUSERAPI DWORD WINAPI OemKeyScan(WORD wOemChar); - WINUSERAPI SHORT WINAPI VkKeyScanA(CHAR ch); - WINUSERAPI SHORT WINAPI VkKeyScanW(WCHAR ch); - WINUSERAPI SHORT WINAPI VkKeyScanExA(CHAR ch,HKL dwhkl); - WINUSERAPI SHORT WINAPI VkKeyScanExW(WCHAR ch,HKL dwhkl); - -#define KEYEVENTF_EXTENDEDKEY 0x0001 -#define KEYEVENTF_KEYUP 0x0002 -#define KEYEVENTF_UNICODE 0x0004 -#define KEYEVENTF_SCANCODE 0x0008 - - WINUSERAPI VOID WINAPI keybd_event(BYTE bVk,BYTE bScan,DWORD dwFlags,ULONG_PTR dwExtraInfo); - -#define MOUSEEVENTF_MOVE 0x0001 -#define MOUSEEVENTF_LEFTDOWN 0x0002 -#define MOUSEEVENTF_LEFTUP 0x0004 -#define MOUSEEVENTF_RIGHTDOWN 0x0008 -#define MOUSEEVENTF_RIGHTUP 0x0010 -#define MOUSEEVENTF_MIDDLEDOWN 0x0020 -#define MOUSEEVENTF_MIDDLEUP 0x0040 -#define MOUSEEVENTF_XDOWN 0x0080 -#define MOUSEEVENTF_XUP 0x0100 -#define MOUSEEVENTF_WHEEL 0x0800 -#define MOUSEEVENTF_VIRTUALDESK 0x4000 -#define MOUSEEVENTF_ABSOLUTE 0x8000 - - WINUSERAPI VOID WINAPI mouse_event(DWORD dwFlags,DWORD dx,DWORD dy,DWORD dwData,ULONG_PTR dwExtraInfo); - - typedef struct tagMOUSEINPUT { - LONG dx; - LONG dy; - DWORD mouseData; - DWORD dwFlags; - DWORD time; - ULONG_PTR dwExtraInfo; - } MOUSEINPUT,*PMOUSEINPUT,*LPMOUSEINPUT; - - typedef struct tagKEYBDINPUT { - WORD wVk; - WORD wScan; - DWORD dwFlags; - DWORD time; - ULONG_PTR dwExtraInfo; - } KEYBDINPUT,*PKEYBDINPUT,*LPKEYBDINPUT; - - typedef struct tagHARDWAREINPUT { - DWORD uMsg; - WORD wParamL; - WORD wParamH; - } HARDWAREINPUT,*PHARDWAREINPUT,*LPHARDWAREINPUT; - -#define INPUT_MOUSE 0 -#define INPUT_KEYBOARD 1 -#define INPUT_HARDWARE 2 - - typedef struct tagINPUT { - DWORD type; - union { - MOUSEINPUT mi; - KEYBDINPUT ki; - HARDWAREINPUT hi; - }; - } INPUT,*PINPUT,*LPINPUT; - - WINUSERAPI UINT WINAPI SendInput(UINT cInputs,LPINPUT pInputs,int cbSize); - - typedef struct tagLASTINPUTINFO { - UINT cbSize; - DWORD dwTime; - } LASTINPUTINFO,*PLASTINPUTINFO; - -#ifdef UNICODE -#define MapVirtualKey MapVirtualKeyW -#define MapVirtualKeyEx MapVirtualKeyExW -#else -#define MapVirtualKey MapVirtualKeyA -#define MapVirtualKeyEx MapVirtualKeyExA -#endif - - WINUSERAPI WINBOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii); - WINUSERAPI UINT WINAPI MapVirtualKeyA(UINT uCode,UINT uMapType); - WINUSERAPI UINT WINAPI MapVirtualKeyW(UINT uCode,UINT uMapType); - WINUSERAPI UINT WINAPI MapVirtualKeyExA(UINT uCode,UINT uMapType,HKL dwhkl); - WINUSERAPI UINT WINAPI MapVirtualKeyExW(UINT uCode,UINT uMapType,HKL dwhkl); - WINUSERAPI WINBOOL WINAPI GetInputState(VOID); - WINUSERAPI DWORD WINAPI GetQueueStatus(UINT flags); - WINUSERAPI HWND WINAPI GetCapture(VOID); - WINUSERAPI HWND WINAPI SetCapture(HWND hWnd); - WINUSERAPI WINBOOL WINAPI ReleaseCapture(VOID); - WINUSERAPI DWORD WINAPI MsgWaitForMultipleObjects(DWORD nCount,CONST HANDLE *pHandles,WINBOOL fWaitAll,DWORD dwMilliseconds,DWORD dwWakeMask); - WINUSERAPI DWORD WINAPI MsgWaitForMultipleObjectsEx(DWORD nCount,CONST HANDLE *pHandles,DWORD dwMilliseconds,DWORD dwWakeMask,DWORD dwFlags); - -#define MWMO_WAITALL 0x0001 -#define MWMO_ALERTABLE 0x0002 -#define MWMO_INPUTAVAILABLE 0x0004 - -#define QS_KEY 0x0001 -#define QS_MOUSEMOVE 0x0002 -#define QS_MOUSEBUTTON 0x0004 -#define QS_POSTMESSAGE 0x0008 -#define QS_TIMER 0x0010 -#define QS_PAINT 0x0020 -#define QS_SENDMESSAGE 0x0040 -#define QS_HOTKEY 0x0080 -#define QS_ALLPOSTMESSAGE 0x0100 -#define QS_RAWINPUT 0x0400 -#define QS_MOUSE (QS_MOUSEMOVE | QS_MOUSEBUTTON) -#define QS_INPUT (QS_MOUSE | QS_KEY | QS_RAWINPUT) -#define QS_ALLEVENTS (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY) -#define QS_ALLINPUT (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE) - -#define USER_TIMER_MAXIMUM 0x7FFFFFFF -#define USER_TIMER_MINIMUM 0x0000000A - -#ifdef UNICODE -#define LoadAccelerators LoadAcceleratorsW -#define CreateAcceleratorTable CreateAcceleratorTableW -#define CopyAcceleratorTable CopyAcceleratorTableW -#else -#define LoadAccelerators LoadAcceleratorsA -#define CreateAcceleratorTable CreateAcceleratorTableA -#define CopyAcceleratorTable CopyAcceleratorTableA -#endif - - WINUSERAPI UINT_PTR WINAPI SetTimer(HWND hWnd,UINT_PTR nIDEvent,UINT uElapse,TIMERPROC lpTimerFunc); - WINUSERAPI WINBOOL WINAPI KillTimer(HWND hWnd,UINT_PTR uIDEvent); - WINUSERAPI WINBOOL WINAPI IsWindowUnicode(HWND hWnd); - WINUSERAPI WINBOOL WINAPI EnableWindow(HWND hWnd,WINBOOL bEnable); - WINUSERAPI WINBOOL WINAPI IsWindowEnabled(HWND hWnd); - WINUSERAPI HACCEL WINAPI LoadAcceleratorsA(HINSTANCE hInstance,LPCSTR lpTableName); - WINUSERAPI HACCEL WINAPI LoadAcceleratorsW(HINSTANCE hInstance,LPCWSTR lpTableName); - WINUSERAPI HACCEL WINAPI CreateAcceleratorTableA(LPACCEL paccel,int cAccel); - WINUSERAPI HACCEL WINAPI CreateAcceleratorTableW(LPACCEL paccel,int cAccel); - WINUSERAPI WINBOOL WINAPI DestroyAcceleratorTable(HACCEL hAccel); - WINUSERAPI int WINAPI CopyAcceleratorTableA(HACCEL hAccelSrc,LPACCEL lpAccelDst,int cAccelEntries); - WINUSERAPI int WINAPI CopyAcceleratorTableW(HACCEL hAccelSrc,LPACCEL lpAccelDst,int cAccelEntries); - -#ifndef NOMSG - -#ifdef UNICODE -#define TranslateAccelerator TranslateAcceleratorW -#else -#define TranslateAccelerator TranslateAcceleratorA -#endif - - WINUSERAPI int WINAPI TranslateAcceleratorA(HWND hWnd,HACCEL hAccTable,LPMSG lpMsg); - WINUSERAPI int WINAPI TranslateAcceleratorW(HWND hWnd,HACCEL hAccTable,LPMSG lpMsg); -#endif - -#ifndef NOSYSMETRICS - -#define SM_CXSCREEN 0 -#define SM_CYSCREEN 1 -#define SM_CXVSCROLL 2 -#define SM_CYHSCROLL 3 -#define SM_CYCAPTION 4 -#define SM_CXBORDER 5 -#define SM_CYBORDER 6 -#define SM_CXDLGFRAME 7 -#define SM_CYDLGFRAME 8 -#define SM_CYVTHUMB 9 -#define SM_CXHTHUMB 10 -#define SM_CXICON 11 -#define SM_CYICON 12 -#define SM_CXCURSOR 13 -#define SM_CYCURSOR 14 -#define SM_CYMENU 15 -#define SM_CXFULLSCREEN 16 -#define SM_CYFULLSCREEN 17 -#define SM_CYKANJIWINDOW 18 -#define SM_MOUSEPRESENT 19 -#define SM_CYVSCROLL 20 -#define SM_CXHSCROLL 21 -#define SM_DEBUG 22 -#define SM_SWAPBUTTON 23 -#define SM_RESERVED1 24 -#define SM_RESERVED2 25 -#define SM_RESERVED3 26 -#define SM_RESERVED4 27 -#define SM_CXMIN 28 -#define SM_CYMIN 29 -#define SM_CXSIZE 30 -#define SM_CYSIZE 31 -#define SM_CXFRAME 32 -#define SM_CYFRAME 33 -#define SM_CXMINTRACK 34 -#define SM_CYMINTRACK 35 -#define SM_CXDOUBLECLK 36 -#define SM_CYDOUBLECLK 37 -#define SM_CXICONSPACING 38 -#define SM_CYICONSPACING 39 -#define SM_MENUDROPALIGNMENT 40 -#define SM_PENWINDOWS 41 -#define SM_DBCSENABLED 42 -#define SM_CMOUSEBUTTONS 43 - -#define SM_CXFIXEDFRAME SM_CXDLGFRAME -#define SM_CYFIXEDFRAME SM_CYDLGFRAME -#define SM_CXSIZEFRAME SM_CXFRAME -#define SM_CYSIZEFRAME SM_CYFRAME - -#define SM_SECURE 44 -#define SM_CXEDGE 45 -#define SM_CYEDGE 46 -#define SM_CXMINSPACING 47 -#define SM_CYMINSPACING 48 -#define SM_CXSMICON 49 -#define SM_CYSMICON 50 -#define SM_CYSMCAPTION 51 -#define SM_CXSMSIZE 52 -#define SM_CYSMSIZE 53 -#define SM_CXMENUSIZE 54 -#define SM_CYMENUSIZE 55 -#define SM_ARRANGE 56 -#define SM_CXMINIMIZED 57 -#define SM_CYMINIMIZED 58 -#define SM_CXMAXTRACK 59 -#define SM_CYMAXTRACK 60 -#define SM_CXMAXIMIZED 61 -#define SM_CYMAXIMIZED 62 -#define SM_NETWORK 63 -#define SM_CLEANBOOT 67 -#define SM_CXDRAG 68 -#define SM_CYDRAG 69 -#define SM_SHOWSOUNDS 70 -#define SM_CXMENUCHECK 71 -#define SM_CYMENUCHECK 72 -#define SM_SLOWMACHINE 73 -#define SM_MIDEASTENABLED 74 -#define SM_MOUSEWHEELPRESENT 75 -#define SM_XVIRTUALSCREEN 76 -#define SM_YVIRTUALSCREEN 77 -#define SM_CXVIRTUALSCREEN 78 -#define SM_CYVIRTUALSCREEN 79 -#define SM_CMONITORS 80 -#define SM_SAMEDISPLAYFORMAT 81 -#define SM_IMMENABLED 82 -#define SM_CXFOCUSBORDER 83 -#define SM_CYFOCUSBORDER 84 -#define SM_TABLETPC 86 -#define SM_MEDIACENTER 87 -#define SM_STARTER 88 -#define SM_SERVERR2 89 -#define SM_CMETRICS 90 -#define SM_REMOTESESSION 0x1000 -#define SM_SHUTTINGDOWN 0x2000 -#define SM_REMOTECONTROL 0x2001 -#define SM_CARETBLINKINGENABLED 0x2002 - - WINUSERAPI int WINAPI GetSystemMetrics(int nIndex); -#endif - -#ifndef NOMENUS - -#ifdef UNICODE -#define LoadMenu LoadMenuW -#define LoadMenuIndirect LoadMenuIndirectW -#define ChangeMenu ChangeMenuW -#define GetMenuString GetMenuStringW -#define InsertMenu InsertMenuW -#define AppendMenu AppendMenuW -#define ModifyMenu ModifyMenuW -#else -#define LoadMenu LoadMenuA -#define LoadMenuIndirect LoadMenuIndirectA -#define ChangeMenu ChangeMenuA -#define GetMenuString GetMenuStringA -#define InsertMenu InsertMenuA -#define AppendMenu AppendMenuA -#define ModifyMenu ModifyMenuA -#endif - - WINUSERAPI HMENU WINAPI LoadMenuA(HINSTANCE hInstance,LPCSTR lpMenuName); - WINUSERAPI HMENU WINAPI LoadMenuW(HINSTANCE hInstance,LPCWSTR lpMenuName); - WINUSERAPI HMENU WINAPI LoadMenuIndirectA(CONST MENUTEMPLATEA *lpMenuTemplate); - WINUSERAPI HMENU WINAPI LoadMenuIndirectW(CONST MENUTEMPLATEW *lpMenuTemplate); - WINUSERAPI HMENU WINAPI GetMenu(HWND hWnd); - WINUSERAPI WINBOOL WINAPI SetMenu(HWND hWnd,HMENU hMenu); - WINUSERAPI WINBOOL WINAPI ChangeMenuA(HMENU hMenu,UINT cmd,LPCSTR lpszNewItem,UINT cmdInsert,UINT flags); - WINUSERAPI WINBOOL WINAPI ChangeMenuW(HMENU hMenu,UINT cmd,LPCWSTR lpszNewItem,UINT cmdInsert,UINT flags); - WINUSERAPI WINBOOL WINAPI HiliteMenuItem(HWND hWnd,HMENU hMenu,UINT uIDHiliteItem,UINT uHilite); - WINUSERAPI int WINAPI GetMenuStringA(HMENU hMenu,UINT uIDItem,LPSTR lpString,int cchMax,UINT flags); - WINUSERAPI int WINAPI GetMenuStringW(HMENU hMenu,UINT uIDItem,LPWSTR lpString,int cchMax,UINT flags); - WINUSERAPI UINT WINAPI GetMenuState(HMENU hMenu,UINT uId,UINT uFlags); - WINUSERAPI WINBOOL WINAPI DrawMenuBar(HWND hWnd); - -#define PMB_ACTIVE 0x00000001 - - WINUSERAPI HMENU WINAPI GetSystemMenu(HWND hWnd,WINBOOL bRevert); - WINUSERAPI HMENU WINAPI CreateMenu(VOID); - WINUSERAPI HMENU WINAPI CreatePopupMenu(VOID); - WINUSERAPI WINBOOL WINAPI DestroyMenu(HMENU hMenu); - WINUSERAPI DWORD WINAPI CheckMenuItem(HMENU hMenu,UINT uIDCheckItem,UINT uCheck); - WINUSERAPI WINBOOL WINAPI EnableMenuItem(HMENU hMenu,UINT uIDEnableItem,UINT uEnable); - WINUSERAPI HMENU WINAPI GetSubMenu(HMENU hMenu,int nPos); - WINUSERAPI UINT WINAPI GetMenuItemID(HMENU hMenu,int nPos); - WINUSERAPI int WINAPI GetMenuItemCount(HMENU hMenu); - WINUSERAPI WINBOOL WINAPI InsertMenuA(HMENU hMenu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); - WINUSERAPI WINBOOL WINAPI InsertMenuW(HMENU hMenu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); - WINUSERAPI WINBOOL WINAPI AppendMenuA(HMENU hMenu,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); - WINUSERAPI WINBOOL WINAPI AppendMenuW(HMENU hMenu,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); - WINUSERAPI WINBOOL WINAPI ModifyMenuA(HMENU hMnu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCSTR lpNewItem); - WINUSERAPI WINBOOL WINAPI ModifyMenuW(HMENU hMnu,UINT uPosition,UINT uFlags,UINT_PTR uIDNewItem,LPCWSTR lpNewItem); - WINUSERAPI WINBOOL WINAPI RemoveMenu(HMENU hMenu,UINT uPosition,UINT uFlags); - WINUSERAPI WINBOOL WINAPI DeleteMenu(HMENU hMenu,UINT uPosition,UINT uFlags); - WINUSERAPI WINBOOL WINAPI SetMenuItemBitmaps(HMENU hMenu,UINT uPosition,UINT uFlags,HBITMAP hBitmapUnchecked,HBITMAP hBitmapChecked); - WINUSERAPI LONG WINAPI GetMenuCheckMarkDimensions(VOID); - WINUSERAPI WINBOOL WINAPI TrackPopupMenu(HMENU hMenu,UINT uFlags,int x,int y,int nReserved,HWND hWnd,CONST RECT *prcRect); - -#define MNC_IGNORE 0 -#define MNC_CLOSE 1 -#define MNC_EXECUTE 2 -#define MNC_SELECT 3 - - typedef struct tagTPMPARAMS { - UINT cbSize; - RECT rcExclude; - } TPMPARAMS; - - typedef TPMPARAMS *LPTPMPARAMS; - - WINUSERAPI WINBOOL WINAPI TrackPopupMenuEx(HMENU,UINT,int,int,HWND,LPTPMPARAMS); - -#define MNS_NOCHECK 0x80000000 -#define MNS_MODELESS 0x40000000 -#define MNS_DRAGDROP 0x20000000 -#define MNS_AUTODISMISS 0x10000000 -#define MNS_NOTIFYBYPOS 0x08000000 -#define MNS_CHECKORBMP 0x04000000 - -#define MIM_MAXHEIGHT 0x00000001 -#define MIM_BACKGROUND 0x00000002 -#define MIM_HELPID 0x00000004 -#define MIM_MENUDATA 0x00000008 -#define MIM_STYLE 0x00000010 -#define MIM_APPLYTOSUBMENUS 0x80000000 - - typedef struct tagMENUINFO { - DWORD cbSize; - DWORD fMask; - DWORD dwStyle; - UINT cyMax; - HBRUSH hbrBack; - DWORD dwContextHelpID; - ULONG_PTR dwMenuData; - } MENUINFO,*LPMENUINFO; - - typedef MENUINFO CONST *LPCMENUINFO; - - WINUSERAPI WINBOOL WINAPI GetMenuInfo(HMENU,LPMENUINFO); - WINUSERAPI WINBOOL WINAPI SetMenuInfo(HMENU,LPCMENUINFO); - WINUSERAPI WINBOOL WINAPI EndMenu(VOID); - -#define MND_CONTINUE 0 -#define MND_ENDMENU 1 - - typedef struct tagMENUGETOBJECTINFO { - DWORD dwFlags; - UINT uPos; - HMENU hmenu; - PVOID riid; - PVOID pvObj; - } MENUGETOBJECTINFO,*PMENUGETOBJECTINFO; - -#define MNGOF_TOPGAP 0x00000001 -#define MNGOF_BOTTOMGAP 0x00000002 - -#define MNGO_NOINTERFACE 0x00000000 -#define MNGO_NOERROR 0x00000001 - -#define MIIM_STATE 0x00000001 -#define MIIM_ID 0x00000002 -#define MIIM_SUBMENU 0x00000004 -#define MIIM_CHECKMARKS 0x00000008 -#define MIIM_TYPE 0x00000010 -#define MIIM_DATA 0x00000020 - -#define MIIM_STRING 0x00000040 -#define MIIM_BITMAP 0x00000080 -#define MIIM_FTYPE 0x00000100 - -#define HBMMENU_CALLBACK ((HBITMAP) -1) -#define HBMMENU_SYSTEM ((HBITMAP) 1) -#define HBMMENU_MBAR_RESTORE ((HBITMAP) 2) -#define HBMMENU_MBAR_MINIMIZE ((HBITMAP) 3) -#define HBMMENU_MBAR_CLOSE ((HBITMAP) 5) -#define HBMMENU_MBAR_CLOSE_D ((HBITMAP) 6) -#define HBMMENU_MBAR_MINIMIZE_D ((HBITMAP) 7) -#define HBMMENU_POPUP_CLOSE ((HBITMAP) 8) -#define HBMMENU_POPUP_RESTORE ((HBITMAP) 9) -#define HBMMENU_POPUP_MAXIMIZE ((HBITMAP) 10) -#define HBMMENU_POPUP_MINIMIZE ((HBITMAP) 11) - - typedef struct tagMENUITEMINFOA { - UINT cbSize; - UINT fMask; - UINT fType; - UINT fState; - UINT wID; - HMENU hSubMenu; - HBITMAP hbmpChecked; - HBITMAP hbmpUnchecked; - ULONG_PTR dwItemData; - LPSTR dwTypeData; - UINT cch; - HBITMAP hbmpItem; - } MENUITEMINFOA,*LPMENUITEMINFOA; - - typedef struct tagMENUITEMINFOW { - UINT cbSize; - UINT fMask; - UINT fType; - UINT fState; - UINT wID; - HMENU hSubMenu; - HBITMAP hbmpChecked; - HBITMAP hbmpUnchecked; - ULONG_PTR dwItemData; - LPWSTR dwTypeData; - UINT cch; - HBITMAP hbmpItem; - } MENUITEMINFOW,*LPMENUITEMINFOW; - -#ifdef UNICODE - typedef MENUITEMINFOW MENUITEMINFO; - typedef LPMENUITEMINFOW LPMENUITEMINFO; -#else - typedef MENUITEMINFOA MENUITEMINFO; - typedef LPMENUITEMINFOA LPMENUITEMINFO; -#endif - typedef MENUITEMINFOA CONST *LPCMENUITEMINFOA; - typedef MENUITEMINFOW CONST *LPCMENUITEMINFOW; -#ifdef UNICODE - typedef LPCMENUITEMINFOW LPCMENUITEMINFO; -#else - typedef LPCMENUITEMINFOA LPCMENUITEMINFO; -#endif - -#ifdef UNICODE -#define InsertMenuItem InsertMenuItemW -#define GetMenuItemInfo GetMenuItemInfoW -#define SetMenuItemInfo SetMenuItemInfoW -#else -#define InsertMenuItem InsertMenuItemA -#define GetMenuItemInfo GetMenuItemInfoA -#define SetMenuItemInfo SetMenuItemInfoA -#endif - - WINUSERAPI WINBOOL WINAPI InsertMenuItemA(HMENU hmenu,UINT item,WINBOOL fByPosition,LPCMENUITEMINFOA lpmi); - WINUSERAPI WINBOOL WINAPI InsertMenuItemW(HMENU hmenu,UINT item,WINBOOL fByPosition,LPCMENUITEMINFOW lpmi); - WINUSERAPI WINBOOL WINAPI GetMenuItemInfoA(HMENU hmenu,UINT item,WINBOOL fByPosition,LPMENUITEMINFOA lpmii); - WINUSERAPI WINBOOL WINAPI GetMenuItemInfoW(HMENU hmenu,UINT item,WINBOOL fByPosition,LPMENUITEMINFOW lpmii); - WINUSERAPI WINBOOL WINAPI SetMenuItemInfoA(HMENU hmenu,UINT item,WINBOOL fByPositon,LPCMENUITEMINFOA lpmii); - WINUSERAPI WINBOOL WINAPI SetMenuItemInfoW(HMENU hmenu,UINT item,WINBOOL fByPositon,LPCMENUITEMINFOW lpmii); - -#define GMDI_USEDISABLED 0x0001L -#define GMDI_GOINTOPOPUPS 0x0002L - - WINUSERAPI UINT WINAPI GetMenuDefaultItem(HMENU hMenu,UINT fByPos,UINT gmdiFlags); - WINUSERAPI WINBOOL WINAPI SetMenuDefaultItem(HMENU hMenu,UINT uItem,UINT fByPos); - WINUSERAPI WINBOOL WINAPI GetMenuItemRect(HWND hWnd,HMENU hMenu,UINT uItem,LPRECT lprcItem); - WINUSERAPI int WINAPI MenuItemFromPoint(HWND hWnd,HMENU hMenu,POINT ptScreen); - -#define TPM_LEFTBUTTON 0x0000L -#define TPM_RIGHTBUTTON 0x0002L -#define TPM_LEFTALIGN 0x0000L -#define TPM_CENTERALIGN 0x0004L -#define TPM_RIGHTALIGN 0x0008L -#define TPM_TOPALIGN 0x0000L -#define TPM_VCENTERALIGN 0x0010L -#define TPM_BOTTOMALIGN 0x0020L - -#define TPM_HORIZONTAL 0x0000L -#define TPM_VERTICAL 0x0040L -#define TPM_NONOTIFY 0x0080L -#define TPM_RETURNCMD 0x0100L -#define TPM_RECURSE 0x0001L -#define TPM_HORPOSANIMATION 0x0400L -#define TPM_HORNEGANIMATION 0x0800L -#define TPM_VERPOSANIMATION 0x1000L -#define TPM_VERNEGANIMATION 0x2000L -#define TPM_NOANIMATION 0x4000L -#define TPM_LAYOUTRTL 0x8000L -#endif - - typedef struct tagDROPSTRUCT { - HWND hwndSource; - HWND hwndSink; - DWORD wFmt; - ULONG_PTR dwData; - POINT ptDrop; - DWORD dwControlData; - } DROPSTRUCT,*PDROPSTRUCT,*LPDROPSTRUCT; - -#define DOF_EXECUTABLE 0x8001 -#define DOF_DOCUMENT 0x8002 -#define DOF_DIRECTORY 0x8003 -#define DOF_MULTIPLE 0x8004 -#define DOF_PROGMAN 0x0001 -#define DOF_SHELLDATA 0x0002 - -#define DO_DROPFILE 0x454C4946L -#define DO_PRINTFILE 0x544E5250L - - WINUSERAPI DWORD WINAPI DragObject(HWND hwndParent,HWND hwndFrom,UINT fmt,ULONG_PTR data,HCURSOR hcur); - WINUSERAPI WINBOOL WINAPI DragDetect(HWND hwnd,POINT pt); - WINUSERAPI WINBOOL WINAPI DrawIcon(HDC hDC,int X,int Y,HICON hIcon); - -#ifndef NODRAWTEXT - -#define DT_TOP 0x00000000 -#define DT_LEFT 0x00000000 -#define DT_CENTER 0x00000001 -#define DT_RIGHT 0x00000002 -#define DT_VCENTER 0x00000004 -#define DT_BOTTOM 0x00000008 -#define DT_WORDBREAK 0x00000010 -#define DT_SINGLELINE 0x00000020 -#define DT_EXPANDTABS 0x00000040 -#define DT_TABSTOP 0x00000080 -#define DT_NOCLIP 0x00000100 -#define DT_EXTERNALLEADING 0x00000200 -#define DT_CALCRECT 0x00000400 -#define DT_NOPREFIX 0x00000800 -#define DT_INTERNAL 0x00001000 - -#define DT_EDITCONTROL 0x00002000 -#define DT_PATH_ELLIPSIS 0x00004000 -#define DT_END_ELLIPSIS 0x00008000 -#define DT_MODIFYSTRING 0x00010000 -#define DT_RTLREADING 0x00020000 -#define DT_WORD_ELLIPSIS 0x00040000 -#define DT_NOFULLWIDTHCHARBREAK 0x00080000 -#define DT_HIDEPREFIX 0x00100000 -#define DT_PREFIXONLY 0x00200000 - - typedef struct tagDRAWTEXTPARAMS { - UINT cbSize; - int iTabLength; - int iLeftMargin; - int iRightMargin; - UINT uiLengthDrawn; - } DRAWTEXTPARAMS,*LPDRAWTEXTPARAMS; - -#ifdef UNICODE -#define DrawText DrawTextW -#define DrawTextEx DrawTextExW -#else -#define DrawText DrawTextA -#define DrawTextEx DrawTextExA -#endif - - WINUSERAPI int WINAPI DrawTextA(HDC hdc,LPCSTR lpchText,int cchText,LPRECT lprc,UINT format); - WINUSERAPI int WINAPI DrawTextW(HDC hdc,LPCWSTR lpchText,int cchText,LPRECT lprc,UINT format); - WINUSERAPI int WINAPI DrawTextExA(HDC hdc,LPSTR lpchText,int cchText,LPRECT lprc,UINT format,LPDRAWTEXTPARAMS lpdtp); - WINUSERAPI int WINAPI DrawTextExW(HDC hdc,LPWSTR lpchText,int cchText,LPRECT lprc,UINT format,LPDRAWTEXTPARAMS lpdtp); -#endif - -#ifdef UNICODE -#define GrayString GrayStringW -#define DrawState DrawStateW -#define TabbedTextOut TabbedTextOutW -#define GetTabbedTextExtent GetTabbedTextExtentW -#else -#define GrayString GrayStringA -#define DrawState DrawStateA -#define TabbedTextOut TabbedTextOutA -#define GetTabbedTextExtent GetTabbedTextExtentA -#endif - - WINUSERAPI WINBOOL WINAPI GrayStringA(HDC hDC,HBRUSH hBrush,GRAYSTRINGPROC lpOutputFunc,LPARAM lpData,int nCount,int X,int Y,int nWidth,int nHeight); - WINUSERAPI WINBOOL WINAPI GrayStringW(HDC hDC,HBRUSH hBrush,GRAYSTRINGPROC lpOutputFunc,LPARAM lpData,int nCount,int X,int Y,int nWidth,int nHeight); - -#define DST_COMPLEX 0x0000 -#define DST_TEXT 0x0001 -#define DST_PREFIXTEXT 0x0002 -#define DST_ICON 0x0003 -#define DST_BITMAP 0x0004 - -#define DSS_NORMAL 0x0000 -#define DSS_UNION 0x0010 -#define DSS_DISABLED 0x0020 -#define DSS_MONO 0x0080 -#define DSS_HIDEPREFIX 0x0200 -#define DSS_PREFIXONLY 0x0400 -#define DSS_RIGHT 0x8000 - - WINUSERAPI WINBOOL WINAPI DrawStateA(HDC hdc,HBRUSH hbrFore,DRAWSTATEPROC qfnCallBack,LPARAM lData,WPARAM wData,int x,int y,int cx,int cy,UINT uFlags); - WINUSERAPI WINBOOL WINAPI DrawStateW(HDC hdc,HBRUSH hbrFore,DRAWSTATEPROC qfnCallBack,LPARAM lData,WPARAM wData,int x,int y,int cx,int cy,UINT uFlags); - WINUSERAPI LONG WINAPI TabbedTextOutA(HDC hdc,int x,int y,LPCSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions,int nTabOrigin); - WINUSERAPI LONG WINAPI TabbedTextOutW(HDC hdc,int x,int y,LPCWSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions,int nTabOrigin); - WINUSERAPI DWORD WINAPI GetTabbedTextExtentA(HDC hdc,LPCSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions); - WINUSERAPI DWORD WINAPI GetTabbedTextExtentW(HDC hdc,LPCWSTR lpString,int chCount,int nTabPositions,CONST INT *lpnTabStopPositions); - WINUSERAPI WINBOOL WINAPI UpdateWindow(HWND hWnd); - WINUSERAPI HWND WINAPI SetActiveWindow(HWND hWnd); - WINUSERAPI HWND WINAPI GetForegroundWindow(VOID); - WINUSERAPI WINBOOL WINAPI PaintDesktop(HDC hdc); - WINUSERAPI VOID WINAPI SwitchToThisWindow(HWND hwnd,WINBOOL fUnknown); - WINUSERAPI WINBOOL WINAPI SetForegroundWindow(HWND hWnd); - WINUSERAPI WINBOOL WINAPI AllowSetForegroundWindow(DWORD dwProcessId); - -#define ASFW_ANY ((DWORD)-1) - - WINUSERAPI WINBOOL WINAPI LockSetForegroundWindow(UINT uLockCode); - -#define LSFW_LOCK 1 -#define LSFW_UNLOCK 2 - - WINUSERAPI HWND WINAPI WindowFromDC(HDC hDC); - WINUSERAPI HDC WINAPI GetDC(HWND hWnd); - WINUSERAPI HDC WINAPI GetDCEx(HWND hWnd,HRGN hrgnClip,DWORD flags); - -#define DCX_WINDOW 0x00000001L -#define DCX_CACHE 0x00000002L -#define DCX_NORESETATTRS 0x00000004L -#define DCX_CLIPCHILDREN 0x00000008L -#define DCX_CLIPSIBLINGS 0x00000010L -#define DCX_PARENTCLIP 0x00000020L -#define DCX_EXCLUDERGN 0x00000040L -#define DCX_INTERSECTRGN 0x00000080L -#define DCX_EXCLUDEUPDATE 0x00000100L -#define DCX_INTERSECTUPDATE 0x00000200L -#define DCX_LOCKWINDOWUPDATE 0x00000400L - -#define DCX_VALIDATE 0x00200000L - - WINUSERAPI HDC WINAPI GetWindowDC(HWND hWnd); - WINUSERAPI int WINAPI ReleaseDC(HWND hWnd,HDC hDC); - WINUSERAPI HDC WINAPI BeginPaint(HWND hWnd,LPPAINTSTRUCT lpPaint); - WINUSERAPI WINBOOL WINAPI EndPaint(HWND hWnd,CONST PAINTSTRUCT *lpPaint); - WINUSERAPI WINBOOL WINAPI GetUpdateRect(HWND hWnd,LPRECT lpRect,WINBOOL bErase); - WINUSERAPI int WINAPI GetUpdateRgn(HWND hWnd,HRGN hRgn,WINBOOL bErase); - WINUSERAPI int WINAPI SetWindowRgn(HWND hWnd,HRGN hRgn,WINBOOL bRedraw); - WINUSERAPI int WINAPI GetWindowRgn(HWND hWnd,HRGN hRgn); - WINUSERAPI int WINAPI GetWindowRgnBox(HWND hWnd,LPRECT lprc); - WINUSERAPI int WINAPI ExcludeUpdateRgn(HDC hDC,HWND hWnd); - WINUSERAPI WINBOOL WINAPI InvalidateRect(HWND hWnd,CONST RECT *lpRect,WINBOOL bErase); - WINUSERAPI WINBOOL WINAPI ValidateRect(HWND hWnd,CONST RECT *lpRect); - WINUSERAPI WINBOOL WINAPI InvalidateRgn(HWND hWnd,HRGN hRgn,WINBOOL bErase); - WINUSERAPI WINBOOL WINAPI ValidateRgn(HWND hWnd,HRGN hRgn); - WINUSERAPI WINBOOL WINAPI RedrawWindow(HWND hWnd,CONST RECT *lprcUpdate,HRGN hrgnUpdate,UINT flags); - -#define RDW_INVALIDATE 0x0001 -#define RDW_INTERNALPAINT 0x0002 -#define RDW_ERASE 0x0004 - -#define RDW_VALIDATE 0x0008 -#define RDW_NOINTERNALPAINT 0x0010 -#define RDW_NOERASE 0x0020 - -#define RDW_NOCHILDREN 0x0040 -#define RDW_ALLCHILDREN 0x0080 - -#define RDW_UPDATENOW 0x0100 -#define RDW_ERASENOW 0x0200 - -#define RDW_FRAME 0x0400 -#define RDW_NOFRAME 0x0800 - - WINUSERAPI WINBOOL WINAPI LockWindowUpdate(HWND hWndLock); - WINUSERAPI WINBOOL WINAPI ScrollWindow(HWND hWnd,int XAmount,int YAmount,CONST RECT *lpRect,CONST RECT *lpClipRect); - WINUSERAPI WINBOOL WINAPI ScrollDC(HDC hDC,int dx,int dy,CONST RECT *lprcScroll,CONST RECT *lprcClip,HRGN hrgnUpdate,LPRECT lprcUpdate); - WINUSERAPI int WINAPI ScrollWindowEx(HWND hWnd,int dx,int dy,CONST RECT *prcScroll,CONST RECT *prcClip,HRGN hrgnUpdate,LPRECT prcUpdate,UINT flags); - -#define SW_SCROLLCHILDREN 0x0001 -#define SW_INVALIDATE 0x0002 -#define SW_ERASE 0x0004 -#define SW_SMOOTHSCROLL 0x0010 - -#ifndef NOSCROLL - WINUSERAPI int WINAPI SetScrollPos(HWND hWnd,int nBar,int nPos,WINBOOL bRedraw); - WINUSERAPI int WINAPI GetScrollPos(HWND hWnd,int nBar); - WINUSERAPI WINBOOL WINAPI SetScrollRange(HWND hWnd,int nBar,int nMinPos,int nMaxPos,WINBOOL bRedraw); - WINUSERAPI WINBOOL WINAPI GetScrollRange(HWND hWnd,int nBar,LPINT lpMinPos,LPINT lpMaxPos); - WINUSERAPI WINBOOL WINAPI ShowScrollBar(HWND hWnd,int wBar,WINBOOL bShow); - WINUSERAPI WINBOOL WINAPI EnableScrollBar(HWND hWnd,UINT wSBflags,UINT wArrows); - -#define ESB_ENABLE_BOTH 0x0000 -#define ESB_DISABLE_BOTH 0x0003 - -#define ESB_DISABLE_LEFT 0x0001 -#define ESB_DISABLE_RIGHT 0x0002 - -#define ESB_DISABLE_UP 0x0001 -#define ESB_DISABLE_DOWN 0x0002 - -#define ESB_DISABLE_LTUP ESB_DISABLE_LEFT -#define ESB_DISABLE_RTDN ESB_DISABLE_RIGHT -#endif - -#ifdef UNICODE -#define SetProp SetPropW -#define GetProp GetPropW -#define RemoveProp RemovePropW -#define EnumPropsEx EnumPropsExW -#define EnumProps EnumPropsW -#define SetWindowText SetWindowTextW -#define GetWindowText GetWindowTextW -#define GetWindowTextLength GetWindowTextLengthW -#else -#define SetProp SetPropA -#define GetProp GetPropA -#define RemoveProp RemovePropA -#define EnumPropsEx EnumPropsExA -#define EnumProps EnumPropsA -#define SetWindowText SetWindowTextA -#define GetWindowText GetWindowTextA -#define GetWindowTextLength GetWindowTextLengthA -#endif - - WINUSERAPI WINBOOL WINAPI SetPropA(HWND hWnd,LPCSTR lpString,HANDLE hData); - WINUSERAPI WINBOOL WINAPI SetPropW(HWND hWnd,LPCWSTR lpString,HANDLE hData); - WINUSERAPI HANDLE WINAPI GetPropA(HWND hWnd,LPCSTR lpString); - WINUSERAPI HANDLE WINAPI GetPropW(HWND hWnd,LPCWSTR lpString); - WINUSERAPI HANDLE WINAPI RemovePropA(HWND hWnd,LPCSTR lpString); - WINUSERAPI HANDLE WINAPI RemovePropW(HWND hWnd,LPCWSTR lpString); - WINUSERAPI int WINAPI EnumPropsExA(HWND hWnd,PROPENUMPROCEXA lpEnumFunc,LPARAM lParam); - WINUSERAPI int WINAPI EnumPropsExW(HWND hWnd,PROPENUMPROCEXW lpEnumFunc,LPARAM lParam); - WINUSERAPI int WINAPI EnumPropsA(HWND hWnd,PROPENUMPROCA lpEnumFunc); - WINUSERAPI int WINAPI EnumPropsW(HWND hWnd,PROPENUMPROCW lpEnumFunc); - WINUSERAPI WINBOOL WINAPI SetWindowTextA(HWND hWnd,LPCSTR lpString); - WINUSERAPI WINBOOL WINAPI SetWindowTextW(HWND hWnd,LPCWSTR lpString); - WINUSERAPI int WINAPI GetWindowTextA(HWND hWnd,LPSTR lpString,int nMaxCount); - WINUSERAPI int WINAPI GetWindowTextW(HWND hWnd,LPWSTR lpString,int nMaxCount); - WINUSERAPI int WINAPI GetWindowTextLengthA(HWND hWnd); - WINUSERAPI int WINAPI GetWindowTextLengthW(HWND hWnd); - WINUSERAPI WINBOOL WINAPI GetClientRect(HWND hWnd,LPRECT lpRect); - WINUSERAPI WINBOOL WINAPI GetWindowRect(HWND hWnd,LPRECT lpRect); - WINUSERAPI WINBOOL WINAPI AdjustWindowRect(LPRECT lpRect,DWORD dwStyle,WINBOOL bMenu); - WINUSERAPI WINBOOL WINAPI AdjustWindowRectEx(LPRECT lpRect,DWORD dwStyle,WINBOOL bMenu,DWORD dwExStyle); - -#define HELPINFO_WINDOW 0x0001 -#define HELPINFO_MENUITEM 0x0002 - - typedef struct tagHELPINFO { - UINT cbSize; - int iContextType; - int iCtrlId; - HANDLE hItemHandle; - DWORD_PTR dwContextId; - POINT MousePos; - } HELPINFO,*LPHELPINFO; - - WINUSERAPI WINBOOL WINAPI SetWindowContextHelpId(HWND,DWORD); - WINUSERAPI DWORD WINAPI GetWindowContextHelpId(HWND); - WINUSERAPI WINBOOL WINAPI SetMenuContextHelpId(HMENU,DWORD); - WINUSERAPI DWORD WINAPI GetMenuContextHelpId(HMENU); - -#ifndef NOMB - -#define MB_OK 0x00000000L -#define MB_OKCANCEL 0x00000001L -#define MB_ABORTRETRYIGNORE 0x00000002L -#define MB_YESNOCANCEL 0x00000003L -#define MB_YESNO 0x00000004L -#define MB_RETRYCANCEL 0x00000005L -#define MB_CANCELTRYCONTINUE 0x00000006L -#define MB_ICONHAND 0x00000010L -#define MB_ICONQUESTION 0x00000020L -#define MB_ICONEXCLAMATION 0x00000030L -#define MB_ICONASTERISK 0x00000040L -#define MB_USERICON 0x00000080L -#define MB_ICONWARNING MB_ICONEXCLAMATION -#define MB_ICONERROR MB_ICONHAND -#define MB_ICONINFORMATION MB_ICONASTERISK -#define MB_ICONSTOP MB_ICONHAND -#define MB_DEFBUTTON1 0x00000000L -#define MB_DEFBUTTON2 0x00000100L -#define MB_DEFBUTTON3 0x00000200L -#define MB_DEFBUTTON4 0x00000300L -#define MB_APPLMODAL 0x00000000L -#define MB_SYSTEMMODAL 0x00001000L -#define MB_TASKMODAL 0x00002000L -#define MB_HELP 0x00004000L -#define MB_NOFOCUS 0x00008000L -#define MB_SETFOREGROUND 0x00010000L -#define MB_DEFAULT_DESKTOP_ONLY 0x00020000L -#define MB_TOPMOST 0x00040000L -#define MB_RIGHT 0x00080000L -#define MB_RTLREADING 0x00100000L -#define MB_SERVICE_NOTIFICATION 0x00200000L -#define MB_SERVICE_NOTIFICATION_NT3X 0x00040000L -#define MB_TYPEMASK 0x0000000FL -#define MB_ICONMASK 0x000000F0L -#define MB_DEFMASK 0x00000F00L -#define MB_MODEMASK 0x00003000L -#define MB_MISCMASK 0x0000C000L - -#ifdef UNICODE -#define MessageBox MessageBoxW -#define MessageBoxEx MessageBoxExW -#else -#define MessageBox MessageBoxA -#define MessageBoxEx MessageBoxExA -#endif - - WINUSERAPI int WINAPI MessageBoxA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType); - WINUSERAPI int WINAPI MessageBoxW(HWND hWnd,LPCWSTR lpText,LPCWSTR lpCaption,UINT uType); - WINUSERAPI int WINAPI MessageBoxExA(HWND hWnd,LPCSTR lpText,LPCSTR lpCaption,UINT uType,WORD wLanguageId); - WINUSERAPI int WINAPI MessageBoxExW(HWND hWnd,LPCWSTR lpText,LPCWSTR lpCaption,UINT uType,WORD wLanguageId); - - typedef VOID (CALLBACK *MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo); - - typedef struct tagMSGBOXPARAMSA { - UINT cbSize; - HWND hwndOwner; - HINSTANCE hInstance; - LPCSTR lpszText; - LPCSTR lpszCaption; - DWORD dwStyle; - LPCSTR lpszIcon; - DWORD_PTR dwContextHelpId; - MSGBOXCALLBACK lpfnMsgBoxCallback; - DWORD dwLanguageId; - } MSGBOXPARAMSA,*PMSGBOXPARAMSA,*LPMSGBOXPARAMSA; - - typedef struct tagMSGBOXPARAMSW { - UINT cbSize; - HWND hwndOwner; - HINSTANCE hInstance; - LPCWSTR lpszText; - LPCWSTR lpszCaption; - DWORD dwStyle; - LPCWSTR lpszIcon; - DWORD_PTR dwContextHelpId; - MSGBOXCALLBACK lpfnMsgBoxCallback; - DWORD dwLanguageId; - } MSGBOXPARAMSW,*PMSGBOXPARAMSW,*LPMSGBOXPARAMSW; - -#ifdef UNICODE - typedef MSGBOXPARAMSW MSGBOXPARAMS; - typedef PMSGBOXPARAMSW PMSGBOXPARAMS; - typedef LPMSGBOXPARAMSW LPMSGBOXPARAMS; -#else - typedef MSGBOXPARAMSA MSGBOXPARAMS; - typedef PMSGBOXPARAMSA PMSGBOXPARAMS; - typedef LPMSGBOXPARAMSA LPMSGBOXPARAMS; -#endif - -#ifdef UNICODE -#define MessageBoxIndirect MessageBoxIndirectW -#else -#define MessageBoxIndirect MessageBoxIndirectA -#endif - - WINUSERAPI int WINAPI MessageBoxIndirectA(CONST MSGBOXPARAMSA *lpmbp); - WINUSERAPI int WINAPI MessageBoxIndirectW(CONST MSGBOXPARAMSW *lpmbp); - WINUSERAPI WINBOOL WINAPI MessageBeep(UINT uType); -#endif - - WINUSERAPI int WINAPI ShowCursor(WINBOOL bShow); - WINUSERAPI WINBOOL WINAPI SetCursorPos(int X,int Y); - WINUSERAPI HCURSOR WINAPI SetCursor(HCURSOR hCursor); - WINUSERAPI WINBOOL WINAPI GetCursorPos(LPPOINT lpPoint); - WINUSERAPI WINBOOL WINAPI ClipCursor(CONST RECT *lpRect); - WINUSERAPI WINBOOL WINAPI GetClipCursor(LPRECT lpRect); - WINUSERAPI HCURSOR WINAPI GetCursor(VOID); - WINUSERAPI WINBOOL WINAPI CreateCaret(HWND hWnd,HBITMAP hBitmap,int nWidth,int nHeight); - WINUSERAPI UINT WINAPI GetCaretBlinkTime(VOID); - WINUSERAPI WINBOOL WINAPI SetCaretBlinkTime(UINT uMSeconds); - WINUSERAPI WINBOOL WINAPI DestroyCaret(VOID); - WINUSERAPI WINBOOL WINAPI HideCaret(HWND hWnd); - WINUSERAPI WINBOOL WINAPI ShowCaret(HWND hWnd); - WINUSERAPI WINBOOL WINAPI SetCaretPos(int X,int Y); - WINUSERAPI WINBOOL WINAPI GetCaretPos(LPPOINT lpPoint); - WINUSERAPI WINBOOL WINAPI ClientToScreen(HWND hWnd,LPPOINT lpPoint); - WINUSERAPI WINBOOL WINAPI ScreenToClient(HWND hWnd,LPPOINT lpPoint); - WINUSERAPI int WINAPI MapWindowPoints(HWND hWndFrom,HWND hWndTo,LPPOINT lpPoints,UINT cPoints); - WINUSERAPI HWND WINAPI WindowFromPoint(POINT Point); - WINUSERAPI HWND WINAPI ChildWindowFromPoint(HWND hWndParent,POINT Point); - -#define CWP_ALL 0x0000 -#define CWP_SKIPINVISIBLE 0x0001 -#define CWP_SKIPDISABLED 0x0002 -#define CWP_SKIPTRANSPARENT 0x0004 - - WINUSERAPI HWND WINAPI ChildWindowFromPointEx(HWND hwnd,POINT pt,UINT flags); - -#ifndef NOCOLOR - -#define CTLCOLOR_MSGBOX 0 -#define CTLCOLOR_EDIT 1 -#define CTLCOLOR_LISTBOX 2 -#define CTLCOLOR_BTN 3 -#define CTLCOLOR_DLG 4 -#define CTLCOLOR_SCROLLBAR 5 -#define CTLCOLOR_STATIC 6 -#define CTLCOLOR_MAX 7 - -#define COLOR_SCROLLBAR 0 -#define COLOR_BACKGROUND 1 -#define COLOR_ACTIVECAPTION 2 -#define COLOR_INACTIVECAPTION 3 -#define COLOR_MENU 4 -#define COLOR_WINDOW 5 -#define COLOR_WINDOWFRAME 6 -#define COLOR_MENUTEXT 7 -#define COLOR_WINDOWTEXT 8 -#define COLOR_CAPTIONTEXT 9 -#define COLOR_ACTIVEBORDER 10 -#define COLOR_INACTIVEBORDER 11 -#define COLOR_APPWORKSPACE 12 -#define COLOR_HIGHLIGHT 13 -#define COLOR_HIGHLIGHTTEXT 14 -#define COLOR_BTNFACE 15 -#define COLOR_BTNSHADOW 16 -#define COLOR_GRAYTEXT 17 -#define COLOR_BTNTEXT 18 -#define COLOR_INACTIVECAPTIONTEXT 19 -#define COLOR_BTNHIGHLIGHT 20 - -#define COLOR_3DDKSHADOW 21 -#define COLOR_3DLIGHT 22 -#define COLOR_INFOTEXT 23 -#define COLOR_INFOBK 24 - -#define COLOR_HOTLIGHT 26 -#define COLOR_GRADIENTACTIVECAPTION 27 -#define COLOR_GRADIENTINACTIVECAPTION 28 -#define COLOR_MENUHILIGHT 29 -#define COLOR_MENUBAR 30 - -#define COLOR_DESKTOP COLOR_BACKGROUND -#define COLOR_3DFACE COLOR_BTNFACE -#define COLOR_3DSHADOW COLOR_BTNSHADOW -#define COLOR_3DHIGHLIGHT COLOR_BTNHIGHLIGHT -#define COLOR_3DHILIGHT COLOR_BTNHIGHLIGHT -#define COLOR_BTNHILIGHT COLOR_BTNHIGHLIGHT - - WINUSERAPI DWORD WINAPI GetSysColor(int nIndex); - WINUSERAPI HBRUSH WINAPI GetSysColorBrush(int nIndex); - WINUSERAPI WINBOOL WINAPI SetSysColors(int cElements,CONST INT *lpaElements,CONST COLORREF *lpaRgbValues); -#endif - - WINUSERAPI WINBOOL WINAPI DrawFocusRect(HDC hDC,CONST RECT *lprc); - WINUSERAPI int WINAPI FillRect(HDC hDC,CONST RECT *lprc,HBRUSH hbr); - WINUSERAPI int WINAPI FrameRect(HDC hDC,CONST RECT *lprc,HBRUSH hbr); - WINUSERAPI WINBOOL WINAPI InvertRect(HDC hDC,CONST RECT *lprc); - WINUSERAPI WINBOOL WINAPI SetRect(LPRECT lprc,int xLeft,int yTop,int xRight,int yBottom); - WINUSERAPI WINBOOL WINAPI SetRectEmpty(LPRECT lprc); - WINUSERAPI WINBOOL WINAPI CopyRect(LPRECT lprcDst,CONST RECT *lprcSrc); - WINUSERAPI WINBOOL WINAPI InflateRect(LPRECT lprc,int dx,int dy); - WINUSERAPI WINBOOL WINAPI IntersectRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); - WINUSERAPI WINBOOL WINAPI UnionRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); - WINUSERAPI WINBOOL WINAPI SubtractRect(LPRECT lprcDst,CONST RECT *lprcSrc1,CONST RECT *lprcSrc2); - WINUSERAPI WINBOOL WINAPI OffsetRect(LPRECT lprc,int dx,int dy); - WINUSERAPI WINBOOL WINAPI IsRectEmpty(CONST RECT *lprc); - WINUSERAPI WINBOOL WINAPI EqualRect(CONST RECT *lprc1,CONST RECT *lprc2); - WINUSERAPI WINBOOL WINAPI PtInRect(CONST RECT *lprc,POINT pt); - -#ifndef NOWINOFFSETS - -#ifdef UNICODE -#define GetWindowLong GetWindowLongW -#define SetWindowLong SetWindowLongW -#else -#define GetWindowLong GetWindowLongA -#define SetWindowLong SetWindowLongA -#endif - - WINUSERAPI WORD WINAPI GetWindowWord(HWND hWnd,int nIndex); - WINUSERAPI WORD WINAPI SetWindowWord(HWND hWnd,int nIndex,WORD wNewWord); - WINUSERAPI LONG WINAPI GetWindowLongA(HWND hWnd,int nIndex); - WINUSERAPI LONG WINAPI GetWindowLongW(HWND hWnd,int nIndex); - WINUSERAPI LONG WINAPI SetWindowLongA(HWND hWnd,int nIndex,LONG dwNewLong); - WINUSERAPI LONG WINAPI SetWindowLongW(HWND hWnd,int nIndex,LONG dwNewLong); - -#ifdef _WIN64 - -#ifdef UNICODE -#define GetWindowLongPtr GetWindowLongPtrW -#define SetWindowLongPtr SetWindowLongPtrW -#else -#define GetWindowLongPtr GetWindowLongPtrA -#define SetWindowLongPtr SetWindowLongPtrA -#endif - - WINUSERAPI LONG_PTR WINAPI GetWindowLongPtrA(HWND hWnd,int nIndex); - WINUSERAPI LONG_PTR WINAPI GetWindowLongPtrW(HWND hWnd,int nIndex); - WINUSERAPI LONG_PTR WINAPI SetWindowLongPtrA(HWND hWnd,int nIndex,LONG_PTR dwNewLong); - WINUSERAPI LONG_PTR WINAPI SetWindowLongPtrW(HWND hWnd,int nIndex,LONG_PTR dwNewLong); -#else - -#ifdef UNICODE -#define GetWindowLongPtr GetWindowLongPtrW -#define SetWindowLongPtr SetWindowLongPtrW -#else -#define GetWindowLongPtr GetWindowLongPtrA -#define SetWindowLongPtr SetWindowLongPtrA -#endif - -#define GetWindowLongPtrA GetWindowLongA -#define GetWindowLongPtrW GetWindowLongW -#define SetWindowLongPtrA SetWindowLongA -#define SetWindowLongPtrW SetWindowLongW -#endif - -#ifdef UNICODE -#define GetClassLong GetClassLongW -#define SetClassLong SetClassLongW -#else -#define GetClassLong GetClassLongA -#define SetClassLong SetClassLongA -#endif - - WINUSERAPI WORD WINAPI GetClassWord(HWND hWnd,int nIndex); - WINUSERAPI WORD WINAPI SetClassWord(HWND hWnd,int nIndex,WORD wNewWord); - WINUSERAPI DWORD WINAPI GetClassLongA(HWND hWnd,int nIndex); - WINUSERAPI DWORD WINAPI GetClassLongW(HWND hWnd,int nIndex); - WINUSERAPI DWORD WINAPI SetClassLongA(HWND hWnd,int nIndex,LONG dwNewLong); - WINUSERAPI DWORD WINAPI SetClassLongW(HWND hWnd,int nIndex,LONG dwNewLong); - -#ifdef _WIN64 - -#ifdef UNICODE -#define GetClassLongPtr GetClassLongPtrW -#define SetClassLongPtr SetClassLongPtrW -#else -#define GetClassLongPtr GetClassLongPtrA -#define SetClassLongPtr SetClassLongPtrA -#endif - - WINUSERAPI ULONG_PTR WINAPI GetClassLongPtrA(HWND hWnd,int nIndex); - WINUSERAPI ULONG_PTR WINAPI GetClassLongPtrW(HWND hWnd,int nIndex); - WINUSERAPI ULONG_PTR WINAPI SetClassLongPtrA(HWND hWnd,int nIndex,LONG_PTR dwNewLong); - WINUSERAPI ULONG_PTR WINAPI SetClassLongPtrW(HWND hWnd,int nIndex,LONG_PTR dwNewLong); -#else -#ifdef UNICODE -#define GetClassLongPtr GetClassLongPtrW -#define SetClassLongPtr SetClassLongPtrW -#else -#define GetClassLongPtr GetClassLongPtrA -#define SetClassLongPtr SetClassLongPtrA -#endif - -#define GetClassLongPtrA GetClassLongA -#define GetClassLongPtrW GetClassLongW -#define SetClassLongPtrA SetClassLongA -#define SetClassLongPtrW SetClassLongW -#endif -#endif - -#ifdef UNICODE -#define FindWindow FindWindowW -#define FindWindowEx FindWindowExW -#define GetClassName GetClassNameW -#else -#define FindWindow FindWindowA -#define FindWindowEx FindWindowExA -#define GetClassName GetClassNameA -#endif - - WINUSERAPI WINBOOL WINAPI GetProcessDefaultLayout(DWORD *pdwDefaultLayout); - WINUSERAPI WINBOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout); - WINUSERAPI HWND WINAPI GetDesktopWindow(VOID); - WINUSERAPI HWND WINAPI GetParent(HWND hWnd); - WINUSERAPI HWND WINAPI SetParent(HWND hWndChild,HWND hWndNewParent); - WINUSERAPI WINBOOL WINAPI EnumChildWindows(HWND hWndParent,WNDENUMPROC lpEnumFunc,LPARAM lParam); - WINUSERAPI HWND WINAPI FindWindowA(LPCSTR lpClassName,LPCSTR lpWindowName); - WINUSERAPI HWND WINAPI FindWindowW(LPCWSTR lpClassName,LPCWSTR lpWindowName); - WINUSERAPI HWND WINAPI FindWindowExA(HWND hWndParent,HWND hWndChildAfter,LPCSTR lpszClass,LPCSTR lpszWindow); - WINUSERAPI HWND WINAPI FindWindowExW(HWND hWndParent,HWND hWndChildAfter,LPCWSTR lpszClass,LPCWSTR lpszWindow); - WINUSERAPI HWND WINAPI GetShellWindow(VOID); - WINUSERAPI WINBOOL WINAPI RegisterShellHookWindow(HWND hwnd); - WINUSERAPI WINBOOL WINAPI DeregisterShellHookWindow(HWND hwnd); - WINUSERAPI WINBOOL WINAPI EnumWindows(WNDENUMPROC lpEnumFunc,LPARAM lParam); - WINUSERAPI WINBOOL WINAPI EnumThreadWindows(DWORD dwThreadId,WNDENUMPROC lpfn,LPARAM lParam); - -#define EnumTaskWindows(hTask,lpfn,lParam) EnumThreadWindows(HandleToUlong(hTask),lpfn,lParam) - - WINUSERAPI int WINAPI GetClassNameA(HWND hWnd,LPSTR lpClassName,int nMaxCount); - WINUSERAPI int WINAPI GetClassNameW(HWND hWnd,LPWSTR lpClassName,int nMaxCount); - WINUSERAPI HWND WINAPI GetTopWindow(HWND hWnd); - -#define GetNextWindow(hWnd,wCmd) GetWindow(hWnd,wCmd) -#define GetSysModalWindow() (NULL) -#define SetSysModalWindow(hWnd) (NULL) - - WINUSERAPI DWORD WINAPI GetWindowThreadProcessId(HWND hWnd,LPDWORD lpdwProcessId); - WINUSERAPI WINBOOL WINAPI IsGUIThread(WINBOOL bConvert); - -#define GetWindowTask(hWnd) ((HANDLE)(DWORD_PTR)GetWindowThreadProcessId(hWnd,NULL)) - - WINUSERAPI HWND WINAPI GetLastActivePopup(HWND hWnd); - -#define GW_HWNDFIRST 0 -#define GW_HWNDLAST 1 -#define GW_HWNDNEXT 2 -#define GW_HWNDPREV 3 -#define GW_OWNER 4 -#define GW_CHILD 5 -#define GW_ENABLEDPOPUP 6 -#define GW_MAX 6 - - WINUSERAPI HWND WINAPI GetWindow(HWND hWnd,UINT uCmd); - -#ifndef NOWH - -#ifdef UNICODE -#define SetWindowsHook SetWindowsHookW -#define SetWindowsHookEx SetWindowsHookExW -#else -#define SetWindowsHook SetWindowsHookA -#define SetWindowsHookEx SetWindowsHookExA -#endif - - WINUSERAPI HHOOK WINAPI SetWindowsHookA(int nFilterType,HOOKPROC pfnFilterProc); - WINUSERAPI HHOOK WINAPI SetWindowsHookW(int nFilterType,HOOKPROC pfnFilterProc); - WINUSERAPI WINBOOL WINAPI UnhookWindowsHook(int nCode,HOOKPROC pfnFilterProc); - WINUSERAPI HHOOK WINAPI SetWindowsHookExA(int idHook,HOOKPROC lpfn,HINSTANCE hmod,DWORD dwThreadId); - WINUSERAPI HHOOK WINAPI SetWindowsHookExW(int idHook,HOOKPROC lpfn,HINSTANCE hmod,DWORD dwThreadId); - WINUSERAPI WINBOOL WINAPI UnhookWindowsHookEx(HHOOK hhk); - WINUSERAPI LRESULT WINAPI CallNextHookEx(HHOOK hhk,int nCode,WPARAM wParam,LPARAM lParam); -#define DefHookProc(nCode,wParam,lParam,phhk) CallNextHookEx(*phhk,nCode,wParam,lParam) -#endif - -#ifndef NOMENUS - -#define MF_INSERT 0x00000000L -#define MF_CHANGE 0x00000080L -#define MF_APPEND 0x00000100L -#define MF_DELETE 0x00000200L -#define MF_REMOVE 0x00001000L -#define MF_BYCOMMAND 0x00000000L -#define MF_BYPOSITION 0x00000400L -#define MF_SEPARATOR 0x00000800L -#define MF_ENABLED 0x00000000L -#define MF_GRAYED 0x00000001L -#define MF_DISABLED 0x00000002L -#define MF_UNCHECKED 0x00000000L -#define MF_CHECKED 0x00000008L -#define MF_USECHECKBITMAPS 0x00000200L -#define MF_STRING 0x00000000L -#define MF_BITMAP 0x00000004L -#define MF_OWNERDRAW 0x00000100L -#define MF_POPUP 0x00000010L -#define MF_MENUBARBREAK 0x00000020L -#define MF_MENUBREAK 0x00000040L -#define MF_UNHILITE 0x00000000L -#define MF_HILITE 0x00000080L -#define MF_DEFAULT 0x00001000L -#define MF_SYSMENU 0x00002000L -#define MF_HELP 0x00004000L -#define MF_RIGHTJUSTIFY 0x00004000L -#define MF_MOUSESELECT 0x00008000L -#define MF_END 0x00000080L - -#define MFT_STRING MF_STRING -#define MFT_BITMAP MF_BITMAP -#define MFT_MENUBARBREAK MF_MENUBARBREAK -#define MFT_MENUBREAK MF_MENUBREAK -#define MFT_OWNERDRAW MF_OWNERDRAW -#define MFT_RADIOCHECK 0x00000200L -#define MFT_SEPARATOR MF_SEPARATOR -#define MFT_RIGHTORDER 0x00002000L -#define MFT_RIGHTJUSTIFY MF_RIGHTJUSTIFY - -#define MFS_GRAYED 0x00000003L -#define MFS_DISABLED MFS_GRAYED -#define MFS_CHECKED MF_CHECKED -#define MFS_HILITE MF_HILITE -#define MFS_ENABLED MF_ENABLED -#define MFS_UNCHECKED MF_UNCHECKED -#define MFS_UNHILITE MF_UNHILITE -#define MFS_DEFAULT MF_DEFAULT - - WINUSERAPI WINBOOL WINAPI CheckMenuRadioItem(HMENU hmenu,UINT first,UINT last,UINT check,UINT flags); - - typedef struct { - WORD versionNumber; - WORD offset; - } MENUITEMTEMPLATEHEADER,*PMENUITEMTEMPLATEHEADER; - - typedef struct { - WORD mtOption; - WORD mtID; - WCHAR mtString[1]; - } MENUITEMTEMPLATE,*PMENUITEMTEMPLATE; -#define MF_END 0x00000080L -#endif - -#ifndef NOSYSCOMMANDS - -#define SC_SIZE 0xF000 -#define SC_MOVE 0xF010 -#define SC_MINIMIZE 0xF020 -#define SC_MAXIMIZE 0xF030 -#define SC_NEXTWINDOW 0xF040 -#define SC_PREVWINDOW 0xF050 -#define SC_CLOSE 0xF060 -#define SC_VSCROLL 0xF070 -#define SC_HSCROLL 0xF080 -#define SC_MOUSEMENU 0xF090 -#define SC_KEYMENU 0xF100 -#define SC_ARRANGE 0xF110 -#define SC_RESTORE 0xF120 -#define SC_TASKLIST 0xF130 -#define SC_SCREENSAVE 0xF140 -#define SC_HOTKEY 0xF150 -#define SC_DEFAULT 0xF160 -#define SC_MONITORPOWER 0xF170 -#define SC_CONTEXTHELP 0xF180 -#define SC_SEPARATOR 0xF00F -#define SC_ICON SC_MINIMIZE -#define SC_ZOOM SC_MAXIMIZE -#endif - -#ifdef UNICODE -#define LoadBitmap LoadBitmapW -#define LoadCursor LoadCursorW -#define LoadCursorFromFile LoadCursorFromFileW -#else -#define LoadBitmap LoadBitmapA -#define LoadCursor LoadCursorA -#define LoadCursorFromFile LoadCursorFromFileA -#endif - - WINUSERAPI HBITMAP WINAPI LoadBitmapA(HINSTANCE hInstance,LPCSTR lpBitmapName); - WINUSERAPI HBITMAP WINAPI LoadBitmapW(HINSTANCE hInstance,LPCWSTR lpBitmapName); - WINUSERAPI HCURSOR WINAPI LoadCursorA(HINSTANCE hInstance,LPCSTR lpCursorName); - WINUSERAPI HCURSOR WINAPI LoadCursorW(HINSTANCE hInstance,LPCWSTR lpCursorName); - WINUSERAPI HCURSOR WINAPI LoadCursorFromFileA(LPCSTR lpFileName); - WINUSERAPI HCURSOR WINAPI LoadCursorFromFileW(LPCWSTR lpFileName); - WINUSERAPI HCURSOR WINAPI CreateCursor(HINSTANCE hInst,int xHotSpot,int yHotSpot,int nWidth,int nHeight,CONST VOID *pvANDPlane,CONST VOID *pvXORPlane); - WINUSERAPI WINBOOL WINAPI DestroyCursor(HCURSOR hCursor); - -#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur))) - -#define IDC_ARROW MAKEINTRESOURCE(32512) -#define IDC_IBEAM MAKEINTRESOURCE(32513) -#define IDC_WAIT MAKEINTRESOURCE(32514) -#define IDC_CROSS MAKEINTRESOURCE(32515) -#define IDC_UPARROW MAKEINTRESOURCE(32516) -#define IDC_SIZE MAKEINTRESOURCE(32640) -#define IDC_ICON MAKEINTRESOURCE(32641) -#define IDC_SIZENWSE MAKEINTRESOURCE(32642) -#define IDC_SIZENESW MAKEINTRESOURCE(32643) -#define IDC_SIZEWE MAKEINTRESOURCE(32644) -#define IDC_SIZENS MAKEINTRESOURCE(32645) -#define IDC_SIZEALL MAKEINTRESOURCE(32646) -#define IDC_NO MAKEINTRESOURCE(32648) -#define IDC_HAND MAKEINTRESOURCE(32649) -#define IDC_APPSTARTING MAKEINTRESOURCE(32650) -#define IDC_HELP MAKEINTRESOURCE(32651) - - WINUSERAPI WINBOOL WINAPI SetSystemCursor(HCURSOR hcur,DWORD id); - - typedef struct _ICONINFO { - WINBOOL fIcon; - DWORD xHotspot; - DWORD yHotspot; - HBITMAP hbmMask; - HBITMAP hbmColor; - } ICONINFO; - typedef ICONINFO *PICONINFO; - -#ifdef UNICODE -#define LoadIcon LoadIconW -#define PrivateExtractIcons PrivateExtractIconsW -#else -#define LoadIcon LoadIconA -#define PrivateExtractIcons PrivateExtractIconsA -#endif - - WINUSERAPI HICON WINAPI LoadIconA(HINSTANCE hInstance,LPCSTR lpIconName); - WINUSERAPI HICON WINAPI LoadIconW(HINSTANCE hInstance,LPCWSTR lpIconName); - WINUSERAPI UINT WINAPI PrivateExtractIconsA(LPCSTR szFileName,int nIconIndex,int cxIcon,int cyIcon,HICON *phicon,UINT *piconid,UINT nIcons,UINT flags); - WINUSERAPI UINT WINAPI PrivateExtractIconsW(LPCWSTR szFileName,int nIconIndex,int cxIcon,int cyIcon,HICON *phicon,UINT *piconid,UINT nIcons,UINT flags); - WINUSERAPI HICON WINAPI CreateIcon(HINSTANCE hInstance,int nWidth,int nHeight,BYTE cPlanes,BYTE cBitsPixel,CONST BYTE *lpbANDbits,CONST BYTE *lpbXORbits); - WINUSERAPI WINBOOL WINAPI DestroyIcon(HICON hIcon); - WINUSERAPI int WINAPI LookupIconIdFromDirectory(PBYTE presbits,WINBOOL fIcon); - WINUSERAPI int WINAPI LookupIconIdFromDirectoryEx(PBYTE presbits,WINBOOL fIcon,int cxDesired,int cyDesired,UINT Flags); - WINUSERAPI HICON WINAPI CreateIconFromResource(PBYTE presbits,DWORD dwResSize,WINBOOL fIcon,DWORD dwVer); - WINUSERAPI HICON WINAPI CreateIconFromResourceEx(PBYTE presbits,DWORD dwResSize,WINBOOL fIcon,DWORD dwVer,int cxDesired,int cyDesired,UINT Flags); - - typedef struct tagCURSORSHAPE { - int xHotSpot; - int yHotSpot; - int cx; - int cy; - int cbWidth; - BYTE Planes; - BYTE BitsPixel; - } CURSORSHAPE,*LPCURSORSHAPE; - -#define IMAGE_BITMAP 0 -#define IMAGE_ICON 1 -#define IMAGE_CURSOR 2 -#define IMAGE_ENHMETAFILE 3 - -#define LR_DEFAULTCOLOR 0x0000 -#define LR_MONOCHROME 0x0001 -#define LR_COLOR 0x0002 -#define LR_COPYRETURNORG 0x0004 -#define LR_COPYDELETEORG 0x0008 -#define LR_LOADFROMFILE 0x0010 -#define LR_LOADTRANSPARENT 0x0020 -#define LR_DEFAULTSIZE 0x0040 -#define LR_VGACOLOR 0x0080 -#define LR_LOADMAP3DCOLORS 0x1000 -#define LR_CREATEDIBSECTION 0x2000 -#define LR_COPYFROMRESOURCE 0x4000 -#define LR_SHARED 0x8000 - -#ifdef UNICODE -#define LoadImage LoadImageW -#else -#define LoadImage LoadImageA -#endif - - WINUSERAPI HANDLE WINAPI LoadImageA(HINSTANCE hInst,LPCSTR name,UINT type,int cx,int cy,UINT fuLoad); - WINUSERAPI HANDLE WINAPI LoadImageW(HINSTANCE hInst,LPCWSTR name,UINT type,int cx,int cy,UINT fuLoad); - WINUSERAPI HANDLE WINAPI CopyImage(HANDLE h,UINT type,int cx,int cy,UINT flags); - -#define DI_MASK 0x0001 -#define DI_IMAGE 0x0002 -#define DI_NORMAL 0x0003 -#define DI_COMPAT 0x0004 -#define DI_DEFAULTSIZE 0x0008 -#define DI_NOMIRROR 0x0010 - - WINUSERAPI WINBOOL WINAPI DrawIconEx(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth,UINT istepIfAniCur,HBRUSH hbrFlickerFreeDraw,UINT diFlags); - WINUSERAPI HICON WINAPI CreateIconIndirect(PICONINFO piconinfo); - WINUSERAPI HICON WINAPI CopyIcon(HICON hIcon); - WINUSERAPI WINBOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO piconinfo); - -#define RES_ICON 1 -#define RES_CURSOR 2 - -#ifdef OEMRESOURCE - -#define OBM_CLOSE 32754 -#define OBM_UPARROW 32753 -#define OBM_DNARROW 32752 -#define OBM_RGARROW 32751 -#define OBM_LFARROW 32750 -#define OBM_REDUCE 32749 -#define OBM_ZOOM 32748 -#define OBM_RESTORE 32747 -#define OBM_REDUCED 32746 -#define OBM_ZOOMD 32745 -#define OBM_RESTORED 32744 -#define OBM_UPARROWD 32743 -#define OBM_DNARROWD 32742 -#define OBM_RGARROWD 32741 -#define OBM_LFARROWD 32740 -#define OBM_MNARROW 32739 -#define OBM_COMBO 32738 -#define OBM_UPARROWI 32737 -#define OBM_DNARROWI 32736 -#define OBM_RGARROWI 32735 -#define OBM_LFARROWI 32734 - -#define OBM_OLD_CLOSE 32767 -#define OBM_SIZE 32766 -#define OBM_OLD_UPARROW 32765 -#define OBM_OLD_DNARROW 32764 -#define OBM_OLD_RGARROW 32763 -#define OBM_OLD_LFARROW 32762 -#define OBM_BTSIZE 32761 -#define OBM_CHECK 32760 -#define OBM_CHECKBOXES 32759 -#define OBM_BTNCORNERS 32758 -#define OBM_OLD_REDUCE 32757 -#define OBM_OLD_ZOOM 32756 -#define OBM_OLD_RESTORE 32755 - -#define OCR_NORMAL 32512 -#define OCR_IBEAM 32513 -#define OCR_WAIT 32514 -#define OCR_CROSS 32515 -#define OCR_UP 32516 -#define OCR_SIZE 32640 -#define OCR_ICON 32641 -#define OCR_SIZENWSE 32642 -#define OCR_SIZENESW 32643 -#define OCR_SIZEWE 32644 -#define OCR_SIZENS 32645 -#define OCR_SIZEALL 32646 -#define OCR_ICOCUR 32647 -#define OCR_NO 32648 -#define OCR_HAND 32649 -#define OCR_APPSTARTING 32650 - -#define OIC_SAMPLE 32512 -#define OIC_HAND 32513 -#define OIC_QUES 32514 -#define OIC_BANG 32515 -#define OIC_NOTE 32516 -#define OIC_WINLOGO 32517 -#define OIC_WARNING OIC_BANG -#define OIC_ERROR OIC_HAND -#define OIC_INFORMATION OIC_NOTE -#endif - -#define ORD_LANGDRIVER 1 - -#ifndef NOICONS - -#ifdef RC_INVOKED -#define IDI_APPLICATION 32512 -#define IDI_HAND 32513 -#define IDI_QUESTION 32514 -#define IDI_EXCLAMATION 32515 -#define IDI_ASTERISK 32516 -#define IDI_WINLOGO 32517 -#else -#define IDI_APPLICATION MAKEINTRESOURCE(32512) -#define IDI_HAND MAKEINTRESOURCE(32513) -#define IDI_QUESTION MAKEINTRESOURCE(32514) -#define IDI_EXCLAMATION MAKEINTRESOURCE(32515) -#define IDI_ASTERISK MAKEINTRESOURCE(32516) -#define IDI_WINLOGO MAKEINTRESOURCE(32517) -#endif - -#define IDI_WARNING IDI_EXCLAMATION -#define IDI_ERROR IDI_HAND -#define IDI_INFORMATION IDI_ASTERISK -#endif - -#ifdef UNICODE -#define LoadString LoadStringW -#else -#define LoadString LoadStringA -#endif - - WINUSERAPI int WINAPI LoadStringA(HINSTANCE hInstance,UINT uID,LPSTR lpBuffer,int cchBufferMax); - WINUSERAPI int WINAPI LoadStringW(HINSTANCE hInstance,UINT uID,LPWSTR lpBuffer,int cchBufferMax); - -#define IDOK 1 -#define IDCANCEL 2 -#define IDABORT 3 -#define IDRETRY 4 -#define IDIGNORE 5 -#define IDYES 6 -#define IDNO 7 -#define IDCLOSE 8 -#define IDHELP 9 -#define IDTRYAGAIN 10 -#define IDCONTINUE 11 - -#ifndef IDTIMEOUT -#define IDTIMEOUT 32000 -#endif - -#ifndef NOCTLMGR - -#ifndef NOWINSTYLES -#define ES_LEFT 0x0000L -#define ES_CENTER 0x0001L -#define ES_RIGHT 0x0002L -#define ES_MULTILINE 0x0004L -#define ES_UPPERCASE 0x0008L -#define ES_LOWERCASE 0x0010L -#define ES_PASSWORD 0x0020L -#define ES_AUTOVSCROLL 0x0040L -#define ES_AUTOHSCROLL 0x0080L -#define ES_NOHIDESEL 0x0100L -#define ES_OEMCONVERT 0x0400L -#define ES_READONLY 0x0800L -#define ES_WANTRETURN 0x1000L -#define ES_NUMBER 0x2000L -#endif - -#define EN_SETFOCUS 0x0100 -#define EN_KILLFOCUS 0x0200 -#define EN_CHANGE 0x0300 -#define EN_UPDATE 0x0400 -#define EN_ERRSPACE 0x0500 -#define EN_MAXTEXT 0x0501 -#define EN_HSCROLL 0x0601 -#define EN_VSCROLL 0x0602 -#define EN_ALIGN_LTR_EC 0x0700 -#define EN_ALIGN_RTL_EC 0x0701 - -#define EC_LEFTMARGIN 0x0001 -#define EC_RIGHTMARGIN 0x0002 -#define EC_USEFONTINFO 0xffff - -#define EMSIS_COMPOSITIONSTRING 0x0001 - -#define EIMES_GETCOMPSTRATONCE 0x0001 -#define EIMES_CANCELCOMPSTRINFOCUS 0x0002 -#define EIMES_COMPLETECOMPSTRKILLFOCUS 0x0004 - -#ifndef NOWINMESSAGES - -#define EM_GETSEL 0x00B0 -#define EM_SETSEL 0x00B1 -#define EM_GETRECT 0x00B2 -#define EM_SETRECT 0x00B3 -#define EM_SETRECTNP 0x00B4 -#define EM_SCROLL 0x00B5 -#define EM_LINESCROLL 0x00B6 -#define EM_SCROLLCARET 0x00B7 -#define EM_GETMODIFY 0x00B8 -#define EM_SETMODIFY 0x00B9 -#define EM_GETLINECOUNT 0x00BA -#define EM_LINEINDEX 0x00BB -#define EM_SETHANDLE 0x00BC -#define EM_GETHANDLE 0x00BD -#define EM_GETTHUMB 0x00BE -#define EM_LINELENGTH 0x00C1 -#define EM_REPLACESEL 0x00C2 -#define EM_GETLINE 0x00C4 -#define EM_LIMITTEXT 0x00C5 -#define EM_CANUNDO 0x00C6 -#define EM_UNDO 0x00C7 -#define EM_FMTLINES 0x00C8 -#define EM_LINEFROMCHAR 0x00C9 -#define EM_SETTABSTOPS 0x00CB -#define EM_SETPASSWORDCHAR 0x00CC -#define EM_EMPTYUNDOBUFFER 0x00CD -#define EM_GETFIRSTVISIBLELINE 0x00CE -#define EM_SETREADONLY 0x00CF -#define EM_SETWORDBREAKPROC 0x00D0 -#define EM_GETWORDBREAKPROC 0x00D1 -#define EM_GETPASSWORDCHAR 0x00D2 -#define EM_SETMARGINS 0x00D3 -#define EM_GETMARGINS 0x00D4 -#define EM_SETLIMITTEXT EM_LIMITTEXT -#define EM_GETLIMITTEXT 0x00D5 -#define EM_POSFROMCHAR 0x00D6 -#define EM_CHARFROMPOS 0x00D7 -#define EM_SETIMESTATUS 0x00D8 -#define EM_GETIMESTATUS 0x00D9 -#endif - -#define WB_LEFT 0 -#define WB_RIGHT 1 -#define WB_ISDELIMITER 2 - -#define BS_PUSHBUTTON 0x00000000L -#define BS_DEFPUSHBUTTON 0x00000001L -#define BS_CHECKBOX 0x00000002L -#define BS_AUTOCHECKBOX 0x00000003L -#define BS_RADIOBUTTON 0x00000004L -#define BS_3STATE 0x00000005L -#define BS_AUTO3STATE 0x00000006L -#define BS_GROUPBOX 0x00000007L -#define BS_USERBUTTON 0x00000008L -#define BS_AUTORADIOBUTTON 0x00000009L -#define BS_PUSHBOX 0x0000000AL -#define BS_OWNERDRAW 0x0000000BL -#define BS_TYPEMASK 0x0000000FL -#define BS_LEFTTEXT 0x00000020L -#define BS_TEXT 0x00000000L -#define BS_ICON 0x00000040L -#define BS_BITMAP 0x00000080L -#define BS_LEFT 0x00000100L -#define BS_RIGHT 0x00000200L -#define BS_CENTER 0x00000300L -#define BS_TOP 0x00000400L -#define BS_BOTTOM 0x00000800L -#define BS_VCENTER 0x00000C00L -#define BS_PUSHLIKE 0x00001000L -#define BS_MULTILINE 0x00002000L -#define BS_NOTIFY 0x00004000L -#define BS_FLAT 0x00008000L -#define BS_RIGHTBUTTON BS_LEFTTEXT - -#define BN_CLICKED 0 -#define BN_PAINT 1 -#define BN_HILITE 2 -#define BN_UNHILITE 3 -#define BN_DISABLE 4 -#define BN_DOUBLECLICKED 5 -#define BN_PUSHED BN_HILITE -#define BN_UNPUSHED BN_UNHILITE -#define BN_DBLCLK BN_DOUBLECLICKED -#define BN_SETFOCUS 6 -#define BN_KILLFOCUS 7 - -#define BM_GETCHECK 0x00F0 -#define BM_SETCHECK 0x00F1 -#define BM_GETSTATE 0x00F2 -#define BM_SETSTATE 0x00F3 -#define BM_SETSTYLE 0x00F4 -#define BM_CLICK 0x00F5 -#define BM_GETIMAGE 0x00F6 -#define BM_SETIMAGE 0x00F7 - -#define BST_UNCHECKED 0x0000 -#define BST_CHECKED 0x0001 -#define BST_INDETERMINATE 0x0002 -#define BST_PUSHED 0x0004 -#define BST_FOCUS 0x0008 - -#define SS_LEFT 0x00000000L -#define SS_CENTER 0x00000001L -#define SS_RIGHT 0x00000002L -#define SS_ICON 0x00000003L -#define SS_BLACKRECT 0x00000004L -#define SS_GRAYRECT 0x00000005L -#define SS_WHITERECT 0x00000006L -#define SS_BLACKFRAME 0x00000007L -#define SS_GRAYFRAME 0x00000008L -#define SS_WHITEFRAME 0x00000009L -#define SS_USERITEM 0x0000000AL -#define SS_SIMPLE 0x0000000BL -#define SS_LEFTNOWORDWRAP 0x0000000CL -#define SS_OWNERDRAW 0x0000000DL -#define SS_BITMAP 0x0000000EL -#define SS_ENHMETAFILE 0x0000000FL -#define SS_ETCHEDHORZ 0x00000010L -#define SS_ETCHEDVERT 0x00000011L -#define SS_ETCHEDFRAME 0x00000012L -#define SS_TYPEMASK 0x0000001FL -#define SS_REALSIZECONTROL 0x00000040L -#define SS_NOPREFIX 0x00000080L -#define SS_NOTIFY 0x00000100L -#define SS_CENTERIMAGE 0x00000200L -#define SS_RIGHTJUST 0x00000400L -#define SS_REALSIZEIMAGE 0x00000800L -#define SS_SUNKEN 0x00001000L -#define SS_EDITCONTROL 0x00002000L -#define SS_ENDELLIPSIS 0x00004000L -#define SS_PATHELLIPSIS 0x00008000L -#define SS_WORDELLIPSIS 0x0000C000L -#define SS_ELLIPSISMASK 0x0000C000L - -#ifndef NOWINMESSAGES - -#define STM_SETICON 0x0170 -#define STM_GETICON 0x0171 -#define STM_SETIMAGE 0x0172 -#define STM_GETIMAGE 0x0173 -#define STN_CLICKED 0 -#define STN_DBLCLK 1 -#define STN_ENABLE 2 -#define STN_DISABLE 3 -#define STM_MSGMAX 0x0174 -#endif - -#define WC_DIALOG (MAKEINTATOM(0x8002)) - -#define DWL_MSGRESULT 0 -#define DWL_DLGPROC 4 -#define DWL_USER 8 - -#ifdef _WIN64 - -#undef DWL_MSGRESULT -#undef DWL_DLGPROC -#undef DWL_USER -#endif - -#define DWLP_MSGRESULT 0 -#define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT) -#define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC) - -#ifndef NOMSG - -#ifdef UNICODE -#define IsDialogMessage IsDialogMessageW -#else -#define IsDialogMessage IsDialogMessageA -#endif - - WINUSERAPI WINBOOL WINAPI IsDialogMessageA(HWND hDlg,LPMSG lpMsg); - WINUSERAPI WINBOOL WINAPI IsDialogMessageW(HWND hDlg,LPMSG lpMsg); -#endif - -#ifdef UNICODE -#define DlgDirList DlgDirListW -#define DlgDirSelectEx DlgDirSelectExW -#define DlgDirListComboBox DlgDirListComboBoxW -#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExW -#else -#define DlgDirList DlgDirListA -#define DlgDirSelectEx DlgDirSelectExA -#define DlgDirListComboBox DlgDirListComboBoxA -#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExA -#endif - - WINUSERAPI WINBOOL WINAPI MapDialogRect(HWND hDlg,LPRECT lpRect); - WINUSERAPI int WINAPI DlgDirListA(HWND hDlg,LPSTR lpPathSpec,int nIDListBox,int nIDStaticPath,UINT uFileType); - WINUSERAPI int WINAPI DlgDirListW(HWND hDlg,LPWSTR lpPathSpec,int nIDListBox,int nIDStaticPath,UINT uFileType); - -#define DDL_READWRITE 0x0000 -#define DDL_READONLY 0x0001 -#define DDL_HIDDEN 0x0002 -#define DDL_SYSTEM 0x0004 -#define DDL_DIRECTORY 0x0010 -#define DDL_ARCHIVE 0x0020 - -#define DDL_POSTMSGS 0x2000 -#define DDL_DRIVES 0x4000 -#define DDL_EXCLUSIVE 0x8000 - - WINUSERAPI WINBOOL WINAPI DlgDirSelectExA(HWND hwndDlg,LPSTR lpString,int chCount,int idListBox); - WINUSERAPI WINBOOL WINAPI DlgDirSelectExW(HWND hwndDlg,LPWSTR lpString,int chCount,int idListBox); - WINUSERAPI int WINAPI DlgDirListComboBoxA(HWND hDlg,LPSTR lpPathSpec,int nIDComboBox,int nIDStaticPath,UINT uFiletype); - WINUSERAPI int WINAPI DlgDirListComboBoxW(HWND hDlg,LPWSTR lpPathSpec,int nIDComboBox,int nIDStaticPath,UINT uFiletype); - WINUSERAPI WINBOOL WINAPI DlgDirSelectComboBoxExA(HWND hwndDlg,LPSTR lpString,int cchOut,int idComboBox); - WINUSERAPI WINBOOL WINAPI DlgDirSelectComboBoxExW(HWND hwndDlg,LPWSTR lpString,int cchOut,int idComboBox); - -#define DS_ABSALIGN 0x01L -#define DS_SYSMODAL 0x02L -#define DS_LOCALEDIT 0x20L -#define DS_SETFONT 0x40L -#define DS_MODALFRAME 0x80L -#define DS_NOIDLEMSG 0x100L -#define DS_SETFOREGROUND 0x200L - -#define DS_3DLOOK 0x0004L -#define DS_FIXEDSYS 0x0008L -#define DS_NOFAILCREATE 0x0010L -#define DS_CONTROL 0x0400L -#define DS_CENTER 0x0800L -#define DS_CENTERMOUSE 0x1000L -#define DS_CONTEXTHELP 0x2000L - -#define DS_SHELLFONT (DS_SETFONT | DS_FIXEDSYS) - -#if(_WIN32_WCE >= 0x0500) -#define DS_USEPIXELS 0x8000L -#endif - -#define DM_GETDEFID (WM_USER+0) -#define DM_SETDEFID (WM_USER+1) -#define DM_REPOSITION (WM_USER+2) - -#define DC_HASDEFID 0x534B - -#define DLGC_WANTARROWS 0x0001 -#define DLGC_WANTTAB 0x0002 -#define DLGC_WANTALLKEYS 0x0004 -#define DLGC_WANTMESSAGE 0x0004 -#define DLGC_HASSETSEL 0x0008 -#define DLGC_DEFPUSHBUTTON 0x0010 -#define DLGC_UNDEFPUSHBUTTON 0x0020 -#define DLGC_RADIOBUTTON 0x0040 -#define DLGC_WANTCHARS 0x0080 -#define DLGC_STATIC 0x0100 -#define DLGC_BUTTON 0x2000 - -#define LB_CTLCODE 0L - -#define LB_OKAY 0 -#define LB_ERR (-1) -#define LB_ERRSPACE (-2) - -#define LBN_ERRSPACE (-2) -#define LBN_SELCHANGE 1 -#define LBN_DBLCLK 2 -#define LBN_SELCANCEL 3 -#define LBN_SETFOCUS 4 -#define LBN_KILLFOCUS 5 - -#ifndef NOWINMESSAGES - -#define LB_ADDSTRING 0x0180 -#define LB_INSERTSTRING 0x0181 -#define LB_DELETESTRING 0x0182 -#define LB_SELITEMRANGEEX 0x0183 -#define LB_RESETCONTENT 0x0184 -#define LB_SETSEL 0x0185 -#define LB_SETCURSEL 0x0186 -#define LB_GETSEL 0x0187 -#define LB_GETCURSEL 0x0188 -#define LB_GETTEXT 0x0189 -#define LB_GETTEXTLEN 0x018A -#define LB_GETCOUNT 0x018B -#define LB_SELECTSTRING 0x018C -#define LB_DIR 0x018D -#define LB_GETTOPINDEX 0x018E -#define LB_FINDSTRING 0x018F -#define LB_GETSELCOUNT 0x0190 -#define LB_GETSELITEMS 0x0191 -#define LB_SETTABSTOPS 0x0192 -#define LB_GETHORIZONTALEXTENT 0x0193 -#define LB_SETHORIZONTALEXTENT 0x0194 -#define LB_SETCOLUMNWIDTH 0x0195 -#define LB_ADDFILE 0x0196 -#define LB_SETTOPINDEX 0x0197 -#define LB_GETITEMRECT 0x0198 -#define LB_GETITEMDATA 0x0199 -#define LB_SETITEMDATA 0x019A -#define LB_SELITEMRANGE 0x019B -#define LB_SETANCHORINDEX 0x019C -#define LB_GETANCHORINDEX 0x019D -#define LB_SETCARETINDEX 0x019E -#define LB_GETCARETINDEX 0x019F -#define LB_SETITEMHEIGHT 0x01A0 -#define LB_GETITEMHEIGHT 0x01A1 -#define LB_FINDSTRINGEXACT 0x01A2 -#define LB_SETLOCALE 0x01A5 -#define LB_GETLOCALE 0x01A6 -#define LB_SETCOUNT 0x01A7 -#define LB_INITSTORAGE 0x01A8 -#define LB_ITEMFROMPOINT 0x01A9 -#if(_WIN32_WCE >= 0x0400) -#define LB_MULTIPLEADDSTRING 0x01B1 -#endif -#define LB_GETLISTBOXINFO 0x01B2 -#define LB_MSGMAX 0x01B3 -#endif - -#ifndef NOWINSTYLES - -#define LBS_NOTIFY 0x0001L -#define LBS_SORT 0x0002L -#define LBS_NOREDRAW 0x0004L -#define LBS_MULTIPLESEL 0x0008L -#define LBS_OWNERDRAWFIXED 0x0010L -#define LBS_OWNERDRAWVARIABLE 0x0020L -#define LBS_HASSTRINGS 0x0040L -#define LBS_USETABSTOPS 0x0080L -#define LBS_NOINTEGRALHEIGHT 0x0100L -#define LBS_MULTICOLUMN 0x0200L -#define LBS_WANTKEYBOARDINPUT 0x0400L -#define LBS_EXTENDEDSEL 0x0800L -#define LBS_DISABLENOSCROLL 0x1000L -#define LBS_NODATA 0x2000L -#define LBS_NOSEL 0x4000L -#define LBS_COMBOBOX 0x8000L - -#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER) -#endif - -#define CB_OKAY 0 -#define CB_ERR (-1) -#define CB_ERRSPACE (-2) - -#define CBN_ERRSPACE (-1) -#define CBN_SELCHANGE 1 -#define CBN_DBLCLK 2 -#define CBN_SETFOCUS 3 -#define CBN_KILLFOCUS 4 -#define CBN_EDITCHANGE 5 -#define CBN_EDITUPDATE 6 -#define CBN_DROPDOWN 7 -#define CBN_CLOSEUP 8 -#define CBN_SELENDOK 9 -#define CBN_SELENDCANCEL 10 - -#ifndef NOWINSTYLES - -#define CBS_SIMPLE 0x0001L -#define CBS_DROPDOWN 0x0002L -#define CBS_DROPDOWNLIST 0x0003L -#define CBS_OWNERDRAWFIXED 0x0010L -#define CBS_OWNERDRAWVARIABLE 0x0020L -#define CBS_AUTOHSCROLL 0x0040L -#define CBS_OEMCONVERT 0x0080L -#define CBS_SORT 0x0100L -#define CBS_HASSTRINGS 0x0200L -#define CBS_NOINTEGRALHEIGHT 0x0400L -#define CBS_DISABLENOSCROLL 0x0800L -#define CBS_UPPERCASE 0x2000L -#define CBS_LOWERCASE 0x4000L -#endif - -#ifndef NOWINMESSAGES -#define CB_GETEDITSEL 0x0140 -#define CB_LIMITTEXT 0x0141 -#define CB_SETEDITSEL 0x0142 -#define CB_ADDSTRING 0x0143 -#define CB_DELETESTRING 0x0144 -#define CB_DIR 0x0145 -#define CB_GETCOUNT 0x0146 -#define CB_GETCURSEL 0x0147 -#define CB_GETLBTEXT 0x0148 -#define CB_GETLBTEXTLEN 0x0149 -#define CB_INSERTSTRING 0x014A -#define CB_RESETCONTENT 0x014B -#define CB_FINDSTRING 0x014C -#define CB_SELECTSTRING 0x014D -#define CB_SETCURSEL 0x014E -#define CB_SHOWDROPDOWN 0x014F -#define CB_GETITEMDATA 0x0150 -#define CB_SETITEMDATA 0x0151 -#define CB_GETDROPPEDCONTROLRECT 0x0152 -#define CB_SETITEMHEIGHT 0x0153 -#define CB_GETITEMHEIGHT 0x0154 -#define CB_SETEXTENDEDUI 0x0155 -#define CB_GETEXTENDEDUI 0x0156 -#define CB_GETDROPPEDSTATE 0x0157 -#define CB_FINDSTRINGEXACT 0x0158 -#define CB_SETLOCALE 0x0159 -#define CB_GETLOCALE 0x015A -#define CB_GETTOPINDEX 0x015b -#define CB_SETTOPINDEX 0x015c -#define CB_GETHORIZONTALEXTENT 0x015d -#define CB_SETHORIZONTALEXTENT 0x015e -#define CB_GETDROPPEDWIDTH 0x015f -#define CB_SETDROPPEDWIDTH 0x0160 -#define CB_INITSTORAGE 0x0161 -#if(_WIN32_WCE >= 0x0400) -#define CB_MULTIPLEADDSTRING 0x0163 -#endif -#define CB_GETCOMBOBOXINFO 0x0164 -#define CB_MSGMAX 0x0165 -#endif - -#ifndef NOWINSTYLES - -#define SBS_HORZ 0x0000L -#define SBS_VERT 0x0001L -#define SBS_TOPALIGN 0x0002L -#define SBS_LEFTALIGN 0x0002L -#define SBS_BOTTOMALIGN 0x0004L -#define SBS_RIGHTALIGN 0x0004L -#define SBS_SIZEBOXTOPLEFTALIGN 0x0002L -#define SBS_SIZEBOXBOTTOMRIGHTALIGN 0x0004L -#define SBS_SIZEBOX 0x0008L -#define SBS_SIZEGRIP 0x0010L -#endif - -#ifndef NOWINMESSAGES -#define SBM_SETPOS 0x00E0 -#define SBM_GETPOS 0x00E1 -#define SBM_SETRANGE 0x00E2 -#define SBM_SETRANGEREDRAW 0x00E6 -#define SBM_GETRANGE 0x00E3 -#define SBM_ENABLE_ARROWS 0x00E4 -#define SBM_SETSCROLLINFO 0x00E9 -#define SBM_GETSCROLLINFO 0x00EA -#define SBM_GETSCROLLBARINFO 0x00EB - -#define SIF_RANGE 0x0001 -#define SIF_PAGE 0x0002 -#define SIF_POS 0x0004 -#define SIF_DISABLENOSCROLL 0x0008 -#define SIF_TRACKPOS 0x0010 -#define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS) - - typedef struct tagSCROLLINFO { - UINT cbSize; - UINT fMask; - int nMin; - int nMax; - UINT nPage; - int nPos; - int nTrackPos; - } SCROLLINFO,*LPSCROLLINFO; - typedef SCROLLINFO CONST *LPCSCROLLINFO; - - WINUSERAPI int WINAPI SetScrollInfo(HWND hwnd,int nBar,LPCSCROLLINFO lpsi,WINBOOL redraw); - WINUSERAPI WINBOOL WINAPI GetScrollInfo(HWND hwnd,int nBar,LPSCROLLINFO lpsi); -#endif -#endif - -#ifndef NOMDI - -#define MDIS_ALLCHILDSTYLES 0x0001 - -#define MDITILE_VERTICAL 0x0000 -#define MDITILE_HORIZONTAL 0x0001 -#define MDITILE_SKIPDISABLED 0x0002 -#define MDITILE_ZORDER 0x0004 - - typedef struct tagMDICREATESTRUCTA { - LPCSTR szClass; - LPCSTR szTitle; - HANDLE hOwner; - int x; - int y; - int cx; - int cy; - DWORD style; - LPARAM lParam; - } MDICREATESTRUCTA,*LPMDICREATESTRUCTA; - - typedef struct tagMDICREATESTRUCTW { - LPCWSTR szClass; - LPCWSTR szTitle; - HANDLE hOwner; - int x; - int y; - int cx; - int cy; - DWORD style; - LPARAM lParam; - } MDICREATESTRUCTW,*LPMDICREATESTRUCTW; - -#ifdef UNICODE - typedef MDICREATESTRUCTW MDICREATESTRUCT; - typedef LPMDICREATESTRUCTW LPMDICREATESTRUCT; -#else - typedef MDICREATESTRUCTA MDICREATESTRUCT; - typedef LPMDICREATESTRUCTA LPMDICREATESTRUCT; -#endif - - typedef struct tagCLIENTCREATESTRUCT { - HANDLE hWindowMenu; - UINT idFirstChild; - } CLIENTCREATESTRUCT,*LPCLIENTCREATESTRUCT; - -#ifdef UNICODE -#define DefFrameProc DefFrameProcW -#define DefMDIChildProc DefMDIChildProcW -#define CreateMDIWindow CreateMDIWindowW -#else -#define DefFrameProc DefFrameProcA -#define DefMDIChildProc DefMDIChildProcA -#define CreateMDIWindow CreateMDIWindowA -#endif - - WINUSERAPI LRESULT WINAPI DefFrameProcA(HWND hWnd,HWND hWndMDIClient,UINT uMsg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI DefFrameProcW(HWND hWnd,HWND hWndMDIClient,UINT uMsg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI DefMDIChildProcA(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); - WINUSERAPI LRESULT WINAPI DefMDIChildProcW(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); - -#ifndef NOMSG - WINUSERAPI WINBOOL WINAPI TranslateMDISysAccel(HWND hWndClient,LPMSG lpMsg); -#endif - - WINUSERAPI UINT WINAPI ArrangeIconicWindows(HWND hWnd); - WINUSERAPI HWND WINAPI CreateMDIWindowA(LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HINSTANCE hInstance,LPARAM lParam); - WINUSERAPI HWND WINAPI CreateMDIWindowW(LPCWSTR lpClassName,LPCWSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HINSTANCE hInstance,LPARAM lParam); - WINUSERAPI WORD WINAPI TileWindows(HWND hwndParent,UINT wHow,CONST RECT *lpRect,UINT cKids,const HWND *lpKids); - WINUSERAPI WORD WINAPI CascadeWindows(HWND hwndParent,UINT wHow,CONST RECT *lpRect,UINT cKids,const HWND *lpKids); -#endif -#endif - -#ifndef NOHELP - - typedef DWORD HELPPOLY; - typedef struct tagMULTIKEYHELPA { - DWORD mkSize; - CHAR mkKeylist; - CHAR szKeyphrase[1]; - } MULTIKEYHELPA,*PMULTIKEYHELPA,*LPMULTIKEYHELPA; - - typedef struct tagMULTIKEYHELPW { - DWORD mkSize; - WCHAR mkKeylist; - WCHAR szKeyphrase[1]; - } MULTIKEYHELPW,*PMULTIKEYHELPW,*LPMULTIKEYHELPW; - -#ifdef UNICODE - typedef MULTIKEYHELPW MULTIKEYHELP; - typedef PMULTIKEYHELPW PMULTIKEYHELP; - typedef LPMULTIKEYHELPW LPMULTIKEYHELP; -#else - typedef MULTIKEYHELPA MULTIKEYHELP; - typedef PMULTIKEYHELPA PMULTIKEYHELP; - typedef LPMULTIKEYHELPA LPMULTIKEYHELP; -#endif - - typedef struct tagHELPWININFOA { - int wStructSize; - int x; - int y; - int dx; - int dy; - int wMax; - CHAR rgchMember[2]; - } HELPWININFOA,*PHELPWININFOA,*LPHELPWININFOA; - - typedef struct tagHELPWININFOW { - int wStructSize; - int x; - int y; - int dx; - int dy; - int wMax; - WCHAR rgchMember[2]; - } HELPWININFOW,*PHELPWININFOW,*LPHELPWININFOW; - -#ifdef UNICODE - typedef HELPWININFOW HELPWININFO; - typedef PHELPWININFOW PHELPWININFO; - typedef LPHELPWININFOW LPHELPWININFO; -#else - typedef HELPWININFOA HELPWININFO; - typedef PHELPWININFOA PHELPWININFO; - typedef LPHELPWININFOA LPHELPWININFO; -#endif - -#define HELP_CONTEXT 0x0001L -#define HELP_QUIT 0x0002L -#define HELP_INDEX 0x0003L -#define HELP_CONTENTS 0x0003L -#define HELP_HELPONHELP 0x0004L -#define HELP_SETINDEX 0x0005L -#define HELP_SETCONTENTS 0x0005L -#define HELP_CONTEXTPOPUP 0x0008L -#define HELP_FORCEFILE 0x0009L -#define HELP_KEY 0x0101L -#define HELP_COMMAND 0x0102L -#define HELP_PARTIALKEY 0x0105L -#define HELP_MULTIKEY 0x0201L -#define HELP_SETWINPOS 0x0203L -#define HELP_CONTEXTMENU 0x000a -#define HELP_FINDER 0x000b -#define HELP_WM_HELP 0x000c -#define HELP_SETPOPUP_POS 0x000d - -#define HELP_TCARD 0x8000 -#define HELP_TCARD_DATA 0x0010 -#define HELP_TCARD_OTHER_CALLER 0x0011 - -#define IDH_NO_HELP 28440 -#define IDH_MISSING_CONTEXT 28441 -#define IDH_GENERIC_HELP_BUTTON 28442 -#define IDH_OK 28443 -#define IDH_CANCEL 28444 -#define IDH_HELP 28445 - -#ifdef UNICODE -#define WinHelp WinHelpW -#else -#define WinHelp WinHelpA -#endif - - WINUSERAPI WINBOOL WINAPI WinHelpA(HWND hWndMain,LPCSTR lpszHelp,UINT uCommand,ULONG_PTR dwData); - WINUSERAPI WINBOOL WINAPI WinHelpW(HWND hWndMain,LPCWSTR lpszHelp,UINT uCommand,ULONG_PTR dwData); -#endif - -#define GR_GDIOBJECTS 0 -#define GR_USEROBJECTS 1 - - WINUSERAPI DWORD WINAPI GetGuiResources(HANDLE hProcess,DWORD uiFlags); - -#ifndef NOSYSPARAMSINFO - -#define SPI_GETBEEP 0x0001 -#define SPI_SETBEEP 0x0002 -#define SPI_GETMOUSE 0x0003 -#define SPI_SETMOUSE 0x0004 -#define SPI_GETBORDER 0x0005 -#define SPI_SETBORDER 0x0006 -#define SPI_GETKEYBOARDSPEED 0x000A -#define SPI_SETKEYBOARDSPEED 0x000B -#define SPI_LANGDRIVER 0x000C -#define SPI_ICONHORIZONTALSPACING 0x000D -#define SPI_GETSCREENSAVETIMEOUT 0x000E -#define SPI_SETSCREENSAVETIMEOUT 0x000F -#define SPI_GETSCREENSAVEACTIVE 0x0010 -#define SPI_SETSCREENSAVEACTIVE 0x0011 -#define SPI_GETGRIDGRANULARITY 0x0012 -#define SPI_SETGRIDGRANULARITY 0x0013 -#define SPI_SETDESKWALLPAPER 0x0014 -#define SPI_SETDESKPATTERN 0x0015 -#define SPI_GETKEYBOARDDELAY 0x0016 -#define SPI_SETKEYBOARDDELAY 0x0017 -#define SPI_ICONVERTICALSPACING 0x0018 -#define SPI_GETICONTITLEWRAP 0x0019 -#define SPI_SETICONTITLEWRAP 0x001A -#define SPI_GETMENUDROPALIGNMENT 0x001B -#define SPI_SETMENUDROPALIGNMENT 0x001C -#define SPI_SETDOUBLECLKWIDTH 0x001D -#define SPI_SETDOUBLECLKHEIGHT 0x001E -#define SPI_GETICONTITLELOGFONT 0x001F -#define SPI_SETDOUBLECLICKTIME 0x0020 -#define SPI_SETMOUSEBUTTONSWAP 0x0021 -#define SPI_SETICONTITLELOGFONT 0x0022 -#define SPI_GETFASTTASKSWITCH 0x0023 -#define SPI_SETFASTTASKSWITCH 0x0024 -#define SPI_SETDRAGFULLWINDOWS 0x0025 -#define SPI_GETDRAGFULLWINDOWS 0x0026 -#define SPI_GETNONCLIENTMETRICS 0x0029 -#define SPI_SETNONCLIENTMETRICS 0x002A -#define SPI_GETMINIMIZEDMETRICS 0x002B -#define SPI_SETMINIMIZEDMETRICS 0x002C -#define SPI_GETICONMETRICS 0x002D -#define SPI_SETICONMETRICS 0x002E -#define SPI_SETWORKAREA 0x002F -#define SPI_GETWORKAREA 0x0030 -#define SPI_SETPENWINDOWS 0x0031 - -#define SPI_GETHIGHCONTRAST 0x0042 -#define SPI_SETHIGHCONTRAST 0x0043 -#define SPI_GETKEYBOARDPREF 0x0044 -#define SPI_SETKEYBOARDPREF 0x0045 -#define SPI_GETSCREENREADER 0x0046 -#define SPI_SETSCREENREADER 0x0047 -#define SPI_GETANIMATION 0x0048 -#define SPI_SETANIMATION 0x0049 -#define SPI_GETFONTSMOOTHING 0x004A -#define SPI_SETFONTSMOOTHING 0x004B -#define SPI_SETDRAGWIDTH 0x004C -#define SPI_SETDRAGHEIGHT 0x004D -#define SPI_SETHANDHELD 0x004E -#define SPI_GETLOWPOWERTIMEOUT 0x004F -#define SPI_GETPOWEROFFTIMEOUT 0x0050 -#define SPI_SETLOWPOWERTIMEOUT 0x0051 -#define SPI_SETPOWEROFFTIMEOUT 0x0052 -#define SPI_GETLOWPOWERACTIVE 0x0053 -#define SPI_GETPOWEROFFACTIVE 0x0054 -#define SPI_SETLOWPOWERACTIVE 0x0055 -#define SPI_SETPOWEROFFACTIVE 0x0056 -#define SPI_SETCURSORS 0x0057 -#define SPI_SETICONS 0x0058 -#define SPI_GETDEFAULTINPUTLANG 0x0059 -#define SPI_SETDEFAULTINPUTLANG 0x005A -#define SPI_SETLANGTOGGLE 0x005B -#define SPI_GETWINDOWSEXTENSION 0x005C -#define SPI_SETMOUSETRAILS 0x005D -#define SPI_GETMOUSETRAILS 0x005E -#define SPI_SETSCREENSAVERRUNNING 0x0061 -#define SPI_SCREENSAVERRUNNING SPI_SETSCREENSAVERRUNNING -#define SPI_GETFILTERKEYS 0x0032 -#define SPI_SETFILTERKEYS 0x0033 -#define SPI_GETTOGGLEKEYS 0x0034 -#define SPI_SETTOGGLEKEYS 0x0035 -#define SPI_GETMOUSEKEYS 0x0036 -#define SPI_SETMOUSEKEYS 0x0037 -#define SPI_GETSHOWSOUNDS 0x0038 -#define SPI_SETSHOWSOUNDS 0x0039 -#define SPI_GETSTICKYKEYS 0x003A -#define SPI_SETSTICKYKEYS 0x003B -#define SPI_GETACCESSTIMEOUT 0x003C -#define SPI_SETACCESSTIMEOUT 0x003D -#define SPI_GETSERIALKEYS 0x003E -#define SPI_SETSERIALKEYS 0x003F -#define SPI_GETSOUNDSENTRY 0x0040 -#define SPI_SETSOUNDSENTRY 0x0041 -#define SPI_GETSNAPTODEFBUTTON 0x005F -#define SPI_SETSNAPTODEFBUTTON 0x0060 -#define SPI_GETMOUSEHOVERWIDTH 0x0062 -#define SPI_SETMOUSEHOVERWIDTH 0x0063 -#define SPI_GETMOUSEHOVERHEIGHT 0x0064 -#define SPI_SETMOUSEHOVERHEIGHT 0x0065 -#define SPI_GETMOUSEHOVERTIME 0x0066 -#define SPI_SETMOUSEHOVERTIME 0x0067 -#define SPI_GETWHEELSCROLLLINES 0x0068 -#define SPI_SETWHEELSCROLLLINES 0x0069 -#define SPI_GETMENUSHOWDELAY 0x006A -#define SPI_SETMENUSHOWDELAY 0x006B -#define SPI_GETSHOWIMEUI 0x006E -#define SPI_SETSHOWIMEUI 0x006F -#define SPI_GETMOUSESPEED 0x0070 -#define SPI_SETMOUSESPEED 0x0071 -#define SPI_GETSCREENSAVERRUNNING 0x0072 -#define SPI_GETDESKWALLPAPER 0x0073 - -#define SPI_GETACTIVEWINDOWTRACKING 0x1000 -#define SPI_SETACTIVEWINDOWTRACKING 0x1001 -#define SPI_GETMENUANIMATION 0x1002 -#define SPI_SETMENUANIMATION 0x1003 -#define SPI_GETCOMBOBOXANIMATION 0x1004 -#define SPI_SETCOMBOBOXANIMATION 0x1005 -#define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006 -#define SPI_SETLISTBOXSMOOTHSCROLLING 0x1007 -#define SPI_GETGRADIENTCAPTIONS 0x1008 -#define SPI_SETGRADIENTCAPTIONS 0x1009 -#define SPI_GETKEYBOARDCUES 0x100A -#define SPI_SETKEYBOARDCUES 0x100B -#define SPI_GETMENUUNDERLINES SPI_GETKEYBOARDCUES -#define SPI_SETMENUUNDERLINES SPI_SETKEYBOARDCUES -#define SPI_GETACTIVEWNDTRKZORDER 0x100C -#define SPI_SETACTIVEWNDTRKZORDER 0x100D -#define SPI_GETHOTTRACKING 0x100E -#define SPI_SETHOTTRACKING 0x100F -#define SPI_GETMENUFADE 0x1012 -#define SPI_SETMENUFADE 0x1013 -#define SPI_GETSELECTIONFADE 0x1014 -#define SPI_SETSELECTIONFADE 0x1015 -#define SPI_GETTOOLTIPANIMATION 0x1016 -#define SPI_SETTOOLTIPANIMATION 0x1017 -#define SPI_GETTOOLTIPFADE 0x1018 -#define SPI_SETTOOLTIPFADE 0x1019 -#define SPI_GETCURSORSHADOW 0x101A -#define SPI_SETCURSORSHADOW 0x101B -#define SPI_GETMOUSESONAR 0x101C -#define SPI_SETMOUSESONAR 0x101D -#define SPI_GETMOUSECLICKLOCK 0x101E -#define SPI_SETMOUSECLICKLOCK 0x101F -#define SPI_GETMOUSEVANISH 0x1020 -#define SPI_SETMOUSEVANISH 0x1021 -#define SPI_GETFLATMENU 0x1022 -#define SPI_SETFLATMENU 0x1023 -#define SPI_GETDROPSHADOW 0x1024 -#define SPI_SETDROPSHADOW 0x1025 -#define SPI_GETBLOCKSENDINPUTRESETS 0x1026 -#define SPI_SETBLOCKSENDINPUTRESETS 0x1027 -#define SPI_GETUIEFFECTS 0x103E -#define SPI_SETUIEFFECTS 0x103F -#define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000 -#define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001 -#define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002 -#define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003 -#define SPI_GETFOREGROUNDFLASHCOUNT 0x2004 -#define SPI_SETFOREGROUNDFLASHCOUNT 0x2005 -#define SPI_GETCARETWIDTH 0x2006 -#define SPI_SETCARETWIDTH 0x2007 -#define SPI_GETMOUSECLICKLOCKTIME 0x2008 -#define SPI_SETMOUSECLICKLOCKTIME 0x2009 -#define SPI_GETFONTSMOOTHINGTYPE 0x200A -#define SPI_SETFONTSMOOTHINGTYPE 0x200B - -#define FE_FONTSMOOTHINGSTANDARD 0x0001 -#define FE_FONTSMOOTHINGCLEARTYPE 0x0002 -#define FE_FONTSMOOTHINGDOCKING 0x8000 - -#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C -#define SPI_SETFONTSMOOTHINGCONTRAST 0x200D -#define SPI_GETFOCUSBORDERWIDTH 0x200E -#define SPI_SETFOCUSBORDERWIDTH 0x200F -#define SPI_GETFOCUSBORDERHEIGHT 0x2010 -#define SPI_SETFOCUSBORDERHEIGHT 0x2011 -#define SPI_GETFONTSMOOTHINGORIENTATION 0x2012 -#define SPI_SETFONTSMOOTHINGORIENTATION 0x2013 - -#define FE_FONTSMOOTHINGORIENTATIONBGR 0x0000 -#define FE_FONTSMOOTHINGORIENTATIONRGB 0x0001 - -#define SPIF_UPDATEINIFILE 0x0001 -#define SPIF_SENDWININICHANGE 0x0002 -#define SPIF_SENDCHANGE SPIF_SENDWININICHANGE - -#define METRICS_USEDEFAULT -1 -#ifdef _WINGDI_ -#ifndef NOGDI - typedef struct tagNONCLIENTMETRICSA { - UINT cbSize; - int iBorderWidth; - int iScrollWidth; - int iScrollHeight; - int iCaptionWidth; - int iCaptionHeight; - LOGFONTA lfCaptionFont; - int iSmCaptionWidth; - int iSmCaptionHeight; - LOGFONTA lfSmCaptionFont; - int iMenuWidth; - int iMenuHeight; - LOGFONTA lfMenuFont; - LOGFONTA lfStatusFont; - LOGFONTA lfMessageFont; - } NONCLIENTMETRICSA,*PNONCLIENTMETRICSA,*LPNONCLIENTMETRICSA; - - typedef struct tagNONCLIENTMETRICSW { - UINT cbSize; - int iBorderWidth; - int iScrollWidth; - int iScrollHeight; - int iCaptionWidth; - int iCaptionHeight; - LOGFONTW lfCaptionFont; - int iSmCaptionWidth; - int iSmCaptionHeight; - LOGFONTW lfSmCaptionFont; - int iMenuWidth; - int iMenuHeight; - LOGFONTW lfMenuFont; - LOGFONTW lfStatusFont; - LOGFONTW lfMessageFont; - } NONCLIENTMETRICSW,*PNONCLIENTMETRICSW,*LPNONCLIENTMETRICSW; - -#ifdef UNICODE - typedef NONCLIENTMETRICSW NONCLIENTMETRICS; - typedef PNONCLIENTMETRICSW PNONCLIENTMETRICS; - typedef LPNONCLIENTMETRICSW LPNONCLIENTMETRICS; -#else - typedef NONCLIENTMETRICSA NONCLIENTMETRICS; - typedef PNONCLIENTMETRICSA PNONCLIENTMETRICS; - typedef LPNONCLIENTMETRICSA LPNONCLIENTMETRICS; -#endif -#endif -#endif - -#define ARW_BOTTOMLEFT 0x0000L -#define ARW_BOTTOMRIGHT 0x0001L -#define ARW_TOPLEFT 0x0002L -#define ARW_TOPRIGHT 0x0003L -#define ARW_STARTMASK 0x0003L -#define ARW_STARTRIGHT 0x0001L -#define ARW_STARTTOP 0x0002L - -#define ARW_LEFT 0x0000L -#define ARW_RIGHT 0x0000L -#define ARW_UP 0x0004L -#define ARW_DOWN 0x0004L -#define ARW_HIDE 0x0008L - - typedef struct tagMINIMIZEDMETRICS { - UINT cbSize; - int iWidth; - int iHorzGap; - int iVertGap; - int iArrange; - } MINIMIZEDMETRICS,*PMINIMIZEDMETRICS,*LPMINIMIZEDMETRICS; - -#ifdef _WINGDI_ -#ifndef NOGDI - typedef struct tagICONMETRICSA { - UINT cbSize; - int iHorzSpacing; - int iVertSpacing; - int iTitleWrap; - LOGFONTA lfFont; - } ICONMETRICSA,*PICONMETRICSA,*LPICONMETRICSA; - - typedef struct tagICONMETRICSW { - UINT cbSize; - int iHorzSpacing; - int iVertSpacing; - int iTitleWrap; - LOGFONTW lfFont; - } ICONMETRICSW,*PICONMETRICSW,*LPICONMETRICSW; - -#ifdef UNICODE - typedef ICONMETRICSW ICONMETRICS; - typedef PICONMETRICSW PICONMETRICS; - typedef LPICONMETRICSW LPICONMETRICS; -#else - typedef ICONMETRICSA ICONMETRICS; - typedef PICONMETRICSA PICONMETRICS; - typedef LPICONMETRICSA LPICONMETRICS; -#endif -#endif -#endif - - typedef struct tagANIMATIONINFO { - UINT cbSize; - int iMinAnimate; - } ANIMATIONINFO,*LPANIMATIONINFO; - - typedef struct tagSERIALKEYSA { - UINT cbSize; - DWORD dwFlags; - LPSTR lpszActivePort; - LPSTR lpszPort; - UINT iBaudRate; - UINT iPortState; - UINT iActive; - } SERIALKEYSA,*LPSERIALKEYSA; - - typedef struct tagSERIALKEYSW { - UINT cbSize; - DWORD dwFlags; - LPWSTR lpszActivePort; - LPWSTR lpszPort; - UINT iBaudRate; - UINT iPortState; - UINT iActive; - } SERIALKEYSW,*LPSERIALKEYSW; - -#ifdef UNICODE - typedef SERIALKEYSW SERIALKEYS; - typedef LPSERIALKEYSW LPSERIALKEYS; -#else - typedef SERIALKEYSA SERIALKEYS; - typedef LPSERIALKEYSA LPSERIALKEYS; -#endif - -#define SERKF_SERIALKEYSON 0x00000001 -#define SERKF_AVAILABLE 0x00000002 -#define SERKF_INDICATOR 0x00000004 - - typedef struct tagHIGHCONTRASTA { - UINT cbSize; - DWORD dwFlags; - LPSTR lpszDefaultScheme; - } HIGHCONTRASTA,*LPHIGHCONTRASTA; - - typedef struct tagHIGHCONTRASTW { - UINT cbSize; - DWORD dwFlags; - LPWSTR lpszDefaultScheme; - } HIGHCONTRASTW,*LPHIGHCONTRASTW; - -#ifdef UNICODE - typedef HIGHCONTRASTW HIGHCONTRAST; - typedef LPHIGHCONTRASTW LPHIGHCONTRAST; -#else - typedef HIGHCONTRASTA HIGHCONTRAST; - typedef LPHIGHCONTRASTA LPHIGHCONTRAST; -#endif - -#define HCF_HIGHCONTRASTON 0x00000001 -#define HCF_AVAILABLE 0x00000002 -#define HCF_HOTKEYACTIVE 0x00000004 -#define HCF_CONFIRMHOTKEY 0x00000008 -#define HCF_HOTKEYSOUND 0x00000010 -#define HCF_INDICATOR 0x00000020 -#define HCF_HOTKEYAVAILABLE 0x00000040 -#define HCF_LOGONDESKTOP 0x00000100 -#define HCF_DEFAULTDESKTOP 0x00000200 - -#define CDS_UPDATEREGISTRY 0x00000001 -#define CDS_TEST 0x00000002 -#define CDS_FULLSCREEN 0x00000004 -#define CDS_GLOBAL 0x00000008 -#define CDS_SET_PRIMARY 0x00000010 -#define CDS_VIDEOPARAMETERS 0x00000020 -#define CDS_RESET 0x40000000 -#define CDS_NORESET 0x10000000 - -//gr #include - -#define DISP_CHANGE_SUCCESSFUL 0 -#define DISP_CHANGE_RESTART 1 -#define DISP_CHANGE_FAILED -1 -#define DISP_CHANGE_BADMODE -2 -#define DISP_CHANGE_NOTUPDATED -3 -#define DISP_CHANGE_BADFLAGS -4 -#define DISP_CHANGE_BADPARAM -5 -#define DISP_CHANGE_BADDUALVIEW -6 - -#ifdef _WINGDI_ -#ifndef NOGDI - -#ifdef UNICODE -#define ChangeDisplaySettings ChangeDisplaySettingsW -#define ChangeDisplaySettingsEx ChangeDisplaySettingsExW -#define EnumDisplaySettings EnumDisplaySettingsW -#define EnumDisplaySettingsEx EnumDisplaySettingsExW -#define EnumDisplayDevices EnumDisplayDevicesW -#else -#define ChangeDisplaySettings ChangeDisplaySettingsA -#define ChangeDisplaySettingsEx ChangeDisplaySettingsExA -#define EnumDisplaySettings EnumDisplaySettingsA -#define EnumDisplaySettingsEx EnumDisplaySettingsExA -#define EnumDisplayDevices EnumDisplayDevicesA -#endif - - WINUSERAPI LONG WINAPI ChangeDisplaySettingsA(LPDEVMODEA lpDevMode,DWORD dwFlags); - WINUSERAPI LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW lpDevMode,DWORD dwFlags); - WINUSERAPI LONG WINAPI ChangeDisplaySettingsExA(LPCSTR lpszDeviceName,LPDEVMODEA lpDevMode,HWND hwnd,DWORD dwflags,LPVOID lParam); - WINUSERAPI LONG WINAPI ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName,LPDEVMODEW lpDevMode,HWND hwnd,DWORD dwflags,LPVOID lParam); - -#define ENUM_CURRENT_SETTINGS ((DWORD)-1) -#define ENUM_REGISTRY_SETTINGS ((DWORD)-2) - - WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsA(LPCSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEA lpDevMode); - WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsW(LPCWSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEW lpDevMode); - WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEA lpDevMode,DWORD dwFlags); - WINUSERAPI WINBOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName,DWORD iModeNum,LPDEVMODEW lpDevMode,DWORD dwFlags); - -#define EDS_RAWMODE 0x00000002 - - WINUSERAPI WINBOOL WINAPI EnumDisplayDevicesA(LPCSTR lpDevice,DWORD iDevNum,PDISPLAY_DEVICEA lpDisplayDevice,DWORD dwFlags); - WINUSERAPI WINBOOL WINAPI EnumDisplayDevicesW(LPCWSTR lpDevice,DWORD iDevNum,PDISPLAY_DEVICEW lpDisplayDevice,DWORD dwFlags); -#endif -#endif - -#ifdef UNICODE -#define SystemParametersInfo SystemParametersInfoW -#else -#define SystemParametersInfo SystemParametersInfoA -#endif - - WINUSERAPI WINBOOL WINAPI SystemParametersInfoA(UINT uiAction,UINT uiParam,PVOID pvParam,UINT fWinIni); - WINUSERAPI WINBOOL WINAPI SystemParametersInfoW(UINT uiAction,UINT uiParam,PVOID pvParam,UINT fWinIni); -#endif - - typedef struct tagFILTERKEYS { - UINT cbSize; - DWORD dwFlags; - DWORD iWaitMSec; - DWORD iDelayMSec; - DWORD iRepeatMSec; - DWORD iBounceMSec; - } FILTERKEYS,*LPFILTERKEYS; - -#define FKF_FILTERKEYSON 0x00000001 -#define FKF_AVAILABLE 0x00000002 -#define FKF_HOTKEYACTIVE 0x00000004 -#define FKF_CONFIRMHOTKEY 0x00000008 -#define FKF_HOTKEYSOUND 0x00000010 -#define FKF_INDICATOR 0x00000020 -#define FKF_CLICKON 0x00000040 - - typedef struct tagSTICKYKEYS { - UINT cbSize; - DWORD dwFlags; - } STICKYKEYS,*LPSTICKYKEYS; - -#define SKF_STICKYKEYSON 0x00000001 -#define SKF_AVAILABLE 0x00000002 -#define SKF_HOTKEYACTIVE 0x00000004 -#define SKF_CONFIRMHOTKEY 0x00000008 -#define SKF_HOTKEYSOUND 0x00000010 -#define SKF_INDICATOR 0x00000020 -#define SKF_AUDIBLEFEEDBACK 0x00000040 -#define SKF_TRISTATE 0x00000080 -#define SKF_TWOKEYSOFF 0x00000100 -#define SKF_LALTLATCHED 0x10000000 -#define SKF_LCTLLATCHED 0x04000000 -#define SKF_LSHIFTLATCHED 0x01000000 -#define SKF_RALTLATCHED 0x20000000 -#define SKF_RCTLLATCHED 0x08000000 -#define SKF_RSHIFTLATCHED 0x02000000 -#define SKF_LWINLATCHED 0x40000000 -#define SKF_RWINLATCHED 0x80000000 -#define SKF_LALTLOCKED 0x00100000 -#define SKF_LCTLLOCKED 0x00040000 -#define SKF_LSHIFTLOCKED 0x00010000 -#define SKF_RALTLOCKED 0x00200000 -#define SKF_RCTLLOCKED 0x00080000 -#define SKF_RSHIFTLOCKED 0x00020000 -#define SKF_LWINLOCKED 0x00400000 -#define SKF_RWINLOCKED 0x00800000 - - typedef struct tagMOUSEKEYS { - UINT cbSize; - DWORD dwFlags; - DWORD iMaxSpeed; - DWORD iTimeToMaxSpeed; - DWORD iCtrlSpeed; - DWORD dwReserved1; - DWORD dwReserved2; - } MOUSEKEYS,*LPMOUSEKEYS; - -#define MKF_MOUSEKEYSON 0x00000001 -#define MKF_AVAILABLE 0x00000002 -#define MKF_HOTKEYACTIVE 0x00000004 -#define MKF_CONFIRMHOTKEY 0x00000008 -#define MKF_HOTKEYSOUND 0x00000010 -#define MKF_INDICATOR 0x00000020 -#define MKF_MODIFIERS 0x00000040 -#define MKF_REPLACENUMBERS 0x00000080 -#define MKF_LEFTBUTTONSEL 0x10000000 -#define MKF_RIGHTBUTTONSEL 0x20000000 -#define MKF_LEFTBUTTONDOWN 0x01000000 -#define MKF_RIGHTBUTTONDOWN 0x02000000 -#define MKF_MOUSEMODE 0x80000000 - - typedef struct tagACCESSTIMEOUT { - UINT cbSize; - DWORD dwFlags; - DWORD iTimeOutMSec; - } ACCESSTIMEOUT,*LPACCESSTIMEOUT; - -#define ATF_TIMEOUTON 0x00000001 -#define ATF_ONOFFFEEDBACK 0x00000002 - -#define SSGF_NONE 0 -#define SSGF_DISPLAY 3 - -#define SSTF_NONE 0 -#define SSTF_CHARS 1 -#define SSTF_BORDER 2 -#define SSTF_DISPLAY 3 - -#define SSWF_NONE 0 -#define SSWF_TITLE 1 -#define SSWF_WINDOW 2 -#define SSWF_DISPLAY 3 -#define SSWF_CUSTOM 4 - - typedef struct tagSOUNDSENTRYA { - UINT cbSize; - DWORD dwFlags; - DWORD iFSTextEffect; - DWORD iFSTextEffectMSec; - DWORD iFSTextEffectColorBits; - DWORD iFSGrafEffect; - DWORD iFSGrafEffectMSec; - DWORD iFSGrafEffectColor; - DWORD iWindowsEffect; - DWORD iWindowsEffectMSec; - LPSTR lpszWindowsEffectDLL; - DWORD iWindowsEffectOrdinal; - } SOUNDSENTRYA,*LPSOUNDSENTRYA; - - typedef struct tagSOUNDSENTRYW { - UINT cbSize; - DWORD dwFlags; - DWORD iFSTextEffect; - DWORD iFSTextEffectMSec; - DWORD iFSTextEffectColorBits; - DWORD iFSGrafEffect; - DWORD iFSGrafEffectMSec; - DWORD iFSGrafEffectColor; - DWORD iWindowsEffect; - DWORD iWindowsEffectMSec; - LPWSTR lpszWindowsEffectDLL; - DWORD iWindowsEffectOrdinal; - } SOUNDSENTRYW,*LPSOUNDSENTRYW; - -#ifdef UNICODE - typedef SOUNDSENTRYW SOUNDSENTRY; - typedef LPSOUNDSENTRYW LPSOUNDSENTRY; -#else - typedef SOUNDSENTRYA SOUNDSENTRY; - typedef LPSOUNDSENTRYA LPSOUNDSENTRY; -#endif - -#define SSF_SOUNDSENTRYON 0x00000001 -#define SSF_AVAILABLE 0x00000002 -#define SSF_INDICATOR 0x00000004 - - typedef struct tagTOGGLEKEYS { - UINT cbSize; - DWORD dwFlags; - } TOGGLEKEYS,*LPTOGGLEKEYS; - -#define TKF_TOGGLEKEYSON 0x00000001 -#define TKF_AVAILABLE 0x00000002 -#define TKF_HOTKEYACTIVE 0x00000004 -#define TKF_CONFIRMHOTKEY 0x00000008 -#define TKF_HOTKEYSOUND 0x00000010 -#define TKF_INDICATOR 0x00000020 - - WINUSERAPI VOID WINAPI SetDebugErrorLevel(DWORD dwLevel); - -#define SLE_ERROR 0x00000001 -#define SLE_MINORERROR 0x00000002 -#define SLE_WARNING 0x00000003 - - WINUSERAPI VOID WINAPI SetLastErrorEx(DWORD dwErrCode,DWORD dwType); - WINUSERAPI int WINAPI InternalGetWindowText(HWND hWnd,LPWSTR pString,int cchMaxCount); - -#ifdef WINNT - WINUSERAPI WINBOOL WINAPI EndTask(HWND hWnd,WINBOOL fShutDown,WINBOOL fForce); -#endif - -#define MONITOR_DEFAULTTONULL 0x00000000 -#define MONITOR_DEFAULTTOPRIMARY 0x00000001 -#define MONITOR_DEFAULTTONEAREST 0x00000002 - - WINUSERAPI HMONITOR WINAPI MonitorFromPoint(POINT pt,DWORD dwFlags); - WINUSERAPI HMONITOR WINAPI MonitorFromRect(LPCRECT lprc,DWORD dwFlags); - WINUSERAPI HMONITOR WINAPI MonitorFromWindow(HWND hwnd,DWORD dwFlags); - -#define MONITORINFOF_PRIMARY 0x00000001 - -#ifndef CCHDEVICENAME -#define CCHDEVICENAME 32 -#endif - - typedef struct tagMONITORINFO { - DWORD cbSize; - RECT rcMonitor; - RECT rcWork; - DWORD dwFlags; - } MONITORINFO,*LPMONITORINFO; - -#ifdef __cplusplus - typedef struct tagMONITORINFOEXA : public tagMONITORINFO { - CHAR szDevice[CCHDEVICENAME]; - } MONITORINFOEXA,*LPMONITORINFOEXA; - - typedef struct tagMONITORINFOEXW : public tagMONITORINFO { - WCHAR szDevice[CCHDEVICENAME]; - } MONITORINFOEXW,*LPMONITORINFOEXW; - -#ifdef UNICODE - typedef MONITORINFOEXW MONITORINFOEX; - typedef LPMONITORINFOEXW LPMONITORINFOEX; -#else - typedef MONITORINFOEXA MONITORINFOEX; - typedef LPMONITORINFOEXA LPMONITORINFOEX; -#endif -#else - typedef struct tagMONITORINFOEXA { - MONITORINFO mi; - CHAR szDevice[CCHDEVICENAME]; - } MONITORINFOEXA,*LPMONITORINFOEXA; - - typedef struct tagMONITORINFOEXW { - MONITORINFO mi; - WCHAR szDevice[CCHDEVICENAME]; - } MONITORINFOEXW,*LPMONITORINFOEXW; -#ifdef UNICODE - typedef MONITORINFOEXW MONITORINFOEX; - typedef LPMONITORINFOEXW LPMONITORINFOEX; -#else - typedef MONITORINFOEXA MONITORINFOEX; - typedef LPMONITORINFOEXA LPMONITORINFOEX; -#endif -#endif - -#ifdef UNICODE -#define GetMonitorInfo GetMonitorInfoW -#else -#define GetMonitorInfo GetMonitorInfoA -#endif - - WINUSERAPI WINBOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor,LPMONITORINFO lpmi); - WINUSERAPI WINBOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor,LPMONITORINFO lpmi); - - typedef WINBOOL (CALLBACK *MONITORENUMPROC)(HMONITOR,HDC,LPRECT,LPARAM); - - WINUSERAPI WINBOOL WINAPI EnumDisplayMonitors(HDC hdc,LPCRECT lprcClip,MONITORENUMPROC lpfnEnum,LPARAM dwData); - -#ifndef NOWINABLE - WINUSERAPI VOID WINAPI NotifyWinEvent(DWORD event,HWND hwnd,LONG idObject,LONG idChild); - - typedef VOID (CALLBACK *WINEVENTPROC)(HWINEVENTHOOK hWinEventHook,DWORD event,HWND hwnd,LONG idObject,LONG idChild,DWORD idEventThread,DWORD dwmsEventTime); - - WINUSERAPI HWINEVENTHOOK WINAPI SetWinEventHook(DWORD eventMin,DWORD eventMax,HMODULE hmodWinEventProc,WINEVENTPROC pfnWinEventProc,DWORD idProcess,DWORD idThread,DWORD dwFlags); - WINUSERAPI WINBOOL WINAPI IsWinEventHookInstalled(DWORD event); - -#define WINEVENT_OUTOFCONTEXT 0x0000 -#define WINEVENT_SKIPOWNTHREAD 0x0001 -#define WINEVENT_SKIPOWNPROCESS 0x0002 -#define WINEVENT_INCONTEXT 0x0004 - - WINUSERAPI WINBOOL WINAPI UnhookWinEvent(HWINEVENTHOOK hWinEventHook); - -#define CHILDID_SELF 0 -#define INDEXID_OBJECT 0 -#define INDEXID_CONTAINER 0 - -#define OBJID_WINDOW ((LONG)0x00000000) -#define OBJID_SYSMENU ((LONG)0xFFFFFFFF) -#define OBJID_TITLEBAR ((LONG)0xFFFFFFFE) -#define OBJID_MENU ((LONG)0xFFFFFFFD) -#define OBJID_CLIENT ((LONG)0xFFFFFFFC) -#define OBJID_VSCROLL ((LONG)0xFFFFFFFB) -#define OBJID_HSCROLL ((LONG)0xFFFFFFFA) -#define OBJID_SIZEGRIP ((LONG)0xFFFFFFF9) -#define OBJID_CARET ((LONG)0xFFFFFFF8) -#define OBJID_CURSOR ((LONG)0xFFFFFFF7) -#define OBJID_ALERT ((LONG)0xFFFFFFF6) -#define OBJID_SOUND ((LONG)0xFFFFFFF5) -#define OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFFFFFF4) -#define OBJID_NATIVEOM ((LONG)0xFFFFFFF0) - -#define EVENT_MIN 0x00000001 -#define EVENT_MAX 0x7FFFFFFF - -#define EVENT_SYSTEM_SOUND 0x0001 -#define EVENT_SYSTEM_ALERT 0x0002 -#define EVENT_SYSTEM_FOREGROUND 0x0003 -#define EVENT_SYSTEM_MENUSTART 0x0004 -#define EVENT_SYSTEM_MENUEND 0x0005 -#define EVENT_SYSTEM_MENUPOPUPSTART 0x0006 -#define EVENT_SYSTEM_MENUPOPUPEND 0x0007 -#define EVENT_SYSTEM_CAPTURESTART 0x0008 -#define EVENT_SYSTEM_CAPTUREEND 0x0009 -#define EVENT_SYSTEM_MOVESIZESTART 0x000A -#define EVENT_SYSTEM_MOVESIZEEND 0x000B -#define EVENT_SYSTEM_CONTEXTHELPSTART 0x000C -#define EVENT_SYSTEM_CONTEXTHELPEND 0x000D -#define EVENT_SYSTEM_DRAGDROPSTART 0x000E -#define EVENT_SYSTEM_DRAGDROPEND 0x000F -#define EVENT_SYSTEM_DIALOGSTART 0x0010 -#define EVENT_SYSTEM_DIALOGEND 0x0011 -#define EVENT_SYSTEM_SCROLLINGSTART 0x0012 -#define EVENT_SYSTEM_SCROLLINGEND 0x0013 -#define EVENT_SYSTEM_SWITCHSTART 0x0014 -#define EVENT_SYSTEM_SWITCHEND 0x0015 -#define EVENT_SYSTEM_MINIMIZESTART 0x0016 -#define EVENT_SYSTEM_MINIMIZEEND 0x0017 - -#define EVENT_CONSOLE_CARET 0x4001 -#define EVENT_CONSOLE_UPDATE_REGION 0x4002 -#define EVENT_CONSOLE_UPDATE_SIMPLE 0x4003 -#define EVENT_CONSOLE_UPDATE_SCROLL 0x4004 -#define EVENT_CONSOLE_LAYOUT 0x4005 -#define EVENT_CONSOLE_START_APPLICATION 0x4006 -#define EVENT_CONSOLE_END_APPLICATION 0x4007 - -#define CONSOLE_APPLICATION_16BIT 0x0001 - -#define CONSOLE_CARET_SELECTION 0x0001 -#define CONSOLE_CARET_VISIBLE 0x0002 - -#define EVENT_OBJECT_CREATE 0x8000 -#define EVENT_OBJECT_DESTROY 0x8001 -#define EVENT_OBJECT_SHOW 0x8002 -#define EVENT_OBJECT_HIDE 0x8003 -#define EVENT_OBJECT_REORDER 0x8004 - -#define EVENT_OBJECT_FOCUS 0x8005 -#define EVENT_OBJECT_SELECTION 0x8006 -#define EVENT_OBJECT_SELECTIONADD 0x8007 -#define EVENT_OBJECT_SELECTIONREMOVE 0x8008 -#define EVENT_OBJECT_SELECTIONWITHIN 0x8009 - -#define EVENT_OBJECT_STATECHANGE 0x800A - -#define EVENT_OBJECT_LOCATIONCHANGE 0x800B - -#define EVENT_OBJECT_NAMECHANGE 0x800C -#define EVENT_OBJECT_DESCRIPTIONCHANGE 0x800D -#define EVENT_OBJECT_VALUECHANGE 0x800E -#define EVENT_OBJECT_PARENTCHANGE 0x800F -#define EVENT_OBJECT_HELPCHANGE 0x8010 -#define EVENT_OBJECT_DEFACTIONCHANGE 0x8011 -#define EVENT_OBJECT_ACCELERATORCHANGE 0x8012 - -#define SOUND_SYSTEM_STARTUP 1 -#define SOUND_SYSTEM_SHUTDOWN 2 -#define SOUND_SYSTEM_BEEP 3 -#define SOUND_SYSTEM_ERROR 4 -#define SOUND_SYSTEM_QUESTION 5 -#define SOUND_SYSTEM_WARNING 6 -#define SOUND_SYSTEM_INFORMATION 7 -#define SOUND_SYSTEM_MAXIMIZE 8 -#define SOUND_SYSTEM_MINIMIZE 9 -#define SOUND_SYSTEM_RESTOREUP 10 -#define SOUND_SYSTEM_RESTOREDOWN 11 -#define SOUND_SYSTEM_APPSTART 12 -#define SOUND_SYSTEM_FAULT 13 -#define SOUND_SYSTEM_APPEND 14 -#define SOUND_SYSTEM_MENUCOMMAND 15 -#define SOUND_SYSTEM_MENUPOPUP 16 -#define CSOUND_SYSTEM 16 - -#define ALERT_SYSTEM_INFORMATIONAL 1 -#define ALERT_SYSTEM_WARNING 2 -#define ALERT_SYSTEM_ERROR 3 -#define ALERT_SYSTEM_QUERY 4 -#define ALERT_SYSTEM_CRITICAL 5 -#define CALERT_SYSTEM 6 - - typedef struct tagGUITHREADINFO { - DWORD cbSize; - DWORD flags; - HWND hwndActive; - HWND hwndFocus; - HWND hwndCapture; - HWND hwndMenuOwner; - HWND hwndMoveSize; - HWND hwndCaret; - RECT rcCaret; - } GUITHREADINFO,*PGUITHREADINFO,*LPGUITHREADINFO; - -#define GUI_CARETBLINKING 0x00000001 -#define GUI_INMOVESIZE 0x00000002 -#define GUI_INMENUMODE 0x00000004 -#define GUI_SYSTEMMENUMODE 0x00000008 -#define GUI_POPUPMENUMODE 0x00000010 -#define GUI_16BITTASK 0x00000020 - -#ifdef UNICODE -#define GetWindowModuleFileName GetWindowModuleFileNameW -#else -#define GetWindowModuleFileName GetWindowModuleFileNameA -#endif - - WINUSERAPI WINBOOL WINAPI GetGUIThreadInfo(DWORD idThread,PGUITHREADINFO pgui); - WINUSERAPI UINT WINAPI GetWindowModuleFileNameA(HWND hwnd,LPSTR pszFileName,UINT cchFileNameMax); - WINUSERAPI UINT WINAPI GetWindowModuleFileNameW(HWND hwnd,LPWSTR pszFileName,UINT cchFileNameMax); - -#ifndef NO_STATE_FLAGS -#define STATE_SYSTEM_UNAVAILABLE 0x00000001 -#define STATE_SYSTEM_SELECTED 0x00000002 -#define STATE_SYSTEM_FOCUSED 0x00000004 -#define STATE_SYSTEM_PRESSED 0x00000008 -#define STATE_SYSTEM_CHECKED 0x00000010 -#define STATE_SYSTEM_MIXED 0x00000020 -#define STATE_SYSTEM_INDETERMINATE STATE_SYSTEM_MIXED -#define STATE_SYSTEM_READONLY 0x00000040 -#define STATE_SYSTEM_HOTTRACKED 0x00000080 -#define STATE_SYSTEM_DEFAULT 0x00000100 -#define STATE_SYSTEM_EXPANDED 0x00000200 -#define STATE_SYSTEM_COLLAPSED 0x00000400 -#define STATE_SYSTEM_BUSY 0x00000800 -#define STATE_SYSTEM_FLOATING 0x00001000 -#define STATE_SYSTEM_MARQUEED 0x00002000 -#define STATE_SYSTEM_ANIMATED 0x00004000 -#define STATE_SYSTEM_INVISIBLE 0x00008000 -#define STATE_SYSTEM_OFFSCREEN 0x00010000 -#define STATE_SYSTEM_SIZEABLE 0x00020000 -#define STATE_SYSTEM_MOVEABLE 0x00040000 -#define STATE_SYSTEM_SELFVOICING 0x00080000 -#define STATE_SYSTEM_FOCUSABLE 0x00100000 -#define STATE_SYSTEM_SELECTABLE 0x00200000 -#define STATE_SYSTEM_LINKED 0x00400000 -#define STATE_SYSTEM_TRAVERSED 0x00800000 -#define STATE_SYSTEM_MULTISELECTABLE 0x01000000 -#define STATE_SYSTEM_EXTSELECTABLE 0x02000000 -#define STATE_SYSTEM_ALERT_LOW 0x04000000 -#define STATE_SYSTEM_ALERT_MEDIUM 0x08000000 -#define STATE_SYSTEM_ALERT_HIGH 0x10000000 -#define STATE_SYSTEM_PROTECTED 0x20000000 -#define STATE_SYSTEM_VALID 0x3FFFFFFF -#endif - -#define CCHILDREN_TITLEBAR 5 -#define CCHILDREN_SCROLLBAR 5 - - typedef struct tagCURSORINFO { - DWORD cbSize; - DWORD flags; - HCURSOR hCursor; - POINT ptScreenPos; - } CURSORINFO,*PCURSORINFO,*LPCURSORINFO; - -#define CURSOR_SHOWING 0x00000001 - - WINUSERAPI WINBOOL WINAPI GetCursorInfo(PCURSORINFO pci); - - typedef struct tagWINDOWINFO { - DWORD cbSize; - RECT rcWindow; - RECT rcClient; - DWORD dwStyle; - DWORD dwExStyle; - DWORD dwWindowStatus; - UINT cxWindowBorders; - UINT cyWindowBorders; - ATOM atomWindowType; - WORD wCreatorVersion; - } WINDOWINFO,*PWINDOWINFO,*LPWINDOWINFO; - -#define WS_ACTIVECAPTION 0x0001 - - WINUSERAPI WINBOOL WINAPI GetWindowInfo(HWND hwnd,PWINDOWINFO pwi); - - typedef struct tagTITLEBARINFO { - DWORD cbSize; - RECT rcTitleBar; - DWORD rgstate[CCHILDREN_TITLEBAR + 1]; - } TITLEBARINFO,*PTITLEBARINFO,*LPTITLEBARINFO; - - WINUSERAPI WINBOOL WINAPI GetTitleBarInfo(HWND hwnd,PTITLEBARINFO pti); - - typedef struct tagMENUBARINFO { - DWORD cbSize; - RECT rcBar; - HMENU hMenu; - HWND hwndMenu; - WINBOOL fBarFocused:1; - WINBOOL fFocused:1; - } MENUBARINFO,*PMENUBARINFO,*LPMENUBARINFO; - - WINUSERAPI WINBOOL WINAPI GetMenuBarInfo(HWND hwnd,LONG idObject,LONG idItem,PMENUBARINFO pmbi); - - typedef struct tagSCROLLBARINFO { - DWORD cbSize; - RECT rcScrollBar; - int dxyLineButton; - int xyThumbTop; - int xyThumbBottom; - int reserved; - DWORD rgstate[CCHILDREN_SCROLLBAR + 1]; - } SCROLLBARINFO,*PSCROLLBARINFO,*LPSCROLLBARINFO; - - WINUSERAPI WINBOOL WINAPI GetScrollBarInfo(HWND hwnd,LONG idObject,PSCROLLBARINFO psbi); - - typedef struct tagCOMBOBOXINFO { - DWORD cbSize; - RECT rcItem; - RECT rcButton; - DWORD stateButton; - HWND hwndCombo; - HWND hwndItem; - HWND hwndList; - } COMBOBOXINFO,*PCOMBOBOXINFO,*LPCOMBOBOXINFO; - - WINUSERAPI WINBOOL WINAPI GetComboBoxInfo(HWND hwndCombo,PCOMBOBOXINFO pcbi); - -#define GA_PARENT 1 -#define GA_ROOT 2 -#define GA_ROOTOWNER 3 - - WINUSERAPI HWND WINAPI GetAncestor(HWND hwnd,UINT gaFlags); - WINUSERAPI HWND WINAPI RealChildWindowFromPoint(HWND hwndParent,POINT ptParentClientCoords); - WINUSERAPI UINT WINAPI RealGetWindowClassA(HWND hwnd,LPSTR ptszClassName,UINT cchClassNameMax); - WINUSERAPI UINT WINAPI RealGetWindowClassW(HWND hwnd,LPWSTR ptszClassName,UINT cchClassNameMax); -#ifdef UNICODE -#define RealGetWindowClass RealGetWindowClassW -#else -#define RealGetWindowClass RealGetWindowClassA -#endif - - typedef struct tagALTTABINFO { - DWORD cbSize; - int cItems; - int cColumns; - int cRows; - int iColFocus; - int iRowFocus; - int cxItem; - int cyItem; - POINT ptStart; - } ALTTABINFO,*PALTTABINFO,*LPALTTABINFO; - -#ifdef UNICODE -#define GetAltTabInfo GetAltTabInfoW -#else -#define GetAltTabInfo GetAltTabInfoA -#endif - - WINUSERAPI WINBOOL WINAPI GetAltTabInfoA(HWND hwnd,int iItem,PALTTABINFO pati,LPSTR pszItemText,UINT cchItemText); - WINUSERAPI WINBOOL WINAPI GetAltTabInfoW(HWND hwnd,int iItem,PALTTABINFO pati,LPWSTR pszItemText,UINT cchItemText); - WINUSERAPI DWORD WINAPI GetListBoxInfo(HWND hwnd); -#endif - - WINUSERAPI WINBOOL WINAPI LockWorkStation(VOID); - WINUSERAPI WINBOOL WINAPI UserHandleGrantAccess(HANDLE hUserHandle,HANDLE hJob,WINBOOL bGrant); - - DECLARE_HANDLE(HRAWINPUT); - -#define GET_RAWINPUT_CODE_WPARAM(wParam) ((wParam) & 0xff) - -#define RIM_INPUT 0 -#define RIM_INPUTSINK 1 - - typedef struct tagRAWINPUTHEADER { - DWORD dwType; - DWORD dwSize; - HANDLE hDevice; - WPARAM wParam; - } RAWINPUTHEADER,*PRAWINPUTHEADER,*LPRAWINPUTHEADER; - -#define RIM_TYPEMOUSE 0 -#define RIM_TYPEKEYBOARD 1 -#define RIM_TYPEHID 2 - - typedef struct tagRAWMOUSE { - USHORT usFlags; - union { - ULONG ulButtons; - struct { - USHORT usButtonFlags; - USHORT usButtonData; - }; - }; - ULONG ulRawButtons; - LONG lLastX; - LONG lLastY; - ULONG ulExtraInformation; - } RAWMOUSE,*PRAWMOUSE,*LPRAWMOUSE; - -#define RI_MOUSE_LEFT_BUTTON_DOWN 0x0001 -#define RI_MOUSE_LEFT_BUTTON_UP 0x0002 -#define RI_MOUSE_RIGHT_BUTTON_DOWN 0x0004 -#define RI_MOUSE_RIGHT_BUTTON_UP 0x0008 -#define RI_MOUSE_MIDDLE_BUTTON_DOWN 0x0010 -#define RI_MOUSE_MIDDLE_BUTTON_UP 0x0020 - -#define RI_MOUSE_BUTTON_1_DOWN RI_MOUSE_LEFT_BUTTON_DOWN -#define RI_MOUSE_BUTTON_1_UP RI_MOUSE_LEFT_BUTTON_UP -#define RI_MOUSE_BUTTON_2_DOWN RI_MOUSE_RIGHT_BUTTON_DOWN -#define RI_MOUSE_BUTTON_2_UP RI_MOUSE_RIGHT_BUTTON_UP -#define RI_MOUSE_BUTTON_3_DOWN RI_MOUSE_MIDDLE_BUTTON_DOWN -#define RI_MOUSE_BUTTON_3_UP RI_MOUSE_MIDDLE_BUTTON_UP - -#define RI_MOUSE_BUTTON_4_DOWN 0x0040 -#define RI_MOUSE_BUTTON_4_UP 0x0080 -#define RI_MOUSE_BUTTON_5_DOWN 0x0100 -#define RI_MOUSE_BUTTON_5_UP 0x0200 - -#define RI_MOUSE_WHEEL 0x0400 - -#define MOUSE_MOVE_RELATIVE 0 -#define MOUSE_MOVE_ABSOLUTE 1 -#define MOUSE_VIRTUAL_DESKTOP 0x02 -#define MOUSE_ATTRIBUTES_CHANGED 0x04 - - typedef struct tagRAWKEYBOARD { - USHORT MakeCode; - USHORT Flags; - USHORT Reserved; - USHORT VKey; - UINT Message; - ULONG ExtraInformation; - } RAWKEYBOARD,*PRAWKEYBOARD,*LPRAWKEYBOARD; - -#define KEYBOARD_OVERRUN_MAKE_CODE 0xFF - -#define RI_KEY_MAKE 0 -#define RI_KEY_BREAK 1 -#define RI_KEY_E0 2 -#define RI_KEY_E1 4 -#define RI_KEY_TERMSRV_SET_LED 8 -#define RI_KEY_TERMSRV_SHADOW 0x10 - - typedef struct tagRAWHID { - DWORD dwSizeHid; - DWORD dwCount; - BYTE bRawData[1]; - } RAWHID,*PRAWHID,*LPRAWHID; - - typedef struct tagRAWINPUT { - RAWINPUTHEADER header; - union { - RAWMOUSE mouse; - RAWKEYBOARD keyboard; - RAWHID hid; - } data; - } RAWINPUT,*PRAWINPUT,*LPRAWINPUT; - -#ifdef _WIN64 -#define RAWINPUT_ALIGN(x) (((x) + sizeof(QWORD) - 1) & ~(sizeof(QWORD) - 1)) -#else -#define RAWINPUT_ALIGN(x) (((x) + sizeof(DWORD) - 1) & ~(sizeof(DWORD) - 1)) -#endif - -#define NEXTRAWINPUTBLOCK(ptr) ((PRAWINPUT)RAWINPUT_ALIGN((ULONG_PTR)((PBYTE)(ptr) + (ptr)->header.dwSize))) - -#define RID_INPUT 0x10000003 -#define RID_HEADER 0x10000005 - - WINUSERAPI UINT WINAPI GetRawInputData(HRAWINPUT hRawInput,UINT uiCommand,LPVOID pData,PUINT pcbSize,UINT cbSizeHeader); - -#define RIDI_PREPARSEDDATA 0x20000005 -#define RIDI_DEVICENAME 0x20000007 -#define RIDI_DEVICEINFO 0x2000000b - - typedef struct tagRID_DEVICE_INFO_MOUSE { - DWORD dwId; - DWORD dwNumberOfButtons; - DWORD dwSampleRate; - } RID_DEVICE_INFO_MOUSE,*PRID_DEVICE_INFO_MOUSE; - - typedef struct tagRID_DEVICE_INFO_KEYBOARD { - DWORD dwType; - DWORD dwSubType; - DWORD dwKeyboardMode; - DWORD dwNumberOfFunctionKeys; - DWORD dwNumberOfIndicators; - DWORD dwNumberOfKeysTotal; - } RID_DEVICE_INFO_KEYBOARD,*PRID_DEVICE_INFO_KEYBOARD; - - typedef struct tagRID_DEVICE_INFO_HID { - DWORD dwVendorId; - DWORD dwProductId; - DWORD dwVersionNumber; - USHORT usUsagePage; - USHORT usUsage; - } RID_DEVICE_INFO_HID,*PRID_DEVICE_INFO_HID; - - typedef struct tagRID_DEVICE_INFO { - DWORD cbSize; - DWORD dwType; - union { - RID_DEVICE_INFO_MOUSE mouse; - RID_DEVICE_INFO_KEYBOARD keyboard; - RID_DEVICE_INFO_HID hid; - }; - } RID_DEVICE_INFO,*PRID_DEVICE_INFO,*LPRID_DEVICE_INFO; - -#ifdef UNICODE -#define GetRawInputDeviceInfo GetRawInputDeviceInfoW -#else -#define GetRawInputDeviceInfo GetRawInputDeviceInfoA -#endif - - WINUSERAPI UINT WINAPI GetRawInputDeviceInfoA(HANDLE hDevice,UINT uiCommand,LPVOID pData,PUINT pcbSize); - WINUSERAPI UINT WINAPI GetRawInputDeviceInfoW(HANDLE hDevice,UINT uiCommand,LPVOID pData,PUINT pcbSize); - WINUSERAPI UINT WINAPI GetRawInputBuffer(PRAWINPUT pData,PUINT pcbSize,UINT cbSizeHeader); - - typedef struct tagRAWINPUTDEVICE { - USHORT usUsagePage; - USHORT usUsage; - DWORD dwFlags; - HWND hwndTarget; - } RAWINPUTDEVICE,*PRAWINPUTDEVICE,*LPRAWINPUTDEVICE; - - typedef CONST RAWINPUTDEVICE *PCRAWINPUTDEVICE; - -#define RIDEV_REMOVE 0x00000001 -#define RIDEV_EXCLUDE 0x00000010 -#define RIDEV_PAGEONLY 0x00000020 -#define RIDEV_NOLEGACY 0x00000030 -#define RIDEV_INPUTSINK 0x00000100 -#define RIDEV_CAPTUREMOUSE 0x00000200 -#define RIDEV_NOHOTKEYS 0x00000200 -#define RIDEV_APPKEYS 0x00000400 -#define RIDEV_EXMODEMASK 0x000000F0 -#define RIDEV_EXMODE(mode) ((mode) & RIDEV_EXMODEMASK) - - WINUSERAPI WINBOOL WINAPI RegisterRawInputDevices(PCRAWINPUTDEVICE pRawInputDevices,UINT uiNumDevices,UINT cbSize); - WINUSERAPI UINT WINAPI GetRegisteredRawInputDevices(PRAWINPUTDEVICE pRawInputDevices,PUINT puiNumDevices,UINT cbSize); - - typedef struct tagRAWINPUTDEVICELIST { - HANDLE hDevice; - DWORD dwType; - } RAWINPUTDEVICELIST,*PRAWINPUTDEVICELIST; - - WINUSERAPI UINT WINAPI GetRawInputDeviceList(PRAWINPUTDEVICELIST pRawInputDeviceList,PUINT puiNumDevices,UINT cbSize); - WINUSERAPI LRESULT WINAPI DefRawInputProc(PRAWINPUT *paRawInput,INT nInput,UINT cbSizeHeader); - -#endif /* NOUSER */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/winver.h b/win32/include/winapi/winver.h deleted file mode 100644 index 5c0f036b..00000000 --- a/win32/include/winapi/winver.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef VER_H -#define VER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define VS_FILE_INFO RT_VERSION -#define VS_VERSION_INFO 1 -#define VS_USER_DEFINED 100 - -#define VS_FFI_SIGNATURE 0xFEEF04BDL -#define VS_FFI_STRUCVERSION 0x00010000L -#define VS_FFI_FILEFLAGSMASK 0x0000003FL - -#define VS_FF_DEBUG 0x00000001L -#define VS_FF_PRERELEASE 0x00000002L -#define VS_FF_PATCHED 0x00000004L -#define VS_FF_PRIVATEBUILD 0x00000008L -#define VS_FF_INFOINFERRED 0x00000010L -#define VS_FF_SPECIALBUILD 0x00000020L - -#define VOS_UNKNOWN 0x00000000L -#define VOS_DOS 0x00010000L -#define VOS_OS216 0x00020000L -#define VOS_OS232 0x00030000L -#define VOS_NT 0x00040000L -#define VOS_WINCE 0x00050000L - -#define VOS__BASE 0x00000000L -#define VOS__WINDOWS16 0x00000001L -#define VOS__PM16 0x00000002L -#define VOS__PM32 0x00000003L -#define VOS__WINDOWS32 0x00000004L - -#define VOS_DOS_WINDOWS16 0x00010001L -#define VOS_DOS_WINDOWS32 0x00010004L -#define VOS_OS216_PM16 0x00020002L -#define VOS_OS232_PM32 0x00030003L -#define VOS_NT_WINDOWS32 0x00040004L - -#define VFT_UNKNOWN 0x00000000L -#define VFT_APP 0x00000001L -#define VFT_DLL 0x00000002L -#define VFT_DRV 0x00000003L -#define VFT_FONT 0x00000004L -#define VFT_VXD 0x00000005L -#define VFT_STATIC_LIB 0x00000007L - -#define VFT2_UNKNOWN 0x00000000L -#define VFT2_DRV_PRINTER 0x00000001L -#define VFT2_DRV_KEYBOARD 0x00000002L -#define VFT2_DRV_LANGUAGE 0x00000003L -#define VFT2_DRV_DISPLAY 0x00000004L -#define VFT2_DRV_MOUSE 0x00000005L -#define VFT2_DRV_NETWORK 0x00000006L -#define VFT2_DRV_SYSTEM 0x00000007L -#define VFT2_DRV_INSTALLABLE 0x00000008L -#define VFT2_DRV_SOUND 0x00000009L -#define VFT2_DRV_COMM 0x0000000AL -#define VFT2_DRV_INPUTMETHOD 0x0000000BL -#define VFT2_DRV_VERSIONED_PRINTER 0x0000000CL - -#define VFT2_FONT_RASTER 0x00000001L -#define VFT2_FONT_VECTOR 0x00000002L -#define VFT2_FONT_TRUETYPE 0x00000003L - -#define VFFF_ISSHAREDFILE 0x0001 - -#define VFF_CURNEDEST 0x0001 -#define VFF_FILEINUSE 0x0002 -#define VFF_BUFFTOOSMALL 0x0004 - -#define VIFF_FORCEINSTALL 0x0001 -#define VIFF_DONTDELETEOLD 0x0002 - -#define VIF_TEMPFILE 0x00000001L -#define VIF_MISMATCH 0x00000002L -#define VIF_SRCOLD 0x00000004L - -#define VIF_DIFFLANG 0x00000008L -#define VIF_DIFFCODEPG 0x00000010L -#define VIF_DIFFTYPE 0x00000020L - -#define VIF_WRITEPROT 0x00000040L -#define VIF_FILEINUSE 0x00000080L -#define VIF_OUTOFSPACE 0x00000100L -#define VIF_ACCESSVIOLATION 0x00000200L -#define VIF_SHARINGVIOLATION 0x00000400L -#define VIF_CANNOTCREATE 0x00000800L -#define VIF_CANNOTDELETE 0x00001000L -#define VIF_CANNOTRENAME 0x00002000L -#define VIF_CANNOTDELETECUR 0x00004000L -#define VIF_OUTOFMEMORY 0x00008000L - -#define VIF_CANNOTREADSRC 0x00010000L -#define VIF_CANNOTREADDST 0x00020000L - -#define VIF_BUFFTOOSMALL 0x00040000L -#define VIF_CANNOTLOADLZ32 0x00080000L -#define VIF_CANNOTLOADCABINET 0x00100000L - -#ifndef RC_INVOKED - - typedef struct tagVS_FIXEDFILEINFO - { - DWORD dwSignature; - DWORD dwStrucVersion; - DWORD dwFileVersionMS; - DWORD dwFileVersionLS; - DWORD dwProductVersionMS; - DWORD dwProductVersionLS; - DWORD dwFileFlagsMask; - DWORD dwFileFlags; - DWORD dwFileOS; - DWORD dwFileType; - DWORD dwFileSubtype; - DWORD dwFileDateMS; - DWORD dwFileDateLS; - } VS_FIXEDFILEINFO; - -#ifdef UNICODE -#define VerFindFile VerFindFileW -#define VerInstallFile VerInstallFileW -#define GetFileVersionInfoSize GetFileVersionInfoSizeW -#define GetFileVersionInfo GetFileVersionInfoW -#define VerLanguageName VerLanguageNameW -#define VerQueryValue VerQueryValueW -#else -#define VerFindFile VerFindFileA -#define VerInstallFile VerInstallFileA -#define GetFileVersionInfoSize GetFileVersionInfoSizeA -#define GetFileVersionInfo GetFileVersionInfoA -#define VerLanguageName VerLanguageNameA -#define VerQueryValue VerQueryValueA -#endif - - DWORD WINAPI VerFindFileA(DWORD uFlags,LPSTR szFileName,LPSTR szWinDir,LPSTR szAppDir,LPSTR szCurDir,PUINT lpuCurDirLen,LPSTR szDestDir,PUINT lpuDestDirLen); - DWORD WINAPI VerFindFileW(DWORD uFlags,LPWSTR szFileName,LPWSTR szWinDir,LPWSTR szAppDir,LPWSTR szCurDir,PUINT lpuCurDirLen,LPWSTR szDestDir,PUINT lpuDestDirLen); - DWORD WINAPI VerInstallFileA(DWORD uFlags,LPSTR szSrcFileName,LPSTR szDestFileName,LPSTR szSrcDir,LPSTR szDestDir,LPSTR szCurDir,LPSTR szTmpFile,PUINT lpuTmpFileLen); - DWORD WINAPI VerInstallFileW(DWORD uFlags,LPWSTR szSrcFileName,LPWSTR szDestFileName,LPWSTR szSrcDir,LPWSTR szDestDir,LPWSTR szCurDir,LPWSTR szTmpFile,PUINT lpuTmpFileLen); - DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR lptstrFilename,LPDWORD lpdwHandle); - DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR lptstrFilename,LPDWORD lpdwHandle); - WINBOOL WINAPI GetFileVersionInfoA(LPCSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); - WINBOOL WINAPI GetFileVersionInfoW(LPCWSTR lptstrFilename,DWORD dwHandle,DWORD dwLen,LPVOID lpData); - DWORD WINAPI VerLanguageNameA(DWORD wLang,LPSTR szLang,DWORD nSize); - DWORD WINAPI VerLanguageNameW(DWORD wLang,LPWSTR szLang,DWORD nSize); - WINBOOL WINAPI VerQueryValueA(const LPVOID pBlock,LPSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); - WINBOOL WINAPI VerQueryValueW(const LPVOID pBlock,LPWSTR lpSubBlock,LPVOID *lplpBuffer,PUINT puLen); -#endif - -#ifdef __cplusplus -} -#endif -#endif diff --git a/win32/include/winapi/ws2ipdef.h b/win32/include/winapi/ws2ipdef.h deleted file mode 100644 index 1f6c1c06..00000000 --- a/win32/include/winapi/ws2ipdef.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _WS2IPDEF_H -#define _WS2IPDEF_H - -#if __GNUC__ >=3 -#pragma GCC system_header -#endif - -#include - -struct ip_mreq { - struct in_addr imr_multiaddr; - struct in_addr imr_interface; -}; - -struct ip_mreq_source { - struct in_addr imr_multiaddr; - struct in_addr imr_sourceaddr; - struct in_addr imr_interface; -}; - -#endif diff --git a/win32/include/winapi/ws2tcpip.h b/win32/include/winapi/ws2tcpip.h deleted file mode 100644 index ac45767d..00000000 --- a/win32/include/winapi/ws2tcpip.h +++ /dev/null @@ -1,391 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the w64 mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within this package. - */ -#ifndef _WS2TCPIP_H -#define _WS2TCPIP_H - -#if __GNUC__ >=3 -#pragma GCC system_header -#endif - -#include - -struct ip_msfilter { - struct in_addr imsf_multiaddr; - struct in_addr imsf_interface; - u_long imsf_fmode; - u_long imsf_numsrc; - struct in_addr imsf_slist[1]; -}; - -#define IP_MSFILTER_SIZE(numsrc) (sizeof(struct ip_msfilter)-sizeof(struct in_addr) + (numsrc)*sizeof(struct in_addr)) - -#define MCAST_INCLUDE 0 -#define MCAST_EXCLUDE 1 - -#define SIO_GET_INTERFACE_LIST _IOR('t',127,u_long) - -#define SIO_GET_INTERFACE_LIST_EX _IOR('t',126,u_long) -#define SIO_SET_MULTICAST_FILTER _IOW('t',125,u_long) -#define SIO_GET_MULTICAST_FILTER _IOW('t',124 | IOC_IN,u_long) - -#define IP_OPTIONS 1 -#define IP_HDRINCL 2 -#define IP_TOS 3 -#define IP_TTL 4 -#define IP_MULTICAST_IF 9 -#define IP_MULTICAST_TTL 10 -#define IP_MULTICAST_LOOP 11 -#define IP_ADD_MEMBERSHIP 12 -#define IP_DROP_MEMBERSHIP 13 -#define IP_DONTFRAGMENT 14 -#define IP_ADD_SOURCE_MEMBERSHIP 15 -#define IP_DROP_SOURCE_MEMBERSHIP 16 -#define IP_BLOCK_SOURCE 17 -#define IP_UNBLOCK_SOURCE 18 -#define IP_PKTINFO 19 -#define IP_RECEIVE_BROADCAST 22 - -#define IPV6_HDRINCL 2 -#define IPV6_UNICAST_HOPS 4 -#define IPV6_MULTICAST_IF 9 -#define IPV6_MULTICAST_HOPS 10 -#define IPV6_MULTICAST_LOOP 11 -#define IPV6_ADD_MEMBERSHIP 12 -#define IPV6_DROP_MEMBERSHIP 13 -#define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP -#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP -#define IPV6_PKTINFO 19 -#define IPV6_HOPLIMIT 21 -#define IPV6_PROTECTION_LEVEL 23 - -#define PROTECTION_LEVEL_UNRESTRICTED 10 -#define PROTECTION_LEVEL_DEFAULT 20 -#define PROTECTION_LEVEL_RESTRICTED 30 - -#define UDP_NOCHECKSUM 1 -#define UDP_CHECKSUM_COVERAGE 20 - -#define TCP_EXPEDITED_1122 0x0002 - -#ifndef s6_addr - -struct in6_addr { - __MINGW_EXTENSION union { - u_char Byte[16]; - u_short Word[8]; - } u; -}; - -#define in_addr6 in6_addr - -#define _S6_un u -#define _S6_u8 Byte -#define s6_addr _S6_un._S6_u8 - -#define s6_bytes u.Byte -#define s6_words u.Word -#endif - -typedef struct ipv6_mreq { - struct in6_addr ipv6mr_multiaddr; - unsigned int ipv6mr_interface; -} IPV6_MREQ; - -struct sockaddr_in6_old { - short sin6_family; - u_short sin6_port; - u_long sin6_flowinfo; - struct in6_addr sin6_addr; -}; - -struct sockaddr_in6 { - short sin6_family; - u_short sin6_port; - u_long sin6_flowinfo; - struct in6_addr sin6_addr; - u_long sin6_scope_id; -}; - -typedef struct in6_addr IN6_ADDR; -typedef struct in6_addr *PIN6_ADDR; -typedef struct in6_addr *LPIN6_ADDR; - -typedef struct sockaddr_in6 SOCKADDR_IN6; -typedef struct sockaddr_in6 *PSOCKADDR_IN6; -typedef struct sockaddr_in6 *LPSOCKADDR_IN6; - -#define SS_PORT(ssp) (((struct sockaddr_in*)(ssp))->sin_port) - -#define IN6ADDR_ANY_INIT { 0 } -#define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } - -#ifdef __cplusplus -extern "C" { -#endif - - extern const struct in6_addr in6addr_any; - extern const struct in6_addr in6addr_loopback; - -#ifdef __cplusplus -} -#endif - -#define WS2TCPIP_INLINE __CRT_INLINE - -int IN6_ADDR_EQUAL(const struct in6_addr *,const struct in6_addr *); -int IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *); -int IN6_IS_ADDR_LOOPBACK(const struct in6_addr *); -int IN6_IS_ADDR_MULTICAST(const struct in6_addr *); -int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *); -int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *); -int IN6_IS_ADDR_V4MAPPED(const struct in6_addr *); -int IN6_IS_ADDR_V4COMPAT(const struct in6_addr *); -int IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *); -int IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *); -int IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *); -int IN6_IS_ADDR_MC_ORGLOCAL(const struct in6_addr *); -int IN6_IS_ADDR_MC_GLOBAL(const struct in6_addr *); -int IN6ADDR_ISANY(const struct sockaddr_in6 *); -int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *); -void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *); -void IN6_SET_ADDR_LOOPBACK(struct in6_addr *); -void IN6ADDR_SETANY(struct sockaddr_in6 *); -void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *); - -#ifndef __CRT__NO_INLINE -WS2TCPIP_INLINE int IN6_ADDR_EQUAL(const struct in6_addr *a,const struct in6_addr *b) { return (memcmp(a,b,sizeof(struct in6_addr))==0); } -WS2TCPIP_INLINE int IN6_IS_ADDR_UNSPECIFIED(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0) && (a->s6_words[6]==0) && (a->s6_words[7]==0)); } -WS2TCPIP_INLINE int IN6_IS_ADDR_LOOPBACK(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0) && (a->s6_words[6]==0) && (a->s6_words[7]==0x0100)); } -WS2TCPIP_INLINE int IN6_IS_ADDR_MULTICAST(const struct in6_addr *a) { return (a->s6_bytes[0]==0xff); } -WS2TCPIP_INLINE int IN6_IS_ADDR_LINKLOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0x80)); } -WS2TCPIP_INLINE int IN6_IS_ADDR_SITELOCAL(const struct in6_addr *a) { return ((a->s6_bytes[0]==0xfe) && ((a->s6_bytes[1] & 0xc0)==0xc0)); } -WS2TCPIP_INLINE int IN6_IS_ADDR_V4MAPPED(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0xffff)); } -WS2TCPIP_INLINE int IN6_IS_ADDR_V4COMPAT(const struct in6_addr *a) { return ((a->s6_words[0]==0) && (a->s6_words[1]==0) && (a->s6_words[2]==0) && (a->s6_words[3]==0) && (a->s6_words[4]==0) && (a->s6_words[5]==0) && !((a->s6_words[6]==0) && (a->s6_addr[14]==0) && ((a->s6_addr[15]==0) || (a->s6_addr[15]==1)))); } -WS2TCPIP_INLINE int IN6_IS_ADDR_MC_NODELOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==1); } -WS2TCPIP_INLINE int IN6_IS_ADDR_MC_LINKLOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==2); } -WS2TCPIP_INLINE int IN6_IS_ADDR_MC_SITELOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==5); } -WS2TCPIP_INLINE int IN6_IS_ADDR_MC_ORGLOCAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==8); } -WS2TCPIP_INLINE int IN6_IS_ADDR_MC_GLOBAL(const struct in6_addr *a) { return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_bytes[1] & 0xf)==0xe); } -WS2TCPIP_INLINE int IN6ADDR_ISANY(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_UNSPECIFIED(&a->sin6_addr)); } -WS2TCPIP_INLINE int IN6ADDR_ISLOOPBACK(const struct sockaddr_in6 *a) { return ((a->sin6_family==AF_INET6) && IN6_IS_ADDR_LOOPBACK(&a->sin6_addr)); } -WS2TCPIP_INLINE void IN6_SET_ADDR_UNSPECIFIED(struct in6_addr *a) { memset(a->s6_bytes,0,sizeof(struct in6_addr)); } -WS2TCPIP_INLINE void IN6_SET_ADDR_LOOPBACK(struct in6_addr *a) { - memset(a->s6_bytes,0,sizeof(struct in6_addr)); - a->s6_bytes[15] = 1; -} -WS2TCPIP_INLINE void IN6ADDR_SETANY(struct sockaddr_in6 *a) { - a->sin6_family = AF_INET6; - a->sin6_port = 0; - a->sin6_flowinfo = 0; - IN6_SET_ADDR_UNSPECIFIED(&a->sin6_addr); - a->sin6_scope_id = 0; -} -WS2TCPIP_INLINE void IN6ADDR_SETLOOPBACK(struct sockaddr_in6 *a) { - a->sin6_family = AF_INET6; - a->sin6_port = 0; - a->sin6_flowinfo = 0; - IN6_SET_ADDR_LOOPBACK(&a->sin6_addr); - a->sin6_scope_id = 0; -} -#endif /* !__CRT__NO_INLINE */ - -typedef union sockaddr_gen { - struct sockaddr Address; - struct sockaddr_in AddressIn; - struct sockaddr_in6_old AddressIn6; -} sockaddr_gen; - -typedef struct _INTERFACE_INFO { - u_long iiFlags; - sockaddr_gen iiAddress; - sockaddr_gen iiBroadcastAddress; - sockaddr_gen iiNetmask; -} INTERFACE_INFO,*LPINTERFACE_INFO; - -typedef struct _INTERFACE_INFO_EX { - u_long iiFlags; - SOCKET_ADDRESS iiAddress; - SOCKET_ADDRESS iiBroadcastAddress; - SOCKET_ADDRESS iiNetmask; -} INTERFACE_INFO_EX,*LPINTERFACE_INFO_EX; - -#define IFF_UP 0x00000001 -#define IFF_BROADCAST 0x00000002 -#define IFF_LOOPBACK 0x00000004 -#define IFF_POINTTOPOINT 0x00000008 -#define IFF_MULTICAST 0x00000010 - -typedef struct in_pktinfo { - IN_ADDR ipi_addr; - UINT ipi_ifindex; -} IN_PKTINFO; - -C_ASSERT(sizeof(IN_PKTINFO)==8); - -typedef struct in6_pktinfo { - IN6_ADDR ipi6_addr; - UINT ipi6_ifindex; -} IN6_PKTINFO; - -C_ASSERT(sizeof(IN6_PKTINFO)==20); - -#define EAI_AGAIN WSATRY_AGAIN -#define EAI_BADFLAGS WSAEINVAL -#define EAI_FAIL WSANO_RECOVERY -#define EAI_FAMILY WSAEAFNOSUPPORT -#define EAI_MEMORY WSA_NOT_ENOUGH_MEMORY - -#define EAI_NONAME WSAHOST_NOT_FOUND -#define EAI_SERVICE WSATYPE_NOT_FOUND -#define EAI_SOCKTYPE WSAESOCKTNOSUPPORT - -#define EAI_NODATA EAI_NONAME - -typedef struct addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - size_t ai_addrlen; - char *ai_canonname; - struct sockaddr *ai_addr; - struct addrinfo *ai_next; -} ADDRINFOA,*PADDRINFOA; - -typedef struct addrinfoW { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - size_t ai_addrlen; - PWSTR ai_canonname; - struct sockaddr *ai_addr; - struct addrinfoW *ai_next; -} ADDRINFOW,*PADDRINFOW; - -#ifdef UNICODE -typedef ADDRINFOW ADDRINFOT,*PADDRINFOT; -#else -typedef ADDRINFOA ADDRINFOT,*PADDRINFOT; -#endif - -typedef ADDRINFOA ADDRINFO,*LPADDRINFO; - -#define AI_PASSIVE 0x1 -#define AI_CANONNAME 0x2 -#define AI_NUMERICHOST 0x4 - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef UNICODE -#define GetAddrInfo GetAddrInfoW -#else -#define GetAddrInfo GetAddrInfoA -#endif - - WINSOCK_API_LINKAGE int WSAAPI getaddrinfo(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res); - WINSOCK_API_LINKAGE int WSAAPI GetAddrInfoW(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult); - -#define GetAddrInfoA getaddrinfo - -#if INCL_WINSOCK_API_TYPEDEFS - typedef int (WSAAPI *LPFN_GETADDRINFO)(const char *nodename,const char *servname,const struct addrinfo *hints,struct addrinfo **res); - typedef int (WSAAPI *LPFN_GETADDRINFOW)(PCWSTR pNodeName,PCWSTR pServiceName,const ADDRINFOW *pHints,PADDRINFOW *ppResult); - -#define LPFN_GETADDRINFOA LPFN_GETADDRINFO - -#ifdef UNICODE -#define LPFN_GETADDRINFOT LPFN_GETADDRINFOW -#else -#define LPFN_GETADDRINFOT LPFN_GETADDRINFOA -#endif -#endif - -#ifdef UNICODE -#define FreeAddrInfo FreeAddrInfoW -#else -#define FreeAddrInfo FreeAddrInfoA -#endif - - WINSOCK_API_LINKAGE void WSAAPI freeaddrinfo(LPADDRINFO pAddrInfo); - WINSOCK_API_LINKAGE void WSAAPI FreeAddrInfoW(PADDRINFOW pAddrInfo); - -#define FreeAddrInfoA freeaddrinfo - -#if INCL_WINSOCK_API_TYPEDEFS - typedef void (WSAAPI *LPFN_FREEADDRINFO)(struct addrinfo *ai); - typedef void (WSAAPI *LPFN_FREEADDRINFOW)(PADDRINFOW pAddrInfo); - -#define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO - -#ifdef UNICODE -#define LPFN_FREEADDRINFOT LPFN_FREEADDRINFOW -#else -#define LPFN_FREEADDRINFOT LPFN_FREEADDRINFOA -#endif -#endif - -#pragma push_macro("socklen_t") -#undef socklen_t - - typedef int socklen_t; - -#ifdef UNICODE -#define GetNameInfo GetNameInfoW -#else -#define GetNameInfo GetNameInfoA -#endif - - WINSOCK_API_LINKAGE int WSAAPI getnameinfo(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags); - WINSOCK_API_LINKAGE INT WSAAPI GetNameInfoW(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags); - -#define GetNameInfoA getnameinfo - -#if INCL_WINSOCK_API_TYPEDEFS - typedef int (WSAAPI *LPFN_GETNAMEINFO)(const struct sockaddr *sa,socklen_t salen,char *host,DWORD hostlen,char *serv,DWORD servlen,int flags); - typedef INT (WSAAPI *LPFN_GETNAMEINFOW)(const SOCKADDR *pSockaddr,socklen_t SockaddrLength,PWCHAR pNodeBuffer,DWORD NodeBufferSize,PWCHAR pServiceBuffer,DWORD ServiceBufferSize,INT Flags); - -#define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO - -#ifdef UNICODE -#define LPFN_GETNAMEINFOT LPFN_GETNAMEINFOW -#else -#define LPFN_GETNAMEINFOT LPFN_GETNAMEINFOA -#endif -#endif - -#pragma pop_macro("socklen_t") - -#ifdef UNICODE -#define gai_strerror gai_strerrorW -#else -#define gai_strerror gai_strerrorA -#endif - -#define GAI_STRERROR_BUFFER_SIZE 1024 - -char *gai_strerrorA (int); -WCHAR *gai_strerrorW(int); - -#define NI_MAXHOST 1025 -#define NI_MAXSERV 32 - -#define INET_ADDRSTRLEN 22 -#define INET6_ADDRSTRLEN 65 - -#define NI_NOFQDN 0x01 -#define NI_NUMERICHOST 0x02 -#define NI_NAMEREQD 0x04 -#define NI_NUMERICSERV 0x08 -#define NI_DGRAM 0x10 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/win32/lib/chkstk.S b/win32/lib/chkstk.S deleted file mode 100644 index 6f583a53..00000000 --- a/win32/lib/chkstk.S +++ /dev/null @@ -1,73 +0,0 @@ -/* ---------------------------------------------- */ -/* chkstk86.s */ - -#ifdef __leading_underscore -# define _(s) _##s -#else -# define _(s) s -#endif - -/* ---------------------------------------------- */ -#ifndef __x86_64__ -/* ---------------------------------------------- */ - -.globl _(__chkstk) -_(__chkstk): - xchg (%esp),%ebp /* store ebp, get ret.addr */ - push %ebp /* push ret.addr */ - lea 4(%esp),%ebp /* setup frame ptr */ - push %ecx /* save ecx */ - mov %ebp,%ecx -P0: - sub $4096,%ecx - test %eax,(%ecx) - sub $4096,%eax - cmp $4096,%eax - jge P0 - sub %eax,%ecx - test %eax,(%ecx) - - mov %esp,%eax - mov %ecx,%esp - mov (%eax),%ecx /* restore ecx */ - jmp *4(%eax) - -/* ---------------------------------------------- */ -#else -/* ---------------------------------------------- */ - -.globl _(__chkstk) -_(__chkstk): - xchg (%rsp),%rbp /* store ebp, get ret.addr */ - push %rbp /* push ret.addr */ - lea 8(%rsp),%rbp /* setup frame ptr */ - push %rcx /* save ecx */ - mov %rbp,%rcx - movslq %eax,%rax -P0: - sub $4096,%rcx - test %rax,(%rcx) - sub $4096,%rax - cmp $4096,%rax - jge P0 - sub %rax,%rcx - test %rax,(%rcx) - - mov %rsp,%rax - mov %rcx,%rsp - mov (%rax),%rcx /* restore ecx */ - jmp *8(%rax) - -/* ---------------------------------------------- */ -/* setjmp/longjmp support */ - -.globl _(tinyc_getbp) -_(tinyc_getbp): - mov %rbp,%rax - ret - -/* ---------------------------------------------- */ -#endif -/* ---------------------------------------------- */ - - diff --git a/win32/lib/crt1.c b/win32/lib/crt1.c deleted file mode 100644 index e1910813..00000000 --- a/win32/lib/crt1.c +++ /dev/null @@ -1,101 +0,0 @@ -// ============================================= -// crt1.c - -// _UNICODE for tchar.h, UNICODE for API -#include - -#include -#include -#include - -#define _UNKNOWN_APP 0 -#define _CONSOLE_APP 1 -#define _GUI_APP 2 - -#define _MCW_PC 0x00030000 // Precision Control -#define _PC_24 0x00020000 // 24 bits -#define _PC_53 0x00010000 // 53 bits -#define _PC_64 0x00000000 // 64 bits - -#ifdef _UNICODE -#define __tgetmainargs __wgetmainargs -#define _tstart _wstart -#define _tmain wmain -#define _runtmain _runwmain -#else -#define __tgetmainargs __getmainargs -#define _tstart _start -#define _tmain main -#define _runtmain _runmain -#endif - -typedef struct { int newmode; } _startupinfo; -int __cdecl __tgetmainargs(int *pargc, _TCHAR ***pargv, _TCHAR ***penv, int globb, _startupinfo*); -void __cdecl __set_app_type(int apptype); -unsigned int __cdecl _controlfp(unsigned int new_value, unsigned int mask); -extern int _tmain(int argc, _TCHAR * argv[], _TCHAR * env[]); - -#include "crtinit.c" - -/* Allow command-line globbing with "int _dowildcard = 1;" in the user source */ -int _dowildcard; - -static LONG WINAPI catch_sig(EXCEPTION_POINTERS *ex) -{ - return _XcptFilter(ex->ExceptionRecord->ExceptionCode, ex); -} - -void _tstart(void) -{ - int ret; - - _startupinfo start_info = {0}; - SetUnhandledExceptionFilter(catch_sig); - // Sets the current application type - __set_app_type(_CONSOLE_APP); - - // Set default FP precision to 53 bits (8-byte double) - // _MCW_PC (Precision control) is not supported on ARM -#if defined __i386__ || defined __x86_64__ - _controlfp(_PC_53, _MCW_PC); -#endif - - __tgetmainargs( &__argc, &__targv, &_tenviron, _dowildcard, &start_info); - run_ctors(__argc, __targv, _tenviron); - ret = _tmain(__argc, __targv, _tenviron); - run_dtors(); - exit(ret); -} - -// ============================================= -// for 'tcc -run ,,,' - -__attribute__((weak)) extern int __run_on_exit(); - -int _runtmain(int argc, /* as tcc passed in */ char **argv) -{ - int ret; -#ifdef UNICODE - _startupinfo start_info = {0}; - - __tgetmainargs(&__argc, &__targv, &_tenviron, _dowildcard, &start_info); - /* may be wrong when tcc has received wildcards (*.c) */ - if (argc < __argc) { - __targv += __argc - argc; - __argc = argc; - } -#else - __argc = argc; - __targv = argv; -#endif -#if defined __i386__ || defined __x86_64__ - _controlfp(_PC_53, _MCW_PC); -#endif - run_ctors(__argc, __targv, _tenviron); - ret = _tmain(__argc, __targv, _tenviron); - run_dtors(); - __run_on_exit(ret); - return ret; -} - -// ============================================= diff --git a/win32/lib/crt1w.c b/win32/lib/crt1w.c deleted file mode 100644 index 2b8bbc8b..00000000 --- a/win32/lib/crt1w.c +++ /dev/null @@ -1,3 +0,0 @@ -#define _UNICODE 1 -#define UNICODE 1 -#include "crt1.c" diff --git a/win32/lib/crtinit.c b/win32/lib/crtinit.c deleted file mode 100644 index 31f087b8..00000000 --- a/win32/lib/crtinit.c +++ /dev/null @@ -1,26 +0,0 @@ -//+--------------------------------------------------------------------------- - -#ifdef __leading_underscore -# define _(s) s -#else -# define _(s) _##s -#endif - -extern void (*_(_init_array_start)[]) (int argc, _TCHAR **argv, _TCHAR **envp); -extern void (*_(_init_array_end)[]) (int argc, _TCHAR **argv, _TCHAR **envp); -extern void (*_(_fini_array_start)[]) (void); -extern void (*_(_fini_array_end)[]) (void); - -static void run_ctors(int argc, _TCHAR **argv, _TCHAR **env) -{ - int i = 0; - while (&_(_init_array_start)[i] != _(_init_array_end)) - (*_(_init_array_start)[i++])(argc, argv, env); -} - -static void run_dtors(void) -{ - int i = 0; - while (&_(_fini_array_end)[i] != _(_fini_array_start)) - (*_(_fini_array_end)[--i])(); -} diff --git a/win32/lib/dllcrt1.c b/win32/lib/dllcrt1.c deleted file mode 100644 index 5a9be82b..00000000 --- a/win32/lib/dllcrt1.c +++ /dev/null @@ -1,18 +0,0 @@ -//+--------------------------------------------------------------------------- - -#include -#include -#include "crtinit.c" - -BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved); - -BOOL WINAPI _dllstart(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) -{ - BOOL bRet; - if (dwReason == DLL_PROCESS_ATTACH) /* ignore DLL_THREAD_ATTACH */ - run_ctors(0, 0, 0); - bRet = DllMain (hDll, dwReason, lpReserved); - if (dwReason == DLL_PROCESS_DETACH) /* ignore DLL_THREAD_DETACH */ - run_dtors(); - return bRet; -} diff --git a/win32/lib/dllmain.c b/win32/lib/dllmain.c deleted file mode 100644 index 2c25b98b..00000000 --- a/win32/lib/dllmain.c +++ /dev/null @@ -1,9 +0,0 @@ -//+--------------------------------------------------------------------------- - -#include - -BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) -{ - return TRUE; -} - diff --git a/win32/lib/gdi32.def b/win32/lib/gdi32.def deleted file mode 100644 index 02766da4..00000000 --- a/win32/lib/gdi32.def +++ /dev/null @@ -1,337 +0,0 @@ -LIBRARY gdi32.dll - -EXPORTS -AbortDoc -AbortPath -AddFontResourceA -AddFontResourceW -AngleArc -AnimatePalette -Arc -ArcTo -BeginPath -BitBlt -ByeByeGDI -CancelDC -CheckColorsInGamut -ChoosePixelFormat -Chord -CloseEnhMetaFile -CloseFigure -CloseMetaFile -ColorCorrectPalette -ColorMatchToTarget -CombineRgn -CombineTransform -CopyEnhMetaFileA -CopyEnhMetaFileW -CopyMetaFileA -CopyMetaFileW -CreateBitmap -CreateBitmapIndirect -CreateBrushIndirect -CreateColorSpaceA -CreateColorSpaceW -CreateCompatibleBitmap -CreateCompatibleDC -CreateDCA -CreateDCW -CreateDIBPatternBrush -CreateDIBPatternBrushPt -CreateDIBSection -CreateDIBitmap -CreateDiscardableBitmap -CreateEllipticRgn -CreateEllipticRgnIndirect -CreateEnhMetaFileA -CreateEnhMetaFileW -CreateFontA -CreateFontIndirectA -CreateFontIndirectW -CreateFontW -CreateHalftonePalette -CreateHatchBrush -CreateICA -CreateICW -CreateMetaFileA -CreateMetaFileW -CreatePalette -CreatePatternBrush -CreatePen -CreatePenIndirect -CreatePolyPolygonRgn -CreatePolygonRgn -CreateRectRgn -CreateRectRgnIndirect -CreateRoundRectRgn -CreateScalableFontResourceA -CreateScalableFontResourceW -CreateSolidBrush -DPtoLP -DeleteColorSpace -DeleteDC -DeleteEnhMetaFile -DeleteMetaFile -DeleteObject -DescribePixelFormat -DeviceCapabilitiesEx -DeviceCapabilitiesExA -DeviceCapabilitiesExW -DrawEscape -Ellipse -EnableEUDC -EndDoc -EndPage -EndPath -EnumEnhMetaFile -EnumFontFamiliesA -EnumFontFamiliesExA -EnumFontFamiliesExW -EnumFontFamiliesW -EnumFontsA -EnumFontsW -EnumICMProfilesA -EnumICMProfilesW -EnumMetaFile -EnumObjects -EqualRgn -Escape -ExcludeClipRect -ExtCreatePen -ExtCreateRegion -ExtEscape -ExtFloodFill -ExtSelectClipRgn -ExtTextOutA -ExtTextOutW -FillPath -FillRgn -FixBrushOrgEx -FlattenPath -FloodFill -FrameRgn -GdiComment -GdiFlush -GdiGetBatchLimit -GdiPlayDCScript -GdiPlayJournal -GdiPlayScript -GdiSetBatchLimit -GetArcDirection -GetAspectRatioFilterEx -GetBitmapBits -GetBitmapDimensionEx -GetBkColor -GetBkMode -GetBoundsRect -GetBrushOrgEx -GetCharABCWidthsA -GetCharABCWidthsFloatA -GetCharABCWidthsFloatW -GetCharABCWidthsW -GetCharWidth32A -GetCharWidth32W -GetCharWidthA -GetCharWidthFloatA -GetCharWidthFloatW -GetCharWidthW -GetCharacterPlacementA -GetCharacterPlacementW -GetClipBox -GetClipRgn -GetColorAdjustment -GetColorSpace -GetCurrentObject -GetCurrentPositionEx -GetDCOrgEx -GetDIBColorTable -GetDIBits -GetDeviceCaps -GetDeviceGammaRamp -GetEnhMetaFileA -GetEnhMetaFileBits -GetEnhMetaFileDescriptionA -GetEnhMetaFileDescriptionW -GetEnhMetaFileHeader -GetEnhMetaFilePaletteEntries -GetEnhMetaFileW -GetFontData -GetFontLanguageInfo -GetFontResourceInfo -GetGlyphOutline -GetGlyphOutlineA -GetGlyphOutlineW -GetGraphicsMode -GetICMProfileA -GetICMProfileW -GetKerningPairs -GetKerningPairsA -GetKerningPairsW -GetLayout -GetLogColorSpaceA -GetLogColorSpaceW -GetMapMode -GetMetaFileA -GetMetaFileBitsEx -GetMetaFileW -GetMetaRgn -GetMiterLimit -GetNearestColor -GetNearestPaletteIndex -GetObjectA -GetObjectType -GetObjectW -GetOutlineTextMetricsA -GetOutlineTextMetricsW -GetPaletteEntries -GetPath -GetPixel -GetPixelFormat -GetPolyFillMode -GetROP2 -GetRandomRgn -GetRasterizerCaps -GetRegionData -GetRgnBox -GetStockObject -GetStretchBltMode -GetSystemPaletteEntries -GetSystemPaletteUse -GetTextAlign -GetTextCharacterExtra -GetTextCharset -GetTextCharsetInfo -GetTextColor -GetTextExtentExPointA -GetTextExtentExPointW -GetTextExtentPoint32A -GetTextExtentPoint32W -GetTextExtentPointA -GetTextExtentPointW -GetTextFaceA -GetTextFaceW -GetTextMetricsA -GetTextMetricsW -GetViewportExtEx -GetViewportOrgEx -GetWinMetaFileBits -GetWindowExtEx -GetWindowOrgEx -GetWorldTransform -IntersectClipRect -InvertRgn -LPtoDP -LineDDA -LineTo -MaskBlt -ModifyWorldTransform -MoveToEx -OffsetClipRgn -OffsetRgn -OffsetViewportOrgEx -OffsetWindowOrgEx -PaintRgn -PatBlt -PathToRegion -Pie -PlayEnhMetaFile -PlayEnhMetaFileRecord -PlayMetaFile -PlayMetaFileRecord -PlgBlt -PolyBezier -PolyBezierTo -PolyDraw -PolyPolygon -PolyPolyline -PolyTextOutA -PolyTextOutW -Polygon -Polyline -PolylineTo -PtInRegion -PtVisible -RealizePalette -RectInRegion -RectVisible -Rectangle -RemoveFontResourceA -RemoveFontResourceW -ResetDCA -ResetDCW -ResizePalette -RestoreDC -RoundRect -SaveDC -ScaleViewportExtEx -ScaleWindowExtEx -SelectClipPath -SelectClipRgn -SelectObject -SelectPalette -SetAbortProc -SetArcDirection -SetBitmapBits -SetBitmapDimensionEx -SetBkColor -SetBkMode -SetBoundsRect -SetBrushOrgEx -SetColorAdjustment -SetColorSpace -SetDIBColorTable -SetDIBits -SetDIBitsToDevice -SetDeviceGammaRamp -SetEnhMetaFileBits -SetFontEnumeration -SetGraphicsMode -SetICMMode -SetICMProfileA -SetICMProfileW -SetLayout -SetMagicColors -SetMapMode -SetMapperFlags -SetMetaFileBitsEx -SetMetaRgn -SetMiterLimit -SetObjectOwner -SetPaletteEntries -SetPixel -SetPixelFormat -SetPixelV -SetPolyFillMode -SetROP2 -SetRectRgn -SetStretchBltMode -SetSystemPaletteUse -SetTextAlign -SetTextCharacterExtra -SetTextColor -SetTextJustification -SetViewportExtEx -SetViewportOrgEx -SetWinMetaFileBits -SetWindowExtEx -SetWindowOrgEx -SetWorldTransform -StartDocA -StartDocW -StartPage -StretchBlt -StretchDIBits -StrokeAndFillPath -StrokePath -SwapBuffers -TextOutA -TextOutW -TranslateCharsetInfo -UnrealizeObject -UpdateColors -UpdateICMRegKeyA -UpdateICMRegKeyW -WidenPath -gdiPlaySpoolStream -pfnRealizePalette -pfnSelectPalette diff --git a/win32/lib/kernel32.def b/win32/lib/kernel32.def deleted file mode 100644 index 588613c3..00000000 --- a/win32/lib/kernel32.def +++ /dev/null @@ -1,775 +0,0 @@ -LIBRARY kernel32.dll - -EXPORTS -AddAtomA -AddAtomW -AddVectoredContinueHandler -AddVectoredExceptionHandler -AllocConsole -AllocLSCallback -AllocSLCallback -AreFileApisANSI -BackupRead -BackupSeek -BackupWrite -Beep -BeginUpdateResourceA -BeginUpdateResourceW -BuildCommDCBA -BuildCommDCBAndTimeoutsA -BuildCommDCBAndTimeoutsW -BuildCommDCBW -CallNamedPipeA -CallNamedPipeW -Callback12 -Callback16 -Callback20 -Callback24 -Callback28 -Callback32 -Callback36 -Callback4 -Callback40 -Callback44 -Callback48 -Callback52 -Callback56 -Callback60 -Callback64 -Callback8 -CancelDeviceWakeupRequest -CancelIo -CancelWaitableTimer -ClearCommBreak -ClearCommError -CloseHandle -CloseProfileUserMapping -CloseSystemHandle -CommConfigDialogA -CommConfigDialogW -CompareFileTime -CompareStringA -CompareStringW -ConnectNamedPipe -ContinueDebugEvent -ConvertDefaultLocale -ConvertThreadToFiber -ConvertToGlobalHandle -CopyFileA -CopyFileExA -CopyFileExW -CopyFileW -CreateConsoleScreenBuffer -CreateDirectoryA -CreateDirectoryExA -CreateDirectoryExW -CreateDirectoryW -CreateEventA -CreateEventW -CreateFiber -CreateFileA -CreateFileMappingA -CreateFileMappingW -CreateFileW -CreateIoCompletionPort -CreateKernelThread -CreateMailslotA -CreateMailslotW -CreateMutexA -CreateMutexW -CreateNamedPipeA -CreateNamedPipeW -CreatePipe -CreateProcessA -CreateProcessW -CreateRemoteThread -CreateSemaphoreA -CreateSemaphoreW -CreateSocketHandle -CreateTapePartition -CreateThread -CreateToolhelp32Snapshot -CreateWaitableTimerA -CreateWaitableTimerW -DebugActiveProcess -DebugBreak -DefineDosDeviceA -DefineDosDeviceW -DeleteAtom -DeleteCriticalSection -DeleteFiber -DeleteFileA -DeleteFileW -DeviceIoControl -DisableThreadLibraryCalls -DisconnectNamedPipe -DosDateTimeToFileTime -DuplicateHandle -EndUpdateResourceA -EndUpdateResourceW -EnterCriticalSection -EnumCalendarInfoA -EnumCalendarInfoExA -EnumCalendarInfoExW -EnumCalendarInfoW -EnumDateFormatsA -EnumDateFormatsExA -EnumDateFormatsExW -EnumDateFormatsW -EnumLanguageGroupLocalesA -EnumLanguageGroupLocalesW -EnumResourceLanguagesA -EnumResourceLanguagesW -EnumResourceNamesA -EnumResourceNamesW -EnumResourceTypesA -EnumResourceTypesW -EnumSystemCodePagesA -EnumSystemCodePagesW -EnumSystemGeoID -EnumSystemLanguageGroupsA -EnumSystemLanguageGroupsW -EnumSystemLocalesA -EnumSystemLocalesW -EnumTimeFormatsA -EnumTimeFormatsW -EnumUILanguagesA -EnumUILanguagesW -EraseTape -EscapeCommFunction -ExitProcess -ExitThread -ExpandEnvironmentStringsA -ExpandEnvironmentStringsW -FT_Exit0 -FT_Exit12 -FT_Exit16 -FT_Exit20 -FT_Exit24 -FT_Exit28 -FT_Exit32 -FT_Exit36 -FT_Exit4 -FT_Exit40 -FT_Exit44 -FT_Exit48 -FT_Exit52 -FT_Exit56 -FT_Exit8 -FT_Prolog -FT_Thunk -FatalAppExitA -FatalAppExitW -FatalExit -FileTimeToDosDateTime -FileTimeToLocalFileTime -FileTimeToSystemTime -FillConsoleOutputAttribute -FillConsoleOutputCharacterA -FillConsoleOutputCharacterW -FindAtomA -FindAtomW -FindClose -FindCloseChangeNotification -FindFirstChangeNotificationA -FindFirstChangeNotificationW -FindFirstFileA -FindFirstFileExA -FindFirstFileExW -FindFirstFileW -FindNextChangeNotification -FindNextFileA -FindNextFileW -FindResourceA -FindResourceExA -FindResourceExW -FindResourceW -FlushConsoleInputBuffer -FlushFileBuffers -FlushInstructionCache -FlushViewOfFile -FoldStringA -FoldStringW -FormatMessageA -FormatMessageW -FreeConsole -FreeEnvironmentStringsA -FreeEnvironmentStringsW -FreeLSCallback -FreeLibrary -FreeLibraryAndExitThread -FreeResource -FreeSLCallback -GenerateConsoleCtrlEvent -GetACP -GetAtomNameA -GetAtomNameW -GetBinaryType -GetBinaryTypeA -GetBinaryTypeW -GetCPInfo -GetCPInfoExA -GetCPInfoExW -GetCalendarInfoA -GetCalendarInfoW -GetCommConfig -GetCommMask -GetCommModemStatus -GetCommProperties -GetCommState -GetCommTimeouts -GetCommandLineA -GetCommandLineW -GetCompressedFileSizeA -GetCompressedFileSizeW -GetComputerNameA -GetComputerNameW -GetConsoleCP -GetConsoleCursorInfo -GetConsoleMode -GetConsoleOutputCP -GetConsoleScreenBufferInfo -GetConsoleTitleA -GetConsoleTitleW -GetCurrencyFormatA -GetCurrencyFormatW -GetCurrentDirectoryA -GetCurrentDirectoryW -GetCurrentProcess -GetCurrentProcessId -GetCurrentThread -GetCurrentThreadId -GetDateFormatA -GetDateFormatW -GetDaylightFlag -GetDefaultCommConfigA -GetDefaultCommConfigW -GetDevicePowerState -GetDiskFreeSpaceA -GetDiskFreeSpaceExA -GetDiskFreeSpaceExW -GetDiskFreeSpaceW -GetDriveTypeA -GetDriveTypeW -GetEnvironmentStrings -GetEnvironmentStringsA -GetEnvironmentStringsW -GetEnvironmentVariableA -GetEnvironmentVariableW -GetErrorMode -GetExitCodeProcess -GetExitCodeThread -GetFileAttributesA -GetFileAttributesExA -GetFileAttributesExW -GetFileAttributesW -GetFileInformationByHandle -GetFileSize -GetFileTime -GetFileType -GetFullPathNameA -GetFullPathNameW -GetGeoInfoA -GetGeoInfoW -GetHandleContext -GetHandleInformation -GetLSCallbackTarget -GetLSCallbackTemplate -GetLargestConsoleWindowSize -GetLastError -GetLocalTime -GetLocaleInfoA -GetLocaleInfoW -GetLogicalDriveStringsA -GetLogicalDriveStringsW -GetLogicalDrives -GetLongPathNameA -GetLongPathNameW -GetMailslotInfo -GetModuleFileNameA -GetModuleFileNameW -GetModuleHandleA -GetModuleHandleExA -GetModuleHandleExW -GetModuleHandleW -GetNamedPipeHandleStateA -GetNamedPipeHandleStateW -GetNamedPipeInfo -GetNumberFormatA -GetNumberFormatW -GetNumberOfConsoleInputEvents -GetNumberOfConsoleMouseButtons -GetOEMCP -GetOverlappedResult -GetPriorityClass -GetPrivateProfileIntA -GetPrivateProfileIntW -GetPrivateProfileSectionA -GetPrivateProfileSectionNamesA -GetPrivateProfileSectionNamesW -GetPrivateProfileSectionW -GetPrivateProfileStringA -GetPrivateProfileStringW -GetPrivateProfileStructA -GetPrivateProfileStructW -GetProcAddress -GetProcessAffinityMask -GetProcessFlags -GetProcessHeap -GetProcessHeaps -GetProcessPriorityBoost -GetProcessShutdownParameters -GetProcessTimes -GetProcessVersion -GetProcessWorkingSetSize -GetProductName -GetProfileIntA -GetProfileIntW -GetProfileSectionA -GetProfileSectionW -GetProfileStringA -GetProfileStringW -GetQueuedCompletionStatus -GetSLCallbackTarget -GetSLCallbackTemplate -GetShortPathNameA -GetShortPathNameW -GetStartupInfoA -GetStartupInfoW -GetStdHandle -GetStringTypeA -GetStringTypeExA -GetStringTypeExW -GetStringTypeW -GetSystemDefaultLCID -GetSystemDefaultLangID -GetSystemDefaultUILanguage -GetSystemDirectoryA -GetSystemDirectoryW -GetSystemInfo -GetSystemPowerStatus -GetSystemTime -GetSystemTimeAdjustment -GetSystemTimeAsFileTime -GetTapeParameters -GetTapePosition -GetTapeStatus -GetTempFileNameA -GetTempFileNameW -GetTempPathA -GetTempPathW -GetThreadContext -GetThreadLocale -GetThreadPriority -GetThreadPriorityBoost -GetThreadSelectorEntry -GetThreadTimes -GetTickCount -GetTimeFormatA -GetTimeFormatW -GetTimeZoneInformation -GetUserDefaultLCID -GetUserDefaultLangID -GetUserDefaultUILanguage -GetUserGeoID -GetVersion -GetVersionExA -GetVersionExW -GetVolumeInformationA -GetVolumeInformationW -GetWindowsDirectoryA -GetWindowsDirectoryW -GetWriteWatch -GlobalAddAtomA -GlobalAddAtomW -GlobalAlloc -GlobalCompact -GlobalDeleteAtom -GlobalFindAtomA -GlobalFindAtomW -GlobalFix -GlobalFlags -GlobalFree -GlobalGetAtomNameA -GlobalGetAtomNameW -GlobalHandle -GlobalLock -GlobalMemoryStatus -GlobalReAlloc -GlobalSize -GlobalUnWire -GlobalUnfix -GlobalUnlock -GlobalWire -Heap32First -Heap32ListFirst -Heap32ListNext -Heap32Next -HeapAlloc -HeapCompact -HeapCreate -HeapDestroy -HeapFree -HeapLock -HeapReAlloc -HeapSetFlags -HeapSize -HeapUnlock -HeapValidate -HeapWalk -InitAtomTable -InitializeCriticalSection -InitializeCriticalSectionAndSpinCount -InterlockedCompareExchange -InterlockedDecrement -InterlockedExchange -InterlockedExchangeAdd -InterlockedIncrement -InvalidateNLSCache -IsBadCodePtr -IsBadHugeReadPtr -IsBadHugeWritePtr -IsBadReadPtr -IsBadStringPtrA -IsBadStringPtrW -IsBadWritePtr -IsDBCSLeadByte -IsDBCSLeadByteEx -IsDebuggerPresent -IsLSCallback -IsProcessorFeaturePresent -IsSLCallback -IsSystemResumeAutomatic -IsValidCodePage -IsValidLanguageGroup -IsValidLocale -K32Thk1632Epilog -K32Thk1632Prolog -K32_NtCreateFile -K32_RtlNtStatusToDosError -LCMapStringA -LCMapStringW -LeaveCriticalSection -LoadLibraryA -LoadLibraryExA -LoadLibraryExW -LoadLibraryW -LoadModule -LoadResource -LocalAlloc -LocalCompact -LocalFileTimeToFileTime -LocalFlags -LocalFree -LocalHandle -LocalLock -LocalReAlloc -LocalShrink -LocalSize -LocalUnlock -LockFile -LockFileEx -LockResource -MakeCriticalSectionGlobal -MapHInstLS -MapHInstLS_PN -MapHInstSL -MapHInstSL_PN -MapHModuleLS -MapHModuleSL -MapLS -MapSL -MapSLFix -MapViewOfFile -MapViewOfFileEx -Module32First -Module32Next -MoveFileA -MoveFileExA -MoveFileExW -MoveFileW -MulDiv -MultiByteToWideChar -NotifyNLSUserCache -OpenEventA -OpenEventW -OpenFile -OpenFileMappingA -OpenFileMappingW -OpenMutexA -OpenMutexW -OpenProcess -OpenProfileUserMapping -OpenSemaphoreA -OpenSemaphoreW -OpenThread -OpenVxDHandle -OpenWaitableTimerA -OpenWaitableTimerW -OutputDebugStringA -OutputDebugStringW -PeekConsoleInputA -PeekConsoleInputW -PeekNamedPipe -PostQueuedCompletionStatus -PrepareTape -Process32First -Process32Next -PulseEvent -PurgeComm -QT_Thunk -QueryDosDeviceA -QueryDosDeviceW -QueryNumberOfEventLogRecords -QueryOldestEventLogRecord -QueryPerformanceCounter -QueryPerformanceFrequency -QueueUserAPC -RaiseException -ReadConsoleA -ReadConsoleInputA -ReadConsoleInputW -ReadConsoleOutputA -ReadConsoleOutputAttribute -ReadConsoleOutputCharacterA -ReadConsoleOutputCharacterW -ReadConsoleOutputW -ReadConsoleW -ReadDirectoryChangesW -ReadFile -ReadFileEx -ReadFileScatter -ReadProcessMemory -RegisterServiceProcess -RegisterSysMsgHandler -ReinitializeCriticalSection -ReleaseMutex -ReleaseSemaphore -RemoveDirectoryA -RemoveDirectoryW -RequestDeviceWakeup -RequestWakeupLatency -ResetEvent -ResetNLSUserInfoCache -ResetWriteWatch -ResumeThread -RtlAddFunctionTable -RtlDeleteFunctionTable -RtlFillMemory -RtlInstallFunctionTableCallback -RtlMoveMemory -RtlUnwind -RtlUnwindEx -RtlZeroMemory -SMapLS -SMapLS_IP_EBP_12 -SMapLS_IP_EBP_16 -SMapLS_IP_EBP_20 -SMapLS_IP_EBP_24 -SMapLS_IP_EBP_28 -SMapLS_IP_EBP_32 -SMapLS_IP_EBP_36 -SMapLS_IP_EBP_40 -SMapLS_IP_EBP_8 -SUnMapLS -SUnMapLS_IP_EBP_12 -SUnMapLS_IP_EBP_16 -SUnMapLS_IP_EBP_20 -SUnMapLS_IP_EBP_24 -SUnMapLS_IP_EBP_28 -SUnMapLS_IP_EBP_32 -SUnMapLS_IP_EBP_36 -SUnMapLS_IP_EBP_40 -SUnMapLS_IP_EBP_8 -ScrollConsoleScreenBufferA -ScrollConsoleScreenBufferW -SearchPathA -SearchPathW -SetCalendarInfoA -SetCalendarInfoW -SetCommBreak -SetCommConfig -SetCommMask -SetCommState -SetCommTimeouts -SetComputerNameA -SetComputerNameW -SetConsoleActiveScreenBuffer -SetConsoleCP -SetConsoleCtrlHandler -SetConsoleCursorInfo -SetConsoleCursorPosition -SetConsoleMode -SetConsoleOutputCP -SetConsoleScreenBufferSize -SetConsoleTextAttribute -SetConsoleTitleA -SetConsoleTitleW -SetConsoleWindowInfo -SetCriticalSectionSpinCount -SetCurrentDirectoryA -SetCurrentDirectoryW -SetDaylightFlag -SetDefaultCommConfigA -SetDefaultCommConfigW -SetEndOfFile -SetEnvironmentVariableA -SetEnvironmentVariableW -SetErrorMode -SetEvent -SetFileApisToANSI -SetFileApisToOEM -SetFileAttributesA -SetFileAttributesW -SetFilePointer -SetFilePointerEx -SetFileTime -SetHandleContext -SetHandleCount -SetHandleInformation -SetLastError -SetLocalTime -SetLocaleInfoA -SetLocaleInfoW -SetMailslotInfo -SetMessageWaitingIndicator -SetNamedPipeHandleState -SetPriorityClass -SetProcessAffinityMask -SetProcessPriorityBoost -SetProcessShutdownParameters -SetProcessWorkingSetSize -SetStdHandle -SetSystemPowerState -SetSystemTime -SetSystemTimeAdjustment -SetTapeParameters -SetTapePosition -SetThreadAffinityMask -SetThreadContext -SetThreadExecutionState -SetThreadIdealProcessor -SetThreadLocale -SetThreadPriority -SetThreadPriorityBoost -SetTimeZoneInformation -SetUnhandledExceptionFilter -SetUserGeoID -SetVolumeLabelA -SetVolumeLabelW -SetWaitableTimer -SetupComm -SignalObjectAndWait -SignalSysMsgHandlers -SizeofResource -Sleep -SleepEx -SuspendThread -SwitchToFiber -SwitchToThread -SystemTimeToFileTime -SystemTimeToTzSpecificLocalTime -TerminateProcess -TerminateThread -Thread32First -Thread32Next -ThunkConnect32 -TlsAlloc -TlsAllocInternal -TlsFree -TlsFreeInternal -TlsGetValue -TlsSetValue -Toolhelp32ReadProcessMemory -TransactNamedPipe -TransmitCommChar -TryEnterCriticalSection -UTRegister -UTUnRegister -UnMapLS -UnMapSLFixArray -UnhandledExceptionFilter -UninitializeCriticalSection -UnlockFile -UnlockFileEx -UnmapViewOfFile -UpdateResourceA -UpdateResourceW -VerLanguageNameA -VerLanguageNameW -VerSetConditionMask -VerifyVersionInfoA -VerifyVersionInfoW -VirtualAlloc -VirtualAllocEx -VirtualFree -VirtualFreeEx -VirtualLock -VirtualProtect -VirtualProtectEx -VirtualQuery -VirtualQueryEx -VirtualUnlock -WaitCommEvent -WaitForDebugEvent -WaitForMultipleObjects -WaitForMultipleObjectsEx -WaitForSingleObject -WaitForSingleObjectEx -WaitNamedPipeA -WaitNamedPipeW -WideCharToMultiByte -WinExec -WriteConsoleA -WriteConsoleInputA -WriteConsoleInputW -WriteConsoleOutputA -WriteConsoleOutputAttribute -WriteConsoleOutputCharacterA -WriteConsoleOutputCharacterW -WriteConsoleOutputW -WriteConsoleW -WriteFile -WriteFileEx -WriteFileGather -WritePrivateProfileSectionA -WritePrivateProfileSectionW -WritePrivateProfileStringA -WritePrivateProfileStringW -WritePrivateProfileStructA -WritePrivateProfileStructW -WriteProcessMemory -WriteProfileSectionA -WriteProfileSectionW -WriteProfileStringA -WriteProfileStringW -WriteTapemark -_DebugOut -_DebugPrintf -_hread -_hwrite -_lclose -_lcreat -_llseek -_lopen -_lread -_lwrite -dprintf -lstrcat -lstrcatA -lstrcatW -lstrcmp -lstrcmpA -lstrcmpW -lstrcmpi -lstrcmpiA -lstrcmpiW -lstrcpy -lstrcpyA -lstrcpyW -lstrcpyn -lstrcpynA -lstrcpynW -lstrlen -lstrlenA -lstrlenW diff --git a/win32/lib/msvcrt.def b/win32/lib/msvcrt.def deleted file mode 100644 index e8f6ab91..00000000 --- a/win32/lib/msvcrt.def +++ /dev/null @@ -1,1320 +0,0 @@ -LIBRARY msvcrt.dll - -EXPORTS -??0__non_rtti_object@@QEAA@AEBV0@@Z -??0__non_rtti_object@@QEAA@PEBD@Z -??0bad_cast@@AAE@PBQBD@Z -??0bad_cast@@AEAA@PEBQEBD@Z -??0bad_cast@@QAE@ABQBD@Z -??0bad_cast@@QEAA@AEBQEBD@Z -??0bad_cast@@QEAA@AEBV0@@Z -??0bad_cast@@QEAA@PEBD@Z -??0bad_typeid@@QEAA@AEBV0@@Z -??0bad_typeid@@QEAA@PEBD@Z -??0exception@@QEAA@AEBQEBD@Z -??0exception@@QEAA@AEBQEBDH@Z -??0exception@@QEAA@AEBV0@@Z -??0exception@@QEAA@XZ -??1__non_rtti_object@@UEAA@XZ -??1bad_cast@@UEAA@XZ -??1bad_typeid@@UEAA@XZ -??1exception@@UEAA@XZ -??1type_info@@UEAA@XZ -??2@YAPEAX_K@Z -??2@YAPEAX_KHPEBDH@Z -??3@YAXPEAX@Z -??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z -??4bad_cast@@QEAAAEAV0@AEBV0@@Z -??4bad_typeid@@QEAAAEAV0@AEBV0@@Z -??4exception@@QEAAAEAV0@AEBV0@@Z -??8type_info@@QEBAHAEBV0@@Z -??9type_info@@QEBAHAEBV0@@Z -??_7__non_rtti_object@@6B@ -??_7bad_cast@@6B@ -??_7bad_typeid@@6B@ -??_7exception@@6B@ -??_Fbad_cast@@QEAAXXZ -??_Fbad_typeid@@QEAAXXZ -??_U@YAPEAX_K@Z -??_U@YAPEAX_KHPEBDH@Z -??_V@YAXPEAX@Z -?_query_new_handler@@YAP6AH_K@ZXZ -?_query_new_mode@@YAHXZ -?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z -?_set_new_mode@@YAHH@Z -?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z -?before@type_info@@QEBAHAEBV1@@Z -?name@type_info@@QEBAPEBDXZ -?raw_name@type_info@@QEBAPEBDXZ -?set_new_handler@@YAP6AXXZP6AXXZ@Z -?set_terminate@@YAP6AXXZP6AXXZ@Z -?set_unexpected@@YAP6AXXZP6AXXZ@Z -?terminate@@YAXXZ -?unexpected@@YAXXZ -?what@exception@@UEBAPEBDXZ -_CrtCheckMemory -_CrtDbgBreak -_CrtDbgReport -_CrtDbgReportV -_CrtDbgReportW -_CrtDbgReportWV -_CrtDoForAllClientObjects -_CrtDumpMemoryLeaks -_CrtIsMemoryBlock -_CrtIsValidHeapPointer -_CrtIsValidPointer -_CrtMemCheckpoint -_CrtMemDifference -_CrtMemDumpAllObjectsSince -_CrtMemDumpStatistics -_CrtReportBlockType -_CrtSetAllocHook -_CrtSetBreakAlloc -_CrtSetDbgBlockType -_CrtSetDbgFlag -_CrtSetDumpClient -_CrtSetReportFile -_CrtSetReportHook -_CrtSetReportHook2 -_CrtSetReportMode -_CxxThrowException -_Getdays -_Getmonths -_Gettnames -_HUGE -_Strftime -_W_Getdays -_W_Getmonths -_W_Gettnames -_Wcsftime -_XcptFilter -__AdjustPointer -__C_specific_handler -__CppXcptFilter -__CxxFrameHandler -__CxxFrameHandler2 -__CxxFrameHandler3 -__DestructExceptionObject -__ExceptionPtrAssign -__ExceptionPtrCompare -__ExceptionPtrCopy -__ExceptionPtrCopyException -__ExceptionPtrCreate -__ExceptionPtrCurrentException -__ExceptionPtrDestroy -__ExceptionPtrRethrow -__ExceptionPtrSwap -__ExceptionPtrToBool -__RTCastToVoid -__RTDynamicCast -__RTtypeid -__STRINGTOLD -___lc_codepage_func -___lc_collate_cp_func -___lc_handle_func -___mb_cur_max_func -___setlc_active_func -___unguarded_readlc_active_add_func -__argc -__argv -__badioinfo -__crtCompareStringA -__crtCompareStringW -__crtGetLocaleInfoW -__crtGetStringTypeW -__crtLCMapStringA -__crtLCMapStringW -__daylight -__dllonexit -__doserrno -__dstbias -__fpecode -__getmainargs -__initenv -__iob_func -__isascii -__iscsym -__iscsymf -__lc_codepage -__lc_collate_cp -__lc_handle -__lconv_init -__mb_cur_max -__pctype_func -__pioinfo -__pwctype_func -__pxcptinfoptrs -__set_app_type -__setlc_active -__setusermatherr -__strncnt -__threadhandle -__threadid -__toascii -__unDName -__unDNameEx -__uncaught_exception -__unguarded_readlc_active -__wargv -__wcserror -__wcserror_s -__wcsncnt -__wgetmainargs -__winitenv -_abs64 -_access -_access_s -_acmdln -_aexit_rtn -_aligned_free -_aligned_free_dbg -_aligned_malloc -_aligned_malloc_dbg -_aligned_offset_malloc -_aligned_offset_malloc_dbg -_aligned_offset_realloc -_aligned_offset_realloc_dbg -_aligned_realloc -_aligned_realloc_dbg -_amsg_exit -_assert -_atodbl -_atodbl_l -_atof_l -_atoflt_l -_atoi64 -_atoi64_l -_atoi_l -_atol_l -_atoldbl -_atoldbl_l -_beep -_beginthread -_beginthreadex -_c_exit -_cabs -_callnewh -_calloc_dbg -_cexit -_cgets -_cgets_s -_cgetws -_cgetws_s -_chdir -_chdrive -_chgsign -_chgsignf -_chmod -_chsize -_chsize_s -_chvalidator -_chvalidator_l -_clearfp -_close -_commit -_commode -_control87 -_controlfp -_controlfp_s -_copysign -_copysignf -_cprintf -_cprintf_l -_cprintf_p -_cprintf_p_l -_cprintf_s -_cprintf_s_l -_cputs -_cputws -_creat -_create_locale -_crtAssertBusy -_crtBreakAlloc -_crtDbgFlag -_cscanf -_cscanf_l -_cscanf_s -_cscanf_s_l -_ctime32 -_ctime32_s -_ctime64 -_ctime64_s -_ctype -_cwait -_cwprintf -_cwprintf_l -_cwprintf_p -_cwprintf_p_l -_cwprintf_s -_cwprintf_s_l -_cwscanf -_cwscanf_l -_cwscanf_s -_cwscanf_s_l -_daylight -_difftime32 -_difftime64 -_dstbias -_dup -_dup2 -_ecvt -_ecvt_s -_endthread -_endthreadex -_environ -_eof -_errno -_execl -_execle -_execlp -_execlpe -_execv -_execve -_execvp -_execvpe -_exit -_expand -_expand_dbg -_fcloseall -_fcvt -_fcvt_s -_fdopen -_fgetchar -_fgetwchar -_filbuf -_fileinfo -_filelength -_filelengthi64 -_fileno -_findclose -_findfirst -_findfirst64 -_findfirsti64 -_findnext -_findnext64 -_findnexti64 -_finite -_finitef -_flsbuf -_flushall -_fmode -_fpclass -_fpclassf -_fpreset -_fprintf_l -_fprintf_p -_fprintf_p_l -_fprintf_s_l -_fputchar -_fputwchar -_free_dbg -_free_locale -_freea -_freea_s -_fscanf_l -_fscanf_s_l -_fseeki64 -_fsopen -_fstat -_fstat64 -_fstati64 -_ftime -_ftime32 -_ftime32_s -_ftime64 -_ftime64_s -_fullpath -_fullpath_dbg -_futime -_futime32 -_futime64 -_fwprintf_l -_fwprintf_p -_fwprintf_p_l -_fwprintf_s_l -_fwscanf_l -_fwscanf_s_l -_gcvt -_gcvt_s -_get_current_locale -_get_doserrno -_get_environ -_get_errno -_get_fileinfo -_get_fmode -_get_heap_handle -_get_osfhandle -_get_osplatform -_get_osver -_get_output_format -_get_pgmptr -_get_sbh_threshold -_get_wenviron -_get_winmajor -_get_winminor -_get_winver -_get_wpgmptr -_getch -_getche -_getcwd -_getdcwd -_getdiskfree -_getdrive -_getdrives -_getmaxstdio -_getmbcp -_getpid -_getsystime -_getw -_getwch -_getwche -_getws -_gmtime32 -_gmtime32_s -_gmtime64 -_gmtime64_s -_heapchk -_heapmin -_heapset -_heapwalk -_hypot -_hypotf -_i64toa -_i64toa_s -_i64tow -_i64tow_s -_initterm -_initterm_e -_invalid_parameter -_iob -_isalnum_l -_isalpha_l -_isatty -_iscntrl_l -_isctype -_isctype_l -_isdigit_l -_isgraph_l -_isleadbyte_l -_islower_l -_ismbbalnum -_ismbbalnum_l -_ismbbalpha -_ismbbalpha_l -_ismbbgraph -_ismbbgraph_l -_ismbbkalnum -_ismbbkalnum_l -_ismbbkana -_ismbbkana_l -_ismbbkprint -_ismbbkprint_l -_ismbbkpunct -_ismbbkpunct_l -_ismbblead -_ismbblead_l -_ismbbprint -_ismbbprint_l -_ismbbpunct -_ismbbpunct_l -_ismbbtrail -_ismbbtrail_l -_ismbcalnum -_ismbcalnum_l -_ismbcalpha -_ismbcalpha_l -_ismbcdigit -_ismbcdigit_l -_ismbcgraph -_ismbcgraph_l -_ismbchira -_ismbchira_l -_ismbckata -_ismbckata_l -_ismbcl0 -_ismbcl0_l -_ismbcl1 -_ismbcl1_l -_ismbcl2 -_ismbcl2_l -_ismbclegal -_ismbclegal_l -_ismbclower -_ismbclower_l -_ismbcprint -_ismbcprint_l -_ismbcpunct -_ismbcpunct_l -_ismbcspace -_ismbcspace_l -_ismbcsymbol -_ismbcsymbol_l -_ismbcupper -_ismbcupper_l -_ismbslead -_ismbslead_l -_ismbstrail -_ismbstrail_l -_isnan -_isnanf -_isprint_l -_isspace_l -_isupper_l -_iswalnum_l -_iswalpha_l -_iswcntrl_l -_iswctype_l -_iswdigit_l -_iswgraph_l -_iswlower_l -_iswprint_l -_iswpunct_l -_iswspace_l -_iswupper_l -_iswxdigit_l -_isxdigit_l -_itoa -_itoa_s -_itow -_itow_s -_j0 -_j1 -_jn -_kbhit -_lfind -_lfind_s -_local_unwind -_localtime32 -_localtime32_s -_localtime64 -_localtime64_s -_lock -_locking -_logb -_logbf -_lrotl -_lrotr -_lsearch -_lsearch_s -_lseek -_lseeki64 -_ltoa -_ltoa_s -_ltow -_ltow_s -_makepath -_makepath_s -_malloc_dbg -_mbbtombc -_mbbtombc_l -_mbbtype -_mbcasemap -_mbccpy -_mbccpy_l -_mbccpy_s -_mbccpy_s_l -_mbcjistojms -_mbcjistojms_l -_mbcjmstojis -_mbcjmstojis_l -_mbclen -_mbclen_l -_mbctohira -_mbctohira_l -_mbctokata -_mbctokata_l -_mbctolower -_mbctolower_l -_mbctombb -_mbctombb_l -_mbctoupper -_mbctoupper_l -_mbctype -_mblen_l -_mbsbtype -_mbsbtype_l -_mbscat -_mbscat_s -_mbscat_s_l -_mbschr -_mbschr_l -_mbscmp -_mbscmp_l -_mbscoll -_mbscoll_l -_mbscpy -_mbscpy_s -_mbscpy_s_l -_mbscspn -_mbscspn_l -_mbsdec -_mbsdec_l -_mbsdup -_mbsicmp -_mbsicmp_l -_mbsicoll -_mbsicoll_l -_mbsinc -_mbsinc_l -_mbslen -_mbslen_l -_mbslwr -_mbslwr_l -_mbslwr_s -_mbslwr_s_l -_mbsnbcat -_mbsnbcat_l -_mbsnbcat_s -_mbsnbcat_s_l -_mbsnbcmp -_mbsnbcmp_l -_mbsnbcnt -_mbsnbcnt_l -_mbsnbcoll -_mbsnbcoll_l -_mbsnbcpy -_mbsnbcpy_l -_mbsnbcpy_s -_mbsnbcpy_s_l -_mbsnbicmp -_mbsnbicmp_l -_mbsnbicoll -_mbsnbicoll_l -_mbsnbset -_mbsnbset_l -_mbsnbset_s -_mbsnbset_s_l -_mbsncat -_mbsncat_l -_mbsncat_s -_mbsncat_s_l -_mbsnccnt -_mbsnccnt_l -_mbsncmp -_mbsncmp_l -_mbsncoll -_mbsncoll_l -_mbsncpy -_mbsncpy_l -_mbsncpy_s -_mbsncpy_s_l -_mbsnextc -_mbsnextc_l -_mbsnicmp -_mbsnicmp_l -_mbsnicoll -_mbsnicoll_l -_mbsninc -_mbsninc_l -_mbsnlen -_mbsnlen_l -_mbsnset -_mbsnset_l -_mbsnset_s -_mbsnset_s_l -_mbspbrk -_mbspbrk_l -_mbsrchr -_mbsrchr_l -_mbsrev -_mbsrev_l -_mbsset -_mbsset_l -_mbsset_s -_mbsset_s_l -_mbsspn -_mbsspn_l -_mbsspnp -_mbsspnp_l -_mbsstr -_mbsstr_l -_mbstok -_mbstok_l -_mbstok_s -_mbstok_s_l -_mbstowcs_l -_mbstowcs_s_l -_mbstrlen -_mbstrlen_l -_mbstrnlen -_mbstrnlen_l -_mbsupr -_mbsupr_l -_mbsupr_s -_mbsupr_s_l -_mbtowc_l -_memccpy -_memicmp -_memicmp_l -_mkdir -_mkgmtime -_mkgmtime32 -_mkgmtime64 -_mktemp -_mktemp_s -_mktime32 -_mktime64 -_msize -_msize_dbg -_nextafter -_nextafterf -_onexit -_open -_open_osfhandle -_osplatform -_osver -_pclose -_pctype -_pgmptr -_pipe -_popen -_printf_l -_printf_p -_printf_p_l -_printf_s_l -_purecall -_putch -_putenv -_putenv_s -_putw -_putwch -_putws -_pwctype -_read -_realloc_dbg -_resetstkoflw -_rmdir -_rmtmp -_rotl -_rotl64 -_rotr -_rotr64 -_scalb -_scalbf -_scanf_l -_scanf_s_l -_scprintf -_scprintf_l -_scprintf_p_l -_scwprintf -_scwprintf_l -_scwprintf_p_l -_searchenv -_searchenv_s -_set_controlfp -_set_doserrno -_set_errno -_set_error_mode -_set_fileinfo -_set_fmode -_set_output_format -_set_sbh_threshold -_seterrormode -_setjmp -_setjmpex -_setmaxstdio -_setmbcp -_setmode -_setsystime -_sleep -_snprintf -_snprintf_c -_snprintf_c_l -_snprintf_l -_snprintf_s -_snprintf_s_l -_snscanf -_snscanf_l -_snscanf_s -_snscanf_s_l -_snwprintf -_snwprintf_l -_snwprintf_s -_snwprintf_s_l -_snwscanf -_snwscanf_l -_snwscanf_s -_snwscanf_s_l -_sopen -_sopen_s -_spawnl -_spawnle -_spawnlp -_spawnlpe -_spawnv -_spawnve -_spawnvp -_spawnvpe -_splitpath -_splitpath_s -_sprintf_l -_sprintf_p_l -_sprintf_s_l -_sscanf_l -_sscanf_s_l -_stat -_stat64 -_stati64 -_statusfp -_strcmpi -_strcoll_l -_strdate -_strdate_s -_strdup -_strdup_dbg -_strerror -_strerror_s -_stricmp -_stricmp_l -_stricoll -_stricoll_l -_strlwr -_strlwr_l -_strlwr_s -_strlwr_s_l -_strncoll -_strncoll_l -_strnicmp -_strnicmp_l -_strnicoll -_strnicoll_l -_strnset -_strnset_s -_strrev -_strset -_strset_s -_strtime -_strtime_s -_strtod_l -_strtoi64 -_strtoi64_l -_strtol_l -_strtoui64 -_strtoui64_l -_strtoul_l -_strupr -_strupr_l -_strupr_s -_strupr_s_l -_strxfrm_l -_swab -_swprintf -_swprintf_c -_swprintf_c_l -_swprintf_p_l -_swprintf_s_l -_swscanf_l -_swscanf_s_l -_sys_errlist -_sys_nerr -_tell -_telli64 -_tempnam -_tempnam_dbg -_time32 -_time64 -_timezone -_tolower -_tolower_l -_toupper -_toupper_l -_towlower_l -_towupper_l -_tzname -_tzset -_ui64toa -_ui64toa_s -_ui64tow -_ui64tow_s -_ultoa -_ultoa_s -_ultow -_ultow_s -_umask -_umask_s -_ungetch -_ungetwch -_unlink -_unlock -_utime -_utime32 -_utime64 -_vcprintf -_vcprintf_l -_vcprintf_p -_vcprintf_p_l -_vcprintf_s -_vcprintf_s_l -_vcwprintf -_vcwprintf_l -_vcwprintf_p -_vcwprintf_p_l -_vcwprintf_s -_vcwprintf_s_l -_vfprintf_l -_vfprintf_p -_vfprintf_p_l -_vfprintf_s_l -_vfwprintf_l -_vfwprintf_p -_vfwprintf_p_l -_vfwprintf_s_l -_vprintf_l -_vprintf_p -_vprintf_p_l -_vprintf_s_l -_vscprintf -_vscprintf_l -_vscprintf_p_l -_vscwprintf -_vscwprintf_l -_vscwprintf_p_l -_vsnprintf -_vsnprintf_c -_vsnprintf_c_l -_vsnprintf_l -_vsnprintf_s -_vsnprintf_s_l -_vsnwprintf -_vsnwprintf_l -_vsnwprintf_s -_vsnwprintf_s_l -_vsprintf_l -_vsprintf_p -_vsprintf_p_l -_vsprintf_s_l -_vswprintf -_vswprintf_c -_vswprintf_c_l -_vswprintf_l -_vswprintf_p_l -_vswprintf_s_l -_vwprintf_l -_vwprintf_p -_vwprintf_p_l -_vwprintf_s_l -_waccess -_waccess_s -_wasctime -_wasctime_s -_wassert -_wchdir -_wchmod -_wcmdln -_wcreat -_wcscoll_l -_wcsdup -_wcsdup_dbg -_wcserror -_wcserror_s -_wcsftime_l -_wcsicmp -_wcsicmp_l -_wcsicoll -_wcsicoll_l -_wcslwr -_wcslwr_l -_wcslwr_s -_wcslwr_s_l -_wcsncoll -_wcsncoll_l -_wcsnicmp -_wcsnicmp_l -_wcsnicoll -_wcsnicoll_l -_wcsnset -_wcsnset_s -_wcsrev -_wcsset -_wcsset_s -_wcstod_l -_wcstoi64 -_wcstoi64_l -_wcstol_l -_wcstombs_l -_wcstombs_s_l -_wcstoui64 -_wcstoui64_l -_wcstoul_l -_wcsupr -_wcsupr_l -_wcsupr_s -_wcsupr_s_l -_wcsxfrm_l -_wctime -_wctime32 -_wctime32_s -_wctime64 -_wctime64_s -_wctomb_l -_wctomb_s_l -_wctype -_wenviron -_wexecl -_wexecle -_wexeclp -_wexeclpe -_wexecv -_wexecve -_wexecvp -_wexecvpe -_wfdopen -_wfindfirst -_wfindfirst64 -_wfindfirsti64 -_wfindnext -_wfindnext64 -_wfindnexti64 -_wfopen -_wfopen_s -_wfreopen -_wfreopen_s -_wfsopen -_wfullpath -_wfullpath_dbg -_wgetcwd -_wgetdcwd -_wgetenv -_wgetenv_s -_winmajor -_winminor -_winput_s -_winver -_wmakepath -_wmakepath_s -_wmkdir -_wmktemp -_wmktemp_s -_wopen -_woutput_s -_wperror -_wpgmptr -_wpopen -_wprintf_l -_wprintf_p -_wprintf_p_l -_wprintf_s_l -_wputenv -_wputenv_s -_wremove -_wrename -_write -_wrmdir -_wscanf_l -_wscanf_s_l -_wsearchenv -_wsearchenv_s -_wsetlocale -_wsopen -_wsopen_s -_wspawnl -_wspawnle -_wspawnlp -_wspawnlpe -_wspawnv -_wspawnve -_wspawnvp -_wspawnvpe -_wsplitpath -_wsplitpath_s -_wstat -_wstat64 -_wstati64 -_wstrdate -_wstrdate_s -_wstrtime -_wstrtime_s -_wsystem -_wtempnam -_wtempnam_dbg -_wtmpnam -_wtmpnam_s -_wtof -_wtof_l -_wtoi -_wtoi64 -_wtoi64_l -_wtoi_l -_wtol -_wtol_l -_wunlink -_wutime -_wutime32 -_wutime64 -_y0 -_y1 -_yn -abort -abs -acos -acosf -asctime -asctime_s -asin -asinf -atan -atan2 -atan2f -atanf -atexit -atof -atoi -atol -bsearch -bsearch_s -btowc -calloc -ceil -ceilf -clearerr -clearerr_s -clock -cos -cosf -cosh -coshf -ctime -difftime -div -exit -exp -expf -fabs -fclose -feof -ferror -fflush -fgetc -fgetpos -fgets -fgetwc -fgetws -floor -floorf -fmod -fmodf -fopen -fopen_s -fprintf -fprintf_s -fputc -fputs -fputwc -fputws -fread -free -freopen -freopen_s -frexp -fscanf -fscanf_s -fseek -fsetpos -ftell -fwprintf -fwprintf_s -fwrite -fwscanf -fwscanf_s -getc -getchar -getenv -getenv_s -gets -getwc -getwchar -gmtime -is_wctype -isalnum -isalpha -iscntrl -isdigit -isgraph -isleadbyte -islower -isprint -ispunct -isspace -isupper -iswalnum -iswalpha -iswascii -iswcntrl -iswctype -iswdigit -iswgraph -iswlower -iswprint -iswpunct -iswspace -iswupper -iswxdigit -isxdigit -labs -ldexp -ldiv -localeconv -localtime -log -log10 -log10f -logf -longjmp -malloc -mblen -mbrlen -mbrtowc -mbsdup_dbg -mbsrtowcs -mbsrtowcs_s -mbstowcs -mbstowcs_s -mbtowc -memchr -memcmp -memcpy -memcpy_s -memmove -memmove_s -memset -mktime -modf -modff -perror -pow -powf -printf -printf_s -putc -putchar -puts -putwc -putwchar -qsort -qsort_s -raise -rand -rand_s -realloc -remove -rename -rewind -scanf -scanf_s -setbuf -setjmp -setlocale -setvbuf -signal -sin -sinf -sinh -sinhf -sprintf -sprintf_s -sqrt -sqrtf -srand -sscanf -sscanf_s -strcat -strcat_s -strchr -strcmp -strcoll -strcpy -strcpy_s -strcspn -strerror -strerror_s -strftime -strlen -strncat -strncat_s -strncmp -strncpy -strncpy_s -strnlen -strpbrk -strrchr -strspn -strstr -strtod -strtok -strtok_s -strtol -strtoul -strxfrm -swprintf -swprintf_s -swscanf -swscanf_s -system -tan -tanf -tanh -tanhf -time -tmpfile -tmpfile_s -tmpnam -tmpnam_s -tolower -toupper -towlower -towupper -ungetc -ungetwc -utime -vfprintf -vfprintf_s -vfwprintf -vfwprintf_s -vprintf -vprintf_s -vsnprintf -vsprintf -vsprintf_s -vswprintf -vswprintf_s -vwprintf -vwprintf_s -wcrtomb -wcrtomb_s -wcscat -wcscat_s -wcschr -wcscmp -wcscoll -wcscpy -wcscpy_s -wcscspn -wcsftime -wcslen -wcsncat -wcsncat_s -wcsncmp -wcsncpy -wcsncpy_s -wcsnlen -wcspbrk -wcsrchr -wcsrtombs -wcsrtombs_s -wcsspn -wcsstr -wcstod -wcstok -wcstok_s -wcstol -wcstombs -wcstombs_s -wcstoul -wcsxfrm -wctob -wctomb -wctomb_s -wprintf -wprintf_s -wscanf -wscanf_s diff --git a/win32/lib/user32.def b/win32/lib/user32.def deleted file mode 100644 index a034dac2..00000000 --- a/win32/lib/user32.def +++ /dev/null @@ -1,658 +0,0 @@ -LIBRARY user32.dll - -EXPORTS -ActivateKeyboardLayout -AdjustWindowRect -AdjustWindowRectEx -AlignRects -AllowSetForegroundWindow -AnimateWindow -AnyPopup -AppendMenuA -AppendMenuW -ArrangeIconicWindows -AttachThreadInput -BeginDeferWindowPos -BeginPaint -BlockInput -BringWindowToTop -BroadcastSystemMessage -BroadcastSystemMessageA -BroadcastSystemMessageW -CalcChildScroll -CallMsgFilter -CallMsgFilterA -CallMsgFilterW -CallNextHookEx -CallWindowProcA -CallWindowProcW -CascadeChildWindows -CascadeWindows -ChangeClipboardChain -ChangeDisplaySettingsA -ChangeDisplaySettingsExA -ChangeDisplaySettingsExW -ChangeDisplaySettingsW -ChangeMenuA -ChangeMenuW -CharLowerA -CharLowerBuffA -CharLowerBuffW -CharLowerW -CharNextA -CharNextExA -CharNextExW -CharNextW -CharPrevA -CharPrevExA -CharPrevExW -CharPrevW -CharToOemA -CharToOemBuffA -CharToOemBuffW -CharToOemW -CharUpperA -CharUpperBuffA -CharUpperBuffW -CharUpperW -CheckDlgButton -CheckMenuItem -CheckMenuRadioItem -CheckRadioButton -ChildWindowFromPoint -ChildWindowFromPointEx -ClientThreadConnect -ClientToScreen -ClipCursor -CloseClipboard -CloseDesktop -CloseWindow -CloseWindowStation -CopyAcceleratorTableA -CopyAcceleratorTableW -CopyIcon -CopyImage -CopyRect -CountClipboardFormats -CreateAcceleratorTableA -CreateAcceleratorTableW -CreateCaret -CreateCursor -CreateDesktopA -CreateDesktopW -CreateDialogIndirectParamA -CreateDialogIndirectParamW -CreateDialogParamA -CreateDialogParamW -CreateIcon -CreateIconFromResource -CreateIconFromResourceEx -CreateIconIndirect -CreateMDIWindowA -CreateMDIWindowW -CreateMenu -CreatePopupMenu -CreateWindowExA -CreateWindowExW -CreateWindowStationA -CreateWindowStationW -DdeAbandonTransaction -DdeAccessData -DdeAddData -DdeClientTransaction -DdeCmpStringHandles -DdeConnect -DdeConnectList -DdeCreateDataHandle -DdeCreateStringHandleA -DdeCreateStringHandleW -DdeDisconnect -DdeDisconnectList -DdeEnableCallback -DdeFreeDataHandle -DdeFreeStringHandle -DdeGetData -DdeGetLastError -DdeImpersonateClient -DdeInitializeA -DdeInitializeW -DdeKeepStringHandle -DdeNameService -DdePostAdvise -DdeQueryConvInfo -DdeQueryNextServer -DdeQueryStringA -DdeQueryStringW -DdeReconnect -DdeSetQualityOfService -DdeSetUserHandle -DdeUnaccessData -DdeUninitialize -DefDlgProcA -DefDlgProcW -DefFrameProcA -DefFrameProcW -DefMDIChildProcA -DefMDIChildProcW -DefWindowProcA -DefWindowProcW -DeferWindowPos -DeleteMenu -DestroyAcceleratorTable -DestroyCaret -DestroyCursor -DestroyIcon -DestroyMenu -DestroyWindow -DialogBoxIndirectParamA -DialogBoxIndirectParamW -DialogBoxParamA -DialogBoxParamW -DispatchMessageA -DispatchMessageW -DlgDirListA -DlgDirListComboBoxA -DlgDirListComboBoxW -DlgDirListW -DlgDirSelectComboBoxExA -DlgDirSelectComboBoxExW -DlgDirSelectExA -DlgDirSelectExW -DragDetect -DragObject -DrawAnimatedRects -DrawCaption -DrawCaptionTempA -DrawCaptionTempW -DrawEdge -DrawFocusRect -DrawFrame -DrawFrameControl -DrawIcon -DrawIconEx -DrawMenuBar -DrawMenuBarTemp -DrawStateA -DrawStateW -DrawTextA -DrawTextExA -DrawTextExW -DrawTextW -EditWndProc -EmptyClipboard -EnableMenuItem -EnableScrollBar -EnableWindow -EndDeferWindowPos -EndDialog -EndMenu -EndPaint -EndTask -EnumChildWindows -EnumClipboardFormats -EnumDesktopWindows -EnumDesktopsA -EnumDesktopsW -EnumDisplayDevicesA -EnumDisplayDevicesW -EnumDisplayMonitors -EnumDisplaySettingsA -EnumDisplaySettingsExA -EnumDisplaySettingsExW -EnumDisplaySettingsW -EnumPropsA -EnumPropsExA -EnumPropsExW -EnumPropsW -EnumThreadWindows -EnumWindowStationsA -EnumWindowStationsW -EnumWindows -EqualRect -ExcludeUpdateRgn -ExitWindowsEx -FillRect -FindWindowA -FindWindowExA -FindWindowExW -FindWindowW -FlashWindow -FlashWindowEx -FrameRect -FreeDDElParam -GetActiveWindow -GetAltTabInfo -GetAncestor -GetAsyncKeyState -GetCapture -GetCaretBlinkTime -GetCaretPos -GetClassInfoA -GetClassInfoExA -GetClassInfoExW -GetClassInfoW -GetClassLongA -GetClassLongW -GetClassNameA -GetClassNameW -GetClassWord -GetClientRect -GetClipCursor -GetClipboardData -GetClipboardFormatNameA -GetClipboardFormatNameW -GetClipboardOwner -GetClipboardSequenceNumber -GetClipboardViewer -GetComboBoxInfo -GetCursor -GetCursorInfo -GetCursorPos -GetDC -GetDCEx -GetDesktopWindow -GetDialogBaseUnits -GetDlgCtrlID -GetDlgItem -GetDlgItemInt -GetDlgItemTextA -GetDlgItemTextW -GetDoubleClickTime -GetFocus -GetForegroundWindow -GetGUIThreadInfo -GetGuiResources -GetIconInfo -GetInputDesktop -GetInputState -GetInternalWindowPos -GetKBCodePage -GetKeyNameTextA -GetKeyNameTextW -GetKeyState -GetKeyboardLayout -GetKeyboardLayoutList -GetKeyboardLayoutNameA -GetKeyboardLayoutNameW -GetKeyboardState -GetKeyboardType -GetLastActivePopup -GetListBoxInfo -GetMenu -GetMenuBarInfo -GetMenuCheckMarkDimensions -GetMenuContextHelpId -GetMenuDefaultItem -GetMenuInfo -GetMenuItemCount -GetMenuItemID -GetMenuItemInfoA -GetMenuItemInfoW -GetMenuItemRect -GetMenuState -GetMenuStringA -GetMenuStringW -GetMessageA -GetMessageExtraInfo -GetMessagePos -GetMessageTime -GetMessageW -GetMonitorInfoA -GetMonitorInfoW -GetMouseMovePoints -GetMouseMovePointsEx -GetNextDlgGroupItem -GetNextDlgTabItem -GetNextQueueWindow -GetOpenClipboardWindow -GetParent -GetPriorityClipboardFormat -GetProcessDefaultLayout -GetProcessWindowStation -GetPropA -GetPropW -GetQueueStatus -GetScrollBarInfo -GetScrollInfo -GetScrollPos -GetScrollRange -GetShellWindow -GetSubMenu -GetSysColor -GetSysColorBrush -GetSystemMenu -GetSystemMetrics -GetTabbedTextExtentA -GetTabbedTextExtentW -GetThreadDesktop -GetTitleBarInfo -GetTopWindow -GetUpdateRect -GetUpdateRgn -GetUserObjectInformationA -GetUserObjectInformationW -GetUserObjectSecurity -GetWindow -GetWindowContextHelpId -GetWindowDC -GetWindowInfo -GetWindowLongPtrA -GetWindowLongPtrW -SetWindowLongPtrA -SetWindowLongPtrW -GetWindowLongA -GetWindowLongW -GetWindowModuleFileNameA -GetWindowModuleFileNameW -GetWindowPlacement -GetWindowRect -GetWindowRgn -GetWindowTextA -GetWindowTextLengthA -GetWindowTextLengthW -GetWindowTextW -GetWindowThreadProcessId -GetWindowWord -GrayStringA -GrayStringW -HasSystemSleepStarted -HideCaret -HiliteMenuItem -IMPGetIMEA -IMPGetIMEW -IMPQueryIMEA -IMPQueryIMEW -IMPSetIMEA -IMPSetIMEW -ImpersonateDdeClientWindow -InSendMessage -InSendMessageEx -InflateRect -InitSharedTable -InitTask -InsertMenuA -InsertMenuItemA -InsertMenuItemW -InsertMenuW -InternalGetWindowText -IntersectRect -InvalidateRect -InvalidateRgn -InvertRect -IsCharAlphaA -IsCharAlphaNumericA -IsCharAlphaNumericW -IsCharAlphaW -IsCharLowerA -IsCharLowerW -IsCharUpperA -IsCharUpperW -IsChild -IsClipboardFormatAvailable -IsDialogMessage -IsDialogMessageA -IsDialogMessageW -IsDlgButtonChecked -IsHungThread -IsIconic -IsMenu -IsRectEmpty -IsWindow -IsWindowEnabled -IsWindowUnicode -IsWindowVisible -IsZoomed -KillTimer -LoadAcceleratorsA -LoadAcceleratorsW -LoadBitmapA -LoadBitmapW -LoadCursorA -LoadCursorFromFileA -LoadCursorFromFileW -LoadCursorW -LoadIconA -LoadIconW -LoadImageA -LoadImageW -LoadKeyboardLayoutA -LoadKeyboardLayoutW -LoadMenuA -LoadMenuIndirectA -LoadMenuIndirectW -LoadMenuW -LoadStringA -LoadStringW -LockSetForegroundWindow -LockWindowStation -LockWindowUpdate -LookupIconIdFromDirectory -LookupIconIdFromDirectoryEx -MapDialogRect -MapVirtualKeyA -MapVirtualKeyExA -MapVirtualKeyExW -MapVirtualKeyW -MapWindowPoints -MenuItemFromPoint -MessageBeep -MessageBoxA -MessageBoxExA -MessageBoxExW -MessageBoxIndirectA -MessageBoxIndirectW -MessageBoxW -ModifyAccess -ModifyMenuA -ModifyMenuW -MonitorFromPoint -MonitorFromRect -MonitorFromWindow -MoveWindow -MsgWaitForMultipleObjects -MsgWaitForMultipleObjectsEx -NotifyWinEvent -OemKeyScan -OemToCharA -OemToCharBuffA -OemToCharBuffW -OemToCharW -OffsetRect -OpenClipboard -OpenDesktopA -OpenDesktopW -OpenIcon -OpenInputDesktop -OpenWindowStationA -OpenWindowStationW -PackDDElParam -PaintDesktop -PeekMessageA -PeekMessageW -PlaySoundEvent -PostMessageA -PostMessageW -PostQuitMessage -PostThreadMessageA -PostThreadMessageW -PtInRect -RealChildWindowFromPoint -RealGetWindowClass -RedrawWindow -RegisterClassA -RegisterClassExA -RegisterClassExW -RegisterClassW -RegisterClipboardFormatA -RegisterClipboardFormatW -RegisterDeviceNotificationA -RegisterDeviceNotificationW -RegisterHotKey -RegisterLogonProcess -RegisterNetworkCapabilities -RegisterSystemThread -RegisterTasklist -RegisterWindowMessageA -RegisterWindowMessageW -ReleaseCapture -ReleaseDC -RemoveMenu -RemovePropA -RemovePropW -ReplyMessage -ReuseDDElParam -ScreenToClient -ScrollDC -ScrollWindow -ScrollWindowEx -SendDlgItemMessageA -SendDlgItemMessageW -SendIMEMessageExA -SendIMEMessageExW -SendInput -SendMessageA -SendMessageCallbackA -SendMessageCallbackW -SendMessageTimeoutA -SendMessageTimeoutW -SendMessageW -SendNotifyMessageA -SendNotifyMessageW -SetActiveWindow -SetCapture -SetCaretBlinkTime -SetCaretPos -SetClassLongA -SetClassLongW -SetClassWord -SetClipboardData -SetClipboardViewer -SetCursor -SetCursorPos -SetDebugErrorLevel -SetDeskWallpaper -SetDesktopBitmap -SetDlgItemInt -SetDlgItemTextA -SetDlgItemTextW -SetDoubleClickTime -SetFocus -SetForegroundWindow -SetInternalWindowPos -SetKeyboardState -SetLastErrorEx -SetLogonNotifyWindow -SetMenu -SetMenuContextHelpId -SetMenuDefaultItem -SetMenuInfo -SetMenuItemBitmaps -SetMenuItemInfoA -SetMenuItemInfoW -SetMessageExtraInfo -SetMessageQueue -SetParent -SetProcessDefaultLayout -SetProcessWindowStation -SetPropA -SetPropW -SetRect -SetRectEmpty -SetScrollInfo -SetScrollPos -SetScrollRange -SetShellWindow -SetSysColors -SetSysColorsTemp -SetSystemCursor -SetThreadDesktop -SetTimer -SetUserObjectInformationA -SetUserObjectInformationW -SetUserObjectSecurity -SetWinEventHook -SetWindowContextHelpId -SetWindowFullScreenState -SetWindowLongA -SetWindowLongW -SetWindowPlacement -SetWindowPos -SetWindowRgn -SetWindowTextA -SetWindowTextW -SetWindowWord -SetWindowsHookA -SetWindowsHookExA -SetWindowsHookExW -SetWindowsHookW -ShowCaret -ShowCursor -ShowOwnedPopups -ShowScrollBar -ShowWindow -ShowWindowAsync -SubtractRect -SwapMouseButton -SwitchDesktop -SwitchToThisWindow -SysErrorBox -SystemParametersInfoA -SystemParametersInfoW -TabbedTextOutA -TabbedTextOutW -TileChildWindows -TileWindows -ToAscii -ToAsciiEx -ToUnicode -ToUnicodeEx -TrackMouseEvent -TrackPopupMenu -TrackPopupMenuEx -TranslateAccelerator -TranslateAcceleratorA -TranslateAcceleratorW -TranslateMDISysAccel -TranslateMessage -UnhookWinEvent -UnhookWindowsHook -UnhookWindowsHookEx -UnionRect -UnloadKeyboardLayout -UnlockWindowStation -UnpackDDElParam -UnregisterClassA -UnregisterClassW -UnregisterDeviceNotification -UnregisterHotKey -UpdateWindow -UserClientDllInitialize -UserIsSystemResumeAutomatic -UserSetDeviceHoldState -UserSignalProc -UserTickleTimer -ValidateRect -ValidateRgn -VkKeyScanA -VkKeyScanExA -VkKeyScanExW -VkKeyScanW -WINNLSEnableIME -WINNLSGetEnableStatus -WINNLSGetIMEHotkey -WNDPROC_CALLBACK -WaitForInputIdle -WaitMessage -WinHelpA -WinHelpW -WinOldAppHackoMatic -WindowFromDC -WindowFromPoint -YieldTask -_SetProcessDefaultLayout -keybd_event -mouse_event -wsprintfA -wsprintfW -wvsprintfA -wvsprintfW diff --git a/win32/lib/wincrt1.c b/win32/lib/wincrt1.c deleted file mode 100644 index d74a0cf8..00000000 --- a/win32/lib/wincrt1.c +++ /dev/null @@ -1,86 +0,0 @@ -//+--------------------------------------------------------------------------- - -// _UNICODE for tchar.h, UNICODE for API -#include - -#include -#include - -#define __UNKNOWN_APP 0 -#define __CONSOLE_APP 1 -#define __GUI_APP 2 -void __set_app_type(int); -void _controlfp(unsigned a, unsigned b); - -#ifdef _UNICODE -#define __tgetmainargs __wgetmainargs -#define _twinstart _wwinstart -#define _runtwinmain _runwwinmain -int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int); -#else -#define __tgetmainargs __getmainargs -#define _twinstart _winstart -#define _runtwinmain _runwinmain -#endif - -typedef struct { int newmode; } _startupinfo; -int __cdecl __tgetmainargs(int *pargc, _TCHAR ***pargv, _TCHAR ***penv, int globb, _startupinfo*); - -#include "crtinit.c" - -static int go_winmain(TCHAR *arg1) -{ - STARTUPINFO si; - _TCHAR *szCmd, *p; - int fShow; - int retval; - - GetStartupInfo(&si); - if (si.dwFlags & STARTF_USESHOWWINDOW) - fShow = si.wShowWindow; - else - fShow = SW_SHOWDEFAULT; - - szCmd = NULL, p = GetCommandLine(); - if (arg1) - szCmd = _tcsstr(p, arg1); - if (NULL == szCmd) - szCmd = _tcsdup(__T("")); - else if (szCmd > p && szCmd[-1] == __T('"')) - --szCmd; -#if defined __i386__ || defined __x86_64__ - _controlfp(0x10000, 0x30000); -#endif - run_ctors(__argc, __targv, _tenviron); - retval = _tWinMain(GetModuleHandle(NULL), NULL, szCmd, fShow); - run_dtors(); - return retval; -} - -static LONG WINAPI catch_sig(EXCEPTION_POINTERS *ex) -{ - return _XcptFilter(ex->ExceptionRecord->ExceptionCode, ex); -} - -int _twinstart(void) -{ - _startupinfo start_info_con = {0}; - SetUnhandledExceptionFilter(catch_sig); - __set_app_type(__GUI_APP); - __tgetmainargs(&__argc, &__targv, &_tenviron, 0, &start_info_con); - exit(go_winmain(__argc > 1 ? __targv[1] : NULL)); -} - -int _runtwinmain(int argc, /* as tcc passed in */ char **argv) -{ -#ifdef UNICODE - _startupinfo start_info = {0}; - __tgetmainargs(&__argc, &__targv, &_tenviron, 0, &start_info); - /* may be wrong when tcc has received wildcards (*.c) */ - if (argc < __argc) - __targv += __argc - argc, __argc = argc; -#else - __argc = argc, __targv = argv; -#endif - return go_winmain(__argc > 1 ? __targv[1] : NULL); -} diff --git a/win32/lib/wincrt1w.c b/win32/lib/wincrt1w.c deleted file mode 100644 index a7d349e1..00000000 --- a/win32/lib/wincrt1w.c +++ /dev/null @@ -1,3 +0,0 @@ -#define _UNICODE 1 -#define UNICODE 1 -#include "wincrt1.c" diff --git a/win32/lib/ws2_32.def b/win32/lib/ws2_32.def deleted file mode 100644 index b6182669..00000000 --- a/win32/lib/ws2_32.def +++ /dev/null @@ -1,198 +0,0 @@ -LIBRARY ws2_32.dll - -EXPORTS -FreeAddrInfoEx -FreeAddrInfoExW -FreeAddrInfoW -GetAddrInfoExA -GetAddrInfoExCancel -GetAddrInfoExOverlappedResult -GetAddrInfoExW -GetAddrInfoW -GetHostNameW -GetNameInfoW -InetNtopW -InetPtonW -SetAddrInfoExA -SetAddrInfoExW -WEP -WPUCompleteOverlappedRequest -WPUGetProviderPathEx -WSAAccept -WSAAddressToStringA -WSAAddressToStringW -WSAAdvertiseProvider -WSAAsyncGetHostByAddr -WSAAsyncGetHostByName -WSAAsyncGetProtoByName -WSAAsyncGetProtoByNumber -WSAAsyncGetServByName -WSAAsyncGetServByPort -WSAAsyncSelect -WSACancelAsyncRequest -WSACancelBlockingCall -WSACleanup -WSACloseEvent -WSAConnect -WSAConnectByList -WSAConnectByNameA -WSAConnectByNameW -WSACreateEvent -WSADuplicateSocketA -WSADuplicateSocketW -WSAEnumNameSpaceProvidersA -WSAEnumNameSpaceProvidersExA -WSAEnumNameSpaceProvidersExW -WSAEnumNameSpaceProvidersW -WSAEnumNetworkEvents -WSAEnumProtocolsA -WSAEnumProtocolsW -WSAEventSelect -WSAGetLastError -WSAGetOverlappedResult -WSAGetQOSByName -WSAGetServiceClassInfoA -WSAGetServiceClassInfoW -WSAGetServiceClassNameByClassIdA -WSAGetServiceClassNameByClassIdW -WSAHtonl -WSAHtons -WSAInstallServiceClassA -WSAInstallServiceClassW -WSAIoctl -WSAIsBlocking -WSAJoinLeaf -WSALookupServiceBeginA -WSALookupServiceBeginW -WSALookupServiceEnd -WSALookupServiceNextA -WSALookupServiceNextW -WSANSPIoctl -WSANtohl -WSANtohs -WSAPoll -WSAProviderCompleteAsyncCall -WSAProviderConfigChange -WSARecv -WSARecvDisconnect -WSARecvFrom -WSARemoveServiceClass -WSAResetEvent -WSASend -WSASendDisconnect -WSASendMsg -WSASendTo -WSASetBlockingHook -WSASetEvent -WSASetLastError -WSASetServiceA -WSASetServiceW -WSASocketA -WSASocketW -WSAStartup -WSAStringToAddressA -WSAStringToAddressW -WSAUnadvertiseProvider -WSAUnhookBlockingHook -WSAWaitForMultipleEvents -WSApSetPostRoutine -WSCDeinstallProvider -WSCDeinstallProvider32 -WSCDeinstallProviderEx -WSCEnableNSProvider -WSCEnableNSProvider32 -WSCEnumNameSpaceProviders32 -WSCEnumNameSpaceProvidersEx32 -WSCEnumProtocols -WSCEnumProtocols32 -WSCEnumProtocolsEx -WSCGetApplicationCategory -WSCGetApplicationCategoryEx -WSCGetProviderInfo -WSCGetProviderInfo32 -WSCGetProviderPath -WSCGetProviderPath32 -WSCInstallNameSpace -WSCInstallNameSpace32 -WSCInstallNameSpaceEx -WSCInstallNameSpaceEx2 -WSCInstallNameSpaceEx32 -WSCInstallProvider -WSCInstallProvider64_32 -WSCInstallProviderAndChains64_32 -WSCInstallProviderEx -WSCSetApplicationCategory -WSCSetApplicationCategoryEx -WSCSetProviderInfo -WSCSetProviderInfo32 -WSCUnInstallNameSpace -WSCUnInstallNameSpace32 -WSCUnInstallNameSpaceEx2 -WSCUpdateProvider -WSCUpdateProvider32 -WSCUpdateProviderEx -WSCWriteNameSpaceOrder -WSCWriteNameSpaceOrder32 -WSCWriteProviderOrder -WSCWriteProviderOrder32 -WSCWriteProviderOrderEx -WahCloseApcHelper -WahCloseHandleHelper -WahCloseNotificationHandleHelper -WahCloseSocketHandle -WahCloseThread -WahCompleteRequest -WahCreateHandleContextTable -WahCreateNotificationHandle -WahCreateSocketHandle -WahDestroyHandleContextTable -WahDisableNonIFSHandleSupport -WahEnableNonIFSHandleSupport -WahEnumerateHandleContexts -WahInsertHandleContext -WahNotifyAllProcesses -WahOpenApcHelper -WahOpenCurrentThread -WahOpenHandleHelper -WahOpenNotificationHandleHelper -WahQueueUserApc -WahReferenceContextByHandle -WahRemoveHandleContext -WahWaitForNotification -WahWriteLSPEvent -__WSAFDIsSet -accept -bind -closesocket -connect -freeaddrinfo -getaddrinfo -gethostbyaddr -gethostbyname -gethostname -getnameinfo -getpeername -getprotobyname -getprotobynumber -getservbyname -getservbyport -getsockname -getsockopt -htonl -htons -inet_addr -inet_ntoa -inet_ntop -inet_pton -ioctlsocket -listen -ntohl -ntohs -recv -recvfrom -select -send -sendto -setsockopt -shutdown -socket diff --git a/win32/tcc-win32.txt b/win32/tcc-win32.txt deleted file mode 100644 index d2cb7668..00000000 --- a/win32/tcc-win32.txt +++ /dev/null @@ -1,192 +0,0 @@ - - TinyCC - ====== - - This file contains specific information for usage of TinyCC - under MS-Windows. See tcc-doc.html to have all the features. - - - Installation from the binary ZIP package: - ----------------------------------------- - Unzip the package to a directory of your choice. - - - Set the system PATH: - -------------------- - To be able to invoke the compiler from everywhere on your computer by - just typing "tcc", please add the directory containing tcc.exe to your - system PATH. - - - Include and library search paths - -------------------------------- - On windows, the standard "include" and "lib" directories are searched - relatively from the location of the executables (tcc.exe, libtcc.dll). - - - Examples: - --------- - Open a console window (DOS box) and 'cd' to the examples directory. - - For the 'Fibonacci' example type: - - tcc fib.c - - For the 'Hello Windows' GUI example type: - - tcc hello_win.c - - For the 'Hello DLL' example type - - tcc -shared dll.c - tcc -impdef dll.dll (optional) - tcc hello_dll.c dll.def - - - Using libtcc as JIT compiler in your program - -------------------------------------------- - Check out the 'libtcc_test' example: - - - Running it from source: - tcc -I libtcc libtcc/libtcc.def -run examples/libtcc_test.c - - - Compiling with TCC: - tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def - - - Compiling with MinGW: - gcc examples/libtcc_test.c -I libtcc libtcc.dll -o libtcc_test.exe - - - Compiling with MSVC: - lib /def:libtcc\libtcc.def /out:libtcc.lib - cl /MD examples/libtcc_test.c -I libtcc libtcc.lib - - - Import Definition Files: - ------------------------ - To link with Windows system DLLs, TCC uses import definition - files (.def) instead of libraries. - - The now built-in 'tiny_impdef' program may be used to make - additional .def files for any DLL. For example - - tcc -impdef [-v] opengl32.dll [-o opengl32.def] - - Put opengl32.def into the tcc/lib directory. Specify -lopengl32 at - the TCC commandline to link a program that uses opengl32.dll. - - - Header Files: - ------------- - The system header files (except _mingw.h) are from the MinGW - distribution: - - http://www.mingw.org/ - - From the windows headers, only a minimal set is included. If you need - more, get MinGW's "w32api" package. Extract the files from "include" - into your "tcc/include/winapi" directory. - - If the latest mingw headers don't play nice with the TinyCC headers, - there's also TinyCC-specific win32 headers package which contains - an "include" dir. Files in that dir are additional to the built-in - include files. At the time of writing there are few files in that - package which also exist as built-in headers: - - unistd.h - winapi/qos.h - winapi/winnls.h - winapi/ws2ipdef.h - winapi/ws2tcpip.h - winapi/windows.h - winapi/winsock2.h - - With the exception of winapi/winsock2.h, these should overwrite the - built-in headers (unistd.h and winapi/windows.h are enhanced in that - package, winapi/winsock2.h is older than the built-in file - and with - less definitions, and the rest are identical). - - The latest package at the time of writing is winapi-full-for-0.9.27.zip - which works well also with TinyCC 0.9.28rc, and is available at: - - http://download.savannah.nongnu.org/releases/tinycc/ - - - Resource Files: - --------------- - TCC can link windows resources in coff format as generated by MinGW's - windres.exe. For example: - - windres -O coff app.rc -o appres.o - tcc app.c appres.o -o app.exe - - - Tiny Libmaker: - -------------- - The now built-in tiny_libmaker tool by Timovj Lahde can be used as - 'ar' replacement to make a library from several object files: - - tcc -ar [rcsv] library objectfiles ... - - - Compilation from source: - ------------------------ - * You can use the MinGW and MSYS tools available at - http://www.mingw.org - http://www.mingw-w64.org - http://www.msys2.org - - Untar the TCC archive and type in the MSYS shell: - ./configure [--prefix installpath] - make - make install - - The default install location is c:\Program Files\tcc - - Cygwin can be used too with its mingw cross-compiler installed: - ./configure --cross-prefix=i686-w64-mingw32- - (the prefix may vary) - - * Alternatively you can compile TCC with just GCC from MinGW using - > build-tcc.bat (from the win32 directory) - - Also MSVC can be used with the "VSTools Developer Command Prompt": - > build-tcc.bat -c cl - - or with an existing tcc (needs to be in a different directory) - > build-tcc.bat -c some-tcc-dir\tcc.exe - - Also you can copy/install everything into another directory: - > build-tcc.bat -i - - Limitations: - ------------ - - On the object file level, currently TCC supports only the ELF format, - not COFF as used by MinGW and MSVC. It is not possible to exchange - object files or libraries between TCC and these compilers. - - However libraries for TCC from objects by TCC can be made using - tcc -ar lib.a files.o ,,, - - - No leading underscore is generated in the ELF symbols. - - Documentation and License: - -------------------------- - TCC is distributed under the GNU Lesser General Public License. (See - COPYING file or http://www.gnu.org/licenses/lgpl-2.1.html) - - TinyCC homepage is at: - - http://fabrice.bellard.free.fr/tcc/ - - - WinAPI Help and 3rd-party tools: - -------------------------------- - The Windows API documentation (Win95) in a single .hlp file is - available on the lcc-win32 site as "win32hlp.exe" or from other - locations as "win32hlp_big.zip". - - A nice RAD tool to create windows resources (dialog boxes etc.) is - "ResEd", available at the RadASM website. - - - --- grischka diff --git a/x86_64-asm.h b/x86_64-asm.h deleted file mode 100644 index 883232ea..00000000 --- a/x86_64-asm.h +++ /dev/null @@ -1,549 +0,0 @@ - DEF_ASM_OP0(clc, 0xf8) /* must be first OP0 */ - DEF_ASM_OP0(cld, 0xfc) - DEF_ASM_OP0(cli, 0xfa) - DEF_ASM_OP0(clts, 0x0f06) - DEF_ASM_OP0(cmc, 0xf5) - DEF_ASM_OP0(lahf, 0x9f) - DEF_ASM_OP0(sahf, 0x9e) - DEF_ASM_OP0(pushfq, 0x9c) - DEF_ASM_OP0(popfq, 0x9d) - DEF_ASM_OP0(pushf, 0x9c) - DEF_ASM_OP0(popf, 0x9d) - DEF_ASM_OP0(stc, 0xf9) - DEF_ASM_OP0(std, 0xfd) - DEF_ASM_OP0(sti, 0xfb) - DEF_ASM_OP0(aaa, 0x37) - DEF_ASM_OP0(aas, 0x3f) - DEF_ASM_OP0(daa, 0x27) - DEF_ASM_OP0(das, 0x2f) - DEF_ASM_OP0(aad, 0xd50a) - DEF_ASM_OP0(aam, 0xd40a) - DEF_ASM_OP0(cbw, 0x6698) - DEF_ASM_OP0(cwd, 0x6699) - DEF_ASM_OP0(cwde, 0x98) - DEF_ASM_OP0(cdq, 0x99) - DEF_ASM_OP0(cbtw, 0x6698) - DEF_ASM_OP0(cwtl, 0x98) - DEF_ASM_OP0(cwtd, 0x6699) - DEF_ASM_OP0(cltd, 0x99) - DEF_ASM_OP0(cqto, 0x4899) - DEF_ASM_OP0(int3, 0xcc) - DEF_ASM_OP0(into, 0xce) - DEF_ASM_OP0(iret, 0xcf) - DEF_ASM_OP0(iretw, 0x66cf) - DEF_ASM_OP0(iretl, 0xcf) - DEF_ASM_OP0(iretq, 0x48cf) - DEF_ASM_OP0(rsm, 0x0faa) - DEF_ASM_OP0(hlt, 0xf4) - DEF_ASM_OP0(wait, 0x9b) - DEF_ASM_OP0(nop, 0x90) - DEF_ASM_OP0(pause, 0xf390) - DEF_ASM_OP0(xlat, 0xd7) - - DEF_ASM_OP0L(vmcall, 0xc1, 0, OPC_0F01) - DEF_ASM_OP0L(vmlaunch, 0xc2, 0, OPC_0F01) - DEF_ASM_OP0L(vmresume, 0xc3, 0, OPC_0F01) - DEF_ASM_OP0L(vmxoff, 0xc4, 0, OPC_0F01) - - /* strings */ -ALT(DEF_ASM_OP0L(cmpsb, 0xa6, 0, OPC_BWLX)) -ALT(DEF_ASM_OP0L(scmpb, 0xa6, 0, OPC_BWLX)) - -ALT(DEF_ASM_OP0L(insb, 0x6c, 0, OPC_BWL)) -ALT(DEF_ASM_OP0L(outsb, 0x6e, 0, OPC_BWL)) - -ALT(DEF_ASM_OP0L(lodsb, 0xac, 0, OPC_BWLX)) -ALT(DEF_ASM_OP0L(slodb, 0xac, 0, OPC_BWLX)) - -ALT(DEF_ASM_OP0L(movsb, 0xa4, 0, OPC_BWLX)) -ALT(DEF_ASM_OP0L(smovb, 0xa4, 0, OPC_BWLX)) - -ALT(DEF_ASM_OP0L(scasb, 0xae, 0, OPC_BWLX)) -ALT(DEF_ASM_OP0L(sscab, 0xae, 0, OPC_BWLX)) - -ALT(DEF_ASM_OP0L(stosb, 0xaa, 0, OPC_BWLX)) -ALT(DEF_ASM_OP0L(sstob, 0xaa, 0, OPC_BWLX)) - - /* bits */ - -ALT(DEF_ASM_OP2(bsfw, 0x0fbc, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW)) -ALT(DEF_ASM_OP2(bsrw, 0x0fbd, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW)) - -ALT(DEF_ASM_OP2(btw, 0x0fa3, 0, OPC_MODRM | OPC_WLX, OPT_REGW, OPT_REGW | OPT_EA)) -ALT(DEF_ASM_OP2(btw, 0x0fba, 4, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW | OPT_EA)) - -ALT(DEF_ASM_OP2(btsw, 0x0fab, 0, OPC_MODRM | OPC_WLX, OPT_REGW, OPT_REGW | OPT_EA)) -ALT(DEF_ASM_OP2(btsw, 0x0fba, 5, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW | OPT_EA)) - -ALT(DEF_ASM_OP2(btrw, 0x0fb3, 0, OPC_MODRM | OPC_WLX, OPT_REGW, OPT_REGW | OPT_EA)) -ALT(DEF_ASM_OP2(btrw, 0x0fba, 6, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW | OPT_EA)) - -ALT(DEF_ASM_OP2(btcw, 0x0fbb, 0, OPC_MODRM | OPC_WLX, OPT_REGW, OPT_REGW | OPT_EA)) -ALT(DEF_ASM_OP2(btcw, 0x0fba, 7, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW | OPT_EA)) - -ALT(DEF_ASM_OP2(popcntw, 0xf30fb8, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW)) - -ALT(DEF_ASM_OP2(tzcntw, 0xf30fbc, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW)) -ALT(DEF_ASM_OP2(lzcntw, 0xf30fbd, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW)) - - /* prefixes */ - DEF_ASM_OP0(lock, 0xf0) - DEF_ASM_OP0(rep, 0xf3) - DEF_ASM_OP0(repe, 0xf3) - DEF_ASM_OP0(repz, 0xf3) - DEF_ASM_OP0(repne, 0xf2) - DEF_ASM_OP0(repnz, 0xf2) - - DEF_ASM_OP0(invd, 0x0f08) - DEF_ASM_OP0(wbinvd, 0x0f09) - DEF_ASM_OP0(cpuid, 0x0fa2) - DEF_ASM_OP0(wrmsr, 0x0f30) - DEF_ASM_OP0(rdtsc, 0x0f31) - DEF_ASM_OP0(rdmsr, 0x0f32) - DEF_ASM_OP0(rdpmc, 0x0f33) - - DEF_ASM_OP0(syscall, 0x0f05) - DEF_ASM_OP0(sysret, 0x0f07) - DEF_ASM_OP0L(sysretq, 0x480f07, 0, 0) - DEF_ASM_OP0(ud2, 0x0f0b) - - /* NOTE: we took the same order as gas opcode definition order */ -/* Right now we can't express the fact that 0xa1/0xa3 can't use $eax and a - 32 bit moffset as operands. -ALT(DEF_ASM_OP2(movb, 0xa0, 0, OPC_BWLX, OPT_ADDR, OPT_EAX)) -ALT(DEF_ASM_OP2(movb, 0xa2, 0, OPC_BWLX, OPT_EAX, OPT_ADDR)) */ -ALT(DEF_ASM_OP2(movb, 0x88, 0, OPC_MODRM | OPC_BWLX, OPT_REG, OPT_EA | OPT_REG)) -ALT(DEF_ASM_OP2(movb, 0x8a, 0, OPC_MODRM | OPC_BWLX, OPT_EA | OPT_REG, OPT_REG)) -/* The moves are special: the 0xb8 form supports IM64 (the only insn that - does) with REG64. It doesn't support IM32 with REG64, it would use - the full movabs form (64bit immediate). For IM32->REG64 we prefer - the 0xc7 opcode. So disallow all 64bit forms and code the rest by hand. */ -ALT(DEF_ASM_OP2(movb, 0xb0, 0, OPC_REG | OPC_BWLX, OPT_IM, OPT_REG)) -ALT(DEF_ASM_OP2(mov, 0xb8, 0, OPC_REG, OPT_IM64, OPT_REG64)) -ALT(DEF_ASM_OP2(movq, 0xb8, 0, OPC_REG, OPT_IM64, OPT_REG64)) -ALT(DEF_ASM_OP2(movb, 0xc6, 0, OPC_MODRM | OPC_BWLX, OPT_IM, OPT_REG | OPT_EA)) - -ALT(DEF_ASM_OP2(movw, 0x8c, 0, OPC_MODRM | OPC_WLX, OPT_SEG, OPT_EA | OPT_REG)) -ALT(DEF_ASM_OP2(movw, 0x8e, 0, OPC_MODRM | OPC_WLX, OPT_EA | OPT_REG, OPT_SEG)) - -ALT(DEF_ASM_OP2(movw, 0x0f20, 0, OPC_MODRM | OPC_WLX, OPT_CR, OPT_REG64)) -ALT(DEF_ASM_OP2(movw, 0x0f21, 0, OPC_MODRM | OPC_WLX, OPT_DB, OPT_REG64)) -ALT(DEF_ASM_OP2(movw, 0x0f22, 0, OPC_MODRM | OPC_WLX, OPT_REG64, OPT_CR)) -ALT(DEF_ASM_OP2(movw, 0x0f23, 0, OPC_MODRM | OPC_WLX, OPT_REG64, OPT_DB)) - -ALT(DEF_ASM_OP2(movsbw, 0x660fbe, 0, OPC_MODRM, OPT_REG8 | OPT_EA, OPT_REG16)) -ALT(DEF_ASM_OP2(movsbl, 0x0fbe, 0, OPC_MODRM, OPT_REG8 | OPT_EA, OPT_REG32)) -ALT(DEF_ASM_OP2(movsbq, 0x0fbe, 0, OPC_MODRM, OPT_REG8 | OPT_EA, OPT_REGW)) -ALT(DEF_ASM_OP2(movswl, 0x0fbf, 0, OPC_MODRM, OPT_REG16 | OPT_EA, OPT_REG32)) -ALT(DEF_ASM_OP2(movswq, 0x0fbf, 0, OPC_MODRM, OPT_REG16 | OPT_EA, OPT_REG)) -ALT(DEF_ASM_OP2(movslq, 0x63, 0, OPC_MODRM, OPT_REG32 | OPT_EA, OPT_REG)) -ALT(DEF_ASM_OP2(movzbw, 0x0fb6, 0, OPC_MODRM | OPC_WLX, OPT_REG8 | OPT_EA, OPT_REGW)) -ALT(DEF_ASM_OP2(movzwl, 0x0fb7, 0, OPC_MODRM, OPT_REG16 | OPT_EA, OPT_REG32)) -ALT(DEF_ASM_OP2(movzwq, 0x0fb7, 0, OPC_MODRM, OPT_REG16 | OPT_EA, OPT_REG)) - -ALT(DEF_ASM_OP1(pushq, 0x6a, 0, 0, OPT_IM8S)) -ALT(DEF_ASM_OP1(push, 0x6a, 0, 0, OPT_IM8S)) -ALT(DEF_ASM_OP1(pushw, 0x666a, 0, 0, OPT_IM8S)) -ALT(DEF_ASM_OP1(pushw, 0x50, 0, OPC_REG | OPC_WLX, OPT_REG64)) -ALT(DEF_ASM_OP1(pushw, 0x50, 0, OPC_REG | OPC_WLX, OPT_REG16)) -ALT(DEF_ASM_OP1(pushw, 0xff, 6, OPC_MODRM | OPC_WLX, OPT_REG64 | OPT_EA)) -ALT(DEF_ASM_OP1(pushw, 0x6668, 0, 0, OPT_IM16)) -ALT(DEF_ASM_OP1(pushw, 0x68, 0, OPC_WLX, OPT_IM32)) -ALT(DEF_ASM_OP1(pushw, 0x06, 0, OPC_WLX, OPT_SEG)) - -ALT(DEF_ASM_OP1(popw, 0x58, 0, OPC_REG | OPC_WLX, OPT_REG64)) -ALT(DEF_ASM_OP1(popw, 0x58, 0, OPC_REG | OPC_WLX, OPT_REG16)) -ALT(DEF_ASM_OP1(popw, 0x8f, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA)) -ALT(DEF_ASM_OP1(popw, 0x07, 0, OPC_WLX, OPT_SEG)) - -ALT(DEF_ASM_OP2(xchgw, 0x90, 0, OPC_REG | OPC_WLX, OPT_REGW, OPT_EAX)) -ALT(DEF_ASM_OP2(xchgw, 0x90, 0, OPC_REG | OPC_WLX, OPT_EAX, OPT_REGW)) -ALT(DEF_ASM_OP2(xchgb, 0x86, 0, OPC_MODRM | OPC_BWLX, OPT_REG, OPT_EA | OPT_REG)) -ALT(DEF_ASM_OP2(xchgb, 0x86, 0, OPC_MODRM | OPC_BWLX, OPT_EA | OPT_REG, OPT_REG)) - -ALT(DEF_ASM_OP2(inb, 0xe4, 0, OPC_BWL, OPT_IM8, OPT_EAX)) -ALT(DEF_ASM_OP1(inb, 0xe4, 0, OPC_BWL, OPT_IM8)) -ALT(DEF_ASM_OP2(inb, 0xec, 0, OPC_BWL, OPT_DX, OPT_EAX)) -ALT(DEF_ASM_OP1(inb, 0xec, 0, OPC_BWL, OPT_DX)) - -ALT(DEF_ASM_OP2(outb, 0xe6, 0, OPC_BWL, OPT_EAX, OPT_IM8)) -ALT(DEF_ASM_OP1(outb, 0xe6, 0, OPC_BWL, OPT_IM8)) -ALT(DEF_ASM_OP2(outb, 0xee, 0, OPC_BWL, OPT_EAX, OPT_DX)) -ALT(DEF_ASM_OP1(outb, 0xee, 0, OPC_BWL, OPT_DX)) - -ALT(DEF_ASM_OP2(leaw, 0x8d, 0, OPC_MODRM | OPC_WLX, OPT_EA, OPT_REG)) - -ALT(DEF_ASM_OP2(les, 0xc4, 0, OPC_MODRM, OPT_EA, OPT_REG32)) -ALT(DEF_ASM_OP2(lds, 0xc5, 0, OPC_MODRM, OPT_EA, OPT_REG32)) -ALT(DEF_ASM_OP2(lss, 0x0fb2, 0, OPC_MODRM, OPT_EA, OPT_REG32)) -ALT(DEF_ASM_OP2(lfs, 0x0fb4, 0, OPC_MODRM, OPT_EA, OPT_REG32)) -ALT(DEF_ASM_OP2(lgs, 0x0fb5, 0, OPC_MODRM, OPT_EA, OPT_REG32)) - - /* arith */ -ALT(DEF_ASM_OP2(addb, 0x00, 0, OPC_ARITH | OPC_MODRM | OPC_BWLX, OPT_REG, OPT_EA | OPT_REG)) /* XXX: use D bit ? */ -ALT(DEF_ASM_OP2(addb, 0x02, 0, OPC_ARITH | OPC_MODRM | OPC_BWLX, OPT_EA | OPT_REG, OPT_REG)) -ALT(DEF_ASM_OP2(addb, 0x04, 0, OPC_ARITH | OPC_BWLX, OPT_IM, OPT_EAX)) -ALT(DEF_ASM_OP2(addw, 0x83, 0, OPC_ARITH | OPC_MODRM | OPC_WLX, OPT_IM8S, OPT_EA | OPT_REGW)) -ALT(DEF_ASM_OP2(addb, 0x80, 0, OPC_ARITH | OPC_MODRM | OPC_BWLX, OPT_IM, OPT_EA | OPT_REG)) - -ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWLX, OPT_REG, OPT_EA | OPT_REG)) -ALT(DEF_ASM_OP2(testb, 0x84, 0, OPC_MODRM | OPC_BWLX, OPT_EA | OPT_REG, OPT_REG)) -ALT(DEF_ASM_OP2(testb, 0xa8, 0, OPC_BWLX, OPT_IM, OPT_EAX)) -ALT(DEF_ASM_OP2(testb, 0xf6, 0, OPC_MODRM | OPC_BWLX, OPT_IM, OPT_EA | OPT_REG)) - -ALT(DEF_ASM_OP1(incb, 0xfe, 0, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) -ALT(DEF_ASM_OP1(decb, 0xfe, 1, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) - -ALT(DEF_ASM_OP1(notb, 0xf6, 2, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) -ALT(DEF_ASM_OP1(negb, 0xf6, 3, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) - -ALT(DEF_ASM_OP1(mulb, 0xf6, 4, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) -ALT(DEF_ASM_OP1(imulb, 0xf6, 5, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) - -ALT(DEF_ASM_OP2(imulw, 0x0faf, 0, OPC_MODRM | OPC_WLX, OPT_REG | OPT_EA, OPT_REG)) -ALT(DEF_ASM_OP3(imulw, 0x6b, 0, OPC_MODRM | OPC_WLX, OPT_IM8S, OPT_REGW | OPT_EA, OPT_REGW)) -ALT(DEF_ASM_OP2(imulw, 0x6b, 0, OPC_MODRM | OPC_WLX, OPT_IM8S, OPT_REGW)) -ALT(DEF_ASM_OP3(imulw, 0x69, 0, OPC_MODRM | OPC_WLX, OPT_IMW, OPT_REGW | OPT_EA, OPT_REGW)) -ALT(DEF_ASM_OP2(imulw, 0x69, 0, OPC_MODRM | OPC_WLX, OPT_IMW, OPT_REGW)) - -ALT(DEF_ASM_OP1(divb, 0xf6, 6, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) -ALT(DEF_ASM_OP2(divb, 0xf6, 6, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA, OPT_EAX)) -ALT(DEF_ASM_OP1(idivb, 0xf6, 7, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA)) -ALT(DEF_ASM_OP2(idivb, 0xf6, 7, OPC_MODRM | OPC_BWLX, OPT_REG | OPT_EA, OPT_EAX)) - - /* shifts */ -ALT(DEF_ASM_OP2(rolb, 0xc0, 0, OPC_MODRM | OPC_BWLX | OPC_SHIFT, OPT_IM8, OPT_EA | OPT_REG)) -ALT(DEF_ASM_OP2(rolb, 0xd2, 0, OPC_MODRM | OPC_BWLX | OPC_SHIFT, OPT_CL, OPT_EA | OPT_REG)) -ALT(DEF_ASM_OP1(rolb, 0xd0, 0, OPC_MODRM | OPC_BWLX | OPC_SHIFT, OPT_EA | OPT_REG)) - -ALT(DEF_ASM_OP3(shldw, 0x0fa4, 0, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW, OPT_EA | OPT_REGW)) -ALT(DEF_ASM_OP3(shldw, 0x0fa5, 0, OPC_MODRM | OPC_WLX, OPT_CL, OPT_REGW, OPT_EA | OPT_REGW)) -ALT(DEF_ASM_OP2(shldw, 0x0fa5, 0, OPC_MODRM | OPC_WLX, OPT_REGW, OPT_EA | OPT_REGW)) -ALT(DEF_ASM_OP3(shrdw, 0x0fac, 0, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW, OPT_EA | OPT_REGW)) -ALT(DEF_ASM_OP3(shrdw, 0x0fad, 0, OPC_MODRM | OPC_WLX, OPT_CL, OPT_REGW, OPT_EA | OPT_REGW)) -ALT(DEF_ASM_OP2(shrdw, 0x0fad, 0, OPC_MODRM | OPC_WLX, OPT_REGW, OPT_EA | OPT_REGW)) - -ALT(DEF_ASM_OP1(call, 0xff, 2, OPC_MODRM, OPT_INDIR)) -ALT(DEF_ASM_OP1(call, 0xe8, 0, 0, OPT_DISP)) - DEF_ASM_OP1(callq, 0xff, 2, OPC_MODRM, OPT_INDIR) -ALT(DEF_ASM_OP1(callq, 0xe8, 0, 0, OPT_DISP)) -ALT(DEF_ASM_OP1(jmp, 0xff, 4, OPC_MODRM, OPT_INDIR)) -ALT(DEF_ASM_OP1(jmp, 0xeb, 0, 0, OPT_DISP8)) - -ALT(DEF_ASM_OP1(lcall, 0xff, 3, OPC_MODRM, OPT_EA)) -ALT(DEF_ASM_OP1(ljmp, 0xff, 5, OPC_MODRM, OPT_EA)) - DEF_ASM_OP1(ljmpw, 0x66ff, 5, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(ljmpl, 0xff, 5, OPC_MODRM, OPT_EA) - -ALT(DEF_ASM_OP1(int, 0xcd, 0, 0, OPT_IM8)) -ALT(DEF_ASM_OP1(seto, 0x0f90, 0, OPC_MODRM | OPC_TEST, OPT_REG8 | OPT_EA)) -ALT(DEF_ASM_OP1(setob, 0x0f90, 0, OPC_MODRM | OPC_TEST, OPT_REG8 | OPT_EA)) - DEF_ASM_OP2(enter, 0xc8, 0, 0, OPT_IM16, OPT_IM8) - DEF_ASM_OP0(leave, 0xc9) - DEF_ASM_OP0(ret, 0xc3) - DEF_ASM_OP0(retq, 0xc3) -ALT(DEF_ASM_OP1(retq, 0xc2, 0, 0, OPT_IM16)) -ALT(DEF_ASM_OP1(ret, 0xc2, 0, 0, OPT_IM16)) - DEF_ASM_OP0(lret, 0xcb) -ALT(DEF_ASM_OP1(lret, 0xca, 0, 0, OPT_IM16)) - -ALT(DEF_ASM_OP1(jo, 0x70, 0, OPC_TEST, OPT_DISP8)) - DEF_ASM_OP1(loopne, 0xe0, 0, 0, OPT_DISP8) - DEF_ASM_OP1(loopnz, 0xe0, 0, 0, OPT_DISP8) - DEF_ASM_OP1(loope, 0xe1, 0, 0, OPT_DISP8) - DEF_ASM_OP1(loopz, 0xe1, 0, 0, OPT_DISP8) - DEF_ASM_OP1(loop, 0xe2, 0, 0, OPT_DISP8) - DEF_ASM_OP1(jecxz, 0x67e3, 0, 0, OPT_DISP8) - - /* float */ - /* specific fcomp handling */ -ALT(DEF_ASM_OP0L(fcomp, 0xd8d9, 0, 0)) - -ALT(DEF_ASM_OP1(fadd, 0xd8c0, 0, OPC_FARITH | OPC_REG, OPT_ST)) -ALT(DEF_ASM_OP2(fadd, 0xd8c0, 0, OPC_FARITH | OPC_REG, OPT_ST, OPT_ST0)) -ALT(DEF_ASM_OP2(fadd, 0xdcc0, 0, OPC_FARITH | OPC_REG, OPT_ST0, OPT_ST)) -ALT(DEF_ASM_OP2(fmul, 0xdcc8, 0, OPC_FARITH | OPC_REG, OPT_ST0, OPT_ST)) -ALT(DEF_ASM_OP0L(fadd, 0xdec1, 0, OPC_FARITH)) -ALT(DEF_ASM_OP1(faddp, 0xdec0, 0, OPC_FARITH | OPC_REG, OPT_ST)) -ALT(DEF_ASM_OP2(faddp, 0xdec0, 0, OPC_FARITH | OPC_REG, OPT_ST, OPT_ST0)) -ALT(DEF_ASM_OP2(faddp, 0xdec0, 0, OPC_FARITH | OPC_REG, OPT_ST0, OPT_ST)) -ALT(DEF_ASM_OP0L(faddp, 0xdec1, 0, OPC_FARITH)) -ALT(DEF_ASM_OP1(fadds, 0xd8, 0, OPC_FARITH | OPC_MODRM, OPT_EA)) -ALT(DEF_ASM_OP1(fiaddl, 0xda, 0, OPC_FARITH | OPC_MODRM, OPT_EA)) -ALT(DEF_ASM_OP1(faddl, 0xdc, 0, OPC_FARITH | OPC_MODRM, OPT_EA)) -ALT(DEF_ASM_OP1(fiadds, 0xde, 0, OPC_FARITH | OPC_MODRM, OPT_EA)) - - DEF_ASM_OP0(fucompp, 0xdae9) - DEF_ASM_OP0(ftst, 0xd9e4) - DEF_ASM_OP0(fxam, 0xd9e5) - DEF_ASM_OP0(fld1, 0xd9e8) - DEF_ASM_OP0(fldl2t, 0xd9e9) - DEF_ASM_OP0(fldl2e, 0xd9ea) - DEF_ASM_OP0(fldpi, 0xd9eb) - DEF_ASM_OP0(fldlg2, 0xd9ec) - DEF_ASM_OP0(fldln2, 0xd9ed) - DEF_ASM_OP0(fldz, 0xd9ee) - - DEF_ASM_OP0(f2xm1, 0xd9f0) - DEF_ASM_OP0(fyl2x, 0xd9f1) - DEF_ASM_OP0(fptan, 0xd9f2) - DEF_ASM_OP0(fpatan, 0xd9f3) - DEF_ASM_OP0(fxtract, 0xd9f4) - DEF_ASM_OP0(fprem1, 0xd9f5) - DEF_ASM_OP0(fdecstp, 0xd9f6) - DEF_ASM_OP0(fincstp, 0xd9f7) - DEF_ASM_OP0(fprem, 0xd9f8) - DEF_ASM_OP0(fyl2xp1, 0xd9f9) - DEF_ASM_OP0(fsqrt, 0xd9fa) - DEF_ASM_OP0(fsincos, 0xd9fb) - DEF_ASM_OP0(frndint, 0xd9fc) - DEF_ASM_OP0(fscale, 0xd9fd) - DEF_ASM_OP0(fsin, 0xd9fe) - DEF_ASM_OP0(fcos, 0xd9ff) - DEF_ASM_OP0(fchs, 0xd9e0) - DEF_ASM_OP0(fabs, 0xd9e1) - DEF_ASM_OP0(fninit, 0xdbe3) - DEF_ASM_OP0(fnclex, 0xdbe2) - DEF_ASM_OP0(fnop, 0xd9d0) - DEF_ASM_OP0(fwait, 0x9b) - - /* fp load */ - DEF_ASM_OP1(fld, 0xd9c0, 0, OPC_REG, OPT_ST) - DEF_ASM_OP1(fldl, 0xd9c0, 0, OPC_REG, OPT_ST) - DEF_ASM_OP1(flds, 0xd9, 0, OPC_MODRM, OPT_EA) -ALT(DEF_ASM_OP1(fldl, 0xdd, 0, OPC_MODRM, OPT_EA)) - DEF_ASM_OP1(fildl, 0xdb, 0, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fildq, 0xdf, 5, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fildll, 0xdf, 5, OPC_MODRM,OPT_EA) - DEF_ASM_OP1(fldt, 0xdb, 5, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fbld, 0xdf, 4, OPC_MODRM, OPT_EA) - - /* fp store */ - DEF_ASM_OP1(fst, 0xddd0, 0, OPC_REG, OPT_ST) - DEF_ASM_OP1(fstl, 0xddd0, 0, OPC_REG, OPT_ST) - DEF_ASM_OP1(fsts, 0xd9, 2, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fstps, 0xd9, 3, OPC_MODRM, OPT_EA) -ALT(DEF_ASM_OP1(fstl, 0xdd, 2, OPC_MODRM, OPT_EA)) - DEF_ASM_OP1(fstpl, 0xdd, 3, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fist, 0xdf, 2, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fistp, 0xdf, 3, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fistl, 0xdb, 2, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fistpl, 0xdb, 3, OPC_MODRM, OPT_EA) - - DEF_ASM_OP1(fstp, 0xddd8, 0, OPC_REG, OPT_ST) - DEF_ASM_OP1(fistpq, 0xdf, 7, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fistpll, 0xdf, 7, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fstpt, 0xdb, 7, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(fbstp, 0xdf, 6, OPC_MODRM, OPT_EA) - - /* exchange */ - DEF_ASM_OP0(fxch, 0xd9c9) -ALT(DEF_ASM_OP1(fxch, 0xd9c8, 0, OPC_REG, OPT_ST)) - - /* misc FPU */ - DEF_ASM_OP1(fucom, 0xdde0, 0, OPC_REG, OPT_ST ) - DEF_ASM_OP1(fucomp, 0xdde8, 0, OPC_REG, OPT_ST ) - - DEF_ASM_OP0L(finit, 0xdbe3, 0, OPC_FWAIT) - DEF_ASM_OP1(fldcw, 0xd9, 5, OPC_MODRM, OPT_EA ) - DEF_ASM_OP1(fnstcw, 0xd9, 7, OPC_MODRM, OPT_EA ) - DEF_ASM_OP1(fstcw, 0xd9, 7, OPC_MODRM | OPC_FWAIT, OPT_EA ) - DEF_ASM_OP0(fnstsw, 0xdfe0) -ALT(DEF_ASM_OP1(fnstsw, 0xdfe0, 0, 0, OPT_EAX )) -ALT(DEF_ASM_OP1(fnstsw, 0xdd, 7, OPC_MODRM, OPT_EA )) - DEF_ASM_OP1(fstsw, 0xdfe0, 0, OPC_FWAIT, OPT_EAX ) -ALT(DEF_ASM_OP0L(fstsw, 0xdfe0, 0, OPC_FWAIT)) -ALT(DEF_ASM_OP1(fstsw, 0xdd, 7, OPC_MODRM | OPC_FWAIT, OPT_EA )) - DEF_ASM_OP0L(fclex, 0xdbe2, 0, OPC_FWAIT) - DEF_ASM_OP1(fnstenv, 0xd9, 6, OPC_MODRM, OPT_EA ) - DEF_ASM_OP1(fstenv, 0xd9, 6, OPC_MODRM | OPC_FWAIT, OPT_EA ) - DEF_ASM_OP1(fldenv, 0xd9, 4, OPC_MODRM, OPT_EA ) - DEF_ASM_OP1(fnsave, 0xdd, 6, OPC_MODRM, OPT_EA ) - DEF_ASM_OP1(fsave, 0xdd, 6, OPC_MODRM | OPC_FWAIT, OPT_EA ) - DEF_ASM_OP1(frstor, 0xdd, 4, OPC_MODRM, OPT_EA ) - DEF_ASM_OP1(ffree, 0xddc0, 4, OPC_REG, OPT_ST ) - DEF_ASM_OP1(ffreep, 0xdfc0, 4, OPC_REG, OPT_ST ) - DEF_ASM_OP1(fxsave, 0x0fae, 0, OPC_MODRM, OPT_EA ) - DEF_ASM_OP1(fxrstor, 0x0fae, 1, OPC_MODRM, OPT_EA ) - /* The *q forms of fxrstor/fxsave use a REX prefix. - If the operand would use extended registers we would have to modify - it instead of generating a second one. Currently that's no - problem with TCC, we don't use extended registers. */ - DEF_ASM_OP1(fxsaveq, 0x0fae, 0, OPC_MODRM | OPC_48, OPT_EA ) - DEF_ASM_OP1(fxrstorq, 0x0fae, 1, OPC_MODRM | OPC_48, OPT_EA ) - - /* segments */ - DEF_ASM_OP2(arpl, 0x63, 0, OPC_MODRM, OPT_REG16, OPT_REG16 | OPT_EA) -ALT(DEF_ASM_OP2(larw, 0x0f02, 0, OPC_MODRM | OPC_WLX, OPT_REG | OPT_EA, OPT_REG)) - DEF_ASM_OP1(lgdt, 0x0f01, 2, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(lgdtq, 0x0f01, 2, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(lidt, 0x0f01, 3, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(lidtq, 0x0f01, 3, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(lldt, 0x0f00, 2, OPC_MODRM, OPT_EA | OPT_REG) - DEF_ASM_OP1(lmsw, 0x0f01, 6, OPC_MODRM, OPT_EA | OPT_REG) -ALT(DEF_ASM_OP2(lslw, 0x0f03, 0, OPC_MODRM | OPC_WLX, OPT_EA | OPT_REG, OPT_REG)) - DEF_ASM_OP1(ltr, 0x0f00, 3, OPC_MODRM, OPT_EA | OPT_REG16) - DEF_ASM_OP1(sgdt, 0x0f01, 0, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(sgdtq, 0x0f01, 0, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(sidt, 0x0f01, 1, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(sidtq, 0x0f01, 1, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(sldt, 0x0f00, 0, OPC_MODRM, OPT_REG | OPT_EA) - DEF_ASM_OP1(smsw, 0x0f01, 4, OPC_MODRM, OPT_REG | OPT_EA) - DEF_ASM_OP1(str, 0x0f00, 1, OPC_MODRM, OPT_REG32 | OPT_EA) -ALT(DEF_ASM_OP1(str, 0x660f00, 1, OPC_MODRM, OPT_REG16)) -ALT(DEF_ASM_OP1(str, 0x0f00, 1, OPC_MODRM | OPC_48, OPT_REG64)) - DEF_ASM_OP1(verr, 0x0f00, 4, OPC_MODRM, OPT_REG | OPT_EA) - DEF_ASM_OP1(verw, 0x0f00, 5, OPC_MODRM, OPT_REG | OPT_EA) - DEF_ASM_OP0L(swapgs, 0x0f01, 7, OPC_MODRM) - - /* 486 */ - /* bswap can't be applied to 16bit regs */ - DEF_ASM_OP1(bswap, 0x0fc8, 0, OPC_REG, OPT_REG32 ) - DEF_ASM_OP1(bswapl, 0x0fc8, 0, OPC_REG, OPT_REG32 ) - DEF_ASM_OP1(bswapq, 0x0fc8, 0, OPC_REG | OPC_48, OPT_REG64 ) - -ALT(DEF_ASM_OP2(xaddb, 0x0fc0, 0, OPC_MODRM | OPC_BWLX, OPT_REG, OPT_REG | OPT_EA )) -ALT(DEF_ASM_OP2(cmpxchgb, 0x0fb0, 0, OPC_MODRM | OPC_BWLX, OPT_REG, OPT_REG | OPT_EA )) - DEF_ASM_OP1(invlpg, 0x0f01, 7, OPC_MODRM, OPT_EA ) - - /* pentium */ - DEF_ASM_OP1(cmpxchg8b, 0x0fc7, 1, OPC_MODRM, OPT_EA ) - - /* AMD 64 */ - DEF_ASM_OP1(cmpxchg16b, 0x0fc7, 1, OPC_MODRM | OPC_48, OPT_EA ) - - /* pentium pro */ -ALT(DEF_ASM_OP2(cmovo, 0x0f40, 0, OPC_MODRM | OPC_TEST | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW)) - - DEF_ASM_OP2(fcmovb, 0xdac0, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcmove, 0xdac8, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcmovbe, 0xdad0, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcmovu, 0xdad8, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcmovnb, 0xdbc0, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcmovne, 0xdbc8, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcmovnbe, 0xdbd0, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcmovnu, 0xdbd8, 0, OPC_REG, OPT_ST, OPT_ST0 ) - - DEF_ASM_OP2(fucomi, 0xdbe8, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcomi, 0xdbf0, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fucomip, 0xdfe8, 0, OPC_REG, OPT_ST, OPT_ST0 ) - DEF_ASM_OP2(fcomip, 0xdff0, 0, OPC_REG, OPT_ST, OPT_ST0 ) - - /* mmx */ - DEF_ASM_OP0(emms, 0x0f77) /* must be last OP0 */ - DEF_ASM_OP2(movd, 0x0f6e, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_MMXSSE ) - /* movd shouldn't accept REG64, but AMD64 spec uses it for 32 and 64 bit - moves, so let's be compatible. */ -ALT(DEF_ASM_OP2(movd, 0x0f6e, 0, OPC_MODRM, OPT_EA | OPT_REG64, OPT_MMXSSE )) -ALT(DEF_ASM_OP2(movq, 0x0f6e, 0, OPC_MODRM | OPC_48, OPT_REG64, OPT_MMXSSE )) -ALT(DEF_ASM_OP2(movq, 0x0f6f, 0, OPC_MODRM, OPT_EA | OPT_MMX, OPT_MMX )) -ALT(DEF_ASM_OP2(movd, 0x0f7e, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_REG32 )) -ALT(DEF_ASM_OP2(movd, 0x0f7e, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_REG64 )) -ALT(DEF_ASM_OP2(movq, 0x0f7f, 0, OPC_MODRM, OPT_MMX, OPT_EA | OPT_MMX )) -ALT(DEF_ASM_OP2(movq, 0x660fd6, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_SSE )) -ALT(DEF_ASM_OP2(movq, 0xf30f7e, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE )) -ALT(DEF_ASM_OP2(movq, 0x0f7e, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_REG64 )) - - DEF_ASM_OP2(packssdw, 0x0f6b, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(packsswb, 0x0f63, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(packuswb, 0x0f67, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(paddb, 0x0ffc, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(paddw, 0x0ffd, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(paddd, 0x0ffe, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(paddsb, 0x0fec, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(paddsw, 0x0fed, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(paddusb, 0x0fdc, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(paddusw, 0x0fdd, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pand, 0x0fdb, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pandn, 0x0fdf, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pcmpeqb, 0x0f74, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pcmpeqw, 0x0f75, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pcmpeqd, 0x0f76, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pcmpgtb, 0x0f64, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pcmpgtw, 0x0f65, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pcmpgtd, 0x0f66, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pmaddwd, 0x0ff5, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pmulhw, 0x0fe5, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pmullw, 0x0fd5, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(por, 0x0feb, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(psllw, 0x0ff1, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(psllw, 0x0f71, 6, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(pslld, 0x0ff2, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(pslld, 0x0f72, 6, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(psllq, 0x0ff3, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(psllq, 0x0f73, 6, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(psraw, 0x0fe1, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(psraw, 0x0f71, 4, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(psrad, 0x0fe2, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(psrad, 0x0f72, 4, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(psrlw, 0x0fd1, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(psrlw, 0x0f71, 2, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(psrld, 0x0fd2, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(psrld, 0x0f72, 2, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(psrlq, 0x0fd3, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) -ALT(DEF_ASM_OP2(psrlq, 0x0f73, 2, OPC_MODRM, OPT_IM8, OPT_MMXSSE )) - DEF_ASM_OP2(psubb, 0x0ff8, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(psubw, 0x0ff9, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(psubd, 0x0ffa, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(psubsb, 0x0fe8, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(psubsw, 0x0fe9, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(psubusb, 0x0fd8, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(psubusw, 0x0fd9, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(punpckhbw, 0x0f68, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(punpckhwd, 0x0f69, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(punpckhdq, 0x0f6a, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(punpcklbw, 0x0f60, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(punpcklwd, 0x0f61, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(punpckldq, 0x0f62, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pxor, 0x0fef, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - - /* sse */ - DEF_ASM_OP1(ldmxcsr, 0x0fae, 2, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(stmxcsr, 0x0fae, 3, OPC_MODRM, OPT_EA) - DEF_ASM_OP2(movups, 0x0f10, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_SSE ) -ALT(DEF_ASM_OP2(movups, 0x0f11, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_REG32 )) - DEF_ASM_OP2(movaps, 0x0f28, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_SSE ) -ALT(DEF_ASM_OP2(movaps, 0x0f29, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_REG32 )) - DEF_ASM_OP2(movhps, 0x0f16, 0, OPC_MODRM, OPT_EA | OPT_REG32, OPT_SSE ) -ALT(DEF_ASM_OP2(movhps, 0x0f17, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_REG32 )) - DEF_ASM_OP2(addps, 0x0f58, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(cvtpi2ps, 0x0f2a, 0, OPC_MODRM, OPT_EA | OPT_MMX, OPT_SSE ) - DEF_ASM_OP2(cvtps2pi, 0x0f2d, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_MMX ) - DEF_ASM_OP2(cvttps2pi, 0x0f2c, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_MMX ) - DEF_ASM_OP2(divps, 0x0f5e, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(maxps, 0x0f5f, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(minps, 0x0f5d, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(mulps, 0x0f59, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(pavgb, 0x0fe0, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(pavgw, 0x0fe3, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(pmaxsw, 0x0fee, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pmaxub, 0x0fde, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pminsw, 0x0fea, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(pminub, 0x0fda, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE ) - DEF_ASM_OP2(rcpss, 0x0f53, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(rsqrtps, 0x0f52, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(sqrtps, 0x0f51, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - DEF_ASM_OP2(subps, 0x0f5c, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ) - - /* movnti should only accept REG32 and REG64, we accept more */ - DEF_ASM_OP2(movnti, 0x0fc3, 0, OPC_MODRM, OPT_REG, OPT_EA) - DEF_ASM_OP2(movntil, 0x0fc3, 0, OPC_MODRM, OPT_REG32, OPT_EA) - DEF_ASM_OP2(movntiq, 0x0fc3, 0, OPC_MODRM | OPC_48, OPT_REG64, OPT_EA) - DEF_ASM_OP1(prefetchnta, 0x0f18, 0, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(prefetcht0, 0x0f18, 1, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(prefetcht1, 0x0f18, 2, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(prefetcht2, 0x0f18, 3, OPC_MODRM, OPT_EA) - DEF_ASM_OP1(prefetchw, 0x0f0d, 1, OPC_MODRM, OPT_EA) - DEF_ASM_OP0L(lfence, 0x0fae, 5, OPC_MODRM) - DEF_ASM_OP0L(mfence, 0x0fae, 6, OPC_MODRM) - DEF_ASM_OP0L(sfence, 0x0fae, 7, OPC_MODRM) - DEF_ASM_OP1(clflush, 0x0fae, 7, OPC_MODRM, OPT_EA) - - /* Control-Flow Enforcement */ - DEF_ASM_OP0L(endbr64, 0xf30f1e, 7, OPC_MODRM) -#undef ALT -#undef DEF_ASM_OP0 -#undef DEF_ASM_OP0L -#undef DEF_ASM_OP1 -#undef DEF_ASM_OP2 -#undef DEF_ASM_OP3 diff --git a/x86_64-gen.c b/x86_64-gen.c deleted file mode 100644 index 29a83069..00000000 --- a/x86_64-gen.c +++ /dev/null @@ -1,2322 +0,0 @@ -/* - * x86-64 code generator for TCC - * - * Copyright (c) 2008 Shinichiro Hamaji - * - * Based on i386-gen.c by Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef TARGET_DEFS_ONLY - -/* number of available registers */ -#define NB_REGS 25 -#define NB_ASM_REGS 16 -#define CONFIG_TCC_ASM - -/* a register can belong to several classes. The classes must be - sorted from more general to more precise (see gv2() code which does - assumptions on it). */ -#define RC_INT 0x0001 /* generic integer register */ -#define RC_FLOAT 0x0002 /* generic float register */ -#define RC_RAX 0x0004 -#define RC_RDX 0x0008 -#define RC_RCX 0x0010 -#define RC_RSI 0x0020 -#define RC_RDI 0x0040 -#define RC_ST0 0x0080 /* only for long double */ -#define RC_R8 0x0100 -#define RC_R9 0x0200 -#define RC_R10 0x0400 -#define RC_R11 0x0800 -#define RC_XMM0 0x1000 -#define RC_XMM1 0x2000 -#define RC_XMM2 0x4000 -#define RC_XMM3 0x8000 -#define RC_XMM4 0x10000 -#define RC_XMM5 0x20000 -#define RC_XMM6 0x40000 -#define RC_XMM7 0x80000 -#define RC_IRET RC_RAX /* function return: integer register */ -#define RC_IRE2 RC_RDX /* function return: second integer register */ -#define RC_FRET RC_XMM0 /* function return: float register */ -#define RC_FRE2 RC_XMM1 /* function return: second float register */ - -/* pretty names for the registers */ -enum { - TREG_RAX = 0, - TREG_RCX = 1, - TREG_RDX = 2, - TREG_RSP = 4, - TREG_RSI = 6, - TREG_RDI = 7, - - TREG_R8 = 8, - TREG_R9 = 9, - TREG_R10 = 10, - TREG_R11 = 11, - - TREG_XMM0 = 16, - TREG_XMM1 = 17, - TREG_XMM2 = 18, - TREG_XMM3 = 19, - TREG_XMM4 = 20, - TREG_XMM5 = 21, - TREG_XMM6 = 22, - TREG_XMM7 = 23, - - TREG_ST0 = 24, - - TREG_MEM = 0x20 -}; - -#define REX_BASE(reg) (((reg) >> 3) & 1) -#define REG_VALUE(reg) ((reg) & 7) - -/* return registers for function */ -#define REG_IRET TREG_RAX /* single word int return register */ -#define REG_IRE2 TREG_RDX /* second word return register (for long long) */ -#define REG_FRET TREG_XMM0 /* float return register */ -#define REG_FRE2 TREG_XMM1 /* second float return register */ - -/* defined if function parameters must be evaluated in reverse order */ -#define INVERT_FUNC_PARAMS - -/* pointer size, in bytes */ -#define PTR_SIZE 8 - -/* long double size and alignment, in bytes */ -#define LDOUBLE_SIZE 16 -#define LDOUBLE_ALIGN 16 -/* maximum alignment (for aligned attribute support) */ -#define MAX_ALIGN 16 - -/* define if return values need to be extended explicitely - at caller side (for interfacing with non-TCC compilers) */ -#define PROMOTE_RET - -#define TCC_TARGET_NATIVE_STRUCT_COPY -ST_FUNC void gen_struct_copy(int size); - -/******************************************************/ -#else /* ! TARGET_DEFS_ONLY */ -/******************************************************/ -#define USING_GLOBALS -#include "tcc.h" -#include - -ST_DATA const char * const target_machine_defs = - "__x86_64__\0" - "__amd64__\0" - ; - -ST_DATA const int reg_classes[NB_REGS] = { - /* eax */ RC_INT | RC_RAX, - /* ecx */ RC_INT | RC_RCX, - /* edx */ RC_INT | RC_RDX, - 0, - 0, - 0, - RC_RSI, - RC_RDI, - RC_R8, - RC_R9, - RC_R10, - RC_R11, - 0, - 0, - 0, - 0, - /* xmm0 */ RC_FLOAT | RC_XMM0, - /* xmm1 */ RC_FLOAT | RC_XMM1, - /* xmm2 */ RC_FLOAT | RC_XMM2, - /* xmm3 */ RC_FLOAT | RC_XMM3, - /* xmm4 */ RC_FLOAT | RC_XMM4, - /* xmm5 */ RC_FLOAT | RC_XMM5, - /* xmm6 an xmm7 are included so gv() can be used on them, - but they are not tagged with RC_FLOAT because they are - callee saved on Windows */ - RC_XMM6, - RC_XMM7, - /* st0 */ RC_ST0 -}; - -static unsigned long func_sub_sp_offset; -static int func_ret_sub; - -#if defined(CONFIG_TCC_BCHECK) -static addr_t func_bound_offset; -static unsigned long func_bound_ind; -ST_DATA int func_bound_add_epilog; -#endif - -#ifdef TCC_TARGET_PE -static int func_scratch, func_alloca; -#endif - -/* XXX: make it faster ? */ -ST_FUNC void g(int c) -{ - int ind1; - if (nocode_wanted) - return; - ind1 = ind + 1; - if (ind1 > cur_text_section->data_allocated) - section_realloc(cur_text_section, ind1); - cur_text_section->data[ind] = c; - ind = ind1; -} - -ST_FUNC void o(unsigned int c) -{ - while (c) { - g(c); - c = c >> 8; - } -} - -ST_FUNC void gen_le16(int v) -{ - g(v); - g(v >> 8); -} - -ST_FUNC void gen_le32(int c) -{ - g(c); - g(c >> 8); - g(c >> 16); - g(c >> 24); -} - -ST_FUNC void gen_le64(int64_t c) -{ - g(c); - g(c >> 8); - g(c >> 16); - g(c >> 24); - g(c >> 32); - g(c >> 40); - g(c >> 48); - g(c >> 56); -} - -static void orex(int ll, int r, int r2, int b) -{ - if ((r & VT_VALMASK) >= VT_CONST) - r = 0; - if ((r2 & VT_VALMASK) >= VT_CONST) - r2 = 0; - if (ll || REX_BASE(r) || REX_BASE(r2)) - o(0x40 | REX_BASE(r) | (REX_BASE(r2) << 2) | (ll << 3)); - o(b); -} - -/* output a symbol and patch all calls to it */ -ST_FUNC void gsym_addr(int t, int a) -{ - while (t) { - unsigned char *ptr = cur_text_section->data + t; - uint32_t n = read32le(ptr); /* next value */ - write32le(ptr, a < 0 ? -a : a - t - 4); - t = n; - } -} - -static int is64_type(int t) -{ - return ((t & VT_BTYPE) == VT_PTR || - (t & VT_BTYPE) == VT_FUNC || - (t & VT_BTYPE) == VT_LLONG); -} - -/* instruction + 4 bytes data. Return the address of the data */ -static int oad(int c, int s) -{ - int t; - if (nocode_wanted) - return s; - o(c); - t = ind; - gen_le32(s); - return t; -} - -/* generate jmp to a label */ -#define gjmp2(instr,lbl) oad(instr,lbl) - -ST_FUNC void gen_addr32(int r, Sym *sym, int c) -{ - if (r & VT_SYM) - greloca(cur_text_section, sym, ind, R_X86_64_32S, c), c=0; - gen_le32(c); -} - -/* output constant with relocation if 'r & VT_SYM' is true */ -ST_FUNC void gen_addr64(int r, Sym *sym, int64_t c) -{ - if (r & VT_SYM) - greloca(cur_text_section, sym, ind, R_X86_64_64, c), c=0; - gen_le64(c); -} - -/* output constant with relocation if 'r & VT_SYM' is true */ -ST_FUNC void gen_addrpc32(int r, Sym *sym, int c) -{ - if (r & VT_SYM) - greloca(cur_text_section, sym, ind, R_X86_64_PC32, c-4), c=4; - gen_le32(c-4); -} - -/* output got address with relocation */ -static void gen_gotpcrel(int r, Sym *sym, int c) -{ -#ifdef TCC_TARGET_PE - tcc_error("internal error: no GOT on PE: %s %x %x | %02x %02x %02x\n", - get_tok_str(sym->v, NULL), c, r, - cur_text_section->data[ind-3], - cur_text_section->data[ind-2], - cur_text_section->data[ind-1] - ); -#endif - greloca(cur_text_section, sym, ind, R_X86_64_GOTPCREL, -4); - gen_le32(0); - if (c) { - /* we use add c, %xxx for displacement */ - orex(1, r, 0, 0x81); - o(0xc0 + REG_VALUE(r)); - gen_le32(c); - } -} - -static void gen_modrm_impl(int op_reg, int r, Sym *sym, int c, int is_got) -{ - op_reg = REG_VALUE(op_reg) << 3; - if ((r & VT_VALMASK) == VT_CONST) { - /* constant memory reference */ - if (!(r & VT_SYM)) { - /* Absolute memory reference */ - o(0x04 | op_reg); /* [sib] | destreg */ - oad(0x25, c); /* disp32 */ - } else { - o(0x05 | op_reg); /* (%rip)+disp32 | destreg */ - if (is_got) { - gen_gotpcrel(r, sym, c); - } else { - gen_addrpc32(r, sym, c); - } - } - } else if ((r & VT_VALMASK) == VT_LOCAL) { - /* currently, we use only ebp as base */ - if (c == (char)c) { - /* short reference */ - o(0x45 | op_reg); - g(c); - } else { - oad(0x85 | op_reg, c); - } - } else if ((r & VT_VALMASK) >= TREG_MEM) { - if (c) { - g(0x80 | op_reg | REG_VALUE(r)); - gen_le32(c); - } else { - g(0x00 | op_reg | REG_VALUE(r)); - } - } else { - g(0x00 | op_reg | REG_VALUE(r)); - } -} - -/* generate a modrm reference. 'op_reg' contains the additional 3 - opcode bits */ -static void gen_modrm(int op_reg, int r, Sym *sym, int c) -{ - gen_modrm_impl(op_reg, r, sym, c, 0); -} - -/* generate a modrm reference. 'op_reg' contains the additional 3 - opcode bits */ -static void gen_modrm64(int opcode, int op_reg, int r, Sym *sym, int c) -{ - int is_got; - is_got = (op_reg & TREG_MEM) && !(sym->type.t & VT_STATIC); - orex(1, r, op_reg, opcode); - gen_modrm_impl(op_reg, r, sym, c, is_got); -} - - -/* load 'r' from value 'sv' */ -void load(int r, SValue *sv) -{ - int v, t, ft, fc, fr; - SValue v1; - - fr = sv->r; - ft = sv->type.t & ~VT_DEFSIGN; - fc = sv->c.i; - if (fc != sv->c.i && (fr & VT_SYM)) - tcc_error("64 bit addend in load"); - - ft &= ~(VT_VOLATILE | VT_CONSTANT); - -#ifndef TCC_TARGET_PE - /* we use indirect access via got */ - if ((fr & VT_VALMASK) == VT_CONST && (fr & VT_SYM) && - (fr & VT_LVAL) && !(sv->sym->type.t & VT_STATIC)) { - /* use the result register as a temporal register */ - int tr = r | TREG_MEM; - if (is_float(ft)) { - /* we cannot use float registers as a temporal register */ - tr = get_reg(RC_INT) | TREG_MEM; - } - gen_modrm64(0x8b, tr, fr, sv->sym, 0); - - /* load from the temporal register */ - fr = tr | VT_LVAL; - } -#endif - - v = fr & VT_VALMASK; - if (fr & VT_LVAL) { - int b, ll; - if (v == VT_LLOCAL) { - v1.type.t = VT_PTR; - v1.r = VT_LOCAL | VT_LVAL; - v1.c.i = fc; - fr = r; - if (!(reg_classes[fr] & (RC_INT|RC_R11))) - fr = get_reg(RC_INT); - load(fr, &v1); - } - if (fc != sv->c.i) { - /* If the addends doesn't fit into a 32bit signed - we must use a 64bit move. We've checked above - that this doesn't have a sym associated. */ - v1.type.t = VT_LLONG; - v1.r = VT_CONST; - v1.c.i = sv->c.i; - fr = r; - if (!(reg_classes[fr] & (RC_INT|RC_R11))) - fr = get_reg(RC_INT); - load(fr, &v1); - fc = 0; - } - ll = 0; - /* Like GCC we can load from small enough properly sized - structs and unions as well. - XXX maybe move to generic operand handling, but should - occur only with asm, so tccasm.c might also be a better place */ - if ((ft & VT_BTYPE) == VT_STRUCT) { - int align; - switch (type_size(&sv->type, &align)) { - case 1: ft = VT_BYTE; break; - case 2: ft = VT_SHORT; break; - case 4: ft = VT_INT; break; - case 8: ft = VT_LLONG; break; - default: - tcc_error("invalid aggregate type for register load"); - break; - } - } - if ((ft & VT_BTYPE) == VT_FLOAT) { - b = 0x6e0f66; - r = REG_VALUE(r); /* movd */ - } else if ((ft & VT_BTYPE) == VT_DOUBLE) { - b = 0x7e0ff3; /* movq */ - r = REG_VALUE(r); - } else if ((ft & VT_BTYPE) == VT_LDOUBLE) { - b = 0xdb, r = 5; /* fldt */ - } else if ((ft & VT_TYPE) == VT_BYTE || (ft & VT_TYPE) == VT_BOOL) { - b = 0xbe0f; /* movsbl */ - } else if ((ft & VT_TYPE) == (VT_BYTE | VT_UNSIGNED)) { - b = 0xb60f; /* movzbl */ - } else if ((ft & VT_TYPE) == VT_SHORT) { - b = 0xbf0f; /* movswl */ - } else if ((ft & VT_TYPE) == (VT_SHORT | VT_UNSIGNED)) { - b = 0xb70f; /* movzwl */ - } else if ((ft & VT_TYPE) == (VT_VOID)) { - /* Can happen with zero size structs */ - return; - } else { - assert(((ft & VT_BTYPE) == VT_INT) - || ((ft & VT_BTYPE) == VT_LLONG) - || ((ft & VT_BTYPE) == VT_PTR) - || ((ft & VT_BTYPE) == VT_FUNC) - ); - ll = is64_type(ft); - b = 0x8b; - } - if (ll) { - gen_modrm64(b, r, fr, sv->sym, fc); - } else { - orex(ll, fr, r, b); - gen_modrm(r, fr, sv->sym, fc); - } - } else { - if (v == VT_CONST) { - if (fr & VT_SYM) { -#ifdef TCC_TARGET_PE - orex(1,0,r,0x8d); - o(0x05 + REG_VALUE(r) * 8); /* lea xx(%rip), r */ - gen_addrpc32(fr, sv->sym, fc); -#else - if (sv->sym->type.t & VT_STATIC) { - orex(1,0,r,0x8d); - o(0x05 + REG_VALUE(r) * 8); /* lea xx(%rip), r */ - gen_addrpc32(fr, sv->sym, fc); - } else { - orex(1,0,r,0x8b); - o(0x05 + REG_VALUE(r) * 8); /* mov xx(%rip), r */ - gen_gotpcrel(r, sv->sym, fc); - } -#endif - } else if (is64_type(ft)) { - if (sv->c.i >> 32) { - orex(1,r,0, 0xb8 + REG_VALUE(r)); /* movabs $xx, r */ - gen_le64(sv->c.i); - } else if (sv->c.i > 0) { - orex(0,r,0, 0xb8 + REG_VALUE(r)); /* mov $xx, r */ - gen_le32(sv->c.i); - } else { - o(0xc031 + REG_VALUE(r) * 0x900); /* xor r, r */ - } - } else { - orex(0,r,0, 0xb8 + REG_VALUE(r)); /* mov $xx, r */ - gen_le32(fc); - } - } else if (v == VT_LOCAL) { - orex(1,0,r,0x8d); /* lea xxx(%ebp), r */ - gen_modrm(r, VT_LOCAL, sv->sym, fc); - } else if (v == VT_CMP) { - if (fc & 0x100) - { - v = vtop->cmp_r; - fc &= ~0x100; - /* This was a float compare. If the parity bit is - set the result was unordered, meaning false for everything - except TOK_NE, and true for TOK_NE. */ - orex(0, r, 0, 0xb0 + REG_VALUE(r)); /* mov $0/1,%al */ - g(v ^ fc ^ (v == TOK_NE)); - o(0x037a + (REX_BASE(r) << 8)); - } - orex(0,r,0, 0x0f); /* setxx %br */ - o(fc); - o(0xc0 + REG_VALUE(r)); - orex(0,r,0, 0x0f); - o(0xc0b6 + REG_VALUE(r) * 0x900); /* movzbl %al, %eax */ - } else if (v == VT_JMP || v == VT_JMPI) { - t = v & 1; - orex(0,r,0,0); - oad(0xb8 + REG_VALUE(r), t); /* mov $1, r */ - o(0x05eb + (REX_BASE(r) << 8)); /* jmp after */ - gsym(fc); - orex(0,r,0,0); - oad(0xb8 + REG_VALUE(r), t ^ 1); /* mov $0, r */ - } else if (v != r) { - if ((r >= TREG_XMM0) && (r <= TREG_XMM7)) { - if (v == TREG_ST0) { - /* gen_cvt_ftof(VT_DOUBLE); */ - o(0xf0245cdd); /* fstpl -0x10(%rsp) */ - /* movsd -0x10(%rsp),%xmmN */ - o(0x100ff2); - o(0x44 + REG_VALUE(r)*8); /* %xmmN */ - o(0xf024); - } else { - assert((v >= TREG_XMM0) && (v <= TREG_XMM7)); - if ((ft & VT_BTYPE) == VT_FLOAT) { - o(0x100ff3); - } else { - assert((ft & VT_BTYPE) == VT_DOUBLE); - o(0x100ff2); - } - o(0xc0 + REG_VALUE(v) + REG_VALUE(r)*8); - } - } else if (r == TREG_ST0) { - assert((v >= TREG_XMM0) && (v <= TREG_XMM7)); - /* gen_cvt_ftof(VT_LDOUBLE); */ - /* movsd %xmmN,-0x10(%rsp) */ - o(0x110ff2); - o(0x44 + REG_VALUE(r)*8); /* %xmmN */ - o(0xf024); - o(0xf02444dd); /* fldl -0x10(%rsp) */ - } else { - orex(is64_type(ft), r, v, 0x89); - o(0xc0 + REG_VALUE(r) + REG_VALUE(v) * 8); /* mov v, r */ - } - } - } -} - -/* store register 'r' in lvalue 'v' */ -void store(int r, SValue *v) -{ - int fr, bt, ft, fc; - int op64 = 0; - /* store the REX prefix in this variable when PIC is enabled */ - int pic = 0; - - fr = v->r & VT_VALMASK; - ft = v->type.t; - fc = v->c.i; - if (fc != v->c.i && (fr & VT_SYM)) - tcc_error("64 bit addend in store"); - ft &= ~(VT_VOLATILE | VT_CONSTANT); - bt = ft & VT_BTYPE; - -#ifndef TCC_TARGET_PE - /* we need to access the variable via got */ - if (fr == VT_CONST - && (v->r & VT_SYM) - && !(v->sym->type.t & VT_STATIC)) { - /* mov xx(%rip), %r11 */ - o(0x1d8b4c); - gen_gotpcrel(TREG_R11, v->sym, v->c.i); - pic = is64_type(bt) ? 0x49 : 0x41; - } -#endif - - /* XXX: incorrect if float reg to reg */ - if (bt == VT_FLOAT) { - o(0x66); - o(pic); - o(0x7e0f); /* movd */ - r = REG_VALUE(r); - } else if (bt == VT_DOUBLE) { - o(0x66); - o(pic); - o(0xd60f); /* movq */ - r = REG_VALUE(r); - } else if (bt == VT_LDOUBLE) { - o(0xc0d9); /* fld %st(0) */ - o(pic); - o(0xdb); /* fstpt */ - r = 7; - } else { - if (bt == VT_SHORT) - o(0x66); - o(pic); - if (bt == VT_BYTE || bt == VT_BOOL) - orex(0, 0, r, 0x88); - else if (is64_type(bt)) - op64 = 0x89; - else - orex(0, 0, r, 0x89); - } - if (pic) { - /* xxx r, (%r11) where xxx is mov, movq, fld, or etc */ - if (op64) - o(op64); - o(3 + (r << 3)); - } else if (op64) { - if (fr == VT_CONST || fr == VT_LOCAL || (v->r & VT_LVAL)) { - gen_modrm64(op64, r, v->r, v->sym, fc); - } else if (fr != r) { - orex(1, fr, r, op64); - o(0xc0 + fr + r * 8); /* mov r, fr */ - } - } else { - if (fr == VT_CONST || fr == VT_LOCAL || (v->r & VT_LVAL)) { - gen_modrm(r, v->r, v->sym, fc); - } else if (fr != r) { - o(0xc0 + fr + r * 8); /* mov r, fr */ - } - } -} - -/* 'is_jmp' is '1' if it is a jump */ -static void gcall_or_jmp(int is_jmp) -{ - int r; - if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST && - ((vtop->r & VT_SYM) && (vtop->c.i-4) == (int)(vtop->c.i-4))) { - /* constant symbolic case -> simple relocation */ - greloca(cur_text_section, vtop->sym, ind + 1, R_X86_64_PLT32, (int)(vtop->c.i-4)); - oad(0xe8 + is_jmp, 0); /* call/jmp im */ - } else { - /* otherwise, indirect call */ - r = TREG_R11; - load(r, vtop); - o(0x41); /* REX */ - o(0xff); /* call/jmp *r */ - o(0xd0 + REG_VALUE(r) + (is_jmp << 4)); - } -} - -#if defined(CONFIG_TCC_BCHECK) - -static void gen_bounds_call(int v) -{ - Sym *sym = external_helper_sym(v); - oad(0xe8, 0); - greloca(cur_text_section, sym, ind-4, R_X86_64_PLT32, -4); -} - -#ifdef TCC_TARGET_PE -# define TREG_FASTCALL_1 TREG_RCX -#else -# define TREG_FASTCALL_1 TREG_RDI -#endif - -static void gen_bounds_prolog(void) -{ - /* leave some room for bound checking code */ - func_bound_offset = lbounds_section->data_offset; - func_bound_ind = ind; - func_bound_add_epilog = 0; - o(0x0d8d48 + ((TREG_FASTCALL_1 == TREG_RDI) * 0x300000)); /*lbound section pointer */ - gen_le32 (0); - oad(0xb8, 0); /* call to function */ -} - -static void gen_bounds_epilog(void) -{ - addr_t saved_ind; - addr_t *bounds_ptr; - Sym *sym_data; - int offset_modified = func_bound_offset != lbounds_section->data_offset; - - if (!offset_modified && !func_bound_add_epilog) - return; - - /* add end of table info */ - bounds_ptr = section_ptr_add(lbounds_section, sizeof(addr_t)); - *bounds_ptr = 0; - - sym_data = get_sym_ref(&char_pointer_type, lbounds_section, - func_bound_offset, PTR_SIZE); - - /* generate bound local allocation */ - if (offset_modified) { - saved_ind = ind; - ind = func_bound_ind; - greloca(cur_text_section, sym_data, ind + 3, R_X86_64_PC32, -4); - ind = ind + 7; - gen_bounds_call(TOK___bound_local_new); - ind = saved_ind; - } - - /* generate bound check local freeing */ - o(0x5250); /* save returned value, if any */ - o(0x20ec8348); /* sub $32,%rsp */ - o(0x290f); /* movaps %xmm0,0x10(%rsp) */ - o(0x102444); - o(0x240c290f); /* movaps %xmm1,(%rsp) */ - greloca(cur_text_section, sym_data, ind + 3, R_X86_64_PC32, -4); - o(0x0d8d48 + ((TREG_FASTCALL_1 == TREG_RDI) * 0x300000)); /* lea xxx(%rip), %rcx/rdi */ - gen_le32 (0); - gen_bounds_call(TOK___bound_local_delete); - o(0x280f); /* movaps 0x10(%rsp),%xmm0 */ - o(0x102444); - o(0x240c280f); /* movaps (%rsp),%xmm1 */ - o(0x20c48348); /* add $32,%rsp */ - o(0x585a); /* restore returned value, if any */ -} -#endif - -#ifdef TCC_TARGET_PE - -#define REGN 4 -static const uint8_t arg_regs[REGN] = { - TREG_RCX, TREG_RDX, TREG_R8, TREG_R9 -}; - -/* Prepare arguments in R10 and R11 rather than RCX and RDX - because gv() will not ever use these */ -static int arg_prepare_reg(int idx) { - if (idx == 0 || idx == 1) - /* idx=0: r10, idx=1: r11 */ - return idx + 10; - else - return idx >= 0 && idx < REGN ? arg_regs[idx] : 0; -} - -/* Generate function call. The function address is pushed first, then - all the parameters in call order. This functions pops all the - parameters and the function address. */ - -static void gen_offs_sp(int b, int r, int d) -{ - orex(1,0,r & 0x100 ? 0 : r, b); - if (d == (char)d) { - o(0x2444 | (REG_VALUE(r) << 3)); - g(d); - } else { - o(0x2484 | (REG_VALUE(r) << 3)); - gen_le32(d); - } -} - -static int using_regs(int size) -{ - return !(size > 8 || (size & (size - 1))); -} - -/* Return the number of registers needed to return the struct, or 0 if - returning via struct pointer. */ -ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize) -{ - int size, align; - *ret_align = 1; // Never have to re-align return values for x86-64 - *regsize = 8; - size = type_size(vt, &align); - if (!using_regs(size)) - return 0; - if (size == 8) - ret->t = VT_LLONG; - else if (size == 4) - ret->t = VT_INT; - else if (size == 2) - ret->t = VT_SHORT; - else - ret->t = VT_BYTE; - ret->ref = NULL; - return 1; -} - -static int is_sse_float(int t) { - int bt; - bt = t & VT_BTYPE; - return bt == VT_DOUBLE || bt == VT_FLOAT; -} - -static int gfunc_arg_size(CType *type) { - int align; - if (type->t & (VT_ARRAY|VT_BITFIELD)) - return 8; - return type_size(type, &align); -} - -void gfunc_call(int nb_args) -{ - int size, r, args_size, i, d, bt, struct_size; - int arg; - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gbound_args(nb_args); -#endif - - args_size = (nb_args < REGN ? REGN : nb_args) * PTR_SIZE; - arg = nb_args; - - /* for struct arguments, we need to call memcpy and the function - call breaks register passing arguments we are preparing. - So, we process arguments which will be passed by stack first. */ - struct_size = args_size; - for(i = 0; i < nb_args; i++) { - SValue *sv; - - --arg; - sv = &vtop[-i]; - bt = (sv->type.t & VT_BTYPE); - size = gfunc_arg_size(&sv->type); - - if (using_regs(size)) - continue; /* arguments smaller than 8 bytes passed in registers or on stack */ - - if (bt == VT_STRUCT) { - /* fetch cpu flag before generating any code */ - if ((vtop->r & VT_VALMASK) == VT_CMP) - gv(RC_INT); - /* align to stack align size */ - size = (size + 15) & ~15; - /* generate structure store */ - r = get_reg(RC_INT); - gen_offs_sp(0x8d, r, struct_size); - struct_size += size; - - /* generate memcpy call */ - vset(&sv->type, r | VT_LVAL, 0); - vpushv(sv); - vstore(); - --vtop; - } else if (bt == VT_LDOUBLE) { - gv(RC_ST0); - gen_offs_sp(0xdb, 0x107, struct_size); - struct_size += 16; - } - } - - if (func_scratch < struct_size) - func_scratch = struct_size; - - arg = nb_args; - struct_size = args_size; - - for(i = 0; i < nb_args; i++) { - --arg; - bt = (vtop->type.t & VT_BTYPE); - - size = gfunc_arg_size(&vtop->type); - if (!using_regs(size)) { - /* align to stack align size */ - size = (size + 15) & ~15; - if (arg >= REGN) { - d = get_reg(RC_INT); - gen_offs_sp(0x8d, d, struct_size); - gen_offs_sp(0x89, d, arg*8); - } else { - d = arg_prepare_reg(arg); - gen_offs_sp(0x8d, d, struct_size); - } - struct_size += size; - } else { - if (is_sse_float(vtop->type.t)) { - if (tcc_state->nosse) - tcc_error("SSE disabled"); - if (arg >= REGN) { - gv(RC_XMM0); - /* movq %xmm0, j*8(%rsp) */ - gen_offs_sp(0xd60f66, 0x100, arg*8); - } else { - /* Load directly to xmmN register */ - gv(RC_XMM0 << arg); - d = arg_prepare_reg(arg); - /* mov %xmmN, %rxx */ - o(0x66); - orex(1,d,0, 0x7e0f); - o(0xc0 + arg*8 + REG_VALUE(d)); - } - } else { - if (bt == VT_STRUCT) { - vtop->type.ref = NULL; - vtop->type.t = size > 4 ? VT_LLONG : size > 2 ? VT_INT - : size > 1 ? VT_SHORT : VT_BYTE; - } - - r = gv(RC_INT); - if (arg >= REGN) { - gen_offs_sp(0x89, r, arg*8); - } else { - d = arg_prepare_reg(arg); - orex(1,d,r,0x89); /* mov */ - o(0xc0 + REG_VALUE(r) * 8 + REG_VALUE(d)); - } - } - } - vtop--; - } - save_regs(0); - /* Copy R10 and R11 into RCX and RDX, respectively */ - if (nb_args > 0) { - o(0xd1894c); /* mov %r10, %rcx */ - if (nb_args > 1) { - o(0xda894c); /* mov %r11, %rdx */ - } - } - - gcall_or_jmp(0); - - if ((vtop->r & VT_SYM) && vtop->sym->v == TOK_alloca) { - /* need to add the "func_scratch" area after alloca */ - o(0x48); func_alloca = oad(0x05, func_alloca); /* add $NN, %rax */ -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_call(TOK___bound_alloca_nr); /* new region */ -#endif - } - vtop--; -} - - -#define FUNC_PROLOG_SIZE 11 - -/* generate function prolog of type 't' */ -void gfunc_prolog(Sym *func_sym) -{ - CType *func_type = &func_sym->type; - int addr, reg_param_index, bt, size; - Sym *sym; - CType *type; - - func_ret_sub = 0; - func_scratch = 32; - func_alloca = 0; - loc = 0; - - addr = PTR_SIZE * 2; - ind += FUNC_PROLOG_SIZE; - func_sub_sp_offset = ind; - reg_param_index = 0; - - sym = func_type->ref; - - /* if the function returns a structure, then add an - implicit pointer parameter */ - size = gfunc_arg_size(&func_vt); - if (!using_regs(size)) { - gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr); - func_vc = addr; - reg_param_index++; - addr += 8; - } - - /* define parameters */ - while ((sym = sym->next) != NULL) { - type = &sym->type; - bt = type->t & VT_BTYPE; - size = gfunc_arg_size(type); - if (!using_regs(size)) { - if (reg_param_index < REGN) { - gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr); - } - sym_push(sym->v & ~SYM_FIELD, type, - VT_LLOCAL | VT_LVAL, addr); - } else { - if (reg_param_index < REGN) { - /* save arguments passed by register */ - if ((bt == VT_FLOAT) || (bt == VT_DOUBLE)) { - if (tcc_state->nosse) - tcc_error("SSE disabled"); - o(0xd60f66); /* movq */ - gen_modrm(reg_param_index, VT_LOCAL, NULL, addr); - } else { - gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr); - } - } - sym_push(sym->v & ~SYM_FIELD, type, - VT_LOCAL | VT_LVAL, addr); - } - addr += 8; - reg_param_index++; - } - - while (reg_param_index < REGN) { - if (func_var) { - gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr); - addr += 8; - } - reg_param_index++; - } -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_prolog(); -#endif -} - -/* generate function epilog */ -void gfunc_epilog(void) -{ - int v, start; - - /* align local size to word & save local variables */ - func_scratch = (func_scratch + 15) & -16; - loc = (loc & -16) - func_scratch; - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_epilog(); -#endif - - o(0xc9); /* leave */ - if (func_ret_sub == 0) { - o(0xc3); /* ret */ - } else { - o(0xc2); /* ret n */ - g(func_ret_sub); - g(func_ret_sub >> 8); - } - - v = -loc; - start = func_sub_sp_offset - FUNC_PROLOG_SIZE; - cur_text_section->data_offset = ind; - pe_add_unwind_data(start, ind, v); - - ind = start; - if (v >= 4096) { - Sym *sym = external_helper_sym(TOK___chkstk); - oad(0xb8, v); /* mov stacksize, %eax */ - oad(0xe8, 0); /* call __chkstk, (does the stackframe too) */ - greloca(cur_text_section, sym, ind-4, R_X86_64_PLT32, -4); - o(0x90); /* fill for FUNC_PROLOG_SIZE = 11 bytes */ - } else { - o(0xe5894855); /* push %rbp, mov %rsp, %rbp */ - o(0xec8148); /* sub rsp, stacksize */ - gen_le32(v); - } - ind = cur_text_section->data_offset; - - /* add the "func_scratch" area after each alloca seen */ - gsym_addr(func_alloca, -func_scratch); -} - -#else - -static void gadd_sp(int val) -{ - if (val == (char)val) { - o(0xc48348); - g(val); - } else { - oad(0xc48148, val); /* add $xxx, %rsp */ - } -} - -typedef enum X86_64_Mode { - x86_64_mode_none, - x86_64_mode_memory, - x86_64_mode_integer, - x86_64_mode_sse, - x86_64_mode_x87 -} X86_64_Mode; - -static X86_64_Mode classify_x86_64_merge(X86_64_Mode a, X86_64_Mode b) -{ - if (a == b) - return a; - else if (a == x86_64_mode_none) - return b; - else if (b == x86_64_mode_none) - return a; - else if ((a == x86_64_mode_memory) || (b == x86_64_mode_memory)) - return x86_64_mode_memory; - else if ((a == x86_64_mode_integer) || (b == x86_64_mode_integer)) - return x86_64_mode_integer; - else if ((a == x86_64_mode_x87) || (b == x86_64_mode_x87)) - return x86_64_mode_memory; - else - return x86_64_mode_sse; -} - -static X86_64_Mode classify_x86_64_inner(CType *ty) -{ - X86_64_Mode mode; - Sym *f; - - switch (ty->t & VT_BTYPE) { - case VT_VOID: return x86_64_mode_none; - - case VT_INT: - case VT_BYTE: - case VT_SHORT: - case VT_LLONG: - case VT_BOOL: - case VT_PTR: - case VT_FUNC: - return x86_64_mode_integer; - - case VT_FLOAT: - case VT_DOUBLE: return x86_64_mode_sse; - - case VT_LDOUBLE: return x86_64_mode_x87; - - case VT_STRUCT: - f = ty->ref; - - mode = x86_64_mode_none; - for (f = f->next; f; f = f->next) - mode = classify_x86_64_merge(mode, classify_x86_64_inner(&f->type)); - - return mode; - } - assert(0); - return 0; -} - -static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *palign, int *reg_count) -{ - X86_64_Mode mode; - int size, align, ret_t = 0; - - if (ty->t & (VT_BITFIELD|VT_ARRAY)) { - *psize = 8; - *palign = 8; - *reg_count = 1; - ret_t = ty->t; - mode = x86_64_mode_integer; - } else { - size = type_size(ty, &align); - *psize = (size + 7) & ~7; - *palign = (align + 7) & ~7; - *reg_count = 0; /* avoid compiler warning */ - - if (size > 16) { - mode = x86_64_mode_memory; - } else { - mode = classify_x86_64_inner(ty); - switch (mode) { - case x86_64_mode_integer: - if (size > 8) { - *reg_count = 2; - ret_t = VT_QLONG; - } else { - *reg_count = 1; - if (size > 4) - ret_t = VT_LLONG; - else if (size > 2) - ret_t = VT_INT; - else if (size > 1) - ret_t = VT_SHORT; - else - ret_t = VT_BYTE; - if ((ty->t & VT_BTYPE) == VT_STRUCT || (ty->t & VT_UNSIGNED)) - ret_t |= VT_UNSIGNED; - } - break; - - case x86_64_mode_x87: - *reg_count = 1; - ret_t = VT_LDOUBLE; - break; - - case x86_64_mode_sse: - if (size > 8) { - *reg_count = 2; - ret_t = VT_QFLOAT; - } else { - *reg_count = 1; - ret_t = (size > 4) ? VT_DOUBLE : VT_FLOAT; - } - break; - default: break; /* nothing to be done for x86_64_mode_memory and x86_64_mode_none*/ - } - } - } - - if (ret) { - ret->ref = NULL; - ret->t = ret_t; - } - - return mode; -} - -ST_FUNC int classify_x86_64_va_arg(CType *ty) -{ - /* This definition must be synced with stdarg.h */ - enum __va_arg_type { - __va_gen_reg, __va_float_reg, __va_stack - }; - int size, align, reg_count; - X86_64_Mode mode = classify_x86_64_arg(ty, NULL, &size, &align, ®_count); - switch (mode) { - default: return __va_stack; - case x86_64_mode_integer: return __va_gen_reg; - case x86_64_mode_sse: return __va_float_reg; - } -} - -/* Return the number of registers needed to return the struct, or 0 if - returning via struct pointer. */ -ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize) -{ - int size, align, reg_count; - if (classify_x86_64_arg(vt, ret, &size, &align, ®_count) == x86_64_mode_memory) - return 0; - *ret_align = 1; // Never have to re-align return values for x86-64 - *regsize = 8 * reg_count; /* the (virtual) regsize is 16 for VT_QLONG/QFLOAT */ - return 1; -} - -#define REGN 6 -static const uint8_t arg_regs[REGN] = { - TREG_RDI, TREG_RSI, TREG_RDX, TREG_RCX, TREG_R8, TREG_R9 -}; - -static int arg_prepare_reg(int idx) { - if (idx == 2 || idx == 3) - /* idx=2: r10, idx=3: r11 */ - return idx + 8; - else - return idx >= 0 && idx < REGN ? arg_regs[idx] : 0; -} - -/* Generate function call. The function address is pushed first, then - all the parameters in call order. This functions pops all the - parameters and the function address. */ -void gfunc_call(int nb_args) -{ - X86_64_Mode mode; - CType type; - int size, align, r, args_size, stack_adjust, i, reg_count, k; - int nb_reg_args = 0; - int nb_sse_args = 0; - int sse_reg, gen_reg; - char *onstack = tcc_malloc((nb_args + 1) * sizeof (char)); - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gbound_args(nb_args); -#endif - - /* calculate the number of integer/float register arguments, remember - arguments to be passed via stack (in onstack[]), and also remember - if we have to align the stack pointer to 16 (onstack[i] == 2). Needs - to be done in a left-to-right pass over arguments. */ - stack_adjust = 0; - for(i = nb_args - 1; i >= 0; i--) { - mode = classify_x86_64_arg(&vtop[-i].type, NULL, &size, &align, ®_count); - if (size == 0) continue; - if (mode == x86_64_mode_sse && nb_sse_args + reg_count <= 8) { - nb_sse_args += reg_count; - onstack[i] = 0; - } else if (mode == x86_64_mode_integer && nb_reg_args + reg_count <= REGN) { - nb_reg_args += reg_count; - onstack[i] = 0; - } else if (mode == x86_64_mode_none) { - onstack[i] = 0; - } else { - if (align == 16 && (stack_adjust &= 15)) { - onstack[i] = 2; - stack_adjust = 0; - } else - onstack[i] = 1; - stack_adjust += size; - } - } - - if (nb_sse_args && tcc_state->nosse) - tcc_error("SSE disabled but floating point arguments passed"); - - /* fetch cpu flag before generating any code */ - if ((vtop->r & VT_VALMASK) == VT_CMP) - gv(RC_INT); - - /* for struct arguments, we need to call memcpy and the function - call breaks register passing arguments we are preparing. - So, we process arguments which will be passed by stack first. */ - gen_reg = nb_reg_args; - sse_reg = nb_sse_args; - args_size = 0; - stack_adjust &= 15; - for (i = k = 0; i < nb_args;) { - mode = classify_x86_64_arg(&vtop[-i].type, NULL, &size, &align, ®_count); - if (size) { - if (!onstack[i + k]) { - ++i; - continue; - } - /* Possibly adjust stack to align SSE boundary. We're processing - args from right to left while allocating happens left to right - (stack grows down), so the adjustment needs to happen _after_ - an argument that requires it. */ - if (stack_adjust) { - o(0x50); /* push %rax; aka sub $8,%rsp */ - args_size += 8; - stack_adjust = 0; - } - if (onstack[i + k] == 2) - stack_adjust = 1; - } - - vrotb(i+1); - - switch (vtop->type.t & VT_BTYPE) { - case VT_STRUCT: - /* allocate the necessary size on stack */ - o(0x48); - oad(0xec81, size); /* sub $xxx, %rsp */ - /* generate structure store */ - r = get_reg(RC_INT); - orex(1, r, 0, 0x89); /* mov %rsp, r */ - o(0xe0 + REG_VALUE(r)); - vset(&vtop->type, r | VT_LVAL, 0); - vswap(); - /* keep stack aligned for (__bound_)memmove call */ - o(0x10ec8348); /* sub $16,%rsp */ - o(0xf0e48348); /* and $-16,%rsp */ - orex(0,r,0,0x50 + REG_VALUE(r)); /* push r (last %rsp) */ - o(0x08ec8348); /* sub $8,%rsp */ - vstore(); - o(0x08c48348); /* add $8,%rsp */ - o(0x5c); /* pop %rsp */ - break; - - case VT_LDOUBLE: - gv(RC_ST0); - oad(0xec8148, size); /* sub $xxx, %rsp */ - o(0x7cdb); /* fstpt 0(%rsp) */ - g(0x24); - g(0x00); - break; - - case VT_FLOAT: - case VT_DOUBLE: - assert(mode == x86_64_mode_sse); - r = gv(RC_FLOAT); - o(0x50); /* push $rax */ - /* movq %xmmN, (%rsp) */ - o(0xd60f66); - o(0x04 + REG_VALUE(r)*8); - o(0x24); - break; - - default: - assert(mode == x86_64_mode_integer); - /* simple type */ - /* XXX: implicit cast ? */ - r = gv(RC_INT); - orex(0,r,0,0x50 + REG_VALUE(r)); /* push r */ - break; - } - args_size += size; - - vpop(); - --nb_args; - k++; - } - - tcc_free(onstack); - - /* XXX This should be superfluous. */ - save_regs(0); /* save used temporary registers */ - - /* then, we prepare register passing arguments. - Note that we cannot set RDX and RCX in this loop because gv() - may break these temporary registers. Let's use R10 and R11 - instead of them */ - assert(gen_reg <= REGN); - assert(sse_reg <= 8); - for(i = 0; i < nb_args; i++) { - mode = classify_x86_64_arg(&vtop->type, &type, &size, &align, ®_count); - if (size == 0) continue; - /* Alter stack entry type so that gv() knows how to treat it */ - vtop->type = type; - if (mode == x86_64_mode_sse) { - if (reg_count == 2) { - sse_reg -= 2; - gv(RC_FRET); /* Use pair load into xmm0 & xmm1 */ - if (sse_reg) { /* avoid redundant movaps %xmm0, %xmm0 */ - /* movaps %xmm1, %xmmN */ - o(0x280f); - o(0xc1 + ((sse_reg+1) << 3)); - /* movaps %xmm0, %xmmN */ - o(0x280f); - o(0xc0 + (sse_reg << 3)); - } - } else { - assert(reg_count == 1); - --sse_reg; - /* Load directly to register */ - gv(RC_XMM0 << sse_reg); - } - } else if (mode == x86_64_mode_integer) { - /* simple type */ - /* XXX: implicit cast ? */ - int d; - gen_reg -= reg_count; - r = gv(RC_INT); - d = arg_prepare_reg(gen_reg); - orex(1,d,r,0x89); /* mov */ - o(0xc0 + REG_VALUE(r) * 8 + REG_VALUE(d)); - if (reg_count == 2) { - d = arg_prepare_reg(gen_reg+1); - orex(1,d,vtop->r2,0x89); /* mov */ - o(0xc0 + REG_VALUE(vtop->r2) * 8 + REG_VALUE(d)); - } - } - vtop--; - } - assert(gen_reg == 0); - assert(sse_reg == 0); - - /* We shouldn't have many operands on the stack anymore, but the - call address itself is still there, and it might be in %eax - (or edx/ecx) currently, which the below writes would clobber. - So evict all remaining operands here. */ - save_regs(0); - - /* Copy R10 and R11 into RDX and RCX, respectively */ - if (nb_reg_args > 2) { - o(0xd2894c); /* mov %r10, %rdx */ - if (nb_reg_args > 3) { - o(0xd9894c); /* mov %r11, %rcx */ - } - } - - if (vtop->type.ref->f.func_type != FUNC_NEW) /* implies FUNC_OLD or FUNC_ELLIPSIS */ - oad(0xb8, nb_sse_args < 8 ? nb_sse_args : 8); /* mov nb_sse_args, %eax */ - gcall_or_jmp(0); - if (args_size) - gadd_sp(args_size); - vtop--; -} - -#define FUNC_PROLOG_SIZE 11 - -static void push_arg_reg(int i) { - loc -= 8; - gen_modrm64(0x89, arg_regs[i], VT_LOCAL, NULL, loc); -} - -/* generate function prolog of type 't' */ -void gfunc_prolog(Sym *func_sym) -{ - CType *func_type = &func_sym->type; - X86_64_Mode mode, ret_mode; - int i, addr, align, size, reg_count; - int param_addr = 0, reg_param_index, sse_param_index; - Sym *sym; - CType *type; - - sym = func_type->ref; - addr = PTR_SIZE * 2; - loc = 0; - ind += FUNC_PROLOG_SIZE; - func_sub_sp_offset = ind; - func_ret_sub = 0; - ret_mode = classify_x86_64_arg(&func_vt, NULL, &size, &align, ®_count); - - if (func_var) { - int seen_reg_num, seen_sse_num, seen_stack_size; - seen_reg_num = ret_mode == x86_64_mode_memory; - seen_sse_num = 0; - /* frame pointer and return address */ - seen_stack_size = PTR_SIZE * 2; - /* count the number of seen parameters */ - sym = func_type->ref; - while ((sym = sym->next) != NULL) { - type = &sym->type; - mode = classify_x86_64_arg(type, NULL, &size, &align, ®_count); - switch (mode) { - default: - stack_arg: - seen_stack_size = ((seen_stack_size + align - 1) & -align) + size; - break; - - case x86_64_mode_integer: - if (seen_reg_num + reg_count > REGN) - goto stack_arg; - seen_reg_num += reg_count; - break; - - case x86_64_mode_sse: - if (seen_sse_num + reg_count > 8) - goto stack_arg; - seen_sse_num += reg_count; - break; - } - } - - loc -= 24; - /* movl $0x????????, -0x18(%rbp) */ - o(0xe845c7); - gen_le32(seen_reg_num * 8); - /* movl $0x????????, -0x14(%rbp) */ - o(0xec45c7); - gen_le32(seen_sse_num * 16 + 48); - /* leaq $0x????????, %r11 */ - o(0x9d8d4c); - gen_le32(seen_stack_size); - /* movq %r11, -0x10(%rbp) */ - o(0xf05d894c); - /* leaq $-192(%rbp), %r11 */ - o(0x9d8d4c); - gen_le32(-176 - 24); - /* movq %r11, -0x8(%rbp) */ - o(0xf85d894c); - - /* save all register passing arguments */ - for (i = 0; i < 8; i++) { - loc -= 16; - if (!tcc_state->nosse) { - o(0xd60f66); /* movq */ - gen_modrm(7 - i, VT_LOCAL, NULL, loc); - } - /* movq $0, loc+8(%rbp) */ - o(0x85c748); - gen_le32(loc + 8); - gen_le32(0); - } - for (i = 0; i < REGN; i++) { - push_arg_reg(REGN-1-i); - } - } - - sym = func_type->ref; - reg_param_index = 0; - sse_param_index = 0; - - /* if the function returns a structure, then add an - implicit pointer parameter */ - if (ret_mode == x86_64_mode_memory) { - push_arg_reg(reg_param_index); - func_vc = loc; - reg_param_index++; - } - /* define parameters */ - while ((sym = sym->next) != NULL) { - type = &sym->type; - mode = classify_x86_64_arg(type, NULL, &size, &align, ®_count); - switch (mode) { - case x86_64_mode_sse: - if (tcc_state->nosse) - tcc_error("SSE disabled but floating point arguments used"); - if (sse_param_index + reg_count <= 8) { - /* save arguments passed by register */ - loc -= reg_count * 8; - param_addr = loc; - for (i = 0; i < reg_count; ++i) { - o(0xd60f66); /* movq */ - gen_modrm(sse_param_index, VT_LOCAL, NULL, param_addr + i*8); - ++sse_param_index; - } - } else { - addr = (addr + align - 1) & -align; - param_addr = addr; - addr += size; - } - break; - - case x86_64_mode_memory: - case x86_64_mode_x87: - addr = (addr + align - 1) & -align; - param_addr = addr; - addr += size; - break; - - case x86_64_mode_integer: { - if (reg_param_index + reg_count <= REGN) { - /* save arguments passed by register */ - loc -= reg_count * 8; - param_addr = loc; - for (i = 0; i < reg_count; ++i) { - gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, param_addr + i*8); - ++reg_param_index; - } - } else { - addr = (addr + align - 1) & -align; - param_addr = addr; - addr += size; - } - break; - } - default: break; /* nothing to be done for x86_64_mode_none */ - } - sym_push(sym->v & ~SYM_FIELD, type, - VT_LOCAL | VT_LVAL, param_addr); - } - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_prolog(); -#endif -} - -/* generate function epilog */ -void gfunc_epilog(void) -{ - int v, saved_ind; - -#ifdef CONFIG_TCC_BCHECK - if (tcc_state->do_bounds_check) - gen_bounds_epilog(); -#endif - o(0xc9); /* leave */ - if (func_ret_sub == 0) { - o(0xc3); /* ret */ - } else { - o(0xc2); /* ret n */ - g(func_ret_sub); - g(func_ret_sub >> 8); - } - /* align local size to word & save local variables */ - v = (-loc + 15) & -16; - saved_ind = ind; - ind = func_sub_sp_offset - FUNC_PROLOG_SIZE; - o(0xe5894855); /* push %rbp, mov %rsp, %rbp */ - o(0xec8148); /* sub rsp, stacksize */ - gen_le32(v); - ind = saved_ind; -} - -#endif /* not PE */ - -ST_FUNC void gen_fill_nops(int bytes) -{ - while (bytes--) - g(0x90); -} - -/* generate a jump to a label */ -int gjmp(int t) -{ - return gjmp2(0xe9, t); -} - -/* generate a jump to a fixed address */ -void gjmp_addr(int a) -{ - int r; - r = a - ind - 2; - if (r == (char)r) { - g(0xeb); - g(r); - } else { - oad(0xe9, a - ind - 5); - } -} - -ST_FUNC int gjmp_append(int n, int t) -{ - void *p; - /* insert vtop->c jump list in t */ - if (n) { - uint32_t n1 = n, n2; - while ((n2 = read32le(p = cur_text_section->data + n1))) - n1 = n2; - write32le(p, t); - t = n; - } - return t; -} - -ST_FUNC int gjmp_cond(int op, int t) -{ - if (op & 0x100) - { - /* This was a float compare. If the parity flag is set - the result was unordered. For anything except != this - means false and we don't jump (anding both conditions). - For != this means true (oring both). - Take care about inverting the test. We need to jump - to our target if the result was unordered and test wasn't NE, - otherwise if unordered we don't want to jump. */ - int v = vtop->cmp_r; - op &= ~0x100; - if (op ^ v ^ (v != TOK_NE)) - o(0x067a); /* jp +6 */ - else - { - g(0x0f); - t = gjmp2(0x8a, t); /* jp t */ - } - } - g(0x0f); - t = gjmp2(op - 16, t); - return t; -} - -/* generate an integer binary operation */ -void gen_opi(int op) -{ - int r, fr, opc, c; - int ll, uu, cc; - - ll = is64_type(vtop[-1].type.t); - uu = (vtop[-1].type.t & VT_UNSIGNED) != 0; - cc = (vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST; - - switch(op) { - case '+': - case TOK_ADDC1: /* add with carry generation */ - opc = 0; - gen_op8: - if (cc && (!ll || (int)vtop->c.i == vtop->c.i)) { - /* constant case */ - vswap(); - r = gv(RC_INT); - vswap(); - c = vtop->c.i; - if (c == (char)c) { - /* XXX: generate inc and dec for smaller code ? */ - orex(ll, r, 0, 0x83); - o(0xc0 | (opc << 3) | REG_VALUE(r)); - g(c); - } else { - orex(ll, r, 0, 0x81); - oad(0xc0 | (opc << 3) | REG_VALUE(r), c); - } - } else { - gv2(RC_INT, RC_INT); - r = vtop[-1].r; - fr = vtop[0].r; - orex(ll, r, fr, (opc << 3) | 0x01); - o(0xc0 + REG_VALUE(r) + REG_VALUE(fr) * 8); - } - vtop--; - if (op >= TOK_ULT && op <= TOK_GT) - vset_VT_CMP(op); - break; - case '-': - case TOK_SUBC1: /* sub with carry generation */ - opc = 5; - goto gen_op8; - case TOK_ADDC2: /* add with carry use */ - opc = 2; - goto gen_op8; - case TOK_SUBC2: /* sub with carry use */ - opc = 3; - goto gen_op8; - case '&': - opc = 4; - goto gen_op8; - case '^': - opc = 6; - goto gen_op8; - case '|': - opc = 1; - goto gen_op8; - case '*': - gv2(RC_INT, RC_INT); - r = vtop[-1].r; - fr = vtop[0].r; - orex(ll, fr, r, 0xaf0f); /* imul fr, r */ - o(0xc0 + REG_VALUE(fr) + REG_VALUE(r) * 8); - vtop--; - break; - case TOK_SHL: - opc = 4; - goto gen_shift; - case TOK_SHR: - opc = 5; - goto gen_shift; - case TOK_SAR: - opc = 7; - gen_shift: - opc = 0xc0 | (opc << 3); - if (cc) { - /* constant case */ - vswap(); - r = gv(RC_INT); - vswap(); - orex(ll, r, 0, 0xc1); /* shl/shr/sar $xxx, r */ - o(opc | REG_VALUE(r)); - g(vtop->c.i & (ll ? 63 : 31)); - } else { - /* we generate the shift in ecx */ - gv2(RC_INT, RC_RCX); - r = vtop[-1].r; - orex(ll, r, 0, 0xd3); /* shl/shr/sar %cl, r */ - o(opc | REG_VALUE(r)); - } - vtop--; - break; - case TOK_UDIV: - case TOK_UMOD: - uu = 1; - goto divmod; - case '/': - case '%': - case TOK_PDIV: - uu = 0; - divmod: - /* first operand must be in eax */ - /* XXX: need better constraint for second operand */ - gv2(RC_RAX, RC_RCX); - r = vtop[-1].r; - fr = vtop[0].r; - vtop--; - save_reg(TREG_RDX); - orex(ll, 0, 0, uu ? 0xd231 : 0x99); /* xor %edx,%edx : cqto */ - orex(ll, fr, 0, 0xf7); /* div fr, %eax */ - o((uu ? 0xf0 : 0xf8) + REG_VALUE(fr)); - if (op == '%' || op == TOK_UMOD) - r = TREG_RDX; - else - r = TREG_RAX; - vtop->r = r; - break; - default: - opc = 7; - goto gen_op8; - } -} - -void gen_opl(int op) -{ - gen_opi(op); -} - -void vpush_const(int t, int v) -{ - CType ctype = { t | VT_CONSTANT, 0 }; - vpushsym(&ctype, external_global_sym(v, &ctype)); - vtop->r |= VT_LVAL; -} - -/* generate a floating point operation 'v = t1 op t2' instruction. The - two operands are guaranteed to have the same floating point type */ -/* XXX: need to use ST1 too */ -void gen_opf(int op) -{ - int a, ft, fc, swapped, r; - int bt = vtop->type.t & VT_BTYPE; - int float_type = bt == VT_LDOUBLE ? RC_ST0 : RC_FLOAT; - - if (op == TOK_NEG) { /* unary minus */ - gv(float_type); - if (float_type == RC_ST0) { - o(0xe0d9); /* fchs */ - } else { - /* -0.0, in libtcc1.c */ - vpush_const(bt, bt == VT_FLOAT ? TOK___mzerosf : TOK___mzerodf); - gv(RC_FLOAT); - if (bt == VT_DOUBLE) - o(0x66); - /* xorp[sd] %xmm1, %xmm0 */ - o(0xc0570f | (REG_VALUE(vtop[0].r) + REG_VALUE(vtop[-1].r)*8) << 16); - vtop--; - } - return; - } - - /* convert constants to memory references */ - if ((vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { - vswap(); - gv(float_type); - vswap(); - } - if ((vtop[0].r & (VT_VALMASK | VT_LVAL)) == VT_CONST) - gv(float_type); - - /* must put at least one value in the floating point register */ - if ((vtop[-1].r & VT_LVAL) && - (vtop[0].r & VT_LVAL)) { - vswap(); - gv(float_type); - vswap(); - } - swapped = 0; - /* swap the stack if needed so that t1 is the register and t2 is - the memory reference */ - if (vtop[-1].r & VT_LVAL) { - vswap(); - swapped = 1; - } - if ((vtop->type.t & VT_BTYPE) == VT_LDOUBLE) { - if (op >= TOK_ULT && op <= TOK_GT) { - /* load on stack second operand */ - load(TREG_ST0, vtop); - save_reg(TREG_RAX); /* eax is used by FP comparison code */ - if (op == TOK_GE || op == TOK_GT) - swapped = !swapped; - else if (op == TOK_EQ || op == TOK_NE) - swapped = 0; - if (swapped) - o(0xc9d9); /* fxch %st(1) */ - if (op == TOK_EQ || op == TOK_NE) - o(0xe9da); /* fucompp */ - else - o(0xd9de); /* fcompp */ - o(0xe0df); /* fnstsw %ax */ - if (op == TOK_EQ) { - o(0x45e480); /* and $0x45, %ah */ - o(0x40fC80); /* cmp $0x40, %ah */ - } else if (op == TOK_NE) { - o(0x45e480); /* and $0x45, %ah */ - o(0x40f480); /* xor $0x40, %ah */ - op = TOK_NE; - } else if (op == TOK_GE || op == TOK_LE) { - o(0x05c4f6); /* test $0x05, %ah */ - op = TOK_EQ; - } else { - o(0x45c4f6); /* test $0x45, %ah */ - op = TOK_EQ; - } - vtop--; - vset_VT_CMP(op); - } else { - /* no memory reference possible for long double operations */ - load(TREG_ST0, vtop); - swapped = !swapped; - - switch(op) { - default: - case '+': - a = 0; - break; - case '-': - a = 4; - if (swapped) - a++; - break; - case '*': - a = 1; - break; - case '/': - a = 6; - if (swapped) - a++; - break; - } - ft = vtop->type.t; - fc = vtop->c.i; - o(0xde); /* fxxxp %st, %st(1) */ - o(0xc1 + (a << 3)); - vtop--; - } - } else { - if (op >= TOK_ULT && op <= TOK_GT) { - /* if saved lvalue, then we must reload it */ - r = vtop->r; - fc = vtop->c.i; - if ((r & VT_VALMASK) == VT_LLOCAL) { - SValue v1; - r = get_reg(RC_INT); - v1.type.t = VT_PTR; - v1.r = VT_LOCAL | VT_LVAL; - v1.c.i = fc; - load(r, &v1); - fc = 0; - vtop->r = r = r | VT_LVAL; - } - - if (op == TOK_EQ || op == TOK_NE) { - swapped = 0; - } else { - if (op == TOK_LE || op == TOK_LT) - swapped = !swapped; - if (op == TOK_LE || op == TOK_GE) { - op = 0x93; /* setae */ - } else { - op = 0x97; /* seta */ - } - } - - if (swapped) { - gv(RC_FLOAT); - vswap(); - } - assert(!(vtop[-1].r & VT_LVAL)); - - if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE) - o(0x66); - if (op == TOK_EQ || op == TOK_NE) - o(0x2e0f); /* ucomisd */ - else - o(0x2f0f); /* comisd */ - - if (vtop->r & VT_LVAL) { - gen_modrm(vtop[-1].r, r, vtop->sym, fc); - } else { - o(0xc0 + REG_VALUE(vtop[0].r) + REG_VALUE(vtop[-1].r)*8); - } - - vtop--; - vset_VT_CMP(op | 0x100); - vtop->cmp_r = op; - } else { - assert((vtop->type.t & VT_BTYPE) != VT_LDOUBLE); - switch(op) { - default: - case '+': - a = 0; - break; - case '-': - a = 4; - break; - case '*': - a = 1; - break; - case '/': - a = 6; - break; - } - ft = vtop->type.t; - fc = vtop->c.i; - assert((ft & VT_BTYPE) != VT_LDOUBLE); - - r = vtop->r; - /* if saved lvalue, then we must reload it */ - if ((vtop->r & VT_VALMASK) == VT_LLOCAL) { - SValue v1; - r = get_reg(RC_INT); - v1.type.t = VT_PTR; - v1.r = VT_LOCAL | VT_LVAL; - v1.c.i = fc; - load(r, &v1); - fc = 0; - vtop->r = r = r | VT_LVAL; - } - - assert(!(vtop[-1].r & VT_LVAL)); - if (swapped) { - assert(vtop->r & VT_LVAL); - gv(RC_FLOAT); - vswap(); - fc = vtop->c.i; /* bcheck may have saved previous vtop[-1] */ - } - - if ((ft & VT_BTYPE) == VT_DOUBLE) { - o(0xf2); - } else { - o(0xf3); - } - o(0x0f); - o(0x58 + a); - - if (vtop->r & VT_LVAL) { - gen_modrm(vtop[-1].r, r, vtop->sym, fc); - } else { - o(0xc0 + REG_VALUE(vtop[0].r) + REG_VALUE(vtop[-1].r)*8); - } - - vtop--; - } - } -} - -/* convert integers to fp 't' type. Must handle 'int', 'unsigned int' - and 'long long' cases. */ -void gen_cvt_itof(int t) -{ - if ((t & VT_BTYPE) == VT_LDOUBLE) { - save_reg(TREG_ST0); - gv(RC_INT); - if ((vtop->type.t & VT_BTYPE) == VT_LLONG) { - /* signed long long to float/double/long double (unsigned case - is handled generically) */ - o(0x50 + (vtop->r & VT_VALMASK)); /* push r */ - o(0x242cdf); /* fildll (%rsp) */ - o(0x08c48348); /* add $8, %rsp */ - } else if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) == - (VT_INT | VT_UNSIGNED)) { - /* unsigned int to float/double/long double */ - o(0x6a); /* push $0 */ - g(0x00); - o(0x50 + (vtop->r & VT_VALMASK)); /* push r */ - o(0x242cdf); /* fildll (%rsp) */ - o(0x10c48348); /* add $16, %rsp */ - } else { - /* int to float/double/long double */ - o(0x50 + (vtop->r & VT_VALMASK)); /* push r */ - o(0x2404db); /* fildl (%rsp) */ - o(0x08c48348); /* add $8, %rsp */ - } - vtop->r = TREG_ST0; - } else { - int r = get_reg(RC_FLOAT); - gv(RC_INT); - o(0xf2 + ((t & VT_BTYPE) == VT_FLOAT?1:0)); - if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) == - (VT_INT | VT_UNSIGNED) || - (vtop->type.t & VT_BTYPE) == VT_LLONG) { - o(0x48); /* REX */ - } - o(0x2a0f); - o(0xc0 + (vtop->r & VT_VALMASK) + REG_VALUE(r)*8); /* cvtsi2sd */ - vtop->r = r; - } -} - -/* convert from one floating point type to another */ -void gen_cvt_ftof(int t) -{ - int ft, bt, tbt; - - ft = vtop->type.t; - bt = ft & VT_BTYPE; - tbt = t & VT_BTYPE; - - if (bt == VT_FLOAT) { - gv(RC_FLOAT); - if (tbt == VT_DOUBLE) { - o(0x140f); /* unpcklps */ - o(0xc0 + REG_VALUE(vtop->r)*9); - o(0x5a0f); /* cvtps2pd */ - o(0xc0 + REG_VALUE(vtop->r)*9); - } else if (tbt == VT_LDOUBLE) { - save_reg(RC_ST0); - /* movss %xmm0,-0x10(%rsp) */ - o(0x110ff3); - o(0x44 + REG_VALUE(vtop->r)*8); - o(0xf024); - o(0xf02444d9); /* flds -0x10(%rsp) */ - vtop->r = TREG_ST0; - } - } else if (bt == VT_DOUBLE) { - gv(RC_FLOAT); - if (tbt == VT_FLOAT) { - o(0x140f66); /* unpcklpd */ - o(0xc0 + REG_VALUE(vtop->r)*9); - o(0x5a0f66); /* cvtpd2ps */ - o(0xc0 + REG_VALUE(vtop->r)*9); - } else if (tbt == VT_LDOUBLE) { - save_reg(RC_ST0); - /* movsd %xmm0,-0x10(%rsp) */ - o(0x110ff2); - o(0x44 + REG_VALUE(vtop->r)*8); - o(0xf024); - o(0xf02444dd); /* fldl -0x10(%rsp) */ - vtop->r = TREG_ST0; - } - } else { - int r; - gv(RC_ST0); - r = get_reg(RC_FLOAT); - if (tbt == VT_DOUBLE) { - o(0xf0245cdd); /* fstpl -0x10(%rsp) */ - /* movsd -0x10(%rsp),%xmm0 */ - o(0x100ff2); - o(0x44 + REG_VALUE(r)*8); - o(0xf024); - vtop->r = r; - } else if (tbt == VT_FLOAT) { - o(0xf0245cd9); /* fstps -0x10(%rsp) */ - /* movss -0x10(%rsp),%xmm0 */ - o(0x100ff3); - o(0x44 + REG_VALUE(r)*8); - o(0xf024); - vtop->r = r; - } - } -} - -/* convert fp to int 't' type */ -void gen_cvt_ftoi(int t) -{ - int ft, bt, size, r; - ft = vtop->type.t; - bt = ft & VT_BTYPE; - if (bt == VT_LDOUBLE) { - gen_cvt_ftof(VT_DOUBLE); - bt = VT_DOUBLE; - } - - gv(RC_FLOAT); - if (t != VT_INT) - size = 8; - else - size = 4; - - r = get_reg(RC_INT); - if (bt == VT_FLOAT) { - o(0xf3); - } else if (bt == VT_DOUBLE) { - o(0xf2); - } else { - assert(0); - } - orex(size == 8, r, 0, 0x2c0f); /* cvttss2si or cvttsd2si */ - o(0xc0 + REG_VALUE(vtop->r) + REG_VALUE(r)*8); - vtop->r = r; -} - -// Generate sign extension from 32 to 64 bits: -ST_FUNC void gen_cvt_sxtw(void) -{ - int r = gv(RC_INT); - /* x86_64 specific: movslq */ - o(0x6348); - o(0xc0 + (REG_VALUE(r) << 3) + REG_VALUE(r)); -} - -/* char/short to int conversion */ -ST_FUNC void gen_cvt_csti(int t) -{ - int r, sz, xl, ll; - r = gv(RC_INT); - sz = !(t & VT_UNSIGNED); - xl = (t & VT_BTYPE) == VT_SHORT; - ll = (vtop->type.t & VT_BTYPE) == VT_LLONG; - orex(ll, r, 0, 0xc0b60f /* mov[sz] %a[xl], %eax */ - | (sz << 3 | xl) << 8 - | (REG_VALUE(r) << 3 | REG_VALUE(r)) << 16 - ); -} - -/* increment tcov counter */ -ST_FUNC void gen_increment_tcov (SValue *sv) -{ - o(0x058348); /* addq $1, xxx(%rip) */ - greloca(cur_text_section, sv->sym, ind, R_X86_64_PC32, -5); - gen_le32(0); - o(1); -} - -/* computed goto support */ -ST_FUNC void ggoto(void) -{ - gcall_or_jmp(1); - vtop--; -} - -/* Save the stack pointer onto the stack and return the location of its address */ -ST_FUNC void gen_vla_sp_save(int addr) { - /* mov %rsp,addr(%rbp)*/ - gen_modrm64(0x89, TREG_RSP, VT_LOCAL, NULL, addr); -} - -/* Restore the SP from a location on the stack */ -ST_FUNC void gen_vla_sp_restore(int addr) { - gen_modrm64(0x8b, TREG_RSP, VT_LOCAL, NULL, addr); -} - -#ifdef TCC_TARGET_PE -/* Save result of gen_vla_alloc onto the stack */ -ST_FUNC void gen_vla_result(int addr) { - /* mov %rax,addr(%rbp)*/ - gen_modrm64(0x89, TREG_RAX, VT_LOCAL, NULL, addr); -} -#endif - -/* Subtract from the stack pointer, and push the resulting value onto the stack */ -ST_FUNC void gen_vla_alloc(CType *type, int align) { - int use_call = 0; - -#if defined(CONFIG_TCC_BCHECK) - use_call = tcc_state->do_bounds_check; -#endif -#ifdef TCC_TARGET_PE /* alloca does more than just adjust %rsp on Windows */ - use_call = 1; -#endif - if (use_call) - { - vpush_helper_func(TOK_alloca); - vswap(); /* Move alloca ref past allocation size */ - gfunc_call(1); - } - else { - int r; - r = gv(RC_INT); /* allocation size */ - /* sub r,%rsp */ - o(0x2b48); - o(0xe0 | REG_VALUE(r)); - /* We align to 16 bytes rather than align */ - /* and ~15, %rsp */ - o(0xf0e48348); - vpop(); - } -} - -/* - * Assmuing the top part of the stack looks like below, - * src dest src - */ -ST_FUNC void gen_struct_copy(int size) -{ - int n = size / PTR_SIZE; -#ifdef TCC_TARGET_PE - o(0x5756); /* push rsi, rdi */ -#endif - gv2(RC_RDI, RC_RSI); - if (n <= 4) { - while (n) - o(0xa548), --n; - } else { - vpushi(n); - gv(RC_RCX); - o(0xa548f3); - vpop(); - } - if (size & 0x04) - o(0xa5); - if (size & 0x02) - o(0xa566); - if (size & 0x01) - o(0xa4); -#ifdef TCC_TARGET_PE - o(0x5e5f); /* pop rdi, rsi */ -#endif - vpop(); - vpop(); -} - -/* end of x86-64 code generator */ -/*************************************************************/ -#endif /* ! TARGET_DEFS_ONLY */ -/******************************************************/ diff --git a/x86_64-link.c b/x86_64-link.c deleted file mode 100644 index 42f753c9..00000000 --- a/x86_64-link.c +++ /dev/null @@ -1,403 +0,0 @@ -#ifdef TARGET_DEFS_ONLY - -#define EM_TCC_TARGET EM_X86_64 - -/* relocation type for 32 bit data relocation */ -#define R_DATA_32 R_X86_64_32S -#define R_DATA_PTR R_X86_64_64 -#define R_JMP_SLOT R_X86_64_JUMP_SLOT -#define R_GLOB_DAT R_X86_64_GLOB_DAT -#define R_COPY R_X86_64_COPY -#define R_RELATIVE R_X86_64_RELATIVE - -#define R_NUM R_X86_64_NUM - -#define ELF_START_ADDR 0x400000 -#define ELF_PAGE_SIZE 0x200000 - -#define PCRELATIVE_DLLPLT 1 -#define RELOCATE_DLLPLT 1 - -#else /* !TARGET_DEFS_ONLY */ - -#include "tcc.h" - -#ifdef NEED_RELOC_TYPE -/* Returns 1 for a code relocation, 0 for a data relocation. For unknown - relocations, returns -1. */ -ST_FUNC int code_reloc (int reloc_type) -{ - switch (reloc_type) { - case R_X86_64_32: - case R_X86_64_32S: - case R_X86_64_64: - case R_X86_64_GOTPC32: - case R_X86_64_GOTPC64: - case R_X86_64_GOTPCREL: - case R_X86_64_GOTPCRELX: - case R_X86_64_REX_GOTPCRELX: - case R_X86_64_GOTTPOFF: - case R_X86_64_GOT32: - case R_X86_64_GOT64: - case R_X86_64_GLOB_DAT: - case R_X86_64_COPY: - case R_X86_64_RELATIVE: - case R_X86_64_GOTOFF64: - case R_X86_64_TLSGD: - case R_X86_64_TLSLD: - case R_X86_64_DTPOFF32: - case R_X86_64_TPOFF32: - case R_X86_64_DTPOFF64: - case R_X86_64_TPOFF64: - return 0; - - case R_X86_64_PC32: - case R_X86_64_PC64: - case R_X86_64_PLT32: - case R_X86_64_PLTOFF64: - case R_X86_64_JUMP_SLOT: - return 1; - } - return -1; -} - -/* Returns an enumerator to describe whether and when the relocation needs a - GOT and/or PLT entry to be created. See tcc.h for a description of the - different values. */ -ST_FUNC int gotplt_entry_type (int reloc_type) -{ - switch (reloc_type) { - case R_X86_64_GLOB_DAT: - case R_X86_64_JUMP_SLOT: - case R_X86_64_COPY: - case R_X86_64_RELATIVE: - return NO_GOTPLT_ENTRY; - - /* The following relocs wouldn't normally need GOT or PLT - slots, but we need them for simplicity in the link - editor part. See our caller for comments. */ - case R_X86_64_32: - case R_X86_64_32S: - case R_X86_64_64: - case R_X86_64_PC32: - case R_X86_64_PC64: - return AUTO_GOTPLT_ENTRY; - - case R_X86_64_GOTTPOFF: - return BUILD_GOT_ONLY; - - case R_X86_64_GOT32: - case R_X86_64_GOT64: - case R_X86_64_GOTPC32: - case R_X86_64_GOTPC64: - case R_X86_64_GOTOFF64: - case R_X86_64_GOTPCREL: - case R_X86_64_GOTPCRELX: - case R_X86_64_TLSGD: - case R_X86_64_TLSLD: - case R_X86_64_DTPOFF32: - case R_X86_64_TPOFF32: - case R_X86_64_DTPOFF64: - case R_X86_64_TPOFF64: - case R_X86_64_REX_GOTPCRELX: - case R_X86_64_PLT32: - case R_X86_64_PLTOFF64: - return ALWAYS_GOTPLT_ENTRY; - } - - return -1; -} - -#ifdef NEED_BUILD_GOT -ST_FUNC unsigned create_plt_entry(TCCState *s1, unsigned got_offset, struct sym_attr *attr) -{ - Section *plt = s1->plt; - uint8_t *p; - int modrm; - unsigned plt_offset, relofs; - - modrm = 0x25; - - /* empty PLT: create PLT0 entry that pushes the library identifier - (GOT + PTR_SIZE) and jumps to ld.so resolution routine - (GOT + 2 * PTR_SIZE) */ - if (plt->data_offset == 0) { - p = section_ptr_add(plt, 16); - p[0] = 0xff; /* pushl got + PTR_SIZE */ - p[1] = modrm + 0x10; - write32le(p + 2, PTR_SIZE); - p[6] = 0xff; /* jmp *(got + PTR_SIZE * 2) */ - p[7] = modrm; - write32le(p + 8, PTR_SIZE * 2); - } - plt_offset = plt->data_offset; - - /* The PLT slot refers to the relocation entry it needs via offset. - The reloc entry is created below, so its offset is the current - data_offset */ - relofs = s1->plt->reloc ? s1->plt->reloc->data_offset : 0; - - /* Jump to GOT entry where ld.so initially put the address of ip + 4 */ - p = section_ptr_add(plt, 16); - p[0] = 0xff; /* jmp *(got + x) */ - p[1] = modrm; - write32le(p + 2, got_offset); - p[6] = 0x68; /* push $xxx */ - /* On x86-64, the relocation is referred to by _index_ */ - write32le(p + 7, relofs / sizeof (ElfW_Rel) - 1); - p[11] = 0xe9; /* jmp plt_start */ - write32le(p + 12, -(plt->data_offset)); - return plt_offset; -} - -/* relocate the PLT: compute addresses and offsets in the PLT now that final - address for PLT and GOT are known (see fill_program_header) */ -ST_FUNC void relocate_plt(TCCState *s1) -{ - uint8_t *p, *p_end; - - if (!s1->plt) - return; - - p = s1->plt->data; - p_end = p + s1->plt->data_offset; - - if (p < p_end) { - int x = s1->got->sh_addr - s1->plt->sh_addr - 6; - add32le(p + 2, x); - add32le(p + 8, x - 6); - p += 16; - while (p < p_end) { - add32le(p + 2, x + (s1->plt->data - p)); - p += 16; - } - } - - if (s1->plt->reloc) { - ElfW_Rel *rel; - int x = s1->plt->sh_addr + 16 + 6; - p = s1->got->data; - for_each_elem(s1->plt->reloc, 0, rel, ElfW_Rel) { - write64le(p + rel->r_offset, x); - x += 16; - } - } -} -#endif -#endif - -ST_FUNC void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t addr, addr_t val) -{ - int sym_index, esym_index; - - sym_index = ELFW(R_SYM)(rel->r_info); - - switch (type) { - case R_X86_64_64: - if (s1->output_type & TCC_OUTPUT_DYN) { - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - qrel->r_offset = rel->r_offset; - if (esym_index) { - qrel->r_info = ELFW(R_INFO)(esym_index, R_X86_64_64); - qrel->r_addend = rel->r_addend; - qrel++; - break; - } else { - qrel->r_info = ELFW(R_INFO)(0, R_X86_64_RELATIVE); - qrel->r_addend = read64le(ptr) + val; - qrel++; - } - } - add64le(ptr, val); - break; - case R_X86_64_32: - case R_X86_64_32S: - if (s1->output_type & TCC_OUTPUT_DYN) { - /* XXX: this logic may depend on TCC's codegen - now TCC uses R_X86_64_32 even for a 64bit pointer */ - qrel->r_offset = rel->r_offset; - qrel->r_info = ELFW(R_INFO)(0, R_X86_64_RELATIVE); - /* Use sign extension! */ - qrel->r_addend = (int)read32le(ptr) + val; - qrel++; - } - add32le(ptr, val); - break; - - case R_X86_64_PC32: - if (s1->output_type == TCC_OUTPUT_DLL) { - /* DLL relocation */ - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - if (esym_index) { - qrel->r_offset = rel->r_offset; - qrel->r_info = ELFW(R_INFO)(esym_index, R_X86_64_PC32); - /* Use sign extension! */ - qrel->r_addend = (int)read32le(ptr) + rel->r_addend; - qrel++; - break; - } - } - goto plt32pc32; - - case R_X86_64_PLT32: - /* fallthrough: val already holds the PLT slot address */ - - plt32pc32: - { - long long diff; - diff = (long long)val - addr; - if (diff < -2147483648LL || diff > 2147483647LL) { -#ifdef TCC_TARGET_PE - /* ignore overflow with undefined weak symbols */ - if (((ElfW(Sym)*)symtab_section->data)[sym_index].st_shndx != SHN_UNDEF) -#endif - tcc_error_noabort("internal error: relocation failed"); - } - add32le(ptr, diff); - } - break; - - case R_X86_64_COPY: - break; - - case R_X86_64_PLTOFF64: - add64le(ptr, val - s1->got->sh_addr + rel->r_addend); - break; - - case R_X86_64_PC64: - if (s1->output_type == TCC_OUTPUT_DLL) { - /* DLL relocation */ - esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index; - if (esym_index) { - qrel->r_offset = rel->r_offset; - qrel->r_info = ELFW(R_INFO)(esym_index, R_X86_64_PC64); - qrel->r_addend = read64le(ptr) + rel->r_addend; - qrel++; - break; - } - } - add64le(ptr, val - addr); - break; - - case R_X86_64_GLOB_DAT: - case R_X86_64_JUMP_SLOT: - /* They don't need addend */ - write64le(ptr, val - rel->r_addend); - break; - case R_X86_64_GOTPCREL: - case R_X86_64_GOTPCRELX: - case R_X86_64_REX_GOTPCRELX: - add32le(ptr, s1->got->sh_addr - addr + - get_sym_attr(s1, sym_index, 0)->got_offset - 4); - break; - case R_X86_64_GOTPC32: - add32le(ptr, s1->got->sh_addr - addr + rel->r_addend); - break; - case R_X86_64_GOTPC64: - add64le(ptr, s1->got->sh_addr - addr + rel->r_addend); - break; - case R_X86_64_GOTTPOFF: - add32le(ptr, val - s1->got->sh_addr); - break; - case R_X86_64_GOT32: - /* we load the got offset */ - add32le(ptr, get_sym_attr(s1, sym_index, 0)->got_offset); - break; - case R_X86_64_GOT64: - /* we load the got offset */ - add64le(ptr, get_sym_attr(s1, sym_index, 0)->got_offset); - break; - case R_X86_64_GOTOFF64: - add64le(ptr, val - s1->got->sh_addr); - break; - case R_X86_64_TLSGD: - { - static const unsigned char expect[] = { - /* .byte 0x66; lea 0(%rip),%rdi */ - 0x66, 0x48, 0x8d, 0x3d, 0x00, 0x00, 0x00, 0x00, - /* .word 0x6666; rex64; call __tls_get_addr@PLT */ - 0x66, 0x66, 0x48, 0xe8, 0x00, 0x00, 0x00, 0x00 }; - static const unsigned char replace[] = { - /* mov %fs:0,%rax */ - 0x64, 0x48, 0x8b, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00, - /* lea -4(%rax),%rax */ - 0x48, 0x8d, 0x80, 0x00, 0x00, 0x00, 0x00 }; - - if (memcmp (ptr-4, expect, sizeof(expect)) == 0) { - ElfW(Sym) *sym; - Section *sec; - int32_t x; - - memcpy(ptr-4, replace, sizeof(replace)); - rel[1].r_info = ELFW(R_INFO)(0, R_X86_64_NONE); - sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; - sec = s1->sections[sym->st_shndx]; - x = sym->st_value - sec->sh_addr - sec->data_offset; - add32le(ptr + 8, x); - } - else - tcc_error_noabort("unexpected R_X86_64_TLSGD pattern"); - } - break; - case R_X86_64_TLSLD: - { - static const unsigned char expect[] = { - /* lea 0(%rip),%rdi */ - 0x48, 0x8d, 0x3d, 0x00, 0x00, 0x00, 0x00, - /* call __tls_get_addr@PLT */ - 0xe8, 0x00, 0x00, 0x00, 0x00 }; - static const unsigned char replace[] = { - /* data16 data16 data16 mov %fs:0,%rax */ - 0x66, 0x66, 0x66, 0x64, 0x48, 0x8b, 0x04, 0x25, - 0x00, 0x00, 0x00, 0x00 }; - - if (memcmp (ptr-3, expect, sizeof(expect)) == 0) { - memcpy(ptr-3, replace, sizeof(replace)); - rel[1].r_info = ELFW(R_INFO)(0, R_X86_64_NONE); - } - else - tcc_error_noabort("unexpected R_X86_64_TLSLD pattern"); - } - break; - case R_X86_64_DTPOFF32: - case R_X86_64_TPOFF32: - { - ElfW(Sym) *sym; - Section *sec; - int32_t x; - - sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; - sec = s1->sections[sym->st_shndx]; - x = val - sec->sh_addr - sec->data_offset; - add32le(ptr, x); - } - break; - case R_X86_64_DTPOFF64: - case R_X86_64_TPOFF64: - { - ElfW(Sym) *sym; - Section *sec; - int32_t x; - - sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; - sec = s1->sections[sym->st_shndx]; - x = val - sec->sh_addr - sec->data_offset; - add64le(ptr, x); - } - break; - case R_X86_64_NONE: - break; - case R_X86_64_RELATIVE: -#ifdef TCC_TARGET_PE - add32le(ptr, val - s1->pe_imagebase); -#endif - /* do nothing */ - break; - default: - fprintf(stderr,"FIXME: handle reloc type %d at %x [%p] to %x\n", - type, (unsigned)addr, ptr, (unsigned)val); - break; - } -} - -#endif /* !TARGET_DEFS_ONLY */