diff options
Diffstat (limited to 'private/sdktools/dumpclip')
-rw-r--r-- | private/sdktools/dumpclip/dumpclip.c | 49 | ||||
-rw-r--r-- | private/sdktools/dumpclip/dumpclip.rc | 11 | ||||
-rw-r--r-- | private/sdktools/dumpclip/makefile | 6 | ||||
-rw-r--r-- | private/sdktools/dumpclip/sources | 40 |
4 files changed, 106 insertions, 0 deletions
diff --git a/private/sdktools/dumpclip/dumpclip.c b/private/sdktools/dumpclip/dumpclip.c new file mode 100644 index 000000000..46e9ccaf2 --- /dev/null +++ b/private/sdktools/dumpclip/dumpclip.c @@ -0,0 +1,49 @@ +#include <windows.h> +#include <stdio.h> +#include <io.h> +#include <fcntl.h> +#include <string.h> + +_CRTAPI1 +main (c, v) +int c; +char *v[]; +{ + HANDLE hMem; + LPSTR lpMem; + FILE *OutputFile; + + if (c <= 1) { + OutputFile = stdout; + } + else + if (c == 2) { + OutputFile = fopen( v[1], "w" ); + if (OutputFile == NULL) { + fprintf( stderr, "DUMPCLIP: unable to open destination file '%s' (%u)\n", v[1], GetLastError() ); + return 1; + } + } + + if (!OpenClipboard( NULL )) { + fprintf( stderr, "DUMPCLIP: unable to open clipboard (%u)\n", GetLastError() ); + return 1; + } + + _setmode( _fileno( OutputFile ), _O_BINARY ); + hMem = GetClipboardData( CF_OEMTEXT ); + if (hMem != NULL) { + lpMem = GlobalLock( hMem ); + if (lpMem) { + fprintf( OutputFile, "%s", lpMem ); + } + GlobalUnlock( hMem ); + } + else { + fprintf( stderr, "DUMPCLIP: unable to get clipboard data as text (%u)\n", GetLastError() ); + } + + CloseClipboard(); + + return( 0 ); +} diff --git a/private/sdktools/dumpclip/dumpclip.rc b/private/sdktools/dumpclip/dumpclip.rc new file mode 100644 index 000000000..efbea0621 --- /dev/null +++ b/private/sdktools/dumpclip/dumpclip.rc @@ -0,0 +1,11 @@ +#include <windows.h> +#include <ntverp.h> + +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "Microsoft\256 Dump Clipboard Utility" + +#define VER_INTERNALNAME_STR "dumpclip.exe" +#define VER_ORIGINALFILENAME_STR "dumpclip.exe" + +#include <common.ver> diff --git a/private/sdktools/dumpclip/makefile b/private/sdktools/dumpclip/makefile new file mode 100644 index 000000000..6ee4f43fa --- /dev/null +++ b/private/sdktools/dumpclip/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 components of NT OS/2 +# +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/private/sdktools/dumpclip/sources b/private/sdktools/dumpclip/sources new file mode 100644 index 000000000..90c796865 --- /dev/null +++ b/private/sdktools/dumpclip/sources @@ -0,0 +1,40 @@ +!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: + + Steve Wood (stevewo) 12-Apr-1990 + +NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl + +!ENDIF + +MAJORCOMP=sdktools +MINORCOMP=dumpclip + +TARGETNAME=dumpclip +TARGETPATH=obj +TARGETTYPE=PROGRAM + +INCLUDES=..\ztools\inc + +SOURCES=dumpclip.c dumpclip.rc + +C_DEFINES=-D_OS2_20_=0 -Dnear= -Dfar= -Dpascal= + +UMTYPE=console +UMLIBS=$(BASEDIR)\public\sdk\lib\*\setargv.obj \ + $(BASEDIR)\public\sdk\lib\*\user32.lib |