Commit 4c90f58b authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

msvcr80: Fix ioinfo structure definition.

parent 2636c9e8
......@@ -21550,6 +21550,7 @@ wine_fn_config_makefile dlls/msvcr120_app enable_msvcr120_app
wine_fn_config_makefile dlls/msvcr70 enable_msvcr70
wine_fn_config_makefile dlls/msvcr71 enable_msvcr71
wine_fn_config_makefile dlls/msvcr80 enable_msvcr80
wine_fn_config_makefile dlls/msvcr80/tests enable_tests
wine_fn_config_makefile dlls/msvcr90 enable_msvcr90
wine_fn_config_makefile dlls/msvcr90/tests enable_tests
wine_fn_config_makefile dlls/msvcrt enable_msvcrt
......
......@@ -2798,6 +2798,7 @@ WINE_CONFIG_MAKEFILE(dlls/msvcr120_app)
WINE_CONFIG_MAKEFILE(dlls/msvcr70)
WINE_CONFIG_MAKEFILE(dlls/msvcr71)
WINE_CONFIG_MAKEFILE(dlls/msvcr80)
WINE_CONFIG_MAKEFILE(dlls/msvcr80/tests)
WINE_CONFIG_MAKEFILE(dlls/msvcr90)
WINE_CONFIG_MAKEFILE(dlls/msvcr90/tests)
WINE_CONFIG_MAKEFILE(dlls/msvcrt)
......
TESTDLL = msvcr80.dll
C_SRCS = \
msvcr80.c
RC_SRCS = \
msvcr80.rc
/*
* Copyright 2022 Paul Gofman for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <share.h>
#include <sys/stat.h>
#include <windef.h>
#include <winbase.h>
#include <errno.h>
#include "wine/test.h"
#define WX_OPEN 0x01
#define WX_ATEOF 0x02
#define WX_READNL 0x04
#define WX_PIPE 0x08
#define WX_DONTINHERIT 0x10
#define WX_APPEND 0x20
#define WX_TTY 0x40
#define WX_TEXT 0x80
#define MSVCRT_FD_BLOCK_SIZE 32
typedef struct
{
HANDLE handle;
unsigned char wxflag;
char lookahead[3];
int exflag;
CRITICAL_SECTION crit;
char textmode : 7;
char unicode : 1;
char pipech2[2];
__int64 startpos;
BOOL utf8translations;
char dbcsBuffer;
BOOL dbcsBufferUsed;
} ioinfo;
static ioinfo **__pioinfo;
static int (__cdecl *p__open)(const char *, int, ...);
static int (__cdecl *p__close)(int);
static intptr_t (__cdecl *p__get_osfhandle)(int);
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hcrt,y)
#define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
static BOOL init(void)
{
HMODULE hcrt;
SetLastError(0xdeadbeef);
hcrt = LoadLibraryA("msvcr80.dll");
if (!hcrt) {
win_skip("msvcr80.dll not installed (got %ld)\n", GetLastError());
return FALSE;
}
SET(__pioinfo, "__pioinfo");
SET(p__open,"_open");
SET(p__close,"_close");
SET(p__get_osfhandle, "_get_osfhandle");
return TRUE;
}
static void test_ioinfo_flags(void)
{
HANDLE handle;
ioinfo *info;
char *tempf;
int tempfd;
tempf = _tempnam(".","wne");
tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_WTEXT, _S_IWRITE);
ok(tempfd != -1, "_open failed with error: %d\n", errno);
handle = (HANDLE)p__get_osfhandle(tempfd);
info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE];
ok(!!info, "NULL info.\n");
ok(info->handle == handle, "Unexpected handle %p, expected %p.\n", info->handle, handle);
todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag);
ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag);
todo_wine ok(info->unicode, "Unicode is not set.\n");
todo_wine ok(info->textmode == 2, "Unexpected textmode %d.\n", info->textmode);
p__close(tempfd);
ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle);
todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag);
todo_wine ok(info->unicode, "Unicode is not set.\n");
ok(!info->wxflag, "Unexpected wxflag %#x.\n", info->wxflag);
todo_wine ok(info->textmode == 2, "Unexpected textmode %d.\n", info->textmode);
info = &__pioinfo[(tempfd + 4) / MSVCRT_FD_BLOCK_SIZE][(tempfd + 4) % MSVCRT_FD_BLOCK_SIZE];
ok(!!info, "NULL info.\n");
ok(info->handle == INVALID_HANDLE_VALUE, "Unexpected handle %p.\n", info->handle);
ok(!info->exflag, "Unexpected exflag %#x.\n", info->exflag);
ok(!info->textmode, "Unexpected textmode %d.\n", info->textmode);
tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_TEXT, _S_IWRITE);
ok(tempfd != -1, "_open failed with error: %d\n", errno);
info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE];
ok(!!info, "NULL info.\n");
todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag);
ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag);
ok(!info->unicode, "Unicode is not set.\n");
ok(!info->textmode, "Unexpected textmode %d.\n", info->textmode);
p__close(tempfd);
tempfd = p__open(tempf, _O_CREAT|_O_TRUNC|_O_WRONLY|_O_U8TEXT, _S_IWRITE);
ok(tempfd != -1, "_open failed with error: %d\n", errno);
info = &__pioinfo[tempfd / MSVCRT_FD_BLOCK_SIZE][tempfd % MSVCRT_FD_BLOCK_SIZE];
ok(!!info, "NULL info.\n");
todo_wine ok(info->exflag == 1, "Unexpected exflag %#x.\n", info->exflag);
ok(info->wxflag == (WX_TEXT | WX_OPEN), "Unexpected wxflag %#x.\n", info->wxflag);
ok(!info->unicode, "Unicode is not set.\n");
todo_wine ok(info->textmode == 1, "Unexpected textmode %d.\n", info->textmode);
p__close(tempfd);
unlink(tempf);
free(tempf);
}
START_TEST(msvcr80)
{
if(!init())
return;
test_ioinfo_flags();
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="Wine.msvcr80.Test"
version="1.0.0.0"
processorArchitecture="*"
/>
<description>Wine msvcr90 test suite</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="microsoft.vc80.crt"
version="8.0.50727.762"
processorArchitecture="*"
publicKeyToken="1fc8b3b9a1e18e3b"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
/*
* Copyright 2022 Paul Gofman for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "winuser.h"
/* @makedep: msvcr80.manifest */
1 RT_MANIFEST msvcr80.manifest
......@@ -113,8 +113,6 @@ typedef struct {
char pipech2[2];
__int64 startpos;
BOOL utf8translations;
#endif
#if _MSVCR_VER >= 90
char dbcsBuffer;
BOOL dbcsBufferUsed;
#endif
......@@ -3476,7 +3474,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count)
char conv[sizeof(lfbuf)];
size_t len = 0;
#if _MSVCR_VER >= 90
#if _MSVCR_VER >= 80
if (info->dbcsBufferUsed)
{
conv[j++] = info->dbcsBuffer;
......@@ -3495,7 +3493,7 @@ int CDECL _write(int fd, const void* buf, unsigned int count)
if (i == count)
{
#if _MSVCR_VER >= 90
#if _MSVCR_VER >= 80
info->dbcsBuffer = conv[j-1];
info->dbcsBufferUsed = TRUE;
break;
......
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