From d534e1f3dc2322bd25dc9d14bee696ead2bea2ea Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Fri, 5 Oct 2012 14:54:17 +0200 Subject: [PATCH] msvcp60: Added basic_filebuf::open implementation. --- dlls/msvcp60/ios.c | 104 ++++++++++++++++++++++++++++++++++++++ dlls/msvcp60/msvcp60.spec | 16 +++--- 2 files changed, 112 insertions(+), 8 deletions(-) diff --git a/dlls/msvcp60/ios.c b/dlls/msvcp60/ios.c index cf3620a516d..8d7381a60a9 100644 --- a/dlls/msvcp60/ios.c +++ b/dlls/msvcp60/ios.c @@ -2491,6 +2491,58 @@ FILE* __cdecl ___Fiopen(const char *name, int mode) return _Fiopen(name, mode, _SH_DENYNO); } +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WHH@Z */ +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WHH@Z */ +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGHH@Z */ +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGHH@Z */ +static basic_filebuf_char* basic_filebuf_char_open_wchar(basic_filebuf_char *this, const wchar_t *name, int mode, int prot) +{ + FILE *f = NULL; + + TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot); + + if(basic_filebuf_char_is_open(this)) + return NULL; + + if(!(f = _Fiopen_wchar(name, mode, prot))) + return NULL; + + basic_filebuf_char__Init(this, f, INITFL_open); + basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(this->base.loc)); + return this; +} + +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDHH@Z */ +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDHH@Z */ +static basic_filebuf_char* basic_filebuf_char_open(basic_filebuf_char *this, const char *name, int mode, int prot) +{ + wchar_t nameW[FILENAME_MAX]; + + TRACE("(%p %s %d %d)\n", this, name, mode, prot); + + if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0) + return NULL; + return basic_filebuf_char_open_wchar(this, nameW, mode, prot); +} + +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDF@Z */ +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDF@Z */ +DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_mode_old, 12) +basic_filebuf_char* __thiscall basic_filebuf_char_open_mode_old(basic_filebuf_char *this, const char *name, short mode) +{ + TRACE("(%p %p %d)\n", this, name, mode); + return basic_filebuf_char_open(this, name, mode, _SH_DENYNO); +} + +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDH@Z */ +/* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDH@Z */ +DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_mode, 12) +basic_filebuf_char* __thiscall basic_filebuf_char_open_mode(basic_filebuf_char *this, const char *name, int mode) +{ + TRACE("(%p %p %d)\n", this, name, mode); + return basic_filebuf_char_open(this, name, mode, _SH_DENYNO); +} + /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */ /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */ DEFINE_THISCALL_WRAPPER(basic_filebuf_char_overflow, 8) @@ -2955,6 +3007,58 @@ MSVCP_bool __thiscall basic_filebuf_wchar_is_open(const basic_filebuf_wchar *thi return this->file != NULL; } +/* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WHH@Z */ +/* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WHH@Z */ +/* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGHH@Z */ +/* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGHH@Z */ +static basic_filebuf_wchar* basic_filebuf_wchar_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot) +{ + FILE *f = NULL; + + TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot); + + if(basic_filebuf_wchar_is_open(this)) + return NULL; + + if(!(f = _Fiopen_wchar(name, mode, prot))) + return NULL; + + basic_filebuf_wchar__Init(this, f, INITFL_open); + basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(this->base.loc)); + return this; +} + +/* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDHH@Z */ +/* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDHH@Z */ +static basic_filebuf_wchar* basic_filebuf_wchar_open(basic_filebuf_wchar *this, const char *name, int mode, int prot) +{ + wchar_t nameW[FILENAME_MAX]; + + TRACE("(%p %s %d %d)\n", this, name, mode, prot); + + if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0) + return NULL; + return basic_filebuf_wchar_open_wchar(this, nameW, mode, prot); +} + +/* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDF@Z */ +/* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDF@Z */ +DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_mode_old, 12) +basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_mode_old(basic_filebuf_wchar *this, const char *name, short mode) +{ + TRACE("(%p %p %d)\n", this, name, mode); + return basic_filebuf_wchar_open(this, name, mode, _SH_DENYNO); +} + +/* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDH@Z */ +/* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDH@Z */ +DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_mode, 12) +basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_mode(basic_filebuf_wchar *this, const char *name, int mode) +{ + TRACE("(%p %p %d)\n", this, name, mode); + return basic_filebuf_wchar_open(this, name, mode, _SH_DENYNO); +} + /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */ /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */ /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */ diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec index e6bf596c63f..9301a6fd5d3 100644 --- a/dlls/msvcp60/msvcp60.spec +++ b/dlls/msvcp60/msvcp60.spec @@ -3498,14 +3498,14 @@ @ extern -arch=win64 ?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2_KB basic_string_char_npos @ extern -arch=win32 ?npos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@2IB basic_string_wchar_npos @ extern -arch=win64 ?npos@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@2_KB basic_string_wchar_npos -@ stub -arch=win32 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDF@Z -@ stub -arch=win64 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDF@Z -@ stub -arch=win32 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDH@Z -@ stub -arch=win64 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDH@Z -@ stub -arch=win32 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDF@Z -@ stub -arch=win64 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDF@Z -@ stub -arch=win32 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDH@Z -@ stub -arch=win64 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDH@Z +@ thiscall -arch=win32 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDF@Z(ptr str long) basic_filebuf_char_open_mode_old +@ cdecl -arch=win64 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDF@Z(ptr str long) basic_filebuf_char_open_mode_old +@ thiscall -arch=win32 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDH@Z(ptr str long) basic_filebuf_char_open_mode +@ cdecl -arch=win64 ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDH@Z(ptr str long) basic_filebuf_char_open_mode +@ thiscall -arch=win32 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDF@Z(ptr str long) basic_filebuf_wchar_open_mode_old +@ cdecl -arch=win64 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDF@Z(ptr str long) basic_filebuf_wchar_open_mode_old +@ thiscall -arch=win32 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDH@Z(ptr str long) basic_filebuf_wchar_open_mode +@ cdecl -arch=win64 ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDH@Z(ptr str long) basic_filebuf_wchar_open_mode @ stub -arch=win32 ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDF@Z @ stub -arch=win64 ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDF@Z @ stub -arch=win32 ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDH@Z