summaryrefslogtreecommitdiffstats
path: root/private/ole32/olethunk/debnot
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ole32/olethunk/debnot
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/ole32/olethunk/debnot')
-rw-r--r--private/ole32/olethunk/debnot/assert.cxx252
-rw-r--r--private/ole32/olethunk/debnot/daytona/makefile23
-rw-r--r--private/ole32/olethunk/debnot/daytona/sources33
-rw-r--r--private/ole32/olethunk/debnot/dirs36
-rw-r--r--private/ole32/olethunk/debnot/dprintf.c19
-rw-r--r--private/ole32/olethunk/debnot/dprintf.h33
-rw-r--r--private/ole32/olethunk/debnot/output.c806
-rw-r--r--private/ole32/olethunk/debnot/printf.h261
-rw-r--r--private/ole32/olethunk/debnot/sprintf.c17
-rw-r--r--private/ole32/olethunk/debnot/w4io.h59
-rw-r--r--private/ole32/olethunk/debnot/win16.mk24
-rw-r--r--private/ole32/olethunk/debnot/win32/makefile6
-rw-r--r--private/ole32/olethunk/debnot/win32/sources45
13 files changed, 1614 insertions, 0 deletions
diff --git a/private/ole32/olethunk/debnot/assert.cxx b/private/ole32/olethunk/debnot/assert.cxx
new file mode 100644
index 000000000..d6125e5e4
--- /dev/null
+++ b/private/ole32/olethunk/debnot/assert.cxx
@@ -0,0 +1,252 @@
+//+---------------------------------------------------------------------------
+// Copyright (C) 1991, Microsoft Corporation.
+//
+// File: assert.cxx
+//
+// Contents: Debugging output routines for idsmgr.dll
+//
+// Functions: _Assert
+// _PopUpError
+//
+// History: 23-Jul-91 KyleP Created.
+// 09-Oct-91 KevinRo Major changes and comments added
+// 18-Oct-91 vich moved debug print routines out
+// 10-Jun-92 BryanT Switched to w4crt.h instead of wchar.h
+//
+//----------------------------------------------------------------------------
+
+//
+// This one file **always** uses debugging options
+//
+
+#if DBG == 1
+
+#include <stdarg.h>
+
+# include <debnot.h>
+# include "dprintf.h" // w4printf, w4dprintf prototypes
+
+extern "C"
+{
+#include <windows.h>
+
+#ifndef WIN32
+#define MessageBoxA MessageBox
+#define wsprintfA wsprintf
+#endif
+}
+
+int APINOT _PopUpError(char const FAR *szMsg,
+ int iLine,
+ char const FAR *szFile);
+
+unsigned long Win4InfoLevel = DEF_INFOLEVEL;
+unsigned long Win4InfoMask = 0xffffffff;
+unsigned long Win4AssertLevel = ASSRT_MESSAGE | ASSRT_BREAK | ASSRT_POPUP;
+
+//+---------------------------------------------------------------------------
+//
+// Function: _asdprintf
+//
+// Synopsis: Calls vdprintf to output a formatted message.
+//
+// History: 18-Oct-91 vich Created
+//
+//----------------------------------------------------------------------------
+inline void _asdprintf(char const FAR *pszfmt, ...)
+{
+ va_list va;
+ va_start(va, pszfmt);
+
+ vdprintf(DEB_FORCE, "Assert", pszfmt, va);
+
+ va_end(va);
+}
+
+//+---------------------------------------------------------------------------
+//
+// Function: _Win4Assert, private
+//
+// Synopsis: Display assertion information
+//
+// Effects: Called when an assertion is hit.
+//
+// History: 12-Jul-91 AlexT Created.
+// 05-Sep-91 AlexT Catch Throws and Catches
+// 19-Oct-92 HoiV Added events for TOM
+//
+//----------------------------------------------------------------------------
+
+void APINOT _Win4Assert(char const FAR * szFile,
+ int iLine,
+ char const FAR * szMessage)
+{
+ if (Win4AssertLevel & ASSRT_MESSAGE)
+ {
+ _asdprintf("%s File: %s Line: %u\n", szMessage, szFile, iLine);
+ }
+
+ if (Win4AssertLevel & ASSRT_POPUP)
+ {
+ int id = _PopUpError(szMessage,iLine,szFile);
+
+ if (id == IDCANCEL)
+ {
+#ifndef FLAT
+ _asm int 3;
+#else
+ DebugBreak();
+#endif
+ }
+ }
+ else if (Win4AssertLevel & ASSRT_BREAK)
+ {
+#ifndef FLAT
+ _asm int 3;
+#else
+ DebugBreak();
+#endif
+ }
+}
+
+
+//+------------------------------------------------------------
+// Function: _SetWin4InfoLevel(unsigned long ulNewLevel)
+//
+// Synopsis: Sets the global info level for debugging output
+// Returns: Old info level
+//
+//-------------------------------------------------------------
+
+unsigned long APINOT _SetWin4InfoLevel(unsigned long ulNewLevel)
+{
+ unsigned long ul;
+
+ ul = Win4InfoLevel;
+ Win4InfoLevel = ulNewLevel;
+ return(ul);
+}
+
+
+//+------------------------------------------------------------
+// Function: _SetWin4InfoMask(unsigned long ulNewMask)
+//
+// Synopsis: Sets the global info mask for debugging output
+// Returns: Old info mask
+//
+//-------------------------------------------------------------
+
+unsigned long APINOT _SetWin4InfoMask(unsigned long ulNewMask)
+{
+ unsigned long ul;
+
+ ul = Win4InfoMask;
+ Win4InfoMask = ulNewMask;
+ return(ul);
+}
+
+
+//+------------------------------------------------------------
+// Function: _SetWin4AssertLevel(unsigned long ulNewLevel)
+//
+// Synopsis: Sets the global assert level for debugging output
+// Returns: Old assert level
+//
+//-------------------------------------------------------------
+
+unsigned long APINOT _SetWin4AssertLevel(unsigned long ulNewLevel)
+{
+ unsigned long ul;
+
+ ul = Win4AssertLevel;
+ Win4AssertLevel = ulNewLevel;
+ return(ul);
+}
+
+//+------------------------------------------------------------
+// Function: _PopUpError
+//
+// Synopsis: Displays a dialog box using provided text,
+// and presents the user with the option to
+// continue or cancel.
+//
+// Arguments:
+// szMsg -- The string to display in main body of dialog
+// iLine -- Line number of file in error
+// szFile -- Filename of file in error
+//
+// Returns:
+// IDCANCEL -- User selected the CANCEL button
+// IDOK -- User selected the OK button
+//-------------------------------------------------------------
+
+int APINOT _PopUpError(char const FAR *szMsg,int iLine, char const FAR *szFile)
+{
+
+ int id;
+ static char szAssertCaption[100];
+ wsprintfA(szAssertCaption, "File: %s line %u", szFile,iLine);
+
+ id = MessageBoxA(NULL,
+ (char FAR *) szMsg,
+ (LPSTR) szAssertCaption,
+ MB_TASKMODAL | MB_ICONEXCLAMATION | MB_OKCANCEL);
+ return id;
+}
+
+
+//+------------------------------------------------------------
+// Function: vdprintf
+//
+// Synopsis: Prints debug output using a pointer to the
+// variable information. Used primarily by the
+// xxDebugOut macros
+//
+// Arguements:
+// ulCompMask -- Component level mask used to determine
+// output ability
+// pszComp -- String const of component prefix.
+// ppszfmt -- Pointer to output format and data
+//
+//-------------------------------------------------------------
+
+void APINOT vdprintf(unsigned long ulCompMask,
+ char const FAR *pszComp,
+ char const FAR *ppszfmt,
+ va_list pargs)
+{
+ if ((ulCompMask & DEB_FORCE) == DEB_FORCE ||
+ ((ulCompMask | Win4InfoLevel) & Win4InfoMask))
+ {
+ if (! (ulCompMask & DEB_NOCOMPNAME))
+ {
+#ifdef WIN32
+#if defined(_CHICAGO_)
+ //
+ // Hex Process/Thread ID's are better for Chicago since both
+ // are memory addresses.
+ //
+ w4dprintf("%08x.%08x> %s: ",
+#else
+ w4dprintf("%03d.%03d> %s: ",
+#endif
+ GetCurrentProcessId(),
+ GetCurrentThreadId(),
+ pszComp);
+#else
+ w4dprintf("%07x> %s: ",
+ GetCurrentTask(),
+ pszComp);
+#endif
+ }
+ w4vdprintf(ppszfmt, pargs);
+
+ // Chicago and Win32s debugging is usually through wdeb386
+ // which needs carriage returns
+#if WIN32 == 50 || WIN32 == 200
+ w4dprintf("\r");
+#endif
+ }
+}
+
+#endif // DBG == 1
diff --git a/private/ole32/olethunk/debnot/daytona/makefile b/private/ole32/olethunk/debnot/daytona/makefile
new file mode 100644
index 000000000..9452d9ca9
--- /dev/null
+++ b/private/ole32/olethunk/debnot/daytona/makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 1991, Microsoft Corporation
+#
+# History:
+#
+# 28-Sept-1994 TerryRu
+
+all:
+!if "$(PROCESSOR_ARCHITECTURE)" == "x86"
+ @echo making dos mode binaries under NTVDM.
+ cd ..
+ $(MAKE) "OPST=dayt" /f win16.mk
+ cd $(MAKEDIR)
+!endif
+
+
+clean:
+!if "$(PROCESSOR_ARCHITECTURE)" == "x86"
+ cd ..
+ $(MAKE) "OPST=dayt" /f win16.mk clean
+ cd $(MAKEDIR)
+!endif
+
diff --git a/private/ole32/olethunk/debnot/daytona/sources b/private/ole32/olethunk/debnot/daytona/sources
new file mode 100644
index 000000000..dc4f04989
--- /dev/null
+++ b/private/ole32/olethunk/debnot/daytona/sources
@@ -0,0 +1,33 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ sources.
+
+Abstract:
+
+ This file specifies the target component being built and the list of
+ sources files needed to build that component. Also specifies optional
+ compiler switches and libraries that are unique for the component being
+ built.
+
+
+Author:
+
+ Terry Rusell
+
+
+!ENDIF
+
+MAJORCOMP=cairole
+MINORCOMP=olethunk
+
+
+
+TARGETNAME=olethunk
+TARGETPATH=obj
+TARGETTYPE=LIBRARY
+
+SOURCES=
diff --git a/private/ole32/olethunk/debnot/dirs b/private/ole32/olethunk/debnot/dirs
new file mode 100644
index 000000000..b055cc6f8
--- /dev/null
+++ b/private/ole32/olethunk/debnot/dirs
@@ -0,0 +1,36 @@
+
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ dirs.
+
+Abstract:
+
+ This file specifies the subdirectories of the current directory that
+ contain component makefiles.
+
+
+Author:
+
+ Terry Russell (TerryRu) 28-Sep-1994
+
+!ENDIF
+
+#
+# This is a list of all subdirectories that build required components.
+# Each subdirectory name should appear on a line by itself. The build
+# follows the order in which the subdirectories are specified.
+#
+
+
+DIRS=WIN32
+
+
+OPTIONAL_DIRS= \
+ daytona
+
+
+
diff --git a/private/ole32/olethunk/debnot/dprintf.c b/private/ole32/olethunk/debnot/dprintf.c
new file mode 100644
index 000000000..88d6047a2
--- /dev/null
+++ b/private/ole32/olethunk/debnot/dprintf.c
@@ -0,0 +1,19 @@
+/***
+*dprintf.c - print formatted to debug port
+*
+* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* defines w4dprintf() - print formatted data to debug port
+* defines w4vdprintf() - print formatted output to debug port, get data
+* from an argument ptr instead of explicit args.
+*******************************************************************************/
+
+#if DBG == 1
+
+#include "dprintf.h" // function prototypes
+
+#define _W4DPRINTF_
+#include "printf.h"
+
+#endif // DBG == 1
diff --git a/private/ole32/olethunk/debnot/dprintf.h b/private/ole32/olethunk/debnot/dprintf.h
new file mode 100644
index 000000000..7cf0affff
--- /dev/null
+++ b/private/ole32/olethunk/debnot/dprintf.h
@@ -0,0 +1,33 @@
+//+---------------------------------------------------------------------------
+// Copyright (C) 1991, Microsoft Corporation.
+//
+// File: dprintf.h
+//
+// Contents: Debugging output routine function prototypes
+//
+// Functions: w4printf
+// w4vprintf
+// w4dprintf
+// w4vdprintf
+//
+// History: 18-Oct-91 vich Created
+//
+//----------------------------------------------------------------------------
+
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef WIN32
+int _cdecl w4dprintf(const char __far *format, ...);
+int _cdecl w4vdprintf(const char __far *format, va_list arglist);
+#else
+int _cdecl w4dprintf(const char *format, ...);
+int _cdecl w4vdprintf(const char *format, va_list arglist);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/private/ole32/olethunk/debnot/output.c b/private/ole32/olethunk/debnot/output.c
new file mode 100644
index 000000000..4f2f14fdb
--- /dev/null
+++ b/private/ole32/olethunk/debnot/output.c
@@ -0,0 +1,806 @@
+/***
+*output.c - printf style output to a struct w4io
+*
+* Copyright (c) 1989-1991, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains the code that does all the work for the
+* printf family of functions. It should not be called directly, only
+* by the *printf functions. We don't make any assumtions about the
+* sizes of ints, longs, shorts, or long doubles, but if types do overlap, we
+* also try to be efficient. We do assume that pointers are the same size
+* as either ints or longs.
+*
+*Revision History:
+* 06-01-89 PHG Module created
+* 08-28-89 JCR Added cast to get rid of warning (no object changes)
+* 02-15-90 GJF Fixed copyright
+* 10-03-90 WHB Defined LOCAL(x) to "static x" for local procedures
+*
+*******************************************************************************/
+
+#if DBG == 1
+
+#include <limits.h>
+#include <string.h>
+#include <stdarg.h>
+#include "w4io.h"
+
+
+/* this macro defines a function which is private and as fast as possible: */
+/* for example, in C 6.0, it might be static _fastcall <type>. */
+#define LOCAL(x) static x // 100390--WHB
+
+#define NOFLOATS // Win 4 doesn't need floating point
+
+/* int/long/short/pointer sizes */
+
+/* the following should be set depending on the sizes of various types */
+// FLAT or LARGE model is assumed
+#ifdef FLAT
+# define LONG_IS_INT 1 /* 1 means long is same size as int */
+# define SHORT_IS_INT 0 /* 1 means short is same size as int */
+# define PTR_IS_INT 1 /* 1 means ptr is same size as int */
+# define PTR_IS_LONG 0 /* 1 means ptr is same size as long */
+#else // LARGE model
+# define LONG_IS_INT 0 /* 1 means long is same size as int */
+# define SHORT_IS_INT 1 /* 1 means short is same size as int */
+# define PTR_IS_INT 0 /* 1 means ptr is same size as int */
+# define PTR_IS_LONG 1 /* 1 means ptr is same size as long */
+#endif
+#define LONGDOUBLE_IS_DOUBLE 0 /* 1 means long double is same as double */
+
+#if LONG_IS_INT
+ #define get_long_arg(x) (long)get_int_arg(x)
+#endif
+
+#if PTR_IS_INT
+ #define get_ptr_arg(x) (void FAR *)get_int_arg(x)
+#elif PTR_IS_LONG
+ #define get_ptr_arg(x) (void FAR *)get_long_arg(x)
+#else
+ #error Size of pointer must be same as size of int or long
+#endif
+
+#ifndef NOFLOATS
+/* These are "fake" double and long doubles to fool the compiler,
+ so we don't drag in floating point. */
+typedef struct {
+ char x[sizeof(double)];
+} DOUBLE;
+typedef struct {
+ char x[sizeof(long double)];
+} LONGDOUBLE;
+#endif
+
+
+/* CONSTANTS */
+
+//#define BUFFERSIZE CVTBUFSIZE /* buffer size for maximum double conv */
+#define BUFFERSIZE 20
+
+/* flag definitions */
+#define FL_SIGN 0x0001 /* put plus or minus in front */
+#define FL_SIGNSP 0x0002 /* put space or minus in front */
+#define FL_LEFT 0x0004 /* left justify */
+#define FL_LEADZERO 0x0008 /* pad with leading zeros */
+#define FL_LONG 0x0010 /* long value given */
+#define FL_SHORT 0x0020 /* short value given */
+#define FL_SIGNED 0x0040 /* signed data given */
+#define FL_ALTERNATE 0x0080 /* alternate form requested */
+#define FL_NEGATIVE 0x0100 /* value is negative */
+#define FL_FORCEOCTAL 0x0200 /* force leading '0' for octals */
+#define FL_LONGDOUBLE 0x0400 /* long double value given */
+#define FL_WIDE 0x0800 /* wide character/string given */
+
+/* state definitions */
+enum STATE {
+ ST_NORMAL, /* normal state; outputting literal chars */
+ ST_PERCENT, /* just read '%' */
+ ST_FLAG, /* just read flag character */
+ ST_WIDTH, /* just read width specifier */
+ ST_DOT, /* just read '.' */
+ ST_PRECIS, /* just read precision specifier */
+ ST_SIZE, /* just read size specifier */
+ ST_TYPE /* just read type specifier */
+};
+#define NUMSTATES (ST_TYPE + 1)
+
+/* character type values */
+enum CHARTYPE {
+ CH_OTHER, /* character with no special meaning */
+ CH_PERCENT, /* '%' */
+ CH_DOT, /* '.' */
+ CH_STAR, /* '*' */
+ CH_ZERO, /* '0' */
+ CH_DIGIT, /* '1'..'9' */
+ CH_FLAG, /* ' ', '+', '-', '#' */
+ CH_SIZE, /* 'h', 'l', 'L', 'N', 'F' */
+ CH_TYPE /* type specifying character */
+};
+
+/* static data (read only, since we are re-entrant) */
+char *nullstring = "(null)"; /* string to print on null ptr */
+
+/* The state table. This table is actually two tables combined into one. */
+/* The lower nybble of each byte gives the character class of any */
+/* character; while the uper nybble of the byte gives the next state */
+/* to enter. See the macros below the table for details. */
+/* */
+/* The table is generated by maketab.c -- use the maketab program to make */
+/* changes. */
+
+static char lookuptable[] = {
+ 0x06, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00,
+ 0x10, 0x00, 0x03, 0x06, 0x00, 0x06, 0x02, 0x10,
+ 0x04, 0x45, 0x45, 0x45, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x35, 0x30, 0x00, 0x50, 0x00, 0x00, 0x00,
+ 0x00, 0x20, 0x28, 0x38, 0x50, 0x58, 0x07, 0x08,
+ 0x00, 0x30, 0x30, 0x30, 0x57, 0x50, 0x07, 0x00,
+ 0x00, 0x20, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
+ 0x00, 0x70, 0x70, 0x78, 0x78, 0x78, 0x78, 0x08,
+ 0x07, 0x08, 0x00, 0x00, 0x07, 0x00, 0x08, 0x08,
+ 0x08, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x07,
+ 0x08
+};
+
+#define find_char_class(c) \
+ ((c) < ' ' || (c) > 'x' ? \
+ CH_OTHER \
+ : \
+ lookuptable[(c)-' '] & 0xF)
+
+#define find_next_state(class, state) \
+ (lookuptable[(class) * NUMSTATES + (state)] >> 4)
+
+#if !LONG_IS_INT
+LOCAL(long) get_long_arg(va_list FAR *pargptr);
+#endif
+LOCAL(int) get_int_arg(va_list FAR *pargptr);
+LOCAL(void) writestring(char FAR *string,
+ int len,
+ struct w4io FAR *f,
+ int FAR *pcchwritten,
+ int fwide);
+
+#ifndef NOFLOATS
+/* extern float convert routines */
+typedef int (FAR * PFI)();
+extern PFI _cfltcvt_tab[5];
+#define _cfltcvt(a,b,c,d,e) (*_cfltcvt_tab[0])(a,b,c,d,e)
+#define _cropzeros(a) (*_cfltcvt_tab[1])(a)
+#define _fassign(a,b,c) (*_cfltcvt_tab[2])(a,b,c)
+#define _forcdecpt(a) (*_cfltcvt_tab[3])(a)
+#define _positive(a) (*_cfltcvt_tab[4])(a)
+#define _cldcvt(a,b,c,d,e) (*_cfltcvt_tab[5])(a,b,c,d,e)
+#endif
+
+
+/***
+*int w4iooutput(f, format, argptr)
+*
+*Purpose:
+* Output performs printf style output onto a stream. It is called by
+* printf/fprintf/sprintf/vprintf/vfprintf/vsprintf to so the dirty
+* work. In multi-thread situations, w4iooutput assumes that the given
+* stream is already locked.
+*
+* Algorithm:
+* The format string is parsed by using a finite state automaton
+* based on the current state and the current character read from
+* the format string. Thus, looping is on a per-character basis,
+* not a per conversion specifier basis. Once the format specififying
+* character is read, output is performed.
+*
+*Entry:
+* struct w4io *f - stream for output
+* char *format - printf style format string
+* va_list argptr - pointer to list of subsidiary arguments
+*
+*Exit:
+* Returns the number of characters written, or -1 if an output error
+* occurs.
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _cdecl w4iooutput(struct w4io FAR *f, const char FAR *format, va_list argptr)
+{
+ int hexadd; /* offset to add to number to get 'a'..'f' */
+ char ch; /* character just read */
+ wchar_t wc; /* wide character temp */
+ wchar_t FAR *pwc; /* wide character temp pointer */
+ int flags; /* flag word -- see #defines above for flag values */
+ enum STATE state; /* current state */
+ enum CHARTYPE chclass; /* class of current character */
+ int radix; /* current conversion radix */
+ int charsout; /* characters currently written so far, -1 = IO error */
+ int fldwidth; /* selected field with -- 0 means default */
+ int fwide;
+ int precision; /* selected precision -- -1 means default */
+ char prefix[2]; /* numeric prefix -- up to two characters */
+ int prefixlen; /* length of prefix -- 0 means no prefix */
+ int capexp; /* non-zero = 'E' exponent signifiet, zero = 'e' */
+ int no_output; /* non-zero = prodcue no output for this specifier */
+ char FAR *text; /* pointer text to be printed, not zero terminated */
+ int textlen; /* length of the text to be printed */
+ char buffer[BUFFERSIZE]; /* buffer for conversions */
+
+ charsout = 0; /* no characters written yet */
+ state = ST_NORMAL; /* starting state */
+
+ /* main loop -- loop while format character exist and no I/O errors */
+ while ((ch = *format++) != '\0' && charsout >= 0) {
+ chclass = find_char_class(ch); /* find character class */
+ state = find_next_state(chclass, state); /* find next state */
+
+ /* execute code for each state */
+ switch (state) {
+
+ case ST_NORMAL:
+ /* normal state -- just write character */
+ f->writechar(ch, 1, f, &charsout);
+ break;
+
+ case ST_PERCENT:
+ /* set default value of conversion parameters */
+ prefixlen = fldwidth = no_output = capexp = 0;
+ flags = 0;
+ precision = -1;
+ fwide = 0;
+ break;
+
+ case ST_FLAG:
+ /* set flag based on which flag character */
+ switch (ch) {
+ case '-':
+ flags |= FL_LEFT; /* '-' => left justify */
+ break;
+ case '+':
+ flags |= FL_SIGN; /* '+' => force sign indicator */
+ break;
+ case ' ':
+ flags |= FL_SIGNSP; /* ' ' => force sign or space */
+ break;
+ case '#':
+ flags |= FL_ALTERNATE; /* '#' => alternate form */
+ break;
+ case '0':
+ flags |= FL_LEADZERO; /* '0' => pad with leading zeros */
+ break;
+ }
+ break;
+
+ case ST_WIDTH:
+ /* update width value */
+ if (ch == '*') {
+ /* get width from arg list */
+ fldwidth = get_int_arg(&argptr);
+ if (fldwidth < 0) {
+ /* ANSI says neg fld width means '-' flag and pos width */
+ flags |= FL_LEFT;
+ fldwidth = -fldwidth;
+ }
+ }
+ else {
+ /* add digit to current field width */
+ fldwidth = fldwidth * 10 + (ch - '0');
+ }
+ break;
+
+ case ST_DOT:
+ /* zero the precision, since dot with no number means 0
+ not default, according to ANSI */
+ precision = 0;
+ break;
+
+ case ST_PRECIS:
+ /* update precison value */
+ if (ch == '*') {
+ /* get precision from arg list */
+ precision = get_int_arg(&argptr);
+ if (precision < 0)
+ precision = -1; /* neg precision means default */
+ }
+ else {
+ /* add digit to current precision */
+ precision = precision * 10 + (ch - '0');
+ }
+ break;
+
+ case ST_SIZE:
+ /* just read a size specifier, set the flags based on it */
+ switch (ch) {
+#if !LONG_IS_INT
+ case 'l':
+ flags |= FL_LONG; /* 'l' => long int */
+ break;
+#endif
+
+#if !LONGDOUBLE_IS_DOUBLE
+ case 'L':
+ flags |= FL_LONGDOUBLE; /* 'L' => long double */
+ break;
+#endif
+
+#if !SHORT_IS_INT
+ case 'h':
+ flags |= FL_SHORT; /* 'h' => short int */
+ break;
+#endif
+ case 'w':
+ flags |= FL_WIDE; /* 'w' => wide character */
+ break;
+ }
+ break;
+
+ case ST_TYPE:
+ /* we have finally read the actual type character, so we */
+ /* now format and "print" the output. We use a big switch */
+ /* statement that sets 'text' to point to the text that should */
+ /* be printed, and 'textlen' to the length of this text. */
+ /* Common code later on takes care of justifying it and */
+ /* other miscellaneous chores. Note that cases share code, */
+ /* in particular, all integer formatting is doen in one place. */
+ /* Look at those funky goto statements! */
+
+ switch (ch) {
+
+ case 'c': {
+ /* print a single character specified by int argument */
+ wc = (wchar_t) get_int_arg(&argptr); /* get char to print */
+ * (wchar_t FAR *) buffer = wc;
+ text = buffer;
+ textlen = 1; /* print just a single character */
+ }
+ break;
+
+ case 'S': {
+ /* print a Counted String
+
+ int i;
+ char FAR *p; /* temps */
+ struct string {
+ short Length;
+ short MaximumLength;
+ char FAR *Buffer;
+ } *pstr;
+
+ pstr = get_ptr_arg(&argptr);
+ if (pstr == NULL || pstr->Buffer == NULL) {
+ /* null ptr passed, use special string */
+ text = nullstring;
+#ifdef FLAT
+ textlen = strlen(text);
+#else
+ textlen = _fstrlen(text);
+#endif
+ flags &= ~FL_WIDE;
+ } else {
+ text = pstr->Buffer;
+ textlen = pstr->Length;
+ }
+
+ }
+ break;
+
+ case 's': {
+ /* print a string -- */
+ /* ANSI rules on how much of string to print: */
+ /* all if precision is default, */
+ /* min(precision, length) if precision given. */
+ /* prints '(null)' if a null string is passed */
+
+ int i;
+ char FAR *p; /* temps */
+
+ text = get_ptr_arg(&argptr);
+ if (text == NULL) {
+ /* null ptr passed, use special string */
+ text = nullstring;
+ flags &= ~FL_WIDE;
+ }
+
+ /* At this point it is tempting to use strlen(), but */
+ /* if a precision is specified, we're not allowed to */
+ /* scan past there, because there might be no null */
+ /* at all. Thus, we must do our own scan. */
+
+ i = (precision == -1) ? INT_MAX : precision;
+
+ /* scan for null upto i characters */
+ if (flags & FL_WIDE) {
+ pwc = (wchar_t FAR *) text;
+ while (i-- && (wc = *pwc) && (wc & 0x00ff)) {
+ ++pwc;
+ if (wc & 0xff00) { // if high byte set,
+ break; // error will be indicated
+ }
+ }
+ textlen = pwc - (wchar_t FAR *) text; /* length of string */
+ } else {
+ p = text;
+ while (i-- && *p) {
+ ++p;
+ }
+ textlen = p - text; /* length of the string */
+ }
+ }
+ break;
+
+ case 'n': {
+ /* write count of characters seen so far into */
+ /* short/int/long thru ptr read from args */
+
+ void FAR *p; /* temp */
+
+ p = get_ptr_arg(&argptr);
+
+ /* store chars out into short/long/int depending on flags */
+#if !LONG_IS_INT
+ if (flags & FL_LONG)
+ *(long FAR *)p = charsout;
+ else
+#endif
+
+#if !SHORT_IS_INT
+ if (flags & FL_SHORT)
+ *(short FAR *)p = (short) charsout;
+ else
+#endif
+ *(int FAR *)p = charsout;
+
+ no_output = 1; /* force no output */
+ }
+ break;
+
+
+#ifndef NOFLOATS
+ case 'E':
+ case 'G':
+ capexp = 1; /* capitalize exponent */
+ ch += 'a' - 'A'; /* convert format char to lower */
+ /* DROP THROUGH */
+ case 'e':
+ case 'f':
+ case 'g': {
+ /* floating point conversion -- we call cfltcvt routines */
+ /* to do the work for us. */
+ flags |= FL_SIGNED; /* floating point is signed conversion */
+ text = buffer; /* put result in buffer */
+ flags &= ~FL_WIDE; /* 8 bit string */
+
+ /* compute the precision value */
+ if (precision < 0)
+ precision = 6; /* default precision: 6 */
+ else if (precision == 0 && ch == 'g')
+ precision = 1; /* ANSI specified */
+
+#if !LONGDOUBLE_IS_DOUBLE
+ /* do the conversion */
+ if (flags & FL_LONGDOUBLE) {
+ _cldcvt(argptr, text, ch, precision, capexp);
+ va_arg(argptr, LONGDOUBLE);
+ }
+ else
+#endif
+ {
+ _cfltcvt(argptr, text, ch, precision, capexp);
+ va_arg(argptr, DOUBLE);
+ }
+
+ /* '#' and precision == 0 means force a decimal point */
+ if ((flags & FL_ALTERNATE) && precision == 0)
+ _forcdecpt(text);
+
+ /* 'g' format means crop zero unless '#' given */
+ if (ch == 'g' && !(flags & FL_ALTERNATE))
+ _cropzeros(text);
+
+ /* check if result was negative, save '-' for later */
+ /* and point to positive part (this is for '0' padding) */
+ if (*text == '-') {
+ flags |= FL_NEGATIVE;
+ ++text;
+ }
+
+ textlen = strlen(text); /* compute length of text */
+ }
+ break;
+#endif // NOFLOATS
+
+ case 'd':
+ case 'i':
+ /* signed decimal output */
+ flags |= FL_SIGNED;
+ radix = 10;
+ goto COMMON_INT;
+
+ case 'u':
+ radix = 10;
+ goto COMMON_INT;
+
+ case 'p':
+ /* write a pointer -- this is like an integer or long */
+ /* except we force precision to pad with zeros and */
+ /* output in big hex. */
+
+ precision = 2 * sizeof(void FAR *); /* number of hex digits needed */
+#if !PTR_IS_INT
+ flags |= FL_LONG; /* assume we're converting a long */
+#endif
+ /* DROP THROUGH to hex formatting */
+
+ case 'C':
+ case 'X':
+ /* unsigned upper hex output */
+ hexadd = 'A' - '9' - 1; /* set hexadd for uppercase hex */
+ goto COMMON_HEX;
+
+ case 'x':
+ /* unsigned lower hex output */
+ hexadd = 'a' - '9' - 1; /* set hexadd for lowercase hex */
+ /* DROP THROUGH TO COMMON_HEX */
+
+ COMMON_HEX:
+ radix = 16;
+ if (flags & FL_ALTERNATE) {
+ /* alternate form means '0x' prefix */
+ prefix[0] = '0';
+ prefix[1] = (char)('x' - 'a' + '9' + 1 + hexadd); /* 'x' or 'X' */
+ prefixlen = 2;
+ }
+ goto COMMON_INT;
+
+ case 'o':
+ /* unsigned octal output */
+ radix = 8;
+ if (flags & FL_ALTERNATE) {
+ /* alternate form means force a leading 0 */
+ flags |= FL_FORCEOCTAL;
+ }
+ /* DROP THROUGH to COMMON_INT */
+
+ COMMON_INT: {
+ /* This is the general integer formatting routine. */
+ /* Basically, we get an argument, make it positive */
+ /* if necessary, and convert it according to the */
+ /* correct radix, setting text and textlen */
+ /* appropriately. */
+
+ unsigned long number; /* number to convert */
+ int digit; /* ascii value of digit */
+ long l; /* temp long value */
+
+ /* 1. read argument into l, sign extend as needed */
+#if !LONG_IS_INT
+ if (flags & FL_LONG)
+ l = get_long_arg(&argptr);
+ else
+#endif
+
+#if !SHORT_IS_INT
+ if (flags & FL_SHORT) {
+ if (flags & FL_SIGNED)
+ l = (short) get_int_arg(&argptr); /* sign extend */
+ else
+ l = (unsigned short) get_int_arg(&argptr); /* zero-extend*/
+ }
+ else
+#endif
+ {
+ if (flags & FL_SIGNED)
+ l = get_int_arg(&argptr); /* sign extend */
+ else
+ l = (unsigned int) get_int_arg(&argptr); /* zero-extend*/
+ }
+
+ /* 2. check for negative; copy into number */
+ if ( (flags & FL_SIGNED) && l < 0) {
+ number = -l;
+ flags |= FL_NEGATIVE; /* remember negative sign */
+ }
+ else {
+ number = l;
+ }
+
+ /* 3. check precision value for default; non-default */
+ /* turns off 0 flag, according to ANSI. */
+ if (precision < 0)
+ precision = 1; /* default precision */
+ else
+ flags &= ~FL_LEADZERO;
+
+ /* 4. Check if data is 0; if so, turn off hex prefix */
+ if (number == 0)
+ prefixlen = 0;
+
+ /* 5. Convert data to ASCII -- note if precision is zero */
+ /* and number is zero, we get no digits at all. */
+
+ text = &buffer[BUFFERSIZE-1]; // last digit at end of buffer
+ flags &= ~FL_WIDE; // 8 bit characters
+
+ while (precision-- > 0 || number != 0) {
+ digit = (int)(number % radix) + '0';
+ number /= radix; /* reduce number */
+ if (digit > '9') {
+ /* a hex digit, make it a letter */
+ digit += hexadd;
+ }
+ *text-- = (char)digit; /* store the digit */
+ }
+
+ textlen = (char FAR *)&buffer[BUFFERSIZE-1] - text; /* compute length of number */
+ ++text; /* text points to first digit now */
+
+
+ /* 6. Force a leading zero if FORCEOCTAL flag set */
+ if ((flags & FL_FORCEOCTAL) && (text[0] != '0' || textlen == 0)) {
+ *--text = '0';
+ ++textlen; /* add a zero */
+ }
+ }
+ break;
+ }
+
+ /* At this point, we have done the specific conversion, and */
+ /* 'text' points to text to print; 'textlen' is length. Now we */
+ /* justify it, put on prefixes, leading zeros, and then */
+ /* print it. */
+
+ if (!no_output) {
+ int padding; /* amount of padding, negative means zero */
+
+ if (flags & FL_SIGNED) {
+ if (flags & FL_NEGATIVE) {
+ /* prefix is a '-' */
+ prefix[0] = '-';
+ prefixlen = 1;
+ }
+ else if (flags & FL_SIGN) {
+ /* prefix is '+' */
+ prefix[0] = '+';
+ prefixlen = 1;
+ }
+ else if (flags & FL_SIGNSP) {
+ /* prefix is ' ' */
+ prefix[0] = ' ';
+ prefixlen = 1;
+ }
+ }
+
+ /* calculate amount of padding -- might be negative, */
+ /* but this will just mean zero */
+ padding = fldwidth - textlen - prefixlen;
+
+ /* put out the padding, prefix, and text, in the correct order */
+
+ if (!(flags & (FL_LEFT | FL_LEADZERO))) {
+ /* pad on left with blanks */
+ f->writechar(' ', padding, f, &charsout);
+ }
+
+ /* write prefix */
+ writestring(prefix, prefixlen, f, &charsout, 0);
+
+ if ((flags & FL_LEADZERO) && !(flags & FL_LEFT)) {
+ /* write leading zeros */
+ f->writechar('0', padding, f, &charsout);
+ }
+
+ /* write text */
+ writestring(text, textlen, f, &charsout, flags & FL_WIDE);
+
+ if (flags & FL_LEFT) {
+ /* pad on right with blanks */
+ f->writechar(' ', padding, f, &charsout);
+ }
+
+ /* we're done! */
+ }
+ break;
+ }
+ }
+
+ return charsout; /* return value = number of characters written */
+}
+
+
+/***
+*int get_int_arg(va_list pargptr)
+*
+*Purpose:
+* Gets an int argument off the given argument list and updates *pargptr.
+*
+*Entry:
+* va_list pargptr - pointer to argument list; updated by function
+*
+*Exit:
+* Returns the integer argument read from the argument list.
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+LOCAL(int) get_int_arg(va_list FAR *pargptr)
+{
+ return va_arg(*pargptr, int);
+}
+
+/***
+*long get_long_arg(va_list pargptr)
+*
+*Purpose:
+* Gets an long argument off the given argument list and updates pargptr.
+*
+*Entry:
+* va_list pargptr - pointer to argument list; updated by function
+*
+*Exit:
+* Returns the long argument read from the argument list.
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+
+#if !LONG_IS_INT
+LOCAL(long) get_long_arg(va_list FAR *pargptr)
+{
+ return va_arg(*pargptr, long);
+}
+#endif
+
+
+
+/***
+*void writestring(char *string, int len, struct w4io *f, int *pcchwritten, int fwide)
+*
+*Purpose:
+* Writes a string of the given length to the given file. If no error occurs,
+* then *pcchwritten is incremented by len; otherwise, *pcchwritten is set
+* to -1. If len is negative, it is treated as zero.
+*
+*Entry:
+* char *string - string to write (NOT null-terminated)
+* int len - length of string
+* struct w4io *f - file to write to
+* int *pcchwritten - pointer to integer to update with total chars written
+* int fwide - wide character flag
+*
+*Exit:
+* No return value.
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+LOCAL(void) writestring(
+ char FAR *string,
+ int len,
+ struct w4io FAR *f,
+ int FAR *pcchwritten,
+ int fwide)
+{
+ wchar_t FAR *pwc;
+
+ //printf("string: str=%.*s, len=%d, cch=%d, f=%d\n", len, string, len, *pcchwritten, fwide);
+ if (fwide) {
+ pwc = (wchar_t FAR *) string;
+ while (len-- > 0) {
+ if (*pwc & 0xff00) {
+ f->writechar('^', 1, f, pcchwritten);
+ }
+ f->writechar((char) *pwc++, 1, f, pcchwritten);
+ }
+ } else {
+ while (len-- > 0) {
+ f->writechar(*string++, 1, f, pcchwritten);
+ }
+ }
+}
+
+#endif // DBG == 1
diff --git a/private/ole32/olethunk/debnot/printf.h b/private/ole32/olethunk/debnot/printf.h
new file mode 100644
index 000000000..1cba796f9
--- /dev/null
+++ b/private/ole32/olethunk/debnot/printf.h
@@ -0,0 +1,261 @@
+/***
+*printf.h - print formatted
+*
+* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* defines w4*printf() - print formatted data
+* defines w4v*printf() - print formatted output, get data from an
+* argument ptr instead of explicit args.
+*
+*Revision History:
+* 09-02-83 RN original sprintf
+* 06-17-85 TC rewrote to use new varargs macros, and to be vsprintf
+* 04-13-87 JCR added const to declaration
+* 11-07-87 JCR Multi-thread support
+* 12-11-87 JCR Added "_LOAD_DS" to declaration
+* 05-27-88 PHG Merged DLL and normal versions
+* 06-13-88 JCR Fake _iob entry is now static so that other routines
+* can assume _iob entries are in DGROUP.
+* 08-25-88 GJF Define MAXSTR to be INT_MAX (from LIMITS.H).
+* 06-06-89 JCR 386 mthread support
+* 08-18-89 GJF Clean up, now specific to OS/2 2.0 (i.e., 386 flat
+* model). Also fixed copyright and indents.
+* 02-16-90 GJF Fixed copyright
+*
+*******************************************************************************/
+
+#include <stdarg.h>
+#include <limits.h>
+#include <windows.h>
+#include "w4io.h"
+
+#if defined(_W4PRINTF_)
+ static long fh;
+// extern long GetStdHandle(long);
+// extern void WriteFile(long fh, char FAR *s, long cch, long FAR * pcchret, long);
+# define _PRINTF_
+#elif defined(_W4DPRINTF_)
+# define _pwritechar _dwritechar
+# define _pflushbuf _dflushbuf
+# define w4printf w4dprintf
+# define w4vprintf w4vdprintf
+# define _PRINTF_
+#elif defined(_W4SPRINTF_)
+# define _pwritechar _swritechar
+# define w4printf w4sprintf
+# define w4vprintf w4vsprintf
+#elif defined(_W4WCSPRINTF_)
+# define _TCHAR_ wchar_t
+# define _PBUF_ pwcbuf
+# define _PSTART_ pwcstart
+# define w4printf w4wcsprintf
+# define w4vprintf w4vwcsprintf
+# define _pwritechar _wwritechar
+#else
+# error configuration problem
+#endif
+
+#ifndef _TCHAR_
+# define _TCHAR_ char
+# define _PBUF_ pchbuf
+# define _PSTART_ pchstart
+#endif
+
+
+#ifdef _PRINTF_
+# ifndef FLAT
+# define OutputDebugStringA OutputDebugString
+# endif
+ int _cdecl _pflushbuf(struct w4io FAR *f);
+# define SPR(a)
+# define MAXSTR 128
+#else
+# define SPR(a) a,
+# define MAXSTR INT_MAX
+#endif
+
+void _cdecl _pwritechar(int ch, int num, struct w4io FAR *f, int FAR *pcchwritten);
+int _cdecl w4vprintf(SPR(_TCHAR_ FAR *string) const char FAR *format, va_list arglist);
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+DWORD FAR PASCAL CallProc32W(DWORD dw1, DWORD dw2, DWORD dw3,
+ LPVOID pfn32, DWORD dwPtrTranslate,
+ DWORD dwArgCount);
+#ifdef __cplusplus
+}
+#endif
+LPVOID lpThkCallOutputFunctionsProc;
+
+
+/***
+*int w4printf(format, ...) - print formatted data
+*
+*Purpose:
+* Prints formatted data using the format string to
+* format data and getting as many arguments as called for
+* Sets up a w4io so file i/o operations can be used.
+* w4iooutput does the real work here
+*
+*Entry:
+* char *format - format string to control data format/number
+* of arguments followed by list of arguments, number and type
+* controlled by format string
+*
+*Exit:
+* returns number of characters written
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+
+int _cdecl
+w4printf(SPR(_TCHAR_ FAR *string) const char FAR *format, ...)
+/*
+ * 'PRINT', 'F'ormatted
+ */
+{
+ va_list arglist;
+
+ va_start(arglist, format);
+ return(w4vprintf(SPR(string) format, arglist));
+}
+
+
+/***
+*int w4vprintf(format, arglist) - print formatted data from arg ptr
+*
+*Purpose:
+* Prints formatted data, but gets data from an argument pointer.
+* Sets up a w4io so file i/o operations can be used, make string look
+* like a huge buffer to it, but _flsbuf will refuse to flush it if it
+* fills up. Appends '\0' to make it a true string.
+*
+* Multi-thread: (1) Since there is no stream, this routine must never try
+* to get the stream lock (i.e., there is no stream lock either). (2)
+* Also, since there is only one staticly allocated 'fake' iob, we must
+* lock/unlock to prevent collisions.
+*
+*Entry:
+* char *format - format string, describes format of data
+* va_list arglist - varargs argument pointer
+*
+*Exit:
+* returns number of characters written
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _cdecl
+w4vprintf(SPR(_TCHAR_ FAR *string) const char FAR *format, va_list arglist)
+/*
+ * 'V'ariable argument 'PRINT', 'F'ormatted
+ */
+{
+ struct w4io outfile;
+ register int retval;
+#ifdef _PRINTF_
+ char string[MAXSTR + 1]; // leave room for null termination
+#else
+ int dummy;
+#endif
+
+#ifdef _W4PRINTF_
+ long ldummy;
+
+ if (fh == 0 || fh == -1)
+ {
+ ldummy = -11; // C7 bug workaround
+ if ((fh = (long)GetStdHandle(ldummy)) == 0 || fh == -1)
+ {
+ OutputDebugStringA("GetStdHandle in " __FILE__ " failed\n");
+ return(-1);
+ }
+ }
+#endif
+
+ outfile._PBUF_ = outfile._PSTART_ = string;
+ outfile.cchleft = MAXSTR;
+ outfile.writechar = _pwritechar;
+
+ retval = w4iooutput(&outfile, format, arglist);
+
+#ifdef _PRINTF_
+ if (_pflushbuf(&outfile) == -1) {
+ return(-1);
+ }
+#else
+ _pwritechar('\0', 1, &outfile, &dummy);
+#endif
+ return(retval);
+}
+
+
+void _cdecl _pwritechar(int ch, int num, struct w4io FAR *f, int FAR *pcchwritten)
+{
+ //printf(" char: ch=%c, cnt=%d, cch=%d\n", ch, num, *pcchwritten);
+ while (num-- > 0) {
+#ifdef _PRINTF_
+ if (f->cchleft < 2 && _pflushbuf(f) == -1) {
+ *pcchwritten = -1;
+ return;
+ }
+#endif
+#ifdef _W4DPRINTF_
+# ifndef FLAT
+ if (ch == '\n')
+ {
+ *f->_PBUF_++ = '\r';
+ f->cchleft--;
+ (*pcchwritten)++;
+ }
+# endif
+#endif
+ *f->_PBUF_++ = (char) ch;
+ f->cchleft--;
+ (*pcchwritten)++;
+ }
+}
+
+
+#ifdef _PRINTF_
+int _cdecl _pflushbuf(struct w4io FAR *f)
+{
+ int cch;
+
+ if (cch = (f->pchbuf - f->pchstart))
+ {
+#ifdef _W4DPRINTF_
+ *f->pchbuf = '\0'; // null terminate
+ if (lpThkCallOutputFunctionsProc == NULL)
+ {
+ OutputDebugStringA(f->pchstart);
+ }
+ else
+ {
+ // note casting and dummy arguments to match other uses of it (see interop.hxx)
+ CallProc32W((DWORD) f->pchstart, 0, 0, lpThkCallOutputFunctionsProc, 0x00000004, 3); // thunk it to olethk32.dll
+ }
+#else
+ long cchret;
+
+ //*f->pchbuf = '\0'; // null terminate
+ //printf("%d chars: \"%s\"\n", cch, f->pchstart);
+ WriteFile((HANDLE)fh, f->pchstart, cch, &cchret, 0);
+ if (cch != cchret)
+ {
+ OutputDebugString("WriteFile in " __FILE__ " failed\n");
+ return(-1);
+ }
+#endif
+ f->pchbuf -= cch; // reset pointer
+ f->cchleft += cch; // reset count
+ }
+ return(0);
+}
+#endif // _PRINTF_
diff --git a/private/ole32/olethunk/debnot/sprintf.c b/private/ole32/olethunk/debnot/sprintf.c
new file mode 100644
index 000000000..c4d9dfcdf
--- /dev/null
+++ b/private/ole32/olethunk/debnot/sprintf.c
@@ -0,0 +1,17 @@
+/***
+*sprintf.c - print formatted to string
+*
+* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* defines w4sprintf() - print formatted data to string
+* defines w4vsprintf() - print formatted output to a string, get data
+* from an argument ptr instead of explicit args.
+*******************************************************************************/
+
+#if DBG == 1
+
+#define _W4SPRINTF_
+#include "printf.h"
+
+#endif
diff --git a/private/ole32/olethunk/debnot/w4io.h b/private/ole32/olethunk/debnot/w4io.h
new file mode 100644
index 000000000..22d280084
--- /dev/null
+++ b/private/ole32/olethunk/debnot/w4io.h
@@ -0,0 +1,59 @@
+/***
+*w4io.h - fake FILE structure for Win 4 printf/sprintf/debug printf support
+*
+*/
+
+#if defined(M_I386) || defined(FLAT)
+#ifndef FAR
+#define FAR
+#endif
+# ifndef FLAT
+# define FLAT
+# endif
+#else
+#ifndef FAR
+#define FAR __far
+#endif
+#endif
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+struct w4io
+{
+ union
+ {
+ struct
+ {
+ wchar_t FAR *_pwcbuf; // wchar_t output buffer
+ wchar_t FAR *_pwcstart;
+ } wc;
+ struct
+ {
+ char FAR *_pchbuf; // char output buffer
+ char FAR *_pchstart;
+ } ch;
+ } buf ;
+ unsigned int cchleft; // output buffer character count
+ void (_cdecl *writechar)(int ch,
+ int num,
+ struct w4io FAR *f,
+ int FAR *pcchwritten);
+};
+
+#define pwcbuf buf.wc._pwcbuf
+#define pwcstart buf.wc._pwcstart
+#define pchbuf buf.ch._pchbuf
+#define pchstart buf.ch._pchstart
+
+#define REG1 register
+#define REG2 register
+
+/* prototypes */
+int _cdecl w4iooutput(struct w4io FAR *stream, const char FAR *format, va_list argptr);
diff --git a/private/ole32/olethunk/debnot/win16.mk b/private/ole32/olethunk/debnot/win16.mk
new file mode 100644
index 000000000..a8859c50b
--- /dev/null
+++ b/private/ole32/olethunk/debnot/win16.mk
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 1991, Microsoft Corporation
+#
+# History:
+#
+# 18-Feb-1994 BobDay Adapted from MVDM\WOW16\GDI\MAKEFILE
+#
+
+TARGET = debnot.lib
+
+CFILES = \
+ .\output.c\
+ .\dprintf.c\
+ .\sprintf.c
+
+CXXFILES = \
+ .\assert.cxx
+
+!include ..\ole16\makefile.inc
+
+$(OBJDIR)\output.obj: output.c
+$(OBJDIR)\dprintf.obj: dprintf.c
+$(OBJDIR)\sprintf.obj: sprintf.c
+$(OBJDIR)\assert.obj: assert.cxx
diff --git a/private/ole32/olethunk/debnot/win32/makefile b/private/ole32/olethunk/debnot/win32/makefile
new file mode 100644
index 000000000..734e18727
--- /dev/null
+++ b/private/ole32/olethunk/debnot/win32/makefile
@@ -0,0 +1,6 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
+# file to this component. This file merely indirects to the real make file
+# that is shared by all the subcomponents of NTOS.
+#
+!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/private/ole32/olethunk/debnot/win32/sources b/private/ole32/olethunk/debnot/win32/sources
new file mode 100644
index 000000000..c88938dfa
--- /dev/null
+++ b/private/ole32/olethunk/debnot/win32/sources
@@ -0,0 +1,45 @@
+!IF 0
+
+Copyright (c) 1994 Microsoft Corporation
+
+Module Name:
+
+ sources.
+
+Abstract:
+
+ Standard definitions file for debnot.lib
+
+Author:
+
+ Drew Bliss (drewb) 23-Feb-1994
+
+NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl
+
+!ENDIF
+
+MAJORCOMP=cairole
+MINORCOMP=interop
+
+TARGETNAME=debnot
+TARGETPATH=obj
+TARGETTYPE=LIBRARY
+
+INCLUDES=..; \
+ $(BASEDIR)\public\sdk\inc;
+
+C_DEFINES=$(C_DEFINES) \
+ -DFLAT \
+ -DWIN32=100 \
+ -D_NT1X_=100 \
+ -DUNICODE \
+ -D_UNICODE
+
+USE_CRTDLL=1
+BLDCRT=1
+
+SOURCES=\
+ ..\assert.cxx \
+ ..\output.c \
+ ..\dprintf.c \
+ ..\sprintf.c