[PATCH] kernel32: LZOpenFile should preserve cBytes on failure.
Lauri Kenttä
lauri.kentta at gmail.com
Tue Jan 31 15:38:08 CST 2017
Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
---
dlls/kernel32/lzexpand.c | 3 +++
dlls/lz32/tests/lzexpand_main.c | 8 --------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/lzexpand.c b/dlls/kernel32/lzexpand.c
index 8f9b409bc4..319c1c8fc2 100644
--- a/dlls/kernel32/lzexpand.c
+++ b/dlls/kernel32/lzexpand.c
@@ -534,6 +534,7 @@ static LPSTR LZEXPAND_MangleName( LPCSTR fn )
HFILE WINAPI LZOpenFileA( LPSTR fn, LPOFSTRUCT ofs, WORD mode )
{
HFILE fd,cfd;
+ BYTE ofs_cBytes = ofs->cBytes;
TRACE("(%s,%p,%d)\n",fn,ofs,mode);
/* 0x70 represents all OF_SHARE_* flags, ignore them for the check */
@@ -544,6 +545,8 @@ HFILE WINAPI LZOpenFileA( LPSTR fn, LPOFSTRUCT ofs, WORD mode )
fd = OpenFile(mfn,ofs,mode);
HeapFree( GetProcessHeap(), 0, mfn );
}
+ if (fd==HFILE_ERROR)
+ ofs->cBytes = ofs_cBytes;
if ((mode&~0x70)!=OF_READ)
return fd;
if (fd==HFILE_ERROR)
diff --git a/dlls/lz32/tests/lzexpand_main.c b/dlls/lz32/tests/lzexpand_main.c
index 4980cf7adc..c37f3fa47e 100644
--- a/dlls/lz32/tests/lzexpand_main.c
+++ b/dlls/lz32/tests/lzexpand_main.c
@@ -229,7 +229,6 @@ static void test_LZOpenFileA_nonexisting_compressed(void)
"LZOpenFileA succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileA set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
@@ -249,7 +248,6 @@ static void test_LZOpenFileA_nonexisting_compressed(void)
"LZOpenFileA succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileA set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
@@ -269,7 +267,6 @@ static void test_LZOpenFileA_nonexisting_compressed(void)
"LZOpenFileA succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileA set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
@@ -289,7 +286,6 @@ static void test_LZOpenFileA_nonexisting_compressed(void)
"LZOpenFileA succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileA set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
@@ -633,7 +629,6 @@ static void test_LZOpenFileW_nonexisting_compressed(void)
"LZOpenFileW succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileW set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
@@ -653,7 +648,6 @@ static void test_LZOpenFileW_nonexisting_compressed(void)
"LZOpenFileW succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileW set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
@@ -673,7 +667,6 @@ static void test_LZOpenFileW_nonexisting_compressed(void)
"LZOpenFileW succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileW set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
@@ -693,7 +686,6 @@ static void test_LZOpenFileW_nonexisting_compressed(void)
"LZOpenFileW succeeded on nonexistent file\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetLastError() returns %d\n", GetLastError());
- todo_wine
ok(test.cBytes == 0xA5,
"LZOpenFileW set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
--
2.11.0
More information about the wine-patches
mailing list