Wine-Devel
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 6 participants
- 84545 discussions
[PATCH 1/2] server: Don't create wait object if infinite timeout is passed to NtSetTimer.
by Piotr Caban Sept. 20, 2020
by Piotr Caban Sept. 20, 2020
Sept. 20, 2020
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49847
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
server/timer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
1
0
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
This is inspired by Jacek's work on the console device. The idea is, similarly,
to replace most direct server calls with ioctls.
It may also make sense to move the socket ioctls (as well as send/recv) handled
in the client to ntdll.so, in the event that they can't be moved to the server
due to performance concerns. In that case they would be handled much like
cdrom/serial/tape ioctls. This would allow us to move all unix I/O out of
ws2_32, as well as get rid of some of the effectively duplicated code dealing
with overlapped I/O.
server/directory.c | 6 ++++-
server/file.h | 1 +
server/sock.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/server/directory.c b/server/directory.c
index 198fc48ece2..c66d10b1928 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -373,10 +373,12 @@ void init_directories(void)
static const WCHAR mailslotW[] = {'M','a','i','l','S','l','o','t'};
static const WCHAR condrvW[] = {'C','o','n','D','r','v'};
static const WCHAR nullW[] = {'N','u','l','l'};
+ static const WCHAR afdW[] = {'A','f','d'};
static const struct unicode_str named_pipe_str = {named_pipeW, sizeof(named_pipeW)};
static const struct unicode_str mailslot_str = {mailslotW, sizeof(mailslotW)};
static const struct unicode_str condrv_str = {condrvW, sizeof(condrvW)};
static const struct unicode_str null_str = {nullW, sizeof(nullW)};
+ static const struct unicode_str afd_str = {afdW, sizeof(afdW)};
/* events */
static const WCHAR event_low_memW[] = {'L','o','w','M','e','m','o','r','y','C','o','n','d','i','t','i','o','n'};
@@ -404,7 +406,7 @@ void init_directories(void)
struct directory *dir_driver, *dir_device, *dir_global, *dir_kernel;
struct object *link_dosdev, *link_global, *link_nul, *link_pipe, *link_mailslot;
struct object *link_conin, *link_conout, *link_con;
- struct object *named_pipe_device, *mailslot_device, *null_device, *user_data_mapping, *console_device;
+ struct object *named_pipe_device, *mailslot_device, *null_device, *user_data_mapping, *console_device, *socket_device;
struct keyed_event *keyed_event;
unsigned int i;
@@ -422,11 +424,13 @@ void init_directories(void)
named_pipe_device = create_named_pipe_device( &dir_device->obj, &named_pipe_str );
mailslot_device = create_mailslot_device( &dir_device->obj, &mailslot_str );
console_device = create_console_device( &dir_device->obj, &condrv_str );
+ socket_device = create_socket_device( &dir_device->obj, &afd_str );
null_device = create_unix_device( &dir_device->obj, &null_str, "/dev/null" );
make_object_static( named_pipe_device );
make_object_static( mailslot_device );
make_object_static( null_device );
make_object_static( console_device );
+ make_object_static( socket_device );
/* sessions */
create_session( 0 );
diff --git a/server/file.h b/server/file.h
index b02c9fe6037..5fb4e5614b9 100644
--- a/server/file.h
+++ b/server/file.h
@@ -179,6 +179,7 @@ extern struct object *create_user_data_mapping( struct object *root, const struc
extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name );
extern struct object *create_mailslot_device( struct object *root, const struct unicode_str *name );
extern struct object *create_console_device( struct object *root, const struct unicode_str *name );
+extern struct object *create_socket_device( struct object *root, const struct unicode_str *name );
extern struct object *create_unix_device( struct object *root, const struct unicode_str *name,
const char *unix_path );
diff --git a/server/sock.c b/server/sock.c
index 1a53ce4b091..115448574ee 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -1164,6 +1164,64 @@ static void sock_release_ifchange( struct sock *sock )
}
}
+static struct object_type *socket_device_get_type( struct object *obj );
+static void socket_device_dump( struct object *obj, int verbose );
+static struct object *socket_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr );
+static struct object *socket_device_open_file( struct object *obj, unsigned int access,
+ unsigned int sharing, unsigned int options );
+
+static const struct object_ops socket_device_ops =
+{
+ sizeof(struct ifchange), /* size */
+ socket_device_dump, /* dump */
+ socket_device_get_type, /* get_type */
+ no_add_queue, /* add_queue */
+ NULL, /* remove_queue */
+ NULL, /* signaled */
+ no_satisfied, /* satisfied */
+ no_signal, /* signal */
+ no_get_fd, /* get_fd */
+ default_fd_map_access, /* map_access */
+ default_get_sd, /* get_sd */
+ default_set_sd, /* set_sd */
+ socket_device_lookup_name, /* lookup_name */
+ directory_link_name, /* link_name */
+ default_unlink_name, /* unlink_name */
+ socket_device_open_file, /* open_file */
+ no_kernel_obj_list, /* get_kernel_obj_list */
+ no_close_handle, /* close_handle */
+ no_destroy /* destroy */
+};
+
+static struct object_type *socket_device_get_type( struct object *obj )
+{
+ static const WCHAR name[] = {'D','e','v','i','c','e'};
+ static const struct unicode_str str = { name, sizeof(name) };
+ return get_object_type( &str );
+}
+
+static void socket_device_dump( struct object *obj, int verbose )
+{
+ fputs( "Socket device\n", stderr );
+}
+
+static struct object *socket_device_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr )
+{
+ return NULL;
+}
+
+static struct object *socket_device_open_file( struct object *obj, unsigned int access,
+ unsigned int sharing, unsigned int options )
+{
+ set_error( STATUS_NOT_IMPLEMENTED );
+ return NULL;
+}
+
+struct object *create_socket_device( struct object *root, const struct unicode_str *name )
+{
+ return create_named_object( root, &socket_device_ops, name, 0, NULL );
+}
+
/* create a socket */
DECL_HANDLER(create_socket)
{
--
2.28.0
1
4
[PATCH 1/2] oleaut32/tests: Include [dual] interface in test_dump_typelib.
by Kevin Puetz Sept. 18, 2020
by Kevin Puetz Sept. 18, 2020
Sept. 18, 2020
Signed-off-by: Kevin Puetz <PuetzKevinA(a)JohnDeere.com>
---
dlls/oleaut32/tests/typelib.c | 61 +++++++++++++++++++++++++++++++----
1 file changed, 55 insertions(+), 6 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 9c341b4df8..5f1851aabf 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -4345,13 +4345,14 @@ static void test_dump_typelib(const WCHAR *name)
ITypeLib *lib;
int count;
int i;
+ HREFTYPE hRefType = 0;
OLE_CHECK(LoadTypeLib(name, &lib));
printf("/*** Autogenerated data. Do not edit, change the generator above instead. ***/\n");
count = ITypeLib_GetTypeInfoCount(lib);
- for (i = 0; i < count; i++)
+ for (i = 0; i < count;)
{
TYPEATTR *attr;
BSTR name;
@@ -4363,6 +4364,12 @@ static void test_dump_typelib(const WCHAR *name)
" \"%s\",\n", dump_string(name));
OLE_CHECK(ITypeLib_GetTypeInfo(lib, i, &info));
+ if(hRefType) {
+ ITypeInfo *refInfo;
+ OLE_CHECK(ITypeInfo_GetRefTypeInfo(info, hRefType, &refInfo));
+ ITypeInfo_Release(info);
+ info = refInfo;
+ }
OLE_CHECK(ITypeInfo_GetTypeAttr(info, &attr));
printf(" \"%s\",\n", wine_dbgstr_guid(&attr->guid));
@@ -4446,6 +4453,14 @@ static void test_dump_typelib(const WCHAR *name)
if (attr->cVars) printf(" },\n");
printf("},\n");
+ if ((attr->typekind == TKIND_DISPATCH) && (attr->wTypeFlags & TYPEFLAG_FDUAL)
+ && SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(info, -1, &hRefType))) {
+ /* next iteration dumps hRefType, the TKIND_INTERFACE reference underneath this [dual] TKIND_DISPATCH */
+ } else {
+ ++i; /* move to the next item in lib */
+ hRefType = 0;
+ }
+
ITypeInfo_ReleaseTypeAttr(info, attr);
ITypeInfo_Release(info);
SysFreeString(name);
@@ -4805,6 +4820,27 @@ static const type_info info[] = {
},
{ /* vars */ },
},
+{
+ "IDualIface",
+ "{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}",
+ /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FOLEAUTOMATION|TYPEFLAG_FDUAL, /*align*/ TYPE_ALIGNMENT(IDualIface*), /*size*/ sizeof(IDualIface*),
+ /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1, /*#var*/ 0,
+ { /* funcs */
+ {
+ /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL, /*inv*/ INVOKE_FUNC, /*call*/ CC_STDCALL,
+ /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
+ {VT_HRESULT, -1, PARAMFLAG_NONE}, /* ret */
+ { /* params */
+ {-1, 0, 0}
+ },
+ { /* names */
+ "Test",
+ NULL,
+ },
+ },
+ },
+ { /* vars */ },
+},
{
"ISimpleIface",
"{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac009}",
@@ -5271,9 +5307,9 @@ static const type_info info[] = {
static void test_dump_typelib(const WCHAR *name)
{
ITypeLib *typelib;
- int ticount = ARRAY_SIZE(info);
CUSTDATA cust_data;
- int iface, func, var;
+ int iface = 0, func, var;
+ HREFTYPE hRefType = 0;
VARIANT v;
HRESULT hr;
TLIBATTR *libattr;
@@ -5286,10 +5322,8 @@ static void test_dump_typelib(const WCHAR *name)
skip("ignoring VARDESC::oInst, (libattr->syskind expected %d got %d)\n", info_syskind, libattr->syskind);
}
- expect_eq(ITypeLib_GetTypeInfoCount(typelib), ticount, UINT, "%d");
- for (iface = 0; iface < ticount; iface++)
+ for (const type_info *ti = info; ti != info + ARRAY_SIZE(info); ++ti)
{
- const type_info *ti = &info[iface];
ITypeInfo2 *typeinfo2;
ITypeInfo *typeinfo;
TYPEATTR *typeattr;
@@ -5298,6 +5332,12 @@ static void test_dump_typelib(const WCHAR *name)
trace("Interface %s\n", ti->name);
ole_check(ITypeLib_GetTypeInfo(typelib, iface, &typeinfo));
+ if(hRefType) {
+ ITypeInfo *refInfo;
+ ole_check(ITypeInfo_GetRefTypeInfo(typeinfo, hRefType, &refInfo));
+ ITypeInfo_Release(typeinfo);
+ typeinfo = refInfo;
+ }
ole_check(ITypeLib_GetDocumentation(typelib, iface, &bstrIfName, NULL, &help_ctx, NULL));
expect_wstr_acpval(bstrIfName, ti->name);
SysFreeString(bstrIfName);
@@ -5438,11 +5478,20 @@ static void test_dump_typelib(const WCHAR *name)
ITypeInfo_ReleaseVarDesc(typeinfo, desc);
}
+ if ((typeattr->typekind == TKIND_DISPATCH) && (typeattr->wTypeFlags & TYPEFLAG_FDUAL)
+ && SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(typeinfo, -1, &hRefType))) {
+ /* next iteration dumps hRefType, the TKIND_INTERFACE reference underneath this [dual] TKIND_DISPATCH */
+ } else {
+ ++iface; /* move to the next item in typelib */
+ hRefType = 0;
+ }
+
ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
ITypeInfo2_Release(typeinfo2);
ITypeInfo_Release(typeinfo);
}
+ expect_eq(ITypeLib_GetTypeInfoCount(typelib), iface, UINT, "%d");
ITypeLib_ReleaseTLibAttr(typelib, libattr);
ITypeLib_Release(typelib);
}
2
3
Sept. 18, 2020
Per standard, ctime already ends with '\n\0', so this doubled it.
Signed-off-by: Kevin Puetz <PuetzKevinA(a)JohnDeere.com>
---
This patch should not be essential to the series
It's only that the doubled '\n' changed the size of the string,
when then also changed all of the offsets of following custdata.
Which made comparisons to existing .tlb files annoying, so I fixed it.
---
tools/widl/write_msft.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 23d1dd8652..aa05dcfe56 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -2750,7 +2750,7 @@ int create_msft_typelib(typelib_t *typelib)
and midl's version number */
time_override = getenv( "WIDL_TIME_OVERRIDE");
cur_time = time_override ? atol( time_override) : time(NULL);
- sprintf(info_string, "Created by WIDL version %s at %s\n", PACKAGE_VERSION, ctime(&cur_time));
+ sprintf(info_string, "Created by WIDL version %s at %s", PACKAGE_VERSION, ctime(&cur_time));
set_custdata(msft, &midl_info_guid, VT_BSTR, info_string, &msft->typelib_header.CustomDataOffset);
set_custdata(msft, &midl_time_guid, VT_UI4, &cur_time, &msft->typelib_header.CustomDataOffset);
set_custdata(msft, &midl_version_guid, VT_UI4, &version, &msft->typelib_header.CustomDataOffset);
1
0
Sept. 18, 2020
From: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
v2:
- Use the opportunity to fixup the parameter names too
- Drop stub from TRACE
dlls/dmstyle/style.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c
index 6eaedb1fbdc..f8a62604a99 100644
--- a/dlls/dmstyle/style.c
+++ b/dlls/dmstyle/style.c
@@ -134,12 +134,39 @@ static ULONG WINAPI IDirectMusicStyle8Impl_Release(IDirectMusicStyle8 *iface)
}
/* IDirectMusicStyle8Impl IDirectMusicStyle(8) part: */
-static HRESULT WINAPI IDirectMusicStyle8Impl_GetBand(IDirectMusicStyle8 *iface, WCHAR *pwszName,
- IDirectMusicBand **ppBand)
+static HRESULT WINAPI IDirectMusicStyle8Impl_GetBand(IDirectMusicStyle8 *iface, WCHAR *name,
+ IDirectMusicBand **band)
{
- IDirectMusicStyle8Impl *This = impl_from_IDirectMusicStyle8(iface);
- FIXME("(%p, %p, %p): stub\n", This, pwszName, ppBand);
- return S_OK;
+ IDirectMusicStyle8Impl *This = impl_from_IDirectMusicStyle8(iface);
+ struct style_band *sband;
+ HRESULT hr;
+
+ TRACE("(%p, %s, %p)\n", This, debugstr_w(name), band);
+
+ if (!name)
+ return E_POINTER;
+
+ LIST_FOR_EACH_ENTRY(sband, &This->bands, struct style_band, entry) {
+ IDirectMusicObject *obj;
+
+ hr = IDirectMusicBand_QueryInterface(sband->pBand, &IID_IDirectMusicObject, (void**)&obj);
+ if (SUCCEEDED(hr)) {
+ DMUS_OBJECTDESC desc;
+
+ if (IDirectMusicObject_GetDescriptor(obj, &desc) == S_OK) {
+ if (desc.dwValidData & DMUS_OBJ_NAME && !lstrcmpW(name, desc.wszName)) {
+ IDirectMusicObject_Release(obj);
+ IDirectMusicBand_AddRef(sband->pBand);
+ *band = sband->pBand;
+ return S_OK;
+ }
+ }
+
+ IDirectMusicObject_Release(obj);
+ }
+ }
+
+ return S_FALSE;
}
static HRESULT WINAPI IDirectMusicStyle8Impl_EnumBand(IDirectMusicStyle8 *iface, DWORD dwIndex,
--
2.26.2
1
0
Sept. 18, 2020
From: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
v2:
- Use the opportunity to fixup the parameter names too
- Change FXIME stub to semi-stub
dlls/dmband/band.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/dmband/band.c b/dlls/dmband/band.c
index 901f5a69ee4..6f990afaf7f 100644
--- a/dlls/dmband/band.c
+++ b/dlls/dmband/band.c
@@ -90,11 +90,27 @@ static ULONG WINAPI IDirectMusicBandImpl_Release(IDirectMusicBand *iface)
}
static HRESULT WINAPI IDirectMusicBandImpl_CreateSegment(IDirectMusicBand *iface,
- IDirectMusicSegment **ppSegment)
+ IDirectMusicSegment **segment)
{
- IDirectMusicBandImpl *This = impl_from_IDirectMusicBand(iface);
- FIXME("(%p, %p): stub\n", This, ppSegment);
- return S_OK;
+ IDirectMusicBandImpl *This = impl_from_IDirectMusicBand(iface);
+ HRESULT hr;
+ DMUS_BAND_PARAM bandparam;
+
+ FIXME("(%p, %p): semi-stub\n", This, segment);
+
+ hr = CoCreateInstance(&CLSID_DirectMusicSegment, NULL, CLSCTX_INPROC,
+ &IID_IDirectMusicSegment, (void**)segment);
+ if (FAILED(hr))
+ return hr;
+
+ bandparam.mtTimePhysical = 0;
+ bandparam.pBand = &This->IDirectMusicBand_iface;
+ IDirectMusicBand_AddRef(bandparam.pBand);
+ hr = IDirectMusicSegment_SetParam(*segment, &GUID_BandParam, 0xffffffff, DMUS_SEG_ALLTRACKS,
+ 0, &bandparam);
+ IDirectMusicBand_Release(bandparam.pBand);
+
+ return hr;
}
static HRESULT WINAPI IDirectMusicBandImpl_Download(IDirectMusicBand *iface,
--
2.26.2
1
0
[PATCH] gdiplus: Initialize the dead point coordinates in "GpPointF, *ptf" to 0.
by Pengpeng Dong Sept. 18, 2020
by Pengpeng Dong Sept. 18, 2020
Sept. 18, 2020
2
2
Sept. 18, 2020
2
1
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31342
Signed-off-by: Gijs Vermeulen <gijsvrm(a)gmail.com>
---
I included the filebuf_open changes in ifstream and fstream because in the rest of the file
the check is done like this.
dlls/msvcirt/msvcirt.c | 205 ++++++++++++++++++-
dlls/msvcirt/msvcirt.spec | 72 +++----
dlls/msvcirt/tests/msvcirt.c | 380 +++++++++++++++++++++++++++++++++++
dlls/msvcrt20/msvcrt20.spec | 72 +++----
dlls/msvcrt40/msvcrt40.spec | 72 +++----
5 files changed, 691 insertions(+), 110 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c
index 0b0a34940d..a8f162e7f7 100644
--- a/dlls/msvcirt/msvcirt.c
+++ b/dlls/msvcirt/msvcirt.c
@@ -186,6 +186,8 @@ extern const vtable_ptr MSVCP_ostream_vtable;
extern const vtable_ptr MSVCP_ostream_withassign_vtable;
/* ??_7ostrstream@@6B@ */
extern const vtable_ptr MSVCP_ostrstream_vtable;
+/* ??_7ofstream@@6B@ */
+extern const vtable_ptr MSVCP_ofstream_vtable;
/* ??_7istream@@6B@ */
extern const vtable_ptr MSVCP_istream_vtable;
/* ??_7istream_withassign@@6B@ */
@@ -260,6 +262,8 @@ __ASM_BLOCK_BEGIN(vtables)
VTABLE_ADD_FUNC(ostream_vector_dtor));
__ASM_VTABLE(ostrstream,
VTABLE_ADD_FUNC(ostream_vector_dtor));
+ __ASM_VTABLE(ofstream,
+ VTABLE_ADD_FUNC(ostream_vector_dtor));
__ASM_VTABLE(istream,
VTABLE_ADD_FUNC(istream_vector_dtor));
__ASM_VTABLE(istream_withassign,
@@ -284,6 +288,7 @@ __ASM_BLOCK_END
/* ??_8ostream@@7B@ */
/* ??_8ostream_withassign@@7B@ */
/* ??_8ostrstream@@7B@ */
+/* ??_8ofstream@@7B@ */
const int ostream_vbtable[] = {0, VBTABLE_ENTRY(ostream, FIELD_OFFSET(ostream, vbtable), ios)};
/* ??_8istream@@7B@ */
/* ??_8istream_withassign@@7B@ */
@@ -309,6 +314,8 @@ DEFINE_RTTI_DATA2(ostream_withassign, sizeof(ostream),
&ostream_rtti_base_descriptor, &ios_rtti_base_descriptor, ".?AVostream_withassign@@")
DEFINE_RTTI_DATA2(ostrstream, sizeof(ostream),
&ostream_rtti_base_descriptor, &ios_rtti_base_descriptor, ".?AVostrstream@@")
+DEFINE_RTTI_DATA2(ofstream, sizeof(ostream),
+ &ostream_rtti_base_descriptor, &ios_rtti_base_descriptor, ".?AVofstream@@")
DEFINE_RTTI_DATA1(istream, sizeof(istream), &ios_rtti_base_descriptor, ".?AVistream@@")
DEFINE_RTTI_DATA2(istream_withassign, sizeof(istream),
&istream_rtti_base_descriptor, &ios_rtti_base_descriptor, ".?AVistream_withassign@@")
@@ -2404,6 +2411,8 @@ ostream* __thiscall ostream_copy_ctor(ostream *this, const ostream *copy, BOOL v
/* ??1ostream_withassign@@UEAA(a)XZ */
/* ??1ostrstream@@UAE(a)XZ */
/* ??1ostrstream@@UEAA(a)XZ */
+/* ??1ofstream@@UAE(a)XZ */
+/* ??1ofstream@@UEAA(a)XZ */
DEFINE_THISCALL_WRAPPER(ostream_dtor, 4)
void __thiscall ostream_dtor(ios *base)
{
@@ -2442,6 +2451,8 @@ ostream* __thiscall ostream_assign_sb(ostream *this, streambuf *sb)
/* ??4ostream_withassign@@QEAAAEAVostream@@AEBV1@@Z */
/* ??4ostrstream@@QAEAAV0(a)ABV0@@Z */
/* ??4ostrstream@@QEAAAEAV0(a)AEBV0@@Z */
+/* ??4ofstream@@QAEAAV0(a)ABV0@@Z */
+/* ??4ofstream@@QEAAAEAV0(a)AEBV0@@Z */
DEFINE_THISCALL_WRAPPER(ostream_assign, 8)
ostream* __thiscall ostream_assign(ostream *this, const ostream *rhs)
{
@@ -2454,6 +2465,8 @@ ostream* __thiscall ostream_assign(ostream *this, const ostream *rhs)
/* ??_Dostream_withassign@@QEAAXXZ */
/* ??_Dostrstream@@QAEXXZ */
/* ??_Dostrstream@@QEAAXXZ */
+/* ??_Dofstream@@QAEXXZ */
+/* ??_Dofstream@@QEAAXXZ */
DEFINE_THISCALL_WRAPPER(ostream_vbase_dtor, 4)
void __thiscall ostream_vbase_dtor(ostream *this)
{
@@ -2468,6 +2481,7 @@ void __thiscall ostream_vbase_dtor(ostream *this)
/* ??_Eostream@@UAEPAXI(a)Z */
/* ??_Eostream_withassign@@UAEPAXI(a)Z */
/* ??_Eostrstream@@UAEPAXI(a)Z */
+/* ??_Eofstream@@UAEPAXI(a)Z */
DEFINE_THISCALL_WRAPPER(ostream_vector_dtor, 8)
ostream* __thiscall ostream_vector_dtor(ios *base, unsigned int flags)
{
@@ -2493,6 +2507,7 @@ ostream* __thiscall ostream_vector_dtor(ios *base, unsigned int flags)
/* ??_Gostream@@UAEPAXI(a)Z */
/* ??_Gostream_withassign@@UAEPAXI(a)Z */
/* ??_Gostrstream@@UAEPAXI(a)Z */
+/* ??_Gofstream@@UAEPAXI(a)Z */
DEFINE_THISCALL_WRAPPER(ostream_scalar_dtor, 8)
ostream* __thiscall ostream_scalar_dtor(ios *base, unsigned int flags)
{
@@ -3086,6 +3101,191 @@ char* __thiscall ostrstream_str(ostream *this)
return strstreambuf_str(ostrstream_rdbuf(this));
}
+/* ??0ofstream@@QAE(a)ABV0@@Z */
+/* ??0ofstream@@QEAA(a)AEBV0@@Z */
+DEFINE_THISCALL_WRAPPER(ofstream_copy_ctor, 12)
+ostream* __thiscall ofstream_copy_ctor(ostream *this, const ostream *copy, BOOL virt_init)
+{
+ TRACE("(%p %p %d)\n", this, copy, virt_init);
+ ostream_withassign_copy_ctor(this, copy, virt_init);
+ ostream_get_ios(this)->vtable = &MSVCP_ofstream_vtable;
+ return this;
+}
+
+/* ??0ofstream@@QAE(a)HPADH@Z */
+/* ??0ofstream@@QEAA(a)HPEADH@Z */
+DEFINE_THISCALL_WRAPPER(ofstream_buffer_ctor, 20)
+ostream* __thiscall ofstream_buffer_ctor(ostream *this, filedesc fd, char *buffer, int length, BOOL virt_init)
+{
+ ios *base;
+ filebuf *fb = MSVCRT_operator_new(sizeof(filebuf));
+
+ TRACE("(%p %d %p %d %d)\n", this, fd, buffer, length, virt_init);
+
+ if (!fb) {
+ FIXME("out of memory\n");
+ return NULL;
+ }
+
+ filebuf_fd_reserve_ctor(fb, fd, buffer, length);
+ ostream_sb_ctor(this, &fb->base, virt_init);
+
+ base = ostream_get_ios(this);
+ base->vtable = &MSVCP_ofstream_vtable;
+ base->delbuf = 1;
+
+ return this;
+}
+
+/* ??0ofstream@@QAE(a)H@Z */
+/* ??0ofstream@@QEAA(a)H@Z */
+DEFINE_THISCALL_WRAPPER(ofstream_fd_ctor, 12)
+ostream* __thiscall ofstream_fd_ctor(ostream *this, filedesc fd, BOOL virt_init)
+{
+ ios *base;
+ filebuf *fb = MSVCRT_operator_new(sizeof(filebuf));
+
+ TRACE("(%p %d %d)\n", this, fd, virt_init);
+
+ if (!fb) {
+ FIXME("out of memory\n");
+ return NULL;
+ }
+
+ filebuf_fd_ctor(fb, fd);
+ ostream_sb_ctor(this, &fb->base, virt_init);
+
+ base = ostream_get_ios(this);
+ base->vtable = &MSVCP_ofstream_vtable;
+ base->delbuf = 1;
+
+ return this;
+}
+
+/* ??0ofstream@@QAE(a)PBDHH@Z */
+/* ??0ofstream@@QEAA(a)PEBDHH@Z */
+DEFINE_THISCALL_WRAPPER(ofstream_open_ctor, 20)
+ostream* __thiscall ofstream_open_ctor(ostream *this, const char *name, int mode, int protection, BOOL virt_init)
+{
+ ios *base;
+ filebuf *fb = MSVCRT_operator_new(sizeof(filebuf));
+
+ TRACE("(%p %s %d %d %d)\n", this, name, mode, protection, virt_init);
+
+ if (!fb) {
+ FIXME("out of memory\n");
+ return NULL;
+ }
+
+ filebuf_ctor(fb);
+ ostream_sb_ctor(this, &fb->base, virt_init);
+
+ base = ostream_get_ios(this);
+ base->vtable = &MSVCP_ofstream_vtable;
+ base->delbuf = 1;
+
+ if (filebuf_open(fb, name, mode|OPENMODE_out, protection) == NULL)
+ base->state |= IOSTATE_failbit;
+ return this;
+}
+
+/* ??0ofstream@@QAE(a)XZ */
+/* ??0ofstream@@QEAA(a)XZ */
+DEFINE_THISCALL_WRAPPER(ofstream_ctor, 8)
+ostream* __thiscall ofstream_ctor(ostream *this, BOOL virt_init)
+{
+ return ofstream_fd_ctor(this, -1, virt_init);
+}
+
+/* ?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ */
+/* ?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ */
+DEFINE_THISCALL_WRAPPER(ofstream_rdbuf, 4)
+filebuf* __thiscall ofstream_rdbuf(const ostream *this)
+{
+ TRACE("(%p)\n", this);
+ return (filebuf*) ostream_get_ios(this)->sb;
+}
+
+/* ?fd(a)ofstream@@QBEHXZ */
+/* ?fd(a)ofstream@@QEBAHXZ */
+DEFINE_THISCALL_WRAPPER(ofstream_fd, 4)
+filedesc __thiscall ofstream_fd(ostream *this)
+{
+ TRACE("(%p)\n", this);
+ return filebuf_fd(ofstream_rdbuf(this));
+}
+
+/* ?attach(a)ofstream@@QAEXH(a)Z */
+/* ?attach(a)ofstream@@QEAAXH(a)Z */
+DEFINE_THISCALL_WRAPPER(ofstream_attach, 8)
+void __thiscall ofstream_attach(ostream *this, filedesc fd)
+{
+ ios *base = ostream_get_ios(this);
+ TRACE("(%p %d)\n", this, fd);
+ if (filebuf_attach(ofstream_rdbuf(this), fd) == NULL)
+ ios_clear(base, base->state | IOSTATE_failbit);
+}
+
+/* ?close(a)ofstream@@QAEXXZ */
+/* ?close(a)ofstream@@QEAAXXZ */
+DEFINE_THISCALL_WRAPPER(ofstream_close, 4)
+void __thiscall ofstream_close(ostream *this)
+{
+ ios *base = ostream_get_ios(this);
+ TRACE("(%p)\n", this);
+ if (filebuf_close(ofstream_rdbuf(this)) == NULL)
+ ios_clear(base, base->state | IOSTATE_failbit);
+ else
+ ios_clear(base, IOSTATE_goodbit);
+}
+
+/* ?is_open(a)ofstream@@QBEHXZ */
+/* ?is_open(a)ofstream@@QEBAHXZ */
+DEFINE_THISCALL_WRAPPER(ofstream_is_open, 4)
+int __thiscall ofstream_is_open(const ostream *this)
+{
+ TRACE("(%p)\n", this);
+ return filebuf_is_open(ofstream_rdbuf(this));
+}
+
+/* ?open(a)ofstream@@QAEXPBDHH(a)Z */
+/* ?open(a)ofstream@@QEAAXPEBDHH(a)Z */
+DEFINE_THISCALL_WRAPPER(ofstream_open, 16)
+void __thiscall ofstream_open(ostream *this, const char *name, ios_open_mode mode, int protection)
+{
+ ios *base = ostream_get_ios(this);
+ TRACE("(%p %s %d %d)\n", this, name, mode, protection);
+ if (filebuf_open(ofstream_rdbuf(this), name, mode|OPENMODE_out, protection) == NULL)
+ ios_clear(base, base->state | IOSTATE_failbit);
+}
+
+/* ?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z */
+/* ?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z */
+DEFINE_THISCALL_WRAPPER(ofstream_setbuf, 12)
+streambuf* __thiscall ofstream_setbuf(ostream *this, char *buffer, int length)
+{
+ ios *base = ostream_get_ios(this);
+ filebuf* fb = ofstream_rdbuf(this);
+
+ TRACE("(%p %p %d)\n", this, buffer, length);
+
+ if (filebuf_is_open(fb)) {
+ ios_clear(base, base->state | IOSTATE_failbit);
+ return NULL;
+ }
+
+ return filebuf_setbuf(fb, buffer, length);
+}
+
+/* ?setmode(a)ofstream@@QAEHH(a)Z */
+/* ?setmode(a)ofstream@@QEAAHH(a)Z */
+DEFINE_THISCALL_WRAPPER(ofstream_setmode, 8)
+int __thiscall ofstream_setmode(ostream *this, int mode)
+{
+ TRACE("(%p %d)\n", this, mode);
+ return filebuf_setmode(ofstream_rdbuf(this), mode);
+}
+
static inline ios* istream_get_ios(const istream *this)
{
return (ios*)((char*)this + this->vbtable[1]);
@@ -4218,7 +4418,7 @@ istream* __thiscall ifstream_open_ctor(istream *this, const char *name, ios_open
base->vtable = &MSVCP_ifstream_vtable;
base->delbuf = 1;
- if (!filebuf_open(fb, name, mode|OPENMODE_in, protection))
+ if (filebuf_open(fb, name, mode|OPENMODE_in, protection) == NULL)
base->state |= IOSTATE_failbit;
return this;
}
@@ -4633,7 +4833,7 @@ iostream* __thiscall fstream_open_ctor(iostream *this, const char *name, ios_ope
base = istream_get_ios(&this->base1);
base->delbuf = 1;
- if (!filebuf_open(fb, name, mode, protection))
+ if (filebuf_open(fb, name, mode, protection) == NULL)
base->state |= IOSTATE_failbit;
return this;
}
@@ -4801,6 +5001,7 @@ static void init_io(void *base)
init_ostream_rtti(base);
init_ostream_withassign_rtti(base);
init_ostrstream_rtti(base);
+ init_ofstream_rtti(base);
init_istream_rtti(base);
init_istream_withassign_rtti(base);
init_istrstream_rtti(base);
diff --git a/dlls/msvcirt/msvcirt.spec b/dlls/msvcirt/msvcirt.spec
index 0842b14314..804300f1a3 100644
--- a/dlls/msvcirt/msvcirt.spec
+++ b/dlls/msvcirt/msvcirt.spec
@@ -70,16 +70,16 @@
@ cdecl -arch=win64 ??0logic_error@@QEAA(a)AEBQEBD@Z(ptr ptr) MSVCP_logic_error_ctor
@ thiscall -arch=win32 ??0logic_error@@QAE(a)ABV0@@Z(ptr ptr) MSVCP_logic_error_copy_ctor
@ cdecl -arch=win64 ??0logic_error@@QEAA(a)AEBV0@@Z(ptr ptr) MSVCP_logic_error_copy_ctor
-@ stub -arch=win32 ??0ofstream@@QAE(a)ABV0@@Z # __thiscall ofstream::ofstream(class ofstream const &)
-@ stub -arch=win64 ??0ofstream@@QEAA(a)AEBV0@@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)H@Z # __thiscall ofstream::ofstream(int)
-@ stub -arch=win64 ??0ofstream@@QEAA(a)H@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)HPADH@Z # __thiscall ofstream::ofstream(int,char *,int)
-@ stub -arch=win64 ??0ofstream@@QEAA(a)HPEADH@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)PBDHH@Z # __thiscall ofstream::ofstream(char const *,int,int)
-@ stub -arch=win64 ??0ofstream@@QEAA(a)PEBDHH@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)XZ # __thiscall ofstream::ofstream(void)
-@ stub -arch=win64 ??0ofstream@@QEAA(a)XZ
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)ABV0@@Z(ptr ptr long) ofstream_copy_ctor
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)AEBV0@@Z(ptr ptr long) ofstream_copy_ctor
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)H@Z(ptr long long) ofstream_fd_ctor
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)H@Z(ptr long long) ofstream_fd_ctor
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)HPADH@Z(ptr long ptr long long) ofstream_buffer_ctor
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)HPEADH@Z(ptr long ptr long long) ofstream_buffer_ctor
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)PBDHH@Z(ptr str long long long) ofstream_open_ctor
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)PEBDHH@Z(ptr str long long long) ofstream_open_ctor
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)XZ(ptr long) ofstream_ctor
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)XZ(ptr long) ofstream_ctor
@ thiscall -arch=win32 ??0ostream@@IAE(a)ABV0@@Z(ptr ptr long) ostream_copy_ctor
@ cdecl -arch=win64 ??0ostream@@IEAA(a)AEBV0@@Z(ptr ptr long) ostream_copy_ctor
@ thiscall -arch=win32 ??0ostream@@IAE(a)XZ(ptr long) ostream_ctor
@@ -152,8 +152,8 @@
@ cdecl -arch=win64 ??1istrstream@@UEAA(a)XZ(ptr) istream_dtor
@ thiscall -arch=win32 ??1logic_error@@UAE(a)XZ(ptr) MSVCP_logic_error_dtor
@ cdecl -arch=win64 ??1logic_error@@UEAA(a)XZ(ptr) MSVCP_logic_error_dtor
-@ stub -arch=win32 ??1ofstream@@UAE(a)XZ # virtual __thiscall ofstream::~ofstream(void)
-@ stub -arch=win64 ??1ofstream@@UEAA(a)XZ
+@ thiscall -arch=win32 ??1ofstream@@UAE(a)XZ(ptr) ostream_dtor
+@ cdecl -arch=win64 ??1ofstream@@UEAA(a)XZ(ptr) ostream_dtor
@ thiscall -arch=win32 ??1ostream@@UAE(a)XZ(ptr) ostream_dtor
@ cdecl -arch=win64 ??1ostream@@UEAA(a)XZ(ptr) ostream_dtor
@ thiscall -arch=win32 ??1ostream_withassign@@UAE(a)XZ(ptr) ostream_dtor
@@ -200,8 +200,8 @@
@ cdecl -arch=win64 ??4istrstream@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) istream_assign
@ thiscall -arch=win32 ??4logic_error@@QAEAAV0(a)ABV0@@Z(ptr ptr) MSVCP_logic_error_assign
@ cdecl -arch=win64 ??4logic_error@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) MSVCP_logic_error_assign
-@ stub -arch=win32 ??4ofstream@@QAEAAV0(a)ABV0@@Z # class ofstream & __thiscall ofstream::operator=(class ofstream const &)
-@ stub -arch=win64 ??4ofstream@@QEAAAEAV0(a)AEBV0@@Z
+@ thiscall -arch=win32 ??4ofstream@@QAEAAV0(a)ABV0@@Z(ptr ptr) ostream_assign
+@ cdecl -arch=win64 ??4ofstream@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) ostream_assign
@ thiscall -arch=win32 ??4ostream@@IAEAAV0(a)ABV0@@Z(ptr ptr) ostream_assign
@ cdecl -arch=win64 ??4ostream@@IEAAAEAV0(a)AEBV0@@Z(ptr ptr) ostream_assign
@ thiscall -arch=win32 ??4ostream@@IAEAAV0(a)PAVstreambuf@@@Z(ptr ptr) ostream_assign_sb
@@ -312,7 +312,7 @@
@ extern ??_7istream_withassign@@6B@ MSVCP_istream_vtable
@ extern ??_7istrstream@@6B@ MSVCP_istrstream_vtable
@ extern ??_7logic_error@@6B@ MSVCP_logic_error_vtable
-# @ extern ??_7ofstream@@6B@ # const ofstream::`vftable'
+@ extern ??_7ofstream@@6B@ MSVCP_ofstream_vtable
@ extern ??_7ostream@@6B@ MSVCP_ostream_vtable
@ extern ??_7ostream_withassign@@6B@ MSVCP_ostream_withassign_vtable
@ extern ??_7ostrstream@@6B@ MSVCP_ostrstream_vtable
@@ -329,7 +329,7 @@
@ extern ??_8istream@@7B@ istream_vbtable
@ extern ??_8istream_withassign@@7B@ istream_vbtable
@ extern ??_8istrstream@@7B@ istream_vbtable
-# @ extern ??_8ofstream@@7B@ # const ofstream::`vbtable'
+@ extern ??_8ofstream@@7B@ ostream_vbtable
@ extern ??_8ostream@@7B@ ostream_vbtable
@ extern ??_8ostream_withassign@@7B@ ostream_vbtable
@ extern ??_8ostrstream@@7B@ ostream_vbtable
@@ -349,8 +349,8 @@
@ cdecl -arch=win64 ??_Distream_withassign@@QEAAXXZ(ptr) istream_vbase_dtor
@ thiscall -arch=win32 ??_Distrstream@@QAEXXZ(ptr) istream_vbase_dtor
@ cdecl -arch=win64 ??_Distrstream@@QEAAXXZ(ptr) istream_vbase_dtor
-@ stub -arch=win32 ??_Dofstream@@QAEXXZ # void __thiscall ofstream::`vbase destructor'(void)
-@ stub -arch=win64 ??_Dofstream@@QEAAXXZ
+@ thiscall -arch=win32 ??_Dofstream@@QAEXXZ(ptr) ostream_vbase_dtor
+@ cdecl -arch=win64 ??_Dofstream@@QEAAXXZ(ptr) ostream_vbase_dtor
@ thiscall -arch=win32 ??_Dostream@@QAEXXZ(ptr) ostream_vbase_dtor
@ cdecl -arch=win64 ??_Dostream@@QEAAXXZ(ptr) ostream_vbase_dtor
@ thiscall -arch=win32 ??_Dostream_withassign@@QAEXXZ(ptr) ostream_vbase_dtor
@@ -371,7 +371,7 @@
@ thiscall -arch=win32 ??_Eistream_withassign@@UAEPAXI(a)Z(ptr long) istream_vector_dtor
@ thiscall -arch=win32 ??_Eistrstream@@UAEPAXI(a)Z(ptr long) istream_vector_dtor
@ thiscall -arch=win32 ??_Elogic_error@@UAEPAXI(a)Z(ptr long) MSVCP_logic_error_vector_dtor
-@ stub -arch=win32 ??_Eofstream@@UAEPAXI(a)Z # virtual void * __thiscall ofstream::`vector deleting destructor'(unsigned int)
+@ thiscall -arch=win32 ??_Eofstream@@UAEPAXI(a)Z(ptr long) ostream_vector_dtor
@ thiscall -arch=win32 ??_Eostream@@UAEPAXI(a)Z(ptr long) ostream_vector_dtor
@ thiscall -arch=win32 ??_Eostream_withassign@@UAEPAXI(a)Z(ptr long) ostream_vector_dtor
@ thiscall -arch=win32 ??_Eostrstream@@UAEPAXI(a)Z(ptr long) ostream_vector_dtor
@@ -390,7 +390,7 @@
@ thiscall -arch=win32 ??_Gistream_withassign@@UAEPAXI(a)Z(ptr long) istream_scalar_dtor
@ thiscall -arch=win32 ??_Gistrstream@@UAEPAXI(a)Z(ptr long) istream_scalar_dtor
@ thiscall -arch=win32 ??_Glogic_error@@UAEPAXI(a)Z(ptr long) MSVCP_logic_error_scalar_dtor
-@ stub -arch=win32 ??_Gofstream@@UAEPAXI(a)Z # virtual void * __thiscall ofstream::`scalar deleting destructor'(unsigned int)
+@ thiscall -arch=win32 ??_Gofstream@@UAEPAXI(a)Z(ptr long) ostream_scalar_dtor
@ thiscall -arch=win32 ??_Gostream@@UAEPAXI(a)Z(ptr long) ostream_scalar_dtor
@ thiscall -arch=win32 ??_Gostream_withassign@@UAEPAXI(a)Z(ptr long) ostream_scalar_dtor
@ thiscall -arch=win32 ??_Gostrstream@@UAEPAXI(a)Z(ptr long) ostream_scalar_dtor
@@ -408,8 +408,8 @@
@ stub -arch=win64 ?attach(a)fstream@@QEAAXH(a)Z
@ thiscall -arch=win32 ?attach(a)ifstream@@QAEXH(a)Z(ptr long) ifstream_attach
@ cdecl -arch=win64 ?attach(a)ifstream@@QEAAXH(a)Z(ptr long) ifstream_attach
-@ stub -arch=win32 ?attach(a)ofstream@@QAEXH(a)Z # void __thiscall ofstream::attach(int)
-@ stub -arch=win64 ?attach(a)ofstream@@QEAAXH(a)Z
+@ thiscall -arch=win32 ?attach(a)ofstream@@QAEXH(a)Z(ptr long) ofstream_attach
+@ cdecl -arch=win64 ?attach(a)ofstream@@QEAAXH(a)Z(ptr long) ofstream_attach
@ thiscall -arch=win32 ?bad(a)ios@@QBEHXZ(ptr) ios_bad
@ cdecl -arch=win64 ?bad(a)ios@@QEBAHXZ(ptr) ios_bad
@ thiscall -arch=win32 ?base(a)streambuf@@IBEPADXZ(ptr) streambuf_base
@@ -430,8 +430,8 @@
@ stub -arch=win64 ?close(a)fstream@@QEAAXXZ
@ thiscall -arch=win32 ?close(a)ifstream@@QAEXXZ(ptr) ifstream_close
@ cdecl -arch=win64 ?close(a)ifstream@@QEAAXXZ(ptr) ifstream_close
-@ stub -arch=win32 ?close(a)ofstream@@QAEXXZ # void __thiscall ofstream::close(void)
-@ stub -arch=win64 ?close(a)ofstream@@QEAAXXZ
+@ thiscall -arch=win32 ?close(a)ofstream@@QAEXXZ(ptr) ofstream_close
+@ cdecl -arch=win64 ?close(a)ofstream@@QEAAXXZ(ptr) ofstream_close
@ cdecl -arch=win32 ?clrlock(a)ios@@QAAXXZ(ptr) ios_clrlock
@ cdecl -arch=win64 ?clrlock(a)ios@@QEAAXXZ(ptr) ios_clrlock
@ thiscall -arch=win32 ?clrlock(a)streambuf@@QAEXXZ(ptr) streambuf_clrlock
@@ -474,8 +474,8 @@
@ stub -arch=win64 ?fd(a)fstream@@QEBAHXZ
@ thiscall -arch=win32 ?fd(a)ifstream@@QBEHXZ(ptr) ifstream_fd
@ cdecl -arch=win64 ?fd(a)ifstream@@QEBAHXZ(ptr) ifstream_fd
-@ stub -arch=win32 ?fd(a)ofstream@@QBEHXZ # int __thiscall ofstream::fd(void)const
-@ stub -arch=win64 ?fd(a)ofstream@@QEBAHXZ
+@ thiscall -arch=win32 ?fd(a)ofstream@@QBEHXZ(ptr) ofstream_fd
+@ cdecl -arch=win64 ?fd(a)ofstream@@QEBAHXZ(ptr) ofstream_fd
@ thiscall -arch=win32 ?fill(a)ios@@QAEDD(a)Z(ptr long) ios_fill_set
@ cdecl -arch=win64 ?fill(a)ios@@QEAADD(a)Z(ptr long) ios_fill_set
@ thiscall -arch=win32 ?fill(a)ios@@QBEDXZ(ptr) ios_fill_get
@@ -543,8 +543,8 @@
@ stub -arch=win64 ?is_open(a)fstream@@QEBAHXZ
@ thiscall -arch=win32 ?is_open(a)ifstream@@QBEHXZ(ptr) ifstream_is_open
@ cdecl -arch=win64 ?is_open(a)ifstream@@QEBAHXZ(ptr) ifstream_is_open
-@ stub -arch=win32 ?is_open(a)ofstream@@QBEHXZ # int __thiscall ofstream::is_open(void)const
-@ stub -arch=win64 ?is_open(a)ofstream@@QEBAHXZ
+@ thiscall -arch=win32 ?is_open(a)ofstream@@QBEHXZ(ptr) ofstream_is_open
+@ cdecl -arch=win64 ?is_open(a)ofstream@@QEBAHXZ(ptr) ofstream_is_open
@ thiscall -arch=win32 ?isfx(a)istream@@QAEXXZ(ptr) istream_isfx
@ cdecl -arch=win64 ?isfx(a)istream@@QEAAXXZ(ptr) istream_isfx
@ thiscall -arch=win32 ?iword(a)ios@@QBEAAJH(a)Z(ptr long) ios_iword
@@ -568,8 +568,8 @@
@ stub -arch=win64 ?open(a)fstream@@QEAAXPEBDHH(a)Z
@ thiscall -arch=win32 ?open(a)ifstream@@QAEXPBDHH(a)Z(ptr str long long) ifstream_open
@ cdecl -arch=win64 ?open(a)ifstream@@QEAAXPEBDHH(a)Z(ptr str long long) ifstream_open
-@ stub -arch=win32 ?open(a)ofstream@@QAEXPBDHH(a)Z # void __thiscall ofstream::open(char const *,int,int)
-@ stub -arch=win64 ?open(a)ofstream@@QEAAXPEBDHH(a)Z
+@ thiscall -arch=win32 ?open(a)ofstream@@QAEXPBDHH(a)Z(ptr str long long) ofstream_open
+@ cdecl -arch=win64 ?open(a)ofstream@@QEAAXPEBDHH(a)Z(ptr str long long) ofstream_open
@ extern ?openprot(a)filebuf@@2HB filebuf_openprot
@ thiscall -arch=win32 ?opfx(a)ostream@@QAEHXZ(ptr) ostream_opfx
@ cdecl -arch=win64 ?opfx(a)ostream@@QEAAHXZ(ptr) ostream_opfx
@@ -621,8 +621,8 @@
@ cdecl -arch=win64 ?rdbuf(a)ios@@QEBAPEAVstreambuf@@XZ(ptr) ios_rdbuf
@ thiscall -arch=win32 ?rdbuf(a)istrstream@@QBEPAVstrstreambuf@@XZ(ptr) istrstream_rdbuf
@ cdecl -arch=win64 ?rdbuf(a)istrstream@@QEBAPEAVstrstreambuf@@XZ(ptr) istrstream_rdbuf
-@ stub -arch=win32 ?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ # class filebuf * __thiscall ofstream::rdbuf(void)const
-@ stub -arch=win64 ?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ
+@ thiscall -arch=win32 ?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ(ptr) ofstream_rdbuf
+@ cdecl -arch=win64 ?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ(ptr) ofstream_rdbuf
@ thiscall -arch=win32 ?rdbuf(a)ostrstream@@QBEPAVstrstreambuf@@XZ(ptr) ostrstream_rdbuf
@ cdecl -arch=win64 ?rdbuf(a)ostrstream@@QEBAPEAVstrstreambuf@@XZ(ptr) ostrstream_rdbuf
@ thiscall -arch=win32 ?rdbuf(a)stdiostream@@QBEPAVstdiobuf@@XZ(ptr) stdiostream_rdbuf
@@ -665,8 +665,8 @@
@ stub -arch=win64 ?setbuf(a)fstream@@QEAAPEAVstreambuf@@PEADH(a)Z
@ thiscall -arch=win32 ?setbuf(a)ifstream@@QAEPAVstreambuf@@PADH(a)Z(ptr ptr long) ifstream_setbuf
@ cdecl -arch=win64 ?setbuf(a)ifstream@@QEAAPEAVstreambuf@@PEADH(a)Z(ptr ptr long) ifstream_setbuf
-@ stub -arch=win32 ?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z # class streambuf * __thiscall ofstream::setbuf(char *,int)
-@ stub -arch=win64 ?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z
+@ thiscall -arch=win32 ?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z(ptr ptr long) ofstream_setbuf
+@ cdecl -arch=win64 ?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z(ptr ptr long) ofstream_setbuf
@ thiscall -arch=win32 ?setbuf(a)streambuf@@UAEPAV1(a)PADH@Z(ptr ptr long) streambuf_setbuf
@ cdecl -arch=win64 ?setbuf(a)streambuf@@UEAAPEAV1(a)PEADH@Z(ptr ptr long) streambuf_setbuf
@ thiscall -arch=win32 ?setbuf(a)strstreambuf@@UAEPAVstreambuf@@PADH(a)Z(ptr ptr long) strstreambuf_setbuf
@@ -687,8 +687,8 @@
@ stub -arch=win64 ?setmode(a)fstream@@QEAAHH(a)Z
@ thiscall -arch=win32 ?setmode(a)ifstream@@QAEHH(a)Z(ptr long) ifstream_setmode
@ cdecl -arch=win64 ?setmode(a)ifstream@@QEAAHH(a)Z(ptr long) ifstream_setmode
-@ stub -arch=win32 ?setmode(a)ofstream@@QAEHH(a)Z # int __thiscall ofstream::setmode(int)
-@ stub -arch=win64 ?setmode(a)ofstream@@QEAAHH(a)Z
+@ thiscall -arch=win32 ?setmode(a)ofstream@@QAEHH(a)Z(ptr long) ofstream_setmode
+@ cdecl -arch=win64 ?setmode(a)ofstream@@QEAAHH(a)Z(ptr long) ofstream_setmode
@ thiscall -arch=win32 ?setp(a)streambuf@@IAEXPAD0(a)Z(ptr ptr ptr) streambuf_setp
@ cdecl -arch=win64 ?setp(a)streambuf@@IEAAXPEAD0(a)Z(ptr ptr ptr) streambuf_setp
@ thiscall -arch=win32 ?setrwbuf(a)stdiobuf@@QAEHHH(a)Z(ptr long long) stdiobuf_setrwbuf
diff --git a/dlls/msvcirt/tests/msvcirt.c b/dlls/msvcirt/tests/msvcirt.c
index 7bb8bdcf73..18cce105fd 100644
--- a/dlls/msvcirt/tests/msvcirt.c
+++ b/dlls/msvcirt/tests/msvcirt.c
@@ -339,6 +339,23 @@ static void (*__thiscall p_ostrstream_vbase_dtor)(ostream*);
static ostream* (*__thiscall p_ostrstream_assign)(ostream*, const ostream*);
static int (*__thiscall p_ostrstream_pcount)(const ostream*);
+/* ofstream */
+static ostream* (*__thiscall p_ofstream_copy_ctor)(ostream*, const ostream*, BOOL);
+static ostream* (*__thiscall p_ofstream_buffer_ctor)(ostream*, filedesc, char*, int, BOOL);
+static ostream* (*__thiscall p_ofstream_fd_ctor)(ostream*, filedesc fd, BOOL virt_init);
+static ostream* (*__thiscall p_ofstream_open_ctor)(ostream*, const char *name, ios_open_mode, int, BOOL);
+static ostream* (*__thiscall p_ofstream_ctor)(ostream*, BOOL);
+static void (*__thiscall p_ofstream_dtor)(ios*);
+static void (*__thiscall p_ofstream_vbase_dtor)(ostream*);
+static void (*__thiscall p_ofstream_attach)(ostream*, filedesc);
+static void (*__thiscall p_ofstream_close)(ostream*);
+static filedesc (*__thiscall p_ofstream_fd)(ostream*);
+static int (*__thiscall p_ofstream_is_open)(const ostream*);
+static void (*__thiscall p_ofstream_open)(ostream*, const char*, ios_open_mode, int);
+static filebuf* (*__thiscall p_ofstream_rdbuf)(const ostream*);
+static streambuf* (*__thiscall p_ofstream_setbuf)(ostream*, char*, int);
+static int (*__thiscall p_ofstream_setmode)(ostream*, int);
+
/* istream */
static istream* (*__thiscall p_istream_copy_ctor)(istream*, const istream*, BOOL);
static istream* (*__thiscall p_istream_ctor)(istream*, BOOL);
@@ -670,6 +687,22 @@ static BOOL init(void)
SET(p_ostrstream_assign, "??4ostrstream@@QEAAAEAV0(a)AEBV0@@Z");
SET(p_ostrstream_pcount, "?pcount(a)ostrstream@@QEBAHXZ");
+ SET(p_ofstream_copy_ctor, "??0ofstream@@QEAA(a)AEBV0@@Z");
+ SET(p_ofstream_buffer_ctor, "??0ofstream@@QEAA(a)HPEADH@Z");
+ SET(p_ofstream_fd_ctor, "??0ofstream@@QEAA(a)H@Z");
+ SET(p_ofstream_open_ctor, "??0ofstream@@QEAA(a)PEBDHH@Z");
+ SET(p_ofstream_ctor, "??0ofstream@@QEAA(a)XZ");
+ SET(p_ofstream_dtor, "??1ofstream@@UEAA(a)XZ");
+ SET(p_ofstream_vbase_dtor, "??_Dofstream@@QEAAXXZ");
+ SET(p_ofstream_attach, "?attach(a)ofstream@@QEAAXH(a)Z");
+ SET(p_ofstream_close, "?close(a)ofstream@@QEAAXXZ");
+ SET(p_ofstream_fd, "?fd(a)ofstream@@QEBAHXZ");
+ SET(p_ofstream_is_open, "?is_open(a)ofstream@@QEBAHXZ");
+ SET(p_ofstream_open, "?open(a)ofstream@@QEAAXPEBDHH(a)Z");
+ SET(p_ofstream_rdbuf, "?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ");
+ SET(p_ofstream_setbuf, "?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z");
+ SET(p_ofstream_setmode, "?setmode(a)ofstream@@QEAAHH(a)Z");
+
SET(p_istream_copy_ctor, "??0istream@@IEAA(a)AEBV0@@Z");
SET(p_istream_ctor, "??0istream@@IEAA(a)XZ");
SET(p_istream_sb_ctor, "??0istream@@QEAA(a)PEAVstreambuf@@@Z");
@@ -905,6 +938,22 @@ static BOOL init(void)
SET(p_ostrstream_assign, "??4ostrstream@@QAEAAV0(a)ABV0@@Z");
SET(p_ostrstream_pcount, "?pcount(a)ostrstream@@QBEHXZ");
+ SET(p_ofstream_copy_ctor, "??0ofstream@@QAE(a)ABV0@@Z");
+ SET(p_ofstream_fd_ctor, "??0ofstream@@QAE(a)H@Z");
+ SET(p_ofstream_buffer_ctor, "??0ofstream@@QAE(a)HPADH@Z");
+ SET(p_ofstream_open_ctor, "??0ofstream@@QAE(a)PBDHH@Z");
+ SET(p_ofstream_ctor, "??0ofstream@@QAE(a)XZ");
+ SET(p_ofstream_dtor, "??1ofstream@@UAE(a)XZ");
+ SET(p_ofstream_vbase_dtor, "??_Dofstream@@QAEXXZ");
+ SET(p_ofstream_attach, "?attach(a)ofstream@@QAEXH(a)Z");
+ SET(p_ofstream_close, "?close(a)ofstream@@QAEXXZ");
+ SET(p_ofstream_fd, "?fd(a)ofstream@@QBEHXZ");
+ SET(p_ofstream_is_open, "?is_open(a)ofstream@@QBEHXZ");
+ SET(p_ofstream_open, "?open(a)ofstream@@QAEXPBDHH(a)Z");
+ SET(p_ofstream_rdbuf, "?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ");
+ SET(p_ofstream_setbuf, "?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z");
+ SET(p_ofstream_setmode, "?setmode(a)ofstream@@QAEHH(a)Z");
+
SET(p_istream_copy_ctor, "??0istream@@IAE(a)ABV0@@Z");
SET(p_istream_ctor, "??0istream@@IAE(a)XZ");
SET(p_istream_sb_ctor, "??0istream@@QAE(a)PAVstreambuf@@@Z");
@@ -4498,6 +4547,336 @@ static void test_ostrstream(void)
call_func1(p_ostrstream_vbase_dtor, &os1);
}
+static void test_ofstream(void)
+{
+ const char *filename = "ofstream_test";
+ ostream ofs, ofs_copy, *pofs;
+ streambuf *psb;
+ filebuf *pfb;
+ char buffer[64];
+ char st[8];
+ int fd, ret;
+
+ memset(&ofs, 0xab, sizeof(ostream));
+
+ /* constructors/destructors */
+ pofs = call_func2(p_ofstream_ctor, &ofs, TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ ok(ofs.unknown == 0, "expected 0 got %d\n", ofs.unknown);
+ ok(ofs.base_ios.sb != NULL, "expected not %p got %p\n", NULL, ofs.base_ios.sb);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(ofs.base_ios.delbuf == 1, "expected 1 got %d\n", ofs.base_ios.delbuf);
+ ok(ofs.base_ios.tie == NULL, "expected %p got %p\n", NULL, ofs.base_ios.tie);
+ ok(ofs.base_ios.flags == 0x0, "expected %x got %x\n", 0x0, ofs.base_ios.flags);
+ ok(ofs.base_ios.precision == 6, "expected 6 got %d\n", ofs.base_ios.precision);
+ ok(ofs.base_ios.fill == ' ', "expected 32 got %d\n", ofs.base_ios.fill);
+ ok(ofs.base_ios.width == 0, "expected 0 got %d\n", ofs.base_ios.width);
+ ok(ofs.base_ios.do_lock == -1, "expected -1 got %d\n", ofs.base_ios.do_lock);
+ ok(pfb->fd == -1, "wrong fd, expected -1 got %d\n", pfb->fd);
+ ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+ ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+ ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+ ok(pfb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pfb->base.base);
+ ok(pfb->base.ebuf == NULL, "wrong ebuf, expected %p got %p\n", NULL, pfb->base.ebuf);
+ ok(pfb->fd == -1, "wrong fd, expected 0 got %d\n", pfb->fd);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+
+ pofs = call_func3(p_ofstream_fd_ctor, &ofs, 42, TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(ofs.base_ios.delbuf == 1, "expected 1 got %d\n", ofs.base_ios.delbuf);
+ ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+ ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+ ok(pfb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pfb->base.base);
+ ok(pfb->base.ebuf == NULL, "wrong ebuf, expected %p got %p\n", NULL, pfb->base.ebuf);
+ ok(pfb->fd == 42, "wrong fd, expected 42 got %d\n", pfb->fd);
+ ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+
+ pofs = call_func3(p_ofstream_copy_ctor, &ofs_copy, &ofs, TRUE);
+ pfb = (filebuf*) ofs_copy.base_ios.sb;
+ ok(pofs == &ofs_copy, "wrong return, expected %p got %p\n", &ofs_copy, pofs);
+ ok(ofs_copy.base_ios.sb == ofs.base_ios.sb, "expected shared streambuf\n");
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(ofs_copy.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs_copy.base_ios.state);
+
+ call_func1(p_ofstream_vbase_dtor, &ofs_copy);
+ call_func1(p_ofstream_dtor, &ofs.base_ios);
+
+ pofs = call_func5(p_ofstream_buffer_ctor, &ofs, 53, buffer, ARRAY_SIZE(buffer), TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(ofs.base_ios.delbuf == 1, "expected 1 got %d\n", ofs.base_ios.delbuf);
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+ ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+ ok(pfb->base.base == buffer, "wrong buffer, expected %p got %p\n", buffer, pfb->base.base);
+ ok(pfb->base.ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), pfb->base.ebuf);
+ ok(pfb->fd == 53, "wrong fd, expected 53 got %d\n", pfb->fd);
+ ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+ call_func1(p_ofstream_dtor, &ofs.base_ios);
+
+ pofs = call_func5(p_ofstream_buffer_ctor, &ofs, 64, NULL, 0, TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(ofs.base_ios.delbuf == 1, "expected 1 got %d\n", ofs.base_ios.delbuf);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(pfb->base.allocated == 0, "wrong allocate value, expected 0 got %d\n", pfb->base.allocated);
+ ok(pfb->base.unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", pfb->base.unbuffered);
+ ok(pfb->base.base == NULL, "wrong buffer, expected %p got %p\n", NULL, pfb->base.base);
+ ok(pfb->base.ebuf == NULL, "wrong ebuf, expected %p got %p\n", NULL, pfb->base.ebuf);
+ ok(pfb->fd == 64, "wrong fd, expected 64 got %d\n", pfb->fd);
+ ok(pfb->close == 0, "wrong value, expected 0 got %d\n", pfb->close);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+
+ pofs = call_func5(p_ofstream_open_ctor, &ofs, filename, OPENMODE_out, filebuf_openprot, TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(ofs.base_ios.delbuf == 1, "expected 1 got %d\n", ofs.base_ios.delbuf);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ ok(pfb->base.allocated == 1, "wrong allocate value, expected 1 got %d\n", pfb->base.allocated);
+ ok(pfb->base.unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", pfb->base.unbuffered);
+ ok(pfb->base.base != NULL, "wrong buffer, expected not %p got %p\n", NULL, pfb->base.base);
+ ok(pfb->base.ebuf != NULL, "wrong ebuf, expected not %p got %p\n", NULL, pfb->base.ebuf);
+ ok(pfb->fd != -1, "wrong fd, expected not -1 got %d\n", pfb->fd);
+ fd = pfb->fd;
+ ok(pfb->close == 1, "wrong value, expected 1 got %d\n", pfb->close);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+ ok(_close(fd) == -1, "expected ofstream to close opened file\n");
+ ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+ /* setbuf */
+ call_func5(p_ofstream_buffer_ctor, &ofs, -1, NULL, 0, TRUE);
+ ok(ofs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", pfb->base.unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, buffer, ARRAY_SIZE(buffer));
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, NULL, 0);
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+
+ call_func2(p_ofstream_ctor, &ofs, TRUE);
+ ok(ofs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, buffer, ARRAY_SIZE(buffer));
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, NULL, 0);
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer, "wrong buffer, expected %p got %p\n", buffer, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, buffer + 8, ARRAY_SIZE(buffer) - 8);
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer + 8, "wrong buffer, expected %p got %p\n", buffer + 8, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, buffer + 8, 0);
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer + 8, "wrong buffer, expected %p got %p\n", buffer + 8, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, buffer + 4, ARRAY_SIZE(buffer) - 4);
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer + 4, "wrong buffer, expected %p got %p\n", buffer + 4, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ psb = call_func3(p_ofstream_setbuf, &ofs, NULL, 5);
+ ok(psb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, psb);
+ ok(ofs.base_ios.sb->base == buffer + 4, "wrong buffer, expected %p got %p\n", buffer + 4, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == buffer + ARRAY_SIZE(buffer), "wrong ebuf, expected %p got %p\n", buffer + ARRAY_SIZE(buffer), ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+
+ /* setbuf - seems to be a nop and always return NULL in those other cases */
+ pofs = call_func5(p_ofstream_buffer_ctor, &ofs, 42, NULL, 0, TRUE);
+ ok(ofs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+
+ ofs.base_ios.state = IOSTATE_eofbit;
+ psb = call_func3(p_ofstream_setbuf, &ofs, buffer, ARRAY_SIZE(buffer));
+ ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+ ok(ofs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+
+ ofs.base_ios.state = IOSTATE_eofbit;
+ psb = call_func3(p_ofstream_setbuf, &ofs, NULL, 0);
+ ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+ ok(ofs.base_ios.sb->base == NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf == NULL, "wrong ebuf value, expected NULL got %p\n", ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 1, "wrong unbuffered value, expected 1 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 0, "wrong allocated value, expected 0 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+
+ pofs = call_func5(p_ofstream_open_ctor, &ofs, filename, OPENMODE_out, filebuf_openprot, TRUE);
+ ofs.base_ios.state = IOSTATE_eofbit;
+ psb = call_func3(p_ofstream_setbuf, &ofs, NULL, 0);
+ ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+ ok(ofs.base_ios.sb->base != NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->ebuf != NULL, "wrong ebuf value, expected NULL got %p\n", ofs.base_ios.sb->ebuf);
+ ok(ofs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 1, "wrong allocated value, expected 1 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+
+ ofs.base_ios.state = IOSTATE_eofbit;
+ psb = call_func3(p_ofstream_setbuf, &ofs, buffer, ARRAY_SIZE(buffer));
+ ok(psb == NULL, "wrong return, expected NULL got %p\n", psb);
+ ok(ofs.base_ios.sb->base != NULL, "wrong base value, expected NULL got %p\n", ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->base != buffer, "wrong base value, expected not %p got %p\n", buffer, ofs.base_ios.sb->base);
+ ok(ofs.base_ios.sb->unbuffered == 0, "wrong unbuffered value, expected 0 got %d\n", ofs.base_ios.sb->unbuffered);
+ ok(ofs.base_ios.sb->allocated == 1, "wrong allocated value, expected 1 got %d\n", ofs.base_ios.sb->allocated);
+ ok(ofs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+ ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+ /* attach */
+ pofs = call_func2(p_ofstream_ctor, &ofs, TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ call_func2(p_ofstream_attach, &ofs, 42);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "attaching on vanilla stream set some state bits\n");
+ fd = (int) call_func1(p_ofstream_fd, &ofs);
+ ok(fd == 42, "wrong fd, expected 42 got %d\n", fd);
+ ok(pfb->close == 0, "wrong close value, expected 0 got %d\n", pfb->close);
+ ofs.base_ios.state = IOSTATE_eofbit;
+ call_func2(p_ofstream_attach, &ofs, 53);
+ ok(ofs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "attaching on already setup stream did not set failbit\n");
+ ok(fd == 42, "wrong fd, expected 42 got %d\n", fd);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+
+ /* fd */
+ pofs = call_func2(p_ofstream_ctor, &ofs, TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ fd = (int) call_func1(p_ofstream_fd, &ofs);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(fd == -1, "wrong fd, expected -1 but got %d\n", fd);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+
+ pofs = call_func5(p_ofstream_open_ctor, &ofs, filename, OPENMODE_out, filebuf_openprot, TRUE);
+ pfb = (filebuf*) ofs.base_ios.sb;
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ fd = (int) call_func1(p_ofstream_fd, &ofs);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ok(fd == pfb->fd, "wrong fd, expected %d but got %d\n", pfb->fd, fd);
+
+ /* rdbuf */
+ pfb = (filebuf*) call_func1(p_ofstream_rdbuf, &ofs);
+ ok((streambuf*) pfb == ofs.base_ios.sb, "wrong return, expected %p got %p\n", ofs.base_ios.sb, pfb);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ /* setmode */
+ ret = (int) call_func2(p_ofstream_setmode, &ofs, filebuf_binary);
+ ok(ret == filebuf_text, "wrong return, expected %d got %d\n", filebuf_text, ret);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ret = (int) call_func2(p_ofstream_setmode, &ofs, filebuf_binary);
+ ok(ret == filebuf_binary, "wrong return, expected %d got %d\n", filebuf_binary, ret);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ret = (int) call_func2(p_ofstream_setmode, &ofs, filebuf_text);
+ ok(ret == filebuf_binary, "wrong return, expected %d got %d\n", filebuf_binary, ret);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+ ret = (int) call_func2(p_ofstream_setmode, &ofs, 0x9000);
+ ok(ret == -1, "wrong return, expected -1 got %d\n", ret);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "expected %d got %d\n", IOSTATE_goodbit, ofs.base_ios.state);
+
+ /* close && is_open */
+ ok((int) call_func1(p_ofstream_is_open, &ofs) == 1, "expected ofstream to be open\n");
+ ofs.base_ios.state = IOSTATE_eofbit | IOSTATE_failbit;
+ call_func1(p_ofstream_close, &ofs);
+ ok(ofs.base_ios.state == IOSTATE_goodbit, "close did not clear state = %d\n", ofs.base_ios.state);
+ ofs.base_ios.state = IOSTATE_eofbit;
+ call_func1(p_ofstream_close, &ofs);
+ ok(ofs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "close on a closed stream did not set failbit\n");
+ ok((int) call_func1(p_ofstream_is_open, &ofs) == 0, "expected ofstream to not be open\n");
+ ok(_close(fd) == -1, "expected close to close the opened file\n");
+
+ /* open */
+ ofs.base_ios.state = IOSTATE_eofbit;
+ call_func4(p_ofstream_open, &ofs, filename, OPENMODE_out, filebuf_openprot);
+ fd = (int) call_func1(p_ofstream_fd, &ofs);
+ ok(fd != -1, "wrong fd, expected not -1 got %d\n", fd);
+ ok(ofs.base_ios.state == IOSTATE_eofbit, "open did not succeed\n");
+ call_func4(p_ofstream_open, &ofs, filename, OPENMODE_out, filebuf_openprot);
+ ok(ofs.base_ios.state == (IOSTATE_eofbit | IOSTATE_failbit), "second open did not set failbit\n");
+ call_func1(p_ofstream_close, &ofs);
+
+ /* integration with parent ostream - writing */
+ ofs.base_ios.state = IOSTATE_goodbit; /* open doesn't clear the state */
+ call_func4(p_ofstream_open, &ofs, filename, OPENMODE_in, filebuf_openprot); /* make sure that OPENMODE_out is implicit */
+ pofs = call_func3(p_ostream_write_char, &ofs, "testing", 7);
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ call_func1(p_ofstream_close, &ofs);
+
+ /* read what we wrote */
+ fd = _open(filename, _O_RDONLY, _S_IREAD);
+ ok(fd != -1, "_open failed\n");
+ ok(_read(fd, st, 7) == 7, "_read failed\n");
+ ok(_close(fd) == 0, "_close failed\n");
+ ok(!strcmp(st, "testing"), "expected 'testing' got '%s'\n", st);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+ ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+
+ /* make sure that OPENMODE_out is implicit with open_ctor */
+ pofs = call_func5(p_ofstream_open_ctor, &ofs, filename, OPENMODE_in, filebuf_openprot, TRUE);
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ pofs = call_func3(p_ostream_write_char, &ofs, "testing", 7);
+ ok(pofs == &ofs, "wrong return, expected %p got %p\n", &ofs, pofs);
+ call_func1(p_ofstream_close, &ofs);
+
+ fd = _open(filename, _O_RDONLY, _S_IREAD);
+ ok(fd != -1, "_open failed\n");
+ ok(_read(fd, st, 7) == 7, "_read failed\n");
+ ok(_close(fd) == 0, "_close failed\n");
+ ok(!strcmp(st, "testing"), "expected 'testing' got '%s'\n", st);
+ call_func1(p_ofstream_vbase_dtor, &ofs);
+ ok(_unlink(filename) == 0, "Couldn't unlink file named '%s'\n", filename);
+}
+
static void test_istream(void)
{
istream is1, is2, *pis;
@@ -8092,6 +8471,7 @@ START_TEST(msvcirt)
test_ostream_print();
test_ostream_withassign();
test_ostrstream();
+ test_ofstream();
test_istream();
test_istream_getint();
test_istream_getdouble();
diff --git a/dlls/msvcrt20/msvcrt20.spec b/dlls/msvcrt20/msvcrt20.spec
index 33383c1d33..907d3ffed6 100644
--- a/dlls/msvcrt20/msvcrt20.spec
+++ b/dlls/msvcrt20/msvcrt20.spec
@@ -60,16 +60,16 @@
@ cdecl -arch=win64 ??0istrstream@@QEAA(a)PEAD@Z(ptr ptr long) msvcirt.??0istrstream@@QEAA(a)PEAD@Z
@ thiscall -arch=win32 ??0istrstream@@QAE(a)PADH@Z(ptr ptr long long) msvcirt.??0istrstream@@QAE(a)PADH@Z
@ cdecl -arch=win64 ??0istrstream@@QEAA(a)PEADH@Z(ptr ptr long long) msvcirt.??0istrstream@@QEAA(a)PEADH@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)ABV0@@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)AEBV0@@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)H@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)H@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)HPADH@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)HPEADH@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)PBDHH@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)PEBDHH@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)XZ
-@ stub -arch=win64 ??0ofstream@@QEAA(a)XZ
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)ABV0@@Z(ptr ptr long) msvcirt.??0ofstream@@QAE(a)ABV0@@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)AEBV0@@Z(ptr ptr long) msvcirt.??0ofstream@@QEAA(a)AEBV0@@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)H@Z(ptr long long) msvcirt.??0ofstream@@QAE(a)H@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)H@Z(ptr long long) msvcirt.??0ofstream@@QEAA(a)H@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)HPADH@Z(ptr long ptr long long) msvcirt.??0ofstream@@QAE(a)HPADH@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)HPEADH@Z(ptr long ptr long long) msvcirt.??0ofstream@@QEAA(a)HPEADH@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)PBDHH@Z(ptr str long long long) msvcirt.??0ofstream@@QAE(a)PBDHH@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)PEBDHH@Z(ptr str long long long) msvcirt.??0ofstream@@QEAA(a)PEBDHH@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)XZ(ptr long) msvcirt.??0ofstream@@QAE(a)XZ
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)XZ(ptr long) msvcirt.??0ofstream@@QEAA(a)XZ
@ thiscall -arch=win32 ??0ostream@@IAE(a)ABV0@@Z(ptr ptr long) msvcirt.??0ostream@@IAE(a)ABV0@@Z
@ cdecl -arch=win64 ??0ostream@@IEAA(a)AEBV0@@Z(ptr ptr long) msvcirt.??0ostream@@IEAA(a)AEBV0@@Z
@ thiscall -arch=win32 ??0ostream@@IAE(a)XZ(ptr long) msvcirt.??0ostream@@IAE(a)XZ
@@ -136,8 +136,8 @@
@ cdecl -arch=win64 ??1istream_withassign@@UEAA(a)XZ(ptr) msvcirt.??1istream_withassign@@UEAA(a)XZ
@ thiscall -arch=win32 ??1istrstream@@UAE(a)XZ(ptr) msvcirt.??1istrstream@@UAE(a)XZ
@ cdecl -arch=win64 ??1istrstream@@UEAA(a)XZ(ptr) msvcirt.??1istrstream@@UEAA(a)XZ
-@ stub -arch=win32 ??1ofstream@@UAE(a)XZ
-@ stub -arch=win64 ??1ofstream@@UEAA(a)XZ
+@ thiscall -arch=win32 ??1ofstream@@UAE(a)XZ(ptr) msvcirt.??1ofstream@@UAE(a)XZ
+@ cdecl -arch=win64 ??1ofstream@@UEAA(a)XZ(ptr) msvcirt.??1ofstream@@UEAA(a)XZ
@ thiscall -arch=win32 ??1ostream@@UAE(a)XZ(ptr) msvcirt.??1ostream@@UAE(a)XZ
@ cdecl -arch=win64 ??1ostream@@UEAA(a)XZ(ptr) msvcirt.??1ostream@@UEAA(a)XZ
@ thiscall -arch=win32 ??1ostream_withassign@@UAE(a)XZ(ptr) msvcirt.??1ostream_withassign@@UAE(a)XZ
@@ -184,8 +184,8 @@
@ cdecl -arch=win64 ??4istream_withassign@@QEAAAEAVistream@@PEAVstreambuf@@@Z(ptr ptr) msvcirt.??4istream_withassign@@QEAAAEAVistream@@PEAVstreambuf@@@Z
@ thiscall -arch=win32 ??4istrstream@@QAEAAV0(a)ABV0@@Z(ptr ptr) msvcirt.??4istrstream@@QAEAAV0(a)ABV0@@Z
@ cdecl -arch=win64 ??4istrstream@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) msvcirt.??4istrstream@@QEAAAEAV0(a)AEBV0@@Z
-@ stub -arch=win32 ??4ofstream@@QAEAAV0(a)ABV0@@Z
-@ stub -arch=win64 ??4ofstream@@QEAAAEAV0(a)AEBV0@@Z
+@ thiscall -arch=win32 ??4ofstream@@QAEAAV0(a)ABV0@@Z(ptr ptr) msvcirt.??4ofstream@@QAEAAV0(a)ABV0@@Z
+@ cdecl -arch=win64 ??4ofstream@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) msvcirt.??4ofstream@@QEAAAEAV0(a)AEBV0@@Z
@ thiscall -arch=win32 ??4ostream@@IAEAAV0(a)ABV0@@Z(ptr ptr) msvcirt.??4ostream@@IAEAAV0(a)ABV0@@Z
@ cdecl -arch=win64 ??4ostream@@IEAAAEAV0(a)AEBV0@@Z(ptr ptr) msvcirt.??4ostream@@IEAAAEAV0(a)AEBV0@@Z
@ thiscall -arch=win32 ??4ostream@@IAEAAV0(a)PAVstreambuf@@@Z(ptr ptr) msvcirt.??4ostream@@IAEAAV0(a)PAVstreambuf@@@Z
@@ -294,7 +294,7 @@
@ extern ??_7istream@@6B@ msvcirt.??_7istream@@6B@
@ extern ??_7istream_withassign@@6B@ msvcirt.??_7istream_withassign@@6B@
@ extern ??_7istrstream@@6B@ msvcirt.??_7istrstream@@6B@
-# @ extern ??_7ofstream@@6B@
+@ extern ??_7ofstream@@6B@ msvcirt.??_7ofstream@@6B@
@ extern ??_7ostream@@6B@ msvcirt.??_7ostream@@6B@
@ extern ??_7ostream_withassign@@6B@ msvcirt.??_7ostream_withassign@@6B@
@ extern ??_7ostrstream@@6B@ msvcirt.??_7ostrstream@@6B@
@@ -311,7 +311,7 @@
@ extern ??_8istream@@7B@ msvcirt.??_8istream@@7B@
@ extern ??_8istream_withassign@@7B@ msvcirt.??_8istream_withassign@@7B@
@ extern ??_8istrstream@@7B@ msvcirt.??_8istrstream@@7B@
-# @ extern ??_8ofstream@@7B@
+@ extern ??_8ofstream@@7B@ msvcirt.??_8ofstream@@7B@
@ extern ??_8ostream@@7B@ msvcirt.??_8ostream@@7B@
@ extern ??_8ostream_withassign@@7B@ msvcirt.??_8ostream_withassign@@7B@
@ extern ??_8ostrstream@@7B@ msvcirt.??_8ostrstream@@7B@
@@ -331,8 +331,8 @@
@ cdecl -arch=win64 ??_Distream_withassign@@QEAAXXZ(ptr) msvcirt.??_Distream_withassign@@QEAAXXZ
@ thiscall -arch=win32 ??_Distrstream@@QAEXXZ(ptr) msvcirt.??_Distrstream@@QAEXXZ
@ cdecl -arch=win64 ??_Distrstream@@QEAAXXZ(ptr) msvcirt.??_Distrstream@@QEAAXXZ
-@ stub -arch=win32 ??_Dofstream@@QAEXXZ
-@ stub -arch=win64 ??_Dofstream@@QEAAXXZ
+@ thiscall -arch=win32 ??_Dofstream@@QAEXXZ(ptr) msvcirt.??_Dofstream@@QAEXXZ
+@ cdecl -arch=win64 ??_Dofstream@@QEAAXXZ(ptr) msvcirt.??_Dofstream@@QEAAXXZ
@ thiscall -arch=win32 ??_Dostream@@QAEXXZ(ptr) msvcirt.??_Dostream@@QAEXXZ
@ cdecl -arch=win64 ??_Dostream@@QEAAXXZ(ptr) msvcirt.??_Dostream@@QEAAXXZ
@ thiscall -arch=win32 ??_Dostream_withassign@@QAEXXZ(ptr) msvcirt.??_Dostream_withassign@@QAEXXZ
@@ -352,7 +352,7 @@
@ thiscall -arch=win32 ??_Eistream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eistream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eistream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eistream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eistrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eistrstream@@UAEPAXI(a)Z
-@ stub -arch=win32 ??_Eofstream@@UAEPAXI(a)Z
+@ thiscall -arch=win32 ??_Eofstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eofstream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eostream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eostream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eostream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eostream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eostrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eostrstream@@UAEPAXI(a)Z
@@ -370,7 +370,7 @@
@ thiscall -arch=win32 ??_Gistream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gistream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gistream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gistream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gistrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gistrstream@@UAEPAXI(a)Z
-@ stub -arch=win32 ??_Gofstream@@UAEPAXI(a)Z
+@ thiscall -arch=win32 ??_Gofstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gofstream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gostream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gostream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gostream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gostream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gostrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gostrstream@@UAEPAXI(a)Z
@@ -396,8 +396,8 @@
@ stub -arch=win64 ?attach(a)fstream@@QEAAXH(a)Z
@ thiscall -arch=win32 ?attach(a)ifstream@@QAEXH(a)Z(ptr long) msvcirt.?attach(a)ifstream@@QAEXH(a)Z
@ cdecl -arch=win64 ?attach(a)ifstream@@QEAAXH(a)Z(ptr long) msvcirt.?attach(a)ifstream@@QEAAXH(a)Z
-@ stub -arch=win32 ?attach(a)ofstream@@QAEXH(a)Z
-@ stub -arch=win64 ?attach(a)ofstream@@QEAAXH(a)Z
+@ thiscall -arch=win32 ?attach(a)ofstream@@QAEXH(a)Z(ptr long) msvcirt.?attach(a)ofstream@@QAEXH(a)Z
+@ cdecl -arch=win64 ?attach(a)ofstream@@QEAAXH(a)Z(ptr long) msvcirt.?attach(a)ofstream@@QEAAXH(a)Z
@ thiscall -arch=win32 ?bad(a)ios@@QBEHXZ(ptr) msvcirt.?bad(a)ios@@QBEHXZ
@ cdecl -arch=win64 ?bad(a)ios@@QEBAHXZ(ptr) msvcirt.?bad(a)ios@@QEBAHXZ
@ thiscall -arch=win32 ?base(a)streambuf@@IBEPADXZ(ptr) msvcirt.?base(a)streambuf@@IBEPADXZ
@@ -418,8 +418,8 @@
@ stub -arch=win64 ?close(a)fstream@@QEAAXXZ
@ thiscall -arch=win32 ?close(a)ifstream@@QAEXXZ(ptr) msvcirt.?close(a)ifstream@@QAEXXZ
@ cdecl -arch=win64 ?close(a)ifstream@@QEAAXXZ(ptr) msvcirt.?close(a)ifstream@@QEAAXXZ
-@ stub -arch=win32 ?close(a)ofstream@@QAEXXZ
-@ stub -arch=win64 ?close(a)ofstream@@QEAAXXZ
+@ thiscall -arch=win32 ?close(a)ofstream@@QAEXXZ(ptr) msvcirt.?close(a)ofstream@@QAEXXZ
+@ cdecl -arch=win64 ?close(a)ofstream@@QEAAXXZ(ptr) msvcirt.?close(a)ofstream@@QEAAXXZ
@ cdecl -arch=win32 ?clrlock(a)ios@@QAAXXZ(ptr) msvcirt.?clrlock(a)ios@@QAAXXZ
@ cdecl -arch=win64 ?clrlock(a)ios@@QEAAXXZ(ptr) msvcirt.?clrlock(a)ios@@QEAAXXZ
@ thiscall -arch=win32 ?clrlock(a)streambuf@@QAEXXZ(ptr) msvcirt.?clrlock(a)streambuf@@QAEXXZ
@@ -462,8 +462,8 @@
@ stub -arch=win64 ?fd(a)fstream@@QEBAHXZ
@ thiscall -arch=win32 ?fd(a)ifstream@@QBEHXZ(ptr) msvcirt.?fd(a)ifstream@@QBEHXZ
@ cdecl -arch=win64 ?fd(a)ifstream@@QEBAHXZ(ptr) msvcirt.?fd(a)ifstream@@QEBAHXZ
-@ stub -arch=win32 ?fd(a)ofstream@@QBEHXZ
-@ stub -arch=win64 ?fd(a)ofstream@@QEBAHXZ
+@ thiscall -arch=win32 ?fd(a)ofstream@@QBEHXZ(ptr) msvcirt.?fd(a)ofstream@@QBEHXZ
+@ cdecl -arch=win64 ?fd(a)ofstream@@QEBAHXZ(ptr) msvcirt.?fd(a)ofstream@@QEBAHXZ
@ thiscall -arch=win32 ?fill(a)ios@@QAEDD(a)Z(ptr long) msvcirt.?fill(a)ios@@QAEDD(a)Z
@ cdecl -arch=win64 ?fill(a)ios@@QEAADD(a)Z(ptr long) msvcirt.?fill(a)ios@@QEAADD(a)Z
@ thiscall -arch=win32 ?fill(a)ios@@QBEDXZ(ptr) msvcirt.?fill(a)ios@@QBEDXZ
@@ -529,8 +529,8 @@
@ stub -arch=win64 ?is_open(a)fstream@@QEBAHXZ
@ thiscall -arch=win32 ?is_open(a)ifstream@@QBEHXZ(ptr) msvcirt.?is_open(a)ifstream@@QBEHXZ
@ cdecl -arch=win64 ?is_open(a)ifstream@@QEBAHXZ(ptr) msvcirt.?is_open(a)ifstream@@QEBAHXZ
-@ stub -arch=win32 ?is_open(a)ofstream@@QBEHXZ
-@ stub -arch=win64 ?is_open(a)ofstream@@QEBAHXZ
+@ thiscall -arch=win32 ?is_open(a)ofstream@@QBEHXZ(ptr) msvcirt.?is_open(a)ofstream@@QBEHXZ
+@ cdecl -arch=win64 ?is_open(a)ofstream@@QEBAHXZ(ptr) msvcirt.?is_open(a)ofstream@@QEBAHXZ
@ thiscall -arch=win32 ?isfx(a)istream@@QAEXXZ(ptr) msvcirt.?isfx(a)istream@@QAEXXZ
@ cdecl -arch=win64 ?isfx(a)istream@@QEAAXXZ(ptr) msvcirt.?isfx(a)istream@@QEAAXXZ
@ thiscall -arch=win32 ?iword(a)ios@@QBEAAJH(a)Z(ptr long) msvcirt.?iword(a)ios@@QBEAAJH(a)Z
@@ -554,8 +554,8 @@
@ stub -arch=win64 ?open(a)fstream@@QEAAXPEBDHH(a)Z
@ thiscall -arch=win32 ?open(a)ifstream@@QAEXPBDHH(a)Z(ptr str long long) msvcirt.?open(a)ifstream@@QAEXPBDHH(a)Z
@ cdecl -arch=win64 ?open(a)ifstream@@QEAAXPEBDHH(a)Z(ptr str long long) msvcirt.?open(a)ifstream@@QEAAXPEBDHH(a)Z
-@ stub -arch=win32 ?open(a)ofstream@@QAEXPBDHH(a)Z
-@ stub -arch=win64 ?open(a)ofstream@@QEAAXPEBDHH(a)Z
+@ thiscall -arch=win32 ?open(a)ofstream@@QAEXPBDHH(a)Z(ptr str long long) msvcirt.?open(a)ofstream@@QAEXPBDHH(a)Z
+@ cdecl -arch=win64 ?open(a)ofstream@@QEAAXPEBDHH(a)Z(ptr str long long) msvcirt.?open(a)ofstream@@QEAAXPEBDHH(a)Z
@ extern ?openprot(a)filebuf@@2HB msvcirt.?openprot(a)filebuf@@2HB
@ thiscall -arch=win32 ?opfx(a)ostream@@QAEHXZ(ptr) msvcirt.?opfx(a)ostream@@QAEHXZ
@ cdecl -arch=win64 ?opfx(a)ostream@@QEAAHXZ(ptr) msvcirt.?opfx(a)ostream@@QEAAHXZ
@@ -607,8 +607,8 @@
@ cdecl -arch=win64 ?rdbuf(a)ios@@QEBAPEAVstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)ios@@QEBAPEAVstreambuf@@XZ
@ thiscall -arch=win32 ?rdbuf(a)istrstream@@QBEPAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)istrstream@@QBEPAVstrstreambuf@@XZ
@ cdecl -arch=win64 ?rdbuf(a)istrstream@@QEBAPEAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)istrstream@@QEBAPEAVstrstreambuf@@XZ
-@ stub -arch=win32 ?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ
-@ stub -arch=win64 ?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ
+@ thiscall -arch=win32 ?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ(ptr) msvcirt.?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ
+@ cdecl -arch=win64 ?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ(ptr) msvcirt.?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ
@ thiscall -arch=win32 ?rdbuf(a)ostrstream@@QBEPAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)ostrstream@@QBEPAVstrstreambuf@@XZ
@ cdecl -arch=win64 ?rdbuf(a)ostrstream@@QEBAPEAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)ostrstream@@QEBAPEAVstrstreambuf@@XZ
@ thiscall -arch=win32 ?rdbuf(a)stdiostream@@QBEPAVstdiobuf@@XZ(ptr) msvcirt.?rdbuf(a)stdiostream@@QBEPAVstdiobuf@@XZ
@@ -653,8 +653,8 @@
@ stub -arch=win64 ?setbuf(a)fstream@@QEAAPEAVstreambuf@@PEADH(a)Z
@ thiscall -arch=win32 ?setbuf(a)ifstream@@QAEPAVstreambuf@@PADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ifstream@@QAEPAVstreambuf@@PADH(a)Z
@ cdecl -arch=win64 ?setbuf(a)ifstream@@QEAAPEAVstreambuf@@PEADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ifstream@@QEAAPEAVstreambuf@@PEADH(a)Z
-@ stub -arch=win32 ?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z
-@ stub -arch=win64 ?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z
+@ thiscall -arch=win32 ?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z
+@ cdecl -arch=win64 ?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z
@ thiscall -arch=win32 ?setbuf(a)streambuf@@UAEPAV1(a)PADH@Z(ptr ptr long) msvcirt.?setbuf(a)streambuf@@UAEPAV1(a)PADH@Z
@ cdecl -arch=win64 ?setbuf(a)streambuf@@UEAAPEAV1(a)PEADH@Z(ptr ptr long) msvcirt.?setbuf(a)streambuf@@UEAAPEAV1(a)PEADH@Z
@ thiscall -arch=win32 ?setbuf(a)strstreambuf@@UAEPAVstreambuf@@PADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)strstreambuf@@UAEPAVstreambuf@@PADH(a)Z
@@ -675,8 +675,8 @@
@ stub -arch=win64 ?setmode(a)fstream@@QEAAHH(a)Z
@ thiscall -arch=win32 ?setmode(a)ifstream@@QAEHH(a)Z(ptr long) msvcirt.?setmode(a)ifstream@@QAEHH(a)Z
@ cdecl -arch=win64 ?setmode(a)ifstream@@QEAAHH(a)Z(ptr long) msvcirt.?setmode(a)ifstream@@QEAAHH(a)Z
-@ stub -arch=win32 ?setmode(a)ofstream@@QAEHH(a)Z
-@ stub -arch=win64 ?setmode(a)ofstream@@QEAAHH(a)Z
+@ thiscall -arch=win32 ?setmode(a)ofstream@@QAEHH(a)Z(ptr long) msvcirt.?setmode(a)ofstream@@QAEHH(a)Z
+@ cdecl -arch=win64 ?setmode(a)ofstream@@QEAAHH(a)Z(ptr long) msvcirt.?setmode(a)ofstream@@QEAAHH(a)Z
@ thiscall -arch=win32 ?setp(a)streambuf@@IAEXPAD0(a)Z(ptr ptr ptr) msvcirt.?setp(a)streambuf@@IAEXPAD0(a)Z
@ cdecl -arch=win64 ?setp(a)streambuf@@IEAAXPEAD0(a)Z(ptr ptr ptr) msvcirt.?setp(a)streambuf@@IEAAXPEAD0(a)Z
@ thiscall -arch=win32 ?setrwbuf(a)stdiobuf@@QAEHHH(a)Z(ptr long long) msvcirt.?setrwbuf(a)stdiobuf@@QAEHHH(a)Z
diff --git a/dlls/msvcrt40/msvcrt40.spec b/dlls/msvcrt40/msvcrt40.spec
index 9f09cfdc8b..9e25f4f2bc 100644
--- a/dlls/msvcrt40/msvcrt40.spec
+++ b/dlls/msvcrt40/msvcrt40.spec
@@ -82,16 +82,16 @@
@ cdecl -arch=win64 ??0logic_error@@QEAA(a)AEBQEBD@Z(ptr ptr) msvcirt.??0logic_error@@QEAA(a)AEBQEBD@Z
@ thiscall -arch=win32 ??0logic_error@@QAE(a)ABV0@@Z(ptr ptr) msvcirt.??0logic_error@@QAE(a)ABV0@@Z
@ cdecl -arch=win64 ??0logic_error@@QEAA(a)AEBV0@@Z(ptr ptr) msvcirt.??0logic_error@@QEAA(a)AEBV0@@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)ABV0@@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)AEBV0@@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)H@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)H@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)HPADH@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)HPEADH@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)PBDHH@Z
-@ stub -arch=win64 ??0ofstream@@QEAA(a)PEBDHH@Z
-@ stub -arch=win32 ??0ofstream@@QAE(a)XZ
-@ stub -arch=win64 ??0ofstream@@QEAA(a)XZ
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)ABV0@@Z(ptr ptr long) msvcirt.??0ofstream@@QAE(a)ABV0@@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)AEBV0@@Z(ptr ptr long) msvcirt.??0ofstream@@QEAA(a)AEBV0@@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)H@Z(ptr long long) msvcirt.??0ofstream@@QAE(a)H@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)H@Z(ptr long long) msvcirt.??0ofstream@@QEAA(a)H@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)HPADH@Z(ptr long ptr long long) msvcirt.??0ofstream@@QAE(a)HPADH@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)HPEADH@Z(ptr long ptr long long) msvcirt.??0ofstream@@QEAA(a)HPEADH@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)PBDHH@Z(ptr str long long long) msvcirt.??0ofstream@@QAE(a)PBDHH@Z
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)PEBDHH@Z(ptr str long long long) msvcirt.??0ofstream@@QEAA(a)PEBDHH@Z
+@ thiscall -arch=win32 ??0ofstream@@QAE(a)XZ(ptr long) msvcirt.??0ofstream@@QAE(a)XZ
+@ cdecl -arch=win64 ??0ofstream@@QEAA(a)XZ(ptr long) msvcirt.??0ofstream@@QEAA(a)XZ
@ thiscall -arch=win32 ??0ostream@@IAE(a)ABV0@@Z(ptr ptr long) msvcirt.??0ostream@@IAE(a)ABV0@@Z
@ cdecl -arch=win64 ??0ostream@@IEAA(a)AEBV0@@Z(ptr ptr long) msvcirt.??0ostream@@IEAA(a)AEBV0@@Z
@ thiscall -arch=win32 ??0ostream@@IAE(a)XZ(ptr long) msvcirt.??0ostream@@IAE(a)XZ
@@ -168,8 +168,8 @@
@ cdecl -arch=win64 ??1istrstream@@UEAA(a)XZ(ptr) msvcirt.??1istrstream@@UEAA(a)XZ
@ thiscall -arch=win32 ??1logic_error@@UAE(a)XZ(ptr) msvcirt.??1logic_error@@UAE(a)XZ
@ cdecl -arch=win64 ??1logic_error@@UEAA(a)XZ(ptr) msvcirt.??1logic_error@@UEAA(a)XZ
-@ stub -arch=win32 ??1ofstream@@UAE(a)XZ
-@ stub -arch=win64 ??1ofstream@@UEAA(a)XZ
+@ thiscall -arch=win32 ??1ofstream@@UAE(a)XZ(ptr) msvcirt.??1ofstream@@UAE(a)XZ
+@ cdecl -arch=win64 ??1ofstream@@UEAA(a)XZ(ptr) msvcirt.??1ofstream@@UEAA(a)XZ
@ thiscall -arch=win32 ??1ostream@@UAE(a)XZ(ptr) msvcirt.??1ostream@@UAE(a)XZ
@ cdecl -arch=win64 ??1ostream@@UEAA(a)XZ(ptr) msvcirt.??1ostream@@UEAA(a)XZ
@ thiscall -arch=win32 ??1ostream_withassign@@UAE(a)XZ(ptr) msvcirt.??1ostream_withassign@@UAE(a)XZ
@@ -228,8 +228,8 @@
@ cdecl -arch=win64 ??4istrstream@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) msvcirt.??4istrstream@@QEAAAEAV0(a)AEBV0@@Z
@ thiscall -arch=win32 ??4logic_error@@QAEAAV0(a)ABV0@@Z(ptr ptr) msvcirt.??4logic_error@@QAEAAV0(a)ABV0@@Z
@ cdecl -arch=win64 ??4logic_error@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) msvcirt.??4logic_error@@QEAAAEAV0(a)AEBV0@@Z
-@ stub -arch=win32 ??4ofstream@@QAEAAV0(a)ABV0@@Z
-@ stub -arch=win64 ??4ofstream@@QEAAAEAV0(a)AEBV0@@Z
+@ thiscall -arch=win32 ??4ofstream@@QAEAAV0(a)ABV0@@Z(ptr ptr) msvcirt.??4ofstream@@QAEAAV0(a)ABV0@@Z
+@ cdecl -arch=win64 ??4ofstream@@QEAAAEAV0(a)AEBV0@@Z(ptr ptr) msvcirt.??4ofstream@@QEAAAEAV0(a)AEBV0@@Z
@ thiscall -arch=win32 ??4ostream@@IAEAAV0(a)ABV0@@Z(ptr ptr) msvcirt.??4ostream@@IAEAAV0(a)ABV0@@Z
@ cdecl -arch=win64 ??4ostream@@IEAAAEAV0(a)AEBV0@@Z(ptr ptr) msvcirt.??4ostream@@IEAAAEAV0(a)AEBV0@@Z
@ thiscall -arch=win32 ??4ostream@@IAEAAV0(a)PAVstreambuf@@@Z(ptr ptr) msvcirt.??4ostream@@IAEAAV0(a)PAVstreambuf@@@Z
@@ -347,7 +347,7 @@
@ extern ??_7istream_withassign@@6B@ msvcirt.??_7istream_withassign@@6B@
@ extern ??_7istrstream@@6B@ msvcirt.??_7istrstream@@6B@
@ extern ??_7logic_error@@6B@ msvcirt.??_7logic_error@@6B@
-# @ extern ??_7ofstream@@6B@
+@ extern ??_7ofstream@@6B@ msvcirt.??_7ofstream@@6B@
@ extern ??_7ostream@@6B@ msvcirt.??_7ostream@@6B@
@ extern ??_7ostream_withassign@@6B@ msvcirt.??_7ostream_withassign@@6B@
@ extern ??_7ostrstream@@6B@ msvcirt.??_7ostrstream@@6B@
@@ -364,7 +364,7 @@
@ extern ??_8istream@@7B@ msvcirt.??_8istream@@7B@
@ extern ??_8istream_withassign@@7B@ msvcirt.??_8istream_withassign@@7B@
@ extern ??_8istrstream@@7B@ msvcirt.??_8istrstream@@7B@
-# @ extern ??_8ofstream@@7B@
+@ extern ??_8ofstream@@7B@ msvcirt.??_8ofstream@@7B@
@ extern ??_8ostream@@7B@ msvcirt.??_8ostream@@7B@
@ extern ??_8ostream_withassign@@7B@ msvcirt.??_8ostream_withassign@@7B@
@ extern ??_8ostrstream@@7B@ msvcirt.??_8ostrstream@@7B@
@@ -384,8 +384,8 @@
@ cdecl -arch=win64 ??_Distream_withassign@@QEAAXXZ(ptr) msvcirt.??_Distream_withassign@@QEAAXXZ
@ thiscall -arch=win32 ??_Distrstream@@QAEXXZ(ptr) msvcirt.??_Distrstream@@QAEXXZ
@ cdecl -arch=win64 ??_Distrstream@@QEAAXXZ(ptr) msvcirt.??_Distrstream@@QEAAXXZ
-@ stub -arch=win32 ??_Dofstream@@QAEXXZ
-@ stub -arch=win64 ??_Dofstream@@QEAAXXZ
+@ thiscall -arch=win32 ??_Dofstream@@QAEXXZ(ptr) msvcirt.??_Dofstream@@QAEXXZ
+@ cdecl -arch=win64 ??_Dofstream@@QEAAXXZ(ptr) msvcirt.??_Dofstream@@QEAAXXZ
@ thiscall -arch=win32 ??_Dostream@@QAEXXZ(ptr) msvcirt.??_Dostream@@QAEXXZ
@ cdecl -arch=win64 ??_Dostream@@QEAAXXZ(ptr) msvcirt.??_Dostream@@QEAAXXZ
@ thiscall -arch=win32 ??_Dostream_withassign@@QAEXXZ(ptr) msvcirt.??_Dostream_withassign@@QAEXXZ
@@ -410,7 +410,7 @@
@ thiscall -arch=win32 ??_Eistream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eistream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eistrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eistrstream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Elogic_error@@UAEPAXI(a)Z(ptr long) msvcirt.??_Elogic_error@@UAEPAXI(a)Z
-@ stub -arch=win32 ??_Eofstream@@UAEPAXI(a)Z
+@ thiscall -arch=win32 ??_Eofstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eofstream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eostream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eostream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eostream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eostream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Eostrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Eostrstream@@UAEPAXI(a)Z
@@ -433,7 +433,7 @@
@ thiscall -arch=win32 ??_Gistream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gistream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gistrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gistrstream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Glogic_error@@UAEPAXI(a)Z(ptr long) msvcirt.??_Glogic_error@@UAEPAXI(a)Z
-@ stub -arch=win32 ??_Gofstream@@UAEPAXI(a)Z
+@ thiscall -arch=win32 ??_Gofstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gofstream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gostream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gostream@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gostream_withassign@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gostream_withassign@@UAEPAXI(a)Z
@ thiscall -arch=win32 ??_Gostrstream@@UAEPAXI(a)Z(ptr long) msvcirt.??_Gostrstream@@UAEPAXI(a)Z
@@ -459,8 +459,8 @@
@ stub -arch=win64 ?attach(a)fstream@@QEAAXH(a)Z
@ thiscall -arch=win32 ?attach(a)ifstream@@QAEXH(a)Z(ptr long) msvcirt.?attach(a)ifstream@@QAEXH(a)Z
@ cdecl -arch=win64 ?attach(a)ifstream@@QEAAXH(a)Z(ptr long) msvcirt.?attach(a)ifstream@@QEAAXH(a)Z
-@ stub -arch=win32 ?attach(a)ofstream@@QAEXH(a)Z
-@ stub -arch=win64 ?attach(a)ofstream@@QEAAXH(a)Z
+@ thiscall -arch=win32 ?attach(a)ofstream@@QAEXH(a)Z(ptr long) msvcirt.?attach(a)ofstream@@QAEXH(a)Z
+@ cdecl -arch=win64 ?attach(a)ofstream@@QEAAXH(a)Z(ptr long) msvcirt.?attach(a)ofstream@@QEAAXH(a)Z
@ thiscall -arch=win32 ?bad(a)ios@@QBEHXZ(ptr) msvcirt.?bad(a)ios@@QBEHXZ
@ cdecl -arch=win64 ?bad(a)ios@@QEBAHXZ(ptr) msvcirt.?bad(a)ios@@QEBAHXZ
@ thiscall -arch=win32 ?base(a)streambuf@@IBEPADXZ(ptr) msvcirt.?base(a)streambuf@@IBEPADXZ
@@ -483,8 +483,8 @@
@ stub -arch=win64 ?close(a)fstream@@QEAAXXZ
@ thiscall -arch=win32 ?close(a)ifstream@@QAEXXZ(ptr) msvcirt.?close(a)ifstream@@QAEXXZ
@ cdecl -arch=win64 ?close(a)ifstream@@QEAAXXZ(ptr) msvcirt.?close(a)ifstream@@QEAAXXZ
-@ stub -arch=win32 ?close(a)ofstream@@QAEXXZ
-@ stub -arch=win64 ?close(a)ofstream@@QEAAXXZ
+@ thiscall -arch=win32 ?close(a)ofstream@@QAEXXZ(ptr) msvcirt.?close(a)ofstream@@QAEXXZ
+@ cdecl -arch=win64 ?close(a)ofstream@@QEAAXXZ(ptr) msvcirt.?close(a)ofstream@@QEAAXXZ
@ cdecl -arch=win32 ?clrlock(a)ios@@QAAXXZ(ptr) msvcirt.?clrlock(a)ios@@QAAXXZ
@ cdecl -arch=win64 ?clrlock(a)ios@@QEAAXXZ(ptr) msvcirt.?clrlock(a)ios@@QEAAXXZ
@ thiscall -arch=win32 ?clrlock(a)streambuf@@QAEXXZ(ptr) msvcirt.?clrlock(a)streambuf@@QAEXXZ
@@ -527,8 +527,8 @@
@ stub -arch=win64 ?fd(a)fstream@@QEBAHXZ
@ thiscall -arch=win32 ?fd(a)ifstream@@QBEHXZ(ptr) msvcirt.?fd(a)ifstream@@QBEHXZ
@ cdecl -arch=win64 ?fd(a)ifstream@@QEBAHXZ(ptr) msvcirt.?fd(a)ifstream@@QEBAHXZ
-@ stub -arch=win32 ?fd(a)ofstream@@QBEHXZ
-@ stub -arch=win64 ?fd(a)ofstream@@QEBAHXZ
+@ thiscall -arch=win32 ?fd(a)ofstream@@QBEHXZ(ptr) msvcirt.?fd(a)ofstream@@QBEHXZ
+@ cdecl -arch=win64 ?fd(a)ofstream@@QEBAHXZ(ptr) msvcirt.?fd(a)ofstream@@QEBAHXZ
@ thiscall -arch=win32 ?fill(a)ios@@QAEDD(a)Z(ptr long) msvcirt.?fill(a)ios@@QAEDD(a)Z
@ cdecl -arch=win64 ?fill(a)ios@@QEAADD(a)Z(ptr long) msvcirt.?fill(a)ios@@QEAADD(a)Z
@ thiscall -arch=win32 ?fill(a)ios@@QBEDXZ(ptr) msvcirt.?fill(a)ios@@QBEDXZ
@@ -596,8 +596,8 @@
@ stub -arch=win64 ?is_open(a)fstream@@QEBAHXZ
@ thiscall -arch=win32 ?is_open(a)ifstream@@QBEHXZ(ptr) msvcirt.?is_open(a)ifstream@@QBEHXZ
@ cdecl -arch=win64 ?is_open(a)ifstream@@QEBAHXZ(ptr) msvcirt.?is_open(a)ifstream@@QEBAHXZ
-@ stub -arch=win32 ?is_open(a)ofstream@@QBEHXZ
-@ stub -arch=win64 ?is_open(a)ofstream@@QEBAHXZ
+@ thiscall -arch=win32 ?is_open(a)ofstream@@QBEHXZ(ptr) msvcirt.?is_open(a)ofstream@@QBEHXZ
+@ cdecl -arch=win64 ?is_open(a)ofstream@@QEBAHXZ(ptr) msvcirt.?is_open(a)ofstream@@QEBAHXZ
@ thiscall -arch=win32 ?isfx(a)istream@@QAEXXZ(ptr) msvcirt.?isfx(a)istream@@QAEXXZ
@ cdecl -arch=win64 ?isfx(a)istream@@QEAAXXZ(ptr) msvcirt.?isfx(a)istream@@QEAAXXZ
@ thiscall -arch=win32 ?iword(a)ios@@QBEAAJH(a)Z(ptr long) msvcirt.?iword(a)ios@@QBEAAJH(a)Z
@@ -623,8 +623,8 @@
@ stub -arch=win64 ?open(a)fstream@@QEAAXPEBDHH(a)Z
@ thiscall -arch=win32 ?open(a)ifstream@@QAEXPBDHH(a)Z(ptr str long long) msvcirt.?open(a)ifstream@@QAEXPBDHH(a)Z
@ cdecl -arch=win64 ?open(a)ifstream@@QEAAXPEBDHH(a)Z(ptr str long long) msvcirt.?open(a)ifstream@@QEAAXPEBDHH(a)Z
-@ stub -arch=win32 ?open(a)ofstream@@QAEXPBDHH(a)Z
-@ stub -arch=win64 ?open(a)ofstream@@QEAAXPEBDHH(a)Z
+@ thiscall -arch=win32 ?open(a)ofstream@@QAEXPBDHH(a)Z(ptr str long long) msvcirt.?open(a)ofstream@@QAEXPBDHH(a)Z
+@ cdecl -arch=win64 ?open(a)ofstream@@QEAAXPEBDHH(a)Z(ptr str long long) msvcirt.?open(a)ofstream@@QEAAXPEBDHH(a)Z
@ extern ?openprot(a)filebuf@@2HB msvcirt.?openprot(a)filebuf@@2HB
@ thiscall -arch=win32 ?opfx(a)ostream@@QAEHXZ(ptr) msvcirt.?opfx(a)ostream@@QAEHXZ
@ cdecl -arch=win64 ?opfx(a)ostream@@QEAAHXZ(ptr) msvcirt.?opfx(a)ostream@@QEAAHXZ
@@ -678,8 +678,8 @@
@ cdecl -arch=win64 ?rdbuf(a)ios@@QEBAPEAVstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)ios@@QEBAPEAVstreambuf@@XZ
@ thiscall -arch=win32 ?rdbuf(a)istrstream@@QBEPAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)istrstream@@QBEPAVstrstreambuf@@XZ
@ cdecl -arch=win64 ?rdbuf(a)istrstream@@QEBAPEAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)istrstream@@QEBAPEAVstrstreambuf@@XZ
-@ stub -arch=win32 ?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ
-@ stub -arch=win64 ?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ
+@ thiscall -arch=win32 ?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ(ptr) msvcirt.?rdbuf(a)ofstream@@QBEPAVfilebuf@@XZ
+@ cdecl -arch=win64 ?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ(ptr) msvcirt.?rdbuf(a)ofstream@@QEBAPEAVfilebuf@@XZ
@ thiscall -arch=win32 ?rdbuf(a)ostrstream@@QBEPAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)ostrstream@@QBEPAVstrstreambuf@@XZ
@ cdecl -arch=win64 ?rdbuf(a)ostrstream@@QEBAPEAVstrstreambuf@@XZ(ptr) msvcirt.?rdbuf(a)ostrstream@@QEBAPEAVstrstreambuf@@XZ
@ thiscall -arch=win32 ?rdbuf(a)stdiostream@@QBEPAVstdiobuf@@XZ(ptr) msvcirt.?rdbuf(a)stdiostream@@QBEPAVstdiobuf@@XZ
@@ -725,8 +725,8 @@
@ stub -arch=win64 ?setbuf(a)fstream@@QEAAPEAVstreambuf@@PEADH(a)Z
@ thiscall -arch=win32 ?setbuf(a)ifstream@@QAEPAVstreambuf@@PADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ifstream@@QAEPAVstreambuf@@PADH(a)Z
@ cdecl -arch=win64 ?setbuf(a)ifstream@@QEAAPEAVstreambuf@@PEADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ifstream@@QEAAPEAVstreambuf@@PEADH(a)Z
-@ stub -arch=win32 ?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z
-@ stub -arch=win64 ?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z
+@ thiscall -arch=win32 ?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ofstream@@QAEPAVstreambuf@@PADH(a)Z
+@ cdecl -arch=win64 ?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)ofstream@@QEAAPEAVstreambuf@@PEADH(a)Z
@ thiscall -arch=win32 ?setbuf(a)streambuf@@UAEPAV1(a)PADH@Z(ptr ptr long) msvcirt.?setbuf(a)streambuf@@UAEPAV1(a)PADH@Z
@ cdecl -arch=win64 ?setbuf(a)streambuf@@UEAAPEAV1(a)PEADH@Z(ptr ptr long) msvcirt.?setbuf(a)streambuf@@UEAAPEAV1(a)PEADH@Z
@ thiscall -arch=win32 ?setbuf(a)strstreambuf@@UAEPAVstreambuf@@PADH(a)Z(ptr ptr long) msvcirt.?setbuf(a)strstreambuf@@UAEPAVstreambuf@@PADH(a)Z
@@ -747,8 +747,8 @@
@ stub -arch=win64 ?setmode(a)fstream@@QEAAHH(a)Z
@ thiscall -arch=win32 ?setmode(a)ifstream@@QAEHH(a)Z(ptr long) msvcirt.?setmode(a)ifstream@@QAEHH(a)Z
@ cdecl -arch=win64 ?setmode(a)ifstream@@QEAAHH(a)Z(ptr long) msvcirt.?setmode(a)ifstream@@QEAAHH(a)Z
-@ stub -arch=win32 ?setmode(a)ofstream@@QAEHH(a)Z
-@ stub -arch=win64 ?setmode(a)ofstream@@QEAAHH(a)Z
+@ thiscall -arch=win32 ?setmode(a)ofstream@@QAEHH(a)Z(ptr long) msvcirt.?setmode(a)ofstream@@QAEHH(a)Z
+@ cdecl -arch=win64 ?setmode(a)ofstream@@QEAAHH(a)Z(ptr long) msvcirt.?setmode(a)ofstream@@QEAAHH(a)Z
@ thiscall -arch=win32 ?setp(a)streambuf@@IAEXPAD0(a)Z(ptr ptr ptr) msvcirt.?setp(a)streambuf@@IAEXPAD0(a)Z
@ cdecl -arch=win64 ?setp(a)streambuf@@IEAAXPEAD0(a)Z(ptr ptr ptr) msvcirt.?setp(a)streambuf@@IEAAXPEAD0(a)Z
@ thiscall -arch=win32 ?setrwbuf(a)stdiobuf@@QAEHHH(a)Z(ptr long long) msvcirt.?setrwbuf(a)stdiobuf@@QAEHHH(a)Z
--
2.28.0
2
1
[PATCH vkd3d v2] vkd3d-shader: Separate the allocated and used mask in struct vkd3d_shader_signature_element.
by Zebediah Figura Sept. 18, 2020
by Zebediah Figura Sept. 18, 2020
Sept. 18, 2020
From: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
include/vkd3d_shader.h | 9 ++++++++-
libs/vkd3d-shader/dxbc.c | 18 +++++++++++++++---
libs/vkd3d-shader/spirv.c | 22 +++++++++++-----------
3 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h
index ed6ac44..532b816 100644
--- a/include/vkd3d_shader.h
+++ b/include/vkd3d_shader.h
@@ -1125,8 +1125,15 @@ struct vkd3d_shader_signature_element
enum vkd3d_shader_component_type component_type;
/** Register index. */
unsigned int register_index;
- /** Register mask. */
+ /** Mask of the register components allocated to this varying. */
unsigned int mask;
+ /**
+ * Subset of \ref mask which the shader reads from or writes to. Unlike
+ * Direct3D shader bytecode, the mask for output and tessellation signatures
+ * is not inverted, i.e. bits set in this field denote components which are
+ * written to.
+ */
+ unsigned int used_mask;
/** Minimum interpolation precision. */
enum vkd3d_shader_minimum_precision min_precision;
};
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c
index a62974a..398cd9f 100644
--- a/libs/vkd3d-shader/dxbc.c
+++ b/libs/vkd3d-shader/dxbc.c
@@ -2139,7 +2139,7 @@ static int shader_parse_signature(DWORD tag, const char *data, DWORD data_size,
for (i = 0; i < count; ++i)
{
- DWORD name_offset;
+ DWORD name_offset, mask;
if (has_stream_index)
read_dword(&ptr, &e[i].stream_index);
@@ -2157,7 +2157,19 @@ static int shader_parse_signature(DWORD tag, const char *data, DWORD data_size,
read_dword(&ptr, &e[i].sysval_semantic);
read_dword(&ptr, &e[i].component_type);
read_dword(&ptr, &e[i].register_index);
- read_dword(&ptr, &e[i].mask);
+ read_dword(&ptr, &mask);
+ e[i].mask = mask & 0xff;
+ e[i].used_mask = (mask >> 8) & 0xff;
+ switch (tag)
+ {
+ case TAG_OSGN:
+ case TAG_OSG1:
+ case TAG_OSG5:
+ case TAG_PCSG:
+ case TAG_PSG1:
+ e[i].used_mask = e[i].mask & ~e[i].used_mask;
+ break;
+ }
if (has_min_precision)
read_dword(&ptr, &e[i].min_precision);
@@ -2167,7 +2179,7 @@ static int shader_parse_signature(DWORD tag, const char *data, DWORD data_size,
TRACE("Stream: %u, semantic: %s, semantic idx: %u, sysval_semantic %#x, "
"type %u, register idx: %u, use_mask %#x, input_mask %#x, precision %u.\n",
e[i].stream_index, debugstr_a(e[i].semantic_name), e[i].semantic_index, e[i].sysval_semantic,
- e[i].component_type, e[i].register_index, (e[i].mask >> 8) & 0xff, e[i].mask & 0xff, e[i].min_precision);
+ e[i].component_type, e[i].register_index, e[i].used_mask, e[i].mask, e[i].min_precision);
}
s->elements = e;
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index ec6987b..fa0d4e0 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -4139,7 +4139,7 @@ static bool needs_private_io_variable(const struct vkd3d_shader_signature *signa
if (current->register_index != reg_idx)
continue;
- write_mask |= current->mask & 0xff;
+ write_mask |= current->mask;
++count;
if (current->sysval_semantic)
@@ -4216,7 +4216,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
builtin = get_spirv_builtin_for_sysval(compiler, sysval);
- write_mask = signature_element->mask & 0xff;
+ write_mask = signature_element->mask;
component_count = vkd3d_write_mask_component_count(dst->write_mask);
if (builtin)
@@ -4228,8 +4228,8 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
else
{
component_type = signature_element->component_type;
- input_component_count = vkd3d_write_mask_component_count(signature_element->mask & 0xff);
- component_idx = vkd3d_write_mask_get_component_idx(signature_element->mask & 0xff);
+ input_component_count = vkd3d_write_mask_component_count(signature_element->mask);
+ component_idx = vkd3d_write_mask_get_component_idx(signature_element->mask);
}
if ((use_private_var = builtin && builtin->fixup_pfn))
@@ -4657,10 +4657,10 @@ static void vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *compiler
builtin = vkd3d_get_spirv_builtin(compiler, dst->reg.type, sysval);
- write_mask = signature_element->mask & 0xff;
+ write_mask = signature_element->mask;
component_idx = vkd3d_write_mask_get_component_idx(dst->write_mask);
- output_component_count = vkd3d_write_mask_component_count(signature_element->mask & 0xff);
+ output_component_count = vkd3d_write_mask_component_count(signature_element->mask);
if (builtin)
{
component_type = builtin->component_type;
@@ -4833,9 +4833,9 @@ static void vkd3d_dxbc_compiler_emit_store_shader_output(struct vkd3d_dxbc_compi
unsigned int i, index, array_idx;
uint32_t output_id;
- dst_write_mask = output->mask & 0xff;
+ dst_write_mask = output->mask;
write_mask &= dst_write_mask;
- use_mask = (output->mask >> 8) & 0xff;
+ use_mask = output->used_mask;
if (!write_mask)
return;
@@ -4847,7 +4847,7 @@ static void vkd3d_dxbc_compiler_emit_store_shader_output(struct vkd3d_dxbc_compi
}
swizzle = get_shader_output_swizzle(compiler, output->register_index);
- uninit_mask = dst_write_mask & use_mask;
+ uninit_mask = dst_write_mask & ~use_mask;
if (uninit_mask)
{
/* Set values to 0 for not initialized shader output components. */
@@ -6180,7 +6180,7 @@ static void vkd3d_dxbc_compiler_emit_default_control_point_phase(struct vkd3d_dx
const struct vkd3d_shader_signature_element *output = &output_signature->elements[i];
const struct vkd3d_shader_signature_element *input = &input_signature->elements[i];
- assert((input->mask & 0xff) == (output->mask & 0xff));
+ assert(input->mask == output->mask);
assert(input->component_type == output->component_type);
if ((input_builtin = get_spirv_builtin_for_sysval(compiler, vkd3d_siv_from_sysval(input->sysval_semantic))))
@@ -6191,7 +6191,7 @@ static void vkd3d_dxbc_compiler_emit_default_control_point_phase(struct vkd3d_dx
else
{
component_type = input->component_type;
- component_count = vkd3d_write_mask_component_count(input->mask & 0xff);
+ component_count = vkd3d_write_mask_component_count(input->mask);
}
if (input_builtin)
--
2.28.0
2
1