├── COPYING ├── README.md ├── arcfw ├── Makefile ├── baselibc │ ├── LICENSE │ ├── Makefile │ ├── README.md │ ├── include │ │ ├── assert.h │ │ ├── ctype.h │ │ ├── dirent.h │ │ ├── errno.h │ │ ├── fcntl.h │ │ ├── inttypes.h │ │ ├── klibc │ │ │ ├── extern.h │ │ │ └── inline.h │ │ ├── pthread.h │ │ ├── stdio.h │ │ ├── stdlib.h │ │ ├── string.h │ │ ├── sys │ │ │ ├── stat.h │ │ │ ├── time.h │ │ │ └── types.h │ │ └── unistd.h │ ├── src │ │ ├── asprintf.c │ │ ├── atoi.c │ │ ├── atol.c │ │ ├── atoll.c │ │ ├── bsearch.c │ │ ├── bzero.c │ │ ├── calloc.c │ │ ├── fgets.c │ │ ├── gettimeofday.c │ │ ├── inline.c │ │ ├── jrand48.c │ │ ├── lrand48.c │ │ ├── malloc.c │ │ ├── malloc.h │ │ ├── memccpy.c │ │ ├── memchr.c │ │ ├── memcmp.c │ │ ├── memcpy.c │ │ ├── memfile.c │ │ ├── memmem.c │ │ ├── memmove.c │ │ ├── memrchr.c │ │ ├── memset.c │ │ ├── memswap.c │ │ ├── mrand48.c │ │ ├── nrand48.c │ │ ├── qsort.c │ │ ├── realloc.c │ │ ├── sprintf.c │ │ ├── srand48.c │ │ ├── sscanf.c │ │ ├── strcasecmp.c │ │ ├── strcat.c │ │ ├── strchr.c │ │ ├── strcmp.c │ │ ├── strcpy.c │ │ ├── strcspn.c │ │ ├── strdup.c │ │ ├── strlcat.c │ │ ├── strlcpy.c │ │ ├── strlen.c │ │ ├── strncasecmp.c │ │ ├── strncat.c │ │ ├── strncmp.c │ │ ├── strncpy.c │ │ ├── strndup.c │ │ ├── strnlen.c │ │ ├── strntoimax.c │ │ ├── strntoumax.c │ │ ├── strpbrk.c │ │ ├── strrchr.c │ │ ├── strsep.c │ │ ├── strspn.c │ │ ├── strstr.c │ │ ├── strtoimax.c │ │ ├── strtok.c │ │ ├── strtok_r.c │ │ ├── strtol.c │ │ ├── strtoll.c │ │ ├── strtoul.c │ │ ├── strtoull.c │ │ ├── strtoumax.c │ │ ├── templates │ │ │ ├── atox.c │ │ │ └── strtox.c │ │ ├── tinyprintf.c │ │ ├── vasprintf.c │ │ ├── vprintf.c │ │ ├── vsprintf.c │ │ └── vsscanf.c │ └── tests │ │ ├── .printf_tests.c~ │ │ ├── .tests_glue.c~ │ │ ├── printf_tests.c │ │ ├── tests_glue.c │ │ └── unittests.h ├── gccle │ └── dummy ├── of.ld └── source │ ├── arc.h │ ├── arcconfig.c │ ├── arcconfig.h │ ├── arcconsole.c │ ├── arcconsole.h │ ├── arcdevice.h │ ├── arcdisk.c │ ├── arcdisk.h │ ├── arcenv.c │ ├── arcenv.h │ ├── arcfs.c │ ├── arcfs.h │ ├── arcinvoke.S │ ├── arcio.c │ ├── arcio.h │ ├── arcload.c │ ├── arcload.h │ ├── arcmem.c │ ├── arcmem.h │ ├── arcterm.c │ ├── arcterm.h │ ├── arctime.c │ ├── arctime.h │ ├── asm.h │ ├── attrdef.inc │ ├── cache.S │ ├── coff.h │ ├── console_font_8x16.c │ ├── context.h │ ├── cpplib.h │ ├── crt0.S │ ├── crtresxgpr.S │ ├── crtsavgpr.S │ ├── diskio.h │ ├── exhandler.c │ ├── exhandler_low.S │ ├── exi.c │ ├── exi.h │ ├── exi_ide.c │ ├── exi_ide.h │ ├── exi_sdmc.c │ ├── exi_sdmc.h │ ├── fatfs │ ├── diskio.c │ ├── diskio.h │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ ├── ffsystem.c │ └── ffunicode.c │ ├── floatctx.S │ ├── fwsetup.c │ ├── getstr.c │ ├── getstr.h │ ├── hwdesc.h │ ├── ios_sdmc.c │ ├── ios_sdmc.h │ ├── ios_usb.c │ ├── ios_usb.h │ ├── ios_usb_kbd.c │ ├── ios_usb_kbd.h │ ├── ios_usb_ms.c │ ├── ios_usb_ms.h │ ├── kbd_high.c │ ├── kbd_high.h │ ├── lib9660.c │ ├── lib9660.h │ ├── main.c │ ├── ntfsboot.inc │ ├── ntfsboot4.inc │ ├── ntfsmft.inc │ ├── ntfsroot.inc │ ├── ntio.h │ ├── oslhooks.c │ ├── oslhooks.h │ ├── pff.c │ ├── pff.h │ ├── pffconf.h │ ├── ppc-asm.h │ ├── ppchook.c │ ├── ppchook.h │ ├── ppcinst.h │ ├── printf.c │ ├── printf.h │ ├── processor.h │ ├── pxi.c │ ├── pxi.h │ ├── pxiheap.c │ ├── pxiheap.h │ ├── runtime.h │ ├── si.c │ ├── si.h │ ├── si_kbd.c │ ├── si_kbd.h │ ├── timer.c │ ├── timer.h │ ├── timer_asm.S │ ├── types.h │ └── ucs2tbl.inc ├── arcldr ├── Makefile.gc ├── Makefile.wii ├── ppc_race_payload │ ├── build.txt │ ├── payload.c │ └── payload.ld └── source │ ├── arc.h │ ├── asm.h │ ├── ata.c │ ├── ata.h │ ├── elf_abi.h │ ├── hwdesc.h │ ├── main.c │ ├── modeswitch.S │ ├── ppc_race_payload.inc │ └── types.h ├── cafegx2drv ├── Makefile └── source │ ├── cafegx2.c │ └── cafegx2.rc ├── fpexiblkdrv ├── Makefile └── source │ ├── arith64.c │ ├── diskio.c │ ├── diskio.h │ ├── entry.c │ ├── exi_ide.c │ ├── exi_ide.h │ ├── exi_map.c │ ├── exi_map.h │ ├── exi_sdmc.c │ ├── exi_sdmc.h │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ ├── ffsystem.c │ ├── ffunicode.c │ └── fpexiblk.rc ├── fpgx35dll ├── Makefile └── source │ ├── color.c │ ├── dci.c │ ├── debug.c │ ├── debug.h │ ├── draw.c │ ├── driver.h │ ├── enable.c │ ├── escape.c │ ├── fpvigx.def │ ├── fpvigx.rc │ ├── palette.c │ ├── pattern.c │ ├── pointer.c │ ├── screen.c │ └── winddi.h ├── fpsidrv ├── Makefile └── source │ ├── entry.c │ ├── fpsi.rc │ ├── keyboard.c │ ├── keyboard.h │ ├── mouse.c │ ├── mouse.h │ ├── si.c │ ├── si.h │ ├── sihid.c │ └── sireg.h ├── fpvigxdll ├── Makefile └── source │ ├── color.c │ ├── ddraw.c │ ├── debug.c │ ├── debug.h │ ├── draw.c │ ├── driver.h │ ├── enable.c │ ├── fpvigx.rc │ ├── palette.c │ ├── pointer.c │ └── screen.c ├── fpvigxdrv ├── Makefile └── source │ ├── cp.h │ ├── efb.h │ ├── fpvigx.c │ ├── fpvigx.rc │ ├── ioctl.h │ └── vi.h ├── halartx ├── Makefile └── source │ ├── arccalls.c │ ├── bat.s │ ├── beep.c │ ├── branchstub.s │ ├── bushnd.c │ ├── cache.s │ ├── clock.c │ ├── display.c │ ├── drivesup.c │ ├── exi.c │ ├── exi.h │ ├── exilock.c │ ├── flushbuf.s │ ├── flushio.c │ ├── getexport.c │ ├── hal.def │ ├── hal.rc │ ├── halasm.h │ ├── halp.h │ ├── halpsys.h │ ├── hpt.c │ ├── hwsup.c │ ├── idle.s │ ├── init.c │ ├── ints.c │ ├── ints.h │ ├── ints.inc │ ├── ios.h │ ├── ioserr.inc │ ├── iosp.h │ ├── irql.c │ ├── kd.c │ ├── ldrhook.c │ ├── lowmem.c │ ├── map.c │ ├── nthal.h │ ├── peimage.h │ ├── ppcinst.h │ ├── procreset.s │ ├── procs.c │ ├── profile.c │ ├── pxi.c │ ├── pxi_regs.h │ ├── pxiheap.c │ ├── pxiheap.h │ ├── rtc.c │ ├── stall.s │ └── x86bios.c ├── inc ├── backport.h ├── exiapi.h ├── hwdesc.h ├── iosapi.h ├── runtime.h ├── texdraw.h └── zwdd.h ├── iossdmcdrv ├── Makefile └── source │ ├── arith64.c │ ├── diskio.c │ ├── diskio.h │ ├── entry.c │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ ├── ffsystem.c │ ├── ffunicode.c │ ├── iossdmc.rc │ ├── sdmc.c │ ├── sdmc.h │ └── sdmcraw.h ├── iosusbdrv ├── Makefile └── source │ ├── asynctimer.c │ ├── asynctimer.h │ ├── entry.c │ ├── iosusb.rc │ ├── iosusbkbd.h │ ├── iosusblow.h │ ├── keyboard.c │ ├── keyboard.h │ ├── mouse.c │ ├── mouse.h │ ├── usbkbd.c │ ├── usbkbd.h │ ├── usblow.c │ ├── usblow.h │ ├── usblowkbd.c │ ├── usblowkbd.h │ ├── usblowmou.c │ ├── usblowmou.h │ ├── usblowms.c │ ├── usblowms.h │ └── usbms.h ├── lib └── dummy ├── msvc-ppc └── bin │ ├── c1_ppc.dll │ ├── clppc.exe │ ├── cvtres.err │ ├── cvtres.exe │ ├── lib.exe │ ├── link.exe │ ├── mspdb40.dll │ ├── mspdb41.dll │ ├── mspdb50.dll │ ├── mspdb60.dll │ ├── pasm.exe │ ├── rc.exe │ ├── rc.hlp │ ├── rcdll.dll │ ├── rcxdti.dll │ └── splitsym.exe ├── nt4 ├── crt │ ├── assert.h │ ├── conio.h │ ├── crtdbg.h │ ├── ctype.h │ ├── direct.h │ ├── dos.h │ ├── eh.h │ ├── errno.h │ ├── excpt.h │ ├── fcntl.h │ ├── float.h │ ├── fpieee.h │ ├── fstream.h │ ├── io.h │ ├── iomanip.h │ ├── ios.h │ ├── iostream.h │ ├── istream.h │ ├── limits.h │ ├── locale.h │ ├── malloc.h │ ├── math.h │ ├── mbctype.h │ ├── mbstring.h │ ├── memory.h │ ├── new.h │ ├── ostream.h │ ├── process.h │ ├── search.h │ ├── setjmp.h │ ├── setjmpex.h │ ├── share.h │ ├── signal.h │ ├── stdarg.h │ ├── stddef.h │ ├── stdexcpt.h │ ├── stdio.h │ ├── stdiostr.h │ ├── stdlib.h │ ├── streamb.h │ ├── string.h │ ├── strstrea.h │ ├── sys │ │ ├── locking.h │ │ ├── stat.h │ │ ├── timeb.h │ │ ├── types.h │ │ └── utime.h │ ├── tchar.h │ ├── time.h │ ├── typeinfo.h │ ├── varargs.h │ ├── wchar.h │ └── wcstr.h ├── ddk │ ├── afilter.h │ ├── alphamk.inc │ ├── alpharef.h │ ├── bugcodes.h │ ├── callconv.inc │ ├── cfg.h │ ├── cfgmgr32.h │ ├── class.h │ ├── class2.h │ ├── common.ver │ ├── compstui.h │ ├── dciddi.h │ ├── dciman.h │ ├── dderror.h │ ├── ddrawint.h │ ├── device.h │ ├── devioctl.h │ ├── efilter.h │ ├── exlevels.h │ ├── fareast │ │ └── jpn │ │ │ └── ntdddisk.h │ ├── ffilter.h │ ├── flpyenbl.h │ ├── gdispool.h │ ├── i386mk.inc │ ├── ioaccess.h │ ├── isdn.h │ ├── isvbop.h │ ├── isvbop.inc │ ├── isvwow.h │ ├── jazzdef.h │ ├── jazzdma.h │ ├── kbd.h │ ├── kbdmou.h │ ├── makefile.def │ ├── makefile.plt │ ├── mapfile.h │ ├── mcdrv.h │ ├── media.h │ ├── mindrvrc.h │ ├── miniport.h │ ├── minitape.h │ ├── mipsmk.inc │ ├── mmddk.h │ ├── msacmdrv.h │ ├── msviddrv.h │ ├── mtf.h │ ├── mvaudio.h │ ├── ndis.h │ ├── ndistapi.h │ ├── ndiswan.h │ ├── netevent.h │ ├── nettypes.h │ ├── npapi.h │ ├── nspapip.h │ ├── nt_vdd.h │ ├── ntddaux.h │ ├── ntddbeep.h │ ├── ntddcdrm.h │ ├── ntdddisk.h │ ├── ntddft.h │ ├── ntddk.h │ ├── ntddkbd.h │ ├── ntddmidi.h │ ├── ntddmix.h │ ├── ntddmou.h │ ├── ntddndis.h │ ├── ntddpar.h │ ├── ntddscsi.h │ ├── ntddser.h │ ├── ntddsnd.h │ ├── ntddstor.h │ ├── ntddtape.h │ ├── ntddtdi.h │ ├── ntddvdeo.h │ ├── ntddwave.h │ ├── ntdef.h │ ├── ntdskreg.h │ ├── ntiologc.h │ ├── ntmindrv.h │ ├── ntpoapi.h │ ├── ntsecapi.h │ ├── ntstatus.h │ ├── ntverp.h │ ├── packoff.h │ ├── packon.h │ ├── parallel.h │ ├── physlogi.h │ ├── ppcmk.inc │ ├── rasman.h │ ├── rx.h │ ├── scsi.h │ ├── soundcfg.h │ ├── soundsys.h │ ├── splcom.h │ ├── spllib.hxx │ ├── srb.h │ ├── stdcall.inc │ ├── synth.h │ ├── tape.h │ ├── tdi.h │ ├── tdiinfo.h │ ├── tdikrnl.h │ ├── tfilter.h │ ├── vddsvc.h │ ├── verinfo.h │ ├── verinfo.ver │ ├── video.h │ ├── vkoem.h │ ├── warning.h │ ├── winddi.h │ ├── winddiui.h │ ├── winfont.h │ ├── winnetp.h │ ├── winsplp.h │ └── wsahelp.h ├── hal │ ├── arc.h │ ├── arccodes.h │ ├── hal.h │ ├── hal386.inc │ ├── halalpha.h │ ├── halmips.h │ ├── halppc.h │ ├── ntkeapi.h │ ├── ntpoapi.h │ └── ppcdef.h └── sdk │ ├── accctrl.h │ ├── aclapi.h │ ├── alphaops.h │ ├── atalkwsh.h │ ├── basetyps.h │ ├── callconv.inc │ ├── cderr.h │ ├── cguid.h │ ├── color.dlg │ ├── colordlg.h │ ├── commctrl.h │ ├── commdlg.h │ ├── compobj.h │ ├── cpl.h │ ├── custcntl.h │ ├── d3d.h │ ├── d3dcaps.h │ ├── d3drm.h │ ├── d3drmdef.h │ ├── d3drmobj.h │ ├── d3drmwin.h │ ├── d3dtypes.h │ ├── dde.h │ ├── ddeml.h │ ├── ddraw.h │ ├── digitalv.h │ ├── dispatch.h │ ├── dlcapi.h │ ├── dlgs.h │ ├── dplay.h │ ├── dsound.h │ ├── dvobj.h │ ├── error.h │ ├── exchext.h │ ├── exchform.h │ ├── fareast │ ├── wingdi.h │ ├── winioctl.h │ └── winuser.h │ ├── fileopen.dlg │ ├── findtext.dlg │ ├── font.dlg │ ├── ftsiface.h │ ├── gl.h │ ├── glaux.h │ ├── glu.h │ ├── httpext.h │ ├── httpfilt.h │ ├── imagehlp.h │ ├── ime.h │ ├── imessage.h │ ├── imm.h │ ├── initguid.h │ ├── initoid.h │ ├── kxalpha.h │ ├── kxmips.h │ ├── kxppc.h │ ├── lm.h │ ├── lmaccess.h │ ├── lmalert.h │ ├── lmapibuf.h │ ├── lmat.h │ ├── lmaudit.h │ ├── lmbrowsr.h │ ├── lmchdev.h │ ├── lmconfig.h │ ├── lmcons.h │ ├── lmerr.h │ ├── lmerrlog.h │ ├── lmmsg.h │ ├── lmremutl.h │ ├── lmrepl.h │ ├── lmserver.h │ ├── lmshare.h │ ├── lmsname.h │ ├── lmstats.h │ ├── lmsvc.h │ ├── lmuse.h │ ├── lmuseflg.h │ ├── lmwksta.h │ ├── loadperf.h │ ├── lsapi.h │ ├── lzexpand.h │ ├── mapi.h │ ├── mapicode.h │ ├── mapidbg.h │ ├── mapidefs.h │ ├── mapiform.h │ ├── mapiguid.h │ ├── mapihook.h │ ├── mapinls.h │ ├── mapioid.h │ ├── mapispi.h │ ├── mapitags.h │ ├── mapiutil.h │ ├── mapival.h │ ├── mapiwin.h │ ├── mapiwz.h │ ├── mapix.h │ ├── mciavi.h │ ├── mcx.h │ ├── mgmtapi.h │ ├── midles.h │ ├── mmreg.h │ ├── mmsystem.h │ ├── moniker.h │ ├── msacm.h │ ├── msacmdlg.dlg │ ├── msacmdlg.h │ ├── msfs.h │ ├── mspab.h │ ├── mspst.h │ ├── mswsock.h │ ├── nb30.h │ ├── nddeapi.h │ ├── nddesec.h │ ├── nspapi.h │ ├── ntsdexts.h │ ├── ntwin32.mak │ ├── oaidl.h │ ├── oaidl.idl │ ├── objbase.h │ ├── objerror.h │ ├── objidl.h │ ├── objidl.idl │ ├── ocidl.h │ ├── ocidl.idl │ ├── ole.h │ ├── ole2.h │ ├── ole2ver.h │ ├── oleauto.h │ ├── olectl.h │ ├── olectlid.h │ ├── oledlg.h │ ├── oleidl.h │ ├── oleidl.idl │ ├── pdh.h │ ├── pdhmsg.h │ ├── poppack.h │ ├── prnsetup.dlg │ ├── prsht.h │ ├── pshpack1.h │ ├── pshpack2.h │ ├── pshpack4.h │ ├── pshpack8.h │ ├── ras.h │ ├── rasdlg.h │ ├── raserror.h │ ├── rassapi.h │ ├── rasshost.h │ ├── recguids.h │ ├── reconcil.h │ ├── regstr.h │ ├── richedit.h │ ├── richole.h │ ├── rpc.h │ ├── rpcdce.h │ ├── rpcdcep.h │ ├── rpcndr.h │ ├── rpcnsi.h │ ├── rpcnsip.h │ ├── rpcnterr.h │ ├── rpcproxy.h │ ├── scode.h │ ├── scrnsave.h │ ├── sehmap.h │ ├── setupapi.h │ ├── shellapi.h │ ├── shlguid.h │ ├── shlobj.h │ ├── smpab.h │ ├── smpms.h │ ├── smpxp.h │ ├── snmp.h │ ├── sporder.h │ ├── storage.h │ ├── svcguid.h │ ├── tapi.h │ ├── tnef.h │ ├── tspi.h │ ├── unknwn.h │ ├── unknwn.idl │ ├── variant.h │ ├── vdmdbg.h │ ├── vfw.h │ ├── w32chico.mk │ ├── wdbgexts.h │ ├── wfext.h │ ├── win32.mak │ ├── winbase.h │ ├── wincon.h │ ├── wincrypt.h │ ├── windef.h │ ├── windows.h │ ├── windowsx.h │ ├── winerror.h │ ├── wingdi.h │ ├── winioctl.h │ ├── winnetwk.h │ ├── winnls.h │ ├── winnls32.h │ ├── winnt.h │ ├── winperf.h │ ├── winreg.h │ ├── winresrc.h │ ├── winsock.h │ ├── winsock2.h │ ├── winspool.h │ ├── winsvc.h │ ├── wintrust.h │ ├── winuser.h │ ├── winver.h │ ├── winwlx.h │ ├── wownt16.h │ ├── wownt32.h │ ├── ws2atm.h │ ├── ws2spi.h │ ├── ws2tcpip.h │ ├── wshisotp.h │ ├── wsipx.h │ ├── wsnetbs.h │ ├── wsnwlink.h │ ├── wsvns.h │ ├── wtypes.h │ ├── wtypes.idl │ ├── xcmc.h │ ├── xcmcext.h │ ├── xcmcmsx2.h │ └── xcmcmsxt.h └── pe_rules /arcfw/baselibc/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ifeq ($(strip $(DEVKITPPC)),) 3 | $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") 4 | endif 5 | 6 | # You can override the CFLAGS and C compiler externally, 7 | # e.g. make PLATFORM=cortex-m3 8 | CFLAGS += -g -Os -Wall -Werror -I include -DBASELIBC_INTERNAL -DWITH_MALLOC -DWITH_STDIO -DPRINTF_LONG_SUPPORT 9 | 10 | PLATFORM ?= ppc 11 | 12 | ifeq ($(PLATFORM),cortex-m3) 13 | CFLAGS += -fno-common -Os 14 | CC = arm-none-eabi-gcc 15 | AR = arm-none-eabi-ar 16 | CFLAGS += -mcpu=cortex-m3 -mthumb 17 | endif 18 | ifeq ($(PLATFORM),mipsel) 19 | CC = ../2019.02-05/bin/mips-img-elf-gcc 20 | AR = ../2019.02-05/bin/mips-img-elf-gcc-ar 21 | CFLAGS += -G0 -mno-gpopt -march=r4000 -Os -mel -mgp32 -mfp32 -mabi=32 22 | endif 23 | ifeq ($(PLATFORM),ppc) 24 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc 25 | AR = $(DEVKITPPC)/bin/powerpc-eabi-gcc-ar 26 | CFLAGS += -mcpu=750 -m32 -mhard-float -mno-eabi -mno-sdata -mlittle 27 | endif 28 | 29 | # With this, the makefile should work on Windows also. 30 | ifdef windir 31 | RM = del 32 | endif 33 | 34 | # Just include all the source files in the build. 35 | CSRC = $(wildcard src/*.c) 36 | OBJS = $(CSRC:.c=.o) 37 | 38 | # And the files for the test suite 39 | TESTS_CSRC = $(wildcard tests/*_tests.c) 40 | TESTS_OBJS = $(TESTS_CSRC:.c=) 41 | 42 | # Some of the files uses "templates", i.e. common pieces 43 | # of code included from multiple files. 44 | CFLAGS += -Isrc/templates 45 | 46 | all: libcbase.a 47 | 48 | clean: 49 | $(RM) $(OBJS) $(TESTS_OBJS) libcbase.a 50 | 51 | libcbase.a: $(OBJS) 52 | $(RM) $@ 53 | $(AR) ru $@ $^ 54 | 55 | run_tests: $(TESTS_OBJS) 56 | $(foreach f,$^,$f) 57 | 58 | tests/%: tests/%.c tests/tests_glue.c libcbase.a 59 | $(CC) $(CFLAGS) -o $@ $^ 60 | 61 | %.o: %.c 62 | $(CC) $(CFLAGS) -c -o $@ $< 63 | -------------------------------------------------------------------------------- /arcfw/baselibc/README.md: -------------------------------------------------------------------------------- 1 | Baselibc 2 | ======== 3 | This is a very simple libc for embedded systems. Mainly geared for 32-bit microcontrollers in the 10-100kB memory range. 4 | The library compiles to less than 5kB total on Cortex-M3, and much less if some functions aren't used. 5 | 6 | The code is based on klibc and tinyprintf modules, and licensed under the BSD license. 7 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * assert.h 3 | */ 4 | 5 | #ifndef _ASSERT_H 6 | #define _ASSERT_H 7 | 8 | #ifdef NDEBUG 9 | 10 | /* 11 | * NDEBUG doesn't just suppress the faulting behavior of assert(), 12 | * but also all side effects of the assert() argument. This behavior 13 | * is required by the C standard, and allows the argument to reference 14 | * variables that are not defined without NDEBUG. 15 | */ 16 | #define assert(x) ((void)(0)) 17 | 18 | #else 19 | 20 | extern void __assert_fail(const char *, const char *, unsigned int); 21 | 22 | #define assert(x) ((x) ? (void)0 : __assert_fail(#x, __FILE__, __LINE__)) 23 | 24 | #endif 25 | 26 | #endif /* _ASSERT_H */ 27 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/ctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ctype.h 3 | * 4 | * This assumes ASCII. 5 | */ 6 | 7 | #ifndef _CTYPE_H 8 | #define _CTYPE_H 9 | 10 | #include 11 | #include 12 | 13 | __extern_inline int isupper(int __c) 14 | { 15 | return __c >= 'A' && __c <= 'Z'; 16 | } 17 | 18 | __extern_inline int islower(int __c) 19 | { 20 | return __c >= 'a' && __c <= 'z'; 21 | } 22 | 23 | __extern_inline int isalpha(int __c) 24 | { 25 | return islower(__c) || isupper(__c); 26 | } 27 | 28 | __extern_inline int isdigit(int __c) 29 | { 30 | return ((unsigned)__c - '0') <= 9; 31 | } 32 | 33 | __extern_inline int isalnum(int __c) 34 | { 35 | return isalpha(__c) || isdigit(__c); 36 | } 37 | 38 | __extern_inline int isascii(int __c) 39 | { 40 | return !(__c & ~0x7f); 41 | } 42 | 43 | __extern_inline int isblank(int __c) 44 | { 45 | return (__c == '\t') || (__c == ' '); 46 | } 47 | 48 | __extern_inline int iscntrl(int __c) 49 | { 50 | return __c < 0x20; 51 | } 52 | 53 | __extern_inline int isspace(int __c) 54 | { 55 | return __c == ' ' || __c == '\n' || __c == '\t' || __c == '\r'; 56 | } 57 | 58 | __extern_inline int isxdigit(int __c) 59 | { 60 | return isdigit(__c) || (__c >= 'a' && __c <= 'f') || (__c >= 'A' && __c <= 'F'); 61 | } 62 | 63 | __extern_inline int toupper(int __c) 64 | { 65 | return islower(__c) ? (__c & ~32) : __c; 66 | } 67 | 68 | __extern_inline int tolower(int __c) 69 | { 70 | return isupper(__c) ? (__c | 32) : __c; 71 | } 72 | 73 | #endif /* _CTYPE_H */ 74 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/dirent.h: -------------------------------------------------------------------------------- 1 | struct dirent { 2 | unsigned char _unknown_00[0xe]; 3 | unsigned char d_type; 4 | unsigned char _unknown_0f; 5 | char d_name[]; 6 | }; 7 | #define DT_DIR 0x10 8 | 9 | typedef void DIR; 10 | 11 | DIR *opendir(const char *name); 12 | struct dirent *readdir(DIR *); 13 | int closedir(DIR *); 14 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/errno.h: -------------------------------------------------------------------------------- 1 | int *__errno(void); 2 | #define errno (*__errno()) 3 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/fcntl.h: -------------------------------------------------------------------------------- 1 | #define O_RDONLY 0x0000 2 | #define O_WRONLY 0x0001 3 | #define O_CREAT 0x0200 4 | #define O_TRUNC 0x0400 5 | 6 | int open(const char *pathname, int flags, ...); 7 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/klibc/extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * klibc/extern.h 3 | */ 4 | 5 | #ifndef _KLIBC_EXTERN_H 6 | #define _KLIBC_EXTERN_H 7 | 8 | #ifdef __cplusplus 9 | #define __extern extern "C" 10 | #else 11 | #define __extern extern 12 | #endif 13 | 14 | #define __alias(x) __attribute__((weak, alias(x))) 15 | 16 | #endif /* _KLIBC_EXTERN_H */ 17 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/klibc/inline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * klibc/inline.h 3 | */ 4 | 5 | #ifndef _KLIBC_INLINE_H 6 | #define _KLIBC_INLINE_H 7 | 8 | #ifndef __extern_inline 9 | #define __extern_inline extern inline __attribute__((gnu_inline)) 10 | #endif 11 | 12 | #endif /* _KLIBC_INLINE_H */ 13 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/pthread.h: -------------------------------------------------------------------------------- 1 | typedef void* pthread_t; 2 | typedef unsigned char pthread_attr_t[0x28]; 3 | int pthread_create(pthread_t *thread, const pthread_attr_t *attr, 4 | void *(*start_routine) (void *), void *arg); 5 | int pthread_join(pthread_t thread, void **retval); 6 | int pthread_cancel(pthread_t thread); 7 | void pthread_exit(void *retval); 8 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/sys/stat.h: -------------------------------------------------------------------------------- 1 | int mkdir(const char *pathname, unsigned int mode); 2 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/sys/time.h: -------------------------------------------------------------------------------- 1 | struct timeval { 2 | unsigned int tv_sec; 3 | unsigned int tv_usec; 4 | }; 5 | 6 | int gettimeofday(struct timeval *tv, void *tz); 7 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #define SEEK_SET 0 2 | #define SEEK_CUR 1 3 | #define SEEK_END 2 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/include/unistd.h: -------------------------------------------------------------------------------- 1 | int write(int fd, const void *buf, unsigned int count); 2 | int read(int fd, void *buf, unsigned int count); 3 | int close(int fd); 4 | int stat(const char *pathname, void *buf); 5 | 6 | int usleep(int usecs); 7 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/asprintf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * asprintf.c 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int asprintf(char **bufp, const char *format, ...) 10 | { 11 | va_list ap, ap1; 12 | int rv; 13 | int bytes; 14 | char *p; 15 | 16 | va_start(ap, format); 17 | va_copy(ap1, ap); 18 | 19 | bytes = vsnprintf(NULL, 0, format, ap1) + 1; 20 | va_end(ap1); 21 | 22 | *bufp = p = malloc(bytes); 23 | if (!p) 24 | return -1; 25 | 26 | rv = vsnprintf(p, bytes, format, ap); 27 | va_end(ap); 28 | 29 | return rv; 30 | } 31 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/atoi.c: -------------------------------------------------------------------------------- 1 | #define TYPE int 2 | #define NAME atoi 3 | #include "atox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/atol.c: -------------------------------------------------------------------------------- 1 | #define TYPE long 2 | #define NAME atol 3 | #include "atox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/atoll.c: -------------------------------------------------------------------------------- 1 | #define TYPE long long 2 | #define NAME atoll 3 | #include "atox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/bsearch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * bsearch.c 3 | */ 4 | 5 | #include 6 | 7 | void *bsearch(const void *key, const void *base, size_t nmemb, 8 | size_t size, int (*cmp) (const void *, const void *)) 9 | { 10 | while (nmemb) { 11 | size_t mididx = nmemb / 2; 12 | const void *midobj = base + mididx * size; 13 | int diff = cmp(key, midobj); 14 | 15 | if (diff == 0) 16 | return (void *)midobj; 17 | 18 | if (diff > 0) { 19 | base = midobj + size; 20 | nmemb -= mididx + 1; 21 | } else 22 | nmemb = mididx; 23 | } 24 | 25 | return NULL; 26 | } 27 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/bzero.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void bzero(void *dst, size_t n) 4 | { 5 | memset(dst, 0, n); 6 | } 7 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/calloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * calloc.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | /* FIXME: This should look for multiplication overflow */ 9 | 10 | void *calloc(size_t nmemb, size_t size) 11 | { 12 | void *ptr; 13 | 14 | size *= nmemb; 15 | ptr = malloc(size); 16 | if (ptr) 17 | memset(ptr, 0, size); 18 | 19 | return ptr; 20 | } 21 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/fgets.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fgets.c 3 | * 4 | * This will be very slow due to the implementation of getc(), 5 | * but we don't have anywhere to put characters we don't need from 6 | * the input. 7 | */ 8 | 9 | #include 10 | 11 | #ifdef WITH_STDIO 12 | char *fgets(char *s, int n, FILE *f) 13 | { 14 | int ch; 15 | char *p = s; 16 | 17 | while (n > 1) { 18 | ch = getc(f); 19 | if (ch == EOF) { 20 | *p = '\0'; 21 | return NULL; 22 | } 23 | *p++ = ch; 24 | n--; 25 | if (ch == '\n') 26 | break; 27 | } 28 | if (n) 29 | *p = '\0'; 30 | 31 | return s; 32 | } 33 | #endif 34 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/gettimeofday.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int do_gettimeofday(struct timeval *tv); 4 | int gettimeofday(struct timeval *tv, void *tz) 5 | { 6 | (void)tz; 7 | return do_gettimeofday(tv); 8 | } 9 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/inline.c: -------------------------------------------------------------------------------- 1 | // Make an externally visible symbol out of inlined functions 2 | #define __extern_inline 3 | #include 4 | #include 5 | #include 6 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/jrand48.c: -------------------------------------------------------------------------------- 1 | /* 2 | * jrand48.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | long jrand48(unsigned short* xsubi) 9 | { 10 | uint64_t x; 11 | 12 | /* The xsubi[] array is littleendian by spec */ 13 | x = (uint64_t) (uint16_t) xsubi[0] + 14 | ((uint64_t) (uint16_t) xsubi[1] << 16) + 15 | ((uint64_t) (uint16_t) xsubi[2] << 32); 16 | 17 | x = (0x5deece66dULL * x) + 0xb; 18 | 19 | xsubi[0] = (unsigned short)(uint16_t) x; 20 | xsubi[1] = (unsigned short)(uint16_t) (x >> 16); 21 | xsubi[2] = (unsigned short)(uint16_t) (x >> 32); 22 | 23 | return (long)(int32_t) (x >> 16); 24 | } 25 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/lrand48.c: -------------------------------------------------------------------------------- 1 | /* 2 | * lrand48.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | extern unsigned short __rand48_seed[3]; /* Common with mrand48.c, srand48.c */ 9 | 10 | long lrand48(void) 11 | { 12 | return (uint32_t) jrand48(__rand48_seed) >> 1; 13 | } 14 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/malloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * malloc.h 3 | * 4 | * Internals for the memory allocator 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | /* 11 | * This structure should be a power of two. This becomes the 12 | * alignment unit. 13 | */ 14 | struct free_arena_header; 15 | 16 | struct arena_header { 17 | size_t type; 18 | size_t size; 19 | struct free_arena_header *next, *prev; 20 | }; 21 | 22 | #ifdef DEBUG_MALLOC 23 | #define ARENA_TYPE_USED 0x64e69c70 24 | #define ARENA_TYPE_FREE 0x012d610a 25 | #define ARENA_TYPE_HEAD 0x971676b5 26 | #define ARENA_TYPE_DEAD 0xeeeeeeee 27 | #else 28 | #define ARENA_TYPE_USED 0 29 | #define ARENA_TYPE_FREE 1 30 | #define ARENA_TYPE_HEAD 2 31 | #endif 32 | 33 | #define ARENA_SIZE_MASK (~(sizeof(struct arena_header)-1)) 34 | 35 | /* 36 | * This structure should be no more than twice the size of the 37 | * previous structure. 38 | */ 39 | struct free_arena_header { 40 | struct arena_header a; 41 | struct free_arena_header *next_free, *prev_free; 42 | }; 43 | 44 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memccpy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memccpy.c 3 | * 4 | * memccpy() 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | void *memccpy(void *dst, const void *src, int c, size_t n) 11 | { 12 | char *q = dst; 13 | const char *p = src; 14 | char ch; 15 | 16 | while (n--) { 17 | *q++ = ch = *p++; 18 | if (ch == (char)c) 19 | return q; 20 | } 21 | 22 | return NULL; /* No instance of "c" found */ 23 | } 24 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memchr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memchr.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | void *memchr(const void *s, int c, size_t n) 9 | { 10 | const unsigned char *sp = s; 11 | 12 | while (n--) { 13 | if (*sp == (unsigned char)c) 14 | return (void *)sp; 15 | sp++; 16 | } 17 | 18 | return NULL; 19 | } 20 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memcmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memcmp.c 3 | */ 4 | 5 | #include 6 | 7 | int memcmp(const void *s1, const void *s2, size_t n) 8 | { 9 | const unsigned char *c1 = s1, *c2 = s2; 10 | int d = 0; 11 | 12 | while (n--) { 13 | d = (int)*c1++ - (int)*c2++; 14 | if (d) 15 | break; 16 | } 17 | 18 | return d; 19 | } 20 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memcpy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memcpy.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | void *memcpy(void *dst, const void *src, size_t n) 9 | { 10 | const char *p = src; 11 | char *q = dst; 12 | #if defined(__i386__) 13 | size_t nl = n >> 2; 14 | asm volatile ("cld ; rep ; movsl ; movl %3,%0 ; rep ; movsb":"+c" (nl), 15 | "+S"(p), "+D"(q) 16 | :"r"(n & 3)); 17 | #elif defined(__x86_64__) 18 | size_t nq = n >> 3; 19 | asm volatile ("cld ; rep ; movsq ; movl %3,%%ecx ; rep ; movsb":"+c" 20 | (nq), "+S"(p), "+D"(q) 21 | :"r"((uint32_t) (n & 7))); 22 | #else 23 | while (n--) { 24 | *q++ = *p++; 25 | } 26 | #endif 27 | 28 | return dst; 29 | } 30 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memfile.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t memfile_write(FILE *instance, const char *bp, size_t n) 4 | { 5 | struct MemFile *f = (struct MemFile*)instance; 6 | size_t i = 0; 7 | 8 | while (n--) 9 | { 10 | f->bytes_written++; 11 | if (f->bytes_written <= f->size) 12 | { 13 | *f->buffer++ = *bp++; 14 | i++; 15 | } 16 | } 17 | 18 | return i; 19 | } 20 | 21 | const struct File_methods MemFile_methods = { 22 | &memfile_write, 23 | NULL 24 | }; 25 | 26 | FILE *fmemopen_w(struct MemFile* storage, char *buffer, size_t size) 27 | { 28 | storage->file.vmt = &MemFile_methods; 29 | storage->buffer = buffer; 30 | storage->bytes_written = 0; 31 | storage->size = size; 32 | return (FILE*)storage; 33 | } 34 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memmem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memmem.c 3 | * 4 | * Find a byte string inside a longer byte string 5 | * 6 | * This uses the "Not So Naive" algorithm, a very simple but 7 | * usually effective algorithm, see: 8 | * 9 | * http://www-igm.univ-mlv.fr/~lecroq/string/ 10 | */ 11 | 12 | #include 13 | 14 | void *memmem(const void *haystack, size_t n, const void *needle, size_t m) 15 | { 16 | const unsigned char *y = (const unsigned char *)haystack; 17 | const unsigned char *x = (const unsigned char *)needle; 18 | 19 | size_t j, k, l; 20 | 21 | if (m > n || !m || !n) 22 | return NULL; 23 | 24 | if (1 != m) { 25 | if (x[0] == x[1]) { 26 | k = 2; 27 | l = 1; 28 | } else { 29 | k = 1; 30 | l = 2; 31 | } 32 | 33 | j = 0; 34 | while (j <= n - m) { 35 | if (x[1] != y[j + 1]) { 36 | j += k; 37 | } else { 38 | if (!memcmp(x + 2, y + j + 2, m - 2) 39 | && x[0] == y[j]) 40 | return (void *)&y[j]; 41 | j += l; 42 | } 43 | } 44 | } else 45 | do { 46 | if (*y == *x) 47 | return (void *)y; 48 | y++; 49 | } while (--n); 50 | 51 | return NULL; 52 | } 53 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memmove.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memmove.c 3 | */ 4 | 5 | #include 6 | 7 | void *memmove(void *dst, const void *src, size_t n) 8 | { 9 | const char *p = src; 10 | char *q = dst; 11 | #if defined(__i386__) || defined(__x86_64__) 12 | if (q < p) { 13 | asm volatile("cld; rep; movsb" 14 | : "+c" (n), "+S"(p), "+D"(q)); 15 | } else { 16 | p += (n - 1); 17 | q += (n - 1); 18 | asm volatile("std; rep; movsb; cld" 19 | : "+c" (n), "+S"(p), "+D"(q)); 20 | } 21 | #else 22 | if (q < p) { 23 | while (n--) { 24 | *q++ = *p++; 25 | } 26 | } else { 27 | p += n; 28 | q += n; 29 | while (n--) { 30 | *--q = *--p; 31 | } 32 | } 33 | #endif 34 | 35 | return dst; 36 | } 37 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memrchr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memrchr.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | void *memrchr(const void *s, int c, size_t n) 9 | { 10 | const unsigned char *sp = (const unsigned char *)s + n - 1; 11 | 12 | while (n--) { 13 | if (*sp == (unsigned char)c) 14 | return (void *)sp; 15 | sp--; 16 | } 17 | 18 | return NULL; 19 | } 20 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memset.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memset.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | void *memset(void *dst, int c, size_t n) 9 | { 10 | char *q = dst; 11 | 12 | #if defined(__i386__) 13 | size_t nl = n >> 2; 14 | asm volatile ("cld ; rep ; stosl ; movl %3,%0 ; rep ; stosb" 15 | : "+c" (nl), "+D" (q) 16 | : "a" ((unsigned char)c * 0x01010101U), "r" (n & 3)); 17 | #elif defined(__x86_64__) 18 | size_t nq = n >> 3; 19 | asm volatile ("cld ; rep ; stosq ; movl %3,%%ecx ; rep ; stosb" 20 | :"+c" (nq), "+D" (q) 21 | : "a" ((unsigned char)c * 0x0101010101010101U), 22 | "r" ((uint32_t) n & 7)); 23 | #else 24 | while (n--) { 25 | *q++ = c; 26 | } 27 | #endif 28 | 29 | return dst; 30 | } 31 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/memswap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * memswap() 3 | * 4 | * Swaps the contents of two nonoverlapping memory areas. 5 | * This really could be done faster... 6 | */ 7 | 8 | #include 9 | 10 | void memswap(void *m1, void *m2, size_t n) 11 | { 12 | char *p = m1; 13 | char *q = m2; 14 | char tmp; 15 | 16 | while (n--) { 17 | tmp = *p; 18 | *p = *q; 19 | *q = tmp; 20 | 21 | p++; 22 | q++; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/mrand48.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mrand48.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | extern unsigned short __rand48_seed[3]; /* Common with lrand48.c, srand48.c */ 9 | 10 | long mrand48(void) 11 | { 12 | return jrand48(__rand48_seed); 13 | } 14 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/nrand48.c: -------------------------------------------------------------------------------- 1 | /* 2 | * nrand48.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | long nrand48(unsigned short* xsubi) 9 | { 10 | return (long)((uint32_t) jrand48(xsubi) >> 1); 11 | } 12 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/qsort.c: -------------------------------------------------------------------------------- 1 | /* 2 | * qsort.c 3 | * 4 | * This is actually combsort. It's an O(n log n) algorithm with 5 | * simplicity/small code size being its main virtue. 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | static inline size_t newgap(size_t gap) 13 | { 14 | gap = (gap * 10) / 13; 15 | if (gap == 9 || gap == 10) 16 | gap = 11; 17 | 18 | if (gap < 1) 19 | gap = 1; 20 | return gap; 21 | } 22 | 23 | void qsort(void *base, size_t nmemb, size_t size, 24 | int (*compar) (const void *, const void *)) 25 | { 26 | size_t gap = nmemb; 27 | size_t i, j; 28 | char *p1, *p2; 29 | int swapped; 30 | 31 | if (!nmemb) 32 | return; 33 | 34 | do { 35 | gap = newgap(gap); 36 | swapped = 0; 37 | 38 | for (i = 0, p1 = base; i < nmemb - gap; i++, p1 += size) { 39 | j = i + gap; 40 | if (compar(p1, p2 = (char *)base + j * size) > 0) { 41 | memswap(p1, p2, size); 42 | swapped = 1; 43 | } 44 | } 45 | } while (gap > 1 || swapped); 46 | } 47 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/realloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * realloc.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | #include "malloc.h" 9 | 10 | /* FIXME: This is cheesy, it should be fixed later */ 11 | 12 | void *realloc(void *ptr, size_t size) 13 | { 14 | struct free_arena_header *ah; 15 | void *newptr; 16 | size_t oldsize; 17 | 18 | if (!ptr) 19 | return malloc(size); 20 | 21 | if (size == 0) { 22 | free(ptr); 23 | return NULL; 24 | } 25 | 26 | /* Add the obligatory arena header, and round up */ 27 | size = (size + 2 * sizeof(struct arena_header) - 1) & ARENA_SIZE_MASK; 28 | 29 | ah = (struct free_arena_header *) 30 | ((struct arena_header *)ptr - 1); 31 | 32 | if (ah->a.size >= size && size >= (ah->a.size >> 2)) { 33 | /* This field is a good size already. */ 34 | return ptr; 35 | } else { 36 | /* Make me a new block. This is kind of bogus; we should 37 | be checking the following block to see if we can do an 38 | in-place adjustment... fix that later. */ 39 | 40 | oldsize = ah->a.size - sizeof(struct arena_header); 41 | 42 | newptr = malloc(size); 43 | memcpy(newptr, ptr, (size < oldsize) ? size : oldsize); 44 | free(ptr); 45 | 46 | return newptr; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/sprintf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sprintf.c 3 | */ 4 | 5 | #ifdef WITH_STDIO 6 | #include 7 | #include 8 | #include 9 | 10 | int sprintf(char *buffer, const char *format, ...) 11 | { 12 | va_list ap; 13 | int rv; 14 | 15 | va_start(ap, format); 16 | rv = vsnprintf(buffer, INT32_MAX, format, ap); 17 | va_end(ap); 18 | 19 | return rv; 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/srand48.c: -------------------------------------------------------------------------------- 1 | /* 2 | * srand48.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | unsigned short __rand48_seed[3]; /* Common with mrand48.c, lrand48.c */ 9 | 10 | void srand48(long seedval) 11 | { 12 | __rand48_seed[0] = 0x330e; 13 | __rand48_seed[1] = (unsigned short)seedval; 14 | __rand48_seed[2] = (unsigned short)((uint32_t) seedval >> 16); 15 | } 16 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/sscanf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sscanf() 3 | */ 4 | 5 | #include 6 | 7 | int sscanf(const char *str, const char *format, ...) 8 | { 9 | va_list ap; 10 | int rv; 11 | 12 | va_start(ap, format); 13 | rv = vsscanf(str, format, ap); 14 | va_end(ap); 15 | 16 | return rv; 17 | } 18 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strcasecmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strcasecmp.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | int strcasecmp(const char *s1, const char *s2) 9 | { 10 | const unsigned char *c1 = (const unsigned char *)s1; 11 | const unsigned char *c2 = (const unsigned char *)s2; 12 | unsigned char ch; 13 | int d = 0; 14 | 15 | while (1) { 16 | /* toupper() expects an unsigned char (implicitly cast to int) 17 | as input, and returns an int, which is exactly what we want. */ 18 | d = toupper(ch = *c1++) - toupper(*c2++); 19 | if (d || !ch) 20 | break; 21 | } 22 | 23 | return d; 24 | } 25 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strcat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strcat.c 3 | */ 4 | 5 | #include 6 | 7 | char *strcat(char *dst, const char *src) 8 | { 9 | strcpy(strchr(dst, '\0'), src); 10 | return dst; 11 | } 12 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strchr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strchr.c 3 | */ 4 | 5 | #include 6 | 7 | char *strchr(const char *s, int c) 8 | { 9 | while (*s != (char)c) { 10 | if (!*s) 11 | return NULL; 12 | s++; 13 | } 14 | 15 | return (char *)s; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strcmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strcmp.c 3 | */ 4 | 5 | #include 6 | 7 | int strcmp(const char *s1, const char *s2) 8 | { 9 | const unsigned char *c1 = (const unsigned char *)s1; 10 | const unsigned char *c2 = (const unsigned char *)s2; 11 | unsigned char ch; 12 | int d = 0; 13 | 14 | while (1) { 15 | d = (int)(ch = *c1++) - (int)*c2++; 16 | if (d || !ch) 17 | break; 18 | } 19 | 20 | return d; 21 | } 22 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strcpy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strcpy.c 3 | * 4 | * strcpy() 5 | */ 6 | 7 | #include 8 | 9 | char *strcpy(char *dst, const char *src) 10 | { 11 | char *q = dst; 12 | const char *p = src; 13 | char ch; 14 | 15 | do { 16 | *q++ = ch = *p++; 17 | } while (ch); 18 | 19 | return dst; 20 | } 21 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strcspn.c: -------------------------------------------------------------------------------- 1 | /* 2 | FUNCTION 3 | <>---count characters not in string 4 | 5 | INDEX 6 | strcspn 7 | 8 | ANSI_SYNOPSIS 9 | size_t strcspn(const char *<[s1]>, const char *<[s2]>); 10 | 11 | TRAD_SYNOPSIS 12 | size_t strcspn(<[s1]>, <[s2]>) 13 | char *<[s1]>; 14 | char *<[s2]>; 15 | 16 | DESCRIPTION 17 | This function computes the length of the initial part of 18 | the string pointed to by <[s1]> which consists entirely of 19 | characters <[NOT]> from the string pointed to by <[s2]> 20 | (excluding the terminating null character). 21 | 22 | RETURNS 23 | <> returns the length of the substring found. 24 | 25 | PORTABILITY 26 | <> is ANSI C. 27 | 28 | <> requires no supporting OS subroutines. 29 | */ 30 | 31 | #include 32 | 33 | size_t strcspn(const char *s1, const char *s2) 34 | { 35 | const char *s = s1; 36 | const char *c; 37 | 38 | while (*s1) 39 | { 40 | for (c = s2; *c; c++) 41 | { 42 | if (*s1 == *c) 43 | break; 44 | } 45 | if (*c) 46 | break; 47 | s1++; 48 | } 49 | 50 | return s1 - s; 51 | } 52 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strdup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strdup.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | char *strdup(const char *s) 9 | { 10 | int l = strlen(s) + 1; 11 | char *d = malloc(l); 12 | 13 | if (d) 14 | memcpy(d, s, l); 15 | 16 | return d; 17 | } 18 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strlcat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strlcat.c 3 | */ 4 | 5 | #include 6 | 7 | size_t strlcat(char *dst, const char *src, size_t size) 8 | { 9 | size_t bytes = 0; 10 | char *q = dst; 11 | const char *p = src; 12 | char ch; 13 | 14 | while (bytes < size && *q) { 15 | q++; 16 | bytes++; 17 | } 18 | if (bytes == size) 19 | return (bytes + strlen(src)); 20 | 21 | while ((ch = *p++)) { 22 | if (bytes + 1 < size) 23 | *q++ = ch; 24 | 25 | bytes++; 26 | } 27 | 28 | *q = '\0'; 29 | return bytes; 30 | } 31 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strlcpy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strlcpy.c 3 | */ 4 | 5 | #include 6 | 7 | size_t strlcpy(char *dst, const char *src, size_t size) 8 | { 9 | size_t bytes = 0; 10 | char *q = dst; 11 | const char *p = src; 12 | char ch; 13 | 14 | while ((ch = *p++)) { 15 | if (bytes + 1 < size) 16 | *q++ = ch; 17 | 18 | bytes++; 19 | } 20 | 21 | /* If size == 0 there is no space for a final null... */ 22 | if (size) 23 | *q = '\0'; 24 | 25 | return bytes; 26 | } 27 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strlen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strlen() 3 | */ 4 | 5 | #include 6 | 7 | size_t strlen(const char *s) 8 | { 9 | const char *ss = s; 10 | while (*ss) 11 | ss++; 12 | return ss - s; 13 | } 14 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strncasecmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strncasecmp.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | int strncasecmp(const char *s1, const char *s2, size_t n) 9 | { 10 | const unsigned char *c1 = (const unsigned char *)s1; 11 | const unsigned char *c2 = (const unsigned char *)s2; 12 | unsigned char ch; 13 | int d = 0; 14 | 15 | while (n--) { 16 | /* toupper() expects an unsigned char (implicitly cast to int) 17 | as input, and returns an int, which is exactly what we want. */ 18 | d = toupper(ch = *c1++) - toupper(*c2++); 19 | if (d || !ch) 20 | break; 21 | } 22 | 23 | return d; 24 | } 25 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strncat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strncat.c 3 | */ 4 | 5 | #include 6 | 7 | char *strncat(char *dst, const char *src, size_t n) 8 | { 9 | char *q = strchr(dst, '\0'); 10 | const char *p = src; 11 | char ch; 12 | 13 | while (n--) { 14 | *q++ = ch = *p++; 15 | if (!ch) 16 | return dst; 17 | } 18 | *q = '\0'; 19 | 20 | return dst; 21 | } 22 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strncmp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strncmp.c 3 | */ 4 | 5 | #include 6 | 7 | int strncmp(const char *s1, const char *s2, size_t n) 8 | { 9 | const unsigned char *c1 = (const unsigned char *)s1; 10 | const unsigned char *c2 = (const unsigned char *)s2; 11 | unsigned char ch; 12 | int d = 0; 13 | 14 | while (n--) { 15 | d = (int)(ch = *c1++) - (int)*c2++; 16 | if (d || !ch) 17 | break; 18 | } 19 | 20 | return d; 21 | } 22 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strncpy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strncpy.c 3 | */ 4 | 5 | #include 6 | 7 | char *strncpy(char *dst, const char *src, size_t n) 8 | { 9 | char *q = dst; 10 | const char *p = src; 11 | char ch; 12 | 13 | while (n) { 14 | n--; 15 | *q++ = ch = *p++; 16 | if (!ch) 17 | break; 18 | } 19 | 20 | /* The specs say strncpy() fills the entire buffer with NUL. Sigh. */ 21 | memset(q, 0, n); 22 | 23 | return dst; 24 | } 25 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strndup.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strndup.c 3 | */ 4 | 5 | #include 6 | #include 7 | 8 | char *strndup(const char *s, size_t n) 9 | { 10 | int l = n > strlen(s) ? strlen(s) + 1 : n + 1; 11 | char *d = malloc(l); 12 | 13 | if (!d) 14 | return NULL; 15 | 16 | memcpy(d, s, l); 17 | d[n] = '\0'; 18 | return d; 19 | } 20 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strnlen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strnlen() 3 | */ 4 | 5 | #include 6 | 7 | size_t strnlen(const char *s, size_t maxlen) 8 | { 9 | const char *ss = s; 10 | 11 | /* Important: the maxlen test must precede the reference through ss; 12 | since the byte beyond the maximum may segfault */ 13 | while ((maxlen > 0) && *ss) { 14 | ss++; 15 | maxlen--; 16 | } 17 | return ss - s; 18 | } 19 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strntoimax.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strntoimax.c 3 | * 4 | * strntoimax() 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | intmax_t strntoimax(const char *nptr, char **endptr, int base, size_t n) 11 | { 12 | return (intmax_t) strntoumax(nptr, endptr, base, n); 13 | } 14 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strntoumax.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strntoumax.c 3 | * 4 | * The strntoumax() function and associated 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | static inline int digitval(int ch) 13 | { 14 | if (ch >= '0' && ch <= '9') { 15 | return ch - '0'; 16 | } else if (ch >= 'A' && ch <= 'Z') { 17 | return ch - 'A' + 10; 18 | } else if (ch >= 'a' && ch <= 'z') { 19 | return ch - 'a' + 10; 20 | } else { 21 | return -1; 22 | } 23 | } 24 | 25 | uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) 26 | { 27 | int minus = 0; 28 | uintmax_t v = 0; 29 | int d; 30 | 31 | while (n && isspace((unsigned char)*nptr)) { 32 | nptr++; 33 | n--; 34 | } 35 | 36 | /* Single optional + or - */ 37 | if (n) { 38 | char c = *nptr; 39 | if (c == '-' || c == '+') { 40 | minus = (c == '-'); 41 | nptr++; 42 | n--; 43 | } 44 | } 45 | 46 | if (base == 0) { 47 | if (n >= 2 && nptr[0] == '0' && 48 | (nptr[1] == 'x' || nptr[1] == 'X')) { 49 | n -= 2; 50 | nptr += 2; 51 | base = 16; 52 | } else if (n >= 1 && nptr[0] == '0') { 53 | n--; 54 | nptr++; 55 | base = 8; 56 | } else { 57 | base = 10; 58 | } 59 | } else if (base == 16) { 60 | if (n >= 2 && nptr[0] == '0' && 61 | (nptr[1] == 'x' || nptr[1] == 'X')) { 62 | n -= 2; 63 | nptr += 2; 64 | } 65 | } 66 | 67 | while (n && (d = digitval(*nptr)) >= 0 && d < base) { 68 | v = v * base + d; 69 | n--; 70 | nptr++; 71 | } 72 | 73 | if (endptr) 74 | *endptr = (char *)nptr; 75 | 76 | return minus ? -v : v; 77 | } 78 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strpbrk.c: -------------------------------------------------------------------------------- 1 | /* 2 | FUNCTION 3 | <>---find characters in string 4 | 5 | INDEX 6 | strpbrk 7 | 8 | ANSI_SYNOPSIS 9 | #include 10 | char *strpbrk(const char *<[s1]>, const char *<[s2]>); 11 | 12 | TRAD_SYNOPSIS 13 | #include 14 | char *strpbrk(<[s1]>, <[s2]>) 15 | char *<[s1]>; 16 | char *<[s2]>; 17 | 18 | DESCRIPTION 19 | This function locates the first occurence in the string 20 | pointed to by <[s1]> of any character in string pointed to by 21 | <[s2]> (excluding the terminating null character). 22 | 23 | RETURNS 24 | <> returns a pointer to the character found in <[s1]>, or a 25 | null pointer if no character from <[s2]> occurs in <[s1]>. 26 | 27 | PORTABILITY 28 | <> requires no supporting OS subroutines. 29 | */ 30 | 31 | #include 32 | 33 | char *strpbrk(const char *s1, const char *s2) 34 | { 35 | const char *c = s2; 36 | if (!*s1) 37 | return (char *) NULL; 38 | 39 | while (*s1) 40 | { 41 | for (c = s2; *c; c++) 42 | { 43 | if (*s1 == *c) 44 | break; 45 | } 46 | if (*c) 47 | break; 48 | s1++; 49 | } 50 | 51 | if (*c == '\0') 52 | s1 = NULL; 53 | 54 | return (char *) s1; 55 | } 56 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strrchr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strrchr.c 3 | */ 4 | 5 | #include 6 | 7 | char *strrchr(const char *s, int c) 8 | { 9 | const char *found = NULL; 10 | 11 | while (*s) { 12 | if (*s == (char)c) 13 | found = s; 14 | s++; 15 | } 16 | 17 | return (char *)found; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strsep.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strsep.c 3 | */ 4 | 5 | #include 6 | 7 | char *strsep(char **stringp, const char *delim) 8 | { 9 | char *s = *stringp; 10 | char *e; 11 | 12 | if (!s) 13 | return NULL; 14 | 15 | e = strpbrk(s, delim); 16 | if (e) 17 | *e++ = '\0'; 18 | 19 | *stringp = e; 20 | return s; 21 | } 22 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strspn.c: -------------------------------------------------------------------------------- 1 | /* 2 | FUNCTION 3 | <>---find initial match 4 | 5 | INDEX 6 | strspn 7 | 8 | ANSI_SYNOPSIS 9 | #include 10 | size_t strspn(const char *<[s1]>, const char *<[s2]>); 11 | 12 | TRAD_SYNOPSIS 13 | #include 14 | size_t strspn(<[s1]>, <[s2]>) 15 | char *<[s1]>; 16 | char *<[s2]>; 17 | 18 | DESCRIPTION 19 | This function computes the length of the initial segment of 20 | the string pointed to by <[s1]> which consists entirely of 21 | characters from the string pointed to by <[s2]> (excluding the 22 | terminating null character). 23 | 24 | RETURNS 25 | <> returns the length of the segment found. 26 | 27 | PORTABILITY 28 | <> is ANSI C. 29 | 30 | <> requires no supporting OS subroutines. 31 | 32 | QUICKREF 33 | strspn ansi pure 34 | */ 35 | 36 | #include 37 | 38 | size_t strspn(const char *s1, const char *s2) 39 | { 40 | const char *s = s1; 41 | const char *c; 42 | 43 | while (*s1) 44 | { 45 | for (c = s2; *c; c++) 46 | { 47 | if (*s1 == *c) 48 | break; 49 | } 50 | if (*c == '\0') 51 | break; 52 | s1++; 53 | } 54 | 55 | return s1 - s; 56 | } 57 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strstr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strstr.c 3 | */ 4 | 5 | #include 6 | 7 | char *strstr(const char *haystack, const char *needle) 8 | { 9 | return (char *)memmem(haystack, strlen(haystack), needle, 10 | strlen(needle)); 11 | } 12 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtoimax.c: -------------------------------------------------------------------------------- 1 | #define TYPE intmax_t 2 | #define NAME strtoimax 3 | #include "strtox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtok.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strtok.c 3 | */ 4 | 5 | #include 6 | 7 | char *strtok(char *s, const char *delim) 8 | { 9 | static char *holder; 10 | 11 | return strtok_r(s, delim, &holder); 12 | } 13 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtok_r.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *strtok_r(char *s, const char *delim, char **holder) 4 | { 5 | if (s) 6 | *holder = s; 7 | 8 | do { 9 | s = strsep(holder, delim); 10 | } while (s && !*s); 11 | 12 | return s; 13 | } 14 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtol.c: -------------------------------------------------------------------------------- 1 | #define TYPE signed long 2 | #define NAME strtol 3 | #include "strtox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtoll.c: -------------------------------------------------------------------------------- 1 | #define TYPE signed long long 2 | #define NAME strtoll 3 | #include "strtox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtoul.c: -------------------------------------------------------------------------------- 1 | #define TYPE unsigned long 2 | #define NAME strtoul 3 | #include "strtox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtoull.c: -------------------------------------------------------------------------------- 1 | #define TYPE unsigned long long 2 | #define NAME strtoull 3 | #include "strtox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/strtoumax.c: -------------------------------------------------------------------------------- 1 | #define TYPE uintmax_t 2 | #define NAME strtoumax 3 | #include "strtox.c" 4 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/templates/atox.c: -------------------------------------------------------------------------------- 1 | /* 2 | * atox.c 3 | * 4 | * atoi(), atol(), atoll() 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | TYPE NAME(const char *nptr) 12 | { 13 | return (TYPE) strntoumax(nptr, (char **)NULL, 10, ~(size_t) 0); 14 | } 15 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/templates/strtox.c: -------------------------------------------------------------------------------- 1 | /* 2 | * strtox.c 3 | * 4 | * strto...() functions, by macro definition 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | TYPE NAME(const char *nptr, char **endptr, int base) 12 | { 13 | return (TYPE) strntoumax(nptr, endptr, base, ~(size_t) 0); 14 | } 15 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/vasprintf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * vasprintf.c 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int vasprintf(char **bufp, const char *format, va_list ap) 10 | { 11 | va_list ap1; 12 | int bytes; 13 | char *p; 14 | 15 | va_copy(ap1, ap); 16 | 17 | bytes = vsnprintf(NULL, 0, format, ap1) + 1; 18 | va_end(ap1); 19 | 20 | *bufp = p = malloc(bytes); 21 | if (!p) 22 | return -1; 23 | 24 | return vsnprintf(p, bytes, format, ap); 25 | } 26 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/vprintf.c: -------------------------------------------------------------------------------- 1 | #ifdef WITH_STDIO 2 | /* 3 | * vprintf.c 4 | */ 5 | 6 | #include 7 | #include 8 | 9 | int vprintf(const char *format, va_list ap) 10 | { 11 | return vfprintf(stdout, format, ap); 12 | } 13 | #endif 14 | -------------------------------------------------------------------------------- /arcfw/baselibc/src/vsprintf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * vsprintf.c 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int vsprintf(char *buffer, const char *format, va_list ap) 10 | { 11 | return vsnprintf(buffer, INT32_MAX, format, ap); 12 | } 13 | -------------------------------------------------------------------------------- /arcfw/baselibc/tests/.printf_tests.c~: -------------------------------------------------------------------------------- 1 | #include "unittests.h" 2 | 3 | int main() 4 | { 5 | int status = 0; 6 | 7 | { 8 | COMMENT("Testing basic snprintf functionality"); 9 | char buf[20]; 10 | 11 | snprintf(buf, sizeof(buf), "%08d", 55); 12 | TEST(strcmp(buf, "00000055") == 0); 13 | 14 | TEST(snprintf(buf, sizeof(buf), "01234567890123456789") == 19); 15 | TEST(strcmp(buf, "0123456789012345678") == 0); 16 | } 17 | 18 | if (status != 0) 19 | fprintf(stdout, "\n\nSome tests FAILED!\n"); 20 | 21 | return status; 22 | } 23 | -------------------------------------------------------------------------------- /arcfw/baselibc/tests/.tests_glue.c~: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if defined(__USE_POSIX) 4 | /* Connects the baselibc stdio to normal POSIX stdio */ 5 | size_t write(int fd, const void *buf, size_t count); 6 | 7 | static size_t stdio_write(FILE *instance, const char *bp, size_t n) 8 | { 9 | if (instance == stdout) 10 | return write(1, bp, n); 11 | else 12 | return write(2, bp, n); 13 | } 14 | #else 15 | #error No suitable write() implementation. 16 | #endif 17 | 18 | 19 | static struct File_methods stdio_methods = { 20 | &stdio_write, NULL 21 | }; 22 | 23 | static struct File _stdout = { 24 | &stdio_methods 25 | }; 26 | 27 | static struct File _stderr = { 28 | &stdio_methods 29 | }; 30 | 31 | FILE* const stdout = &_stdout; 32 | FILE* const stderr = &_stderr; 33 | 34 | -------------------------------------------------------------------------------- /arcfw/baselibc/tests/printf_tests.c: -------------------------------------------------------------------------------- 1 | #include "unittests.h" 2 | 3 | int main() 4 | { 5 | int status = 0; 6 | 7 | { 8 | COMMENT("Testing basic snprintf functionality"); 9 | char buf[20]; 10 | 11 | snprintf(buf, sizeof(buf), "%08d", 55); 12 | TEST(strcmp(buf, "00000055") == 0); 13 | 14 | TEST(snprintf(buf, sizeof(buf), "01234567890123456789") == 20); 15 | TEST(strcmp(buf, "0123456789012345678") == 0); 16 | } 17 | 18 | if (status != 0) 19 | fprintf(stdout, "\n\nSome tests FAILED!\n"); 20 | 21 | return status; 22 | } 23 | -------------------------------------------------------------------------------- /arcfw/baselibc/tests/tests_glue.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if defined(linux) 4 | /* Connects the baselibc stdio to normal POSIX stdio */ 5 | size_t write(int fd, const void *buf, size_t count); 6 | 7 | static size_t stdio_write(FILE *instance, const char *bp, size_t n) 8 | { 9 | if (instance == stdout) 10 | return write(1, bp, n); 11 | else 12 | return write(2, bp, n); 13 | } 14 | #else 15 | #error No suitable write() implementation. 16 | #endif 17 | 18 | 19 | static struct File_methods stdio_methods = { 20 | &stdio_write, NULL 21 | }; 22 | 23 | static struct File _stdout = { 24 | &stdio_methods 25 | }; 26 | 27 | static struct File _stderr = { 28 | &stdio_methods 29 | }; 30 | 31 | FILE* const stdout = &_stdout; 32 | FILE* const stderr = &_stderr; 33 | 34 | -------------------------------------------------------------------------------- /arcfw/baselibc/tests/unittests.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define COMMENT(x) printf("\n----" x "----\n"); 4 | #define STR(x) #x 5 | #define STR2(x) STR(x) 6 | #define TEST(x) \ 7 | if (!(x)) { \ 8 | fprintf(stderr, "\033[31;1mFAILED:\033[22;39m " __FILE__ ":" STR2(__LINE__) " " #x "\n"); \ 9 | status = 1; \ 10 | } else { \ 11 | printf("\033[32;1mOK:\033[22;39m " #x "\n"); \ 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /arcfw/gccle/dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/arcfw/gccle/dummy -------------------------------------------------------------------------------- /arcfw/of.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf32-powerpcle") 2 | OUTPUT_ARCH(powerpc:common) 3 | 4 | ENTRY(_start) 5 | 6 | SECTIONS { 7 | . = 0x80900000; 8 | __executable_start = .; 9 | 10 | .text : ALIGN(8) { *(.text) *(.text.*) } 11 | 12 | .rodata : ALIGN(8) { *(.rodata) *(.rodata.*) } 13 | 14 | .sdata : ALIGN(8) { *(.sdata) *(.sdata.*) } 15 | .data : ALIGN(8) { *(.data) *(.data.*) } 16 | 17 | . = ALIGN(32); 18 | __self_end = .; 19 | 20 | __bss_start = .; 21 | .bss : ALIGN(8) { *(.bss .bss.*) } :NONE = 0 22 | .sbss : { *(.sbss) } 23 | __bss_end = .; 24 | 25 | . = ALIGN(32); 26 | _end = .; 27 | } -------------------------------------------------------------------------------- /arcfw/source/arcconfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /// 4 | /// Parses the next part of an ARC device path. 5 | /// 6 | /// Pointer to the part of the string to parse. On function success, pointer is advanced past the part that was parsed. 7 | /// The device type that is expected to be parsed. 8 | /// On function success, returns the parsed key from the string. 9 | /// True if parsing succeeded, false if it failed. 10 | bool ArcDeviceParse(PCHAR* pPath, CONFIGURATION_TYPE ExpectedType, ULONG* Key); 11 | 12 | /// 13 | /// For an ARC device, get its ARC path. 14 | /// 15 | /// ARC component 16 | /// Buffer to write path to 17 | /// Length of buffer 18 | /// Length written without null terminator 19 | ULONG ArcDeviceGetPath(PCONFIGURATION_COMPONENT Component, PCHAR Path, ULONG Length); 20 | 21 | void ArcConfigInit(void); -------------------------------------------------------------------------------- /arcfw/source/arcconsole.h: -------------------------------------------------------------------------------- 1 | 2 | void ArcConsoleUseRgb(void); 3 | 4 | void ArcConsoleInit(void* framebuffer, int xstart, int ystart, int xres, int yres, int stride); 5 | 6 | int ArcConsoleWrite(const BYTE* ptr, size_t len); 7 | 8 | void ArcConsoleGetStatus(PARC_DISPLAY_STATUS Status); -------------------------------------------------------------------------------- /arcfw/source/arcdevice.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "arc.h" 3 | 4 | typedef struct _DEVICE_ENTRY DEVICE_ENTRY, *PDEVICE_ENTRY; 5 | 6 | typedef struct _DEVICE_VECTORS { 7 | PARC_CLOSE_ROUTINE Close; 8 | PARC_MOUNT_ROUTINE Mount; 9 | PARC_OPEN_ROUTINE_INTERNAL Open; 10 | PARC_READ_ROUTINE_INTERNAL Read; 11 | PARC_READ_STATUS_ROUTINE GetReadStatus; 12 | PARC_SEEK_ROUTINE Seek; 13 | PARC_WRITE_ROUTINE_INTERNAL Write; 14 | PARC_GET_FILE_INFO_ROUTINE GetFileInformation; 15 | PARC_SET_FILE_INFO_ROUTINE SetFileInformation; 16 | PARC_GET_DIRECTORY_ENTRY_ROUTINE_INTERNAL GetDirectoryEntry; 17 | } DEVICE_VECTORS, *PDEVICE_VECTORS; 18 | 19 | struct _DEVICE_ENTRY { 20 | CONFIGURATION_COMPONENT Component; 21 | PCM_PARTIAL_RESOURCE_LIST_HEADER ConfigData; 22 | PDEVICE_ENTRY Peer, Child, Parent; 23 | PDEVICE_VECTORS Vectors; 24 | // todo what else? 25 | }; 26 | -------------------------------------------------------------------------------- /arcfw/source/arcdisk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | ARC_STATUS ArcDiskTryEject(ULONG FileId); 4 | 5 | void ArcDiskGetCounts(PULONG Disk, PULONG Cdrom); 6 | 7 | ULONG ArcDiskGetPartitionCount(ULONG Disk); 8 | 9 | ULONG ArcDiskGetSizeMb(ULONG Disk); 10 | 11 | void ArcDiskInit(void); -------------------------------------------------------------------------------- /arcfw/source/arcenv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum { 4 | ARC_ENV_VARS_SIZE = 1024, 5 | ARC_ENV_MAXIMUM_VALUE_SIZE = 256, 6 | }; 7 | 8 | /// 9 | /// Gets the environment variable table. 10 | /// 11 | /// Environment variable table 12 | const BYTE* ArcEnvGetVars(void); 13 | 14 | /// 15 | /// Sets an environment variable in memory. 16 | /// 17 | /// Environment variable key. 18 | /// Environment variable value. 19 | /// ARC status. 20 | ARC_STATUS ArcEnvSetVarInMem(PCHAR Key, PCHAR Value); 21 | 22 | bool ArcEnvHardDiskIsUsb(ULONG Key); 23 | 24 | /// 25 | /// Gets a device environment variable. 26 | /// 27 | /// Name of environment variable 28 | /// Pointer to environment variable 29 | PCHAR ArcEnvGetDevice(PCHAR Key); 30 | 31 | /// 32 | /// Sets a device path environment variable. 33 | /// 34 | /// Environment variable key. 35 | /// Environment variable value. 36 | /// ARC status. 37 | ARC_STATUS ArcEnvSetDevice(PCHAR Key, PCHAR Value); 38 | 39 | /// 40 | /// Sets the hard disk containing ARC NV storage, after it has been formatted. 41 | /// 42 | /// ARC device path. 43 | void ArcEnvSetDiskAfterFormat(PCHAR DevicePath); 44 | 45 | /// 46 | /// Sets the device containing ARC NV storage, after disk images have been created on it. 47 | /// 48 | /// ARC device path. 49 | void ArcEnvSetDeviceAfterFormat(UCHAR Drive); 50 | 51 | /// 52 | /// Loads environment from ARC non-volatile storage, scanning all hard disks to find the one containing ARC NV storage. 53 | /// 54 | void ArcEnvLoad(void); 55 | 56 | void ArcEnvInit(void); -------------------------------------------------------------------------------- /arcfw/source/arcinvoke.S: -------------------------------------------------------------------------------- 1 | #define _LANGUAGE_ASSEMBLY 2 | #include "asm.h" 3 | 4 | .text 5 | 6 | .global __ArcInvokeImpl 7 | __ArcInvokeImpl: 8 | mflr r0 9 | stwu r0, -4(r1) 10 | mtctr r3 11 | mr r2, r4 12 | mr r3, r5 13 | mr r4, r6 14 | mr r5, r7 15 | bctrl 16 | lwzu r0, 0(r1) 17 | addi r1, r1, 4 18 | mtlr r0 19 | blr 20 | 21 | .globl DCFlushRangeNoSync 22 | DCFlushRangeNoSync: 23 | cmplwi r4, 0 # zero or negative size? 24 | blelr 25 | clrlwi. r5, r3, 27 # check for lower bits set in address 26 | beq 1f 27 | addi r4, r4, 0x20 28 | 1: 29 | addi r4, r4, 0x1f 30 | srwi r4, r4, 5 31 | mtctr r4 32 | 2: 33 | dcbf r0, r3 34 | addi r3, r3, 0x20 35 | bdnz 2b 36 | blr 37 | 38 | .globl ICInvalidateRange 39 | ICInvalidateRange: 40 | cmplwi r4, 0 # zero or negative size? 41 | blelr 42 | clrlwi. r5, r3, 27 # check for lower bits set in address 43 | beq 1f 44 | addi r4, r4, 0x20 45 | 1: 46 | addi r4, r4, 0x1f 47 | srwi r4, r4, 5 48 | mtctr r4 49 | 2: 50 | icbi r0, r3 51 | addi r3, r3, 0x20 52 | bdnz 2b 53 | sync 54 | isync 55 | blr 56 | 57 | 58 | .globl DCFlushRangeInlineSync 59 | DCFlushRangeInlineSync: 60 | cmplwi r4, 0 # zero or negative size? 61 | blelr 62 | clrlwi. r5, r3, 27 # check for lower bits set in address 63 | beq 1f 64 | addi r4, r4, 0x20 65 | 1: 66 | addi r4, r4, 0x1f 67 | srwi r4, r4, 5 68 | mtctr r4 69 | 2: 70 | dcbf r0, r3 71 | addi r3, r3, 0x20 72 | bdnz 2b 73 | mfspr r3,HID0 74 | ori r4,r3,0x0008 75 | mtspr HID0,r4 76 | isync 77 | sync 78 | mtspr HID0,r3 79 | blr 80 | -------------------------------------------------------------------------------- /arcfw/source/arcload.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | PVOID ArcLoadGetScratchAddress(void); 4 | 5 | void ArcLoadInit(void); -------------------------------------------------------------------------------- /arcfw/source/arcterm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void ArcTermInit(void); -------------------------------------------------------------------------------- /arcfw/source/arctime.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void ArcTimeInit(void); -------------------------------------------------------------------------------- /arcfw/source/cache.S: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/arcfw/source/cache.S -------------------------------------------------------------------------------- /arcfw/source/console_font_8x16.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/arcfw/source/console_font_8x16.c -------------------------------------------------------------------------------- /arcfw/source/context.h: -------------------------------------------------------------------------------- 1 | #ifndef __EXCONTEXT_H__ 2 | #define __EXCONTEXT_H__ 3 | 4 | #define NUM_EXCEPTIONS 15 5 | 6 | #define EX_SYS_RESET 0 7 | #define EX_MACH_CHECK 1 8 | #define EX_DSI 2 9 | #define EX_ISI 3 10 | #define EX_INT 4 11 | #define EX_ALIGN 5 12 | #define EX_PRG 6 13 | #define EX_FP 7 14 | #define EX_DEC 8 15 | #define EX_SYS_CALL 9 16 | #define EX_TRACE 10 17 | #define EX_PERF 11 18 | #define EX_IABR 12 19 | #define EX_RESV 13 20 | #define EX_THERM 14 21 | 22 | #ifndef _LANGUAGE_ASSEMBLY 23 | 24 | #include "types.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif /* __cplusplus */ 29 | 30 | typedef struct _excption_frame { 31 | ULONG EXCPT_Number; 32 | ULONG SRR0,SRR1; 33 | ULONG GPR[32]; 34 | ULONG GQR[8]; 35 | ULONG CR, LR, CTR, XER, MSR, DAR; 36 | 37 | USHORT state; //used to determine whether to restore the fpu context or not 38 | USHORT mode; //unused 39 | 40 | double FPR[32]; 41 | uint64_t FPSCR; 42 | double PSFPR[32]; 43 | } frame_context; 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif /* __cplusplus */ 48 | 49 | #endif //!_LANGUAGE_ASSEMBLY 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /arcfw/source/diskio.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------- 2 | / PFF - Low level disk interface modlue include file (C)ChaN, 2014 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO_DEFINED 6 | #define _DISKIO_DEFINED 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #include "pff.h" 13 | 14 | 15 | /* Status of Disk Functions */ 16 | typedef BYTE DPSTATUS; 17 | 18 | 19 | /* Results of Disk Functions */ 20 | typedef enum { 21 | RES_OK = 0, /* 0: Function succeeded */ 22 | RES_ERROR, /* 1: Disk error */ 23 | RES_NOTRDY, /* 2: Not ready */ 24 | RES_PARERR /* 3: Invalid parameter */ 25 | } DPRESULT; 26 | 27 | 28 | /*---------------------------------------*/ 29 | /* Prototypes for disk control functions */ 30 | 31 | DPSTATUS disk_initializep (void); 32 | DPRESULT disk_readp (UINT DeviceId, BYTE* buff, DWORD sector, UINT offser, UINT count); 33 | DPRESULT disk_writep (UINT DeviceId, const BYTE* buff, DWORD sc); 34 | 35 | #define STA_NOINIT 0x01 /* Drive not initialized */ 36 | #define STA_NODISK 0x02 /* No medium in the drive */ 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _DISKIO_DEFINED */ 43 | -------------------------------------------------------------------------------- /arcfw/source/exhandler_low.S: -------------------------------------------------------------------------------- 1 | #define _LANGUAGE_ASSEMBLY 2 | #include "asm.h" 3 | 4 | .text 5 | 6 | .extern ArcBugcheck 7 | .extern RegisterSpace 8 | 9 | .globl BugcheckTrampoline 10 | BugcheckTrampoline: 11 | mtspr SPRG3, r31 12 | lis r31, RegisterSpace@h 13 | ori r31, r31, RegisterSpace@l 14 | clrlwi r31, r31, 2 15 | stw r0, 0(r31) 16 | mfsrr0 r0 17 | stw r0, 128(r31) 18 | mfsrr1 r0 19 | stw r0, 132(r31) 20 | 21 | lis r31, BugcheckHandler@h 22 | ori r31, r31, BugcheckHandler@l 23 | mtsrr0 r31 24 | mfmsr r31 25 | ori r31,r31,MSR_IR|MSR_DR 26 | mtsrr1 r31 27 | mfspr r31, SPRG3 28 | rfi 29 | 30 | .globl BugcheckHandler 31 | BugcheckHandler: 32 | lis r31, RegisterSpace@h 33 | ori r31, r31, RegisterSpace@l 34 | //stw r0, 0(r31) 35 | stw r1, 4(r31) 36 | stw r2, 8(r31) 37 | stw r3, 12(r31) 38 | stw r4, 16(r31) 39 | stw r5, 20(r31) 40 | stw r6, 24(r31) 41 | stw r7, 28(r31) 42 | stw r8, 32(r31) 43 | stw r9, 36(r31) 44 | stw r10, 40(r31) 45 | stw r11, 44(r31) 46 | stw r12, 48(r31) 47 | stw r13, 52(r31) 48 | stw r14, 56(r31) 49 | stw r15, 60(r31) 50 | stw r16, 64(r31) 51 | stw r17, 68(r31) 52 | stw r18, 72(r31) 53 | stw r19, 76(r31) 54 | stw r20, 80(r31) 55 | stw r21, 84(r31) 56 | stw r22, 88(r31) 57 | stw r23, 92(r31) 58 | stw r24, 96(r31) 59 | stw r25, 100(r31) 60 | stw r26, 104(r31) 61 | stw r27, 108(r31) 62 | stw r28, 112(r31) 63 | stw r29, 116(r31) 64 | stw r30, 120(r31) 65 | stw r31, 124(r31) 66 | 67 | //mfspr r4, 26 68 | //stw r4, 128(r31) 69 | //mfspr r4, 27 70 | //stw r4, 132(r31) 71 | //mfspr r4, CR 72 | //stw r4, 136(r31) 73 | mfspr r4, 8 74 | stw r4, 140(r31) 75 | mfspr r4, 9 76 | stw r4, 144(r31) 77 | mfspr r4, 1 78 | stw r4, 148(r31) 79 | mfspr r4, 19 80 | stw r4, 152(r31) 81 | mfspr r4, 18 82 | stw r4, 156(r31) 83 | mfspr r4, 25 84 | stw r4, 160(r31) 85 | 86 | mr r3, r31 87 | b ArcBugcheck 88 | -------------------------------------------------------------------------------- /arcfw/source/exi_ide.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | 4 | typedef enum { 5 | IDE_DRIVE_CARD_A, // Memory Card Slot A (EXI0:0) 6 | IDE_DRIVE_CARD_B, // Memory Card Slot B (EXI1:0) 7 | IDE_DRIVE_SP1, // Flipper SP1 (EXI0:2) 8 | IDE_DRIVE_SP2, // Flipper SP2 (EXI2:0) 9 | } EXI_IDE_DRIVE; 10 | 11 | void IdeexiInit(void); 12 | bool IdeexiIsMounted(EXI_IDE_DRIVE drive); 13 | bool IdeexiMount(EXI_IDE_DRIVE drive); 14 | ULONG IdeexiTransferrableSectorCount(EXI_IDE_DRIVE drive); 15 | uint64_t IdeexiSectorCount(EXI_IDE_DRIVE drive); 16 | uint64_t IdeexiReadBlocks(EXI_IDE_DRIVE drive, PVOID buffer, uint64_t sector, ULONG count); 17 | uint64_t IdeexiWriteBlocks(EXI_IDE_DRIVE drive, PVOID buffer, uint64_t sector, ULONG count); 18 | -------------------------------------------------------------------------------- /arcfw/source/exi_sdmc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | 4 | typedef enum { 5 | SDMC_DRIVE_CARD_A, // Memory Card Slot A (EXI0:0) 6 | SDMC_DRIVE_CARD_B, // Memory Card Slot B (EXI1:0) 7 | SDMC_DRIVE_SP1, // Flipper SP1 (EXI0:2) 8 | SDMC_DRIVE_SP2, // Flipper SP2 (EXI2:0) 9 | } EXI_SDMC_DRIVE; 10 | 11 | void SdmcexiInit(void); 12 | bool SdmcexiIsMounted(EXI_SDMC_DRIVE drive); 13 | bool SdmcexiMount(EXI_SDMC_DRIVE drive); 14 | bool SdmcexiWriteProtected(EXI_SDMC_DRIVE drive); 15 | ULONG SdmcexiSectorCount(EXI_SDMC_DRIVE drive); 16 | ULONG SdmcexiReadBlocks(EXI_SDMC_DRIVE drive, PVOID buffer, ULONG sector, ULONG count); 17 | ULONG SdmcexiWriteBlocks(EXI_SDMC_DRIVE drive, PVOID buffer, ULONG sector, ULONG count); 18 | -------------------------------------------------------------------------------- /arcfw/source/getstr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "arc.h" 3 | 4 | typedef enum _GETSTRING_ACTION { 5 | GetStringSuccess, 6 | GetStringEscape, 7 | GetStringUpArrow, 8 | GetStringDownArrow, 9 | GetStringMaximum 10 | } GETSTRING_ACTION, * PGETSTRING_ACTION; 11 | 12 | GETSTRING_ACTION KbdGetString(PCHAR String, ULONG StringLength, PCHAR InitialString, ULONG CurrentRow, ULONG CurrentColumn); 13 | -------------------------------------------------------------------------------- /arcfw/source/hwdesc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../inc/hwdesc.h" -------------------------------------------------------------------------------- /arcfw/source/ios_sdmc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | 4 | bool SdmcFinalise(void); 5 | bool SdmcStartup(void); 6 | bool SdmcIsMounted(void); 7 | bool SdmcIsWriteProtected(void); 8 | ULONG SdmcSectorCount(void); 9 | ULONG SdmcReadSectors(ULONG Sector, ULONG NumSector, PVOID Buffer); 10 | ULONG SdmcWriteSectors(ULONG Sector, ULONG NumSector, const void* Buffer); -------------------------------------------------------------------------------- /arcfw/source/ios_usb_kbd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void UlkPoll(void); 4 | LONG UlkInit(void); -------------------------------------------------------------------------------- /arcfw/source/ios_usb_ms.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ios_usb.h" 3 | 4 | typedef struct _USBMS_CONTROLLER USBMS_CONTROLLER, * PUSBMS_CONTROLLER; 5 | 6 | typedef struct _USBMS_DEVICES { 7 | ULONG DeviceCount; 8 | ULONG ArcKey[USB_COUNT_DEVICES]; 9 | } USBMS_DEVICES, *PUSBMS_DEVICES; 10 | 11 | bool UlmsInit(void); 12 | void UlmsFinalise(void); 13 | void UlmsGetDevices(PUSBMS_DEVICES Devices); 14 | PUSBMS_CONTROLLER UlmsGetController(ULONG ArcKey); 15 | ULONG UlmsGetLuns(PUSBMS_CONTROLLER Controller); 16 | ULONG UlmsGetSectorSize(PUSBMS_CONTROLLER Controller, ULONG Lun); 17 | ULONG UlmsGetSectorCount(PUSBMS_CONTROLLER Controller, ULONG Lun); 18 | ULONG UlmsReadSectors(PUSBMS_CONTROLLER Controller, ULONG Lun, ULONG Sector, ULONG NumSector, PVOID Buffer); 19 | ULONG UlmsWriteSectors(PUSBMS_CONTROLLER Controller, ULONG Lun, ULONG Sector, ULONG NumSector, const void* Buffer); 20 | -------------------------------------------------------------------------------- /arcfw/source/ntio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | 4 | typedef struct ARC_LE _MDL { 5 | ULONG Next; 6 | CSHORT Size; 7 | CSHORT MdlFlags; 8 | ULONG Process; 9 | ULONG MappedSystemVa; 10 | ULONG StartVa; 11 | ULONG ByteCount; 12 | ULONG ByteOffset; 13 | } MDL, *PMDL; 14 | 15 | typedef struct ARC_LE _IO_STATUS_BLOCK { 16 | ULONG Status; 17 | ULONG Information; 18 | } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; -------------------------------------------------------------------------------- /arcfw/source/oslhooks.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void OslHookInit(PVOID BlOpen, PVOID BlFileTable, PVOID BlSetupForNt, PVOID BlReadSignature); -------------------------------------------------------------------------------- /arcfw/source/pffconf.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------/ 2 | / Petit FatFs - Configuration file 3 | /---------------------------------------------------------------------------*/ 4 | 5 | #ifndef PFCONF_DEF 6 | #define PFCONF_DEF 8088 /* Revision ID */ 7 | 8 | /*---------------------------------------------------------------------------/ 9 | / Function Configurations (0:Disable, 1:Enable) 10 | /---------------------------------------------------------------------------*/ 11 | 12 | #define PF_USE_READ 1 /* pf_read() function */ 13 | #define PF_USE_DIR 1 /* pf_opendir() and pf_readdir() function */ 14 | #define PF_USE_LSEEK 1 /* pf_lseek() function */ 15 | #define PF_USE_WRITE 1 /* pf_write() function */ 16 | 17 | #define PF_FS_FAT12 1 /* FAT12 */ 18 | #define PF_FS_FAT16 1 /* FAT16 */ 19 | #define PF_FS_FAT32 1 /* FAT32 */ 20 | 21 | 22 | /*---------------------------------------------------------------------------/ 23 | / Locale and Namespace Configurations 24 | /---------------------------------------------------------------------------*/ 25 | 26 | #define PF_USE_LCC 1 /* Allow lower case ASCII and non-ASCII chars */ 27 | 28 | #define PF_CODE_PAGE 437 29 | /* The PF_CODE_PAGE specifies the code page to be used on the target system. 30 | / SBCS code pages with PF_USE_LCC == 1 requiers a 128 byte of case conversion 31 | / table. It might occupy RAM on some platforms, e.g. avr-gcc. 32 | / When PF_USE_LCC == 0, PF_CODE_PAGE has no effect. 33 | / 34 | / 437 - U.S. 35 | / 720 - Arabic 36 | / 737 - Greek 37 | / 771 - KBL 38 | / 775 - Baltic 39 | / 850 - Latin 1 40 | / 852 - Latin 2 41 | / 855 - Cyrillic 42 | / 857 - Turkish 43 | / 860 - Portuguese 44 | / 861 - Icelandic 45 | / 862 - Hebrew 46 | / 863 - Canadian French 47 | / 864 - Arabic 48 | / 865 - Nordic 49 | / 866 - Russian 50 | / 869 - Greek 2 51 | / 932 - Japanese (DBCS) 52 | / 936 - Simplified Chinese (DBCS) 53 | / 949 - Korean (DBCS) 54 | / 950 - Traditional Chinese (DBCS) 55 | */ 56 | 57 | 58 | #endif /* PF_CONF */ 59 | -------------------------------------------------------------------------------- /arcfw/source/ppc-asm.h: -------------------------------------------------------------------------------- 1 | #ifdef __STDC__ 2 | #define XGLUE(a,b) a##b 3 | #else 4 | #define XGLUE(a,b) a/**/b 5 | #endif 6 | 7 | #define GLUE(a,b) XGLUE(a,b) 8 | 9 | #define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name) 10 | #if defined __PIC__ || defined __pic__ 11 | #define JUMP_TARGET(name) FUNC_NAME(name@plt) 12 | #else 13 | #define JUMP_TARGET(name) FUNC_NAME(name) 14 | #endif 15 | #define FUNC_START(name) \ 16 | .type FUNC_NAME(name),@function; \ 17 | .globl FUNC_NAME(name); \ 18 | FUNC_NAME(name): 19 | 20 | #define HIDDEN_FUNC(name) \ 21 | FUNC_START(name) \ 22 | .hidden FUNC_NAME(name); 23 | 24 | #define FUNC_END(name) \ 25 | GLUE(.L,name): \ 26 | .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name) 27 | 28 | # define CFI_STARTPROC .cfi_startproc 29 | # define CFI_ENDPROC .cfi_endproc 30 | # define CFI_OFFSET(reg, off) .cfi_offset reg, off 31 | # define CFI_DEF_CFA_REGISTER(reg) .cfi_def_cfa_register reg 32 | # define CFI_RESTORE(reg) .cfi_restore reg -------------------------------------------------------------------------------- /arcfw/source/ppchook.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /// 4 | /// Hooks a powerpc function, using the specified code-cave to store the trampoline. 5 | /// 6 | /// Pointer to function pointer to hook, will get overwritten by orig_function trampoline address. 7 | /// Pointer to hooked implementation. 8 | /// Code cave to use as trampoline. 9 | /// Number of instructions written to TrampolineCave. 10 | size_t PPCHook_HookWithCave(PVOID* FunctionPointer, PVOID HookLocation, PPPC_INSTRUCTION_BIG TrampolineCave); 11 | 12 | /// 13 | /// Hooks a powerpc function, using a global buffer to store the trampoline. 14 | /// 15 | /// Pointer to function pointer to hook, will get overwritten by orig_function trampoline address. 16 | /// Pointer to hooked implementation. 17 | /// Number of instructions written to TrampolineCave. 18 | size_t PPCHook_Hook(PVOID* FunctionPointer, PVOID HookLocation); 19 | 20 | /// 21 | /// Hooks a powerpc function end, using a global buffer to store the trampoline. 22 | /// 23 | /// Function end (blr insn) to hook. 24 | /// Pointer to hooked implementation. 25 | /// Number of instructions written to TrampolineCave. 26 | size_t PPCHook_HookEnd(PVOID FunctionPointer, PVOID HookLocation); -------------------------------------------------------------------------------- /arcfw/source/pxiheap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "types.h" 4 | 5 | bool PxiHeapInit(ULONG PhysAddr, ULONG Size); 6 | PVOID PxiIopAlloc(ULONG Size); 7 | PVOID PxiIopAllocAligned(ULONG Size, ULONG Alignment); 8 | void PxiIopFree(PVOID Ptr); -------------------------------------------------------------------------------- /arcfw/source/runtime.h: -------------------------------------------------------------------------------- 1 | // Defines runtime variables, shared from ARC fw to OS. 2 | #pragma once 3 | 4 | #include "../../inc/runtime.h" -------------------------------------------------------------------------------- /arcfw/source/si.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | #include "runtime.h" 4 | 5 | enum { 6 | SI_CHANNEL_COUNT = 4, 7 | }; 8 | 9 | // Joy Bus device type 10 | typedef union _JOYBUS_DEVICE_TYPE { 11 | struct { 12 | UCHAR ValidIfZero; 13 | 14 | union { 15 | struct { 16 | UCHAR Mode : 3; 17 | UCHAR Motor : 2; 18 | UCHAR GetOrigin : 1; 19 | UCHAR Unknown : 1; 20 | UCHAR : 1; 21 | }; 22 | UCHAR Value; 23 | } Status; 24 | 25 | USHORT Identifier; 26 | }; 27 | ULONG Value; 28 | } JOYBUS_DEVICE_TYPE; 29 | 30 | static inline bool SiDeviceTypeValid(JOYBUS_DEVICE_TYPE Type) { 31 | return Type.ValidIfZero == 0; 32 | } 33 | 34 | void SiInit(ARTX_SYSTEM_TYPE SystemType); 35 | JOYBUS_DEVICE_TYPE SiGetDeviceType(ULONG channel); 36 | JOYBUS_DEVICE_TYPE SiGetDeviceTypeReset(ULONG channel); 37 | bool SiTransferSync(ULONG channel, PVOID bufWrite, ULONG lenWrite, PVOID bufRead, ULONG lenRead); 38 | 39 | static inline bool SiTransferByteSync(ULONG channel, UCHAR command, PVOID bufRead, ULONG lenRead) { 40 | return SiTransferSync(channel, &command, sizeof(command), bufRead, lenRead); 41 | } 42 | -------------------------------------------------------------------------------- /arcfw/source/si_kbd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "types.h" 3 | 4 | void SikbdInit(void); 5 | void SikbdPoll(void); 6 | 7 | -------------------------------------------------------------------------------- /arcfw/source/timer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * OpenBIOS native timer driver 3 | * 4 | * (C) 2004 Stefan Reinauer 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License 8 | * version 2 9 | * 10 | */ 11 | 12 | #include "types.h" 13 | #include "timer.h" 14 | 15 | static unsigned long timer_freq = 0; 16 | static unsigned long timer_freq_usecs = 0; 17 | 18 | #define ticks_to_microsecs(ticks) ((((uint64_t)(ticks)*8)/(uint64_t)((timer_freq/1000)/125))) 19 | #define microsecs_to_ticks(usec) (((uint64_t)(usec)*((timer_freq/1000)/125))/8) 20 | 21 | void setup_timers(ULONG DecrementerFreq) 22 | { 23 | timer_freq = DecrementerFreq; 24 | timer_freq_usecs = DecrementerFreq / 1000000; 25 | } 26 | 27 | void udelay(unsigned int usecs) 28 | { 29 | _wait_ticks(timer_freq_usecs * usecs); 30 | } 31 | 32 | unsigned long long currticks(void) { 33 | unsigned long long _get_ticks(void); 34 | return _get_ticks(); 35 | } 36 | 37 | unsigned long long currusecs(void) { 38 | //return ticks_to_microsecs(currticks()); 39 | if (timer_freq_usecs == 40) return currticks() / 40; 40 | if (timer_freq_usecs == 60) return currticks() / 60; 41 | return currticks() / (unsigned long long)timer_freq_usecs; 42 | } 43 | 44 | unsigned long currmsecs(void) { 45 | return (unsigned long)(currusecs() / 1000); 46 | } 47 | 48 | void ndelay(unsigned int nsecs) 49 | { 50 | udelay((nsecs + 999) / 1000); 51 | } 52 | 53 | void mdelay(unsigned int msecs) 54 | { 55 | udelay(msecs * 1000); 56 | } 57 | 58 | -------------------------------------------------------------------------------- /arcfw/source/timer.h: -------------------------------------------------------------------------------- 1 | /* Taken from Etherboot */ 2 | /* Defines for routines to implement a low-overhead timer for drivers */ 3 | 4 | /* 5 | * This program is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU General Public License as 7 | * published by the Free Software Foundation; either version 2, or (at 8 | * your option) any later version. 9 | */ 10 | 11 | #ifndef TIMER_H 12 | #define TIMER_H 13 | 14 | /* Ports for the 8254 timer chip */ 15 | #define TIMER2_PORT 0x42 16 | #define TIMER_MODE_PORT 0x43 17 | 18 | /* Meaning of the mode bits */ 19 | #define TIMER0_SEL 0x00 20 | #define TIMER1_SEL 0x40 21 | #define TIMER2_SEL 0x80 22 | #define READBACK_SEL 0xC0 23 | 24 | #define LATCH_COUNT 0x00 25 | #define LOBYTE_ACCESS 0x10 26 | #define HIBYTE_ACCESS 0x20 27 | #define WORD_ACCESS 0x30 28 | 29 | #define MODE0 0x00 30 | #define MODE1 0x02 31 | #define MODE2 0x04 32 | #define MODE3 0x06 33 | #define MODE4 0x08 34 | #define MODE5 0x0A 35 | 36 | #define BINARY_COUNT 0x00 37 | #define BCD_COUNT 0x01 38 | 39 | /* Timers tick over at this rate */ 40 | #define CLOCK_TICK_RATE 1193180U 41 | #define TICKS_PER_MS (CLOCK_TICK_RATE/1000) 42 | 43 | /* Parallel Peripheral Controller Port B */ 44 | #define PPC_PORTB 0x61 45 | 46 | /* Meaning of the port bits */ 47 | #define PPCB_T2OUT 0x20 /* Bit 5 */ 48 | #define PPCB_SPKR 0x02 /* Bit 1 */ 49 | #define PPCB_T2GATE 0x01 /* Bit 0 */ 50 | 51 | extern void ndelay(unsigned int nsecs); 52 | extern void udelay(unsigned int usecs); 53 | extern void mdelay(unsigned int msecs); 54 | extern unsigned long long currticks(void); 55 | unsigned long long currusecs(void); 56 | unsigned long currmsecs(void); 57 | //unsigned long currsecs(void); 58 | 59 | /* arch/ppc/timebase.S */ 60 | void _wait_ticks(unsigned long nticks); 61 | 62 | #define TICKS_PER_SEC 1000 63 | 64 | #endif /* TIMER_H */ 65 | -------------------------------------------------------------------------------- /arcfw/source/timer_asm.S: -------------------------------------------------------------------------------- 1 | #define _LANGUAGE_ASSEMBLY 2 | #include "asm.h" 3 | 4 | .text 5 | 6 | .globl _get_ticks 7 | _get_ticks: 8 | mftbu r4 9 | mftb r3 10 | mftbu r5 11 | cmpw 0,r4,r5 12 | bne _get_ticks 13 | blr 14 | 15 | .globl _wait_ticks 16 | _wait_ticks: 17 | mflr r8 18 | mr r7,r3 19 | bl _get_ticks 20 | 21 | addc r7, r3, r7 22 | addze r6, r4 23 | 24 | 1: bl _get_ticks 25 | subfc r3, r3, r7 26 | subfe. r4, r4, r6 27 | bge 1b 28 | 29 | mtlr r8 30 | blr 31 | 32 | -------------------------------------------------------------------------------- /arcldr/ppc_race_payload/build.txt: -------------------------------------------------------------------------------- 1 | arm-none-eabi-gcc -marm -march=armv5t -mbig-endian -O3 -nostdlib -nodefaultlibs -o payload.elf -Wl,-T,payload.ld payload.c 2 | arm-none-eabi-objcopy -O binary payload.elf payload.bin -------------------------------------------------------------------------------- /arcldr/source/hwdesc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../inc/hwdesc.h" -------------------------------------------------------------------------------- /cafegx2drv/source/cafegx2.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DRV 6 | #define VER_FILESUBTYPE VFT2_DRV_DISPLAY 7 | #define VER_FILEDESCRIPTION_STR "Cafe GX2 Frame Buffer Miniport Driver" 8 | #define VER_INTERNALNAME_STR "cafegx2.sys" 9 | #define VER_ORIGINALFILENAME_STR "cafegx2.sys" 10 | 11 | #include "common.ver" 12 | -------------------------------------------------------------------------------- /fpexiblkdrv/source/exi_ide.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef enum { 4 | IDE_DRIVE_CARD_A, // Memory Card Slot A (EXI0:0) 5 | IDE_DRIVE_CARD_B, // Memory Card Slot B (EXI1:0) 6 | IDE_DRIVE_SP1, // Flipper SP1 (EXI0:2) 7 | IDE_DRIVE_SP2, // Flipper SP2 (EXI2:0) 8 | } EXI_IDE_DRIVE; 9 | 10 | void IdeexiInit(void); 11 | BOOLEAN IdeexiIsMounted(EXI_IDE_DRIVE drive); 12 | BOOLEAN IdeexiMount(EXI_IDE_DRIVE drive); 13 | ULONG IdeexiTransferrableSectorCount(EXI_IDE_DRIVE drive); 14 | unsigned long long IdeexiSectorCount(EXI_IDE_DRIVE drive); 15 | unsigned long long IdeexiReadBlocks(EXI_IDE_DRIVE drive, PVOID buffer, unsigned long long sector, ULONG count); 16 | unsigned long long IdeexiWriteBlocks(EXI_IDE_DRIVE drive, PVOID buffer, unsigned long long sector, ULONG count); 17 | -------------------------------------------------------------------------------- /fpexiblkdrv/source/exi_map.c: -------------------------------------------------------------------------------- 1 | 2 | #define DEVL 1 3 | #include 4 | #include "backport.h" 5 | #include "exi_map.h" 6 | 7 | enum { 8 | EXI_BUFFER_LENGTH = 0x80000 9 | }; 10 | 11 | static PVOID s_ExiDmaBuffer = NULL; 12 | static KSPIN_LOCK s_ExiSpinLock; 13 | static RTL_BITMAP s_ExiDmaMap; 14 | static ULONG s_ExiDmaMapData[4] = {0}; 15 | 16 | NTSTATUS ExiMapInit(void) { 17 | PHYSICAL_ADDRESS HighestAddress = {0}; 18 | HighestAddress.LowPart = HighestAddress.HighPart = 0xFFFFFFFFul; 19 | s_ExiDmaBuffer = MmAllocateContiguousMemory(EXI_BUFFER_LENGTH, HighestAddress); 20 | if (s_ExiDmaBuffer == NULL) return STATUS_INSUFFICIENT_RESOURCES; 21 | 22 | // Initialise the bitmap. 23 | RtlInitializeBitMap(&s_ExiDmaMap, s_ExiDmaMapData, sizeof(s_ExiDmaMap) * 8); 24 | KeInitializeSpinLock(&s_ExiSpinLock); 25 | return STATUS_SUCCESS; 26 | } 27 | 28 | void ExiMapFinalise(void) { 29 | MmFreeContiguousMemory(s_ExiDmaBuffer); 30 | } 31 | 32 | static PVOID ExipAllocateBufferPage(PULONG AllocatedBufferPage) { 33 | if (AllocatedBufferPage == NULL) return NULL; 34 | ULONG BufferPage = RtlFindClearBitsAndSet(&s_ExiDmaMap, 1, 0); 35 | if (BufferPage == 0xFFFFFFFF) { 36 | return NULL; 37 | } 38 | *AllocatedBufferPage = BufferPage; 39 | return (PUCHAR)s_ExiDmaBuffer + (BufferPage * PAGE_SIZE); 40 | } 41 | 42 | PVOID ExiAllocateBufferPage(PULONG AllocatedBufferPage) { 43 | KIRQL OldIrql; 44 | //KeAcquireSpinLock(&s_ExiSpinLock, &OldIrql); 45 | ULONG BufferPage; 46 | PVOID Ret = ExipAllocateBufferPage(&BufferPage); 47 | //KeReleaseSpinLock(&s_ExiSpinLock, OldIrql); 48 | if (Ret == NULL) return Ret; 49 | *AllocatedBufferPage = BufferPage; 50 | return Ret; 51 | } 52 | 53 | void ExiFreeBufferPage(ULONG BufferPage) { 54 | KIRQL OldIrql; 55 | //KeAcquireSpinLock(&s_ExiSpinLock, &OldIrql); 56 | RtlClearBits(&s_ExiDmaMap, BufferPage, 1); 57 | //KeReleaseSpinLock(&s_ExiSpinLock, OldIrql); 58 | } 59 | 60 | void ExiInvalidateDcache(const void* p, ULONG len) { 61 | ULONG a, b; 62 | 63 | a = (ULONG)p & ~0x1f; 64 | b = ((ULONG)p + len + 0x1f) & ~0x1f; 65 | 66 | for (; a < b; a += 32) 67 | asm("dcbi 0,%0 ; sync" : : "b"(a)); 68 | 69 | asm("sync ; isync"); 70 | } -------------------------------------------------------------------------------- /fpexiblkdrv/source/exi_map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | NTSTATUS ExiMapInit(void); 3 | void ExiMapFinalise(void); 4 | PVOID ExiAllocateBufferPage(PULONG AllocatedBufferPage); 5 | void ExiFreeBufferPage(ULONG BufferPage); 6 | void ExiInvalidateDcache(const void* p, ULONG len); -------------------------------------------------------------------------------- /fpexiblkdrv/source/exi_sdmc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef enum { 4 | SDMC_DRIVE_CARD_A, // Memory Card Slot A (EXI0:0) 5 | SDMC_DRIVE_CARD_B, // Memory Card Slot B (EXI1:0) 6 | SDMC_DRIVE_SP1, // Flipper SP1 (EXI0:2) 7 | SDMC_DRIVE_SP2, // Flipper SP2 (EXI2:0) 8 | } EXI_SDMC_DRIVE; 9 | 10 | void SdmcexiInit(void); 11 | BOOLEAN SdmcexiIsMounted(EXI_SDMC_DRIVE drive); 12 | BOOLEAN SdmcexiMount(EXI_SDMC_DRIVE drive); 13 | BOOLEAN SdmcexiWriteProtected(EXI_SDMC_DRIVE drive); 14 | ULONG SdmcexiSectorCount(EXI_SDMC_DRIVE drive); 15 | ULONG SdmcexiReadBlocks(EXI_SDMC_DRIVE drive, PVOID buffer, ULONG sector, ULONG count); 16 | ULONG SdmcexiWriteBlocks(EXI_SDMC_DRIVE drive, PVOID buffer, ULONG sector, ULONG count); 17 | -------------------------------------------------------------------------------- /fpexiblkdrv/source/fpexiblk.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DRV 6 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 7 | #define VER_FILEDESCRIPTION_STR "Flipper EXI SDMC/IDE Disk Emulation Driver" 8 | #define VER_INTERNALNAME_STR "fpexiblk.sys" 9 | #define VER_ORIGINALFILENAME_STR "fpexiblk.sys" 10 | 11 | #include "common.ver" 12 | 13 | -------------------------------------------------------------------------------- /fpgx35dll/source/debug.c: -------------------------------------------------------------------------------- 1 | /******************************Module*Header*******************************\ 2 | * Module Name: debug.c 3 | * 4 | * debug helpers routine 5 | * 6 | * Copyright (c) 1992-1995 Microsoft Corporation 7 | * 8 | \**************************************************************************/ 9 | 10 | #include "driver.h" 11 | 12 | #if DBG 13 | 14 | ULONG DebugLevel = 0; 15 | 16 | /***************************************************************************** 17 | * 18 | * Routine Description: 19 | * 20 | * This function is variable-argument, level-sensitive debug print 21 | * routine. 22 | * If the specified debug level for the print statement is lower or equal 23 | * to the current debug level, the message will be printed. 24 | * 25 | * Arguments: 26 | * 27 | * DebugPrintLevel - Specifies at which debugging level the string should 28 | * be printed 29 | * 30 | * DebugMessage - Variable argument ascii c string 31 | * 32 | * Return Value: 33 | * 34 | * None. 35 | * 36 | ***************************************************************************/ 37 | 38 | VOID 39 | DebugPrint( 40 | ULONG DebugPrintLevel, 41 | PCHAR DebugMessage, 42 | ... 43 | ) 44 | 45 | { 46 | 47 | va_list ap; 48 | 49 | va_start(ap, DebugMessage); 50 | 51 | if (DebugPrintLevel <= DebugLevel) 52 | { 53 | EngDebugPrint(STANDARD_DEBUG_PREFIX, DebugMessage, ap); 54 | } 55 | 56 | va_end(ap); 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /fpgx35dll/source/debug.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************\ 2 | * Module Name: debug.h 3 | * 4 | * Commonly used debugging macros. 5 | * 6 | * Copyright (c) 1992-1995 Microsoft Corporation 7 | \***************************************************************************/ 8 | 9 | 10 | #if DBG 11 | 12 | VOID 13 | DebugPrint( 14 | ULONG DebugPrintLevel, 15 | PCHAR DebugMessage, 16 | ... 17 | ); 18 | 19 | #define DISPDBG(arg) DebugPrint arg 20 | #define RIP(x) { DebugPrint(0, x); EngDebugBreak();} 21 | 22 | #else 23 | 24 | #define DISPDBG(arg) 25 | #define RIP(x) 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /fpgx35dll/source/fpvigx.def: -------------------------------------------------------------------------------- 1 | LIBRARY framebuf 2 | 3 | DESCRIPTION 'FRAME BUFFER NT Display Driver Library' 4 | 5 | EXPORTS 6 | DrvEnableDriver 7 | DrvDisableDriver 8 | 9 | PROTMODE 10 | -------------------------------------------------------------------------------- /fpgx35dll/source/fpvigx.rc: -------------------------------------------------------------------------------- 1 | /* Resource file for frame buffer display driver */ 2 | 3 | #include "windows.h" 4 | 5 | 1 RCDATA 6 | BEGIN 7 | // Machine dependent parameters 8 | 17, // Height of vertical thumb 9 | 17, // Width of horizontal thumb 10 | 2, // Icon horiz compression factor 11 | 2, // Icon vert compression factor 12 | 1, // Cursor horz compression factor 13 | 1, // Cursor vert compression factor 14 | 0, // Kanji window height 15 | 1, // cxBorder (thickness of vertical lines) 16 | 1 // cyBorder (thickness of horizontal lines) 17 | END 18 | 19 | #include 20 | 21 | #define VER_FILETYPE VFT_DRV 22 | #define VER_FILESUBTYPE VFT2_DRV_DISPLAY 23 | #define VER_FILEDESCRIPTION_STR "Flipper Video Interface/Command Processor Display Driver" 24 | #define VER_INTERNALNAME_STR "fpvigx.dll" 25 | #define VER_ORIGINALFILENAME_STR "fpvigx.dll" 26 | 27 | #include "common.ver" 28 | -------------------------------------------------------------------------------- /fpsidrv/source/entry.c: -------------------------------------------------------------------------------- 1 | // SI driver (entrypoint) 2 | #define DEVL 1 3 | #include 4 | #include "si.h" 5 | #include "keyboard.h" 6 | #include "mouse.h" 7 | 8 | NTSTATUS SiCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) { 9 | // just return success 10 | Irp->IoStatus.Status = STATUS_SUCCESS; 11 | IoCompleteRequest(Irp, IO_NO_INCREMENT); 12 | return STATUS_SUCCESS; 13 | } 14 | 15 | NTSTATUS SiInternalDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) { 16 | if (DeviceObject == KbdDeviceObject) return KbdIoctl(DeviceObject, Irp); 17 | if (DeviceObject == MouDeviceObject) return MouIoctl(DeviceObject, Irp); 18 | Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; 19 | IoCompleteRequest(Irp, IO_NO_INCREMENT); 20 | return STATUS_INVALID_DEVICE_REQUEST; 21 | } 22 | 23 | BOOLEAN SikbdInit(void); 24 | 25 | NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) { 26 | NTSTATUS Status = SiInit(); 27 | if (!NT_SUCCESS(Status)) return Status; 28 | 29 | if (!SikbdInit()) return STATUS_SUCCESS; 30 | KbdInit(DriverObject, RegistryPath); 31 | MouInit(DriverObject, RegistryPath); 32 | 33 | // Set up the device driver entry points. 34 | DriverObject->MajorFunction[IRP_MJ_CREATE] = SiCreate; 35 | DriverObject->MajorFunction[IRP_MJ_CLOSE] = SiCreate; 36 | DriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = SiInternalDeviceControl; 37 | 38 | return STATUS_SUCCESS; 39 | } -------------------------------------------------------------------------------- /fpsidrv/source/fpsi.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DRV 6 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 7 | #define VER_FILEDESCRIPTION_STR "Flipper Serial Interface HID Driver" 8 | #define VER_INTERNALNAME_STR "fpsi.sys" 9 | #define VER_ORIGINALFILENAME_STR "fpsi.sys" 10 | 11 | #include "common.ver" 12 | 13 | -------------------------------------------------------------------------------- /fpsidrv/source/keyboard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "runtime.h" 3 | 4 | typedef struct ARC_BE { 5 | UCHAR Modifiers; 6 | UCHAR Reserved; 7 | UCHAR KeyCode[6]; 8 | } USB_KBD_REPORT, *PUSB_KBD_REPORT; 9 | 10 | enum { 11 | KEY_MODIFIER_LCTRL = BIT(0), 12 | KEY_MODIFIER_LSHIFT = BIT(1), 13 | KEY_MODIFIER_LALT = BIT(2), 14 | KEY_MODIFIER_LWIN = BIT(3), 15 | KEY_MODIFIER_RCTRL = BIT(4), 16 | KEY_MODIFIER_RSHIFT = BIT(5), 17 | KEY_MODIFIER_RALT = BIT(6), 18 | KEY_MODIFIER_RWIN = BIT(7), 19 | 20 | KEY_MODIFIER_CTRL = KEY_MODIFIER_LCTRL | KEY_MODIFIER_RCTRL, 21 | KEY_MODIFIER_SHIFT = KEY_MODIFIER_LSHIFT | KEY_MODIFIER_RSHIFT, 22 | KEY_MODIFIER_ALT = KEY_MODIFIER_LALT | KEY_MODIFIER_RALT, 23 | KEY_MODIFIER_WIN = KEY_MODIFIER_LWIN | KEY_MODIFIER_RWIN 24 | }; 25 | 26 | enum { 27 | KEY_ERROR_OVF = 1 28 | }; 29 | 30 | // Keyboard device object. 31 | extern PDEVICE_OBJECT KbdDeviceObject; 32 | 33 | // Set keyboard LEDs (IOS /dev/usb/kbd) 34 | NTSTATUS IukSetLeds(UCHAR Indicators); 35 | // Set keyboard LEDs (IOS USBv5 low-level) 36 | NTSTATUS UlkSetLeds(UCHAR Indicators); 37 | 38 | // Called from lower-level driver when keyboard input data read complete. 39 | void KbdReadComplete(PUSB_KBD_REPORT Report); 40 | 41 | // USB keyboard ioctl implementation... 42 | NTSTATUS KbdIoctl(PDEVICE_OBJECT Device, PIRP Irp); 43 | 44 | // Initialise USB keyboard driver. 45 | NTSTATUS KbdInit(PDRIVER_OBJECT Driver, PUNICODE_STRING RegistryPath); -------------------------------------------------------------------------------- /fpsidrv/source/mouse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct _USB_MOUSE_REPORT { 4 | UCHAR Buttons; 5 | signed char X; 6 | signed char Y; 7 | signed char Wheel; 8 | UCHAR Padding[0x1C]; 9 | } USB_MOUSE_REPORT, *PUSB_MOUSE_REPORT; 10 | _Static_assert(sizeof(USB_MOUSE_REPORT) == 0x20); 11 | 12 | // Mouse device object. 13 | extern PDEVICE_OBJECT MouDeviceObject; 14 | 15 | // Called from lower-level driver when mouse input data read complete. 16 | void MouReadComplete(PUSB_MOUSE_REPORT Report, UCHAR Length); 17 | 18 | // USB mouse ioctl implementation 19 | NTSTATUS MouIoctl(PDEVICE_OBJECT Device, PIRP Irp); 20 | 21 | // Initialise USB mouse driver. 22 | NTSTATUS MouInit(PDRIVER_OBJECT Driver, PUNICODE_STRING RegistryPath); -------------------------------------------------------------------------------- /fpsidrv/source/si.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum { 4 | SI_CHANNEL_COUNT = 4, 5 | SI_POLL_LENGTH = 8 6 | }; 7 | 8 | typedef void (*SI_TRANSFER_CALLBACK)(ULONG Channel, BOOLEAN Success, PVOID Buffer, ULONG Length); 9 | typedef void (*SI_POLL_CALLBACK)(ULONG Channel, PUCHAR Data); 10 | 11 | // Joy Bus device type 12 | typedef union _JOYBUS_DEVICE_TYPE { 13 | struct { 14 | UCHAR ValidIfZero; 15 | 16 | union { 17 | struct { 18 | UCHAR Mode : 3; 19 | UCHAR Motor : 2; 20 | UCHAR GetOrigin : 1; 21 | UCHAR Unknown : 1; 22 | UCHAR : 1; 23 | }; 24 | UCHAR Value; 25 | } Status; 26 | 27 | USHORT Identifier; 28 | }; 29 | ULONG Value; 30 | } JOYBUS_DEVICE_TYPE; 31 | 32 | static inline BOOLEAN SiDeviceTypeValid(JOYBUS_DEVICE_TYPE Type) { 33 | return Type.ValidIfZero == 0; 34 | } 35 | 36 | NTSTATUS SiInit(void); 37 | JOYBUS_DEVICE_TYPE SiGetDeviceType(ULONG channel); 38 | JOYBUS_DEVICE_TYPE SiGetDeviceTypeReset(ULONG channel); 39 | NTSTATUS SiTransferAsync(ULONG channel, PVOID bufWrite, ULONG lenWrite, PVOID bufRead, ULONG lenRead, SI_TRANSFER_CALLBACK callback); 40 | NTSTATUS SiTransferSync(ULONG channel, PVOID bufWrite, ULONG lenWrite, PVOID bufRead, ULONG lenRead); 41 | NTSTATUS SiPollSetCallback(ULONG channel, SI_POLL_CALLBACK callback); 42 | NTSTATUS SiTransferPoll(ULONG channels, ULONG data, ULONG length); 43 | void SiTogglePoll(BOOLEAN value); 44 | 45 | static inline NTSTATUS SiTransferByteSync(ULONG channel, UCHAR command, PVOID bufRead, ULONG lenRead) { 46 | return SiTransferSync(channel, &command, sizeof(command), bufRead, lenRead); 47 | } -------------------------------------------------------------------------------- /fpvigxdll/source/debug.c: -------------------------------------------------------------------------------- 1 | /******************************Module*Header*******************************\ 2 | * Module Name: debug.c 3 | * 4 | * debug helpers routine 5 | * 6 | * Copyright (c) 1992-1995 Microsoft Corporation 7 | * 8 | \**************************************************************************/ 9 | 10 | #include "driver.h" 11 | 12 | #if DBG 13 | 14 | ULONG DebugLevel = 0; 15 | 16 | /***************************************************************************** 17 | * 18 | * Routine Description: 19 | * 20 | * This function is variable-argument, level-sensitive debug print 21 | * routine. 22 | * If the specified debug level for the print statement is lower or equal 23 | * to the current debug level, the message will be printed. 24 | * 25 | * Arguments: 26 | * 27 | * DebugPrintLevel - Specifies at which debugging level the string should 28 | * be printed 29 | * 30 | * DebugMessage - Variable argument ascii c string 31 | * 32 | * Return Value: 33 | * 34 | * None. 35 | * 36 | ***************************************************************************/ 37 | 38 | VOID 39 | DebugPrint( 40 | ULONG DebugPrintLevel, 41 | PCHAR DebugMessage, 42 | ... 43 | ) 44 | 45 | { 46 | 47 | va_list ap; 48 | 49 | va_start(ap, DebugMessage); 50 | 51 | if (DebugPrintLevel <= DebugLevel) 52 | { 53 | EngDebugPrint(STANDARD_DEBUG_PREFIX, DebugMessage, ap); 54 | } 55 | 56 | va_end(ap); 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /fpvigxdll/source/debug.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************\ 2 | * Module Name: debug.h 3 | * 4 | * Commonly used debugging macros. 5 | * 6 | * Copyright (c) 1992-1995 Microsoft Corporation 7 | \***************************************************************************/ 8 | 9 | 10 | #if DBG 11 | 12 | VOID 13 | DebugPrint( 14 | ULONG DebugPrintLevel, 15 | PCHAR DebugMessage, 16 | ... 17 | ); 18 | 19 | #define DISPDBG(arg) DebugPrint arg 20 | #define RIP(x) { DebugPrint(0, x); EngDebugBreak();} 21 | 22 | #else 23 | 24 | #define DISPDBG(arg) 25 | #define RIP(x) 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /fpvigxdll/source/fpvigx.rc: -------------------------------------------------------------------------------- 1 | /* Resource file for frame buffer display driver */ 2 | 3 | #include "windows.h" 4 | 5 | 1 RCDATA 6 | BEGIN 7 | // Machine dependent parameters 8 | 17, // Height of vertical thumb 9 | 17, // Width of horizontal thumb 10 | 2, // Icon horiz compression factor 11 | 2, // Icon vert compression factor 12 | 1, // Cursor horz compression factor 13 | 1, // Cursor vert compression factor 14 | 0, // Kanji window height 15 | 1, // cxBorder (thickness of vertical lines) 16 | 1 // cyBorder (thickness of horizontal lines) 17 | END 18 | 19 | #include 20 | 21 | #define VER_FILETYPE VFT_DRV 22 | #define VER_FILESUBTYPE VFT2_DRV_DISPLAY 23 | #define VER_FILEDESCRIPTION_STR "Flipper Video Interface/Command Processor Display Driver" 24 | #define VER_INTERNALNAME_STR "fpvigx.dll" 25 | #define VER_ORIGINALFILENAME_STR "fpvigx.dll" 26 | 27 | #include "common.ver" 28 | -------------------------------------------------------------------------------- /fpvigxdrv/source/efb.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum { 4 | EFB_PHYS_ADDR = 0x08000000, 5 | EFB_VIRT_ADDR = 0x88000000, 6 | EFB_LENGTH = 0x400000, // 4MB RGBA space 7 | EFB_STRIDE = 1024 * 4, // 1024 RGBA pixels 8 | }; -------------------------------------------------------------------------------- /fpvigxdrv/source/fpvigx.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DRV 6 | #define VER_FILESUBTYPE VFT2_DRV_DISPLAY 7 | #define VER_FILEDESCRIPTION_STR "Flipper Video Interface/Command Processor Miniport Driver" 8 | #define VER_INTERNALNAME_STR "fpvigx.sys" 9 | #define VER_ORIGINALFILENAME_STR "fpvigx.sys" 10 | 11 | #include "common.ver" 12 | -------------------------------------------------------------------------------- /fpvigxdrv/source/ioctl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define IOCTL_VIDEO_GET_BITMAP_BUFFER CTL_CODE(FILE_DEVICE_VIDEO, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) -------------------------------------------------------------------------------- /fpvigxdrv/source/vi.h: -------------------------------------------------------------------------------- 1 | // Video Interface Registers 2 | #pragma once 3 | 4 | enum { 5 | VI_PHYSADDR = 0x0C002000, 6 | VI_VIRTADDR = 0x8C002000, 7 | VI_LENGTH = 0x1000, 8 | VI_INTERRUPT_COUNT = 4, 9 | 10 | VI_INTERRUPT_FLAG_ENABLE = BIT(12), 11 | VI_INTERRUPT_FLAG_STATUS = BIT(15), 12 | 13 | VECTOR_VI = 8 14 | }; 15 | 16 | typedef struct _VI_INTERRUPT_REGISTERS { 17 | USHORT VerticalAndFlags; 18 | USHORT HorizontalCount; 19 | } VI_INTERRUPT_REGISTERS, *PVI_INTERRUPT_REGISTERS; 20 | 21 | typedef struct _VI_REGISTERS { 22 | USHORT Unused[24]; 23 | VI_INTERRUPT_REGISTERS Interrupts[VI_INTERRUPT_COUNT]; 24 | } VI_REGISTERS, *PVI_REGISTERS; 25 | 26 | #define VI_REGISTER_BAT ((PVI_REGISTERS)VI_VIRTADDR) 27 | 28 | #define VI_INTERRUPT_FLAGS_READ(i) MmioReadBase16( MMIO_OFFSET(VI_REGISTER_BAT, Interrupts[(i)].VerticalAndFlags) ) 29 | #define VI_INTERRUPT_FLAGS_WRITE(i, x) MmioWriteBase16( MMIO_OFFSET(VI_REGISTER_BAT, Interrupts[(i)].VerticalAndFlags), (x) ) 30 | #define VI_INTERRUPT_ENABLE(i) VI_INTERRUPT_FLAGS_WRITE( i, VI_INTERRUPT_FLAGS_READ(i) | VI_INTERRUPT_FLAG_ENABLE ) 31 | #define VI_INTERRUPT_DISABLE(i) VI_INTERRUPT_FLAGS_WRITE( i, VI_INTERRUPT_FLAGS_READ(i) & ~VI_INTERRUPT_FLAG_ENABLE ) 32 | #define VI_INTERRUPT_STATUS(i) ( ( VI_INTERRUPT_FLAGS_READ(i) & VI_INTERRUPT_FLAG_STATUS ) != 0 ) 33 | #define VI_INTERRUPT_CLEAR(i) VI_INTERRUPT_FLAGS_WRITE( i, VI_INTERRUPT_FLAGS_READ(i) & ~VI_INTERRUPT_FLAG_STATUS ) -------------------------------------------------------------------------------- /halartx/source/bat.s: -------------------------------------------------------------------------------- 1 | // Function to set an unused BAT. 2 | 3 | #include "kxppc.h" 4 | 5 | // NT only allocates IBAT/DBAT for the actual MEM1 size rounded up. 6 | // So for all of dol/rvl/cafe it would allocate 32MB cached BAT. 7 | 8 | // However, the entire 0x8xxxxxxx address space is reserved. 9 | // The rest of this 256MB range is unused. 10 | 11 | // Therefore, we can use a BAT to map PA 0x0c000000-0x0e000000 (32MB MMIO) uncached, 12 | // at 0x8C000000. 13 | 14 | // We also need to map the EFB by BAT. 15 | 16 | // Therefore, we can also map PA 0x08000000-0x08400000 (4MB MMIO) uncached, 17 | // at 0x88000000. 18 | 19 | // This function is used to set DBAT1 and DBAT2 to allow for this. 20 | 21 | LEAF_ENTRY(HalpSetMmioDbat) 22 | LWI(r.7, 0x8800007E) // base at 0x88000000, size = 4MB, kernel mode only 23 | LWI(r.6, 0x0800002A) // phys at 0x08000000, uncached, guarded, readwrite 24 | LWI(r.5, 0x8C0003FE) // base at 0x8C000000, size = 32MB, kernel mode only 25 | LWI(r.4, 0x0C00002A) // phys at 0x0C000000, uncached, guarded, readwrite 26 | // set invalid first just in case 27 | li r.3, 0 28 | mtdbatu 1, r.3 29 | mtdbatu 2, r.3 30 | isync 31 | // set lower part first 32 | mtdbatl 1, r.4 33 | mtdbatl 2, r.6 34 | mtdbatu 1, r.5 35 | mtdbatu 2, r.7 36 | // barrier 37 | isync 38 | LEAF_EXIT(HalpSetMmioDbat) -------------------------------------------------------------------------------- /halartx/source/beep.c: -------------------------------------------------------------------------------- 1 | // Square-wave speaker functions 2 | #include "halp.h" 3 | 4 | // No operation is a valid way to implement this function. 5 | BOOLEAN HalMakeBeep(ULONG Frequency) { 6 | return FALSE; 7 | } -------------------------------------------------------------------------------- /halartx/source/branchstub.s: -------------------------------------------------------------------------------- 1 | // Branch to reset stub. 2 | 3 | #include 4 | 5 | LEAF_ENTRY(HalpBranchToResetStub) 6 | 7 | // Move passed in address to srr0 ready to jump there 8 | mtsrr0 r.3 9 | mfmsr r.3 10 | // disable MSR_ILE 11 | rlwinm r.3, r.3, 0, 16, 14 12 | mtmsr r.3 13 | // disable MSR_LE into srr1 14 | rlwinm r.3, r.3, 0, 0, 30 15 | mtsrr1 r.3 16 | // jump to reset stub. 17 | rfi 18 | 19 | LEAF_EXIT(HalpBranchToResetStub) -------------------------------------------------------------------------------- /halartx/source/drivesup.c: -------------------------------------------------------------------------------- 1 | // Disk partitioning related functions. 2 | #include "halp.h" 3 | #include "bugcodes.h" 4 | 5 | #include "ntddft.h" 6 | #include "ntdddisk.h" 7 | #include "ntdskreg.h" 8 | #include "stdio.h" 9 | #include "string.h" 10 | 11 | ARC_STATUS NvpInitNvram(void); 12 | 13 | VOID 14 | IoAssignDriveLetters( 15 | PLOADER_PARAMETER_BLOCK LoaderBlock, 16 | PSTRING NtDeviceName, 17 | OUT PUCHAR NtSystemPath, 18 | OUT PSTRING NtSystemPathString 19 | ) 20 | 21 | { 22 | 23 | // By this point, we know io is up and running 24 | // So attempt to init NVRAM here, if it hasn't been already 25 | NvpInitNvram(); 26 | 27 | // Just call the kernel implementation 28 | HalIoAssignDriveLetters( 29 | LoaderBlock, 30 | NtDeviceName, 31 | NtSystemPath, 32 | NtSystemPathString 33 | ); 34 | 35 | } 36 | 37 | NTSTATUS 38 | IoReadPartitionTable( 39 | IN PDEVICE_OBJECT DeviceObject, 40 | IN ULONG SectorSize, 41 | IN BOOLEAN ReturnRecognizedPartitions, 42 | OUT PDRIVE_LAYOUT_INFORMATION *PartitionBuffer 43 | ) 44 | 45 | { 46 | // Just call the kernel implementation 47 | 48 | return HalIoReadPartitionTable( 49 | DeviceObject, 50 | SectorSize, 51 | ReturnRecognizedPartitions, 52 | PartitionBuffer 53 | ); 54 | } 55 | 56 | NTSTATUS 57 | IoSetPartitionInformation( 58 | IN PDEVICE_OBJECT DeviceObject, 59 | IN ULONG SectorSize, 60 | IN ULONG PartitionNumber, 61 | IN ULONG PartitionType 62 | ) 63 | 64 | { 65 | // Just call the kernel implementation 66 | 67 | return HalIoSetPartitionInformation( 68 | DeviceObject, 69 | SectorSize, 70 | PartitionNumber, 71 | PartitionType 72 | ); 73 | 74 | } 75 | 76 | NTSTATUS 77 | IoWritePartitionTable( 78 | IN PDEVICE_OBJECT DeviceObject, 79 | IN ULONG SectorSize, 80 | IN ULONG SectorsPerTrack, 81 | IN ULONG NumberOfHeads, 82 | IN PDRIVE_LAYOUT_INFORMATION PartitionBuffer 83 | ) 84 | 85 | { 86 | 87 | // Just call the kernel implementation 88 | return HalIoWritePartitionTable( 89 | DeviceObject, 90 | SectorSize, 91 | SectorsPerTrack, 92 | NumberOfHeads, 93 | PartitionBuffer 94 | ); 95 | } 96 | -------------------------------------------------------------------------------- /halartx/source/exi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "exiapi.h" 3 | 4 | // EXI hardware registers. 5 | 6 | typedef union _EXI_CHANNEL_PARAMETER_REGISTER { 7 | struct { 8 | BOOLEAN DeviceInterruptMask : 1; 9 | BOOLEAN DeviceInterruptStatus : 1; 10 | BOOLEAN TransferInterruptMask : 1; 11 | BOOLEAN TransferInterruptStatus : 1; 12 | EXI_CLOCK_FREQUENCY ClockFrequency : 3; 13 | BOOLEAN ChipSelect0 : 1; 14 | 15 | BOOLEAN ChipSelect1 : 1; 16 | BOOLEAN ChipSelect2 : 1; 17 | BOOLEAN UnplugInterruptMask : 1; 18 | BOOLEAN UnplugInterruptStatus : 1; 19 | BOOLEAN Connected : 1; 20 | BOOLEAN BootromDisable : 1; 21 | }; 22 | ULONG Value; 23 | } EXI_CHANNEL_PARAMETER_REGISTER, *PEXI_CHANNEL_PARAMETER_REGISTER; 24 | 25 | typedef union _EXI_CHANNEL_TRANSFER_REGISTER { 26 | struct { 27 | BOOLEAN Start : 1; 28 | BOOLEAN EnableDma : 1; 29 | EXI_TRANSFER_TYPE Type : 2; 30 | UCHAR Length : 2; // zero = 1 byte, etc. 31 | }; 32 | ULONG Value; 33 | } EXI_CHANNEL_TRANSFER_REGISTER, *PEXI_CHANNEL_TRANSFER_REGISTER; 34 | 35 | typedef struct _EXI_CHANNEL_REGISTERS { 36 | EXI_CHANNEL_PARAMETER_REGISTER Parameter; 37 | ULONG DmaAddress; 38 | ULONG DmaLength; 39 | EXI_CHANNEL_TRANSFER_REGISTER Transfer; 40 | ULONG Data; 41 | } EXI_CHANNEL_REGISTERS, *PEXI_CHANNEL_REGISTERS; 42 | 43 | #if 0 44 | typedef struct { 45 | volatile ULONG Status; 46 | volatile ULONG Address; 47 | volatile ULONG Length; 48 | volatile ULONG Control; 49 | volatile ULONG Data; 50 | } EXI_CHANNEL_REGISTERS, *PEXI_CHANNEL_REGISTERS; 51 | #endif 52 | 53 | typedef struct { 54 | EXI_CHANNEL_REGISTERS Channel[3]; 55 | ULONG Reserved; 56 | ULONG BootVector[(0x80 - 0x40) / 4]; 57 | } EXI_REGISTERS, *PEXI_REGISTERS; 58 | 59 | enum { 60 | EXI_REGISTER_BASE_FLIPPER = 0x0C006800, 61 | EXI_REGISTER_BASE = 0x0D006800 62 | }; -------------------------------------------------------------------------------- /halartx/source/flushbuf.s: -------------------------------------------------------------------------------- 1 | // Implement KeFlushWriteBuffer export 2 | 3 | #include "kxppc.h" 4 | 5 | // KeFlushWriteBuffer: eieio + sync (full memory barrier) 6 | 7 | LEAF_ENTRY(KeFlushWriteBuffer) 8 | 9 | eieio 10 | sync 11 | 12 | LEAF_EXIT(KeFlushWriteBuffer) -------------------------------------------------------------------------------- /halartx/source/flushio.c: -------------------------------------------------------------------------------- 1 | // Cache flushing/etc functions. 2 | #include "halp.h" 3 | 4 | ULONG HalGetDmaAlignmentRequirement(void) { 5 | return 1; 6 | } 7 | 8 | 9 | void HalpSweepPhysicalRange(ULONG Page, ULONG Offset, ULONG Length, BOOLEAN AlsoFlushDcache); 10 | 11 | // Flush the IO buffer from dcache. 12 | void HalFlushIoBuffers(PMDL Mdl, BOOLEAN ReadOperation, BOOLEAN DmaOperation) { 13 | // If it's not a read, then do nothing. 14 | if (ReadOperation == FALSE || (Mdl->MdlFlags & MDL_IO_PAGE_READ) == 0) { 15 | return; 16 | } 17 | 18 | ULONG Length = Mdl->ByteCount; 19 | if (!Length) return; 20 | 21 | BOOLEAN AlsoFlushDcache = DmaOperation == FALSE; 22 | 23 | ULONG Offset = Mdl->ByteOffset; 24 | ULONG PartialLength = PAGE_SIZE - Offset; 25 | if (PartialLength > Length) PartialLength = Length; 26 | 27 | PULONG Page = (PULONG) &Mdl[1]; 28 | 29 | // Sweep the first page. 30 | HalpSweepPhysicalRange(*Page, Offset, PartialLength, AlsoFlushDcache); 31 | Page++; 32 | Length -= PartialLength; 33 | if (Length == 0) return; 34 | 35 | // Additional pages are done without any byte offset. 36 | PartialLength = PAGE_SIZE; 37 | do { 38 | if (PartialLength > Length) PartialLength = Length; 39 | HalpSweepPhysicalRange(*Page, 0, PartialLength, AlsoFlushDcache); 40 | Page++; 41 | Length -= PartialLength; 42 | } while (Length != 0); 43 | } -------------------------------------------------------------------------------- /halartx/source/getexport.c: -------------------------------------------------------------------------------- 1 | #define DEVL 1 2 | #include 3 | #include 4 | 5 | PVOID PeGetExportWithDirectory(PVOID ImageBase, PIMAGE_EXPORT_DIRECTORY Export, const char* ExportName) { 6 | PVOID Ret = NULL; 7 | 8 | ULONG Va = (ULONG)Export - (ULONG)ImageBase; 9 | 10 | BOOLEAN LookUpName = TRUE; 11 | USHORT Ordinal = 0; 12 | if (((ULONG)ExportName & 0xffff0000) == 0) { 13 | LookUpName = FALSE; 14 | Ordinal = (USHORT)(ULONG)ExportName; 15 | } 16 | 17 | if (LookUpName) { 18 | PULONG AddressOfNames = (PULONG)((ULONG)ImageBase + (ULONG)Export->AddressOfNames); 19 | PUSHORT AddressOfNameOrdinals = (PUSHORT)((ULONG)ImageBase + (ULONG)Export->AddressOfNameOrdinals); 20 | for (ULONG i = 0; i < Export->NumberOfNames; i++) { 21 | const char* Name = (const char*)((ULONG)ImageBase + AddressOfNames[i]); 22 | if (!strcmp(Name, ExportName)) { 23 | Ordinal = AddressOfNameOrdinals[i]; 24 | LookUpName = FALSE; 25 | break; 26 | } 27 | } 28 | if (LookUpName) return NULL; 29 | } 30 | 31 | PULONG AddressOfFunctions = (PULONG)((ULONG)ImageBase + (ULONG)Export->AddressOfFunctions); 32 | return (PVOID)((ULONG)ImageBase + AddressOfFunctions[Ordinal]); 33 | } 34 | 35 | PVOID PeGetExport(PVOID ImageBase, const char* ExportName) { 36 | PIMAGE_DOS_HEADER Mz = (PIMAGE_DOS_HEADER)ImageBase; 37 | PIMAGE_NT_HEADERS Pe = (PIMAGE_NT_HEADERS)((ULONG)ImageBase + Mz->e_lfanew); 38 | PIMAGE_DATA_DIRECTORY ExportDir = &Pe->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT]; 39 | 40 | PIMAGE_EXPORT_DIRECTORY Export = (PIMAGE_EXPORT_DIRECTORY) ((ULONG)ImageBase + ExportDir->VirtualAddress); 41 | 42 | return PeGetExportWithDirectory(ImageBase, Export, ExportName); 43 | } -------------------------------------------------------------------------------- /halartx/source/hal.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DLL 6 | #define VER_FILESUBTYPE VFT2_UNKNOWN 7 | #define VER_FILEDESCRIPTION_STR "Hardware Abstraction Layer DLL for ArtX Chipsets" 8 | #define VER_INTERNALNAME_STR "hal.dll" 9 | 10 | #include "common.ver" 11 | 12 | -------------------------------------------------------------------------------- /halartx/source/halasm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // nothing here anymore, leave this around in case this ever becomes useful again 4 | -------------------------------------------------------------------------------- /halartx/source/halpsys.h: -------------------------------------------------------------------------------- 1 | #define BIT(x) (1 << (x)) 2 | 3 | #define __mfspr(spr) \ 4 | ({ ULONG mfsprResult; \ 5 | __asm__ volatile ("mfspr %0, %1" : "=r" (mfsprResult) : "n" (spr)); \ 6 | mfsprResult; }) 7 | 8 | #define __mtspr(spr, value) \ 9 | __asm__ volatile ("mtspr %0, %1" : : "n" (spr), "r" (value)) 10 | 11 | #define SPR_HID0 1008 12 | #define SPR_HID1 1009 13 | #define SPR_HID2 920 14 | #define SPR_HID4 1011 15 | // Espresso extra SPRs that we care about 16 | #define SPR_HID5 944 17 | #define SPR_SCR 947 18 | #define SPR_CAR 948 19 | #define SPR_BCR 949 20 | #define SPR_PIR 1007 21 | 22 | enum { 23 | HID4_SBE = 0x02000000, 24 | 25 | HID5_H5A = 0x80000000, // enable HID5 26 | HID5_PIRE = 0x40000000, // enable PIR 27 | 28 | SCR_IPI_BIT = 18, 29 | SCR_WAKE_BIT = 21, 30 | 31 | SCR_IPI2 = BIT(SCR_IPI_BIT + 0), 32 | SCR_IPI1 = BIT(SCR_IPI_BIT + 1), 33 | SCR_IPI0 = BIT(SCR_IPI_BIT + 2), 34 | SCR_WAKE2 = BIT(SCR_WAKE_BIT + 0), 35 | SCR_WAKE1 = BIT(SCR_WAKE_BIT + 1), 36 | SCR_WAKE0 = BIT(SCR_WAKE_BIT + 2), 37 | }; 38 | 39 | static inline BOOLEAN HalpCpuIsEspresso(void) { 40 | ULONG ProcessorType; 41 | asm volatile("mfpvr %0\n" : "=r" (ProcessorType)); 42 | ProcessorType >>= 16; 43 | return ProcessorType == 0x7001; 44 | } 45 | 46 | static inline BOOLEAN HalpSystemIsCafe(void) { 47 | // Instead of using memory lookups, 48 | // check for CPU = espresso and BCR mask 0x08000000 49 | // This bit hangs the core when in wiimode. 50 | if (!HalpCpuIsEspresso()) return FALSE; 51 | return (__mfspr(SPR_BCR) & 0x08000000) != 0; 52 | } -------------------------------------------------------------------------------- /halartx/source/hpt.c: -------------------------------------------------------------------------------- 1 | #include "halp.h" 2 | 3 | typedef struct _LDR_DATA_TABLE_ENTRY { 4 | LIST_ENTRY InLoadOrderLinks; 5 | LIST_ENTRY InMemoryOrderLinks; 6 | LIST_ENTRY InInitializationOrderLinks; 7 | PVOID DllBase; 8 | PVOID EntryPoint; 9 | ULONG SizeOfImage; 10 | // ... 11 | } LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY; 12 | 13 | PVOID PeGetExport(PVOID ImageBase, const char* ExportName); 14 | 15 | typedef void (*tfpMmAllocateHPT)(ULONG Size, PLOADER_PARAMETER_BLOCK LoaderBlock); 16 | static volatile ULONG s_HashPageTables = 0; 17 | 18 | #define __mtspr(spr, value) \ 19 | __asm__ volatile ("mtspr %0, %1" : : "n" (spr), "r" (value)) 20 | 21 | // NT 3.51 init calls this function to initialise hashed page tables. 22 | // NT 4 does this in the kernel itself. 23 | NTHALAPI VOID HalInitializeHPT(IN ULONG ProcessorNumber, IN PLOADER_PARAMETER_BLOCK LoaderBlock) { 24 | // We need to import some functions. 25 | // Those functions are gone in NT4, so we can't just link with the implib. 26 | // We have LOADER_PARAMETER_BLOCK so we can walk through loaded binaries. 27 | // first one in load order should well be kernel. 28 | 29 | if (ProcessorNumber == 0) { 30 | 31 | PLDR_DATA_TABLE_ENTRY Entry = (PLDR_DATA_TABLE_ENTRY) 32 | LoaderBlock->LoadOrderListHead.Flink; 33 | PVOID ImageBase = Entry->DllBase; 34 | 35 | tfpMmAllocateHPT MmAllocateHPT = (tfpMmAllocateHPT) 36 | PeGetExport(ImageBase, "MmAllocateHPT"); 37 | 38 | if (MmAllocateHPT == NULL) KeBugCheck(MISMATCHED_HAL); 39 | // Work around compiler bug 40 | asm volatile(""); 41 | 42 | MmAllocateHPT(0x10000, LoaderBlock); 43 | LoaderBlock->u.Ppc.NumberCongruenceClasses = 64; 44 | 45 | // This is NT 3.51. Put some stuff in the PCR(?). 46 | ULONG PcrMaybe; 47 | asm volatile("mfsprg %0, 1\n" : "=r" (PcrMaybe)); 48 | *(PULONG)(PcrMaybe + 0x484) = 0x8000; 49 | *(PULONG)(PcrMaybe + 0x48c) = 0x8000; 50 | *(PULONG)(PcrMaybe + 0x4AC) = 31; 51 | *(PULONG)(PcrMaybe + 0x4B4) = 31; 52 | 53 | s_HashPageTables = LoaderBlock->u.Ppc.HashedPageTable; 54 | } else { 55 | // Spin until first processor allocates the HPTs. 56 | while (s_HashPageTables == 0) { } 57 | } 58 | 59 | // set SDR1 60 | __mtspr(25, s_HashPageTables); 61 | } -------------------------------------------------------------------------------- /halartx/source/idle.s: -------------------------------------------------------------------------------- 1 | // Function called where nothing else needs to be done until next interrupt. 2 | #include "kxppc.h" 3 | #include "halasm.h" 4 | 5 | .set HID0, 1008 6 | 7 | LEAF_ENTRY(HalProcessorIdle) 8 | 9 | mfmsr r.4 10 | ori r.4, r.4, 0x8000 // enable interrupts (MSR[EE]) 11 | 12 | mfspr r.3, HID0 13 | ori r.3, r.3, 0x0080 // enable doze mode 14 | mtspr HID0, r.3 15 | 16 | oris r.4, r.4, 0x0004 // enable power management (MSR[POW]) 17 | sync 18 | mtmsr r.4 19 | isync 20 | 21 | LEAF_EXIT(HalpProcessorIdle) 22 | -------------------------------------------------------------------------------- /halartx/source/ints.inc: -------------------------------------------------------------------------------- 1 | 2 | INTERRUPT_DEFINE(ERROR, 0) 3 | INTERRUPT_DEFINE(RESET, 1) 4 | INTERRUPT_DEFINE(DVD, 2) 5 | INTERRUPT_DEFINE(SERIAL, 3) 6 | INTERRUPT_DEFINE(EXI, 4) 7 | INTERRUPT_DEFINE(AI, 5) 8 | INTERRUPT_DEFINE(DSP, 6) 9 | INTERRUPT_DEFINE(MEM, 7) 10 | INTERRUPT_DEFINE(VI, 8) 11 | INTERRUPT_DEFINE(PE_TOKEN, 9) 12 | INTERRUPT_DEFINE(PE_FINISH, 10) 13 | INTERRUPT_DEFINE(CP_FIFO, 11) 14 | INTERRUPT_DEFINE(DEBUG, 12) 15 | INTERRUPT_DEFINE(HIGHSPEED_PORT, 13) 16 | INTERRUPT_DEFINE(VEGAS, 14) 17 | INTERRUPT_DEFINE(RESERVED15, 15) 18 | INTERRUPT_DEFINE(RESERVED16, 16) 19 | INTERRUPT_DEFINE(RVL_MAX, 16) 20 | 21 | INTERRUPT_DEFINE(CAFE_CP_FIFO0, 17) 22 | INTERRUPT_DEFINE(CAFE_CP_FIFO1, 18) 23 | INTERRUPT_DEFINE(CAFE_CP_FIFO2, 19) 24 | INTERRUPT_DEFINE(CAFE_MB_CPU0, 20) 25 | INTERRUPT_DEFINE(CAFE_MB_CPU1, 21) 26 | INTERRUPT_DEFINE(CAFE_MB_CPU2, 22) 27 | INTERRUPT_DEFINE(CAFE_GPU7, 23) 28 | INTERRUPT_DEFINE(CAFE_LATTE, 24) 29 | INTERRUPT_DEFINE(CAFE_MAX, 24) -------------------------------------------------------------------------------- /halartx/source/ioserr.inc: -------------------------------------------------------------------------------- 1 | 2 | IOSERROR_DEFINE(0, STATUS_SUCCESS) // success 3 | IOSERROR_DEFINE(1,STATUS_ACCESS_DENIED) // access 4 | IOSERROR_DEFINE(2,STATUS_OBJECT_NAME_COLLISION) // exists 5 | IOSERROR_DEFINE(3,STATUS_CANCELLED) // intr 6 | IOSERROR_DEFINE(4,STATUS_INVALID_PARAMETER) // invalid 7 | IOSERROR_DEFINE(5,STATUS_INSUFFICIENT_RESOURCES) // max 8 | IOSERROR_DEFINE(6,STATUS_OBJECT_NAME_NOT_FOUND) // noexists 9 | IOSERROR_DEFINE(7,STATUS_TIMEOUT) // queue_empty 10 | IOSERROR_DEFINE(8,STATUS_TIMEOUT) // queue_full 11 | IOSERROR_DEFINE(9,STATUS_UNSUCCESSFUL) // unknown 12 | IOSERROR_DEFINE(10,STATUS_DEVICE_NOT_CONNECTED) // (USB) not ready 13 | IOSERROR_DEFINE(11,STATUS_FT_READ_RECOVERY_FROM_BACKUP) // ECC (single bit error recovered) 14 | IOSERROR_DEFINE(12,STATUS_CRC_ERROR) // ECC critical (mult-bit error) 15 | IOSERROR_DEFINE(13,STATUS_DEVICE_DATA_ERROR) // bad block 16 | IOSERROR_DEFINE(14,STATUS_OBJECT_TYPE_MISMATCH) // invalid_objtype 17 | IOSERROR_DEFINE(15,STATUS_UNSUCCESSFUL) // invalid rng 18 | IOSERROR_DEFINE(16,STATUS_UNSUCCESSFUL) // invalid flag 19 | IOSERROR_DEFINE(17,STATUS_UNSUCCESSFUL) // invalid format 20 | IOSERROR_DEFINE(18,STATUS_UNSUCCESSFUL) // invalid version 21 | IOSERROR_DEFINE(19,STATUS_UNSUCCESSFUL) // invalid signer 22 | IOSERROR_DEFINE(20,0xC0000428) // checkvalue (hash invalid) INVALID_IMAGE_HASH isn't here this early, just use the raw value of that 23 | IOSERROR_DEFINE(21,STATUS_UNSUCCESSFUL) // fail internal 24 | IOSERROR_DEFINE(22,STATUS_NO_MEMORY) // fail alloc 25 | IOSERROR_DEFINE(23,STATUS_INVALID_BUFFER_SIZE) // invalid size -------------------------------------------------------------------------------- /halartx/source/iosp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ios.h" -------------------------------------------------------------------------------- /halartx/source/map.c: -------------------------------------------------------------------------------- 1 | // Map all needed MMIO after memory manager init. 2 | 3 | #include "halp.h" 4 | 5 | BOOLEAN HalpMapInterruptRegs(void); 6 | BOOLEAN HalpMapExiRegs(void); 7 | void HalpTermInit(void); 8 | BOOLEAN HalpInitializeDisplay1(void); 9 | 10 | BOOLEAN HalpMapIoSpace(void) { 11 | if (!HalpMapInterruptRegs()) return FALSE; 12 | if (!HalpMapExiRegs()) return FALSE; 13 | HalpTermInit(); 14 | if (!HalpInitializeDisplay1()) return FALSE; 15 | return TRUE; 16 | } -------------------------------------------------------------------------------- /halartx/source/procreset.s: -------------------------------------------------------------------------------- 1 | // Initialise other processor coming out of reset. 2 | 3 | #include 4 | 5 | .text 6 | .align 2 7 | .globl HalpProcessorReset 8 | HalpProcessorReset: 9 | // Write to HW_VISOLID (a value without bit 0 set so it doesn't enable it) 10 | // to tell CPU 0 that this processor is running. 11 | lis r.6, 0x0d80 12 | stw r.6, 0x20(r.6) // 0x24 swizzle for 32-bit == 0x24 ^ 4 == 0x20 13 | sync 14 | 15 | // Set HID0 16 | lis r.6, 0x0011 17 | ori r.6, r.6, 0x0024 18 | mtspr 1008, r.6 19 | // set HID4 20 | lis r.6, 0xb1b0 21 | mtspr 1011, r.6 22 | sync 23 | // set HID5 24 | lis r.6, 0xE7FD 25 | ori r.6, r.6, 0xC000 26 | mtspr 944, r.6 27 | sync 28 | // enable caches 29 | lis r.6, 0x0011 30 | ori r.6, r.6, 0xC024 31 | mtspr 1008, r.6 32 | 33 | isync 34 | 35 | 36 | // Initialise unused registers. r1 to r6 all got set by the code at the boot vector. 37 | li r.0, 0 38 | li r.7, 0 39 | li r.8, 0 40 | li r.9, 0 41 | li r.10, 0 42 | li r.11, 0 43 | li r.12, 0 44 | li r.13, 0 45 | li r.14, 0 46 | li r.16, 0 47 | li r.17, 0 48 | li r.18, 0 49 | li r.19, 0 50 | li r.20, 0 51 | li r.21, 0 52 | li r.22, 0 53 | li r.23, 0 54 | li r.24, 0 55 | li r.25, 0 56 | li r.26, 0 57 | li r.27, 0 58 | li r.28, 0 59 | li r.29, 0 60 | li r.30, 0 61 | li r.31, 0 62 | 63 | // set MSR_ILE 64 | mfmsr r.6 65 | oris r.6, r.6, 1 66 | mtmsr r.6 67 | isync 68 | 69 | // Long jump to kernel init. 70 | mtsrr0 r.2 71 | mtsrr1 r.5 72 | rfi -------------------------------------------------------------------------------- /halartx/source/profile.c: -------------------------------------------------------------------------------- 1 | // Profiler exports. 2 | // We can't implement a profiler due to not having another timing source 3 | // (Vegas timer is for IOP) 4 | 5 | #include "halp.h" 6 | 7 | void HalStartProfileInterrupt(KPROFILE_SOURCE ProfileSource) { 8 | } 9 | 10 | ULONG HalSetProfileInterval(ULONG Interval) { 11 | return 0; 12 | } 13 | 14 | void HalStopProfileInterrupt(KPROFILE_SOURCE ProfileSource) { 15 | } 16 | 17 | void HalCalibratePerformanceCounter(volatile PLONG Number) { 18 | // Raise IRQL to HIGH_LEVEL 19 | KSPIN_LOCK Lock; 20 | KIRQL OldIrql; 21 | 22 | KeInitializeSpinLock(&Lock); 23 | KeRaiseIrql(HIGH_LEVEL, &OldIrql); 24 | 25 | // Decrement the number of processors, and wait until that same number is zero. 26 | if (ExInterlockedDecrementLong(Number, &Lock) != RESULT_ZERO) { 27 | while (*Number != 0) { } 28 | } 29 | 30 | // Zero the performance counters. 31 | HalpZeroPerformanceCounter(); 32 | 33 | // Restore IRQL. 34 | KeLowerIrql(OldIrql); 35 | } -------------------------------------------------------------------------------- /halartx/source/pxiheap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct _PXI_HEAP_CHUNK { 4 | ULONG Status; 5 | ULONG Size; 6 | struct _PXI_HEAP_CHUNK 7 | * Previous, * Next; 8 | } PXI_HEAP_CHUNK, *PPXI_HEAP_CHUNK; 9 | 10 | typedef struct _PXI_HEAP { 11 | PVOID Base; 12 | ULONG Size; 13 | PPXI_HEAP_CHUNK FreeList; 14 | KSPIN_LOCK SpinLock; 15 | BOOLEAN Initialised; 16 | } PXI_HEAP, *PPXI_HEAP; 17 | 18 | 19 | BOOLEAN PhCreate(PPXI_HEAP Heap, PVOID Ptr, ULONG Size); 20 | void PhDelete(PPXI_HEAP Heap); 21 | PVOID PhAlloc(PPXI_HEAP Heap, ULONG Size); 22 | PVOID PhAllocAligned(PPXI_HEAP Heap, ULONG Size, ULONG Alignment); 23 | void PhFree(PPXI_HEAP Heap, PVOID Ptr); -------------------------------------------------------------------------------- /halartx/source/x86bios.c: -------------------------------------------------------------------------------- 1 | // Stub for an x86 emulator, needed for devices with MCS-86 option ROMs. 2 | // (which Flipper/Vegas/Latte systems have none of) 3 | 4 | #include "halp.h" 5 | 6 | BOOLEAN 7 | HalCallBios ( 8 | IN ULONG BiosCommand, 9 | IN OUT PULONG Eax, 10 | IN OUT PULONG Ebx, 11 | IN OUT PULONG Ecx, 12 | IN OUT PULONG Edx, 13 | IN OUT PULONG Esi, 14 | IN OUT PULONG Edi, 15 | IN OUT PULONG Ebp 16 | ) { 17 | return FALSE; 18 | } -------------------------------------------------------------------------------- /inc/hwdesc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | enum { // FPF = "Flipper Flag" 4 | FPF_IN_EMULATOR = ARC_BIT(0), // System is Dolphin emulator 5 | FPF_IS_VEGAS = ARC_BIT(1), // System is Vegas (RVL) 6 | FPF_IS_LATTE = ARC_BIT(2), // System is Latte (Cafe) 7 | }; 8 | 9 | typedef struct _HW_DESCRIPTION { 10 | ULONG MemoryLength[2]; // Length of physical memory. (Splash/Napa, DDR) 11 | ULONG DdrIpcBase, DdrIpcLength; // Start and length of IOS IPC buffer in DDR 12 | ULONG DecrementerFrequency; // Decrementer frequency. 13 | ULONG RtcBias; // RTC counter bias. 14 | ULONG FpFlags; // FPF_* bit flags. 15 | 16 | // Framebuffer details. 17 | ULONG FrameBufferBase; // Base address of frame buffer. 18 | ULONG FrameBufferLength; // Length of frame buffer in video RAM. 19 | ULONG FrameBufferWidth; // Display width 20 | ULONG FrameBufferHeight; // Display height 21 | ULONG FrameBufferStride; // Number of bytes per line. 22 | 23 | // GX FIFO memory. 24 | ULONG GxFifoBase; // Base address of GX FIFO (length is 64KB) 25 | 26 | ULONG Padding; 27 | } HW_DESCRIPTION, *PHW_DESCRIPTION; 28 | 29 | _Static_assert((sizeof(HW_DESCRIPTION) % sizeof(unsigned long long)) == 0); 30 | -------------------------------------------------------------------------------- /iossdmcdrv/source/iossdmc.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DRV 6 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 7 | #define VER_FILEDESCRIPTION_STR "Vegas SDMC (via IOS) Disk Emulation Driver" 8 | #define VER_INTERNALNAME_STR "iossdmc.sys" 9 | #define VER_ORIGINALFILENAME_STR "iossdmc.sys" 10 | 11 | #include "common.ver" 12 | 13 | -------------------------------------------------------------------------------- /iossdmcdrv/source/sdmcraw.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct _SDMC_SECTOR_TRANSFER { 4 | ULONG SectorStart; 5 | ULONG SectorCount; 6 | } SDMC_SECTOR_TRANSFER, *PSDMC_SECTOR_TRANSFER; 7 | 8 | #define FILE_DEVICE_SDMCRAW (0x5D10 | 0x8000) 9 | #define IOCTL_SDMC_SECTOR_READ CTL_CODE(FILE_DEVICE_SDMCRAW, 0x800, METHOD_BUFFERED, FILE_READ_DATA) 10 | #define IOCTL_SDMC_SECTOR_WRITE CTL_CODE(FILE_DEVICE_SDMCRAW, 0x801, METHOD_BUFFERED, FILE_WRITE_DATA) 11 | 12 | NTSTATUS SdmcRawDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp); 13 | 14 | -------------------------------------------------------------------------------- /iosusbdrv/source/asynctimer.c: -------------------------------------------------------------------------------- 1 | #define DEVL 1 2 | #include 3 | #include "asynctimer.h" 4 | 5 | #define MS_TO_TIMEOUT(ms) ((ms) * 10000) 6 | 7 | void AsyncTimerSet(PKTIMER Timer, PRKDPC Dpc) { 8 | LARGE_INTEGER DueTime; 9 | DueTime.QuadPart = -MS_TO_TIMEOUT(10); 10 | KeSetTimer(Timer, DueTime, Dpc); 11 | } -------------------------------------------------------------------------------- /iosusbdrv/source/asynctimer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void AsyncTimerSet(PKTIMER Timer, PRKDPC Dpc); -------------------------------------------------------------------------------- /iosusbdrv/source/iosusb.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DRV 6 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 7 | #define VER_FILEDESCRIPTION_STR "Vegas USB (via IOS) HID and Mass Storage Driver" 8 | #define VER_INTERNALNAME_STR "iosusb.sys" 9 | #define VER_ORIGINALFILENAME_STR "iosusb.sys" 10 | 11 | #include "common.ver" 12 | 13 | -------------------------------------------------------------------------------- /iosusbdrv/source/iosusbkbd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "keyboard.h" 3 | 4 | enum { 5 | USBKBD_IOCTL_READEVENT = 0 6 | }; 7 | 8 | typedef enum { 9 | KEYBOARD_ATTACH, 10 | KEYBOARD_DETACH, 11 | KEYBOARD_EVENT 12 | } IOSUSBKBDType; 13 | 14 | typedef struct ARC_BE { 15 | ULONG type; 16 | ULONG id; 17 | USB_KBD_REPORT report; 18 | } IOSUSBKBDEvent; 19 | 20 | typedef struct { 21 | UCHAR Padding[3]; 22 | UCHAR LedState; 23 | ULONG id; 24 | } IOSUSBKBDLed; 25 | 26 | #define KBD_LED_SIZEOF (sizeof(IOSUSBKBDLed) - __builtin_offsetof(IOSUSBKBDLed, LedState)) 27 | 28 | NTSTATUS IukInit(void); -------------------------------------------------------------------------------- /iosusbdrv/source/keyboard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "runtime.h" 3 | 4 | typedef struct ARC_BE { 5 | UCHAR Modifiers; 6 | UCHAR Reserved; 7 | UCHAR KeyCode[6]; 8 | } USB_KBD_REPORT, *PUSB_KBD_REPORT; 9 | 10 | enum { 11 | KEY_MODIFIER_LCTRL = BIT(0), 12 | KEY_MODIFIER_LSHIFT = BIT(1), 13 | KEY_MODIFIER_LALT = BIT(2), 14 | KEY_MODIFIER_LWIN = BIT(3), 15 | KEY_MODIFIER_RCTRL = BIT(4), 16 | KEY_MODIFIER_RSHIFT = BIT(5), 17 | KEY_MODIFIER_RALT = BIT(6), 18 | KEY_MODIFIER_RWIN = BIT(7), 19 | 20 | KEY_MODIFIER_CTRL = KEY_MODIFIER_LCTRL | KEY_MODIFIER_RCTRL, 21 | KEY_MODIFIER_SHIFT = KEY_MODIFIER_LSHIFT | KEY_MODIFIER_RSHIFT, 22 | KEY_MODIFIER_ALT = KEY_MODIFIER_LALT | KEY_MODIFIER_RALT, 23 | KEY_MODIFIER_WIN = KEY_MODIFIER_LWIN | KEY_MODIFIER_RWIN 24 | }; 25 | 26 | enum { 27 | KEY_ERROR_OVF = 1 28 | }; 29 | 30 | // Keyboard device object. 31 | extern PDEVICE_OBJECT KbdDeviceObject; 32 | 33 | // Set keyboard LEDs (IOS /dev/usb/kbd) 34 | NTSTATUS IukSetLeds(UCHAR Indicators); 35 | // Set keyboard LEDs (IOS USBv5 low-level) 36 | NTSTATUS UlkSetLeds(UCHAR Indicators); 37 | 38 | // Called from lower-level driver when keyboard input data read complete. 39 | void KbdReadComplete(PUSB_KBD_REPORT Report); 40 | 41 | // USB keyboard ioctl implementation... 42 | NTSTATUS KbdIoctl(PDEVICE_OBJECT Device, PIRP Irp); 43 | 44 | // Initialise USB keyboard driver. 45 | NTSTATUS KbdInit(PDRIVER_OBJECT Driver, PUNICODE_STRING RegistryPath); -------------------------------------------------------------------------------- /iosusbdrv/source/mouse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct _USB_MOUSE_REPORT { 4 | UCHAR Buttons; 5 | signed char X; 6 | signed char Y; 7 | signed char Wheel; 8 | UCHAR Padding[0x1C]; 9 | } USB_MOUSE_REPORT, *PUSB_MOUSE_REPORT; 10 | _Static_assert(sizeof(USB_MOUSE_REPORT) == 0x20); 11 | 12 | // Mouse device object. 13 | extern PDEVICE_OBJECT MouDeviceObject; 14 | 15 | // Called from lower-level driver when mouse input data read complete. 16 | void MouReadComplete(PUSB_MOUSE_REPORT Report, UCHAR Length); 17 | 18 | // USB mouse ioctl implementation 19 | NTSTATUS MouIoctl(PDEVICE_OBJECT Device, PIRP Irp); 20 | 21 | // Initialise USB mouse driver. 22 | NTSTATUS MouInit(PDRIVER_OBJECT Driver, PUNICODE_STRING RegistryPath); -------------------------------------------------------------------------------- /iosusbdrv/source/usbkbd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | NTSTATUS IukInit(void); 4 | -------------------------------------------------------------------------------- /iosusbdrv/source/usblowkbd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | NTSTATUS UlkInit(void); -------------------------------------------------------------------------------- /iosusbdrv/source/usblowmou.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | NTSTATUS UlmInit(void); -------------------------------------------------------------------------------- /iosusbdrv/source/usblowms.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | NTSTATUS UlmsInit(PDRIVER_OBJECT DriverObject); -------------------------------------------------------------------------------- /lib/dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/lib/dummy -------------------------------------------------------------------------------- /msvc-ppc/bin/c1_ppc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/c1_ppc.dll -------------------------------------------------------------------------------- /msvc-ppc/bin/clppc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/clppc.exe -------------------------------------------------------------------------------- /msvc-ppc/bin/cvtres.err: -------------------------------------------------------------------------------- 1 | 1100 "ERR_DUPLICATE_RESOURCE" 2 | 1101 "cannot open %s for reading" 3 | 1102 "out of memory; %u bytes required" 4 | 1103 "cannot read file" 5 | 1104 "cannot get location in file" 6 | 1105 "cannot seek in file" 7 | 1106 "cannot write to file" 8 | 1107 "%s is corrupt" 9 | 1108 "cannot open %s for writing" 10 | 2000 "duplicate resource -- type:%S,%c" 11 | 2001 "duplicate resource -- type:%s,%c" 12 | 2002 "duplicate resource -- type:%ld,%c" 13 | 2003 "name:%S, language:0x%.4x\n" 14 | 2004 "name:%ld, language:0x%.4x\n" 15 | 4001 "machine type not specified; assumed %s" 16 | 5001 "adding resource -- type:%S,%c" 17 | 5002 "adding resource -- type:%s,%c" 18 | 5003 "adding resource -- type:%ld,%c" 19 | 5004 "name:%S,%c" 20 | 5005 "name:%ld,%c" 21 | 5006 "language:%x, flags:%x, size:%ld\n" 22 | 8001 "CVTRES : fatal error CVT%04d:%c" 23 | 8002 "CVTRES : warning CVT%04d:%c" 24 | 8003 "Microsoft (R) Windows Resource To Object Converter Version %s\n" 25 | 8004 "Copyright (C) Microsoft Corp 1992-1995. All rights reserved.\n" 26 | -------------------------------------------------------------------------------- /msvc-ppc/bin/cvtres.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/cvtres.exe -------------------------------------------------------------------------------- /msvc-ppc/bin/lib.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/lib.exe -------------------------------------------------------------------------------- /msvc-ppc/bin/link.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/link.exe -------------------------------------------------------------------------------- /msvc-ppc/bin/mspdb40.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/mspdb40.dll -------------------------------------------------------------------------------- /msvc-ppc/bin/mspdb41.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/mspdb41.dll -------------------------------------------------------------------------------- /msvc-ppc/bin/mspdb50.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/mspdb50.dll -------------------------------------------------------------------------------- /msvc-ppc/bin/mspdb60.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/mspdb60.dll -------------------------------------------------------------------------------- /msvc-ppc/bin/pasm.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/pasm.exe -------------------------------------------------------------------------------- /msvc-ppc/bin/rc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/rc.exe -------------------------------------------------------------------------------- /msvc-ppc/bin/rc.hlp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/rc.hlp -------------------------------------------------------------------------------- /msvc-ppc/bin/rcdll.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/rcdll.dll -------------------------------------------------------------------------------- /msvc-ppc/bin/rcxdti.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/rcxdti.dll -------------------------------------------------------------------------------- /msvc-ppc/bin/splitsym.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/msvc-ppc/bin/splitsym.exe -------------------------------------------------------------------------------- /nt4/crt/assert.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *assert.h - define the assert macro 3 | * 4 | * Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * Defines the assert(exp) macro. 8 | * [ANSI/System V] 9 | * 10 | * [Public] 11 | * 12 | ****/ 13 | 14 | #if !defined(_WIN32) && !defined(_MAC) 15 | #error ERROR: Only Mac or Win32 targets supported! 16 | #endif 17 | 18 | 19 | 20 | /* Define _CRTAPI1 (for compatibility with the NT SDK) */ 21 | 22 | #ifndef _CRTAPI1 23 | #if _MSC_VER >= 800 && _M_IX86 >= 300 24 | #define _CRTAPI1 __cdecl 25 | #else 26 | #define _CRTAPI1 27 | #endif 28 | #endif 29 | 30 | 31 | /* Define _CRTAPI2 (for compatibility with the NT SDK) */ 32 | 33 | #ifndef _CRTAPI2 34 | #if _MSC_VER >= 800 && _M_IX86 >= 300 35 | #define _CRTAPI2 __cdecl 36 | #else 37 | #define _CRTAPI2 38 | #endif 39 | #endif 40 | 41 | 42 | /* Define _CRTIMP */ 43 | 44 | #ifndef _CRTIMP 45 | #ifdef _NTSDK 46 | /* definition compatible with NT SDK */ 47 | #define _CRTIMP 48 | #else /* ndef _NTSDK */ 49 | /* current definition */ 50 | #ifdef _DLL 51 | #define _CRTIMP __declspec(dllimport) 52 | #else /* ndef _DLL */ 53 | #define _CRTIMP 54 | #endif /* _DLL */ 55 | #endif /* _NTSDK */ 56 | #endif /* _CRTIMP */ 57 | 58 | 59 | /* Define __cdecl for non-Microsoft compilers */ 60 | 61 | #if ( !defined(_MSC_VER) && !defined(__cdecl) ) 62 | #define __cdecl 63 | #endif 64 | 65 | 66 | #undef assert 67 | 68 | #ifdef NDEBUG 69 | 70 | #define assert(exp) ((void)0) 71 | 72 | #else 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | _CRTIMP void __cdecl _assert(void *, void *, unsigned); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) ) 85 | 86 | #endif /* NDEBUG */ 87 | -------------------------------------------------------------------------------- /nt4/crt/setjmpex.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *setjmpex.h - definitions/declarations for extended setjmp/longjmp routines 3 | * 4 | * Copyright (c) 1993-1995, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * This file causes _setjmpex to be called which will enable safe 8 | * setjmp/longjmp that work correctly with try/except/finally. 9 | * 10 | * [Public] 11 | * 12 | ****/ 13 | 14 | #if _MSC_VER > 1000 15 | #pragma once 16 | #endif 17 | 18 | #ifndef _INC_SETJMPEX 19 | #define _INC_SETJMPEX 20 | 21 | #if !defined(_WIN32) && !defined(_MAC) 22 | #error ERROR: Only Mac or Win32 targets supported! 23 | #endif 24 | 25 | 26 | /* 27 | * Definitions specific to particular setjmp implementations. 28 | */ 29 | 30 | #if defined(_M_IX86) 31 | 32 | /* 33 | * MS compiler for x86 34 | */ 35 | 36 | #define setjmp _setjmp 37 | #define longjmp _longjmpex 38 | 39 | #else 40 | 41 | #define setjmp _setjmpex 42 | 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* _INC_SETJMPEX */ 48 | -------------------------------------------------------------------------------- /nt4/crt/share.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *share.h - defines file sharing modes for sopen 3 | * 4 | * Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * This file defines the file sharing modes for sopen(). 8 | * 9 | * [Public] 10 | * 11 | ****/ 12 | 13 | #if _MSC_VER > 1000 14 | #pragma once 15 | #endif 16 | 17 | #ifndef _INC_SHARE 18 | #define _INC_SHARE 19 | 20 | #if !defined(_WIN32) && !defined(_MAC) 21 | #error ERROR: Only Mac or Win32 targets supported! 22 | #endif 23 | 24 | 25 | #define _SH_DENYRW 0x10 /* deny read/write mode */ 26 | #define _SH_DENYWR 0x20 /* deny write mode */ 27 | #define _SH_DENYRD 0x30 /* deny read mode */ 28 | #define _SH_DENYNO 0x40 /* deny none mode */ 29 | 30 | #if !__STDC__ 31 | /* Non-ANSI names for compatibility */ 32 | #define SH_DENYRW _SH_DENYRW 33 | #define SH_DENYWR _SH_DENYWR 34 | #define SH_DENYRD _SH_DENYRD 35 | #define SH_DENYNO _SH_DENYNO 36 | #endif 37 | 38 | #endif /* _INC_SHARE */ 39 | -------------------------------------------------------------------------------- /nt4/crt/stdexcpt.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *stdexcpt.h - User include file for standard exception classes 3 | * 4 | * Copyright (c) 1994-1995, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * This file presents an interface to the standard exception classes, 8 | * as specified by the ANSI X3J16/ISO SC22/WG21 Working Paper for 9 | * Draft C++, May 1994. 10 | * 11 | * [Public] 12 | * 13 | ****/ 14 | 15 | #if _MSC_VER > 1000 16 | #pragma once 17 | #endif 18 | 19 | #ifndef _INC_STDEXCPT 20 | #define _INC_STDEXCPT 21 | 22 | #if !defined(_WIN32) && !defined(_MAC) 23 | #error ERROR: Only Mac or Win32 targets supported! 24 | #endif 25 | 26 | 27 | #ifndef _CRTIMP 28 | #ifdef _NTSDK 29 | /* definition compatible with NT SDK */ 30 | #define _CRTIMP 31 | #else /* ndef _NTSDK */ 32 | /* current definition */ 33 | #ifdef _DLL 34 | #define _CRTIMP __declspec(dllimport) 35 | #else /* ndef _DLL */ 36 | #define _CRTIMP 37 | #endif /* _DLL */ 38 | #endif /* _NTSDK */ 39 | #endif /* _CRTIMP */ 40 | 41 | #ifndef _SIZE_T_DEFINED 42 | typedef unsigned int size_t; 43 | #define _SIZE_T_DEFINED 44 | #endif 45 | 46 | 47 | // 48 | // Standard exception class heirarchy (ref. 1/94 WP 17.3.2.1, as ammended 3/94). 49 | // 50 | // exception (formerly xmsg) 51 | // logic 52 | // domain 53 | // runtime 54 | // range 55 | // alloc 56 | // xalloc 57 | // 58 | // Updated as per May'94 Working Paper 59 | 60 | typedef const char *__exString; 61 | 62 | class _CRTIMP exception 63 | { 64 | public: 65 | exception(); 66 | exception(const __exString&); 67 | exception(const exception&); 68 | exception& operator= (const exception&); 69 | virtual ~exception(); 70 | virtual __exString what() const; 71 | private: 72 | __exString _m_what; 73 | int _m_doFree; 74 | }; 75 | 76 | #ifdef __RTTI_OLDNAMES 77 | typedef exception xmsg; // A synonym for folks using older standard 78 | #endif 79 | 80 | // 81 | // logic_error 82 | // 83 | class _CRTIMP logic_error: public exception 84 | { 85 | public: 86 | logic_error (const __exString& _what_arg) : exception(_what_arg) {} 87 | }; 88 | 89 | #endif /* _INC_STDEXCPT */ 90 | 91 | -------------------------------------------------------------------------------- /nt4/crt/sys/locking.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *sys/locking.h - flags for locking() function 3 | * 4 | * Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * This file defines the flags for the locking() function. 8 | * [System V] 9 | * 10 | * [Public] 11 | * 12 | ****/ 13 | 14 | #if _MSC_VER > 1000 15 | #pragma once 16 | #endif 17 | 18 | #ifndef _INC_LOCKING 19 | #define _INC_LOCKING 20 | 21 | #if !defined(_WIN32) && !defined(_MAC) 22 | #error ERROR: Only Mac or Win32 targets supported! 23 | #endif 24 | 25 | 26 | #define _LK_UNLCK 0 /* unlock the file region */ 27 | #ifdef _WIN32 28 | #define _LK_LOCK 1 /* lock the file region */ 29 | #endif 30 | #define _LK_NBLCK 2 /* non-blocking lock */ 31 | #ifdef _WIN32 32 | #define _LK_RLCK 3 /* lock for writing */ 33 | #endif 34 | #define _LK_NBRLCK 4 /* non-blocking lock for writing */ 35 | 36 | #if !__STDC__ 37 | /* Non-ANSI names for compatibility */ 38 | #define LK_UNLCK _LK_UNLCK 39 | #ifdef _WIN32 40 | #define LK_LOCK _LK_LOCK 41 | #endif 42 | #define LK_NBLCK _LK_NBLCK 43 | #ifdef _WIN32 44 | #define LK_RLCK _LK_RLCK 45 | #endif 46 | #define LK_NBRLCK _LK_NBRLCK 47 | #endif 48 | 49 | #endif /* _INC_LOCKING */ 50 | -------------------------------------------------------------------------------- /nt4/crt/sys/types.h: -------------------------------------------------------------------------------- 1 | /*** 2 | *sys/types.h - types returned by system level calls for file and time info 3 | * 4 | * Copyright (c) 1985-1995, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * This file defines types used in defining values returned by system 8 | * level calls for file status and time information. 9 | * [System V] 10 | * 11 | * [Public] 12 | * 13 | ****/ 14 | 15 | #if _MSC_VER > 1000 16 | #pragma once 17 | #endif 18 | 19 | #ifndef _INC_TYPES 20 | #define _INC_TYPES 21 | 22 | #if !defined(_WIN32) && !defined(_MAC) 23 | #error ERROR: Only Mac or Win32 targets supported! 24 | #endif 25 | 26 | 27 | #ifndef _TIME_T_DEFINED 28 | typedef long time_t; 29 | #define _TIME_T_DEFINED 30 | #endif 31 | 32 | 33 | #ifndef _INO_T_DEFINED 34 | 35 | typedef unsigned short _ino_t; /* i-node number (not used on DOS) */ 36 | 37 | #if !__STDC__ 38 | /* Non-ANSI name for compatibility */ 39 | #ifdef _NTSDK 40 | #define ino_t _ino_t 41 | #else /* ndef _NTSDK */ 42 | typedef unsigned short ino_t; 43 | #endif /* _NTSDK */ 44 | #endif 45 | 46 | #define _INO_T_DEFINED 47 | #endif 48 | 49 | 50 | #ifndef _DEV_T_DEFINED 51 | 52 | #ifdef _NTSDK 53 | typedef short _dev_t; /* device code */ 54 | #else /* ndef _NTSDK */ 55 | typedef unsigned int _dev_t; /* device code */ 56 | #endif /* _NTSDK */ 57 | 58 | #if !__STDC__ 59 | /* Non-ANSI name for compatibility */ 60 | #ifdef _NTSDK 61 | #define dev_t _dev_t 62 | #else /* ndef _NTSDK */ 63 | typedef unsigned int dev_t; 64 | #endif /* _NTSDK */ 65 | #endif 66 | 67 | #define _DEV_T_DEFINED 68 | #endif 69 | 70 | 71 | #ifndef _OFF_T_DEFINED 72 | 73 | typedef long _off_t; /* file offset value */ 74 | 75 | #if !__STDC__ 76 | /* Non-ANSI name for compatibility */ 77 | #ifdef _NTSDK 78 | #define off_t _off_t 79 | #else /* ndef _NTSDK */ 80 | typedef long off_t; 81 | #endif /* _NTSDK */ 82 | #endif 83 | 84 | #define _OFF_T_DEFINED 85 | #endif 86 | 87 | #endif /* _INC_TYPES */ 88 | -------------------------------------------------------------------------------- /nt4/crt/wcstr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * wcstr.h - declarations for wide character string manipulation functions 3 | * 4 | * Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved. 5 | * 6 | *Purpose: 7 | * This file contains the function declarations for the string 8 | * manipulation functions. 9 | * [OBSOLETE][UNICODE/ISO] 10 | * 11 | * WARNING: OBSOLETE FILE: use wchar.h/stdlib.h instead!!! 12 | * This file provided only for short-term compatibility. It will 13 | * disappear in the near future after a brief transitional period. 14 | * 15 | ****/ 16 | 17 | #ifndef _INC_WCSTR 18 | 19 | #include 20 | #define wcswcs wcsstr 21 | 22 | #define _wcscmpi _wcsicmp 23 | #if !__STDC__ 24 | #define wcscmpi _wcsicmp 25 | #endif 26 | 27 | /* from stdlib.h */ 28 | int _CRTAPI1 wctomb(char *, wchar_t); 29 | size_t _CRTAPI1 wcstombs(char*, const wchar_t *, size_t); 30 | 31 | #define _INC_WCSTR 32 | #endif /* _INC_WCSTR */ 33 | -------------------------------------------------------------------------------- /nt4/ddk/dderror.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0000 Increment this if a change has global effects 2 | 3 | Copyright (c) 1990-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | dderror.h 8 | 9 | Abstract: 10 | 11 | This module defines the 32-Bit Windows error codes that are useable by 12 | portable kernel drivers. 13 | 14 | Revision History: 15 | 16 | --*/ 17 | 18 | #ifndef _DDERROR_ 19 | #define _DDERROR_ 20 | 21 | /* 22 | * This file is a subset of Win32 error codes. Other win32 error codes 23 | * are not supported by portable drivers and should not beused. 24 | * This #define removes the definitions of all other error codes. 25 | */ 26 | 27 | #define _WINERROR_ 28 | 29 | #define NO_ERROR 0L 30 | #define ERROR_INVALID_FUNCTION 1L 31 | #define ERROR_NOT_ENOUGH_MEMORY 8L 32 | #define ERROR_DEV_NOT_EXIST 55L 33 | #define ERROR_INVALID_PARAMETER 87L 34 | #define ERROR_INSUFFICIENT_BUFFER 122L 35 | #define ERROR_MORE_DATA 234L 36 | #define ERROR_IO_PENDING 997L 37 | 38 | #endif /* _DDERROR_ */ 39 | 40 | -------------------------------------------------------------------------------- /nt4/ddk/exlevels.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1989 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | exlevels.h 8 | 9 | Abstract: 10 | 11 | This file contains all of the MUTEX level numbers used by the NT 12 | executive. A thread is only allowed to acquire mutexes with levels 13 | numerically higher than the highest mutex level already owned. 14 | 15 | Author: 16 | 17 | Steve Wood (stevewo) 08-May-1989 18 | 19 | Revision History: 20 | 21 | --*/ 22 | 23 | // 24 | // Kernel Mutex Level Numbers (must be globallly assigned within executive) 25 | // The third token in the name is the sub-component name that defines and 26 | // uses the level number. 27 | // 28 | 29 | // 30 | // Used by Vdm for protecting io simulation structures 31 | // 32 | 33 | #define MUTEX_LEVEL_VDM_IO (ULONG)0x00000001 34 | 35 | #define MUTEX_LEVEL_EX_PROFILE (ULONG)0x00000040 36 | 37 | // 38 | // The LANMAN Redirector uses the file system major function, but defines 39 | // it's own mutex levels. We can do this safely because we know that the 40 | // local filesystem will never call the remote filesystem and vice versa. 41 | // 42 | 43 | #define MUTEX_LEVEL_RDR_FILESYS_DATABASE (ULONG)0x10100000 44 | #define MUTEX_LEVEL_RDR_FILESYS_SECURITY (ULONG)0x10100001 45 | 46 | // 47 | // File System levels. 48 | // 49 | 50 | #define MUTEX_LEVEL_FILESYSTEM_RAW_VCB (ULONG)0x11000006 51 | 52 | // 53 | // In the NT STREAMS environment, a mutex is used to serialize open, close 54 | // and Scheduler threads executing in a subsystem-parallelized stack. 55 | // 56 | 57 | #define MUTEX_LEVEL_STREAMS_SUBSYS (ULONG)0x11001001 58 | 59 | // 60 | // Mutex level used by LDT support on x86 61 | // 62 | 63 | #define MUTEX_LEVEL_PS_LDT (ULONG)0x1F000000 64 | -------------------------------------------------------------------------------- /nt4/ddk/gdispool.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1990-1993 Microsoft Corporation 4 | 5 | 6 | Module Name: 7 | 8 | gdispool.h 9 | 10 | 11 | Abstract: 12 | 13 | This module contains private gdi spool definition to the Drvxxxx calls 14 | 15 | 16 | Author: 17 | 18 | 04-Jun-1996 Tue 10:50:56 updated -by- Daniel Chou (danielc) 19 | 20 | 21 | [Environment:] 22 | 23 | spooler 24 | 25 | 26 | [Notes:] 27 | 28 | 29 | Revision History: 30 | 31 | Move most stuff to the winddiui.h in the public\oak\inc directory, this 32 | file only used by the gdi printer device drivers 33 | 34 | 35 | --*/ 36 | 37 | #ifndef _GDISPOOL_ 38 | #define _GDISPOOL_ 39 | 40 | #include 41 | 42 | 43 | #if DBG 44 | #ifdef DEF_DRV_DOCUMENT_EVENT_DBG_STR 45 | TCHAR *szDrvDocumentEventDbgStrings[] = 46 | { 47 | L"UNKNOWN ESCAPE", 48 | L"CREATEDCPRE", 49 | L"CREATEDCPOST", 50 | L"RESETDCPRE", 51 | L"RESETDCPOST", 52 | L"STARTDOC", 53 | L"STARTPAGE", 54 | L"ENDPAGE", 55 | L"ENDDOC", 56 | L"ABORTDOC", 57 | L"DELETEDC", 58 | L"ESCAPE", 59 | L"ENDDOCPOST", 60 | L"STARTDOCPOST" 61 | }; 62 | #endif 63 | #endif // #define(DEBUG) 64 | 65 | 66 | typedef int (WINAPI * PFNDOCUMENTEVENT)( 67 | HANDLE hPrinter, 68 | HDC hdc, 69 | int iEsc, 70 | ULONG cbIn, 71 | PULONG pbIn, 72 | ULONG cbOut, 73 | PULONG pbOut 74 | ); 75 | 76 | 77 | #endif // _GDISPOOL_ 78 | -------------------------------------------------------------------------------- /nt4/ddk/isvbop.inc: -------------------------------------------------------------------------------- 1 | ; This is the inc file for isvbop.h. 2 | ; Please refer to isvbop.h for comments and notes on these interfaces 3 | ; 4 | BOP_3RDPARTY EQU 58H 5 | BOP_UNSIMULATE EQU 0FEH 6 | 7 | RegisterModule macro 8 | db 0C4h, 0C4h, BOP_3RDPARTY, 0 9 | endm 10 | 11 | UnRegisterModule macro 12 | db 0C4h, 0C4h, BOP_3RDPARTY, 1 13 | endm 14 | 15 | DispatchCall macro 16 | db 0C4h, 0C4h, BOP_3RDPARTY, 2 17 | endm 18 | 19 | VDDUnSimulate16 macro 20 | db 0C4h, 0C4h, BOP_UNSIMULATE 21 | endm 22 | -------------------------------------------------------------------------------- /nt4/ddk/mindrvrc.h: -------------------------------------------------------------------------------- 1 | /************************ Module Header ************************************** 2 | * mindrvrc.h 3 | * This file contains definitions for tables contained in the resource file 4 | * of the Mini Drivers. It should be shared by both gentool and the 5 | * generic library. 6 | * 7 | * HISTORY: 8 | * 09:51 on Mon 28 Dec 1992 -by- Lindsay Harris [lindsayh] 9 | * Split from rasdd internal file - required to build minidrivers. 10 | * 11 | * Updated: 10/4/90 ericbi Updated structs to current spec for Win 3.1 12 | * Created: 2 /6 /90 lins 13 | * 14 | * Copyright (C) 1990 Microsoft Corporation 15 | ****************************************************************************/ 16 | 17 | 18 | /* 19 | * The following are the resource types used in minidrivers and 20 | * used in the .rc file. 21 | */ 22 | 23 | #define RC_TABLES 257 24 | #define RC_FONT 258 25 | #define RC_TRANSTAB 259 26 | -------------------------------------------------------------------------------- /nt4/ddk/ntddaux.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1992-1993 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | ntddaux.h 8 | 9 | Abstract: 10 | 11 | This include file defines all constants and types for 12 | accessing an NT auxiliary sound devices. 13 | 14 | Author: 15 | 16 | Robin Speed (RobinSp) - 24-Aug-1992 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _NTDDAUX_ 23 | #define _NTDDAUX_ 24 | 25 | #include // general sound stuff 26 | 27 | #define IOCTL_AUX_BASE 0x0100 28 | 29 | // 30 | // Device Name - this string is the name of the device. It is the name 31 | // that when added to the name of the root of the device tree and with 32 | // the device number appended, gives the name of the device required for 33 | // a call to NtOpenFile. 34 | // So for example, if the root is \Device and the Device type is 35 | // MMAux and the device number is 2, the full name is \Device\MMAux2 36 | // 37 | 38 | #define DD_AUX_DEVICE_NAME "\\Device\\MMAux" 39 | #define DD_AUX_DEVICE_NAME_U L"\\Device\\MMAux" 40 | 41 | // 42 | // WAVE device driver IOCTL set 43 | // 44 | 45 | #define IOCTL_AUX_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS) 46 | #define IOCTL_AUX_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS) 47 | #define IOCTL_AUX_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS) 48 | 49 | // 50 | // Input and output are AUX_DD_VOLUME structure. 51 | // Completes when real device volume != volume passed in. 52 | // Returns new volume 53 | // 54 | #define IOCTL_SOUND_GET_CHANGED_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS) 55 | 56 | // 57 | // Aux volume structure 58 | // 59 | 60 | typedef struct _AUX_DD_VOLUME { 61 | ULONG Left; 62 | ULONG Right; 63 | } AUX_DD_VOLUME, *PAUX_DD_VOLUME; 64 | 65 | #define AUX_DD_MAX_VOLUME 0xFFFFFFFF // Maximum volume 66 | 67 | // 68 | // Data returned by IOCTL_AUX_GET_CAPABILITIES is AUXCAPSW structure 69 | // defined in mmsystem.h 70 | // 71 | 72 | #endif // _NTDDAUX_ 73 | 74 | -------------------------------------------------------------------------------- /nt4/ddk/ntddbeep.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1990-1993 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | ntddbeep.h 8 | 9 | Abstract: 10 | 11 | This is the include file that defines all constants and types for 12 | the beep device. 13 | 14 | Author: 15 | 16 | Lee A. Smith (lees) 02-Aug-1991. 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _NTDDBEEP_ 23 | #define _NTDDBEEP_ 24 | 25 | // 26 | // Device Name - this string is the name of the device. It is the name 27 | // that should be passed to NtOpenFile when accessing the device. 28 | // 29 | // Note: For devices that support multiple units, it should be suffixed 30 | // with the Ascii representation of the unit number. 31 | // 32 | 33 | #define DD_BEEP_DEVICE_NAME "\\Device\\Beep" 34 | #define DD_BEEP_DEVICE_NAME_U L"\\Device\\Beep" 35 | 36 | // 37 | // NtDeviceIoControlFile IoControlCode values for this device. 38 | // 39 | // Warning: Remember that the low two bits of the code specify how the 40 | // buffers are passed to the driver! 41 | // 42 | 43 | #define IOCTL_BEEP_SET CTL_CODE(FILE_DEVICE_BEEP, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) 44 | 45 | // 46 | // NtDeviceIoControlFile OutputBuffer record structures for 47 | // IOCTL_BEEP_SET. 48 | // 49 | 50 | typedef struct _BEEP_SET_PARAMETERS { 51 | ULONG Frequency; 52 | ULONG Duration; 53 | } BEEP_SET_PARAMETERS, *PBEEP_SET_PARAMETERS; 54 | 55 | #define BEEP_FREQUENCY_MINIMUM 0x25 56 | #define BEEP_FREQUENCY_MAXIMUM 0x7FFF 57 | 58 | #endif // _NTDDBEEP_ 59 | -------------------------------------------------------------------------------- /nt4/ddk/ntddpar.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1990-1993 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | ntddpar.h 8 | 9 | Abstract: 10 | 11 | This is the include file that defines all constants and types for 12 | accessing the Parallel device. 13 | 14 | Author: 15 | 16 | Steve Wood (stevewo) 27-May-1990 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | // 23 | // NtDeviceIoControlFile IoControlCode values for this device. 24 | // 25 | // Warning: Remember that the low two bits of the code specify how the 26 | // buffers are passed to the driver! 27 | // 28 | 29 | #define IOCTL_PAR_BASE FILE_DEVICE_PARALLEL_PORT 30 | #define IOCTL_PAR_QUERY_INFORMATION CTL_CODE(FILE_DEVICE_PARALLEL_PORT,1,METHOD_BUFFERED,FILE_ANY_ACCESS) 31 | #define IOCTL_PAR_SET_INFORMATION CTL_CODE(FILE_DEVICE_PARALLEL_PORT,2,METHOD_BUFFERED,FILE_ANY_ACCESS) 32 | #define IOCTL_PAR_QUERY_DEVICE_ID CTL_CODE(FILE_DEVICE_PARALLEL_PORT,3,METHOD_BUFFERED,FILE_ANY_ACCESS) 33 | #define IOCTL_PAR_QUERY_DEVICE_ID_SIZE CTL_CODE(FILE_DEVICE_PARALLEL_PORT,4,METHOD_BUFFERED,FILE_ANY_ACCESS) 34 | 35 | // 36 | // NtDeviceIoControlFile InputBuffer/OutputBuffer record structures for 37 | // this device. 38 | // 39 | 40 | typedef struct _PAR_QUERY_INFORMATION{ 41 | UCHAR Status; 42 | } PAR_QUERY_INFORMATION, *PPAR_QUERY_INFORMATION; 43 | 44 | typedef struct _PAR_SET_INFORMATION{ 45 | UCHAR Init; 46 | } PAR_SET_INFORMATION, *PPAR_SET_INFORMATION; 47 | 48 | #define PARALLEL_INIT 0x1 49 | #define PARALLEL_AUTOFEED 0x2 50 | #define PARALLEL_PAPER_EMPTY 0x4 51 | #define PARALLEL_OFF_LINE 0x8 52 | #define PARALLEL_POWER_OFF 0x10 53 | #define PARALLEL_NOT_CONNECTED 0x20 54 | #define PARALLEL_BUSY 0x40 55 | #define PARALLEL_SELECTED 0x80 56 | 57 | // 58 | // This is the structure returned by IOCTL_PAR_QUERY_DEVICE_ID_SIZE. 59 | // 60 | 61 | typedef struct _PAR_DEVICE_ID_SIZE_INFORMATION { 62 | ULONG DeviceIdSize; 63 | } PAR_DEVICE_ID_SIZE_INFORMATION, *PPAR_DEVICE_ID_SIZE_INFORMATION; 64 | -------------------------------------------------------------------------------- /nt4/ddk/ntddsnd.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1990-1993 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | ntddsnd.h 8 | 9 | Abstract: 10 | 11 | This is the include file that defines all the common 12 | constants and types for sound devices. 13 | 14 | Author: 15 | 16 | Nigel Thompson (NigelT) 17-May-91 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _NTDDSND_ 23 | #define _NTDDSND_ 24 | 25 | // 26 | // Define the IOCTL base values for sound devices and each class 27 | // of sound device 28 | // 29 | 30 | #define IOCTL_SOUND_BASE FILE_DEVICE_SOUND 31 | #define IOCTL_WAVE_BASE 0x0000 32 | #define IOCTL_MIDI_BASE 0x0080 33 | 34 | // 35 | // Define some useful limits 36 | // 37 | 38 | #define SOUND_MAX_DEVICE_NAME 80 // BUGBUG this is a wild guess 39 | #define SOUND_MAX_DEVICES 100 // Max no of devices of a given type 40 | #endif // _NTDDSND_ 41 | -------------------------------------------------------------------------------- /nt4/ddk/ntmindrv.h: -------------------------------------------------------------------------------- 1 | /**************************** MODULE HEADER ******************************** 2 | * ntmindrv.h 3 | * Defines etc for use in NT minidrivers with code. 4 | * 5 | * 6 | * Copyright (C) 1992 Microsoft Corporation. 7 | * 8 | ****************************************************************************/ 9 | 10 | /* 11 | * Some generic function types, as needed by the minidriver. 12 | */ 13 | 14 | typedef int (* WSBFN)( void *, BYTE *, int ); 15 | 16 | /* 17 | * A structure which is passed into the minidriver's initialisation 18 | * function. This contains the addresses of RasDD entry points that 19 | * the minidriver needs to know about. 20 | */ 21 | 22 | typedef struct 23 | { 24 | WORD wSize; /* Size in bytes */ 25 | WORD wVersion; /* Version ID - see below */ 26 | 27 | WSBFN WriteSpoolBuf; /* WriteSpoolBuf: output function */ 28 | } NTMD_INIT; 29 | 30 | #define NTMD_INIT_VER 0x0001 /* Version ID */ 31 | 32 | /* 33 | * Prototype for the minidriver's initialisation function. 34 | */ 35 | 36 | typedef BOOL (* bSFAFN)( NTMD_INIT * ); 37 | 38 | BOOL bSetFuncAddr( NTMD_INIT * ); 39 | -------------------------------------------------------------------------------- /nt4/ddk/ntpoapi.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Power Management will be included in a later release of Windows NT. 4 | 5 | --*/ 6 | -------------------------------------------------------------------------------- /nt4/ddk/packoff.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1990,91 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | packoff.h 8 | 9 | Abstract: 10 | 11 | This file turns packing of structures off. (That is, it enables 12 | automatic alignment of structure fields.) An include file is needed 13 | because various compilers do this in different ways. 14 | 15 | packoff.h is the complement to packon.h. An inclusion of packoff.h 16 | MUST ALWAYS be preceded by an inclusion of packon.h, in one-to-one 17 | correspondence. 18 | 19 | Author: 20 | 21 | Chuck Lenzmeier (chuckl) 4-Mar-1990 22 | 23 | Revision History: 24 | 25 | 15-Apr-1991 JohnRo 26 | Created lint-able variant. 27 | --*/ 28 | 29 | #if ! (defined(lint) || defined(_lint)) 30 | #if ( _MSC_VER >= 800 ) 31 | #pragma warning(disable:4103) 32 | #endif 33 | #pragma pack() 34 | #endif // ! (defined(lint) || defined(_lint)) 35 | -------------------------------------------------------------------------------- /nt4/ddk/packon.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1990,91 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | packon.h 8 | 9 | Abstract: 10 | 11 | This file turns packing of structures on. (That is, it disables 12 | automatic alignment of structure fields.) An include file is needed 13 | because various compilers do this in different ways. 14 | 15 | The file packoff.h is the complement to this file. 16 | 17 | Author: 18 | 19 | Chuck Lenzmeier (chuckl) 4-Mar-1990 20 | 21 | Revision History: 22 | 23 | 15-Apr-1991 JohnRo 24 | Created lint-able variant. 25 | --*/ 26 | 27 | #if ! (defined(lint) || defined(_lint)) 28 | #if ( _MSC_VER >= 800 ) 29 | #pragma warning(disable:4103) 30 | #endif 31 | #pragma pack(1) // x86, MS compiler; MIPS, MIPS compiler 32 | #endif // ! (defined(lint) || defined(_lint)) 33 | -------------------------------------------------------------------------------- /nt4/ddk/spllib.hxx: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1994 - 1996 Microsoft Corporation 4 | All rights reserved. 5 | 6 | Module Name: 7 | 8 | spllib.hxx 9 | 10 | Abstract: 11 | 12 | All definitions for spllib. 13 | 14 | Revision History: 15 | 16 | --*/ 17 | 18 | #ifndef RC_INVOKED 19 | #include "..\spllib\common.hxx" 20 | #include "..\spllib\mem.hxx" 21 | #include "..\spllib\clink.hxx" 22 | #endif 23 | -------------------------------------------------------------------------------- /nt4/ddk/verinfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * verinfo.h - internal header file to define the build version 3 | * 4 | */ 5 | 6 | // 7 | // WARNING! Do not put LEADING ZERO's on these numbers or 8 | // they will end up as OCTAL numbers in the C code! 9 | // 10 | 11 | 12 | #define MMVERSION 3 13 | #define MMREVISION 5 14 | #define MMRELEASE 00 15 | 16 | #ifdef RC_INVOKED 17 | #define VERSIONPRODUCTNAME "Audio Compression Manager Sample\0" 18 | #define VERSIONCOPYRIGHT "Copyright \251 Microsoft Corp. 1992-1996\0" 19 | #endif 20 | 21 | 22 | 23 | #define VERSIONSTR "3.50\0" 24 | 25 | 26 | #define VERSIONCOMPANYNAME "Company\0" 27 | 28 | #define VER_PRIVATEBUILD 0 29 | 30 | #define VER_PRERELEASE 0 31 | 32 | #define VER_DEBUG 0 33 | 34 | #define VERSIONFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) 35 | #define VERSIONFILEFLAGSMASK 0x0030003FL 36 | 37 | -------------------------------------------------------------------------------- /nt4/ddk/verinfo.ver: -------------------------------------------------------------------------------- 1 | 2 | #ifdef RC_INVOKED 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION MMVERSION, MMREVISION, 0, MMRELEASE 6 | PRODUCTVERSION MMVERSION, MMREVISION, 0, MMRELEASE 7 | FILEFLAGSMASK VERSIONFILEFLAGSMASK 8 | FILEFLAGS VERSIONFLAGS 9 | FILEOS VOS_DOS_WINDOWS16 10 | FILETYPE VERSIONTYPE 11 | FILESUBTYPE VERSIONSUBTYPE 12 | BEGIN 13 | BLOCK "StringFileInfo" 14 | BEGIN 15 | BLOCK "040904E4" 16 | BEGIN 17 | VALUE "CompanyName", VERSIONCOMPANYNAME 18 | VALUE "FileDescription", VERSIONDESCRIPTION 19 | VALUE "FileVersion", VERSIONSTR 20 | VALUE "InternalName", VERSIONNAME 21 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 22 | VALUE "OriginalFilename", VERSIONNAME 23 | VALUE "ProductName", VERSIONPRODUCTNAME 24 | VALUE "ProductVersion", VERSIONSTR 25 | END 26 | END 27 | 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | /* the following line should be extended for localized versions */ 31 | VALUE "Translation", 0x409, 1252 32 | END 33 | 34 | END 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /nt4/ddk/warning.h: -------------------------------------------------------------------------------- 1 | #pragma warning(3:4092) // sizeof returns 'unsigned long' 2 | #pragma warning(3:4121) // structure is sensitive to alignment 3 | #pragma warning(3:4125) // decimal digit in octal sequence 4 | #pragma warning(3:4130) // logical operation on address of string constant 5 | #pragma warning(3:4132) // const object should be initialized 6 | #pragma warning(4:4206) // Source File is empty 7 | #pragma warning(4:4101) // Unreferenced local variable 8 | #pragma warning(4:4208) // delete[exp] - exp evaluated but ignored 9 | #pragma warning(3:4212) // function declaration used ellipsis 10 | #pragma warning(error:4700) // Local used w/o being initialized 11 | #pragma warning(error:4259) // pure virtual function was not defined 12 | #pragma warning(4:4509) // use of SEH with destructor 13 | #pragma warning(4:4177) // pragma data_seg s/b at global scope 14 | 15 | #pragma warning(disable:4237) // bool keyword reserved for future use 16 | 17 | #if 0 18 | #pragma warning(3:4100) // Unreferenced formal parameter 19 | #pragma warning(3:4701) // local may be used w/o init 20 | #pragma warning(3:4702) // Unreachable code 21 | #pragma warning(3:4705) // Statement has no effect 22 | #pragma warning(3:4706) // assignment w/i conditional expression 23 | #pragma warning(3:4709) // command operator w/o index expression 24 | #endif 25 | 26 | #ifndef __cplusplus 27 | #undef try 28 | #undef except 29 | #undef finally 30 | #undef leave 31 | #define try __try 32 | #define except __except 33 | #define finally __finally 34 | #define leave __leave 35 | #endif 36 | -------------------------------------------------------------------------------- /nt4/hal/arccodes.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1991 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | arc.h 8 | 9 | Abstract: 10 | 11 | This header file defines the ARC status codes. 12 | 13 | Author: 14 | 15 | David N. Cutler (davec) 20-Sep-1991 16 | 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _ARCCODES_ 23 | #define _ARCCODES_ 24 | 25 | // 26 | // Define ARC status codes. 27 | // 28 | 29 | typedef enum _ARC_CODES { 30 | ESUCCESS, 31 | E2BIG, 32 | EACCES, 33 | EAGAIN, 34 | EBADF, 35 | EBUSY, 36 | EFAULT, 37 | EINVAL, 38 | EIO, 39 | EISDIR, 40 | EMFILE, 41 | EMLINK, 42 | ENAMETOOLONG, 43 | ENODEV, 44 | ENOENT, 45 | ENOEXEC, 46 | ENOMEM, 47 | ENOSPC, 48 | ENOTDIR, 49 | ENOTTY, 50 | ENXIO, 51 | EROFS, 52 | EMAXIMUM 53 | } ARC_CODES; 54 | 55 | #endif // ARCCODES 56 | -------------------------------------------------------------------------------- /nt4/sdk/colordlg.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1990-1996, Microsoft Corporation All rights reserved. 4 | 5 | Module Name: 6 | 7 | colordlg.h 8 | 9 | Abstract: 10 | 11 | This module contains the header information for the Win32 color dialog. 12 | 13 | Revision History: 14 | 15 | --*/ 16 | 17 | 18 | 19 | // 20 | // Constant Declarations. 21 | // 22 | 23 | #define DLG_COLOR 10 24 | 25 | #define COLOR_HUESCROLL 700 // color dialog 26 | #define COLOR_SATSCROLL 701 27 | #define COLOR_LUMSCROLL 702 28 | #define COLOR_HUE 703 29 | #define COLOR_SAT 704 30 | #define COLOR_LUM 705 31 | #define COLOR_RED 706 32 | #define COLOR_GREEN 707 33 | #define COLOR_BLUE 708 34 | #define COLOR_CURRENT 709 35 | #define COLOR_RAINBOW 710 36 | #define COLOR_SAVE 711 37 | #define COLOR_ADD 712 38 | #define COLOR_SOLID 713 39 | #define COLOR_TUNE 714 40 | #define COLOR_SCHEMES 715 41 | #define COLOR_ELEMENT 716 42 | #define COLOR_SAMPLES 717 43 | #define COLOR_PALETTE 718 44 | #define COLOR_MIX 719 45 | #define COLOR_BOX1 720 46 | #define COLOR_CUSTOM1 721 47 | 48 | #define COLOR_HUEACCEL 723 49 | #define COLOR_SATACCEL 724 50 | #define COLOR_LUMACCEL 725 51 | #define COLOR_REDACCEL 726 52 | #define COLOR_GREENACCEL 727 53 | #define COLOR_BLUEACCEL 728 54 | 55 | #define COLOR_SOLID_LEFT 730 56 | #define COLOR_SOLID_RIGHT 731 57 | 58 | #define NUM_BASIC_COLORS 48 59 | #define NUM_CUSTOM_COLORS 16 60 | 61 | -------------------------------------------------------------------------------- /nt4/sdk/compobj.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992-1996. 5 | // 6 | // File: compobj.h 7 | // 8 | //---------------------------------------------------------------------------- 9 | 10 | #ifndef RC_INVOKED 11 | #pragma message("WARNING: your code should #include objbase.h instead of compobj.h") 12 | #endif /* !RC_INVOKED */ 13 | 14 | #include 15 | 16 | -------------------------------------------------------------------------------- /nt4/sdk/d3drmwin.h: -------------------------------------------------------------------------------- 1 | /*==========================================================================; 2 | * 3 | * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. 4 | * 5 | * File: d3drm.h 6 | * Content: Direct3DRM include file 7 | * 8 | ***************************************************************************/ 9 | 10 | #ifndef __D3DRMWIN_H__ 11 | #define __D3DRMWIN_H__ 12 | 13 | #ifndef WIN32 14 | #define WIN32 15 | #endif 16 | 17 | #include "d3drm.h" 18 | #include "ddraw.h" 19 | #include "d3d.h" 20 | 21 | /* 22 | * GUIDS used by Direct3DRM Windows interface 23 | */ 24 | DEFINE_GUID(IID_IDirect3DRMWinDevice, 0xc5016cc0, 0xd273, 0x11ce, 0xac, 0x48, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); 25 | 26 | WIN_TYPES(IDirect3DRMWinDevice, DIRECT3DRMWINDEVICE); 27 | 28 | #undef INTERFACE 29 | #define INTERFACE IDirect3DRMWinDevice 30 | 31 | DECLARE_INTERFACE_(IDirect3DRMWinDevice, IDirect3DRMObject) 32 | { 33 | IUNKNOWN_METHODS(PURE); 34 | IDIRECT3DRMOBJECT_METHODS(PURE); 35 | 36 | /* 37 | * IDirect3DRMWinDevice methods 38 | */ 39 | 40 | /* Repaint the window with the last frame which was rendered. */ 41 | STDMETHOD(HandlePaint)(THIS_ HDC hdc) PURE; 42 | 43 | /* Respond to a WM_ACTIVATE message. */ 44 | STDMETHOD(HandleActivate)(THIS_ WORD wparam) PURE; 45 | }; 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /nt4/sdk/dispatch.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992-1996. 5 | // 6 | // File: dispatch.h 7 | // 8 | //---------------------------------------------------------------------------- 9 | 10 | #ifndef RC_INVOKED 11 | #pragma message("WARNING: your code should #include oleauto.h instead of dispatch.h") 12 | #endif /* !RC_INVOKED */ 13 | 14 | #include 15 | 16 | -------------------------------------------------------------------------------- /nt4/sdk/dvobj.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992-1996. 5 | // 6 | // File: dvobj.h 7 | // 8 | //---------------------------------------------------------------------------- 9 | 10 | #ifndef RC_INVOKED 11 | #pragma message("WARNING: your code should include ole2.h instead of dvobj.h") 12 | #endif /* !RC_INVOKED */ 13 | 14 | #include 15 | 16 | -------------------------------------------------------------------------------- /nt4/sdk/exchform.h: -------------------------------------------------------------------------------- 1 | #ifndef EXCHFORM_H 2 | #define EXCHFORM_H 3 | 4 | 5 | /* 6 | * E X C H F O R M . H 7 | * 8 | * Declarations of interfaces and constants for forms that work with 9 | * the Microsoft Exchange client. 10 | * 11 | * Copyright 1986-1996 Microsoft Corporation. All Rights Reserved. 12 | */ 13 | 14 | 15 | /* 16 | * V e r b s 17 | */ 18 | 19 | 20 | // Interpersonal messaging verbs 21 | #define EXCHIVERB_OPEN 0 22 | #define EXCHIVERB_RESERVED_COMPOSE 100 23 | #define EXCHIVERB_RESERVED_OPEN 101 24 | #define EXCHIVERB_REPLYTOSENDER 102 25 | #define EXCHIVERB_REPLYTOALL 103 26 | #define EXCHIVERB_FORWARD 104 27 | #define EXCHIVERB_PRINT 105 28 | #define EXCHIVERB_SAVEAS 106 29 | #define EXCHIVERB_RESERVED_DELIVERY 107 30 | #define EXCHIVERB_REPLYTOFOLDER 108 31 | 32 | 33 | /* 34 | * G U I D s 35 | */ 36 | 37 | 38 | #define DEFINE_EXCHFORMGUID(name, b) \ 39 | DEFINE_GUID(name, 0x00020D00 | (b), 0, 0, 0xC0,0,0,0,0,0,0,0x46) 40 | 41 | #ifndef NOEXCHFORMGUIDS 42 | DEFINE_EXCHFORMGUID(PS_EXCHFORM, 0x0C); 43 | #endif // NOEXCHFORMGUIDS 44 | 45 | 46 | /* 47 | * E x t e n d e d P r o p e r t i e s 48 | */ 49 | 50 | 51 | // Operation map property 52 | #define psOpMap PS_EXCHFORM 53 | #define ulKindOpMap MNID_ID 54 | #define lidOpMap 1 55 | #define ptOpMap PT_STRING8 56 | 57 | // Operation map indices 58 | #define ichOpMapReservedCompose 0 59 | #define ichOpMapOpen 1 60 | #define ichOpMapReplyToSender 2 61 | #define ichOpMapReplyToAll 3 62 | #define ichOpMapForward 4 63 | #define ichOpMapPrint 5 64 | #define ichOpMapSaveAs 6 65 | #define ichOpMapReservedDelivery 7 66 | #define ichOpMapReplyToFolder 8 67 | 68 | // Operation map values 69 | #define chOpMapByClient '0' 70 | #define chOpMapByForm '1' 71 | #define chOpMapDisable '2' 72 | 73 | 74 | #endif // EXCHFORM_H 75 | -------------------------------------------------------------------------------- /nt4/sdk/font.dlg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wack0/entii-for-workcubes/0274ddcda5d029206127dd9b986042e866650089/nt4/sdk/font.dlg -------------------------------------------------------------------------------- /nt4/sdk/initguid.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * * 3 | * initguid.h - Definitions for controlling GUID initialization * 4 | * * 5 | * OLE Version 2.0 * 6 | * * 7 | * Copyright (c) 1992-1996, Microsoft Corp. All rights reserved. * 8 | * * 9 | \*****************************************************************************/ 10 | 11 | // Include after compobj.h to enable GUID initialization. This 12 | // must be done once per exe/dll. 13 | // 14 | // After this file, include one or more of the GUID definition files. 15 | // 16 | // NOTE: ole2.lib contains references to all GUIDs defined by OLE. 17 | 18 | #ifndef DEFINE_GUID 19 | #error initguid: must include objbase.h first. 20 | #endif 21 | 22 | #undef DEFINE_GUID 23 | 24 | #ifdef _MAC 25 | #define __based(a) 26 | #endif 27 | 28 | #ifdef _WIN32 29 | #define __based(a) 30 | #endif 31 | 32 | #ifdef __TURBOC__ 33 | #define __based(a) 34 | #endif 35 | 36 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 37 | EXTERN_C const GUID __based(__segname("_CODE")) name \ 38 | = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } 39 | -------------------------------------------------------------------------------- /nt4/sdk/initoid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * I N I T O I D . H 3 | * 4 | * Define macros to be used for initializing MAPI OID's 5 | * 6 | * Copyright 1986-1996 Microsoft Corporation. All Rights Reserved. 7 | */ 8 | 9 | #define MAPI_PREFIX 0x2A,0x86,0x48,0x86,0xf7,0x14,0x03 10 | 11 | #ifdef _MAC 12 | #undef DEFINE_OID_1 13 | #define DEFINE_OID_1(name, b0, b1) \ 14 | EXTERN_C const BYTE name[] = { MAPI_PREFIX, b0, b1 } 15 | 16 | #undef DEFINE_OID_2 17 | #define DEFINE_OID_2(name, b0, b1, b2) \ 18 | EXTERN_C const BYTE name[] = { MAPI_PREFIX, b0, b1, b2 } 19 | 20 | #undef DEFINE_OID_3 21 | #define DEFINE_OID_3(name, b0, b1, b2, b3) \ 22 | EXTERN_C const BYTE name[] = { MAPI_PREFIX, b0, b1, b2, b3 } 23 | 24 | #undef DEFINE_OID_4 25 | #define DEFINE_OID_4(name, b0, b1, b2, b3, b4) \ 26 | EXTERN_C const BYTE name[] = { MAPI_PREFIX, b0, b1, b2, b3, b4 } 27 | #else 28 | #undef DEFINE_OID_1 29 | #define DEFINE_OID_1(name, b0, b1) \ 30 | EXTERN_C const BYTE __based(__segname("_CODE")) name[] =\ 31 | { MAPI_PREFIX, b0, b1 } 32 | 33 | #undef DEFINE_OID_2 34 | #define DEFINE_OID_2(name, b0, b1, b2) \ 35 | EXTERN_C const BYTE __based(__segname("_CODE")) name[] =\ 36 | { MAPI_PREFIX, b0, b1, b2 } 37 | 38 | #undef DEFINE_OID_3 39 | #define DEFINE_OID_3(name, b0, b1, b2, b3) \ 40 | EXTERN_C const BYTE __based(__segname("_CODE")) name[] =\ 41 | { MAPI_PREFIX, b0, b1, b2, b3 } 42 | 43 | #undef DEFINE_OID_4 44 | #define DEFINE_OID_4(name, b0, b1, b2, b3, b4) \ 45 | EXTERN_C const BYTE __based(__segname("_CODE")) name[] =\ 46 | { MAPI_PREFIX, b0, b1, b2, b3, b4 } 47 | #endif 48 | -------------------------------------------------------------------------------- /nt4/sdk/lm.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1991-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | lm.h 8 | 9 | Abstract: 10 | 11 | This is the top level include file that includes all the files 12 | necessary for writing Lan Manager Application. 13 | 14 | [Environment:] 15 | 16 | User Mode - Win32 17 | 18 | --*/ 19 | 20 | #ifndef _LM_ 21 | #define _LM_ 22 | 23 | #include // LAN Manager common definitions 24 | #include // LAN Manager network error definitions 25 | 26 | #include // Access, Domain, Group and User classes 27 | #include // Alerter 28 | #include // Character Device and Handle classes 29 | #include // Connection, File, Session and Share classes 30 | #include // Message class 31 | #include // Remote Utility class 32 | #include // Replicator class 33 | #include // Server class 34 | #include // Service class 35 | #include // Use class 36 | #include // Workstation class 37 | #include // NetApiBuffer class 38 | #include // NetErrorLog class 39 | #include // NetConfig class 40 | #include // NetStats class 41 | #include // NetAudit class 42 | 43 | #endif // _LM_ 44 | -------------------------------------------------------------------------------- /nt4/sdk/lmapibuf.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1991-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | lmapibuf.h 8 | 9 | Abstract: 10 | 11 | This file contains information about NetApiBuffer APIs. 12 | 13 | Environment: 14 | 15 | User Mode - Win32 16 | 17 | Notes: 18 | 19 | You must include LMCONS.H before this file, since this file depends 20 | on values defined in LMCONS.H. 21 | 22 | --*/ 23 | 24 | #ifndef _LMAPIBUF_ 25 | #define _LMAPIBUF_ 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | // 32 | // Function Prototypes 33 | // 34 | 35 | NET_API_STATUS NET_API_FUNCTION 36 | NetApiBufferAllocate( 37 | IN DWORD ByteCount, 38 | OUT LPVOID * Buffer 39 | ); 40 | 41 | NET_API_STATUS NET_API_FUNCTION 42 | NetApiBufferFree ( 43 | IN LPVOID Buffer 44 | ); 45 | 46 | NET_API_STATUS NET_API_FUNCTION 47 | NetApiBufferReallocate( 48 | IN LPVOID OldBuffer OPTIONAL, 49 | IN DWORD NewByteCount, 50 | OUT LPVOID * NewBuffer 51 | ); 52 | 53 | NET_API_STATUS NET_API_FUNCTION 54 | NetApiBufferSize( 55 | IN LPVOID Buffer, 56 | OUT LPDWORD ByteCount 57 | ); 58 | 59 | 60 | // 61 | // The following private function will go away eventually. 62 | // Call NetApiBufferAllocate instead. 63 | // 64 | NET_API_STATUS NET_API_FUNCTION 65 | NetapipBufferAllocate ( // Internal Function 66 | IN DWORD ByteCount, 67 | OUT LPVOID * Buffer 68 | ); 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | 74 | #endif // _LMAPIBUF_ 75 | -------------------------------------------------------------------------------- /nt4/sdk/lmconfig.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0003 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1991-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | lmconfig.h 8 | 9 | Abstract: 10 | 11 | This module defines the API function prototypes and data structures 12 | for the following groups of NT API functions: 13 | NetConfig 14 | 15 | Environment: 16 | 17 | User Mode - Win32 18 | 19 | Notes: 20 | 21 | You must include NETCONS.H before this file, since this file depends 22 | on values defined in NETCONS.H. 23 | 24 | --*/ 25 | 26 | #ifndef _LMCONFIG_ 27 | #define _LMCONFIG_ 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #define REVISED_CONFIG_APIS 34 | 35 | // 36 | // Function Prototypes - Config 37 | // 38 | 39 | NET_API_STATUS NET_API_FUNCTION 40 | NetConfigGet ( 41 | IN LPCWSTR server OPTIONAL, 42 | IN LPCWSTR component, 43 | IN LPCWSTR parameter, 44 | #ifdef REVISED_CONFIG_APIS 45 | OUT LPBYTE *bufptr 46 | #else 47 | OUT LPBYTE *bufptr, 48 | OUT LPDWORD totalavailable 49 | #endif 50 | ); 51 | 52 | NET_API_STATUS NET_API_FUNCTION 53 | NetConfigGetAll ( 54 | IN LPCWSTR server OPTIONAL, 55 | IN LPCWSTR component, 56 | #ifdef REVISED_CONFIG_APIS 57 | OUT LPBYTE *bufptr 58 | #else 59 | OUT LPBYTE *bufptr, 60 | OUT LPDWORD totalavailable 61 | #endif 62 | ); 63 | 64 | 65 | NET_API_STATUS NET_API_FUNCTION 66 | NetConfigSet ( 67 | IN LPCWSTR server OPTIONAL, 68 | IN LPCWSTR reserved1 OPTIONAL, 69 | IN LPCWSTR component, 70 | IN DWORD level, 71 | IN DWORD reserved2, 72 | IN LPBYTE buf, 73 | IN DWORD reserved3 74 | ); 75 | 76 | // 77 | // Data Structures - Config 78 | // 79 | 80 | typedef struct _CONFIG_INFO_0 { 81 | LPWSTR cfgi0_key; 82 | LPWSTR cfgi0_data; 83 | } CONFIG_INFO_0, *PCONFIG_INFO_0, *LPCONFIG_INFO_0; 84 | 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif // _LMCONFIG_ 91 | -------------------------------------------------------------------------------- /nt4/sdk/lmuseflg.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1991-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | lmuseflg.h 8 | 9 | Abstract: 10 | 11 | This file contains deletion force levels for deleting a connection. 12 | 13 | Environment: 14 | 15 | User Mode - Win32 16 | 17 | Notes: 18 | 19 | This file has no dependencies. It is included by lmwksta.h and 20 | lmuse.h. 21 | 22 | Revision History: 23 | 24 | --*/ 25 | 26 | #ifndef _LMUSEFLG_ 27 | #define _LMUSEFLG_ 28 | 29 | // 30 | // Definition for NetWkstaTransportDel and NetUseDel deletion force levels 31 | // 32 | 33 | #define USE_NOFORCE 0 34 | #define USE_FORCE 1 35 | #define USE_LOTS_OF_FORCE 2 36 | 37 | 38 | #endif // _LMUSEFLG_ 39 | -------------------------------------------------------------------------------- /nt4/sdk/loadperf.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (C) 1995-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | loadperf.h 8 | 9 | Abstract: 10 | 11 | Header file for the Performance Monitor counter string installation 12 | and removal functions. 13 | 14 | Revision History 15 | 16 | 16-Nov-95 Created (a-robw) 17 | 18 | --*/ 19 | 20 | #ifndef _LOADPERF_H_ 21 | #define _LOADPERF_H_ 22 | 23 | // function prototypes for perf counter name string load & unload functions 24 | // provided in LOADPERF.DLL 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #define LOADPERF_FUNCTION __declspec(dllexport) LONG __stdcall 31 | 32 | LOADPERF_FUNCTION 33 | LoadPerfCounterTextStringsA ( 34 | IN LPSTR lpAnsiCommandLine, 35 | IN BOOL bQuietModeArg 36 | ); 37 | 38 | LOADPERF_FUNCTION 39 | LoadPerfCounterTextStringsW ( 40 | IN LPWSTR lpWideCommandLine, 41 | IN BOOL bQuietModeArg 42 | ); 43 | 44 | LOADPERF_FUNCTION 45 | UnloadPerfCounterTextStringsW ( 46 | IN LPWSTR lpWideCommandLine, 47 | IN BOOL bQuietModeArg 48 | ); 49 | 50 | LOADPERF_FUNCTION 51 | UnloadPerfCounterTextStringsA ( 52 | IN LPSTR lpAnsiCommandLine, 53 | IN BOOL bQuietModeArg 54 | ); 55 | 56 | #ifdef UNICODE 57 | #define LoadPerfCounterTextStrings LoadPerfCounterTextStringsW 58 | #define UnloadPerfCounterTextStrings UnloadPerfCounterTextStringsW 59 | #else 60 | #define LoadPerfCounterTextStrings LoadPerfCounterTextStringsA 61 | #define UnloadPerfCounterTextStrings UnloadPerfCounterTextStringsA 62 | #endif 63 | 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | 70 | #endif // _LOADPERF_H_ 71 | -------------------------------------------------------------------------------- /nt4/sdk/mapiwz.h: -------------------------------------------------------------------------------- 1 | /* 2 | * M A P I W Z . H 3 | * 4 | * Definitions for the Profile Wizard. Includes all prototypes 5 | * and constants required by the provider-wizard code consumers. 6 | * 7 | * Copyright 1986-1996 Microsoft Corporation. All Rights Reserved. 8 | */ 9 | 10 | #ifndef _MAPIWZ_H 11 | #define _MAPIWZ_H 12 | 13 | #define WIZ_QUERYNUMPAGES (WM_USER +10) 14 | #define WIZ_NEXT (WM_USER +11) 15 | #define WIZ_PREV (WM_USER +12) 16 | /* 17 | * NOTE: Provider-Wizards should not use ids ranging between 18 | * (WM_USER + 1) and (WM_USER +20) as these have been reserved for 19 | * future releases. 20 | */ 21 | 22 | /* Flags for LaunchWizard API */ 23 | 24 | #define MAPI_PW_FIRST_PROFILE 0x00000001 25 | #define MAPI_PW_LAUNCHED_BY_CONFIG 0x00000002 26 | #define MAPI_PW_ADD_SERVICE_ONLY 0x00000004 27 | #define MAPI_PW_PROVIDER_UI_ONLY 0x00000008 28 | #define MAPI_PW_HIDE_SERVICES_LIST 0x00000010 29 | 30 | /* 31 | * Provider should set this property to TRUE if it does not 32 | * want the Profile Wizard to display the PST setup page. 33 | */ 34 | #define PR_WIZARD_NO_PST_PAGE PROP_TAG(PT_BOOLEAN, 0x6700) 35 | 36 | typedef HRESULT (STDAPICALLTYPE LAUNCHWIZARDENTRY) 37 | ( 38 | HWND hParentWnd, 39 | ULONG ulFlags, 40 | LPCTSTR FAR * lppszServiceNameToAdd, 41 | ULONG cbBufferMax, 42 | LPTSTR lpszNewProfileName 43 | ); 44 | typedef LAUNCHWIZARDENTRY FAR * LPLAUNCHWIZARDENTRY; 45 | 46 | typedef BOOL (STDAPICALLTYPE SERVICEWIZARDDLGPROC) 47 | ( 48 | HWND hDlg, 49 | UINT wMsgID, 50 | WPARAM wParam, 51 | LPARAM lParam 52 | ); 53 | typedef SERVICEWIZARDDLGPROC FAR * LPSERVICEWIZARDDLGPROC; 54 | 55 | typedef ULONG (STDAPICALLTYPE WIZARDENTRY) 56 | ( 57 | HINSTANCE hProviderDLLInstance, 58 | LPTSTR FAR * lppcsResourceName, 59 | DLGPROC FAR * lppDlgProc, 60 | LPMAPIPROP lpMapiProp, 61 | LPVOID lpMapiSupportObject 62 | ); 63 | typedef WIZARDENTRY FAR * LPWIZARDENTRY; 64 | 65 | #define LAUNCHWIZARDENTRYNAME "LAUNCHWIZARD" 66 | 67 | #endif /* _MAPIWZ_H */ 68 | -------------------------------------------------------------------------------- /nt4/sdk/moniker.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992-1996. 5 | // 6 | // File: moniker.h 7 | // 8 | //---------------------------------------------------------------------------- 9 | 10 | #ifndef RC_INVOKED 11 | #pragma message("WARNING: your code should #include objbase.h instead of moniker.h") 12 | #endif /* !RC_INVOKED */ 13 | 14 | #include 15 | 16 | -------------------------------------------------------------------------------- /nt4/sdk/msacmdlg.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * 3 | * msacmdlg.h 4 | * 5 | * Copyright (c) 1991-1995 Microsoft Corporation. All Rights Reserved. 6 | * 7 | * Description: 8 | * Audio Compression Manager Common Dialogs Identifiers 9 | * 10 | ***************************************************************************/ 11 | 12 | #define DLG_ACMFORMATCHOOSE_ID 70 13 | #define IDD_ACMFORMATCHOOSE_BTN_HELP 9 14 | #define IDD_ACMFORMATCHOOSE_CMB_CUSTOM 100 15 | #define IDD_ACMFORMATCHOOSE_CMB_FORMATTAG 101 16 | #define IDD_ACMFORMATCHOOSE_CMB_FORMAT 102 17 | #define IDD_ACMFORMATCHOOSE_BTN_SETNAME 103 18 | #define IDD_ACMFORMATCHOOSE_BTN_DELNAME 104 19 | 20 | #define DLG_ACMFILTERCHOOSE_ID 71 21 | #define IDD_ACMFILTERCHOOSE_BTN_HELP 9 22 | #define IDD_ACMFILTERCHOOSE_CMB_CUSTOM 100 23 | #define IDD_ACMFILTERCHOOSE_CMB_FILTERTAG 101 24 | #define IDD_ACMFILTERCHOOSE_CMB_FILTER 102 25 | #define IDD_ACMFILTERCHOOSE_BTN_SETNAME 103 26 | #define IDD_ACMFILTERCHOOSE_BTN_DELNAME 104 27 | 28 | -------------------------------------------------------------------------------- /nt4/sdk/ntsdexts.h: -------------------------------------------------------------------------------- 1 | /*++ BUILD Version: 0001 // Increment this if a change has global effects 2 | 3 | Copyright (c) 1990-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | ntsdexts.h 8 | 9 | Abstract: 10 | 11 | This file contains procedure prototypes and structures 12 | needed to write NTSD and KD debugger extensions. 13 | 14 | Environment: 15 | 16 | runs in the Win32 NTSD debug environment. 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _NTSDEXTNS_ 23 | #define _NTSDEXTNS_ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | typedef 30 | VOID 31 | (*PNTSD_OUTPUT_ROUTINE)( 32 | char *, 33 | ... 34 | ); 35 | 36 | typedef 37 | DWORD 38 | (*PNTSD_GET_EXPRESSION)( 39 | char * 40 | ); 41 | 42 | typedef 43 | VOID 44 | (*PNTSD_GET_SYMBOL)( 45 | LPVOID offset, 46 | PUCHAR pchBuffer, 47 | LPDWORD pDisplacement 48 | ); 49 | 50 | typedef 51 | DWORD 52 | (*PNTSD_DISASM)( 53 | LPDWORD lpOffset, 54 | LPSTR lpBuffer, 55 | BOOL fShowEfeectiveAddress 56 | ); 57 | 58 | typedef 59 | BOOL 60 | (*PNTSD_CHECK_CONTROL_C)( 61 | VOID 62 | ); 63 | 64 | typedef struct _NTSD_EXTENSION_APIS { 65 | DWORD nSize; 66 | PNTSD_OUTPUT_ROUTINE lpOutputRoutine; 67 | PNTSD_GET_EXPRESSION lpGetExpressionRoutine; 68 | PNTSD_GET_SYMBOL lpGetSymbolRoutine; 69 | PNTSD_DISASM lpDisasmRoutine; 70 | PNTSD_CHECK_CONTROL_C lpCheckControlCRoutine; 71 | } NTSD_EXTENSION_APIS, *PNTSD_EXTENSION_APIS; 72 | 73 | typedef 74 | VOID 75 | (*PNTSD_EXTENSION_ROUTINE)( 76 | HANDLE hCurrentProcess, 77 | HANDLE hCurrentThread, 78 | DWORD dwCurrentPc, 79 | PNTSD_EXTENSION_APIS lpExtensionApis, 80 | LPSTR lpArgumentString 81 | ); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | 88 | #endif // _NTSDEXTNS_ 89 | -------------------------------------------------------------------------------- /nt4/sdk/ntwin32.mak: -------------------------------------------------------------------------------- 1 | 2 | !include 3 | 4 | -------------------------------------------------------------------------------- /nt4/sdk/objerror.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992-1996. 5 | // 6 | // File: objerror.h 7 | // 8 | //---------------------------------------------------------------------------- 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /nt4/sdk/ole2ver.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * * 3 | * ole2ver.h - OLE 2 Version Number Info * 4 | * * 5 | * Copyright (c) 1992-1996, Microsoft Corp. All rights reserved. * 6 | * * 7 | \*****************************************************************************/ 8 | 9 | #ifndef _OLE2VER_H_ 10 | #define _OLE2VER_H_ 11 | 12 | #define rmm 23 13 | #define rup 639 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /nt4/sdk/olectlid.h: -------------------------------------------------------------------------------- 1 | /*****************************************************************************\ 2 | * * 3 | * olectlid.h Master definition of GUIDs for OLE Controls * 4 | * * 5 | * OLE Version 2.0 * 6 | * * 7 | * Copyright (c) 1992-1996, Microsoft Corp. All rights reserved. * 8 | * * 9 | \*****************************************************************************/ 10 | 11 | #pragma message("WARNING: your code should #include olectl.h instead") 12 | #include 13 | -------------------------------------------------------------------------------- /nt4/sdk/poppack.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1990-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | poppack.h 8 | 9 | Abstract: 10 | 11 | This file turns packing of structures off. (That is, it enables 12 | automatic alignment of structure fields.) An include file is needed 13 | because various compilers do this in different ways. 14 | 15 | poppack.h is the complement to pshpack?.h. An inclusion of poppack.h 16 | MUST ALWAYS be preceded by an inclusion of one of pshpack?.h, in one-to-one 17 | correspondence. 18 | 19 | For Microsoft compatible compilers, this file uses the pop option 20 | to the pack pragma so that it can restore the previous saved by the 21 | pshpack?.h include file. 22 | 23 | --*/ 24 | 25 | #if ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 26 | #if ( _MSC_VER >= 800 ) || defined(_PUSHPOP_SUPPORTED) 27 | #pragma warning(disable:4103) 28 | #if !(defined( MIDL_PASS )) || defined( __midl ) 29 | #pragma pack(pop) 30 | #else 31 | #pragma pack() 32 | #endif 33 | #else 34 | #pragma pack() 35 | #endif 36 | #endif // ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 37 | -------------------------------------------------------------------------------- /nt4/sdk/pshpack1.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1995-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | pshpack1.h 8 | 9 | Abstract: 10 | 11 | This file turns 1 byte packing of structures on. (That is, it disables 12 | automatic alignment of structure fields.) An include file is needed 13 | because various compilers do this in different ways. For Microsoft 14 | compatible compilers, this files uses the push option to the pack pragma 15 | so that the poppack.h include file can restore the previous packing 16 | reliably. 17 | 18 | The file poppack.h is the complement to this file. 19 | 20 | --*/ 21 | 22 | #if ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 23 | #if ( _MSC_VER >= 800 ) || defined(_PUSHPOP_SUPPORTED) 24 | #pragma warning(disable:4103) 25 | #if !(defined( MIDL_PASS )) || defined( __midl ) 26 | #pragma pack(push) 27 | #endif 28 | #pragma pack(1) 29 | #else 30 | #pragma pack(1) 31 | #endif 32 | #endif // ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 33 | -------------------------------------------------------------------------------- /nt4/sdk/pshpack2.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1995-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | pshpack2.h 8 | 9 | Abstract: 10 | 11 | This file turns 2 byte packing of structures on. (That is, it disables 12 | automatic alignment of structure fields.) An include file is needed 13 | because various compilers do this in different ways. For Microsoft 14 | compatible compilers, this files uses the push option to the pack pragma 15 | so that the poppack.h include file can restore the previous packing 16 | reliably. 17 | 18 | The file poppack.h is the complement to this file. 19 | 20 | --*/ 21 | 22 | #if ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 23 | #if ( _MSC_VER >= 800 ) || defined(_PUSHPOP_SUPPORTED) 24 | #pragma warning(disable:4103) 25 | #if !(defined( MIDL_PASS )) || defined( __midl ) 26 | #pragma pack(push) 27 | #endif 28 | #pragma pack(2) 29 | #else 30 | #pragma pack(2) 31 | #endif 32 | #endif // ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 33 | -------------------------------------------------------------------------------- /nt4/sdk/pshpack4.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1995-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | pshpack4.h 8 | 9 | Abstract: 10 | 11 | This file turns 4 byte packing of structures on. (That is, it disables 12 | automatic alignment of structure fields.) An include file is needed 13 | because various compilers do this in different ways. For Microsoft 14 | compatible compilers, this files uses the push option to the pack pragma 15 | so that the poppack.h include file can restore the previous packing 16 | reliably. 17 | 18 | The file poppack.h is the complement to this file. 19 | 20 | --*/ 21 | 22 | #if ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 23 | #if ( _MSC_VER >= 800 ) || defined(_PUSHPOP_SUPPORTED) 24 | #pragma warning(disable:4103) 25 | #if !(defined( MIDL_PASS )) || defined( __midl ) 26 | #pragma pack(push) 27 | #endif 28 | #pragma pack(4) 29 | #else 30 | #pragma pack(4) 31 | #endif 32 | #endif // ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 33 | -------------------------------------------------------------------------------- /nt4/sdk/pshpack8.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1995-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | pshpack8.h 8 | 9 | Abstract: 10 | 11 | This file turns 8 byte packing of structures on. (That is, it disables 12 | automatic alignment of structure fields.) An include file is needed 13 | because various compilers do this in different ways. For Microsoft 14 | compatible compilers, this files uses the push option to the pack pragma 15 | so that the poppack.h include file can restore the previous packing 16 | reliably. 17 | 18 | The file poppack.h is the complement to this file. 19 | 20 | --*/ 21 | 22 | #if ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 23 | #if ( _MSC_VER >= 800 ) || defined(_PUSHPOP_SUPPORTED) 24 | #pragma warning(disable:4103) 25 | #if !(defined( MIDL_PASS )) || defined( __midl ) 26 | #pragma pack(push) 27 | #endif 28 | #pragma pack(8) 29 | #else 30 | #pragma pack(8) 31 | #endif 32 | #endif // ! (defined(lint) || defined(_lint) || defined(RC_INVOKED)) 33 | -------------------------------------------------------------------------------- /nt4/sdk/recguids.h: -------------------------------------------------------------------------------- 1 | /* 2 | * recguids.h - OLE reconciliation interface GUID definitions. 3 | */ 4 | 5 | 6 | /* GUIDs 7 | ********/ 8 | 9 | DEFINE_GUID(IID_IReconcileInitiator, 0x99180161L, 0xDA16, 0x101A, 0x93, 0x5C, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); 10 | DEFINE_GUID(IID_IReconcilableObject, 0x99180162L, 0xDA16, 0x101A, 0x93, 0x5C, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); 11 | DEFINE_GUID(IID_INotifyReplica, 0x99180163L, 0xDA16, 0x101A, 0x93, 0x5C, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); 12 | DEFINE_GUID(IID_IBriefcaseInitiator, 0x99180164L, 0xDA16, 0x101A, 0x93, 0x5C, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); 13 | 14 | -------------------------------------------------------------------------------- /nt4/sdk/rpcnsip.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1992-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | rpcnsip.h 8 | 9 | Abstract: 10 | 11 | This file contains the types and function definitions to use the 12 | to implement the autohandle features of the runtime. 13 | 14 | --*/ 15 | 16 | #ifndef __RPCNSIP_H__ 17 | #define __RPCNSIP_H__ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef struct 24 | { 25 | RPC_NS_HANDLE LookupContext; 26 | RPC_BINDING_HANDLE ProposedHandle; 27 | RPC_BINDING_VECTOR * Bindings; 28 | 29 | } RPC_IMPORT_CONTEXT_P, * PRPC_IMPORT_CONTEXT_P; 30 | 31 | 32 | /* Stub Auto Binding routines. */ 33 | 34 | RPC_STATUS RPC_ENTRY 35 | I_RpcNsGetBuffer( 36 | IN PRPC_MESSAGE Message 37 | ); 38 | 39 | RPC_STATUS RPC_ENTRY 40 | I_RpcNsSendReceive( 41 | IN PRPC_MESSAGE Message, 42 | OUT RPC_BINDING_HANDLE __RPC_FAR * Handle 43 | ); 44 | 45 | void RPC_ENTRY 46 | I_RpcNsRaiseException( 47 | IN PRPC_MESSAGE Message, 48 | IN RPC_STATUS Status 49 | ); 50 | 51 | RPC_STATUS RPC_ENTRY 52 | I_RpcReBindBuffer( 53 | IN PRPC_MESSAGE Message 54 | ); 55 | 56 | RPC_STATUS RPC_ENTRY 57 | I_NsServerBindSearch( 58 | ); 59 | 60 | RPC_STATUS RPC_ENTRY 61 | I_NsClientBindSearch( 62 | ); 63 | 64 | void RPC_ENTRY 65 | I_NsClientBindDone( 66 | ); 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __RPCNSIP_H__ */ 73 | -------------------------------------------------------------------------------- /nt4/sdk/rpcnterr.h: -------------------------------------------------------------------------------- 1 | /*********************************************************/ 2 | /** Microsoft LAN Manager **/ 3 | /** Copyright(c) Microsoft Corp., 1987-1996 **/ 4 | /** **/ 5 | /** Rpc Error Codes from the compiler and runtime **/ 6 | /** **/ 7 | /*********************************************************/ 8 | 9 | /* 10 | If you change this file, you must also change rpcerr.h. 11 | */ 12 | 13 | #ifndef __RPCNTERR_H__ 14 | #define __RPCNTERR_H__ 15 | 16 | #define RPC_S_OK ERROR_SUCCESS 17 | #define RPC_S_INVALID_ARG ERROR_INVALID_PARAMETER 18 | #define RPC_S_OUT_OF_MEMORY ERROR_OUTOFMEMORY 19 | #define RPC_S_OUT_OF_THREADS ERROR_MAX_THRDS_REACHED 20 | #define RPC_S_INVALID_LEVEL ERROR_INVALID_PARAMETER 21 | #define RPC_S_BUFFER_TOO_SMALL ERROR_INSUFFICIENT_BUFFER 22 | #define RPC_S_INVALID_SECURITY_DESC ERROR_INVALID_SECURITY_DESCR 23 | #define RPC_S_ACCESS_DENIED ERROR_ACCESS_DENIED 24 | #define RPC_S_SERVER_OUT_OF_MEMORY ERROR_NOT_ENOUGH_SERVER_MEMORY 25 | 26 | #define RPC_X_NO_MEMORY RPC_S_OUT_OF_MEMORY 27 | #define RPC_X_INVALID_BOUND RPC_S_INVALID_BOUND 28 | #define RPC_X_INVALID_TAG RPC_S_INVALID_TAG 29 | #define RPC_X_ENUM_VALUE_TOO_LARGE RPC_X_ENUM_VALUE_OUT_OF_RANGE 30 | #define RPC_X_SS_CONTEXT_MISMATCH ERROR_INVALID_HANDLE 31 | #define RPC_X_INVALID_BUFFER ERROR_INVALID_USER_BUFFER 32 | 33 | #endif /* __RPCNTERR_H__ */ 34 | -------------------------------------------------------------------------------- /nt4/sdk/scode.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1992-1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | scode.h 8 | 9 | Abstract: 10 | 11 | Obsolete SCODE header file. Use WINERROR.H 12 | 13 | --*/ 14 | 15 | #ifndef _WINERROR_ 16 | #include 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /nt4/sdk/sehmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | SEHMAP.H - Map old-style structured exception handling to correct names. 4 | 5 | The mapping of structured exception handling statements from {try, except, 6 | finally, leave} to their proper names (prefaced by "__") has been removed 7 | from win32.mak. This header is provided solely for compatibility with 8 | source code that used the older convention. 9 | 10 | */ 11 | 12 | 13 | #ifndef __cplusplus 14 | #undef try 15 | #undef except 16 | #undef finally 17 | #undef leave 18 | #define try __try 19 | #define except __except 20 | #define finally __finally 21 | #define leave __leave 22 | #endif 23 | -------------------------------------------------------------------------------- /nt4/sdk/smpab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * S M P A B . H 3 | * 4 | * Definitions used by the Microsoft Sample Address Book 5 | * provider for service entry calls 6 | * 7 | * Copyright 1993-1995 Microsoft Corporation. All Rights Reserved. 8 | */ 9 | 10 | /* 11 | * Property tag definitions 12 | */ 13 | 14 | /* The following MAPI-defined properties are settable in service entry */ 15 | /* calls: */ 16 | /* */ 17 | /* PR_SAB_FILE_NAME */ 18 | /* PR_SAB_UID */ 19 | 20 | #define PR_SAB_FILE PROP_TAG(PT_STRING8,0x6604) 21 | #define PR_SAB_UID PROP_TAG(PT_BINARY,0x6601) 22 | 23 | /* 24 | * PR_SAB_FILE_NAME is the full path name of the .SAB file (e.g. c:\foo\mylist.sab). 25 | * This string must be ANSI. 26 | * 27 | * PR_SAB_UID is the UID uniquely identifying this session of the SAB. If you have 28 | * multiple SABs configured, they must have different PR_SAB_UIDs. 29 | */ 30 | 31 | /* 32 | * The Sample Address Book's PR_AB_PROVIDER_ID 33 | */ 34 | #define SAB_PROVIDER_ID {0x34,0xda,0x7e,0x60,0x03,0x1b,0x11,0xce,0x95,0x74,0x00,0xaa,0x00,0x3c,0xd2,0x07} 35 | 36 | -------------------------------------------------------------------------------- /nt4/sdk/smpms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * S M P M S . H 3 | * 4 | * Definitions used by the Microsoft Sample Message Store Provider 5 | * for service entry calls. 6 | * 7 | * The following MAPI-defined properties are settable in service 8 | * entry calls for the Sample Message Store Provider. 9 | * 10 | * Copyright 1993-1995 Microsoft Corporation. All Rights Reserved. 11 | */ 12 | 13 | #ifndef _SMPMS_H_ 14 | #define _SMPMS_H_ 15 | 16 | #define SMS_EXTERN_PROPID_BASE 0x6700 /* From MAPITAGS.H comments */ 17 | 18 | #define PR_SMS_PATH PROP_TAG(PT_STRING8, SMS_EXTERN_PROPID_BASE + 0) 19 | #define PR_SMS_PASSWORD PROP_TAG(PT_STRING8, SMS_EXTERN_PROPID_BASE + 1) 20 | #define PR_SMS_REMEMBER_PW PROP_TAG(PT_BOOLEAN, SMS_EXTERN_PROPID_BASE + 2) 21 | #define PR_SMS_CREATE PROP_TAG(PT_BOOLEAN, SMS_EXTERN_PROPID_BASE + 3) 22 | 23 | 24 | /* 25 | * The following is a description of each of the Sample Message Store 26 | * Provider properties: 27 | * 28 | * PR_SMS_PATH 29 | * The full pathname to the root directory of the sample message store. 30 | * 31 | * PR_SMS_PASSWORD 32 | * The password needed to open the store (if already present), or the 33 | * new password (if creating the store). 34 | * 35 | * PR_SMS_REMEMBER_PW 36 | * If non-zero (TRUE), this property asks the service entry to save the 37 | * password in the profile, and to not prompt for it. 38 | * 39 | * PR_SMS_CREATE 40 | * If non-zero (TRUE), this property asks the service entry to create the 41 | * sample store. Otherwise, the service entry will attempt to open an 42 | * existing store. 43 | */ 44 | 45 | /* 46 | * PR_MDB_PROVIDER is the GUID that represent the Sample Message Store 47 | * Provider. This guid is available as a property in the stores 48 | * table and on the message store object. 49 | */ 50 | #define SMPMS_UID_PROVIDER \ 51 | { 0x38, 0x5d, 0x47, 0x5f, \ 52 | 0xec, 0xf1, 0xcd, 0x11, \ 53 | 0x93, 0xdc, 0x5a, 0xab, \ 54 | 0x3C, 0x47, 0x84, 0x37 } 55 | 56 | #endif /* _SMPMS_H_ */ 57 | 58 | -------------------------------------------------------------------------------- /nt4/sdk/sporder.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) 1996 Microsoft Corporation 4 | 5 | Module Name: 6 | 7 | sporder.h 8 | 9 | Abstract: 10 | 11 | This header prototypes the 32-Bit Windows functions that are used 12 | to change the order or WinSock2 transport service providers and 13 | name space providers. 14 | 15 | Revision History: 16 | 17 | --*/ 18 | 19 | 20 | 21 | int 22 | WSPAPI 23 | WSCWriteProviderOrder ( 24 | IN LPDWORD lpwdCatalogEntryId, 25 | IN DWORD dwNumberOfEntries 26 | ); 27 | /*++ 28 | 29 | Routine Description: 30 | 31 | Reorder existing WinSock2 service providers. The order of the service 32 | providers determines their priority in being selected for use. The 33 | sporder.exe tool will show you the installed provider and their ordering, 34 | Alternately, WSAEnumProtocols(), in conjunction with this function, 35 | will allow you to write your own tool. 36 | 37 | Arguments: 38 | 39 | lpwdCatalogEntryId [in] 40 | An array of CatalogEntryId elements as found in the WSAPROTOCOL_INFO 41 | structure. The order of the CatalogEntryId elements is the new 42 | priority ordering for the service providers. 43 | 44 | dwNumberOfEntries [in] 45 | The number of elements in the lpwdCatalogEntryId array. 46 | 47 | 48 | Return Value: 49 | 50 | ERROR_SUCCESS - the service providers have been reordered. 51 | WSAEINVAL - input parameters were bad, no action was taken. 52 | ERROR_BUSY - the routine is being called by another thread or process. 53 | any registry error code 54 | 55 | 56 | Comments: 57 | 58 | Here are scenarios in which the WSCWriteProviderOrder function may fail: 59 | 60 | The dwNumberOfEntries is not equal to the number of registered service 61 | providers. 62 | 63 | The lpwdCatalogEntryId contains an invalid catalog ID. 64 | 65 | The lpwdCatalogEntryId does not contain all valid catalog IDs exactly 66 | 1 time. 67 | 68 | The routine is not able to access the registry for some reason 69 | (e.g. inadequate user persmissions) 70 | 71 | Another process (or thread) is currently calling the routine. 72 | 73 | --*/ 74 | -------------------------------------------------------------------------------- /nt4/sdk/storage.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992-1996. 5 | // 6 | // File: storage.h 7 | // 8 | //---------------------------------------------------------------------------- 9 | 10 | #ifndef RC_INVOKED 11 | #pragma message("WARNING: your code should #include objbase.h instead of storage.h") 12 | #endif /* !RC_INVOKED */ 13 | 14 | #include 15 | 16 | -------------------------------------------------------------------------------- /nt4/sdk/unknwn.idl: -------------------------------------------------------------------------------- 1 | //+------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992 - 1996. 5 | // 6 | // File: unknwn.idl 7 | // 8 | // Contents: IUnknown interface definition 9 | // 10 | // 11 | //-------------------------------------------------------------------------- 12 | 13 | cpp_quote("//+-------------------------------------------------------------------------") 14 | cpp_quote("//") 15 | cpp_quote("// Microsoft Windows") 16 | cpp_quote("// Copyright (C) Microsoft Corporation, 1992 - 1996.") 17 | cpp_quote("//") 18 | cpp_quote("//--------------------------------------------------------------------------") 19 | 20 | #ifndef DO_NO_IMPORTS 21 | import "wtypes.idl"; 22 | #endif 23 | 24 | [ 25 | local, 26 | object, 27 | uuid(00000000-0000-0000-C000-000000000046), 28 | pointer_default(unique) 29 | ] 30 | 31 | interface IUnknown 32 | { 33 | typedef [unique] IUnknown *LPUNKNOWN; 34 | 35 | cpp_quote("//////////////////////////////////////////////////////////////////") 36 | cpp_quote("// IID_IUnknown and all other system IIDs are provided in UUID.LIB") 37 | cpp_quote("// Link that library in with your proxies, clients and servers") 38 | cpp_quote("//////////////////////////////////////////////////////////////////") 39 | 40 | HRESULT QueryInterface( 41 | [in] REFIID riid, 42 | [out, iid_is(riid)] void **ppvObject); 43 | ULONG AddRef(); 44 | ULONG Release(); 45 | } 46 | 47 | [ 48 | object, 49 | uuid(00000001-0000-0000-C000-000000000046), 50 | pointer_default(unique) 51 | ] 52 | 53 | interface IClassFactory : IUnknown 54 | { 55 | typedef [unique] IClassFactory * LPCLASSFACTORY; 56 | 57 | [local] 58 | HRESULT CreateInstance( 59 | [in, unique] IUnknown * pUnkOuter, 60 | [in] REFIID riid, 61 | [out, iid_is(riid)] void **ppvObject); 62 | 63 | [call_as(CreateInstance)] 64 | HRESULT RemoteCreateInstance( 65 | [in] REFIID riid, 66 | [out, iid_is(riid)] IUnknown ** ppvObject); 67 | 68 | [local] 69 | HRESULT LockServer( 70 | [in] BOOL fLock); 71 | 72 | [call_as(LockServer)] 73 | HRESULT __stdcall RemoteLockServer( 74 | [in] BOOL fLock); 75 | } 76 | -------------------------------------------------------------------------------- /nt4/sdk/variant.h: -------------------------------------------------------------------------------- 1 | //+--------------------------------------------------------------------------- 2 | // 3 | // Microsoft Windows 4 | // Copyright (C) Microsoft Corporation, 1992-1996. 5 | // 6 | // File: variant.h 7 | // 8 | //---------------------------------------------------------------------------- 9 | 10 | #ifndef RC_INVOKED 11 | #pragma message("WARNING: your code should #include oleauto.h instead of variant.h") 12 | #endif /* !RC_INVOKED */ 13 | 14 | #include 15 | 16 | -------------------------------------------------------------------------------- /nt4/sdk/w32chico.mk: -------------------------------------------------------------------------------- 1 | 2 | !include 3 | 4 | -------------------------------------------------------------------------------- /nt4/sdk/wsipx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wsipx.h 3 | * 4 | * Microsoft Windows 5 | * Copyright (C) Microsoft Corporation, 1992-1996. 6 | * 7 | * Windows Sockets include file for IPX/SPX. This file contains all 8 | * standardized IPX/SPX information. Include this header file after 9 | * winsock.h. 10 | * 11 | * To open an IPX socket, call socket() with an address family of 12 | * AF_IPX, a socket type of SOCK_DGRAM, and protocol NSPROTO_IPX. 13 | * Note that the protocol value must be specified, it cannot be 0. 14 | * All IPX packets are sent with the packet type field of the IPX 15 | * header set to 0. 16 | * 17 | * To open an SPX or SPXII socket, call socket() with an address 18 | * family of AF_IPX, socket type of SOCK_SEQPACKET or SOCK_STREAM, 19 | * and protocol of NSPROTO_SPX or NSPROTO_SPXII. If SOCK_SEQPACKET 20 | * is specified, then the end of message bit is respected, and 21 | * recv() calls are not completed until a packet is received with 22 | * the end of message bit set. If SOCK_STREAM is specified, then 23 | * the end of message bit is not respected, and recv() completes 24 | * as soon as any data is received, regardless of the setting of the 25 | * end of message bit. Send coalescing is never performed, and sends 26 | * smaller than a single packet are always sent with the end of 27 | * message bit set. Sends larger than a single packet are packetized 28 | * with the end of message bit set on only the last packet of the 29 | * send. 30 | * 31 | */ 32 | 33 | #ifndef _WSIPX_ 34 | #define _WSIPX_ 35 | 36 | /* 37 | * This is the structure of the SOCKADDR structure for IPX and SPX. 38 | * 39 | */ 40 | 41 | typedef struct sockaddr_ipx { 42 | short sa_family; 43 | char sa_netnum[4]; 44 | char sa_nodenum[6]; 45 | unsigned short sa_socket; 46 | } SOCKADDR_IPX, *PSOCKADDR_IPX,FAR *LPSOCKADDR_IPX; 47 | 48 | /* 49 | * Protocol families used in the "protocol" parameter of the socket() API. 50 | * 51 | */ 52 | 53 | #define NSPROTO_IPX 1000 54 | #define NSPROTO_SPX 1256 55 | #define NSPROTO_SPXII 1257 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /nt4/sdk/wsvns.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * 3 | * wsvns.h 4 | * 5 | * Windows Sockets include file for VINES IP. This file contains all 6 | * standardized VINES IP information. Include this header file after 7 | * winsock.h. 8 | * 9 | * To open an VINES IP socket, call socket() with an address family of 10 | * AF_BAN, a socket type of SOCK_DGRAM, SOCK_STREAM, or SOCK_SEQPACKET, 11 | * and protocol of 0. 12 | * 13 | ******************************************************************************/ 14 | 15 | #ifndef _WSVNS_ 16 | #define _WSVNS_ 17 | 18 | /* 19 | * Socket address, VINES IP style. Address fields and port field are defined 20 | * as a sequence of bytes. This is done because they are byte ordered 21 | * BIG ENDIAN, ala most significant byte first. 22 | */ 23 | typedef struct sockaddr_vns { 24 | u_short sin_family; // = AF_BAN 25 | u_char net_address[4]; // network address 26 | u_char subnet_addr[2]; // subnet address 27 | u_char port[2]; // msb=port[0], lsb=port[1] 28 | u_char hops; // # hops for broadcasts 29 | u_char filler[5]; // filler, zeros 30 | } SOCKADDR_VNS, *PSOCKADDR_VNS, FAR *LPSOCKADDR_VNS; 31 | 32 | #define VNSPROTO_IPC 1 33 | #define VNSPROTO_RELIABLE_IPC 2 34 | #define VNSPROTO_SPP 3 35 | 36 | 37 | #endif _WSVNS_ 38 | 39 | 40 | -------------------------------------------------------------------------------- /nt4/sdk/xcmcmsx2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * XCMCMSX2.H 3 | * 4 | * Purpose: 5 | * Specifies constants and data structures for Microsoft CMC extensions 6 | * set update (forms extensions) 7 | * 8 | */ 9 | 10 | #ifndef _XCMCMSX2_H 11 | #define _XCMCMSX2_H 12 | 13 | #ifndef XCMCMSXT_H 14 | # include 15 | #endif 16 | 17 | #ifndef MAPIDEFS_H 18 | # include 19 | #endif 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* Get an extended MAPI session from a CMC session */ 26 | #ifdef MAPIX_H 27 | 28 | STDMETHODIMP_(SCODE) 29 | ScMAPIXFromCMC(CMC_session_id cmc_session, 30 | ULONG ulFlags, 31 | LPCIID lpInterface, 32 | LPMAPISESSION FAR * lppMAPISession); 33 | 34 | #endif /* MAPIX_H */ 35 | 36 | /* Extra flag for CMC_X_MS_ATTACH_DATA */ 37 | #define CMC_X_MS_ATTACH_MESSAGE ((CMC_flags) 4) 38 | 39 | /* Attachment descriptor for CMC_X_ATTACH_DATA */ 40 | typedef struct { 41 | CMC_message_reference FAR *message; 42 | CMC_uint32 id; 43 | CMC_buffer object; 44 | } CMC_X_MS_ATTACH; 45 | 46 | #ifdef __cplusplus 47 | } /* extern "C" */ 48 | #endif 49 | 50 | #endif /* _XCMCMSX2_H */ 51 | 52 | -------------------------------------------------------------------------------- /nt4/sdk/xcmcmsxt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * XCMCMSXT.H 3 | * 4 | * Purpose: 5 | * Specifies constants and data structures for Microsoft CMC extension set 6 | * 7 | */ 8 | 9 | #ifndef XCMCMSXT_H 10 | #define XCMCMSXT_H 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /*********************************************************************** 17 | Warning: Value for MS_EXT_SET_ID has not been finalized yet. 18 | ***********************************************************************/ 19 | #define MS_EXT_SET_ID (512) 20 | 21 | #define CMC_XS_MS ((CMC_uint32) MS_EXT_SET_ID) 22 | 23 | /*** FUNCTION EXTENSIONS ***/ 24 | 25 | /* Describes extra flags used for logging on/off a session */ 26 | #define CMC_X_MS_SESSION_FLAGS ((CMC_uint32) MS_EXT_SET_ID + 16) 27 | #define CMC_X_MS_NEW_SESSION ((CMC_flags) 1) 28 | #define CMC_X_MS_FORCE_DOWNLOAD ((CMC_flags) 4) 29 | 30 | /* Flags used by various functions */ 31 | #define CMC_X_MS_FUNCTION_FLAGS ((CMC_uint32) MS_EXT_SET_ID + 17) 32 | #define CMC_X_MS_READ_ENV_ONLY ((CMC_flags) 1) 33 | #define CMC_X_MS_READ_BODY_AS_FILE ((CMC_flags) 2) 34 | #define CMC_X_MS_LIST_GUARANTEE_FIFO ((CMC_flags) 4) 35 | #define CMC_X_MS_AB_NO_MODIFY ((CMC_flags) 8) 36 | 37 | /* Extra options when displaying the Address Book UI */ 38 | #define CMC_X_MS_ADDRESS_UI ((CMC_uint32) MS_EXT_SET_ID + 18) 39 | 40 | /*** DATA EXTENSIONS ***/ 41 | 42 | /* Extra flags for attachments */ 43 | #define CMC_X_MS_ATTACH_DATA ((CMC_uint32) MS_EXT_SET_ID + 128) 44 | #define CMC_X_MS_ATTACH_OLE ((CMC_flags) 1) 45 | #define CMC_X_MS_ATTACH_OLE_STATIC ((CMC_flags) 2) 46 | 47 | /* Extra data for messages */ 48 | #define CMC_X_MS_MESSAGE_DATA ((CMC_uint32) MS_EXT_SET_ID + 129) 49 | #define CMC_X_MS_MSG_RECEIPT_REQ ((CMC_flags) 1) 50 | 51 | #ifdef __cplusplus 52 | } /* extern "C" */ 53 | #endif 54 | 55 | #endif /* XCMCMSXT_H */ 56 | --------------------------------------------------------------------------------