Module: wine
Branch: master
Commit: 370b881fcda8b7b8ef8fe2cfbe99c824882fd104
URL: http://source.winehq.org/git/wine.git/?a=commit;h=370b881fcda8b7b8ef8fe2cfb…
Author: Mikolaj Zalewski <mikolajz(a)google.com>
Date: Tue Oct 16 17:49:28 2007 -0700
ntdll: Avoid setting IS_TEXT_UNICODE_NUL_BYTES for the last byte of an ANSI string.
---
dlls/ntdll/rtlstr.c | 3 +++
dlls/ntdll/tests/rtlstr.c | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index 1b13f12..ecd8523 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -1610,6 +1610,9 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
/* Check for an odd length ... pass if even. */
if (len & 1) out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
+ if (((char *)buf)[len - 1] == 0)
+ len--; /* Windows seems to do something like that to avoid e.g. false IS_TEXT_UNICODE_NULL_BYTES */
+
len /= sizeof(WCHAR);
/* Windows only checks the first 256 characters */
if (len > 256) len = 256;
diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c
index 65b9b52..e40bd53 100644
--- a/dlls/ntdll/tests/rtlstr.c
+++ b/dlls/ntdll/tests/rtlstr.c
@@ -1677,7 +1677,7 @@ static void test_RtlIsTextUnicode(void)
int flags;
int i;
- todo_wine ok(!pRtlIsTextUnicode(ascii, sizeof(ascii), NULL), "ASCII text detected as Unicode\n");
+ ok(!pRtlIsTextUnicode(ascii, sizeof(ascii), NULL), "ASCII text detected as Unicode\n");
ok(pRtlIsTextUnicode(unicode, sizeof(unicode), NULL), "Text should be Unicode\n");
ok(!pRtlIsTextUnicode(unicode, sizeof(unicode) - 1, NULL), "Text should be Unicode\n");
Module: wine
Branch: master
Commit: 6b8ee0e41f0333de11cf837b21fba580a641c0f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b8ee0e41f0333de11cf837b2…
Author: Dmitry Timoshkov <dmitry(a)codeweavers.com>
Date: Tue Oct 16 22:07:31 2007 +0900
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/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 | 9 +++++++++
12 files changed, 20 insertions(+), 0 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/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..a117a75 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -1092,8 +1092,17 @@ static void DoOpenFile(LPCWSTR szOpenFileName)
} else if(readOut >= 5)
{
static const char header[] = "{\\rtf";
+ static const BYTE STG_magic[] = { 0xd0,0xcf,0x11,0xe0 };
+
if(!memcmp(header, fileStart, 5))
format = SF_RTF;
+ else if (!memcmp(STG_magic, fileStart, sizeof(STG_magic)))
+ {
+ CloseHandle(hFile);
+ MessageBoxW(hMainWnd, MAKEINTRESOURCEW(STRING_OLE_STORAGE_NOT_SUPPORTED), wszAppTitle,
+ MB_OK | MB_ICONEXCLAMATION);
+ return;
+ }
}
es.dwCookie = (DWORD_PTR)hFile;