Commit ae147195 authored by Lauri Kenttä's avatar Lauri Kenttä Committed by Alexandre Julliard

kernel32: LZOpenFile should preserve cBytes on failure.

parent 41a82d80
......@@ -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)
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment