kernel32: LZOpenFile should preserve cBytes on failure.

Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Lauri Kenttä 2017-01-31 23:38:08 +02:00 committed by Alexandre Julliard
parent 41a82d8037
commit ae14719538
2 changed files with 3 additions and 8 deletions

View file

@ -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)

View file

@ -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,