Ignore:
Timestamp:
Sep 23, 1999, 11:38:06 AM (26 years ago)
Author:
sandervl
Message:

Jens Weissner's changes to crtdll + others

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/crtdll/crtdll.cpp

    r973 r1012  
    1 /* $Id: crtdll.cpp,v 1.4 1999-09-18 15:58:34 sandervl Exp $ */
     1/* $Id: crtdll.cpp,v 1.5 1999-09-23 09:38:03 sandervl Exp $ */
    22
    33/*
     
    3838#include <direct.h>
    3939#include <malloc.h>
     40#include <drive.h>
     41#include <fcntl.h>
    4042#include <sys\utime.h>
    4143#include <sys\stat.h>
     
    4547
    4648
    47 // DEFAULT_DEBUG_CHANNEL(crtdll)
    48 
    49 INT CDECL CRTDLL_vfprintf( CRTDLL_FILE *file, LPSTR format, va_list args );
     49DEFAULT_DEBUG_CHANNEL(crtdll)
    5050
    5151
     
    6363}
    6464
     65
     66/*********************************************************************
     67 *                  new           (CRTDLL.001)
     68 */
     69VOID* CDECL CRTDLL_new(DWORD size)
     70{
     71    dprintf(("CRTDLL: ??2@YAPAXI@Z\n"));
     72    VOID* result;
     73    if(!(result = HeapAlloc(GetProcessHeap(),0,size)) && new_handler)
     74        (*new_handler)();
     75    return result;
     76}
     77
     78
     79/*********************************************************************
     80 *                  delete       (CRTDLL.002)
     81 */
     82VOID CDECL CRTDLL_delete(VOID* ptr)
     83{
     84    dprintf(("CRTDLL: ??3@YAXPAX@Z\n"));
     85    HeapFree(GetProcessHeap(),0,ptr);
     86}
     87
     88
     89/*********************************************************************
     90 *                  set_new_handler(CRTDLL.003)
     91 */
     92new_handler_type CDECL CRTDLL_set_new_handler(new_handler_type func)
     93{
     94    dprintf(("CRTDLL: ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z\n"));
     95    new_handler_type old_handler = new_handler;
     96    new_handler = func;
     97    return old_handler;
     98}
     99
     100
    65101/*********************************************************************
    66102 *                  _XcptFilter    (CRTDLL.21)
     
    69105INT CDECL CRTDLL__XcptFilter(DWORD ret)
    70106{
    71         dprintf(("CRTDLL: XcptFilter\n"));
    72 
    73         return 0;
     107  dprintf(("CRTDLL: XcptFilter not implemented.\n"));
     108  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     109  return FALSE;
    74110}
    75111
     
    149185
    150186/*********************************************************************
     187 *                  __dllonexit           (CRTDLL.25)
     188 */
     189VOID CDECL CRTDLL___dllonexit ()
     190{       
     191        dprintf(("__dllonexit not implemented.\n"));
     192}
     193
     194
     195/*********************************************************************
    151196 *           CRTDLL___isascii   (CRTDLL.28)
    152197 */
    153198int CDECL CRTDLL___isascii(int i)
    154199{
    155   dprintf(("CRTDLL: __isascii\n"));
     200  dprintf(("CRTDLL: __isascii not implemented.\n"));
    156201  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    157202  return FALSE;
     
    164209int CDECL CRTDLL___iscsym(int i)
    165210{
    166   dprintf(("CRTDLL: __iscsym\n"));
     211  dprintf(("CRTDLL: __iscsym not implemented.\n"));
    167212  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    168213  return FALSE;
     
    175220int CDECL CRTDLL___iscsymf(int i)
    176221{
    177   dprintf(("CRTDLL: __iscsymf\n"));
     222  dprintf(("CRTDLL: __iscsymf not implemented.\n"));
    178223  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    179224  return FALSE;
     
    187232INT CDECL CRTDLL___mb_cur_max_dll(DWORD ret)
    188233{
    189         dprintf(("CRTDLL: __mb_cur_max_dll\n"));
    190 
    191         return 0;
     234  dprintf(("CRTDLL: __mb_cur_max_dll not implemented.\n"));
     235  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     236  return FALSE;
    192237}
    193238
     
    198243unsigned long CDECL CRTDLL___threadhandle( void )
    199244{
    200   dprintf(("CRTDLL: __threadhandle\n"));
     245  dprintf(("CRTDLL: __threadhandle  not implemented.\n"));
    201246  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    202247  return FALSE;
     
    209254int * CDECL CRTDLL___threadid(void)
    210255{
    211   dprintf(("CRTDLL: __threadid\n"));
     256  dprintf(("CRTDLL: __threadid  not implemented.\n"));
    212257  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    213258  return FALSE;
     
    220265int CDECL CRTDLL__abnormal_termination(void)
    221266{
    222   dprintf(("CRTDLL: _abnormal_termination\n"));
     267  dprintf(("CRTDLL: _abnormal_termination  not implemented.\n"));
    223268  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    224269  return FALSE;
     
    242287INT CDECL CRTDLL__aexit_rtn_dll(DWORD ret)
    243288{
    244         dprintf(("CRTDLL: _aexit_rtn_dll\n"));
    245 
    246         return 0;
     289  dprintf(("CRTDLL: _aexit_rtn_dll not implemented.\n"));
     290  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     291  return FALSE;
    247292}
    248293
     
    254299INT CDECL CRTDLL__amsg_exit(DWORD ret)
    255300{
    256         dprintf(("CRTDLL: _amsg_exit\n"));
    257 
     301        dprintf(("CRTDLL: _amsg_exit not implemented.\n"));
    258302        return 0;
    259303}
     
    276320                unsigned stack_size, void *arglist )
    277321{
    278   dprintf(("CRTDLL: _beginthread\n"));
    279   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    280   return FALSE;
     322  dprintf(("CRTDLL: _beginthread not implemented.\n"));
     323  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     324  return FALSE;
     325}
     326
     327
     328/*********************************************************************
     329 *                  _c_exit          (CRTDLL.47)
     330 *
     331 */
     332void CDECL CRTDLL__c_exit(INT ret)
     333{
     334        dprintf(("_c_exit(%d)\n",ret));
     335        ExitProcess(ret);
     336}
     337
     338
     339/*********************************************************************
     340 *                  _cexit          (CRTDLL.49)
     341 *
     342 */
     343void CDECL CRTDLL__cexit(INT ret)
     344{
     345        dprintf(("_cexit(%d)\n",ret));
     346        ExitProcess(ret);
    281347}
    282348
     
    295361
    296362/*********************************************************************
     363 *                  _chdrive           (CRTDLL.52)
     364 *
     365 *  newdir      [I] drive to change to, A=1
     366 *
     367 */
     368BOOL CDECL CRTDLL__chdrive(INT newdrive)
     369{
     370        /* FIXME: generates errnos */
     371        dprintf(("CRTDLL: _chdrive\n"));
     372        return DRIVE_SetCurrentDrive(newdrive-1);
     373}
     374
     375
     376/*********************************************************************
    297377 *           CRTDLL__close   (CRTDLL.57)
    298378 */
     
    381461{
    382462        dprintf(("CRTDLL: _except_handler2\n"));
    383 
    384463        return 0;
    385464}
     
    391470VOID CDECL CRTDLL__exit(DWORD ret)
    392471{
    393         dprintf(("CRTDLL: exit\n"));
     472        dprintf(("CRTDLL: _exit\n"));
    394473        ExitProcess(ret);
    395474}
     
    401480void * CDECL CRTDLL__expand( void *ptr, size_t size )
    402481{
    403   dprintf(("CRTDLL: _expand\n"));
     482  dprintf(("CRTDLL: _expand not implemented.\n"));
    404483  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    405484  return FALSE;
     
    463542wint_t CDECL CRTDLL__fgetwchar( void *i )
    464543{
    465   dprintf(("CRTDLL: _fgetwchar\n"));
     544  dprintf(("CRTDLL: _fgetwchar not implemented.\n"));
    466545  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    467546  return FALSE;
     
    474553int CDECL CRTDLL__findclose( long handle )
    475554{
    476   dprintf(("CRTDLL: _findclose\n"));
     555  dprintf(("CRTDLL: _findclose not implemented.\n"));
    477556  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    478557  return FALSE;
     
    485564DWORD CDECL CRTDLL__findfirst(LPCSTR fname,  struct find_t * x2)
    486565{
    487   dprintf(("CRTDLL: _findfirst\n"));
     566  dprintf(("CRTDLL: _findfirst not implemented.\n"));
    488567  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    489568  return FALSE;
     
    496575INT CDECL CRTDLL__findnext(DWORD hand, struct find_t * x2)
    497576{
    498   dprintf(("CRTDLL: _findnext\n"));
     577  dprintf(("CRTDLL: _findnext not implemented.\n"));
    499578  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    500579  return FALSE;
     
    507586INT CDECL CRTDLL__finite(double x)
    508587{
    509   dprintf(("CRTDLL: _finite\n"));
     588  dprintf(("CRTDLL: _finite not implemented.\n"));
    510589  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    511590  return FALSE;
     
    518597INT CDECL CRTDLL__fpreset(void)
    519598{
    520   dprintf(("CRTDLL: _fpreset\n"));
     599  dprintf(("CRTDLL: _fpreset not implemented.\n"));
    521600  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    522601  return FALSE;
     
    539618wint_t CDECL CRTDLL__fputwchar( wint_t )
    540619{
    541   dprintf(("CRTDLL: _fputwchar\n"));
     620  dprintf(("CRTDLL: _fputwchar not implemented.\n"));
    542621  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    543622  return FALSE;
     
    550629FILE * CDECL CRTDLL__fsopen( const char *filename, const char *mode, int shflag )
    551630{
    552   dprintf(("CRTDLL: _fsopen\n"));
     631  dprintf(("CRTDLL: _fsopen not implemented.\n"));
    553632  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    554633  return FALSE;
     
    561640int CDECL CRTDLL__fstat(int file, struct stat* buf)
    562641{
    563   dprintf(("CRTDLL: _fstat\n"));
     642  dprintf(("CRTDLL: _fstat not implemented.\n"));
    564643  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    565644  return FALSE;
     
    572651int CDECL CRTDLL__ftime( struct timeb *timeptr )
    573652{
    574   dprintf(("CRTDLL: _ftime\n"));
     653  dprintf(("CRTDLL: _ftime not implemented.\n"));
    575654  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    576655  return FALSE;
     
    603682long CDECL CRTDLL__get_osfhandle( int posixhandle )
    604683{
    605   dprintf(("CRTDLL: _gcvt\n"));
     684  dprintf(("CRTDLL: _gcvt not implemented.\n"));
    606685  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    607686  return FALSE;
     
    654733unsigned CDECL CRTDLL__getdiskfree( unsigned drive, struct _diskfree_t *diskspace)
    655734{
    656   dprintf(("CRTDLL: _getdiskfree\n"));
     735  dprintf(("CRTDLL: _getdiskfree not implemented.\n"));
    657736  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    658737  return FALSE;
     
    666745{
    667746  dprintf(("CRTDLL: _getdrive\n"));
    668   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    669   return FALSE;
     747  return DRIVE_GetCurrentDrive() + 1;
    670748}
    671749
     
    676754int CDECL CRTDLL__getw( FILE *fp )
    677755{
    678   dprintf(("CRTDLL: _getw\n"));
     756  dprintf(("CRTDLL: _getw not implemented.\n"));
    679757  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    680758  return FALSE;
     
    727805int CDECL CRTDLL__heapwalk( struct _heapinfo *entry )
    728806{
    729   dprintf(("CRTDLL: _heapwalk\n"));
     807  dprintf(("CRTDLL: _heapwalk not implemented.\n"));
    730808  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    731809  return FALSE;
     
    747825        }
    748826        return 0;
     827}
     828
     829
     830/*********************************************************************
     831 *                  _isatty       (CRTDLL.137)
     832 */
     833BOOL CDECL CRTDLL__isatty(DWORD x)
     834{
     835   dprintf(("(%ld)\n",x));
     836   return TRUE;
    749837}
    750838
     
    780868int CDECL CRTDLL__ismbbalnum( unsigned int ch )
    781869{
    782   dprintf(("CRTDLL: _ismbbalnum\n"));
     870  dprintf(("CRTDLL: _ismbbalnum not implemented.\n"));
    783871  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    784872  return FALSE;
     
    791879int CDECL CRTDLL__ismbbalpha( unsigned int ch )
    792880{
    793   dprintf(("CRTDLL: _ismbbalpha\n"));
     881  dprintf(("CRTDLL: _ismbbalpha not implemented.\n"));
    794882  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    795883  return FALSE;
     
    802890int CDECL CRTDLL__ismbbgraph( unsigned int ch )
    803891{
    804   dprintf(("CRTDLL: _ismbbgraph\n"));
     892  dprintf(("CRTDLL: _ismbbgraph not implemented.\n"));
    805893  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    806894  return FALSE;
     
    813901int CDECL CRTDLL__ismbbkalnum( unsigned int ch )
    814902{
    815   dprintf(("CRTDLL: _ismbbkalnum\n"));
     903  dprintf(("CRTDLL: _ismbbkalnum not implemented.\n"));
    816904  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    817905  return FALSE;
     
    824912int CDECL CRTDLL__ismbbkana( unsigned int ch )
    825913{
    826   dprintf(("CRTDLL: _ismbbkana\n"));
     914  dprintf(("CRTDLL: _ismbbkana not implemented.\n"));
    827915  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    828916  return FALSE;
     
    835923int CDECL CRTDLL__ismbbkpunct( unsigned int ch )
    836924{
    837   dprintf(("CRTDLL: _ismbbkpunct\n"));
     925  dprintf(("CRTDLL: _ismbbkpunct not implemented.\n"));
    838926  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    839927  return FALSE;
     
    846934int CDECL CRTDLL__ismbblead( unsigned int ch )
    847935{
    848   dprintf(("CRTDLL: _ismbblead\n"));
     936  dprintf(("CRTDLL: _ismbblead not implemented.\n"));
    849937  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    850938  return FALSE;
     
    857945int CDECL CRTDLL__ismbbprint( unsigned int ch )
    858946{
    859   dprintf(("CRTDLL: _ismbbprint\n"));
     947  dprintf(("CRTDLL: _ismbbprint not implemented.\n"));
    860948  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    861949  return FALSE;
     
    868956int CDECL CRTDLL__ismbbpunct( unsigned int ch )
    869957{
    870   dprintf(("CRTDLL: _ismbbpunct\n"));
     958  dprintf(("CRTDLL: _ismbbpunct not implemented.\n"));
    871959  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    872960  return FALSE;
     
    879967int CDECL CRTDLL__ismbbtrail( unsigned int ch )
    880968{
    881   dprintf(("CRTDLL: _ismbbtrail\n"));
     969  dprintf(("CRTDLL: _ismbbtrail not implemented.\n"));
    882970  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    883971  return FALSE;
     
    890978int CDECL CRTDLL__ismbcalpha( unsigned int ch )
    891979{
    892   dprintf(("CRTDLL: _ismbcalpha\n"));
     980  dprintf(("CRTDLL: _ismbcalpha not implemented.\n"));
    893981  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    894982  return FALSE;
     
    901989int CDECL CRTDLL__ismbcdigit( unsigned int ch )
    902990{
    903   dprintf(("CRTDLL: _ismbcdigit\n"));
     991  dprintf(("CRTDLL: _ismbcdigit not implemented.\n"));
    904992  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    905993  return FALSE;
     
    9121000int CDECL CRTDLL__ismbchira( unsigned int ch )
    9131001{
    914   dprintf(("CRTDLL: _ismbchira\n"));
     1002  dprintf(("CRTDLL: _ismbchira not implemented.\n"));
    9151003  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9161004  return FALSE;
     
    9231011int CDECL CRTDLL__ismbckata( unsigned int ch )
    9241012{
    925   dprintf(("CRTDLL: _ismbckata\n"));
     1013  dprintf(("CRTDLL: _ismbckata not implemented.\n"));
    9261014  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9271015  return FALSE;
     
    9331021int CDECL CRTDLL__ismbcl0( unsigned int ch )
    9341022{
    935   dprintf(("CRTDLL: _ismbcl0\n"));
     1023  dprintf(("CRTDLL: _ismbcl0 not implemented.\n"));
    9361024  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9371025  return FALSE;
     
    9441032int CDECL CRTDLL__ismbcl1( unsigned int ch )
    9451033{
    946   dprintf(("CRTDLL: _ismbcl1\n"));
     1034  dprintf(("CRTDLL: _ismbcl1 not implemented.\n"));
    9471035  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9481036  return FALSE;
     
    9551043int CDECL CRTDLL__ismbcl2( unsigned int ch )
    9561044{
    957   dprintf(("CRTDLL: _ismbcl2\n"));
     1045  dprintf(("CRTDLL: _ismbcl2 not implemented.\n"));
    9581046  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9591047  return FALSE;
     
    9661054int CDECL CRTDLL__ismbclegal( unsigned int ch )
    9671055{
    968   dprintf(("CRTDLL: _ismbclegal\n"));
     1056  dprintf(("CRTDLL: _ismbclegal not implemented.\n"));
    9691057  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9701058  return FALSE;
     
    9771065int CDECL CRTDLL__ismbclower( unsigned int ch )
    9781066{
    979   dprintf(("CRTDLL: _ismbclower\n"));
     1067  dprintf(("CRTDLL: _ismbclower not implemented.\n"));
    9801068  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9811069  return FALSE;
     
    9881076int CDECL CRTDLL__ismbcprint( unsigned int ch )
    9891077{
    990   dprintf(("CRTDLL: _ismbcprint\n"));
     1078  dprintf(("CRTDLL: _ismbcprint not implemented.\n"));
    9911079  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    9921080  return FALSE;
     
    9991087int CDECL CRTDLL__ismbcspace( unsigned int ch )
    10001088{
    1001   dprintf(("CRTDLL: _ismbcspace\n"));
     1089  dprintf(("CRTDLL: _ismbcspace not implemented.\n"));
    10021090  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    10031091  return FALSE;
     
    10101098int CDECL CRTDLL__ismbcsymbol( unsigned int ch )
    10111099{
    1012   dprintf(("CRTDLL: _ismbcsymbol\n"));
     1100  dprintf(("CRTDLL: _ismbcsymbol not implemented.\n"));
    10131101  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    10141102  return FALSE;
     
    10211109int CDECL CRTDLL__ismbcupper( unsigned int ch )
    10221110{
    1023   dprintf(("CRTDLL: _ismbcupper\n"));
     1111  dprintf(("CRTDLL: _ismbcupper not implemented.\n"));
    10241112  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    10251113  return FALSE;
     
    10411129int CDECL CRTDLL__locking(int handle,int mode,unsigned long nbyte)
    10421130{
    1043   dprintf(("CRTDLL: _locking\n"));
     1131  dprintf(("CRTDLL: _locking not implemented.\n"));
    10441132  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    10451133  return FALSE;
     
    10881176
    10891177
     1178#if (__IBMCPP__ > 300)
     1179#define exception _exception
     1180#endif
     1181
    10901182/*********************************************************************
    10911183 *                  _matherr    (CRTDLL.181)
     
    10971189}
    10981190
    1099 // unsigned int _mbbtombc( unsigned int __ch );
    1100 // unsigned int _mbctombb( unsigned int __ch );
     1191
     1192/*********************************************************************
     1193 *                  _mbbtombc        (CRTDLL.182)
     1194 */
     1195unsigned int CDECL CRTDLL__mbbtombc( unsigned int ch )
     1196{
     1197  dprintf(("CRTDLL: _mbbtombc\n"));
     1198  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1199  return FALSE;
     1200}
     1201
     1202
     1203/*********************************************************************
     1204 *                  _mbbtype        (CRTDLL.183)
     1205 */
     1206int CDECL CRTDLL__mbbtype( unsigned char s, int i )
     1207{
     1208  dprintf(("CRTDLL: _mbbtype not implemented.\n"));
     1209  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1210  return FALSE;
     1211}
     1212
     1213
     1214/*********************************************************************
     1215 *                  _mbccpy        (CRTDLL.184)
     1216 */
     1217void CDECL CRTDLL__mbccpy( unsigned char *dest, const unsigned char *ch )
     1218{
     1219  dprintf(("CRTDLL: _mbccpy not implemented.\n"));
     1220  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1221}
     1222
     1223
     1224/*********************************************************************
     1225 *                  _mbcjistojms     (CRTDLL.185)
     1226 */
     1227int CDECL CRTDLL__mbcjistojms( unsigned int ch )
     1228{
     1229  dprintf(("CRTDLL: _mbcjistojms not implemented.\n"));
     1230  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1231  return FALSE;
     1232}
     1233
     1234
     1235/*********************************************************************
     1236 *                  _mbcjmstojis     (CRTDLL.186)
     1237 */
     1238int CDECL CRTDLL__mbcjmstojis( unsigned int ch )
     1239{
     1240  dprintf(("CRTDLL: _mbcjmstojis not implemented.\n"));
     1241  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1242  return FALSE;
     1243}
     1244
     1245
     1246/*********************************************************************
     1247 *                  _mbclen    (CRTDLL.187)
     1248 */
     1249size_t CDECL CRTDLL__mbclen( const unsigned char *ch )
     1250{
     1251  dprintf(("CRTDLL: _mbclen not implemented.\n"));
     1252  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1253  return FALSE;
     1254}
     1255
     1256
     1257/*********************************************************************
     1258 *                  _mbctohira     (CRTDLL.188)
     1259 */
     1260int CDECL CRTDLL__mbctohira( unsigned int ch )
     1261{
     1262  dprintf(("CRTDLL: _mbctohira not implemented.\n"));
     1263  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1264  return FALSE;
     1265}
     1266
     1267
     1268/*********************************************************************
     1269 *                  _mbctokata     (CRTDLL.189)
     1270 */
     1271int CDECL CRTDLL__mbctokata( unsigned int ch )
     1272{
     1273  dprintf(("CRTDLL: _mbctokata not implemented.\n"));
     1274  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1275  return FALSE;
     1276}
     1277
     1278
     1279/*********************************************************************
     1280 *                  _mbctolower     (CRTDLL.190)
     1281 */
     1282unsigned int CDECL CRTDLL__mbctolower( unsigned int ch )
     1283{
     1284  dprintf(("CRTDLL: _mbctolower not implemented.\n"));
     1285  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1286  return FALSE;
     1287}
     1288
     1289
     1290/*********************************************************************
     1291 *                  _mbctombb        (CRTDLL.191)
     1292 */
     1293unsigned int CDECL CRTDLL__mbctombb( unsigned int ch )
     1294{
     1295  dprintf(("CRTDLL: _mbctombb not implemented.\n"));
     1296  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1297  return FALSE;
     1298}
     1299
     1300
     1301/*********************************************************************
     1302 *                  _mbctoupper     (CRTDLL.192)
     1303 */
     1304unsigned int CDECL CRTDLL__mbctoupper( unsigned int ch )
     1305{
     1306  dprintf(("CRTDLL: _mbctoupper not implemented.\n"));
     1307  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1308  return FALSE;
     1309}
     1310
     1311
     1312/*********************************************************************
     1313 *                  _mbsbtype     (CRTDLL.194)
     1314 */
     1315int CDECL CRTDLL__mbsbtype( const unsigned char *s1, int ch )
     1316{
     1317  dprintf(("CRTDLL: _mbsbtype not implemented.\n"));
     1318  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1319  return FALSE;
     1320}
     1321
     1322
     1323/*********************************************************************
     1324 *                  _mbscat       (CRTDLL.195)
     1325 */
     1326unsigned char * CDECL CRTDLL__mbscat( unsigned char *s1, const unsigned char *s2 )
     1327{
     1328  dprintf(("CRTDLL: _mbscat not implemented.\n"));
     1329  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1330  return FALSE;
     1331}
     1332
     1333
     1334/*********************************************************************
     1335 *                  _mbschr       (CRTDLL.196)
     1336 */
     1337unsigned char * CDECL CRTDLL__mbschr( const unsigned char *s, unsigned int ch )
     1338{
     1339  dprintf(("CRTDLL: _mbschr not implemented.\n"));
     1340  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1341  return FALSE;
     1342}
     1343
     1344
     1345/*********************************************************************
     1346 *                  _mbscmp       (CRTDLL.197)
     1347 */
     1348int CDECL CRTDLL__mbscmp( const unsigned char *s1, const unsigned char *s2 )
     1349{
     1350  dprintf(("CRTDLL: _mbscmp not implemented.\n"));
     1351  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1352  return FALSE;
     1353}
     1354
     1355
     1356/*********************************************************************
     1357 *                  _mbscpy       (CRTDLL.198)
     1358 */
     1359unsigned char * CDECL CRTDLL__mbscpy( unsigned char *s1, const unsigned char *s2 )
     1360{
     1361  dprintf(("CRTDLL: _mbscpy not implemented.\n"));
     1362  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1363  return FALSE;
     1364}
    11011365
    11021366
     
    11061370size_t CDECL CRTDLL__mbscspn( const unsigned char *s, const unsigned char *charset )
    11071371{
    1108   dprintf(("CRTDLL: _mbscspn\n"));
    1109   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1110   return FALSE;
    1111 }
    1112 
     1372  dprintf(("CRTDLL: _mbscspn not implemented.\n"));
     1373  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1374  return FALSE;
     1375}
     1376
     1377
     1378/*********************************************************************
     1379 *           CRTDLL__mbsdec    (CRTDLL.200)
     1380 */
     1381unsigned char * CDECL CRTDLL__mbsdec( const unsigned char *s, const unsigned char *ch )
     1382{
     1383  dprintf(("CRTDLL: _mbsdec not implemented.\n"));
     1384  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1385  return FALSE;
     1386}
     1387
     1388
     1389/*********************************************************************
     1390 *           CRTDLL__mbsdec    (CRTDLL.201)
     1391 */
     1392unsigned char * CDECL CRTDLL__mbsdup( unsigned char *src )
     1393{
     1394  dprintf(("CRTDLL: _mbsdup not implemented.\n"));
     1395  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     1396  return FALSE;
     1397}
     1398
     1399
     1400/*********************************************************************
     1401 *           CRTDLL__mbsicmp   (CRTDLL.202)
     1402 */
     1403int CDECL CRTDLL__mbsicmp( const unsigned char *x, const unsigned char *y )
     1404{
     1405  dprintf(("CRTDLL: _mbsicmp\n"));
     1406    do {
     1407        if (!*x)
     1408            return !!*y;
     1409        if (!*y)
     1410            return !!*x;
     1411        /* FIXME: MBCS handling... */
     1412        if (*x!=*y)
     1413            return 1;
     1414        x++;
     1415        y++;
     1416    } while (1);
     1417}
    11131418
    11141419
     
    11181423LPSTR CDECL CRTDLL__mbsinc( LPCSTR str )
    11191424{
     1425    dprintf(("CRTDLL: _mbsinc\n"));
    11201426    int len = mblen( str, MB_LEN_MAX );
    11211427    if (len < 1) len = 1;
     
    11291435INT CDECL CRTDLL__mbslen( LPCSTR str )
    11301436{
     1437    dprintf(("CRTDLL: _mbslen\n"));
    11311438    INT len, total = 0;
    11321439    while ((len = mblen( str, MB_LEN_MAX )) > 0)
     
    11401447
    11411448/*********************************************************************
    1142  *           CRTDLL__mbsdec    (CRTDLL.200)
    1143  */
    1144 unsigned char * CDECL CRTDLL__mbsdec( const unsigned char *s, const unsigned char *ch )
    1145 {
    1146   dprintf(("CRTDLL: _mbsdec\n"));
    1147   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1148   return FALSE;
    1149 }
    1150 
    1151 
    1152 /*********************************************************************
    1153  *           CRTDLL__mbsdec    (CRTDLL.201)
    1154  */
    1155 unsigned char * CDECL CRTDLL__mbsdup( unsigned char *src )
    1156 {
    1157   dprintf(("CRTDLL: _mbsdup\n"));
    1158   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1159   return FALSE;
    1160 }
    1161 
    1162 
    1163 /*********************************************************************
    1164  *           CRTDLL__mbsicmp   (CRTDLL.202)
    1165  */
    1166 int CDECL CRTDLL__mbsicmp( const unsigned char *s1, const unsigned char *s2 )
    1167 {
    1168   dprintf(("CRTDLL: _mbsicmp\n"));
    1169   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1170   return FALSE;
    1171 }
    1172 
    1173 
    1174 /*********************************************************************
    11751449 *           CRTDLL__mbslwr    (CRTDLL.205)
    11761450 */
    11771451unsigned char * CDECL CRTDLL__mbslwr( unsigned char *s )
    11781452{
    1179   dprintf(("CRTDLL: _mbslwr\n"));
     1453  dprintf(("CRTDLL: _mbslwr not implemented.\n"));
    11801454  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    11811455  return FALSE;
     
    11881462unsigned char * CDECL CRTDLL__mbsnbcat( unsigned char *s1, const unsigned char *s2, size_t n )
    11891463{
    1190   dprintf(("CRTDLL: _mbsnbcat\n"));
     1464  dprintf(("CRTDLL: _mbsnbcat not implemented.\n"));
    11911465  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    11921466  return FALSE;
     
    11991473int CDECL CRTDLL__mbsnbcmp( const unsigned char *s1, const unsigned char *s2, size_t n )
    12001474{
    1201   dprintf(("CRTDLL: _mbsnbcmp\n"));
     1475  dprintf(("CRTDLL: _mbsnbcmp not implemented.\n"));
    12021476  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12031477  return FALSE;
     
    12101484size_t CDECL CRTDLL__mbsnbcnt( const unsigned char *s, size_t n )
    12111485{
    1212   dprintf(("CRTDLL: _mbsnbcnt\n"));
     1486  dprintf(("CRTDLL: _mbsnbcnt not implemented.\n"));
    12131487  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12141488  return FALSE;
     
    12211495unsigned char * CDECL CRTDLL__mbsnbcpy( unsigned char *s1, const unsigned char *s2, size_t n )
    12221496{
    1223   dprintf(("CRTDLL: _mbsnbcpy\n"));
     1497  dprintf(("CRTDLL: _mbsnbcpy not implemented.\n"));
    12241498  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12251499  return FALSE;
     
    12321506int CDECL CRTDLL__mbsnbicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
    12331507{
    1234   dprintf(("CRTDLL: _mbsnbicmp\n"));
     1508  dprintf(("CRTDLL: _mbsnbicmp not implemented.\n"));
    12351509  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12361510  return FALSE;
     
    12431517unsigned char * CDECL CRTDLL__mbsnbset( unsigned char *s, unsigned int ch, size_t n )
    12441518{
    1245   dprintf(("CRTDLL: _mbsnbset\n"));
     1519  dprintf(("CRTDLL: _mbsnbset not implemented.\n"));
    12461520  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12471521  return FALSE;
     
    12541528unsigned char * CDECL CRTDLL__mbsncat( unsigned char *s1, const unsigned char *s2, size_t n )
    12551529{
    1256   dprintf(("CRTDLL: _mbsncat\n"));
     1530  dprintf(("CRTDLL: _mbsncat not implemented.\n"));
    12571531  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12581532  return FALSE;
     
    12651539size_t CDECL CRTDLL__mbsnccnt( const unsigned char *s, size_t n )
    12661540{
    1267   dprintf(("CRTDLL: _mbsnccnt\n"));
     1541  dprintf(("CRTDLL: _mbsnccnt not implemented.\n"));
    12681542  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12691543  return FALSE;
     
    12761550int CDECL CRTDLL__mbsncmp( const unsigned char *s1, const unsigned char *s2, size_t n )
    12771551{
    1278   dprintf(("CRTDLL: _mbsncmp\n"));
     1552  dprintf(("CRTDLL: _mbsncmp not implemented.\n"));
    12791553  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12801554  return FALSE;
     
    12871561unsigned char * CDECL CRTDLL__mbsncpy( unsigned char *s1, const unsigned char *s2, size_t n )
    12881562{
    1289   dprintf(("CRTDLL: _mbsncpy\n"));
     1563  dprintf(("CRTDLL: _mbsncpy not implemented.\n"));
    12901564  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    12911565  return FALSE;
     
    12981572unsigned int CDECL CRTDLL__mbsnextc( const unsigned char *s )
    12991573{
    1300   dprintf(("CRTDLL: _mbsnextc\n"));
     1574  dprintf(("CRTDLL: _mbsnextc not implemented.\n"));
    13011575  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13021576  return FALSE;
     
    13091583int CDECL CRTDLL__mbsnicmp( const unsigned char *s1, const unsigned char *s2, size_t n )
    13101584{
    1311   dprintf(("CRTDLL: _mbsnicmp\n"));
     1585  dprintf(("CRTDLL: _mbsnicmp not implemented.\n"));
    13121586  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13131587  return FALSE;
     
    13201594unsigned char * CDECL CRTDLL__mbsninc( const unsigned char *s, size_t count )
    13211595{
    1322   dprintf(("CRTDLL: _mbsninc\n"));
     1596  dprintf(("CRTDLL: _mbsninc not implemented.\n"));
    13231597  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13241598  return FALSE;
     
    13311605unsigned char * CDECL CRTDLL__mbsnset( unsigned char *s, unsigned int ch, size_t n )
    13321606{
    1333   dprintf(("CRTDLL: _mbsnset\n"));
     1607  dprintf(("CRTDLL: _mbsnset not implemented.\n"));
    13341608  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13351609  return FALSE;
     
    13421616unsigned char * CDECL CRTDLL__mbspbrk( const unsigned char *s, const unsigned char *charset )
    13431617{
    1344   dprintf(("CRTDLL: _mbspbrk\n"));
     1618  dprintf(("CRTDLL: _mbspbrk not implemented.\n"));
    13451619  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13461620  return FALSE;
     
    13511625 *           CRTDLL__mbsrchr   (CRTDLL.221)
    13521626 */
    1353 unsigned char * CDECL CRTDLL__mbsrchr( const unsigned char *s, unsigned int ch )
     1627LPSTR CDECL CRTDLL__mbsrchr(LPSTR s,CHAR x)
    13541628{
    13551629  dprintf(("CRTDLL: _mbsrchr\n"));
    1356   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1357   return FALSE;
     1630        /* FIXME: handle multibyte strings */
     1631        return strrchr(s,x);
    13581632}
    13591633
     
    13641638unsigned char * CDECL CRTDLL__mbsrev( unsigned char *s )
    13651639{
    1366   dprintf(("CRTDLL: _mbsrev\n"));
     1640  dprintf(("CRTDLL: _mbsrev not implemented.\n"));
    13671641  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13681642  return FALSE;
     
    13751649unsigned char * CDECL CRTDLL__mbsset( unsigned char *s, unsigned int ch )
    13761650{
    1377   dprintf(("CRTDLL: _mbsset\n"));
     1651  dprintf(("CRTDLL: _mbsset not implemented.\n"));
    13781652  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13791653  return FALSE;
     
    13861660size_t CDECL CRTDLL__mbsspn( const unsigned char *s, const unsigned char *charset )
    13871661{
    1388   dprintf(("CRTDLL: _mbsspn\n"));
     1662  dprintf(("CRTDLL: _mbsspn not implemented.\n"));
    13891663  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    13901664  return FALSE;
     
    13971671unsigned char * CDECL CRTDLL__mbsspnp( const unsigned char *s, const unsigned char *charset )
    13981672{
    1399   dprintf(("CRTDLL: _mbsspnp\n"));
     1673  dprintf(("CRTDLL: _mbsspnp not implemented.\n"));
    14001674  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    14011675  return FALSE;
     
    14081682unsigned char * CDECL CRTDLL__mbsstr( const unsigned char *s1, const unsigned char *s2 )
    14091683{
    1410   dprintf(("CRTDLL: _mbsstr\n"));
     1684  dprintf(("CRTDLL: _mbsstr not implemented.\n"));
    14111685  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    14121686  return FALSE;
     
    14191693unsigned char * CDECL CRTDLL__mbstok( unsigned char *s, const unsigned char *delim )
    14201694{
    1421   dprintf(("CRTDLL: _mbstok\n"));
     1695  dprintf(("CRTDLL: _mbstok not implemented.\n"));
    14221696  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    14231697  return FALSE;
     
    14301704unsigned char * CDECL CRTDLL__mbsupr( unsigned char *s )
    14311705{
    1432   dprintf(("CRTDLL: _mbsupr\n"));
     1706  dprintf(("CRTDLL: _mbsupr not implemented.\n"));
    14331707  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    14341708  return FALSE;
     
    14531727char * CDECL CRTDLL__mktemp( char * templt )
    14541728{
    1455   dprintf(("CRTDLL: _mktemp\n"));
     1729  dprintf(("CRTDLL: _mktemp not implemented.\n"));
    14561730  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    14571731  return FALSE;
     
    14721746 *                  _open        (CRTDLL.237)
    14731747 */
    1474 INT CDECL CRTDLL__open(const char *path,int oflag,...)
    1475 {
    1476   dprintf(("CRTDLL: _open\n"));
    1477   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1478   return FALSE;
     1748HFILE CDECL CRTDLL__open(LPCSTR path,INT flags)
     1749{
     1750    dprintf(("CRTDLL: _open\n"));
     1751    DWORD access = 0, creation = 0;
     1752    HFILE ret;
     1753   
     1754    switch(flags & 3)
     1755    {
     1756    case O_RDONLY: access |= GENERIC_READ; break;
     1757    case O_WRONLY: access |= GENERIC_WRITE; break;
     1758    case O_RDWR:   access |= GENERIC_WRITE | GENERIC_READ; break;
     1759    }
     1760
     1761    if (flags & 0x0100) /* O_CREAT */
     1762    {
     1763        if (flags & 0x0400) /* O_EXCL */
     1764            creation = CREATE_NEW;
     1765        else if (flags & 0x0200) /* O_TRUNC */
     1766            creation = CREATE_ALWAYS;
     1767        else
     1768            creation = OPEN_ALWAYS;
     1769    }
     1770    else  /* no O_CREAT */
     1771    {
     1772        if (flags & 0x0200) /* O_TRUNC */
     1773            creation = TRUNCATE_EXISTING;
     1774        else
     1775            creation = OPEN_EXISTING;
     1776    }
     1777    if (flags & 0x0008) /* O_APPEND */
     1778        dprintf(("O_APPEND not supported\n" ));
     1779    if (flags & 0xf0f4)
     1780      dprintf(("CRTDLL_open file unsupported flags 0x%04x\n",flags));
     1781    /* End Fixme */
     1782
     1783    ret = CreateFileA( path, access, FILE_SHARE_READ | FILE_SHARE_WRITE,
     1784                         NULL, creation, FILE_ATTRIBUTE_NORMAL, -1 );
     1785    dprintf(("CRTDLL_open file %s mode 0x%04x got handle %d\n", path,flags,ret));
     1786    return ret;
    14791787}
    14801788
     
    14861794{
    14871795  dprintf(("CRTDLL: _open_osfhandle\n"));
    1488   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1489   return FALSE;
     1796HFILE handle;
     1797 
     1798        switch (osfhandle) {
     1799        case STD_INPUT_HANDLE :
     1800        case 0 :
     1801          handle=0;
     1802          break;
     1803        case STD_OUTPUT_HANDLE:
     1804        case 1:
     1805          handle=1;
     1806          break;
     1807        case STD_ERROR_HANDLE:
     1808        case 2:
     1809          handle=2;
     1810          break;
     1811        default:
     1812          return (-1);
     1813        }
     1814        dprintf(("(handle %08lx,flags %d) return %d\n",
     1815                     osfhandle,flags,handle));
     1816        return handle;
    14901817}
    14911818
     
    14961823INT CDECL CRTDLL__pclose( FILE *fp )
    14971824{
    1498   dprintf(("CRTDLL: _pclose\n"));
     1825  dprintf(("CRTDLL: _pclose not implemented.\n"));
    14991826  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    15001827  return FALSE;
     
    15081835INT CDECL CRTDLL__pctype_dll(DWORD ret)
    15091836{
    1510         dprintf(("CRTDLL: _pctype_dll\n"));
    1511 
     1837        dprintf(("CRTDLL: _pctype_dll not implemented.\n"));
    15121838        return 0;
    15131839}
     
    15191845INT CDECL CRTDLL__pipe( int *phandles, unsigned psize, int textmode )
    15201846{
    1521   dprintf(("CRTDLL: _pipe\n"));
     1847  dprintf(("CRTDLL: _pipe not implemented.\n"));
    15221848  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    15231849  return FALSE;
     
    15301856FILE * CDECL CRTDLL__popen( const char *command, const char *mode )
    15311857{
    1532   dprintf(("CRTDLL: _popen\n"));
     1858  dprintf(("CRTDLL: _popen not implemented.\n"));
    15331859  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    15341860  return FALSE;
     
    15371863/*********************************************************************
    15381864 *                  _read     (CRTDLL.254)
    1539  *
    1540  * BUGS
    1541  *   Unimplemented
    15421865 */
    15431866INT CDECL CRTDLL__read(INT fd, LPVOID buf, UINT count)
    15441867{
    1545   dprintf(("CRTDLL: _read\n"));
     1868  dprintf(("CRTDLL: _read not implemented.\n"));
    15461869  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    15471870  return FALSE;
     
    15541877INT CDECL CRTDLL__putw( int binint, FILE *fp )
    15551878{
    1556   dprintf(("CRTDLL: _putw\n"));
     1879  dprintf(("CRTDLL: _putw not implemented.\n"));
    15571880  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    15581881  return FALSE;
     
    15851908void CDECL CRTDLL__searchenv( const char *name, const char *env_var, char *buf )
    15861909{
    1587   dprintf(("CRTDLL: _searchenv\n"));
     1910  dprintf(("CRTDLL: _searchenv not implemented.\n"));
    15881911  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    15891912}
     
    16011924
    16021925/*********************************************************************
     1926 *                  _setmode           (CRTDLL.263)
     1927 * FIXME: At present we ignore the request to translate CR/LF to LF.
     1928 *
     1929 * We allways translate when we read with fgets, we never do with fread
     1930 *
     1931 */
     1932INT CDECL CRTDLL__setmode( INT fh,INT mode)
     1933{
     1934        /* FIXME */
     1935        dprintf(("on fhandle %d mode %s, STUB.\n",
     1936                      fh,(mode=O_TEXT)?"O_TEXT":
     1937                      (mode=O_BINARY)?"O_BINARY":"UNKNOWN"));
     1938        return -1;
     1939}
     1940
     1941
     1942/*********************************************************************
     1943 *                  _sleep           (CRTDLL.265)
     1944 */
     1945VOID CDECL CRTDLL__sleep(unsigned long timeout)
     1946{
     1947  dprintf(("CRTDLL__sleep for %ld milliseconds\n",timeout));
     1948  Sleep((timeout)?timeout:1);
     1949}
     1950
     1951
     1952/*********************************************************************
    16031953 *           CRTDLL__stat        (CRTDLL.278)
    16041954 */
     
    16331983 *           CRTDLL__strdup      (CRTDLL.283)
    16341984 */
    1635 char * CDECL CRTDLL__strdup( const char *string )
     1985LPSTR CDECL CRTDLL__strdup(LPCSTR ptr)
    16361986{
    16371987  dprintf(("CRTDLL: _strdup\n"));
    1638   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1639   return FALSE;
     1988  return HEAP_strdupA(GetProcessHeap(),0,ptr);
    16401989}
    16411990
     
    16461995int CDECL CRTDLL__stricoll( const char *s1, const char *s2 )
    16471996{
    1648   dprintf(("CRTDLL: _stricoll\n"));
     1997  dprintf(("CRTDLL: _stricoll not implemented.\n"));
    16491998  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    16501999  return FALSE;
     
    16982047char * CDECL CRTDLL__strnset( char *string, int c, size_t len )
    16992048{
    1700   dprintf(("CRTDLL: _strnset\n"));
     2049  dprintf(("CRTDLL: _strnset not implemented.\n"));
    17012050  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    17022051  return FALSE;
     
    17092058char * CDECL CRTDLL__strrev( char *string )
    17102059{
    1711   dprintf(("CRTDLL: _strrev\n"));
     2060  dprintf(("CRTDLL: _strrev not implemented.\n"));
    17122061  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    17132062  return FALSE;
     
    17202069char * CDECL CRTDLL__strset( char *string, int c )
    17212070{
    1722   dprintf(("CRTDLL: _strset\n"));
     2071  dprintf(("CRTDLL: _strset not implemented.\n"));
    17232072  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    17242073  return FALSE;
     
    17772126
    17782127/*********************************************************************
     2128 *                  _unlink           (CRTDLL.312)
     2129 */
     2130INT CDECL CRTDLL__unlink(LPCSTR pathname)
     2131{
     2132    dprintf(("CRTDLL: _unlink\n"));
     2133    int ret=0;
     2134    DOS_FULL_NAME full_name;
     2135
     2136    if (!DOSFS_GetFullName( pathname, FALSE, (CHAR*)&full_name )) {
     2137      dprintf(("CRTDLL_unlink file %s bad name\n",pathname));
     2138      return EOF;
     2139    }
     2140 
     2141    ret=unlink(full_name.long_name);
     2142    dprintf(("(%s unix %s)\n",
     2143                   pathname,full_name.long_name));
     2144    if(ret)
     2145      dprintf((" Failed!\n"));
     2146
     2147    return ret;
     2148}
     2149
     2150
     2151/*********************************************************************
    17792152 *           CRTDLL__utime       (CRTDLL.314)
    17802153 */
     
    17912164int CDECL CRTDLL__vsnwprintf( wchar_t *s1, size_t n, const wchar_t *s2, va_list arg )
    17922165{
    1793   dprintf(("CRTDLL: _vsnwprintf\n"));
     2166  dprintf(("CRTDLL: _vsnwprintf not implemented.\n"));
    17942167  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    17952168  return FALSE;
     
    18002173 *           CRTDLL__wcsdup      (CRTDLL.317)
    18012174 */
    1802 wchar_t * CDECL CRTDLL__wcsdup( const wchar_t *s1 )
     2175LPWSTR CDECL CRTDLL__wcsdup( LPCWSTR str )
    18032176{
    18042177  dprintf(("CRTDLL: _wcsdup\n"));
    1805   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1806   return FALSE;
     2178  LPWSTR ret = NULL;
     2179  if (str)
     2180  {
     2181      int size = (wcslen((const wchar_t*)str) + 1) * sizeof(WCHAR);
     2182// FIXME     ret = CRTDLL_malloc( size );
     2183      if (ret) memcpy( ret, str, size );
     2184  }
     2185  return ret;
    18072186}
    18082187
     
    18112190 *           CRTDLL__wcsicoll    (CRTDLL.319)
    18122191 */
    1813 int CDECL CRTDLL__wcsicoll( const wchar_t *s1, const wchar_t *s2 )
     2192int CDECL CRTDLL__wcsicoll( LPCWSTR str1, LPCWSTR str2 )
    18142193{
    18152194  dprintf(("CRTDLL: _wcsicoll\n"));
    1816   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1817   return FALSE;
     2195  return NTDLL__wcsicmp( str1, str2 );
    18182196}
    18192197
     
    18242202LPWSTR CDECL CRTDLL__wcsnset( LPWSTR str, WCHAR c, INT n )
    18252203{
     2204    dprintf(("CRTDLL: _wcsnset\n"));
    18262205    LPWSTR ret = str;
    18272206    while ((n-- > 0) && *str) *str++ = c;
     
    18332212 *           CRTDLL__wcsrev      (CRTDLL.323)
    18342213 */
    1835 wchar_t * CDECL CRTDLL__wcsrev( wchar_t *s1 )
     2214LPWSTR CDECL CRTDLL__wcsrev( LPWSTR str )
    18362215{
    18372216  dprintf(("CRTDLL: _wcsrev\n"));
    1838   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1839   return FALSE;
     2217  LPWSTR ret = str;
     2218  LPWSTR end = str + wcslen((const wchar_t*)str) - 1;
     2219  while (end > str)
     2220  {
     2221      WCHAR t = *end;
     2222      *end--  = *str;
     2223      *str++  = t;
     2224  }
     2225  return ret;
    18402226}
    18412227
     
    18462232LPWSTR CDECL CRTDLL__wcsset( LPWSTR str, WCHAR c )
    18472233{
     2234    dprintf(("CRTDLL: _wcsset\n"));
    18482235    LPWSTR ret = str;
    18492236    while (*str) *str++ = c;
     
    18512238}
    18522239
     2240
     2241/*********************************************************************
     2242 *                  _write        (CRTDLL.329)
     2243 */
     2244INT CDECL CRTDLL__write(INT fd,LPCVOID buf,UINT count)
     2245{
     2246        dprintf(("CRTDLL: _write\n"));
     2247        INT len=0;
     2248
     2249        if (fd == -1)
     2250          len = -1;
     2251        else if (fd<=2)
     2252          len = (UINT)write(fd,buf,(LONG)count);
     2253        else
     2254          len = _lwrite(fd,(LPCSTR)buf,count);
     2255        dprintf(("%d/%d byte to dfh %d from %p,\n",
     2256                       len,count,fd,buf));
     2257        return len;
     2258}
     2259
     2260
    18532261/*********************************************************************
    18542262 *                  isleadbyte  (CRTDLL.335)
     
    18602268}
    18612269
     2270
    18622271/*********************************************************************
    18632272 *                  acos        (CRTDLL.336)
     
    18692278}
    18702279
     2280
    18712281/*********************************************************************
    18722282 *                  asctime     (CRTDLL.338)
     
    18782288}
    18792289
     2290
    18802291/*********************************************************************
    18812292 *                  asin        (CRTDLL.339)
     
    18872298}
    18882299
     2300
    18892301/*********************************************************************
    18902302 *                  atan2       (CRTDLL.341)
     
    18962308}
    18972309
     2310
    18982311/*********************************************************************
    18992312 *                  atexit      (CRTDLL.342)
     
    19012314int CDECL CRTDLL_atexit( register void ( *func )( void ) )
    19022315{
    1903   dprintf(("CRTDLL: atexit\n"));
    1904   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1905   return FALSE;
    1906 }
     2316  dprintf(("CRTDLL: atexit not implemented.\n"));
     2317  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     2318  return FALSE;
     2319}
     2320
    19072321
    19082322/*********************************************************************
     
    19152329}
    19162330
     2331
    19172332/*********************************************************************
    19182333 *                  bsearch     (CRTDLL.346)
     
    19212336         size_t size, int (*compar)(const void *pkey, const void *pbase) )
    19222337{
    1923   dprintf(("CRTDLL: bsearch\n"));
    1924   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    1925   return FALSE;
    1926 }
     2338  dprintf(("CRTDLL: bsearch not implemented.\n"));
     2339  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     2340  return FALSE;
     2341}
     2342
    19272343
    19282344/*********************************************************************
     
    19352351}
    19362352
     2353
    19372354/*********************************************************************
    19382355 *                  clearerr    (CRTDLL.349)
     
    19442361}
    19452362
     2363
    19462364/*********************************************************************
    19472365 *                  clock       (CRTDLL.350)
     
    19532371}
    19542372
     2373
    19552374/*********************************************************************
    19562375 *                  cosh        (CRTDLL.352)
     
    19622381}
    19632382
     2383
    19642384/*********************************************************************
    19652385 *                  ctime       (CRTDLL.353)
     
    19712391}
    19722392
     2393
    19732394/*********************************************************************
    19742395 *                  difftime    (CRTDLL.354)
     
    19802401}
    19812402
     2403
    19822404/*********************************************************************
    19832405 *                  div         (CRTDLL.355)
     
    19892411}
    19902412
     2413
    19912414/*********************************************************************
    19922415 *                  exit          (CRTDLL.356)
     
    19982421}
    19992422
     2423
    20002424/*********************************************************************
    20012425 *                  exp         (CRTDLL.357)
     
    20072431}
    20082432
     2433
    20092434/*********************************************************************
    20102435 *                  fclose      (CRTDLL.359)
     
    20162441}
    20172442
     2443
    20182444/*********************************************************************
    20192445 *                  feof        (CRTDLL.360)
     
    20252451}
    20262452
     2453
    20272454/*********************************************************************
    20282455 *                  ferror      (CRTDLL.361)
     
    20342461}
    20352462
     2463
    20362464/*********************************************************************
    20372465 *                  fflush      (CRTDLL.362)
     
    20432471}
    20442472
     2473
    20452474/*********************************************************************
    20462475 *                  fgetc       (CRTDLL.363)
     
    20522481}
    20532482
     2483
    20542484/*********************************************************************
    20552485 *                  fgetpos     (CRTDLL.364)
     
    20612491}
    20622492
     2493
    20632494/*********************************************************************
    20642495 *                  fgets       (CRTDLL.365)
     
    20702501}
    20712502
     2503
    20722504/*********************************************************************
    20732505 *                  fgetwc      (CRTDLL.366)
     
    20792511}
    20802512
     2513
    20812514/*********************************************************************
    20822515 *                  fmod        (CRTDLL.368)
     
    20882521}
    20892522
     2523
    20902524/*********************************************************************
    20912525 *                  fopen       (CRTDLL.369)
     
    20962530  return (fopen( filename, mode));
    20972531}
     2532
    20982533
    20992534/*********************************************************************
     
    21122547}
    21132548
     2549
    21142550/*********************************************************************
    21152551 *                  fputc   (CRTDLL.371)
     
    21212557}
    21222558
     2559
    21232560/*********************************************************************
    21242561 *                  fputs   (CRTDLL.372)
     
    21302567}
    21312568
     2569
    21322570/*********************************************************************
    21332571 *                  fputwc  (CRTDLL.373)
     
    21392577}
    21402578
     2579
    21412580/*********************************************************************
    21422581 *                  fread  (CRTDLL.374)
     
    21472586  return (fread(ptr, size, n, fp));
    21482587}
     2588
    21492589 
    21502590/*********************************************************************
     
    21572597}
    21582598
     2599
    21592600/*********************************************************************
    21602601 *                  freopen       (CRTDLL.376)
     
    21662607}
    21672608
     2609
    21682610/*********************************************************************
    21692611 *                  frexp         (CRTDLL.377)
     
    21752617}
    21762618
     2619
    21772620/*********************************************************************
    21782621 *                  fscanf        (CRTDLL.378)
     
    21802623int CDECL CRTDLL_fscanf( FILE*fp, const char *format, ... )
    21812624{
    2182   dprintf(("CRTDLL: frexp\n"));
    2183   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2184   return FALSE;
    2185 }
     2625  dprintf(("CRTDLL: fscanf\n"));
     2626#if 0
     2627    va_list valist;
     2628    INT res;
     2629
     2630    va_start( valist, format );
     2631#ifdef HAVE_VFSCANF
     2632    res = vfscanf( xlat_file_ptr(stream), format, valist );
     2633#endif
     2634    va_end( valist );
     2635    return res;
     2636#endif
     2637    dprintf(("broken\n"));
     2638    return 0;
     2639}
     2640
    21862641
    21872642/*********************************************************************
    21882643 *                  fseek         (CRTDLL.379)
    21892644 */
    2190 int CDECL CRTDLL_fseek( FILE *fp, long int offset, int whence )
     2645int CDECL CRTDLL_fseek( FILE *file, long int offset, int whence )
    21912646{
    21922647  dprintf(("CRTDLL: fseek\n"));
    2193   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2194   return FALSE;
    2195 }
     2648  dprintf(("file %p to 0x%08lx pos %s\n",
     2649        file,offset,(whence==SEEK_SET)?"SEEK_SET":
     2650        (whence==SEEK_CUR)?"SEEK_CUR":
     2651        (whence==SEEK_END)?"SEEK_END":"UNKNOWN"));
     2652// FIXME if (SetFilePointer( file->handle, offset, NULL, whence ) != 0xffffffff)
     2653// FIXME     return 0;
     2654  dprintf((" failed!\n"));
     2655  return -1;
     2656}
     2657
    21962658
    21972659/*********************************************************************
     
    22042666}
    22052667
     2668
    22062669/*********************************************************************
    22072670 *                  ftell         (CRTDLL.381)
     
    22132676}
    22142677
     2678
    22152679/*********************************************************************
    22162680 *                  fwprintf      (CRTDLL.382)
     
    22182682int CDECL CRTDLL_fwprintf( FILE *strm, const wchar_t *format, ... )
    22192683{
    2220   dprintf(("CRTDLL: fwprintf\n"));
    2221   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2222   return FALSE;
    2223 }
     2684  dprintf(("CRTDLL: fwprintf not implemented.\n"));
     2685  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     2686  return FALSE;
     2687}
     2688
    22242689
    22252690/*********************************************************************
     
    22352700}
    22362701
     2702
    22372703/*********************************************************************
    22382704 *                  fwscanf       (CRTDLL.384)
     
    22402706int CDECL CRTDLL_fwscanf( FILE *strm, const wchar_t *format, ... )
    22412707{
    2242   dprintf(("CRTDLL: fwscanf\n"));
    2243   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2244   return FALSE;
    2245 }
     2708  dprintf(("CRTDLL: fwscanf not implemented.\n"));
     2709  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     2710  return FALSE;
     2711}
     2712
    22462713
    22472714/*********************************************************************
     
    22542721}
    22552722
     2723
    22562724/*********************************************************************
    22572725 *                  getchar    (CRTDLL.386)
     
    22632731}
    22642732
     2733
    22652734/*********************************************************************
    22662735 *                  getenv    (CRTDLL.387)
     
    22722741}
    22732742
     2743
    22742744/*********************************************************************
    22752745 *                  gets    (CRTDLL.388)
     
    22812751}
    22822752
     2753
    22832754/*********************************************************************
    22842755 *                  gmtime    (CRTDLL.389)
     
    22902761}
    22912762
     2763
    22922764/*********************************************************************
    22932765 *                  is_wctype    (CRTDLL.390)
     
    23002772}
    23012773
     2774
    23022775/*********************************************************************
    23032776 *                  isalnum    (CRTDLL.391)
     
    23092782}
    23102783
     2784
    23112785/*********************************************************************
    23122786 *                  iscntrl    (CRTDLL.393)
     
    23182792}
    23192793
     2794
    23202795/*********************************************************************
    23212796 *                  isgraph    (CRTDLL.395)
     
    23272802}
    23282803
     2804
    23292805/*********************************************************************
    23302806 *                  isleadbyte  (CRTDLL.396)
     
    23322808int CDECL CRTDLL_isleadbyte(int i)
    23332809{
    2334   dprintf(("CRTDLL: isleadbyte(%08xh)\n", i));
    2335   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2336   return FALSE;
    2337 }
     2810  dprintf(("CRTDLL: isleadbyte(%08xh) not implemented.\n", i));
     2811  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     2812  return FALSE;
     2813}
     2814
    23382815
    23392816/*********************************************************************
     
    23462823}
    23472824
     2825
    23482826/*********************************************************************
    23492827 *                  iswalnum    (CRTDLL.402)
     
    23522830{
    23532831  dprintf(("CRTDLL: iswalnum(%08xh)\n", i));
    2354 
    23552832  return (iswalnum(i));
    23562833}
    23572834
     2835
    23582836/*********************************************************************
    23592837 *                  iswascii    (CRTDLL.404)
     
    23612839int CDECL CRTDLL_iswascii(wint_t i)
    23622840{
    2363   dprintf(("CRTDLL: iswascii(%08xh)\n", i));
    2364 
    2365   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2366   return FALSE;
    2367 }
     2841  dprintf(("CRTDLL: iswascii(%08xh) not implemented.\n", i));
     2842  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     2843  return FALSE;
     2844}
     2845
    23682846
    23692847/*********************************************************************
     
    23732851{
    23742852  dprintf(("CRTDLL: iswcntrl(%08xh)\n", i));
    2375 
    23762853  return (iswcntrl(i));
    23772854}
    23782855
     2856
    23792857/*********************************************************************
    23802858 *                  iswdigit    (CRTDLL.407)
     
    23832861{
    23842862  dprintf(("CRTDLL: iswdigit(%08xh)\n", i));
    2385 
    23862863  return (iswdigit(i));
    23872864}
    23882865
     2866
    23892867/*********************************************************************
    23902868 *                  iswgraph    (CRTDLL.408)
     
    23932871{
    23942872  dprintf(("CRTDLL: iswgraph(%08xh)\n", i));
    2395 
    23962873  return (iswgraph(i));
    23972874}
    23982875
     2876
    23992877/*********************************************************************
    24002878 *                  iswlower    (CRTDLL.409)
     
    24032881{
    24042882  dprintf(("CRTDLL: iswlower(%08xh)\n", i));
    2405 
    24062883  return (iswlower(i));
    24072884}
    24082885
     2886
    24092887/*********************************************************************
    24102888 *                  iswprint    (CRTDLL.410)
     
    24132891{
    24142892  dprintf(("CRTDLL: iswprint(%08xh)\n", i));
    2415 
    24162893  return (iswprint(i));
    24172894}
    24182895
     2896
    24192897/*********************************************************************
    24202898 *                  iswpunct    (CRTDLL.411)
     
    24232901{
    24242902  dprintf(("CRTDLL: iswpunct(%08xh)\n", i));
    2425 
    24262903  return (iswpunct(i));
    24272904}
    24282905
     2906
    24292907/*********************************************************************
    24302908 *                  iswspace    (CRTDLL.412)
     
    24332911{
    24342912  dprintf(("CRTDLL: iswspace(%08xh)\n", i));
    2435 
    24362913  return (iswspace(i));
    24372914}
    24382915
     2916
    24392917/*********************************************************************
    24402918 *                  iswupper    (CRTDLL.413)
     
    24432921{
    24442922  dprintf(("CRTDLL: iswupper(%08xh)\n", i));
    2445 
    24462923  return (iswupper(i));
    24472924}
    24482925
     2926
    24492927/*********************************************************************
    24502928 *                  iswxdigit    (CRTDLL.414)
     
    24532931{
    24542932  dprintf(("CRTDLL: iswxdigit(%08xh)\n", i));
    2455 
    24562933  return (iswxdigit(i));
    24572934}
    24582935
     2936
    24592937/*********************************************************************
    24602938 *                  ldexp       (CRTDLL.417)
     
    24632941{
    24642942  dprintf(("CRTDLL: ldexp\n"));
    2465 
    24662943  return (ldexp(x, exp));
    24672944}
    24682945
     2946
    24692947/*********************************************************************
    24702948 *                  ldiv        (CRTDLL.418)
     
    24732951{
    24742952  dprintf(("CRTDLL: ldiv\n"));
    2475 
    24762953  return (ldiv(numer, denom));
    24772954}
     2955
    24782956
    24792957/*********************************************************************
     
    24862964}
    24872965
     2966
    24882967/*********************************************************************
    24892968 *                  localtime   (CRTDLL.420)
     
    24952974}
    24962975
     2976
    24972977/*********************************************************************
    24982978 *                  log10       (CRTDLL.422)
     
    25042984}
    25052985
     2986
    25062987/*********************************************************************
    25072988 *                  longjmp        (CRTDLL.423)
     
    25132994}
    25142995
     2996
    25152997/*********************************************************************
    25162998 *                  malloc        (CRTDLL.424)
     
    25223004}
    25233005
     3006
    25243007/*********************************************************************
    25253008 *                  mblen        (CRTDLL.425)
     
    25313014}
    25323015
     3016
    25333017/*********************************************************************
    25343018 *           CRTDLL_mbtowc    (CRTDLL.427)
     
    25363020INT CDECL CRTDLL_mbtowc( WCHAR *dst, LPCSTR str, INT n )
    25373021{
     3022    dprintf(("CRTDLL: _mbtowc\n"));
    25383023    wchar_t res;
    25393024    int ret = mbtowc( &res, str, n );
     
    25423027}
    25433028
     3029
    25443030/*********************************************************************
    25453031 *                  mktime   (CRTDLL.433)
     
    25513037}
    25523038
     3039
    25533040/*********************************************************************
    25543041 *                  modf   (CRTDLL.434)
     
    25603047}
    25613048
     3049
    25623050/*********************************************************************
    25633051 *                  perror   (CRTDLL.435)
     
    25693057}
    25703058
     3059
    25713060/*********************************************************************
    25723061 *                  printf   (CRTDLL.437)
     
    25743063int CDECL CRTDLL_printf( const char *format, ... )
    25753064{
    2576     dprintf(("CRTDLL: printf\n"));
     3065    dprintf(("CRTDLL: printf not implemented.\n"));
    25773066    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    25783067    return FALSE;
    25793068}
    25803069
     3070
    25813071/*********************************************************************
    25823072 *                  putc      (CRTDLL.438)
     
    25883078}
    25893079
     3080
    25903081/*********************************************************************
    25913082 *                  putchar      (CRTDLL.439)
     
    25973088}
    25983089
     3090
    25993091/*********************************************************************
    26003092 *                  puts         (CRTDLL.440)
     
    26063098}
    26073099
     3100
    26083101/*********************************************************************
    26093102 *                  raise        (CRTDLL.442)
     
    26153108}
    26163109
     3110
    26173111/*********************************************************************
    26183112 *                  rand   (CRTDLL.443)
     
    26243118}
    26253119
     3120
    26263121/*********************************************************************
    26273122 *                  realloc   (CRTDLL.444)
     
    26303125{
    26313126    dprintf(("CRTDLL: realloc\n"));
    2632     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2633     return FALSE;
    2634 }
     3127    return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
     3128}
     3129
    26353130
    26363131/*********************************************************************
     
    26453140}
    26463141
     3142
    26473143/*********************************************************************
    26483144 *                  rename      (CRTDLL.446)
     
    26543150}
    26553151
     3152
    26563153/*********************************************************************
    26573154 *                  rewind      (CRTDLL.447)
     
    26633160}
    26643161
     3162
    26653163/*********************************************************************
    26663164 *                  scanf       (CRTDLL.448)
     
    26683166int CDECL CRTDLL_scanf( const char *format, ... )
    26693167{
    2670   dprintf(("CRTDLL: scanf\n"));
    2671   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2672   return FALSE;
    2673 }
     3168  dprintf(("CRTDLL: scanf not implemented.\n"));
     3169  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     3170  return FALSE;
     3171}
     3172
    26743173       
    26753174/*********************************************************************
     
    26823181}
    26833182
     3183
    26843184/*********************************************************************
    26853185 *                  setlocale      (CRTDLL.450)
     
    26913191}
    26923192
     3193
    26933194/*********************************************************************
    26943195 *                  setvbuf      (CRTDLL.451)
     
    27003201}
    27013202
     3203
    27023204/*********************************************************************
    27033205 *                  signal       (CRTDLL.452)
     
    27053207void CDECL CRTDLL_signal( int sig, void (*func)(int))
    27063208{
    2707     dprintf(("CRTDLL: signal\n"));
     3209    dprintf(("CRTDLL: signal not implemented.\n"));
    27083210    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    27093211}
     3212
    27103213
    27113214/*********************************************************************
     
    27183221}
    27193222
     3223
    27203224/*********************************************************************
    27213225 *                  srand        (CRTDLL.457)
     
    27273231}
    27283232
     3233
    27293234/*********************************************************************
    27303235 *                  strcoll        (CRTDLL.462)
     
    27363241}
    27373242
     3243
    27383244/*********************************************************************
    27393245 *                  strerror        (CRTDLL.465)
     
    27453251}
    27463252
     3253
    27473254/*********************************************************************
    27483255 *                  strftime        (CRTDLL.466)
     
    27643271}
    27653272
     3273
    27663274/*********************************************************************
    27673275 *                  strtok        (CRTDLL.476)
     
    27733281}
    27743282
     3283
    27753284/*********************************************************************
    27763285 *                  strtol        (CRTDLL.477)
     
    27823291}
    27833292
     3293
    27843294/*********************************************************************
    27853295 *                  strtoul        (CRTDLL.478)
     
    27913301}
    27923302
     3303
    27933304/*********************************************************************
    27943305 *                  strxfrm        (CRTDLL.479)
     
    28003311}
    28013312
     3313
    28023314/*********************************************************************
    28033315 *                  swscanf           (CRTDLL.481)
     
    28053317int CDECL CRTDLL_swscanf( const wchar_t *s1, const wchar_t *s2, ... )
    28063318{
    2807   dprintf(("CRTDLL: swscanf\n"));
    2808   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2809   return FALSE;
    2810 }
     3319  dprintf(("CRTDLL: swscanf not implemented.\n"));
     3320  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     3321  return FALSE;
     3322}
     3323
    28113324
    28123325/*********************************************************************
     
    28193332}
    28203333
     3334
    28213335/*********************************************************************
    28223336 *                  tanh           (CRTDLL.485)
     
    28283342}
    28293343
     3344
    28303345/*********************************************************************
    28313346 *                  time           (CRTDLL.485)
     
    28383353}
    28393354
    2840 /*********************************************************************
    2841  *                  tmpnam           (CRTDLL.486)
     3355
     3356/*********************************************************************
     3357 *                  tmpfile           (CRTDLL.486)
    28423358 */
    28433359FILE * CDECL CRTDLL_tmpfile( void )
     
    28463362  return (tmpfile());
    28473363}
     3364
    28483365       
    28493366/*********************************************************************
     
    28533370{
    28543371  dprintf(("CRTDLL: tmpnam\n"));
    2855 
    28563372  return (tmpnam(s));
    28573373}
    28583374
     3375
    28593376/*********************************************************************
    28603377 *                  ungetc           (CRTDLL.492)
     
    28623379INT CDECL CRTDLL_ungetc(int c)
    28633380{
    2864   dprintf(("CRTDLL: ungetc\n"));
    2865   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2866   return FALSE;
    2867 }
     3381  dprintf(("CRTDLL: ungetc not implemented.\n"));
     3382  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     3383  return FALSE;
     3384}
     3385
    28683386
    28693387/*********************************************************************
     
    28733391{
    28743392  dprintf(("CRTDLL: ungetwc\n"));
    2875 
    28763393  return (ungetwc(wc, strm));
    28773394}
     3395
    28783396
    28793397/*********************************************************************
     
    28843402    dprintf(("CRTDLL: vprintf\n"));
    28853403    char buffer[2048];  /* FIXME... */
    2886 
    28873404    vsprintf( buffer, format, args );
    28883405    return CRTDLL_fwrite( buffer, 1, strlen(buffer), file );
    28893406}
    28903407
     3408
    28913409/*********************************************************************
    28923410 *                  vfwprintf     (CRTDLL.495)
     
    28943412int CDECL CRTDLL_vfwprintf( FILE *F, const wchar_t *s, va_list arg )
    28953413{
    2896   dprintf(("CRTDLL: vfwprintf\n"));
    2897   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2898   return FALSE;
    2899 }
     3414  dprintf(("CRTDLL: vfwprintf not implemented.\n"));
     3415  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     3416  return FALSE;
     3417}
     3418
    29003419
    29013420/*********************************************************************
     
    29053424{
    29063425  dprintf(("CRTDLL: vprintf\n"));
    2907 
    29083426  return (vprintf(format, arg));
    29093427}
    29103428
     3429
    29113430/*********************************************************************
    29123431 *                  vswprintf       (CRTDLL.498)
     
    29153434{
    29163435  dprintf(("CRTDLL: vswprintf\n"));
    2917 
    29183436  return (vswprintf(s, t, format, arg));
    29193437}
    29203438
     3439
    29213440/*********************************************************************
    29223441 *                  vwprintf     (CRTDLL.499)
     
    29243443int CDECL CRTDLL_vwprintf( const wchar_t *s, va_list arg)
    29253444{
    2926   dprintf(("CRTDLL: vwprintf\n"));
     3445  dprintf(("CRTDLL: vwprintf not implemented.\n"));
    29273446  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    29283447  return FALSE;
     
    29363455{
    29373456  dprintf(("CRTDLL: wcscoll\n"));
    2938 
    29393457  return (wcscoll(s1, s2));
    29403458}
     3459
    29413460
    29423461/*********************************************************************
     
    29473466{
    29483467  dprintf(("CRTDLL: wcsftime\n"));
    2949 
    29503468  return (wcsftime(s, maxsize, format, timeptr));
    29513469}
     3470
    29523471
    29533472/*********************************************************************
     
    29603479}
    29613480
     3481
    29623482/*********************************************************************
    29633483 *                  wcsxfrm   (CRTDLL.520)
     
    29663486{
    29673487  dprintf(("CRTDLL: wcsxfrm\n"));
    2968 
    29693488  return (wcsxfrm(s1, s2, n));
    29703489}
    29713490
     3491
    29723492/*********************************************************************
    29733493 *                  wcstomb   (CRTDLL.521)
     
    29763496{
    29773497  dprintf(("CRTDLL: wctomb\n"));
    2978 
    29793498  return (wctomb(s,wchar));
    29803499}
    29813500
     3501
    29823502/*********************************************************************
    29833503 *                  wprintf   (CRTDLL.522)
     
    29853505int CDECL CRTDLL_wprintf( const wchar_t *s, ... )
    29863506{
    2987   dprintf(("CRTDLL: wprintf\n"));
    2988   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2989   return FALSE;
    2990 }
     3507  dprintf(("CRTDLL: wprintf not implemented.\n"));
     3508  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     3509  return FALSE;
     3510}
     3511
    29913512
    29923513/*********************************************************************
     
    29953516int CDECL CRTDLL_wscanf( const wchar_t *s, ... )
    29963517{
    2997   dprintf(("CRTDLL: wscanf\n"));
    2998   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    2999   return FALSE;
    3000 }
    3001 
    3002 
     3518  dprintf(("CRTDLL: wscanf not implemented.\n"));
     3519  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     3520  return FALSE;
     3521}
Note: See TracChangeset for help on using the changeset viewer.