2 * File handling functions
4 * Copyright 1993 John Burton
5 * Copyright 1996 Alexandre Julliard
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 * Fix the CopyFileEx methods to implement the "extended" functionality.
23 * Right now, they simply call the CopyFile method.
27 #include "wine/port.h"
33 #define NONAMELESSUNION
34 #define NONAMELESSSTRUCT
39 #include "wine/winbase16.h"
40 #include "kernel16_private.h"
41 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(file);
46 #define DOS_TABLE_SIZE 256
48 static HANDLE dos_handles[DOS_TABLE_SIZE];
50 /***********************************************************************
51 * FILE_InitProcessDosHandles
53 * Allocates the default DOS handles for a process. Called either by
54 * Win32HandleToDosFileHandle below or by the DOSVM stuff.
56 static void FILE_InitProcessDosHandles( void )
58 static BOOL init_done /* = FALSE */;
59 HANDLE cp = GetCurrentProcess();
61 if (init_done) return;
63 DuplicateHandle(cp, GetStdHandle(STD_INPUT_HANDLE), cp, &dos_handles[0],
64 0, TRUE, DUPLICATE_SAME_ACCESS);
65 DuplicateHandle(cp, GetStdHandle(STD_OUTPUT_HANDLE), cp, &dos_handles[1],
66 0, TRUE, DUPLICATE_SAME_ACCESS);
67 DuplicateHandle(cp, GetStdHandle(STD_ERROR_HANDLE), cp, &dos_handles[2],
68 0, TRUE, DUPLICATE_SAME_ACCESS);
69 DuplicateHandle(cp, GetStdHandle(STD_ERROR_HANDLE), cp, &dos_handles[3],
70 0, TRUE, DUPLICATE_SAME_ACCESS);
71 DuplicateHandle(cp, GetStdHandle(STD_ERROR_HANDLE), cp, &dos_handles[4],
72 0, TRUE, DUPLICATE_SAME_ACCESS);
75 /***********************************************************************
76 * DosFileHandleToWin32Handle (KERNEL32.20)
78 * Return the Win32 handle for a DOS handle.
80 * Note: this is not exactly right, since on Win95 the Win32 handles
81 * are on top of DOS handles and we do it the other way
82 * around. Should be good enough though.
84 HANDLE WINAPI DosFileHandleToWin32Handle( HFILE handle )
86 HFILE16 hfile = (HFILE16)handle;
87 if (hfile < 5) FILE_InitProcessDosHandles();
88 if ((hfile >= DOS_TABLE_SIZE) || !dos_handles[hfile])
90 SetLastError( ERROR_INVALID_HANDLE );
91 return INVALID_HANDLE_VALUE;
93 return dos_handles[hfile];
96 /***********************************************************************
97 * Win32HandleToDosFileHandle (KERNEL32.21)
99 * Allocate a DOS handle for a Win32 handle. The Win32 handle is no
100 * longer valid after this function (even on failure).
102 * Note: this is not exactly right, since on Win95 the Win32 handles
103 * are on top of DOS handles and we do it the other way
104 * around. Should be good enough though.
106 HFILE WINAPI Win32HandleToDosFileHandle( HANDLE handle )
110 if (!handle || (handle == INVALID_HANDLE_VALUE))
113 FILE_InitProcessDosHandles();
114 for (i = 0; i < DOS_TABLE_SIZE; i++)
117 dos_handles[i] = handle;
118 TRACE("Got %d for h32 %p\n", i, handle );
121 CloseHandle( handle );
122 SetLastError( ERROR_TOO_MANY_OPEN_FILES );
126 /***********************************************************************
127 * DisposeLZ32Handle (KERNEL32.22)
129 * Note: this is not entirely correct, we should only close the
130 * 32-bit handle and not the 16-bit one, but we cannot do
131 * this because of the way our DOS handles are implemented.
132 * It shouldn't break anything though.
134 void WINAPI DisposeLZ32Handle( HANDLE handle )
138 if (!handle || (handle == INVALID_HANDLE_VALUE)) return;
140 for (i = 5; i < DOS_TABLE_SIZE; i++)
141 if (dos_handles[i] == handle)
144 CloseHandle( handle );
149 /***********************************************************************
150 * GetProfileInt (KERNEL.57)
152 UINT16 WINAPI GetProfileInt16( LPCSTR section, LPCSTR entry, INT16 def_val )
154 return GetPrivateProfileInt16( section, entry, def_val, "win.ini" );
158 /***********************************************************************
159 * GetProfileString (KERNEL.58)
161 INT16 WINAPI GetProfileString16( LPCSTR section, LPCSTR entry, LPCSTR def_val,
162 LPSTR buffer, UINT16 len )
164 return GetPrivateProfileString16( section, entry, def_val,
165 buffer, len, "win.ini" );
169 /***********************************************************************
170 * WriteProfileString (KERNEL.59)
172 BOOL16 WINAPI WriteProfileString16( LPCSTR section, LPCSTR entry,
175 return WritePrivateProfileString16( section, entry, string, "win.ini" );
179 /* get the search path for the current module; helper for OpenFile16 */
180 static char *get_search_path(void)
183 char *ret, *p, module[OFS_MAXPATHNAME];
186 if (GetCurrentTask() && GetModuleFileName16( GetCurrentTask(), module, sizeof(module) ))
188 if (!(p = strrchr( module, '\\' ))) p = module;
192 len = (2 + /* search order: first current dir */
193 GetSystemDirectoryA( NULL, 0 ) + 1 + /* then system dir */
194 GetWindowsDirectoryA( NULL, 0 ) + 1 + /* then windows dir */
195 strlen( module ) + 1 + /* then module path */
196 GetEnvironmentVariableA( "PATH", NULL, 0 ) + 1); /* then look in PATH */
197 if (!(ret = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL;
200 GetSystemDirectoryA( p, ret + len - p );
203 GetWindowsDirectoryA( p, ret + len - p );
212 GetEnvironmentVariableA( "PATH", p, ret + len - p );
216 /***********************************************************************
217 * OpenFile (KERNEL.74)
218 * OpenFileEx (KERNEL.360)
220 HFILE16 WINAPI OpenFile16( LPCSTR name, OFSTRUCT *ofs, UINT16 mode )
225 WORD filedatetime[2];
226 const char *p, *filename;
228 if (!ofs) return HFILE_ERROR;
230 TRACE("%s %s %s %s%s%s%s%s%s%s%s%s\n",debugstr_a(name),
231 ((mode & 0x3 )==OF_READ)?"OF_READ":
232 ((mode & 0x3 )==OF_WRITE)?"OF_WRITE":
233 ((mode & 0x3 )==OF_READWRITE)?"OF_READWRITE":"unknown",
234 ((mode & 0x70 )==OF_SHARE_COMPAT)?"OF_SHARE_COMPAT":
235 ((mode & 0x70 )==OF_SHARE_DENY_NONE)?"OF_SHARE_DENY_NONE":
236 ((mode & 0x70 )==OF_SHARE_DENY_READ)?"OF_SHARE_DENY_READ":
237 ((mode & 0x70 )==OF_SHARE_DENY_WRITE)?"OF_SHARE_DENY_WRITE":
238 ((mode & 0x70 )==OF_SHARE_EXCLUSIVE)?"OF_SHARE_EXCLUSIVE":"unknown",
239 ((mode & OF_PARSE )==OF_PARSE)?"OF_PARSE ":"",
240 ((mode & OF_DELETE )==OF_DELETE)?"OF_DELETE ":"",
241 ((mode & OF_VERIFY )==OF_VERIFY)?"OF_VERIFY ":"",
242 ((mode & OF_SEARCH )==OF_SEARCH)?"OF_SEARCH ":"",
243 ((mode & OF_CANCEL )==OF_CANCEL)?"OF_CANCEL ":"",
244 ((mode & OF_CREATE )==OF_CREATE)?"OF_CREATE ":"",
245 ((mode & OF_PROMPT )==OF_PROMPT)?"OF_PROMPT ":"",
246 ((mode & OF_EXIST )==OF_EXIST)?"OF_EXIST ":"",
247 ((mode & OF_REOPEN )==OF_REOPEN)?"OF_REOPEN ":""
252 OpenFile( name, ofs, mode );
256 if (mode & OF_CREATE)
258 handle = (HANDLE)OpenFile( name, ofs, mode );
259 if (handle == (HANDLE)HFILE_ERROR) goto error;
263 ofs->cBytes = sizeof(OFSTRUCT);
265 if (mode & OF_REOPEN) name = ofs->szPathName;
267 if (!name) return HFILE_ERROR;
269 /* the watcom 10.6 IDE relies on a valid path returned in ofs->szPathName
270 Are there any cases where getting the path here is wrong?
271 Uwe Bonnes 1997 Apr 2 */
272 if (!GetFullPathNameA( name, sizeof(ofs->szPathName), ofs->szPathName, NULL )) goto error;
274 /* If OF_SEARCH is set, ignore the given path */
277 if ((mode & OF_SEARCH) && !(mode & OF_REOPEN))
279 /* First try the file name as is */
280 if (GetFileAttributesA( filename ) != INVALID_FILE_ATTRIBUTES) filename = NULL;
283 /* Now remove the path */
284 if (filename[0] && (filename[1] == ':')) filename += 2;
285 if ((p = strrchr( filename, '\\' ))) filename = p + 1;
286 if ((p = strrchr( filename, '/' ))) filename = p + 1;
289 SetLastError( ERROR_FILE_NOT_FOUND );
295 /* Now look for the file */
300 char *path = get_search_path();
302 if (!path) goto error;
303 found = SearchPathA( path, filename, NULL, sizeof(ofs->szPathName),
304 ofs->szPathName, NULL );
305 HeapFree( GetProcessHeap(), 0, path );
306 if (!found) goto error;
309 TRACE("found %s\n", debugstr_a(ofs->szPathName) );
311 if (mode & OF_DELETE)
313 if (!DeleteFileA( ofs->szPathName )) goto error;
314 TRACE("(%s): OF_DELETE return = OK\n", name);
318 handle = (HANDLE)_lopen( ofs->szPathName, mode );
319 if (handle == INVALID_HANDLE_VALUE) goto error;
321 GetFileTime( handle, NULL, NULL, &filetime );
322 FileTimeToDosDateTime( &filetime, &filedatetime[0], &filedatetime[1] );
323 if ((mode & OF_VERIFY) && (mode & OF_REOPEN))
325 if (ofs->Reserved1 != filedatetime[0] || ofs->Reserved2 != filedatetime[1] )
327 CloseHandle( handle );
328 WARN("(%s): OF_VERIFY failed\n", name );
329 /* FIXME: what error here? */
330 SetLastError( ERROR_FILE_NOT_FOUND );
334 ofs->Reserved1 = filedatetime[0];
335 ofs->Reserved2 = filedatetime[1];
338 TRACE("(%s): OK, return = %p\n", name, handle );
339 hFileRet = Win32HandleToDosFileHandle( handle );
340 if (hFileRet == HFILE_ERROR16) goto error;
341 if (mode & OF_EXIST) _lclose16( hFileRet ); /* Return the handle, but close it first */
344 error: /* We get here if there was an error opening the file */
345 ofs->nErrCode = GetLastError();
346 WARN("(%s): return = HFILE_ERROR error= %d\n", name,ofs->nErrCode );
347 return HFILE_ERROR16;
351 /***********************************************************************
352 * _lclose (KERNEL.81)
354 HFILE16 WINAPI _lclose16( HFILE16 hFile )
356 if ((hFile >= DOS_TABLE_SIZE) || !dos_handles[hFile])
358 SetLastError( ERROR_INVALID_HANDLE );
359 return HFILE_ERROR16;
361 TRACE("%d (handle32=%p)\n", hFile, dos_handles[hFile] );
362 CloseHandle( dos_handles[hFile] );
363 dos_handles[hFile] = 0;
367 /***********************************************************************
368 * _lcreat (KERNEL.83)
370 HFILE16 WINAPI _lcreat16( LPCSTR path, INT16 attr )
372 return Win32HandleToDosFileHandle( (HANDLE)_lcreat( path, attr ) );
375 /***********************************************************************
376 * _llseek (KERNEL.84)
379 * Seeking before the start of the file should be allowed for _llseek16,
380 * but cause subsequent I/O operations to fail (cf. interrupt list)
383 LONG WINAPI _llseek16( HFILE16 hFile, LONG lOffset, INT16 nOrigin )
385 return SetFilePointer( DosFileHandleToWin32Handle(hFile), lOffset, NULL, nOrigin );
389 /***********************************************************************
392 HFILE16 WINAPI _lopen16( LPCSTR path, INT16 mode )
394 return Win32HandleToDosFileHandle( (HANDLE)_lopen( path, mode ) );
398 /***********************************************************************
399 * _lread16 (KERNEL.82)
401 UINT16 WINAPI _lread16( HFILE16 hFile, LPVOID buffer, UINT16 count )
403 return (UINT16)_lread((HFILE)DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
407 /***********************************************************************
408 * _lwrite (KERNEL.86)
410 UINT16 WINAPI _lwrite16( HFILE16 hFile, LPCSTR buffer, UINT16 count )
412 return (UINT16)_hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, (LONG)count );
415 /***********************************************************************
416 * _hread (KERNEL.349)
418 LONG WINAPI WIN16_hread( HFILE16 hFile, SEGPTR buffer, LONG count )
422 TRACE("%d %08x %d\n", hFile, (DWORD)buffer, count );
424 /* Some programs pass a count larger than the allocated buffer */
425 maxlen = GetSelectorLimit16( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1;
426 if (count > maxlen) count = maxlen;
427 return _lread((HFILE)DosFileHandleToWin32Handle(hFile), MapSL(buffer), count );
431 /***********************************************************************
434 UINT16 WINAPI WIN16_lread( HFILE16 hFile, SEGPTR buffer, UINT16 count )
436 return (UINT16)WIN16_hread( hFile, buffer, (LONG)count );
440 /***********************************************************************
441 * _hwrite (KERNEL.350)
443 LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
445 return _hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
449 /***********************************************************************
450 * GetTempDrive (KERNEL.92)
451 * A closer look at krnl386.exe shows what the SDK doesn't mention:
455 * AH: ':' - yes, some kernel code even does stosw with
459 UINT WINAPI GetTempDrive( BYTE ignored )
464 if (GetTempPathW( 8, buffer )) ret = (BYTE)toupperW(buffer[0]);
466 return MAKELONG( ret | (':' << 8), 1 );
470 /***********************************************************************
471 * GetTempFileName (KERNEL.97)
473 UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
476 char temppath[MAX_PATH];
477 char *prefix16 = NULL;
480 if (!(drive & ~TF_FORCEDRIVE)) /* drive 0 means current default drive */
482 GetCurrentDirectoryA(sizeof(temppath), temppath);
483 drive |= temppath[0];
486 if (drive & TF_FORCEDRIVE)
490 d[0] = drive & ~TF_FORCEDRIVE;
493 if (GetDriveTypeA(d) == DRIVE_NO_ROOT_DIR)
495 drive &= ~TF_FORCEDRIVE;
496 WARN("invalid drive %d specified\n", drive );
500 if (drive & TF_FORCEDRIVE)
501 sprintf(temppath,"%c:", drive & ~TF_FORCEDRIVE );
503 GetTempPathA( MAX_PATH, temppath );
507 prefix16 = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + 2);
509 strcpy(prefix16 + 1, prefix);
512 ret = GetTempFileNameA( temppath, prefix16, unique, buffer );
514 HeapFree(GetProcessHeap(), 0, prefix16);
519 /***********************************************************************
520 * GetPrivateProfileInt (KERNEL.127)
522 UINT16 WINAPI GetPrivateProfileInt16( LPCSTR section, LPCSTR entry,
523 INT16 def_val, LPCSTR filename )
525 /* we used to have some elaborate return value limitation (<= -32768 etc.)
526 * here, but Win98SE doesn't care about this at all, so I deleted it.
527 * AFAIR versions prior to Win9x had these limits, though. */
528 return (INT16)GetPrivateProfileIntA(section,entry,def_val,filename);
532 /***********************************************************************
533 * GetPrivateProfileString (KERNEL.128)
535 INT16 WINAPI GetPrivateProfileString16( LPCSTR section, LPCSTR entry,
536 LPCSTR def_val, LPSTR buffer,
537 UINT16 len, LPCSTR filename )
541 if (buffer && len) buffer[0] = 0;
546 /* We have to return the list of keys in the section but without the values
547 * so we need to massage the results of GetPrivateProfileSectionA.
549 UINT ret, oldlen = len, size = min( len, 1024 );
554 if (!(data = HeapAlloc(GetProcessHeap(), 0, size ))) return 0;
555 ret = GetPrivateProfileSectionA( section, data, size, filename );
558 if (len) *buffer = 0;
559 HeapFree( GetProcessHeap(), 0, data );
562 if (ret != size - 2) break;
563 /* overflow, try again */
565 HeapFree( GetProcessHeap(), 0, data );
571 char *p = strchr( src, '=' );
573 if (!p) p = src + strlen(src);
576 memcpy( buffer, src, p - src );
579 len -= (p - src) + 1;
580 src += strlen(src) + 1;
584 memcpy( buffer, src, len );
589 HeapFree( GetProcessHeap(), 0, data );
604 return GetPrivateProfileStringA( section, entry, def_val, buffer, len, filename );
608 /***********************************************************************
609 * WritePrivateProfileString (KERNEL.129)
611 BOOL16 WINAPI WritePrivateProfileString16( LPCSTR section, LPCSTR entry,
612 LPCSTR string, LPCSTR filename )
614 return WritePrivateProfileStringA(section,entry,string,filename);
618 /***********************************************************************
619 * GetWindowsDirectory (KERNEL.134)
621 UINT16 WINAPI GetWindowsDirectory16( LPSTR path, UINT16 count )
623 return GetWindowsDirectoryA( path, count );
627 /***********************************************************************
628 * GetSystemDirectory (KERNEL.135)
630 UINT16 WINAPI GetSystemDirectory16( LPSTR path, UINT16 count )
632 return GetSystemDirectoryA( path, count );
636 /***********************************************************************
637 * GetDriveType (KERNEL.136)
638 * Get the type of a drive in Win16.
641 * The type of the Drive. For a list see GetDriveTypeW from kernel32.
644 * Note that it returns DRIVE_REMOTE for CD-ROMs, since MSCDEX uses the
645 * remote drive API. The return value DRIVE_REMOTE for CD-ROMs has been
646 * verified on Win 3.11 and Windows 95. Some programs rely on it, so don't
647 * do any pseudo-clever changes.
649 UINT16 WINAPI GetDriveType16( UINT16 drive ) /* [in] number (NOT letter) of drive */
654 root[0] = 'A' + drive;
657 type = GetDriveTypeW( root );
658 if (type == DRIVE_CDROM) type = DRIVE_REMOTE;
659 else if (type == DRIVE_NO_ROOT_DIR) type = DRIVE_UNKNOWN;
664 /***********************************************************************
665 * GetProfileSectionNames (KERNEL.142)
667 WORD WINAPI GetProfileSectionNames16(LPSTR buffer, WORD size)
670 return GetPrivateProfileSectionNamesA(buffer,size,"win.ini");
674 /***********************************************************************
675 * GetPrivateProfileSectionNames (KERNEL.143)
677 WORD WINAPI GetPrivateProfileSectionNames16( LPSTR buffer, WORD size,
680 return GetPrivateProfileSectionNamesA(buffer,size,filename);
684 /***********************************************************************
685 * CreateDirectory (KERNEL.144)
687 BOOL16 WINAPI CreateDirectory16( LPCSTR path, LPVOID dummy )
689 return CreateDirectoryA( path, NULL );
693 /***********************************************************************
694 * RemoveDirectory (KERNEL.145)
696 BOOL16 WINAPI RemoveDirectory16( LPCSTR path )
698 return RemoveDirectoryA( path );
702 /***********************************************************************
703 * DeleteFile (KERNEL.146)
705 BOOL16 WINAPI DeleteFile16( LPCSTR path )
707 return DeleteFileA( path );
711 /***********************************************************************
712 * SetHandleCount (KERNEL.199)
714 UINT16 WINAPI SetHandleCount16( UINT16 count )
716 return SetHandleCount( count );
720 /***********************************************************************
721 * GetShortPathName (KERNEL.274)
723 WORD WINAPI GetShortPathName16( LPCSTR longpath, LPSTR shortpath, WORD len )
725 return GetShortPathNameA( longpath, shortpath, len );
729 /***********************************************************************
730 * WriteOutProfiles (KERNEL.315)
732 void WINAPI WriteOutProfiles16(void)
734 WritePrivateProfileSectionW( NULL, NULL, NULL );
738 /***********************************************************************
739 * WritePrivateProfileStruct (KERNEL.406)
741 BOOL16 WINAPI WritePrivateProfileStruct16 (LPCSTR section, LPCSTR key,
742 LPVOID buf, UINT16 bufsize, LPCSTR filename)
744 return WritePrivateProfileStructA( section, key, buf, bufsize, filename );
748 /***********************************************************************
749 * GetPrivateProfileStruct (KERNEL.407)
751 BOOL16 WINAPI GetPrivateProfileStruct16(LPCSTR section, LPCSTR key,
752 LPVOID buf, UINT16 len, LPCSTR filename)
754 return GetPrivateProfileStructA( section, key, buf, len, filename );
758 /***********************************************************************
759 * GetCurrentDirectory (KERNEL.411)
761 UINT16 WINAPI GetCurrentDirectory16( UINT16 buflen, LPSTR buf )
763 return GetCurrentDirectoryA( buflen, buf );
767 /***********************************************************************
768 * SetCurrentDirectory (KERNEL.412)
770 BOOL16 WINAPI SetCurrentDirectory16( LPCSTR dir )
772 char fulldir[MAX_PATH];
774 if (!GetFullPathNameA( dir, MAX_PATH, fulldir, NULL )) return FALSE;
776 if (!SetCurrentDirectoryA( dir )) return FALSE;
778 if (fulldir[0] && fulldir[1] == ':')
780 TDB *pTask = GlobalLock16( GetCurrentTask() );
781 char env_var[4] = "=A:";
783 env_var[1] = fulldir[0];
784 SetEnvironmentVariableA( env_var, fulldir );
786 /* update the directory in the TDB */
789 pTask->curdrive = 0x80 | (fulldir[0] - 'A');
790 GetShortPathNameA( fulldir + 2, pTask->curdir, sizeof(pTask->curdir) );
797 /*************************************************************************
798 * FindFirstFile (KERNEL.413)
800 HANDLE16 WINAPI FindFirstFile16( LPCSTR path, WIN32_FIND_DATAA *data )
805 if (!(h16 = GlobalAlloc16( GMEM_MOVEABLE, sizeof(handle) ))) return INVALID_HANDLE_VALUE16;
806 ptr = GlobalLock16( h16 );
807 *ptr = handle = FindFirstFileA( path, data );
808 GlobalUnlock16( h16 );
810 if (handle == INVALID_HANDLE_VALUE)
813 h16 = INVALID_HANDLE_VALUE16;
819 /*************************************************************************
820 * FindNextFile (KERNEL.414)
822 BOOL16 WINAPI FindNextFile16( HANDLE16 handle, WIN32_FIND_DATAA *data )
827 if ((handle == INVALID_HANDLE_VALUE16) || !(ptr = GlobalLock16( handle )))
829 SetLastError( ERROR_INVALID_HANDLE );
832 ret = FindNextFileA( *ptr, data );
833 GlobalUnlock16( handle );
838 /*************************************************************************
839 * FindClose (KERNEL.415)
841 BOOL16 WINAPI FindClose16( HANDLE16 handle )
845 if ((handle == INVALID_HANDLE_VALUE16) || !(ptr = GlobalLock16( handle )))
847 SetLastError( ERROR_INVALID_HANDLE );
851 GlobalUnlock16( handle );
852 GlobalFree16( handle );
857 /***********************************************************************
858 * WritePrivateProfileSection (KERNEL.416)
860 BOOL16 WINAPI WritePrivateProfileSection16( LPCSTR section,
861 LPCSTR string, LPCSTR filename )
863 return WritePrivateProfileSectionA( section, string, filename );
867 /***********************************************************************
868 * WriteProfileSection (KERNEL.417)
870 BOOL16 WINAPI WriteProfileSection16( LPCSTR section, LPCSTR keys_n_values)
872 return WritePrivateProfileSection16( section, keys_n_values, "win.ini");
876 /***********************************************************************
877 * GetPrivateProfileSection (KERNEL.418)
879 INT16 WINAPI GetPrivateProfileSection16( LPCSTR section, LPSTR buffer,
880 UINT16 len, LPCSTR filename )
882 return GetPrivateProfileSectionA( section, buffer, len, filename );
886 /***********************************************************************
887 * GetProfileSection (KERNEL.419)
889 INT16 WINAPI GetProfileSection16( LPCSTR section, LPSTR buffer, UINT16 len )
891 return GetPrivateProfileSection16( section, buffer, len, "win.ini" );
895 /**************************************************************************
896 * GetFileAttributes (KERNEL.420)
898 DWORD WINAPI GetFileAttributes16( LPCSTR name )
900 return GetFileAttributesA( name );
904 /**************************************************************************
905 * SetFileAttributes (KERNEL.421)
907 BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes )
909 return SetFileAttributesA( lpFileName, attributes );
913 /***********************************************************************
914 * GetDiskFreeSpace (KERNEL.422)
916 BOOL16 WINAPI GetDiskFreeSpace16( LPCSTR root, LPDWORD cluster_sectors,
917 LPDWORD sector_bytes, LPDWORD free_clusters,
918 LPDWORD total_clusters )
920 return GetDiskFreeSpaceA( root, cluster_sectors, sector_bytes,
921 free_clusters, total_clusters );
924 /***********************************************************************
925 * FileCDR (KERNEL.130)
927 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
929 FIXME("(%p): stub\n", x);
930 return (FARPROC16)TRUE;