Mikołaj Zalewski : write.exe: Add a new program that calls wordpad.exe.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 2 06:23:18 CDT 2007


Module: wine
Branch: master
Commit: 2777a94d4eef7dd8f8d422bed1c1363a059f9109
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2777a94d4eef7dd8f8d422bed1c1363a059f9109

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Wed Aug  1 20:01:29 2007 -0700

write.exe: Add a new program that calls wordpad.exe.

---

 .gitignore                 |    2 +
 Makefile.in                |    2 +
 configure                  |    3 ++
 configure.ac               |    1 +
 programs/Makefile.in       |    2 +
 programs/write/En.rc       |   26 +++++++++++++++++++++
 programs/write/Makefile.in |   15 ++++++++++++
 programs/write/resources.h |   19 +++++++++++++++
 programs/write/rsrc.rc     |   24 +++++++++++++++++++
 programs/write/write.c     |   54 ++++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 148 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 2c87b7a..0ddaa04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -936,6 +936,8 @@ programs/wordpad/rsrc.res
 programs/wordpad/toolbar.bmp
 programs/wordpad/wordpad
 programs/wordpad/wordpad.ico
+programs/write/rsrc.res
+programs/write/write
 programs/xcopy/rsrc.res
 programs/xcopy/xcopy
 server/wineserver
diff --git a/Makefile.in b/Makefile.in
index 8174a91..002f425 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -493,6 +493,7 @@ ALL_MAKEFILES = \
 	programs/winhelp/Makefile \
 	programs/winver/Makefile \
 	programs/wordpad/Makefile \
+	programs/write/Makefile \
 	programs/xcopy/Makefile \
 	server/Makefile \
 	tools/Makefile \
@@ -856,6 +857,7 @@ programs/winevdm/Makefile: programs/winevdm/Makefile.in programs/Makeprog.rules
 programs/winhelp/Makefile: programs/winhelp/Makefile.in programs/Makeprog.rules
 programs/winver/Makefile: programs/winver/Makefile.in programs/Makeprog.rules
 programs/wordpad/Makefile: programs/wordpad/Makefile.in programs/Makeprog.rules
+programs/write/Makefile: programs/write/Makefile.in programs/Makeprog.rules
 programs/xcopy/Makefile: programs/xcopy/Makefile.in programs/Makeprog.rules
 server/Makefile: server/Makefile.in Make.rules
 tools/Makefile: tools/Makefile.in Make.rules
diff --git a/configure b/configure
index 35ec7ff..fdcdbd5 100755
--- a/configure
+++ b/configure
@@ -20936,6 +20936,8 @@ ac_config_files="$ac_config_files programs/winver/Makefile"
 
 ac_config_files="$ac_config_files programs/wordpad/Makefile"
 
+ac_config_files="$ac_config_files programs/write/Makefile"
+
 ac_config_files="$ac_config_files programs/xcopy/Makefile"
 
 ac_config_files="$ac_config_files server/Makefile"
@@ -21863,6 +21865,7 @@ do
     "programs/winhelp/Makefile") CONFIG_FILES="$CONFIG_FILES programs/winhelp/Makefile" ;;
     "programs/winver/Makefile") CONFIG_FILES="$CONFIG_FILES programs/winver/Makefile" ;;
     "programs/wordpad/Makefile") CONFIG_FILES="$CONFIG_FILES programs/wordpad/Makefile" ;;
+    "programs/write/Makefile") CONFIG_FILES="$CONFIG_FILES programs/write/Makefile" ;;
     "programs/xcopy/Makefile") CONFIG_FILES="$CONFIG_FILES programs/xcopy/Makefile" ;;
     "server/Makefile") CONFIG_FILES="$CONFIG_FILES server/Makefile" ;;
     "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 780b419..e6088ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1894,6 +1894,7 @@ AC_CONFIG_FILES([programs/winevdm/Makefile])
 AC_CONFIG_FILES([programs/winhelp/Makefile])
 AC_CONFIG_FILES([programs/winver/Makefile])
 AC_CONFIG_FILES([programs/wordpad/Makefile])
+AC_CONFIG_FILES([programs/write/Makefile])
 AC_CONFIG_FILES([programs/xcopy/Makefile])
 AC_CONFIG_FILES([server/Makefile])
 AC_CONFIG_FILES([tools/Makefile])
diff --git a/programs/Makefile.in b/programs/Makefile.in
index 9ea131b..1a3d3d5 100644
--- a/programs/Makefile.in
+++ b/programs/Makefile.in
@@ -45,6 +45,7 @@ SUBDIRS = \
 	winhelp \
 	winver \
 	wordpad \
+	write \
 	xcopy
 
 # Sub-directories to run make install into
@@ -85,6 +86,7 @@ INSTALLSUBDIRS = \
 	winhelp \
 	winver \
 	wordpad \
+	write \
 	xcopy
 
 # Programs to install in bin directory
diff --git a/programs/write/En.rc b/programs/write/En.rc
new file mode 100644
index 0000000..5215db5
--- /dev/null
+++ b/programs/write/En.rc
@@ -0,0 +1,26 @@
+/*
+ * English language support
+ *
+ * Copyright (C) 2007 Mikolaj Zalewski
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+
+STRINGTABLE
+{
+    IDS_FAILED, "Starting Wordpad failed"
+}
diff --git a/programs/write/Makefile.in b/programs/write/Makefile.in
new file mode 100644
index 0000000..1e877ef
--- /dev/null
+++ b/programs/write/Makefile.in
@@ -0,0 +1,15 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = write.exe
+APPMODE   = -mwindows
+IMPORTS   = user32 gdi32 kernel32
+
+C_SRCS = write.c
+
+RC_SRCS = rsrc.rc
+
+ at MAKE_PROG_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/programs/write/resources.h b/programs/write/resources.h
new file mode 100644
index 0000000..e99e5b1
--- /dev/null
+++ b/programs/write/resources.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2007 Mikolaj Zalewski
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define IDS_FAILED 101
diff --git a/programs/write/rsrc.rc b/programs/write/rsrc.rc
new file mode 100644
index 0000000..06e4040
--- /dev/null
+++ b/programs/write/rsrc.rc
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2007 Mikolaj Zalewski
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <windows.h>
+#include "resources.h"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+
+#include "En.rc"
diff --git a/programs/write/write.c b/programs/write/write.c
new file mode 100644
index 0000000..0f2aca0
--- /dev/null
+++ b/programs/write/write.c
@@ -0,0 +1,54 @@
+/*
+ * Write.exe - this program only calls wordpad.exe
+ *
+ * Copyright 2007 by Mikolaj Zalewski
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define WIN32_LEAN_AND_MEAN
+
+#include <stdarg.h>
+
+#include <windows.h>
+#include "resources.h"
+
+static const WCHAR SZ_BACKSLASH[] = {'\\',0};
+static const WCHAR SZ_WORDPAD[]   = {'w','o','r','d','p','a','d','.','e','x','e',0};
+
+int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hOldInstance, LPSTR szCmdParagraph, int res)
+{
+    WCHAR path[MAX_PATH];
+    STARTUPINFOW stinf;
+    PROCESS_INFORMATION info;
+
+    if (!GetSystemDirectoryW(path, MAX_PATH - 1 - lstrlenW(SZ_WORDPAD)))
+	goto failed;
+    if (path[lstrlenW(path) - 1] != '\\')
+	lstrcatW(path, SZ_BACKSLASH);
+    lstrcatW(path, SZ_WORDPAD);
+
+    stinf.cb = sizeof(STARTUPINFO);
+    GetStartupInfoW(&stinf);
+
+    if (!CreateProcessW(path, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &stinf, &info))
+	goto failed;
+    return 0;
+
+failed:
+    LoadStringW(GetModuleHandle(NULL), IDS_FAILED, path, MAX_PATH);
+    MessageBoxW(NULL, path, NULL, MB_OK|MB_ICONERROR);
+    return 1;
+}




More information about the wine-cvs mailing list