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 HeapFree( GetProcessHeap(), 0, data );
561 if (ret != size - 2) break;
562 /* overflow, try again */
564 HeapFree( GetProcessHeap(), 0, data );
570 char *p = strchr( src, '=' );
572 if (!p) p = src + strlen(src);
575 memcpy( buffer, src, p - src );
578 len -= (p - src) + 1;
579 src += strlen(src) + 1;
583 memcpy( buffer, src, len );
588 HeapFree( GetProcessHeap(), 0, data );
603 return GetPrivateProfileStringA( section, entry, def_val, buffer, len, filename );
607 /***********************************************************************
608 * WritePrivateProfileString (KERNEL.129)
610 BOOL16 WINAPI WritePrivateProfileString16( LPCSTR section, LPCSTR entry,
611 LPCSTR string, LPCSTR filename )
613 return WritePrivateProfileStringA(section,entry,string,filename);
617 /***********************************************************************
618 * GetWindowsDirectory (KERNEL.134)
620 UINT16 WINAPI GetWindowsDirectory16( LPSTR path, UINT16 count )
622 return GetWindowsDirectoryA( path, count );
626 /***********************************************************************
627 * GetSystemDirectory (KERNEL.135)
629 UINT16 WINAPI GetSystemDirectory16( LPSTR path, UINT16 count )
631 return GetSystemDirectoryA( path, count );
635 /***********************************************************************
636 * GetDriveType (KERNEL.136)
637 * Get the type of a drive in Win16.
640 * The type of the Drive. For a list see GetDriveTypeW from kernel32.
643 * Note that it returns DRIVE_REMOTE for CD-ROMs, since MSCDEX uses the
644 * remote drive API. The return value DRIVE_REMOTE for CD-ROMs has been
645 * verified on Win 3.11 and Windows 95. Some programs rely on it, so don't
646 * do any pseudo-clever changes.
648 UINT16 WINAPI GetDriveType16( UINT16 drive ) /* [in] number (NOT letter) of drive */
653 root[0] = 'A' + drive;
656 type = GetDriveTypeW( root );
657 if (type == DRIVE_CDROM) type = DRIVE_REMOTE;
658 else if (type == DRIVE_NO_ROOT_DIR) type = DRIVE_UNKNOWN;
663 /***********************************************************************
664 * GetProfileSectionNames (KERNEL.142)
666 WORD WINAPI GetProfileSectionNames16(LPSTR buffer, WORD size)
669 return GetPrivateProfileSectionNamesA(buffer,size,"win.ini");
673 /***********************************************************************
674 * GetPrivateProfileSectionNames (KERNEL.143)
676 WORD WINAPI GetPrivateProfileSectionNames16( LPSTR buffer, WORD size,
679 return GetPrivateProfileSectionNamesA(buffer,size,filename);
683 /***********************************************************************
684 * CreateDirectory (KERNEL.144)
686 BOOL16 WINAPI CreateDirectory16( LPCSTR path, LPVOID dummy )
688 return CreateDirectoryA( path, NULL );
692 /***********************************************************************
693 * RemoveDirectory (KERNEL.145)
695 BOOL16 WINAPI RemoveDirectory16( LPCSTR path )
697 return RemoveDirectoryA( path );
701 /***********************************************************************
702 * DeleteFile (KERNEL.146)
704 BOOL16 WINAPI DeleteFile16( LPCSTR path )
706 return DeleteFileA( path );
710 /***********************************************************************
711 * SetHandleCount (KERNEL.199)
713 UINT16 WINAPI SetHandleCount16( UINT16 count )
715 return SetHandleCount( count );
719 /***********************************************************************
720 * GetShortPathName (KERNEL.274)
722 WORD WINAPI GetShortPathName16( LPCSTR longpath, LPSTR shortpath, WORD len )
724 return GetShortPathNameA( longpath, shortpath, len );
728 /***********************************************************************
729 * WriteOutProfiles (KERNEL.315)
731 void WINAPI WriteOutProfiles16(void)
733 WritePrivateProfileSectionW( NULL, NULL, NULL );
737 /***********************************************************************
738 * WritePrivateProfileStruct (KERNEL.406)
740 BOOL16 WINAPI WritePrivateProfileStruct16 (LPCSTR section, LPCSTR key,
741 LPVOID buf, UINT16 bufsize, LPCSTR filename)
743 return WritePrivateProfileStructA( section, key, buf, bufsize, filename );
747 /***********************************************************************
748 * GetPrivateProfileStruct (KERNEL.407)
750 BOOL16 WINAPI GetPrivateProfileStruct16(LPCSTR section, LPCSTR key,
751 LPVOID buf, UINT16 len, LPCSTR filename)
753 return GetPrivateProfileStructA( section, key, buf, len, filename );
757 /***********************************************************************
758 * GetCurrentDirectory (KERNEL.411)
760 UINT16 WINAPI GetCurrentDirectory16( UINT16 buflen, LPSTR buf )
762 return GetCurrentDirectoryA( buflen, buf );
766 /***********************************************************************
767 * SetCurrentDirectory (KERNEL.412)
769 BOOL16 WINAPI SetCurrentDirectory16( LPCSTR dir )
771 char fulldir[MAX_PATH];
773 if (!GetFullPathNameA( dir, MAX_PATH, fulldir, NULL )) return FALSE;
775 if (!SetCurrentDirectoryA( dir )) return FALSE;
777 if (fulldir[0] && fulldir[1] == ':')
779 TDB *pTask = GlobalLock16( GetCurrentTask() );
780 char env_var[4] = "=A:";
782 env_var[1] = fulldir[0];
783 SetEnvironmentVariableA( env_var, fulldir );
785 /* update the directory in the TDB */
788 pTask->curdrive = 0x80 | (fulldir[0] - 'A');
789 GetShortPathNameA( fulldir + 2, pTask->curdir, sizeof(pTask->curdir) );
796 /*************************************************************************
797 * FindFirstFile (KERNEL.413)
799 HANDLE16 WINAPI FindFirstFile16( LPCSTR path, WIN32_FIND_DATAA *data )
804 if (!(h16 = GlobalAlloc16( GMEM_MOVEABLE, sizeof(handle) ))) return INVALID_HANDLE_VALUE16;
805 ptr = GlobalLock16( h16 );
806 *ptr = handle = FindFirstFileA( path, data );
807 GlobalUnlock16( h16 );
809 if (handle == INVALID_HANDLE_VALUE)
812 h16 = INVALID_HANDLE_VALUE16;
818 /*************************************************************************
819 * FindNextFile (KERNEL.414)
821 BOOL16 WINAPI FindNextFile16( HANDLE16 handle, WIN32_FIND_DATAA *data )
826 if ((handle == INVALID_HANDLE_VALUE16) || !(ptr = GlobalLock16( handle )))
828 SetLastError( ERROR_INVALID_HANDLE );
831 ret = FindNextFileA( *ptr, data );
832 GlobalUnlock16( handle );
837 /*************************************************************************
838 * FindClose (KERNEL.415)
840 BOOL16 WINAPI FindClose16( HANDLE16 handle )
844 if ((handle == INVALID_HANDLE_VALUE16) || !(ptr = GlobalLock16( handle )))
846 SetLastError( ERROR_INVALID_HANDLE );
850 GlobalUnlock16( handle );
851 GlobalFree16( handle );
856 /***********************************************************************
857 * WritePrivateProfileSection (KERNEL.416)
859 BOOL16 WINAPI WritePrivateProfileSection16( LPCSTR section,
860 LPCSTR string, LPCSTR filename )
862 return WritePrivateProfileSectionA( section, string, filename );
866 /***********************************************************************
867 * WriteProfileSection (KERNEL.417)
869 BOOL16 WINAPI WriteProfileSection16( LPCSTR section, LPCSTR keys_n_values)
871 return WritePrivateProfileSection16( section, keys_n_values, "win.ini");
875 /***********************************************************************
876 * GetPrivateProfileSection (KERNEL.418)
878 INT16 WINAPI GetPrivateProfileSection16( LPCSTR section, LPSTR buffer,
879 UINT16 len, LPCSTR filename )
881 return GetPrivateProfileSectionA( section, buffer, len, filename );
885 /***********************************************************************
886 * GetProfileSection (KERNEL.419)
888 INT16 WINAPI GetProfileSection16( LPCSTR section, LPSTR buffer, UINT16 len )
890 return GetPrivateProfileSection16( section, buffer, len, "win.ini" );
894 /**************************************************************************
895 * GetFileAttributes (KERNEL.420)
897 DWORD WINAPI GetFileAttributes16( LPCSTR name )
899 return GetFileAttributesA( name );
903 /**************************************************************************
904 * SetFileAttributes (KERNEL.421)
906 BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes )
908 return SetFileAttributesA( lpFileName, attributes );
912 /***********************************************************************
913 * GetDiskFreeSpace (KERNEL.422)
915 BOOL16 WINAPI GetDiskFreeSpace16( LPCSTR root, LPDWORD cluster_sectors,
916 LPDWORD sector_bytes, LPDWORD free_clusters,
917 LPDWORD total_clusters )
919 return GetDiskFreeSpaceA( root, cluster_sectors, sector_bytes,
920 free_clusters, total_clusters );
923 /***********************************************************************
924 * FileCDR (KERNEL.130)
926 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
928 FIXME("(%p): stub\n", x);
929 return (FARPROC16)TRUE;