wordpad: Refuse to load OLE compound storage files like Windows does
Dmitry Timoshkov
dmitry at codeweavers.com
Tue Oct 16 02:35:38 CDT 2007
Hello,
Wordpad from Windows XP pops up a MessageBox stating that Word for Windows
files are not supported when somebody tries to open a .doc file.
This patch should fix the bug 9196.
Changelog:
wordpad: Refuse to load OLE compound storage files like Windows does.
---
programs/wordpad/De.rc | 1 +
programs/wordpad/En.rc | 1 +
programs/wordpad/Fr.rc | 1 +
programs/wordpad/Hu.rc | 1 +
programs/wordpad/Ko.rc | 1 +
programs/wordpad/Makefile.in | 2 +-
programs/wordpad/Nl.rc | 1 +
programs/wordpad/No.rc | 1 +
programs/wordpad/Pl.rc | 1 +
programs/wordpad/Ru.rc | 1 +
programs/wordpad/Tr.rc | 1 +
programs/wordpad/resource.h | 1 +
programs/wordpad/wordpad.c | 12 ++++++++++++
13 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/programs/wordpad/De.rc b/programs/wordpad/De.rc
index 1b333fd..7175fa7 100644
--- a/programs/wordpad/De.rc
+++ b/programs/wordpad/De.rc
@@ -229,4 +229,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc
index e0724fb..a14ec7f 100644
--- a/programs/wordpad/En.rc
+++ b/programs/wordpad/En.rc
@@ -229,4 +229,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/Fr.rc b/programs/wordpad/Fr.rc
index dcf80ec..2448c3c 100644
--- a/programs/wordpad/Fr.rc
+++ b/programs/wordpad/Fr.rc
@@ -229,4 +229,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/Hu.rc b/programs/wordpad/Hu.rc
index feca301..7b72a7f 100644
--- a/programs/wordpad/Hu.rc
+++ b/programs/wordpad/Hu.rc
@@ -229,4 +229,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/Ko.rc b/programs/wordpad/Ko.rc
index 7ec919e..800f2cf 100644
--- a/programs/wordpad/Ko.rc
+++ b/programs/wordpad/Ko.rc
@@ -223,4 +223,5 @@ BEGIN
"ÀÌ°ÍÀº Ư¼öÇÑ ²Ù¹ÒÀ» ¾ø¿¤ °ÍÀÔ´Ï´Ù. " \
"´ç½ÅÀº Á¤¸»·Î ÀúÀåÇϱ⸦ ¿øÇմϱî?"
STRING_INVALID_NUMBER, "¿Ã¹Ù¸£Áö ¾ÊÀº ¼ö Çü½Ä"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/Makefile.in b/programs/wordpad/Makefile.in
index 69f1721..890a0f4 100644
--- a/programs/wordpad/Makefile.in
+++ b/programs/wordpad/Makefile.in
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = wordpad.exe
APPMODE = -mwindows
-IMPORTS = comdlg32 shell32 user32 gdi32 msvcrt advapi32 kernel32 comctl32
+IMPORTS = comdlg32 shell32 user32 gdi32 msvcrt advapi32 kernel32 comctl32 ole32
EXTRAINCL = -I$(TOPSRCDIR)/include/msvcrt
EXTRADEFS = -DNO_LIBWINE_PORT
MODCFLAGS = @BUILTINFLAG@
diff --git a/programs/wordpad/Nl.rc b/programs/wordpad/Nl.rc
index d6c5346..04042d8 100644
--- a/programs/wordpad/Nl.rc
+++ b/programs/wordpad/Nl.rc
@@ -229,4 +229,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc
index 3bebdf9..0c203ed 100644
--- a/programs/wordpad/No.rc
+++ b/programs/wordpad/No.rc
@@ -229,4 +229,5 @@ BEGIN
"vil føre til at all formatering går tapt. Er du " \
"sikker på at du vil fortsette?"
STRING_INVALID_NUMBER, "Ugyldig tallformat"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/Pl.rc b/programs/wordpad/Pl.rc
index 3b05326..3ed7e81 100644
--- a/programs/wordpad/Pl.rc
+++ b/programs/wordpad/Pl.rc
@@ -230,4 +230,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/Ru.rc b/programs/wordpad/Ru.rc
index 17828cc..3eaf438 100644
--- a/programs/wordpad/Ru.rc
+++ b/programs/wordpad/Ru.rc
@@ -228,4 +228,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/Tr.rc b/programs/wordpad/Tr.rc
index 65cb31f..b3463f0 100644
--- a/programs/wordpad/Tr.rc
+++ b/programs/wordpad/Tr.rc
@@ -232,4 +232,5 @@ BEGIN
"which will cause all formatting to be lost. " \
"Are you sure that you wish to do this?"
STRING_INVALID_NUMBER, "Invalid number format"
+ STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported"
END
diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h
index 2c2cc98..130eb94 100644
--- a/programs/wordpad/resource.h
+++ b/programs/wordpad/resource.h
@@ -180,3 +180,4 @@
#define STRING_LOAD_RICHED_FAILED 1703
#define STRING_SAVE_LOSEFORMATTING 1704
#define STRING_INVALID_NUMBER 1705
+#define STRING_OLE_STORAGE_NOT_SUPPORTED 1706
diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c
index 5e1d0dc..d373778 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -22,6 +22,8 @@
#define WIN32_LEAN_AND_MEAN
#define _WIN32_IE 0x0400
+#define COBJMACROS
+
#define MAX_STRING_LEN 255
#include <stdarg.h>
@@ -1076,6 +1078,16 @@ static void DoOpenFile(LPCWSTR szOpenFileName)
char fileStart[5];
DWORD readOut;
WPARAM format = SF_TEXT;
+ IStorage *stg;
+
+ if (StgOpenStorage(szOpenFileName, NULL, STGM_SHARE_DENY_WRITE | STGM_READ,
+ NULL, 0, &stg) == S_OK)
+ {
+ IStorage_Release(stg);
+ MessageBoxW(hMainWnd, MAKEINTRESOURCEW(STRING_OLE_STORAGE_NOT_SUPPORTED), wszAppTitle,
+ MB_OK | MB_ICONEXCLAMATION);
+ return;
+ }
hFile = CreateFileW(szOpenFileName, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
--
1.5.3.4
More information about the wine-patches
mailing list