Replace the get_file_info request by an fstat() on the client side.
[wine] / dlls / kernel / file16.c
1 /*
2  * File handling functions
3  *
4  * Copyright 1993 John Burton
5  * Copyright 1996 Alexandre Julliard
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  * TODO:
22  *    Fix the CopyFileEx methods to implement the "extended" functionality.
23  *    Right now, they simply call the CopyFile method.
24  */
25
26 #include "config.h"
27 #include "wine/port.h"
28
29 #include <stdarg.h>
30 #include <stdio.h>
31 #include <assert.h>
32
33 #define NONAMELESSUNION
34 #define NONAMELESSSTRUCT
35 #include "winerror.h"
36 #include "windef.h"
37 #include "winbase.h"
38 #include "winreg.h"
39 #include "winternl.h"
40 #include "wine/winbase16.h"
41 #include "wine/server.h"
42 #include "kernel_private.h"
43 #include "wine/unicode.h"
44 #include "wine/debug.h"
45
46 WINE_DEFAULT_DEBUG_CHANNEL(file);
47
48
49 /***********************************************************************
50  *           GetProfileInt   (KERNEL.57)
51  */
52 UINT16 WINAPI GetProfileInt16( LPCSTR section, LPCSTR entry, INT16 def_val )
53 {
54     return GetPrivateProfileInt16( section, entry, def_val, "win.ini" );
55 }
56
57
58 /***********************************************************************
59  *           GetProfileString   (KERNEL.58)
60  */
61 INT16 WINAPI GetProfileString16( LPCSTR section, LPCSTR entry, LPCSTR def_val,
62                                  LPSTR buffer, UINT16 len )
63 {
64     return GetPrivateProfileString16( section, entry, def_val,
65                                       buffer, len, "win.ini" );
66 }
67
68
69 /***********************************************************************
70  *           WriteProfileString   (KERNEL.59)
71  */
72 BOOL16 WINAPI WriteProfileString16( LPCSTR section, LPCSTR entry,
73                                     LPCSTR string )
74 {
75     return WritePrivateProfileString16( section, entry, string, "win.ini" );
76 }
77
78
79 /* get the search path for the current module; helper for OpenFile16 */
80 static char *get_search_path(void)
81 {
82     UINT len;
83     char *ret, *p, module[OFS_MAXPATHNAME];
84
85     module[0] = 0;
86     if (GetCurrentTask() && GetModuleFileName16( GetCurrentTask(), module, sizeof(module) ))
87     {
88         if (!(p = strrchr( module, '\\' ))) p = module;
89         *p = 0;
90     }
91
92     len = (2 +                                              /* search order: first current dir */
93            GetSystemDirectoryA( NULL, 0 ) + 1 +             /* then system dir */
94            GetWindowsDirectoryA( NULL, 0 ) + 1 +            /* then windows dir */
95            strlen( module ) + 1 +                           /* then module path */
96            GetEnvironmentVariableA( "PATH", NULL, 0 ) + 1); /* then look in PATH */
97     if (!(ret = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL;
98     strcpy( ret, ".;" );
99     p = ret + 2;
100     GetSystemDirectoryA( p, ret + len - p );
101     p += strlen( p );
102     *p++ = ';';
103     GetWindowsDirectoryA( p, ret + len - p );
104     p += strlen( p );
105     *p++ = ';';
106     if (module[0])
107     {
108         strcpy( p, module );
109         p += strlen( p );
110         *p++ = ';';
111     }
112     GetEnvironmentVariableA( "PATH", p, ret + len - p );
113     return ret;
114 }
115
116 /***********************************************************************
117  *           OpenFile   (KERNEL.74)
118  *           OpenFileEx (KERNEL.360)
119  */
120 HFILE16 WINAPI OpenFile16( LPCSTR name, OFSTRUCT *ofs, UINT16 mode )
121 {
122     HFILE hFileRet;
123     HANDLE handle;
124     FILETIME filetime;
125     WORD filedatetime[2];
126     const char *p, *filename;
127
128     if (!ofs) return HFILE_ERROR;
129
130     TRACE("%s %s %s %s%s%s%s%s%s%s%s%s\n",debugstr_a(name),
131           ((mode & 0x3 )==OF_READ)?"OF_READ":
132           ((mode & 0x3 )==OF_WRITE)?"OF_WRITE":
133           ((mode & 0x3 )==OF_READWRITE)?"OF_READWRITE":"unknown",
134           ((mode & 0x70 )==OF_SHARE_COMPAT)?"OF_SHARE_COMPAT":
135           ((mode & 0x70 )==OF_SHARE_DENY_NONE)?"OF_SHARE_DENY_NONE":
136           ((mode & 0x70 )==OF_SHARE_DENY_READ)?"OF_SHARE_DENY_READ":
137           ((mode & 0x70 )==OF_SHARE_DENY_WRITE)?"OF_SHARE_DENY_WRITE":
138           ((mode & 0x70 )==OF_SHARE_EXCLUSIVE)?"OF_SHARE_EXCLUSIVE":"unknown",
139           ((mode & OF_PARSE )==OF_PARSE)?"OF_PARSE ":"",
140           ((mode & OF_DELETE )==OF_DELETE)?"OF_DELETE ":"",
141           ((mode & OF_VERIFY )==OF_VERIFY)?"OF_VERIFY ":"",
142           ((mode & OF_SEARCH )==OF_SEARCH)?"OF_SEARCH ":"",
143           ((mode & OF_CANCEL )==OF_CANCEL)?"OF_CANCEL ":"",
144           ((mode & OF_CREATE )==OF_CREATE)?"OF_CREATE ":"",
145           ((mode & OF_PROMPT )==OF_PROMPT)?"OF_PROMPT ":"",
146           ((mode & OF_EXIST )==OF_EXIST)?"OF_EXIST ":"",
147           ((mode & OF_REOPEN )==OF_REOPEN)?"OF_REOPEN ":""
148         );
149
150     ofs->cBytes = sizeof(OFSTRUCT);
151     ofs->nErrCode = 0;
152     if (mode & OF_REOPEN) name = ofs->szPathName;
153
154     if (!name) return HFILE_ERROR;
155
156     /* the watcom 10.6 IDE relies on a valid path returned in ofs->szPathName
157        Are there any cases where getting the path here is wrong?
158        Uwe Bonnes 1997 Apr 2 */
159     if (!GetFullPathNameA( name, sizeof(ofs->szPathName), ofs->szPathName, NULL )) goto error;
160
161     /* OF_PARSE simply fills the structure */
162
163     if (mode & OF_PARSE)
164     {
165         ofs->fFixedDisk = (GetDriveType16( ofs->szPathName[0]-'A' ) != DRIVE_REMOVABLE);
166         TRACE("(%s): OF_PARSE, res = '%s'\n", name, ofs->szPathName );
167         return 0;
168     }
169
170     /* OF_CREATE is completely different from all other options, so
171        handle it first */
172
173     if (mode & OF_CREATE)
174     {
175         DWORD access, sharing;
176         FILE_ConvertOFMode( mode, &access, &sharing );
177         if ((handle = CreateFileA( ofs->szPathName, GENERIC_READ | GENERIC_WRITE,
178                                    sharing, NULL, CREATE_ALWAYS,
179                                    FILE_ATTRIBUTE_NORMAL, 0 ))== INVALID_HANDLE_VALUE)
180             goto error;
181     }
182     else
183     {
184         /* If OF_SEARCH is set, ignore the given path */
185
186         filename = name;
187         if ((mode & OF_SEARCH) && !(mode & OF_REOPEN))
188         {
189             /* First try the file name as is */
190             if (GetFileAttributesA( filename ) != INVALID_FILE_ATTRIBUTES) filename = NULL;
191             else
192             {
193                 /* Now remove the path */
194                 if (filename[0] && (filename[1] == ':')) filename += 2;
195                 if ((p = strrchr( filename, '\\' ))) filename = p + 1;
196                 if ((p = strrchr( filename, '/' ))) filename = p + 1;
197                 if (!filename[0])
198                 {
199                     SetLastError( ERROR_FILE_NOT_FOUND );
200                     goto error;
201                 }
202             }
203         }
204
205         /* Now look for the file */
206
207         if (filename)
208         {
209             BOOL found;
210             char *path = get_search_path();
211
212             if (!path) goto error;
213             found = SearchPathA( path, filename, NULL, sizeof(ofs->szPathName),
214                                  ofs->szPathName, NULL );
215             HeapFree( GetProcessHeap(), 0, path );
216             if (!found) goto error;
217         }
218
219         TRACE("found %s\n", debugstr_a(ofs->szPathName) );
220
221         if (mode & OF_DELETE)
222         {
223             if (!DeleteFileA( ofs->szPathName )) goto error;
224             TRACE("(%s): OF_DELETE return = OK\n", name);
225             return 1;
226         }
227
228         handle = (HANDLE)_lopen( ofs->szPathName, mode );
229         if (handle == INVALID_HANDLE_VALUE) goto error;
230
231         GetFileTime( handle, NULL, NULL, &filetime );
232         FileTimeToDosDateTime( &filetime, &filedatetime[0], &filedatetime[1] );
233         if ((mode & OF_VERIFY) && (mode & OF_REOPEN))
234         {
235             if (ofs->Reserved1 != filedatetime[0] || ofs->Reserved2 != filedatetime[1] )
236             {
237                 CloseHandle( handle );
238                 WARN("(%s): OF_VERIFY failed\n", name );
239                 /* FIXME: what error here? */
240                 SetLastError( ERROR_FILE_NOT_FOUND );
241                 goto error;
242             }
243         }
244         ofs->Reserved1 = filedatetime[0];
245         ofs->Reserved2 = filedatetime[1];
246     }
247
248     TRACE("(%s): OK, return = %p\n", name, handle );
249     hFileRet = Win32HandleToDosFileHandle( handle );
250     if (hFileRet == HFILE_ERROR16) goto error;
251     if (mode & OF_EXIST) _lclose16( hFileRet ); /* Return the handle, but close it first */
252     return hFileRet;
253
254 error:  /* We get here if there was an error opening the file */
255     ofs->nErrCode = GetLastError();
256     WARN("(%s): return = HFILE_ERROR error= %d\n", name,ofs->nErrCode );
257     return HFILE_ERROR16;
258 }
259
260
261 /***********************************************************************
262  *           _lclose   (KERNEL.81)
263  */
264 HFILE16 WINAPI _lclose16( HFILE16 hFile )
265 {
266     if ((hFile >= DOS_TABLE_SIZE) || !dos_handles[hFile])
267     {
268         SetLastError( ERROR_INVALID_HANDLE );
269         return HFILE_ERROR16;
270     }
271     TRACE("%d (handle32=%p)\n", hFile, dos_handles[hFile] );
272     CloseHandle( dos_handles[hFile] );
273     dos_handles[hFile] = 0;
274     return 0;
275 }
276
277 /***********************************************************************
278  *           _lcreat   (KERNEL.83)
279  */
280 HFILE16 WINAPI _lcreat16( LPCSTR path, INT16 attr )
281 {
282     return Win32HandleToDosFileHandle( (HANDLE)_lcreat( path, attr ) );
283 }
284
285 /***********************************************************************
286  *           _llseek   (KERNEL.84)
287  *
288  * FIXME:
289  *   Seeking before the start of the file should be allowed for _llseek16,
290  *   but cause subsequent I/O operations to fail (cf. interrupt list)
291  *
292  */
293 LONG WINAPI _llseek16( HFILE16 hFile, LONG lOffset, INT16 nOrigin )
294 {
295     return SetFilePointer( DosFileHandleToWin32Handle(hFile), lOffset, NULL, nOrigin );
296 }
297
298
299 /***********************************************************************
300  *           _lopen   (KERNEL.85)
301  */
302 HFILE16 WINAPI _lopen16( LPCSTR path, INT16 mode )
303 {
304     return Win32HandleToDosFileHandle( (HANDLE)_lopen( path, mode ) );
305 }
306
307
308 /***********************************************************************
309  *           _lread16   (KERNEL.82)
310  */
311 UINT16 WINAPI _lread16( HFILE16 hFile, LPVOID buffer, UINT16 count )
312 {
313     return (UINT16)_lread((HFILE)DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
314 }
315
316
317 /***********************************************************************
318  *           _lwrite   (KERNEL.86)
319  */
320 UINT16 WINAPI _lwrite16( HFILE16 hFile, LPCSTR buffer, UINT16 count )
321 {
322     return (UINT16)_hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
323 }
324
325 /***********************************************************************
326  *           _hread (KERNEL.349)
327  */
328 LONG WINAPI WIN16_hread( HFILE16 hFile, SEGPTR buffer, LONG count )
329 {
330     LONG maxlen;
331
332     TRACE("%d %08lx %ld\n", hFile, (DWORD)buffer, count );
333
334     /* Some programs pass a count larger than the allocated buffer */
335     maxlen = GetSelectorLimit16( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1;
336     if (count > maxlen) count = maxlen;
337     return _lread((HFILE)DosFileHandleToWin32Handle(hFile), MapSL(buffer), count );
338 }
339
340
341 /***********************************************************************
342  *           _lread (KERNEL.82)
343  */
344 UINT16 WINAPI WIN16_lread( HFILE16 hFile, SEGPTR buffer, UINT16 count )
345 {
346     return (UINT16)WIN16_hread( hFile, buffer, (LONG)count );
347 }
348
349
350 /***********************************************************************
351  *           GetTempDrive   (KERNEL.92)
352  * A closer look at krnl386.exe shows what the SDK doesn't mention:
353  *
354  * returns:
355  *   AL: driveletter
356  *   AH: ':'            - yes, some kernel code even does stosw with
357  *                            the returned AX.
358  *   DX: 1 for success
359  */
360 UINT WINAPI GetTempDrive( BYTE ignored )
361 {
362     WCHAR buffer[8];
363     BYTE ret;
364
365     if (GetTempPathW( 8, buffer )) ret = (BYTE)toupperW(buffer[0]);
366     else ret = 'C';
367     return MAKELONG( ret | (':' << 8), 1 );
368 }
369
370
371 /***********************************************************************
372  *           GetTempFileName   (KERNEL.97)
373  */
374 UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
375                                  LPSTR buffer )
376 {
377     char temppath[MAX_PATH];
378     char *prefix16 = NULL;
379     UINT16 ret;
380
381     if (!(drive & ~TF_FORCEDRIVE)) /* drive 0 means current default drive */
382     {
383         GetCurrentDirectoryA(sizeof(temppath), temppath); 
384         drive |= temppath[0];
385     }
386
387     if (drive & TF_FORCEDRIVE)
388     {
389         char    d[3];
390
391         d[0] = drive & ~TF_FORCEDRIVE;
392         d[1] = ':';
393         d[2] = '\0';
394         if (GetDriveTypeA(d) == DRIVE_NO_ROOT_DIR)
395         {
396             drive &= ~TF_FORCEDRIVE;
397             WARN("invalid drive %d specified\n", drive );
398         }
399     }
400
401     if (drive & TF_FORCEDRIVE)
402         sprintf(temppath,"%c:", drive & ~TF_FORCEDRIVE );
403     else
404         GetTempPathA( MAX_PATH, temppath );
405
406     if (prefix)
407     {
408         prefix16 = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + 2);
409         *prefix16 = '~';
410         strcpy(prefix16 + 1, prefix);
411     }
412
413     ret = GetTempFileNameA( temppath, prefix16, unique, buffer );
414
415     if (prefix16) HeapFree(GetProcessHeap(), 0, prefix16);
416     return ret;
417 }
418
419
420 /***********************************************************************
421  *           GetPrivateProfileInt   (KERNEL.127)
422  */
423 UINT16 WINAPI GetPrivateProfileInt16( LPCSTR section, LPCSTR entry,
424                                       INT16 def_val, LPCSTR filename )
425 {
426     /* we used to have some elaborate return value limitation (<= -32768 etc.)
427      * here, but Win98SE doesn't care about this at all, so I deleted it.
428      * AFAIR versions prior to Win9x had these limits, though. */
429     return (INT16)GetPrivateProfileIntA(section,entry,def_val,filename);
430 }
431
432
433 /***********************************************************************
434  *           WritePrivateProfileString   (KERNEL.129)
435  */
436 BOOL16 WINAPI WritePrivateProfileString16( LPCSTR section, LPCSTR entry,
437                                            LPCSTR string, LPCSTR filename )
438 {
439     return WritePrivateProfileStringA(section,entry,string,filename);
440 }
441
442
443 /***********************************************************************
444  *           GetWindowsDirectory   (KERNEL.134)
445  */
446 UINT16 WINAPI GetWindowsDirectory16( LPSTR path, UINT16 count )
447 {
448     return GetWindowsDirectoryA( path, count );
449 }
450
451
452 /***********************************************************************
453  *           GetSystemDirectory   (KERNEL.135)
454  */
455 UINT16 WINAPI GetSystemDirectory16( LPSTR path, UINT16 count )
456 {
457     return GetSystemDirectoryA( path, count );
458 }
459
460
461 /***********************************************************************
462  *           GetDriveType   (KERNEL.136)
463  * This function returns the type of a drive in Win16.
464  * Note that it returns DRIVE_REMOTE for CD-ROMs, since MSCDEX uses the
465  * remote drive API. The return value DRIVE_REMOTE for CD-ROMs has been
466  * verified on Win 3.11 and Windows 95. Some programs rely on it, so don't
467  * do any pseudo-clever changes.
468  */
469 UINT16 WINAPI GetDriveType16( UINT16 drive ) /* [in] number (NOT letter) of drive */
470 {
471     UINT type;
472     WCHAR root[3];
473
474     root[0] = 'A' + drive;
475     root[1] = ':';
476     root[2] = 0;
477     type = GetDriveTypeW( root );
478     if (type == DRIVE_CDROM) type = DRIVE_REMOTE;
479     else if (type == DRIVE_NO_ROOT_DIR) type = DRIVE_UNKNOWN;
480     return type;
481 }
482
483
484 /***********************************************************************
485  *           GetProfileSectionNames   (KERNEL.142)
486  */
487 WORD WINAPI GetProfileSectionNames16(LPSTR buffer, WORD size)
488
489 {
490     return GetPrivateProfileSectionNamesA(buffer,size,"win.ini");
491 }
492
493
494 /***********************************************************************
495  *           GetPrivateProfileSectionNames   (KERNEL.143)
496  */
497 WORD WINAPI GetPrivateProfileSectionNames16( LPSTR buffer, WORD size,
498                                              LPCSTR filename )
499 {
500     return GetPrivateProfileSectionNamesA(buffer,size,filename);
501 }
502
503
504 /***********************************************************************
505  *           CreateDirectory   (KERNEL.144)
506  */
507 BOOL16 WINAPI CreateDirectory16( LPCSTR path, LPVOID dummy )
508 {
509     return CreateDirectoryA( path, NULL );
510 }
511
512
513 /***********************************************************************
514  *           RemoveDirectory   (KERNEL.145)
515  */
516 BOOL16 WINAPI RemoveDirectory16( LPCSTR path )
517 {
518     return RemoveDirectoryA( path );
519 }
520
521
522 /***********************************************************************
523  *           DeleteFile   (KERNEL.146)
524  */
525 BOOL16 WINAPI DeleteFile16( LPCSTR path )
526 {
527     return DeleteFileA( path );
528 }
529
530
531 /***********************************************************************
532  *           SetHandleCount   (KERNEL.199)
533  */
534 UINT16 WINAPI SetHandleCount16( UINT16 count )
535 {
536     return SetHandleCount( count );
537 }
538
539
540 /***********************************************************************
541  *           _hread16   (KERNEL.349)
542  */
543 LONG WINAPI _hread16( HFILE16 hFile, LPVOID buffer, LONG count)
544 {
545     return _lread( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
546 }
547
548
549 /***********************************************************************
550  *           _hwrite   (KERNEL.350)
551  */
552 LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
553 {
554     return _hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
555 }
556
557
558 /***********************************************************************
559  *           WritePrivateProfileStruct (KERNEL.406)
560  */
561 BOOL16 WINAPI WritePrivateProfileStruct16 (LPCSTR section, LPCSTR key,
562                                            LPVOID buf, UINT16 bufsize, LPCSTR filename)
563 {
564     return WritePrivateProfileStructA( section, key, buf, bufsize, filename );
565 }
566
567
568 /***********************************************************************
569  *           GetPrivateProfileStruct (KERNEL.407)
570  */
571 BOOL16 WINAPI GetPrivateProfileStruct16(LPCSTR section, LPCSTR key,
572                                         LPVOID buf, UINT16 len, LPCSTR filename)
573 {
574     return GetPrivateProfileStructA( section, key, buf, len, filename );
575 }
576
577
578 /***********************************************************************
579  *           SetCurrentDirectory   (KERNEL.412)
580  */
581 BOOL16 WINAPI SetCurrentDirectory16( LPCSTR dir )
582 {
583     return SetCurrentDirectoryA( dir );
584 }
585
586
587 /*************************************************************************
588  *           FindFirstFile   (KERNEL.413)
589  */
590 HANDLE16 WINAPI FindFirstFile16( LPCSTR path, WIN32_FIND_DATAA *data )
591 {
592     HGLOBAL16 h16;
593     HANDLE handle, *ptr;
594
595     if (!(h16 = GlobalAlloc16( GMEM_MOVEABLE, sizeof(handle) ))) return INVALID_HANDLE_VALUE16;
596     ptr = GlobalLock16( h16 );
597     *ptr = handle = FindFirstFileA( path, data );
598     GlobalUnlock16( h16 );
599
600     if (handle == INVALID_HANDLE_VALUE)
601     {
602         GlobalFree16( h16 );
603         h16 = INVALID_HANDLE_VALUE16;
604     }
605     return h16;
606 }
607
608
609 /*************************************************************************
610  *           FindNextFile   (KERNEL.414)
611  */
612 BOOL16 WINAPI FindNextFile16( HANDLE16 handle, WIN32_FIND_DATAA *data )
613 {
614     HANDLE *ptr;
615     BOOL ret = FALSE;
616
617     if ((handle == INVALID_HANDLE_VALUE16) || !(ptr = GlobalLock16( handle )))
618     {
619         SetLastError( ERROR_INVALID_HANDLE );
620         return ret;
621     }
622     ret = FindNextFileA( *ptr, data );
623     GlobalUnlock16( handle );
624     return ret;
625 }
626
627
628 /*************************************************************************
629  *           FindClose   (KERNEL.415)
630  */
631 BOOL16 WINAPI FindClose16( HANDLE16 handle )
632 {
633     HANDLE *ptr;
634
635     if ((handle == INVALID_HANDLE_VALUE16) || !(ptr = GlobalLock16( handle )))
636     {
637         SetLastError( ERROR_INVALID_HANDLE );
638         return FALSE;
639     }
640     FindClose( *ptr );
641     GlobalUnlock16( handle );
642     GlobalFree16( handle );
643     return TRUE;
644 }
645
646
647 /***********************************************************************
648  *           WritePrivateProfileSection   (KERNEL.416)
649  */
650 BOOL16 WINAPI WritePrivateProfileSection16( LPCSTR section,
651                                             LPCSTR string, LPCSTR filename )
652 {
653     return WritePrivateProfileSectionA( section, string, filename );
654 }
655
656
657 /***********************************************************************
658  *           WriteProfileSection   (KERNEL.417)
659  */
660 BOOL16 WINAPI WriteProfileSection16( LPCSTR section, LPCSTR keys_n_values)
661 {
662     return WritePrivateProfileSection16( section, keys_n_values, "win.ini");
663 }
664
665
666 /***********************************************************************
667  *           GetPrivateProfileSection   (KERNEL.418)
668  */
669 INT16 WINAPI GetPrivateProfileSection16( LPCSTR section, LPSTR buffer,
670                                          UINT16 len, LPCSTR filename )
671 {
672     return GetPrivateProfileSectionA( section, buffer, len, filename );
673 }
674
675
676 /***********************************************************************
677  *           GetProfileSection   (KERNEL.419)
678  */
679 INT16 WINAPI GetProfileSection16( LPCSTR section, LPSTR buffer, UINT16 len )
680 {
681     return GetPrivateProfileSection16( section, buffer, len, "win.ini" );
682 }
683
684
685 /**************************************************************************
686  *           GetFileAttributes   (KERNEL.420)
687  */
688 DWORD WINAPI GetFileAttributes16( LPCSTR name )
689 {
690     return GetFileAttributesA( name );
691 }
692
693
694 /**************************************************************************
695  *              SetFileAttributes       (KERNEL.421)
696  */
697 BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes )
698 {
699     return SetFileAttributesA( lpFileName, attributes );
700 }
701
702
703 /***********************************************************************
704  *           GetDiskFreeSpace   (KERNEL.422)
705  */
706 BOOL16 WINAPI GetDiskFreeSpace16( LPCSTR root, LPDWORD cluster_sectors,
707                                   LPDWORD sector_bytes, LPDWORD free_clusters,
708                                   LPDWORD total_clusters )
709 {
710     return GetDiskFreeSpaceA( root, cluster_sectors, sector_bytes,
711                                 free_clusters, total_clusters );
712 }